mirror of
https://github.com/actionbook/actionbook.git
synced 2026-09-19 03:28:06 +08:00
93caf967e0
* [packages/dify-plugin]feat: add Dify plugin for browser automation - Implement search_actions and get_action_by_area_id tools - Support API key authentication via Dify plugin SDK - Add comprehensive tests (34 tests, 99% coverage) - Add documentation (README, PRIVACY) - Phase 1: Query action manuals via API Tools: - search_actions: Find website elements by keyword/domain filter - get_action_by_area_id: Get complete selector details by area ID Testing: - Unit tests: provider, search_actions, get_action_by_area_id - Coverage: 99% (412 statements, 3 missed) - Linting: ruff with zero errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/dify-plugin]fix: align SDK interface, fix API issues and improve reliability - Fix API endpoint and parameter alignment with Actionbook API - Align with Dify SDK interface (provider structure, tool signatures) - Restructure provider: replace provider.yaml with provider/ package - Add test infrastructure: unit tests, integration tests, E2E checklist - Improve error handling and remove legacy provider.yaml - Resolve empty response issue in Dify Cloud - Pin dify-plugin>=0.5.1,<0.6.0 to prevent breaking changes - Add *.difypkg, .coverage, .alma-snapshots to root .gitignore * [packages/dify-plugin]fix: address code review issues in source code - C4: Add insecure CDP URL warning for non-localhost ws:// connections - C5: Replace print(stderr) with proper logger in search/get tools - C6: Re-raise exception after logging in HyperbrowserSession.stop() - W8: Make API_BASE_URL configurable via ACTIONBOOK_API_URL env var - W-limit: Fix float limit validation with int() cast - W-except: Narrow bare Exception to PlaywrightTimeout in operator - W-use_proxy: Fix bool comparison for string/bool/whitespace inputs - W7: Document _get_active_page tab selection behavior - Fix type annotation in providers/__init__.py - Update misleading comment in provider/actionbook.py - Add cleanup warning in browser_create_session.yaml * [packages/dify-plugin]fix: correct integration tests to match tool behavior Tools yield error messages instead of raising exceptions. Fix tests that incorrectly used pytest.raises(ValueError) to instead assert on the returned message content. * [packages/dify-plugin]test: add missing unit tests for improved coverage - New test_browser_stop_session.py (6 tests) - Add HTTP 403, SSL/connection error branch tests for search/get tools - Add use_proxy edge cases and default provider tests - Add malformed cdp_url test for browser operator - Add insecure CDP URL warning tests - Update operator tests for PlaywrightTimeout narrowing - Add provider re-raise test 184 tests pass at 86% coverage. * [packages/dify-plugin]test: add E2E browser tests with Hyperbrowser - Add verify_hyperbrowser.py manual verification script - Add 8 E2E tests: tool wrappers (create/stop/navigate/screenshot) and Playwright direct (multi-step, form fill, nav history, HTML) - Add retry logic for intermittent gevent SSL errors - Add tenacity to dev dependencies Run: HYPERBROWSER_API_KEY=hb-xxx uv run pytest -m e2e -v --timeout=120 --no-cov * [packages/dify-plugin]feat: add connection pool, playwright worker and API key resolver - api_key.py: resolve provider key from params or env vars with placeholder filtering - connection_pool.py: in-process pool of browser workers keyed by session_id, using subprocess-based Playwright workers to avoid asyncio conflicts - playwright_worker.py: standalone Playwright worker process supporting CSS, XPath, and snapshot ref selectors (@eN / [ref=eN]) * [packages/dify-plugin]refactor: simplify cdp_client to URL validation only Remove CDP connection logic (cdp_page, _get_active_page, CdpConnectionError) since connections are now managed by the connection pool and playwright worker. Retain only validate_cdp_url for input validation. * [packages/dify-plugin]feat: add snapshot action, connection pool integration and improved error handling browser_operator: - Add snapshot action with accessibility tree (ported from actionbook-rs) - Replace cdp_page with connection pool for persistent sessions - Add SSRF protection for CDP URLs - Improve click/type/fill error messages with recovery hints - Remove screenshot action in favor of snapshot browser_create_session: - Integrate connection pool (pre-connect on session create) - Add profile_id fallback retry logic - Support API key from env vars via resolve_provider_api_key - Validate provider name against SUPPORTED_PROVIDERS browser_stop_session: - Disconnect pooled connection before stopping provider session - Improved error messages with troubleshooting hints hyperbrowser provider: - Add profile_id UUID normalization (uuid5 for non-UUID inputs) actionbook provider: - Add API health check in _validate_credentials * [packages/dify-plugin]fix: improve search/get_action tools with validation and fallback hints - Add area_id character validation regex to prevent injection - Add snapshot fallback guidance in tool descriptions - Reduce debug log verbosity (avoid logging raw parameters) * [packages/dify-plugin]docs: update README workflow guide, manifest version and difyignore - README: add snapshot-based recovery workflow and troubleshooting section - manifest: set version to 0.1.0 (initial release) - difyignore: add scripts/, dist/, .docs/, .DS_Store exclusions * [packages/dify-plugin]chore: remove verify_hyperbrowser script No longer needed — verification is covered by E2E tests. * [packages/dify-plugin]test: update tests for connection pool, snapshot and improved tools - Add test_connection_pool.py: pool connect/disconnect/execute lifecycle - Add test_playwright_worker.py: worker process smoke test - Add test_workflow_snapshot_recovery.py: snapshot-based selector recovery - Update browser_operator tests for snapshot action and error handling - Update browser_create/stop session tests for pool integration - Update cdp_client tests (simplified to URL validation only) - Update provider/search/get_action tests for new validation logic - Replace screenshot references with snapshot in E2E tests * [packages/dify-plugin]refactor: cache provider info in connection pool so stop_session auto-resolves credentials browser_stop_session no longer requires provider/api_key params — they are looked up from the pool via get_session_info(). api_key field in browser_create_session changed to secret-input with form-level input. * [packages/dify-plugin]docs: update README with browser tools and remove unused import - Add documentation for browser_create_session, browser_stop_session, browser_operator tools - Update features list and use cases to reflect browser automation - Remove outdated Phase 2 roadmap (already implemented) - Fix provider names (Hyperbrowser/Steel.dev, not Browserbase) - Note that browser_stop_session auto-resolves provider/api_key - Remove unused SUPPORTED_PROVIDERS import from browser_stop_session.py * [packages/dify-plugin]fix: correct YAML descriptions and add zh_Hans translations - Fix browser_create_session llm_description referencing non-existent tool names (browser_navigate → browser_operator) - Remove Steel.dev mention from descriptions (not yet available) - Update manifest description to reflect browser automation capabilities - Add proper zh_Hans translations for search_actions, get_action_by_area_id, manifest and provider YAML files * [packages/dify-plugin]fix: address CodeQL URL sanitization and logging findings * [packages/dify-plugin]fix: remove dynamic data from error logs * [packages/dify-plugin]feat: add tag-based release workflow and version sync Add automated dify-plugin release pipeline: - release.yml: tag detection (actionbook-dify-plugin-v{VERSION}) and release job that packages .difypkg via uv + creates GitHub Release - sync-versions.js: sync package.json version to manifest.yaml (root + meta.version) and pyproject.toml with exact equality checks and fail-loud on missing fields * [packages/dify-plugin]fix: handle stop/create session failure recovery * [packages/dify-plugin]fix: resolve critical review findings — deadlock, exception safety, timeout handling - Fix connection pool deadlock: move worker.stop() outside pool lock to prevent deadlock when _io_lock is held by another thread in call()/readline(). All call sites (disconnect, disconnect_all, cleanup_stale, connect eviction, get_page health check) now pop under lock and stop outside lock. - Fix BaseException swallowing: re-raise KeyboardInterrupt, SystemExit, and GeneratorExit in search_actions and get_action_by_area_id generators. Only non-Exception BaseException subclasses (e.g. gevent.Timeout) are caught. - Fix timeout exception misclassification: add WorkerTimeoutError exception class. SubprocessWorker.call() now detects timeout errors in worker responses and raises WorkerTimeoutError instead of RuntimeError, so browser_operator handlers can show proper "element not found" hints instead of generic errors. - Document SSRF DNS rebinding TOCTOU limitation in _is_ssrf_target with explanation of cloud browser architecture mitigation. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
7 lines
8.8 KiB
XML
7 lines
8.8 KiB
XML
<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<rect width="256" height="256" rx="48" fill="#0F172A"/>
|
|
<g transform="translate(28, 14.15) scale(0.8878)">
|
|
<path fill="#F8FAFC" d="M225.25 32C225.25 95.4426 225.25 158.885 225.25 224.25C224.282 223.863 223.783 223.638 223.017 223.023C222.836 222.88 222.655 222.737 222.469 222.589C222.277 222.436 222.087 222.282 221.891 222.125C220.541 221.057 219.19 220.004 217.781 219.016C216.36 218.016 214.966 216.983 213.578 215.937C211.343 214.255 209.094 212.59 206.84 210.933C205.653 210.061 204.467 209.186 203.28 208.312C202.295 207.585 201.308 206.859 200.322 206.133C198.079 204.485 195.845 202.825 193.621 201.152C191.62 199.649 189.606 198.164 187.589 196.683C186.403 195.811 185.217 194.936 184.031 194.062C183.044 193.335 182.058 192.609 181.071 191.883C178.829 190.235 176.596 188.575 174.371 186.902C172.175 185.253 169.963 183.626 167.75 182C165.33 180.222 162.913 178.439 160.513 176.634C158.637 175.224 156.746 173.835 154.856 172.446C153.664 171.569 152.473 170.69 151.281 169.812C150.295 169.086 149.308 168.359 148.322 167.634C146.079 165.985 143.845 164.324 141.621 162.652C139.62 161.15 137.606 159.665 135.589 158.184C134.403 157.311 133.217 156.436 132.031 155.561C131.044 154.836 130.058 154.109 129.071 153.384C126.831 151.736 124.599 150.077 122.375 148.405C120.529 147.018 118.674 145.644 116.81 144.282C116.159 143.806 115.517 143.321 114.885 142.819C114.645 142.632 114.404 142.443 114.157 142.249C113.958 142.09 113.761 141.93 113.557 141.766C113.015 141.44 113.015 141.44 112.434 141.601C111.429 142.186 110.546 142.898 109.641 143.625C108.271 144.709 106.898 145.777 105.469 146.782C104.239 147.647 103.029 148.532 101.828 149.438C100.366 150.539 98.8973 151.633 97.4216 152.719C97.2241 152.864 97.0257 153.011 96.8209 153.161C96.0109 153.757 95.2008 154.352 94.3908 154.948C92.3382 156.457 90.2865 157.968 88.2504 159.5C86.2125 161.033 84.1599 162.544 82.1055 164.054C80.9133 164.931 79.722 165.81 78.5306 166.687C77.545 167.414 76.5585 168.141 75.5713 168.866C73.5401 170.359 71.5152 171.86 69.5001 173.375C67.0951 175.183 64.6747 176.969 62.2501 178.75C59.9937 180.408 57.7378 182.067 55.5 183.75C53.4626 185.282 51.41 186.794 49.3559 188.305C48.1636 189.182 46.9723 190.059 45.7809 190.938C44.7949 191.665 43.8085 192.391 42.8213 193.116C40.7901 194.61 38.7652 196.11 36.75 197.625C34.5402 199.286 32.3177 200.929 30.0898 202.567C29.1008 203.294 28.113 204.021 27.125 204.75C25.9409 205.622 24.7568 206.495 23.5713 207.366C21.5401 208.859 19.5152 210.36 17.5001 211.875C15.0951 213.683 12.6747 215.468 10.2501 217.25C7.59305 219.203 4.94098 221.161 2.30564 223.144C2.16494 223.249 2.02414 223.355 1.87904 223.463C1.55648 223.707 1.23822 223.957 0.920959 224.208C0.500022 224.5 0.500023 224.5 0 224.5C0 161.057 0 97.615 0 32.25C0.967863 32.6371 1.46679 32.8616 2.23342 33.4766C2.41435 33.6199 2.5952 33.7633 2.78162 33.911C3.06761 34.1407 3.06761 34.1407 3.35936 34.3749C4.70903 35.4422 6.06016 36.496 7.4688 37.4843C8.89024 38.4839 10.2838 39.5171 11.6719 40.5625C13.9072 42.2454 16.1554 43.9098 18.4103 45.5665C19.5975 46.4391 20.7834 47.3138 21.9694 48.1881C22.9553 48.9147 23.9417 49.641 24.9287 50.3662C27.1714 52.0148 29.4043 53.6755 31.6293 55.348C33.6301 56.8506 35.6439 58.335 37.6603 59.8165C38.8475 60.6892 40.0333 61.5638 41.2194 62.438C42.2053 63.1647 43.1917 63.8909 44.1787 64.6161C46.4214 66.2648 48.6544 67.9255 50.8793 69.598C53.0751 71.2471 55.2869 72.8741 57.5001 74.4999C59.9201 76.2787 62.337 78.061 64.7372 79.8664C66.613 81.2757 68.5039 82.6647 70.3941 84.0544C71.5866 84.9313 72.7778 85.8097 73.9691 86.6879C74.9552 87.4147 75.9414 88.1409 76.9288 88.8662C79.1716 90.5147 81.4042 92.1759 83.6296 93.8481C85.6301 95.3503 87.6442 96.8351 89.6602 98.3162C90.8479 99.1894 92.0337 100.063 93.2196 100.938C94.2052 101.664 95.1917 102.391 96.1791 103.116C98.42 104.764 100.652 106.423 102.875 108.095C105.978 110.425 109.105 112.724 112.25 115C113.165 114.586 113.956 114.024 114.766 113.438C114.916 113.329 115.068 113.22 115.224 113.108C118.386 110.826 121.512 108.495 124.629 106.153C126.825 104.503 129.037 102.876 131.25 101.25C133.507 99.5917 135.762 97.9332 138 96.25C140.037 94.7176 142.09 93.2054 144.144 91.6959C145.337 90.8186 146.528 89.9402 147.719 89.062C148.705 88.3353 149.691 87.609 150.679 86.8837C152.71 85.3906 154.735 83.8897 156.75 82.3749C158.96 80.7138 161.182 79.0704 163.41 77.4334C164.399 76.7066 165.387 75.9781 166.375 75.2499C167.559 74.3771 168.743 73.5047 169.929 72.6338C171.96 71.1406 173.985 69.6398 176 68.125C178.405 66.3172 180.826 64.5312 183.25 62.75C185.507 61.0917 187.762 59.4332 190 57.7499C192.037 56.2174 194.09 54.7056 196.144 53.1955C197.337 52.3186 198.528 51.4402 199.719 50.562C200.705 49.8353 201.691 49.109 202.679 48.3837C204.71 46.8906 206.735 45.3897 208.75 43.8749C211.155 42.0672 213.575 40.2812 216 38.4999C216.807 37.9065 217.615 37.3127 218.422 36.7187C218.617 36.5755 218.811 36.4325 219.012 36.285C219.986 35.5677 220.957 34.8454 221.92 34.1133C222.105 33.9731 222.289 33.833 222.479 33.6886C222.83 33.4229 223.178 33.1563 223.525 32.8885C224.695 32 224.695 32 225.25 32ZM29.25 88.4999C29.25 113.993 29.25 139.485 29.25 165.75C30.2215 165.264 31.0039 164.69 31.8438 164.016C32.1595 163.764 32.4752 163.514 32.791 163.263C32.9513 163.136 33.1115 163.008 33.2766 162.877C33.9945 162.305 34.7159 161.738 35.4375 161.172C35.5791 161.061 35.7207 160.949 35.8666 160.834C37.2669 159.734 38.6734 158.643 40.0796 157.55C41.667 156.316 43.249 155.075 44.8286 153.832C45.552 153.262 46.2761 152.693 47 152.125C47.2917 151.896 47.5834 151.667 47.875 151.437C55.75 145.25 55.75 145.25 63.625 139.062C63.7693 138.949 63.9136 138.836 64.0623 138.719C64.3547 138.489 64.6472 138.26 64.9397 138.029C65.6567 137.466 66.3735 136.903 67.0898 136.339C68.9127 134.904 70.7414 133.477 72.5735 132.054C73.9433 130.99 75.3086 129.92 76.6683 128.843C77.2671 128.371 77.865 127.924 78.4996 127.5C78.1805 126.542 77.61 126.199 76.8283 125.625C76.5302 125.401 76.2312 125.176 75.9332 124.952C75.7791 124.836 75.6246 124.721 75.4653 124.601C74.7239 124.042 73.9948 123.466 73.2656 122.89C72.9717 122.659 72.6778 122.428 72.3838 122.196C72.2379 122.081 72.0919 121.966 71.9416 121.848C71.2116 121.273 70.4807 120.699 69.75 120.125C69.4584 119.896 69.1667 119.667 68.8751 119.437C68.7306 119.324 68.5862 119.21 68.4375 119.093C63.6251 115.313 63.625 115.313 63.1877 114.969C62.8953 114.739 62.6028 114.509 62.3103 114.28C61.5933 113.716 60.8765 113.153 60.1602 112.589C58.5275 111.304 56.8906 110.025 55.25 108.75C53.4692 107.367 51.6933 105.977 49.9214 104.582C49.198 104.012 48.474 103.444 47.75 102.875C47.4584 102.645 47.1667 102.417 46.8751 102.187C46.7306 102.074 46.5862 101.961 46.4375 101.844C43.6667 99.6666 40.8958 97.4897 38.125 95.3128C37.9805 95.1985 37.8361 95.0852 37.6873 94.9681C37.3964 94.7396 37.1056 94.511 36.8147 94.2824C36.0733 93.7 35.3318 93.1176 34.5899 92.5361C34.2891 92.3003 33.9883 92.0644 33.6875 91.8285C33.543 91.7151 33.3983 91.6014 33.2494 91.4845C32.1404 90.6138 31.0417 89.7309 29.9482 88.8408C29.5607 88.4748 29.5607 88.4748 29.25 88.4999ZM194.578 90.8281C194.433 90.9404 194.288 91.0527 194.138 91.1685C192.651 92.3231 191.171 93.487 189.691 94.6518C188.962 95.2269 188.231 95.801 187.5 96.3752C186.637 97.0536 185.773 97.732 184.911 98.4113C183.086 99.8477 181.254 101.276 179.42 102.7C177.833 103.935 176.251 105.174 174.671 106.419C173.948 106.987 173.224 107.556 172.5 108.125C172.208 108.354 171.917 108.584 171.625 108.812C155.875 121.187 155.875 121.187 155.438 121.532C155.146 121.76 154.855 121.989 154.564 122.217C153.823 122.8 153.082 123.382 152.34 123.964C151.61 124.536 150.883 125.108 150.155 125.682C149.764 125.988 149.374 126.294 148.984 126.6C148.644 126.868 148.644 126.868 148.297 127.141C148.1 127.295 147.902 127.451 147.698 127.61C147.224 127.973 147.224 127.973 147 128.5C147.194 128.649 147.388 128.797 147.588 128.95C149.506 130.42 151.41 131.906 153.308 133.402C154.039 133.977 154.769 134.551 155.5 135.125C155.791 135.354 156.083 135.583 156.375 135.812C156.519 135.926 156.664 136.04 156.813 136.156C161.625 139.937 161.625 139.937 162.063 140.281C162.355 140.511 162.648 140.741 162.939 140.97C163.657 141.534 164.374 142.097 165.09 142.661C166.723 143.946 168.359 145.226 170 146.5C171.78 147.883 173.557 149.273 175.329 150.668C176.052 151.238 176.776 151.807 177.5 152.375C177.792 152.604 178.084 152.833 178.375 153.063C178.52 153.176 178.664 153.289 178.812 153.407C181.583 155.583 184.354 157.76 187.125 159.937C187.342 160.107 187.342 160.107 187.563 160.281C187.854 160.51 188.144 160.738 188.435 160.967C189.177 161.55 189.918 162.132 190.66 162.714C190.884 162.89 190.884 162.89 191.114 163.07C191.409 163.302 191.706 163.534 192.001 163.765C193.105 164.632 194.195 165.515 195.278 166.41C195.72 166.799 195.72 166.799 196.25 166.75C196.25 141.34 196.25 115.93 196.25 89.7499C195.67 89.7499 195.035 90.4719 194.578 90.8281Z"/>
|
|
</g>
|
|
</svg>
|