tabwright 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aria-snapshot.d.ts +0 -1
- package/dist/aria-snapshot.js +9 -1
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts +0 -1
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js +0 -1
- package/dist/bippy.js +1 -1
- package/dist/browser-config.d.ts +0 -1
- package/dist/browser-config.js +0 -1
- package/dist/browser-install.d.ts +0 -1
- package/dist/browser-install.js +0 -1
- package/dist/browser-launch.d.ts +0 -1
- package/dist/browser-launch.js +0 -1
- package/dist/builtin-capabilities.d.ts +0 -1
- package/dist/builtin-capabilities.js +0 -1
- package/dist/capability-agent-skill.d.ts +0 -1
- package/dist/capability-agent-skill.js +0 -1
- package/dist/capability-auth-state.d.ts +0 -1
- package/dist/capability-auth-state.js +0 -1
- package/dist/capability-auth.d.ts +0 -1
- package/dist/capability-auth.js +0 -1
- package/dist/capability-options.d.ts +0 -1
- package/dist/capability-options.js +0 -1
- package/dist/capability-package.d.ts +0 -1
- package/dist/capability-package.js +0 -1
- package/dist/capability-registry.d.ts +0 -1
- package/dist/capability-registry.js +0 -1
- package/dist/capability-runner.d.ts +0 -1
- package/dist/capability-runner.js +0 -1
- package/dist/capability-studio.d.ts +0 -1
- package/dist/capability-studio.js +0 -1
- package/dist/cdp-log.d.ts +0 -1
- package/dist/cdp-log.js +0 -1
- package/dist/cdp-relay.d.ts +0 -1
- package/dist/cdp-relay.js +0 -1
- package/dist/cdp-session.d.ts +0 -1
- package/dist/cdp-session.js +0 -1
- package/dist/cdp-types.d.ts +0 -1
- package/dist/cdp-types.js +0 -1
- package/dist/chrome-discovery.d.ts +0 -1
- package/dist/chrome-discovery.js +0 -1
- package/dist/clean-html.d.ts +0 -1
- package/dist/clean-html.js +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +9 -2
- package/dist/cloud-client.d.ts +0 -1
- package/dist/cloud-client.js +0 -1
- package/dist/create-logger.d.ts +0 -1
- package/dist/create-logger.js +0 -1
- package/dist/debugger-examples-types.d.ts +0 -1
- package/dist/debugger-examples-types.js +0 -1
- package/dist/debugger-examples.d.ts +0 -1
- package/dist/debugger-examples.js +0 -1
- package/dist/debugger.d.ts +0 -1
- package/dist/debugger.js +0 -1
- package/dist/diff-utils.d.ts +0 -1
- package/dist/diff-utils.js +0 -1
- package/dist/doctor.d.ts +0 -1
- package/dist/doctor.js +5 -7
- package/dist/editor-examples.d.ts +0 -1
- package/dist/editor-examples.js +0 -1
- package/dist/editor.d.ts +0 -1
- package/dist/editor.js +0 -1
- package/dist/env-compat.d.ts +0 -1
- package/dist/env-compat.js +0 -1
- package/dist/executor.d.ts +0 -1
- package/dist/executor.js +1 -2
- package/dist/extension/background.js +7 -3
- package/dist/extension/manifest.json +1 -1
- package/dist/ghost-browser.d.ts +0 -1
- package/dist/ghost-browser.js +0 -1
- package/dist/ghost-cursor-controller.d.ts +0 -1
- package/dist/ghost-cursor-controller.js +0 -1
- package/dist/ghost-cursor.d.ts +0 -1
- package/dist/ghost-cursor.js +0 -1
- package/dist/htmlrewrite.d.ts +0 -1
- package/dist/htmlrewrite.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/kill-port.d.ts +0 -1
- package/dist/kill-port.js +0 -1
- package/dist/kitty-graphics.d.ts +0 -1
- package/dist/kitty-graphics.js +0 -1
- package/dist/mcp.d.ts +0 -1
- package/dist/mcp.js +0 -1
- package/dist/package-paths.d.ts +0 -1
- package/dist/package-paths.js +0 -1
- package/dist/page-markdown.d.ts +0 -1
- package/dist/page-markdown.js +0 -1
- package/dist/performance-examples.d.ts +0 -1
- package/dist/performance-examples.js +0 -1
- package/dist/playwright-import.d.ts +0 -1
- package/dist/playwright-import.js +0 -1
- package/dist/product-paths.d.ts +0 -1
- package/dist/product-paths.js +0 -1
- package/dist/protocol.d.ts +0 -1
- package/dist/protocol.js +0 -1
- package/dist/react-source.d.ts +0 -1
- package/dist/react-source.js +0 -1
- package/dist/readability.js +1 -1
- package/dist/relay-client.d.ts +0 -1
- package/dist/relay-client.js +0 -1
- package/dist/relay-state.d.ts +0 -1
- package/dist/relay-state.js +0 -1
- package/dist/replay-ai-index.d.ts +0 -1
- package/dist/replay-ai-index.js +0 -1
- package/dist/replay-eval.d.ts +0 -1
- package/dist/replay-eval.js +0 -1
- package/dist/replay-handoff.d.ts +0 -1
- package/dist/replay-handoff.js +0 -1
- package/dist/replay-workflow-compiler.d.ts +0 -1
- package/dist/replay-workflow-compiler.js +0 -1
- package/dist/rrweb-recording-relay.d.ts +0 -1
- package/dist/rrweb-recording-relay.js +0 -1
- package/dist/rrweb-recording.d.ts +0 -1
- package/dist/rrweb-recording.js +0 -1
- package/dist/scoped-fs.d.ts +0 -1
- package/dist/scoped-fs.js +0 -1
- package/dist/selector-generator.js +1 -1
- package/dist/start-relay-server.d.ts +0 -1
- package/dist/start-relay-server.js +0 -1
- package/dist/styles-examples.d.ts +0 -1
- package/dist/styles-examples.js +0 -1
- package/dist/styles.d.ts +0 -1
- package/dist/styles.js +0 -1
- package/dist/tabwright-agent-skill.d.ts +0 -1
- package/dist/tabwright-agent-skill.js +0 -1
- package/dist/test-declarations.d.ts +0 -1
- package/dist/test-declarations.js +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +2 -2
- package/dist/wait-for-page-load.d.ts +0 -1
- package/dist/wait-for-page-load.js +0 -1
- package/dist/workflow-capability.d.ts +0 -1
- package/dist/workflow-capability.js +0 -1
- package/package.json +9 -4
- package/readme.md +35 -0
- package/dist/aria-snapshot.d.ts.map +0 -1
- package/dist/aria-snapshot.js.map +0 -1
- package/dist/aria-snapshot.test.d.ts +0 -2
- package/dist/aria-snapshot.test.d.ts.map +0 -1
- package/dist/aria-snapshot.test.js +0 -270
- package/dist/aria-snapshot.test.js.map +0 -1
- package/dist/aria-snapshot.unit.test.d.ts +0 -2
- package/dist/aria-snapshot.unit.test.d.ts.map +0 -1
- package/dist/aria-snapshot.unit.test.js +0 -542
- package/dist/aria-snapshot.unit.test.js.map +0 -1
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts.map +0 -1
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js.map +0 -1
- package/dist/browser-config.d.ts.map +0 -1
- package/dist/browser-config.js.map +0 -1
- package/dist/browser-install.d.ts.map +0 -1
- package/dist/browser-install.js.map +0 -1
- package/dist/browser-launch.d.ts.map +0 -1
- package/dist/browser-launch.js.map +0 -1
- package/dist/builtin-capabilities.d.ts.map +0 -1
- package/dist/builtin-capabilities.js.map +0 -1
- package/dist/capability-agent-skill.d.ts.map +0 -1
- package/dist/capability-agent-skill.js.map +0 -1
- package/dist/capability-auth-state.d.ts.map +0 -1
- package/dist/capability-auth-state.js.map +0 -1
- package/dist/capability-auth.d.ts.map +0 -1
- package/dist/capability-auth.js.map +0 -1
- package/dist/capability-cli-confirmation.test.d.ts +0 -2
- package/dist/capability-cli-confirmation.test.d.ts.map +0 -1
- package/dist/capability-cli-confirmation.test.js +0 -79
- package/dist/capability-cli-confirmation.test.js.map +0 -1
- package/dist/capability-options.d.ts.map +0 -1
- package/dist/capability-options.js.map +0 -1
- package/dist/capability-options.test.d.ts +0 -2
- package/dist/capability-options.test.d.ts.map +0 -1
- package/dist/capability-options.test.js +0 -81
- package/dist/capability-options.test.js.map +0 -1
- package/dist/capability-package.d.ts.map +0 -1
- package/dist/capability-package.js.map +0 -1
- package/dist/capability-package.test.d.ts +0 -2
- package/dist/capability-package.test.d.ts.map +0 -1
- package/dist/capability-package.test.js +0 -179
- package/dist/capability-package.test.js.map +0 -1
- package/dist/capability-registry.d.ts.map +0 -1
- package/dist/capability-registry.js.map +0 -1
- package/dist/capability-registry.test.d.ts +0 -2
- package/dist/capability-registry.test.d.ts.map +0 -1
- package/dist/capability-registry.test.js +0 -1683
- package/dist/capability-registry.test.js.map +0 -1
- package/dist/capability-runner.d.ts.map +0 -1
- package/dist/capability-runner.js.map +0 -1
- package/dist/capability-search-relevance.test.d.ts +0 -2
- package/dist/capability-search-relevance.test.d.ts.map +0 -1
- package/dist/capability-search-relevance.test.js +0 -67
- package/dist/capability-search-relevance.test.js.map +0 -1
- package/dist/capability-studio.d.ts.map +0 -1
- package/dist/capability-studio.js.map +0 -1
- package/dist/capability-studio.test.d.ts +0 -2
- package/dist/capability-studio.test.d.ts.map +0 -1
- package/dist/capability-studio.test.js +0 -41
- package/dist/capability-studio.test.js.map +0 -1
- package/dist/cdp-log.d.ts.map +0 -1
- package/dist/cdp-log.js.map +0 -1
- package/dist/cdp-log.test.d.ts +0 -2
- package/dist/cdp-log.test.d.ts.map +0 -1
- package/dist/cdp-log.test.js +0 -109
- package/dist/cdp-log.test.js.map +0 -1
- package/dist/cdp-relay.d.ts.map +0 -1
- package/dist/cdp-relay.js.map +0 -1
- package/dist/cdp-session.d.ts.map +0 -1
- package/dist/cdp-session.js.map +0 -1
- package/dist/cdp-types.d.ts.map +0 -1
- package/dist/cdp-types.js.map +0 -1
- package/dist/channel-owner-inspect.test.d.ts +0 -2
- package/dist/channel-owner-inspect.test.d.ts.map +0 -1
- package/dist/channel-owner-inspect.test.js +0 -75
- package/dist/channel-owner-inspect.test.js.map +0 -1
- package/dist/chrome-discovery.d.ts.map +0 -1
- package/dist/chrome-discovery.js.map +0 -1
- package/dist/chrome-discovery.test.d.ts +0 -2
- package/dist/chrome-discovery.test.d.ts.map +0 -1
- package/dist/chrome-discovery.test.js +0 -41
- package/dist/chrome-discovery.test.js.map +0 -1
- package/dist/clean-html.d.ts.map +0 -1
- package/dist/clean-html.js.map +0 -1
- package/dist/cli-help.test.d.ts +0 -2
- package/dist/cli-help.test.d.ts.map +0 -1
- package/dist/cli-help.test.js +0 -98
- package/dist/cli-help.test.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cloud-client.d.ts.map +0 -1
- package/dist/cloud-client.js.map +0 -1
- package/dist/create-logger.d.ts.map +0 -1
- package/dist/create-logger.js.map +0 -1
- package/dist/debugger-examples-types.d.ts.map +0 -1
- package/dist/debugger-examples-types.js.map +0 -1
- package/dist/debugger-examples.d.ts.map +0 -1
- package/dist/debugger-examples.js.map +0 -1
- package/dist/debugger.d.ts.map +0 -1
- package/dist/debugger.js.map +0 -1
- package/dist/diff-utils.d.ts.map +0 -1
- package/dist/diff-utils.js.map +0 -1
- package/dist/diff-utils.test.d.ts +0 -2
- package/dist/diff-utils.test.d.ts.map +0 -1
- package/dist/diff-utils.test.js +0 -137
- package/dist/diff-utils.test.js.map +0 -1
- package/dist/doctor.d.ts.map +0 -1
- package/dist/doctor.js.map +0 -1
- package/dist/doctor.test.d.ts +0 -2
- package/dist/doctor.test.d.ts.map +0 -1
- package/dist/doctor.test.js +0 -208
- package/dist/doctor.test.js.map +0 -1
- package/dist/editor-examples.d.ts.map +0 -1
- package/dist/editor-examples.js.map +0 -1
- package/dist/editor.d.ts.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/env-compat.d.ts.map +0 -1
- package/dist/env-compat.js.map +0 -1
- package/dist/executor.d.ts.map +0 -1
- package/dist/executor.js.map +0 -1
- package/dist/executor.unit.test.d.ts +0 -2
- package/dist/executor.unit.test.d.ts.map +0 -1
- package/dist/executor.unit.test.js +0 -143
- package/dist/executor.unit.test.js.map +0 -1
- package/dist/extension-connection.test.d.ts +0 -2
- package/dist/extension-connection.test.d.ts.map +0 -1
- package/dist/extension-connection.test.js +0 -708
- package/dist/extension-connection.test.js.map +0 -1
- package/dist/extension-icon-warning.test.d.ts +0 -2
- package/dist/extension-icon-warning.test.d.ts.map +0 -1
- package/dist/extension-icon-warning.test.js +0 -33
- package/dist/extension-icon-warning.test.js.map +0 -1
- package/dist/ghost-browser.d.ts.map +0 -1
- package/dist/ghost-browser.js.map +0 -1
- package/dist/ghost-cursor-controller.d.ts.map +0 -1
- package/dist/ghost-cursor-controller.js.map +0 -1
- package/dist/ghost-cursor.d.ts.map +0 -1
- package/dist/ghost-cursor.js.map +0 -1
- package/dist/htmlrewrite.d.ts.map +0 -1
- package/dist/htmlrewrite.js.map +0 -1
- package/dist/htmlrewrite.test.d.ts +0 -2
- package/dist/htmlrewrite.test.d.ts.map +0 -1
- package/dist/htmlrewrite.test.js +0 -7975
- package/dist/htmlrewrite.test.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kill-port.d.ts.map +0 -1
- package/dist/kill-port.js.map +0 -1
- package/dist/kitty-graphics.d.ts.map +0 -1
- package/dist/kitty-graphics.js.map +0 -1
- package/dist/kitty-graphics.test.d.ts +0 -2
- package/dist/kitty-graphics.test.d.ts.map +0 -1
- package/dist/kitty-graphics.test.js +0 -125
- package/dist/kitty-graphics.test.js.map +0 -1
- package/dist/locator-selector.test.d.ts +0 -2
- package/dist/locator-selector.test.d.ts.map +0 -1
- package/dist/locator-selector.test.js +0 -98
- package/dist/locator-selector.test.js.map +0 -1
- package/dist/mcp-client.d.ts +0 -20
- package/dist/mcp-client.d.ts.map +0 -1
- package/dist/mcp-client.js +0 -56
- package/dist/mcp-client.js.map +0 -1
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js.map +0 -1
- package/dist/on-mouse-action.test.d.ts +0 -2
- package/dist/on-mouse-action.test.d.ts.map +0 -1
- package/dist/on-mouse-action.test.js +0 -180
- package/dist/on-mouse-action.test.js.map +0 -1
- package/dist/options-page.test.d.ts +0 -2
- package/dist/options-page.test.d.ts.map +0 -1
- package/dist/options-page.test.js +0 -773
- package/dist/options-page.test.js.map +0 -1
- package/dist/package-paths.d.ts.map +0 -1
- package/dist/package-paths.js.map +0 -1
- package/dist/page-markdown.d.ts.map +0 -1
- package/dist/page-markdown.js.map +0 -1
- package/dist/performance-examples.d.ts.map +0 -1
- package/dist/performance-examples.js.map +0 -1
- package/dist/playwright-import.d.ts.map +0 -1
- package/dist/playwright-import.js.map +0 -1
- package/dist/popup-relocation.test.d.ts +0 -7
- package/dist/popup-relocation.test.d.ts.map +0 -1
- package/dist/popup-relocation.test.js +0 -139
- package/dist/popup-relocation.test.js.map +0 -1
- package/dist/product-paths.d.ts.map +0 -1
- package/dist/product-paths.js.map +0 -1
- package/dist/product-paths.test.d.ts +0 -2
- package/dist/product-paths.test.d.ts.map +0 -1
- package/dist/product-paths.test.js +0 -39
- package/dist/product-paths.test.js.map +0 -1
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js.map +0 -1
- package/dist/protocol.test.d.ts +0 -2
- package/dist/protocol.test.d.ts.map +0 -1
- package/dist/protocol.test.js +0 -31
- package/dist/protocol.test.js.map +0 -1
- package/dist/react-source.d.ts.map +0 -1
- package/dist/react-source.js.map +0 -1
- package/dist/relay-client.d.ts.map +0 -1
- package/dist/relay-client.js.map +0 -1
- package/dist/relay-client.test.d.ts +0 -2
- package/dist/relay-client.test.d.ts.map +0 -1
- package/dist/relay-client.test.js +0 -305
- package/dist/relay-client.test.js.map +0 -1
- package/dist/relay-core.test.d.ts +0 -2
- package/dist/relay-core.test.d.ts.map +0 -1
- package/dist/relay-core.test.js +0 -1427
- package/dist/relay-core.test.js.map +0 -1
- package/dist/relay-navigation.test.d.ts +0 -2
- package/dist/relay-navigation.test.d.ts.map +0 -1
- package/dist/relay-navigation.test.js +0 -661
- package/dist/relay-navigation.test.js.map +0 -1
- package/dist/relay-session.test.d.ts +0 -2
- package/dist/relay-session.test.d.ts.map +0 -1
- package/dist/relay-session.test.js +0 -1121
- package/dist/relay-session.test.js.map +0 -1
- package/dist/relay-state.d.ts.map +0 -1
- package/dist/relay-state.js.map +0 -1
- package/dist/relay-state.test.d.ts +0 -2
- package/dist/relay-state.test.d.ts.map +0 -1
- package/dist/relay-state.test.js +0 -594
- package/dist/relay-state.test.js.map +0 -1
- package/dist/replay-ai-index.d.ts.map +0 -1
- package/dist/replay-ai-index.js.map +0 -1
- package/dist/replay-ai-index.test.d.ts +0 -2
- package/dist/replay-ai-index.test.d.ts.map +0 -1
- package/dist/replay-ai-index.test.js +0 -255
- package/dist/replay-ai-index.test.js.map +0 -1
- package/dist/replay-cli.test.d.ts +0 -2
- package/dist/replay-cli.test.d.ts.map +0 -1
- package/dist/replay-cli.test.js +0 -275
- package/dist/replay-cli.test.js.map +0 -1
- package/dist/replay-eval.d.ts.map +0 -1
- package/dist/replay-eval.js.map +0 -1
- package/dist/replay-handoff.d.ts.map +0 -1
- package/dist/replay-handoff.js.map +0 -1
- package/dist/replay-handoff.test.d.ts +0 -2
- package/dist/replay-handoff.test.d.ts.map +0 -1
- package/dist/replay-handoff.test.js +0 -123
- package/dist/replay-handoff.test.js.map +0 -1
- package/dist/replay-workflow-compiler.d.ts.map +0 -1
- package/dist/replay-workflow-compiler.js.map +0 -1
- package/dist/replay-workflow-compiler.test.d.ts +0 -2
- package/dist/replay-workflow-compiler.test.d.ts.map +0 -1
- package/dist/replay-workflow-compiler.test.js +0 -223
- package/dist/replay-workflow-compiler.test.js.map +0 -1
- package/dist/rrweb-recording-relay.d.ts.map +0 -1
- package/dist/rrweb-recording-relay.js.map +0 -1
- package/dist/rrweb-recording-relay.test.d.ts +0 -2
- package/dist/rrweb-recording-relay.test.d.ts.map +0 -1
- package/dist/rrweb-recording-relay.test.js +0 -85
- package/dist/rrweb-recording-relay.test.js.map +0 -1
- package/dist/rrweb-recording.d.ts.map +0 -1
- package/dist/rrweb-recording.js.map +0 -1
- package/dist/scoped-fs.d.ts.map +0 -1
- package/dist/scoped-fs.js.map +0 -1
- package/dist/scoped-fs.test.d.ts +0 -5
- package/dist/scoped-fs.test.d.ts.map +0 -1
- package/dist/scoped-fs.test.js +0 -73
- package/dist/scoped-fs.test.js.map +0 -1
- package/dist/skill-stub.test.d.ts +0 -2
- package/dist/skill-stub.test.d.ts.map +0 -1
- package/dist/skill-stub.test.js +0 -22
- package/dist/skill-stub.test.js.map +0 -1
- package/dist/snapshot-tools.test.d.ts +0 -2
- package/dist/snapshot-tools.test.d.ts.map +0 -1
- package/dist/snapshot-tools.test.js +0 -856
- package/dist/snapshot-tools.test.js.map +0 -1
- package/dist/start-relay-server.d.ts.map +0 -1
- package/dist/start-relay-server.js.map +0 -1
- package/dist/styles-examples.d.ts.map +0 -1
- package/dist/styles-examples.js.map +0 -1
- package/dist/styles.d.ts.map +0 -1
- package/dist/styles.js.map +0 -1
- package/dist/tabwright-agent-skill.d.ts.map +0 -1
- package/dist/tabwright-agent-skill.js.map +0 -1
- package/dist/tabwright-agent-skill.test.d.ts +0 -2
- package/dist/tabwright-agent-skill.test.d.ts.map +0 -1
- package/dist/tabwright-agent-skill.test.js +0 -51
- package/dist/tabwright-agent-skill.test.js.map +0 -1
- package/dist/test-declarations.d.ts.map +0 -1
- package/dist/test-declarations.js.map +0 -1
- package/dist/test-utils.d.ts +0 -69
- package/dist/test-utils.d.ts.map +0 -1
- package/dist/test-utils.js +0 -448
- package/dist/test-utils.js.map +0 -1
- package/dist/test-utils.test.d.ts +0 -2
- package/dist/test-utils.test.d.ts.map +0 -1
- package/dist/test-utils.test.js +0 -55
- package/dist/test-utils.test.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
- package/dist/wait-for-page-load.d.ts.map +0 -1
- package/dist/wait-for-page-load.js.map +0 -1
- package/dist/workflow-capability.d.ts.map +0 -1
- package/dist/workflow-capability.js.map +0 -1
- package/dist/workflow-script-flow.test.d.ts +0 -2
- package/dist/workflow-script-flow.test.d.ts.map +0 -1
- package/dist/workflow-script-flow.test.js +0 -285
- package/dist/workflow-script-flow.test.js.map +0 -1
- package/src/__snapshots__/x.com.processed.html +0 -1003
- package/src/__snapshots__/x.com.processed.withStyles.html +0 -2720
- package/src/a11y-client.ts +0 -241
- package/src/aria-snapshot.test.ts +0 -311
- package/src/aria-snapshot.ts +0 -1681
- package/src/aria-snapshot.unit.test.ts +0 -615
- package/src/aria-snapshots/github-interactive.txt +0 -193
- package/src/aria-snapshots/github-raw.txt +0 -309
- package/src/aria-snapshots/hackernews-interactive.txt +0 -477
- package/src/aria-snapshots/hackernews-raw.txt +0 -428
- package/src/aria-snapshots/prosemirror-interactive.txt +0 -66
- package/src/aria-snapshots/prosemirror-raw.txt +0 -145
- package/src/assets/aria-labels-hacker-news.png +0 -0
- package/src/assets/aria-labels-old-reddit.png +0 -0
- package/src/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.ts +0 -5
- package/src/assets/cursors/screen-studio/pointer-macos-tahoe.svg +0 -18
- package/src/assets/x.com.html +0 -32946
- package/src/browser-config.ts +0 -179
- package/src/browser-install.ts +0 -284
- package/src/browser-launch.ts +0 -75
- package/src/builtin-capabilities.ts +0 -2765
- package/src/capability-agent-skill.ts +0 -305
- package/src/capability-auth-state.ts +0 -197
- package/src/capability-auth.ts +0 -249
- package/src/capability-cli-confirmation.test.ts +0 -90
- package/src/capability-options.test.ts +0 -89
- package/src/capability-options.ts +0 -57
- package/src/capability-package.test.ts +0 -204
- package/src/capability-package.ts +0 -555
- package/src/capability-registry.test.ts +0 -1905
- package/src/capability-registry.ts +0 -1234
- package/src/capability-runner.ts +0 -801
- package/src/capability-search-relevance.test.ts +0 -73
- package/src/capability-studio.test.ts +0 -45
- package/src/capability-studio.ts +0 -641
- package/src/cdp-log.test.ts +0 -131
- package/src/cdp-log.ts +0 -112
- package/src/cdp-relay.ts +0 -2944
- package/src/cdp-session.ts +0 -77
- package/src/cdp-types.ts +0 -158
- package/src/channel-owner-inspect.test.ts +0 -94
- package/src/chrome-discovery.test.ts +0 -50
- package/src/chrome-discovery.ts +0 -220
- package/src/clean-html.ts +0 -141
- package/src/cli-help.test.ts +0 -123
- package/src/cli.ts +0 -3181
- package/src/cloud-client.ts +0 -179
- package/src/create-logger.ts +0 -38
- package/src/debugger-examples-types.ts +0 -16
- package/src/debugger-examples.ts +0 -66
- package/src/debugger.ts +0 -708
- package/src/diff-utils.test.ts +0 -152
- package/src/diff-utils.ts +0 -70
- package/src/doctor.test.ts +0 -244
- package/src/doctor.ts +0 -321
- package/src/editor-examples.ts +0 -158
- package/src/editor.ts +0 -426
- package/src/env-compat.ts +0 -28
- package/src/executor.ts +0 -1824
- package/src/executor.unit.test.ts +0 -168
- package/src/extension-connection.test.ts +0 -855
- package/src/extension-icon-warning.test.ts +0 -45
- package/src/ghost-browser.ts +0 -149
- package/src/ghost-cursor-client.ts +0 -494
- package/src/ghost-cursor-controller.ts +0 -129
- package/src/ghost-cursor.ts +0 -123
- package/src/htmlrewrite.test.ts +0 -8008
- package/src/htmlrewrite.ts +0 -390
- package/src/index.ts +0 -53
- package/src/kill-port.ts +0 -219
- package/src/kitty-graphics.test.ts +0 -139
- package/src/kitty-graphics.ts +0 -79
- package/src/locator-selector.test.ts +0 -119
- package/src/mcp-client.ts +0 -78
- package/src/mcp.ts +0 -629
- package/src/on-mouse-action.test.ts +0 -226
- package/src/options-page.test.ts +0 -839
- package/src/package-paths.ts +0 -38
- package/src/page-markdown.ts +0 -240
- package/src/performance-examples.ts +0 -186
- package/src/playwright-import.ts +0 -59
- package/src/popup-relocation.test.ts +0 -163
- package/src/product-paths.test.ts +0 -47
- package/src/product-paths.ts +0 -28
- package/src/protocol.test.ts +0 -52
- package/src/protocol.ts +0 -351
- package/src/react-source.ts +0 -379
- package/src/relay-client.test.ts +0 -375
- package/src/relay-client.ts +0 -572
- package/src/relay-core.test.ts +0 -1603
- package/src/relay-navigation.test.ts +0 -790
- package/src/relay-session.test.ts +0 -1375
- package/src/relay-state.test.ts +0 -729
- package/src/relay-state.ts +0 -561
- package/src/replay-ai-index.test.ts +0 -278
- package/src/replay-ai-index.ts +0 -872
- package/src/replay-cli.test.ts +0 -325
- package/src/replay-eval.ts +0 -1039
- package/src/replay-handoff.test.ts +0 -163
- package/src/replay-handoff.ts +0 -109
- package/src/replay-workflow-compiler.test.ts +0 -250
- package/src/replay-workflow-compiler.ts +0 -700
- package/src/resource.md +0 -409
- package/src/rrweb-recording-relay.test.ts +0 -99
- package/src/rrweb-recording-relay.ts +0 -400
- package/src/rrweb-recording.ts +0 -322
- package/src/scoped-fs.test.ts +0 -80
- package/src/scoped-fs.ts +0 -420
- package/src/skill-stub.test.ts +0 -24
- package/src/snapshot-tools.test.ts +0 -1017
- package/src/snapshots/hacker-news-accessibility-full.md +0 -81
- package/src/snapshots/hacker-news-accessibility-interactive.md +0 -43
- package/src/snapshots/page-markdown-output.txt +0 -16
- package/src/snapshots/shadcn-ui-accessibility-full.md +0 -201
- package/src/snapshots/shadcn-ui-accessibility-interactive.md +0 -109
- package/src/start-relay-server.ts +0 -69
- package/src/styles-examples.ts +0 -84
- package/src/styles.ts +0 -343
- package/src/tabwright-agent-skill.test.ts +0 -61
- package/src/tabwright-agent-skill.ts +0 -105
- package/src/test-declarations.ts +0 -13
- package/src/test-utils.test.ts +0 -70
- package/src/test-utils.ts +0 -566
- package/src/utils.ts +0 -78
- package/src/wait-for-page-load.ts +0 -198
- package/src/workflow-capability.ts +0 -417
- package/src/workflow-script-flow.test.ts +0 -388
package/src/capability-runner.ts
DELETED
|
@@ -1,801 +0,0 @@
|
|
|
1
|
-
import crypto from 'node:crypto'
|
|
2
|
-
import fs from 'node:fs'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import util from 'node:util'
|
|
5
|
-
import vm from 'node:vm'
|
|
6
|
-
import {
|
|
7
|
-
appendCapabilityRun,
|
|
8
|
-
capabilityMatchesUrl,
|
|
9
|
-
getCapabilityContractFingerprint,
|
|
10
|
-
getCapabilityContractHealth,
|
|
11
|
-
readCapabilitySecrets,
|
|
12
|
-
requireCapability,
|
|
13
|
-
resolveCapabilityOperation,
|
|
14
|
-
updateCapabilityManifest,
|
|
15
|
-
validateJsonAgainstSchema,
|
|
16
|
-
type CapabilityContractCheckStatus,
|
|
17
|
-
type CapabilityRecord,
|
|
18
|
-
type CapabilityRunContract,
|
|
19
|
-
type CapabilityRunRecord,
|
|
20
|
-
type ResolvedCapabilityOperation,
|
|
21
|
-
} from './capability-registry.js'
|
|
22
|
-
import type { ExecuteResult } from './executor.js'
|
|
23
|
-
|
|
24
|
-
export interface CapabilityExecutor {
|
|
25
|
-
execute(code: string, timeout?: number, options?: { includeStructuredResult?: boolean }): Promise<ExecuteResult>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface PreparedCapabilityRun {
|
|
29
|
-
capability: CapabilityRecord
|
|
30
|
-
operation: ResolvedCapabilityOperation
|
|
31
|
-
code: string
|
|
32
|
-
input: unknown
|
|
33
|
-
inputHash: string
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface CapabilityRunResult {
|
|
37
|
-
capability: CapabilityRecord
|
|
38
|
-
executeResult: ExecuteResult
|
|
39
|
-
output: unknown
|
|
40
|
-
runRecord: CapabilityRunRecord
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface NodeCapabilityRunResult {
|
|
44
|
-
capability: CapabilityRecord
|
|
45
|
-
output: unknown
|
|
46
|
-
text: string
|
|
47
|
-
isError: boolean
|
|
48
|
-
runRecord: CapabilityRunRecord
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface CapabilityExecutionObservation {
|
|
52
|
-
status: 'success' | 'error'
|
|
53
|
-
output: unknown
|
|
54
|
-
error?: string
|
|
55
|
-
observedNetworkUrls?: string[]
|
|
56
|
-
url?: string
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface FinalizedCapabilityRun {
|
|
60
|
-
capability: CapabilityRecord
|
|
61
|
-
output: unknown
|
|
62
|
-
runRecord: CapabilityRunRecord
|
|
63
|
-
contractError?: Error
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
interface CapabilityExecutionEnvelope {
|
|
67
|
-
__tabwrightCapabilityEnvelope: 1
|
|
68
|
-
output: unknown
|
|
69
|
-
observedNetworkUrls: string[]
|
|
70
|
-
url?: string
|
|
71
|
-
error?: string
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
interface NodeCapabilityExecution {
|
|
75
|
-
output: unknown
|
|
76
|
-
observedNetworkUrls: string[]
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
class ObservedCapabilityExecutionError extends Error {
|
|
80
|
-
observedNetworkUrls: string[]
|
|
81
|
-
|
|
82
|
-
constructor(options: { cause: unknown; observedNetworkUrls: string[] }) {
|
|
83
|
-
const message = options.cause instanceof Error ? options.cause.message : String(options.cause)
|
|
84
|
-
super(message, { cause: options.cause })
|
|
85
|
-
this.name = 'ObservedCapabilityExecutionError'
|
|
86
|
-
this.observedNetworkUrls = options.observedNetworkUrls
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface CapabilityArtifacts {
|
|
91
|
-
root: string
|
|
92
|
-
path(options: { filename: string }): string
|
|
93
|
-
writeJson(options: { filename: string; value: unknown }): string
|
|
94
|
-
writeText(options: { filename: string; text: string }): string
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function prepareCapabilityRun(options: {
|
|
98
|
-
id: string
|
|
99
|
-
input: unknown
|
|
100
|
-
cwd?: string
|
|
101
|
-
force?: boolean
|
|
102
|
-
confirmation?: string
|
|
103
|
-
}): PreparedCapabilityRun {
|
|
104
|
-
const capability = requireCapability({ id: options.id, cwd: options.cwd })
|
|
105
|
-
const operation = validateCapabilityRunnable({
|
|
106
|
-
capability,
|
|
107
|
-
input: options.input,
|
|
108
|
-
force: options.force,
|
|
109
|
-
confirmation: options.confirmation,
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
const script = fs.readFileSync(capability.scriptPath, 'utf-8')
|
|
113
|
-
return {
|
|
114
|
-
capability,
|
|
115
|
-
operation,
|
|
116
|
-
code: buildCapabilityCode({ capability, operation, script, input: options.input, force: options.force }),
|
|
117
|
-
input: options.input,
|
|
118
|
-
inputHash: hashInput(options.input),
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export async function runNodeCapability(options: {
|
|
123
|
-
id: string
|
|
124
|
-
input: unknown
|
|
125
|
-
timeout?: number
|
|
126
|
-
cwd?: string
|
|
127
|
-
force?: boolean
|
|
128
|
-
confirmation?: string
|
|
129
|
-
}): Promise<NodeCapabilityRunResult> {
|
|
130
|
-
const capability = requireCapability({ id: options.id, cwd: options.cwd })
|
|
131
|
-
if (capability.manifest.runtime !== 'node') {
|
|
132
|
-
throw new Error(`Capability ${options.id} is runtime "${capability.manifest.runtime}", not "node"`)
|
|
133
|
-
}
|
|
134
|
-
const operation = validateCapabilityRunnable({
|
|
135
|
-
capability,
|
|
136
|
-
input: options.input,
|
|
137
|
-
force: options.force,
|
|
138
|
-
confirmation: options.confirmation,
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
const start = Date.now()
|
|
142
|
-
const inputHash = hashInput(options.input)
|
|
143
|
-
const execution = await executeNodeCapabilityScript({
|
|
144
|
-
capability,
|
|
145
|
-
operation,
|
|
146
|
-
input: options.input,
|
|
147
|
-
timeout: options.timeout || 10000,
|
|
148
|
-
}).catch((error: unknown) => {
|
|
149
|
-
const finalized = finalizeCapabilityRun({
|
|
150
|
-
capability,
|
|
151
|
-
operation,
|
|
152
|
-
cwd: options.cwd,
|
|
153
|
-
inputHash,
|
|
154
|
-
startedAt: start,
|
|
155
|
-
execution: {
|
|
156
|
-
status: 'error',
|
|
157
|
-
output: undefined,
|
|
158
|
-
error: error instanceof Error ? error.message : String(error),
|
|
159
|
-
observedNetworkUrls: error instanceof ObservedCapabilityExecutionError ? error.observedNetworkUrls : [],
|
|
160
|
-
},
|
|
161
|
-
})
|
|
162
|
-
throw finalized.contractError || error
|
|
163
|
-
})
|
|
164
|
-
const finalized = finalizeCapabilityRun({
|
|
165
|
-
capability,
|
|
166
|
-
operation,
|
|
167
|
-
cwd: options.cwd,
|
|
168
|
-
inputHash,
|
|
169
|
-
startedAt: start,
|
|
170
|
-
execution: {
|
|
171
|
-
status: 'success',
|
|
172
|
-
output: execution.output,
|
|
173
|
-
observedNetworkUrls: execution.observedNetworkUrls,
|
|
174
|
-
},
|
|
175
|
-
})
|
|
176
|
-
if (finalized.contractError) {
|
|
177
|
-
throw finalized.contractError
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return {
|
|
181
|
-
capability: finalized.capability,
|
|
182
|
-
output: finalized.output,
|
|
183
|
-
text: formatNodeOutput(finalized.output),
|
|
184
|
-
isError: false,
|
|
185
|
-
runRecord: finalized.runRecord,
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export async function runCapabilityWithExecutor(options: {
|
|
190
|
-
executor: CapabilityExecutor
|
|
191
|
-
id: string
|
|
192
|
-
input: unknown
|
|
193
|
-
timeout?: number
|
|
194
|
-
cwd?: string
|
|
195
|
-
force?: boolean
|
|
196
|
-
confirmation?: string
|
|
197
|
-
}): Promise<CapabilityRunResult> {
|
|
198
|
-
const prepared = prepareCapabilityRun(options)
|
|
199
|
-
const start = Date.now()
|
|
200
|
-
const executeResult = await options.executor
|
|
201
|
-
.execute(prepared.code, options.timeout || 10000, {
|
|
202
|
-
includeStructuredResult: true,
|
|
203
|
-
})
|
|
204
|
-
.catch((error: unknown) => {
|
|
205
|
-
finalizeCapabilityRun({
|
|
206
|
-
capability: prepared.capability,
|
|
207
|
-
operation: prepared.operation,
|
|
208
|
-
cwd: options.cwd,
|
|
209
|
-
inputHash: prepared.inputHash,
|
|
210
|
-
startedAt: start,
|
|
211
|
-
execution: {
|
|
212
|
-
status: 'error',
|
|
213
|
-
output: undefined,
|
|
214
|
-
error: error instanceof Error ? error.message : String(error),
|
|
215
|
-
},
|
|
216
|
-
})
|
|
217
|
-
throw error
|
|
218
|
-
})
|
|
219
|
-
const observation = readCapabilityExecutionObservation(executeResult.structuredResult)
|
|
220
|
-
const isExecutionError = executeResult.isError || Boolean(observation.error)
|
|
221
|
-
const normalizedExecuteResult: ExecuteResult = {
|
|
222
|
-
...executeResult,
|
|
223
|
-
text: normalizeCapabilityExecutionText({
|
|
224
|
-
text: executeResult.text,
|
|
225
|
-
output: observation.output,
|
|
226
|
-
error: observation.error,
|
|
227
|
-
}),
|
|
228
|
-
isError: isExecutionError,
|
|
229
|
-
structuredResult: observation.output,
|
|
230
|
-
}
|
|
231
|
-
const finalized = finalizeCapabilityRun({
|
|
232
|
-
capability: prepared.capability,
|
|
233
|
-
operation: prepared.operation,
|
|
234
|
-
cwd: options.cwd,
|
|
235
|
-
inputHash: prepared.inputHash,
|
|
236
|
-
startedAt: start,
|
|
237
|
-
execution: {
|
|
238
|
-
status: isExecutionError ? 'error' : 'success',
|
|
239
|
-
output: observation.output,
|
|
240
|
-
error: isExecutionError ? observation.error || normalizedExecuteResult.text : undefined,
|
|
241
|
-
observedNetworkUrls: observation.observedNetworkUrls,
|
|
242
|
-
url: observation.url,
|
|
243
|
-
},
|
|
244
|
-
})
|
|
245
|
-
if (finalized.contractError) {
|
|
246
|
-
throw finalized.contractError
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return {
|
|
250
|
-
capability: finalized.capability,
|
|
251
|
-
executeResult: normalizedExecuteResult,
|
|
252
|
-
output: finalized.output,
|
|
253
|
-
runRecord: finalized.runRecord,
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export function finalizeCapabilityRun(options: {
|
|
258
|
-
capability: CapabilityRecord
|
|
259
|
-
operation: ResolvedCapabilityOperation
|
|
260
|
-
cwd?: string
|
|
261
|
-
inputHash: string
|
|
262
|
-
startedAt: number
|
|
263
|
-
execution: CapabilityExecutionObservation
|
|
264
|
-
}): FinalizedCapabilityRun {
|
|
265
|
-
const fingerprint = getCapabilityContractFingerprint(options.capability)
|
|
266
|
-
const outputValidation =
|
|
267
|
-
options.execution.status === 'success'
|
|
268
|
-
? validateJsonAgainstSchema({
|
|
269
|
-
schema: options.operation.outputSchema,
|
|
270
|
-
value: options.execution.output,
|
|
271
|
-
label: 'output',
|
|
272
|
-
})
|
|
273
|
-
: { valid: false, errors: [] }
|
|
274
|
-
const network = validateObservedNetworkUrls({
|
|
275
|
-
capability: options.capability,
|
|
276
|
-
operation: options.operation,
|
|
277
|
-
executionStatus: options.execution.status,
|
|
278
|
-
observedNetworkUrls: options.execution.observedNetworkUrls || [],
|
|
279
|
-
})
|
|
280
|
-
const failures: CapabilityRunContract['failures'] = [
|
|
281
|
-
...(options.execution.status === 'success' && !outputValidation.valid
|
|
282
|
-
? outputValidation.errors.map((message) => {
|
|
283
|
-
return { kind: 'output-schema' as const, message }
|
|
284
|
-
})
|
|
285
|
-
: []),
|
|
286
|
-
...network.undeclaredHosts.map((host) => {
|
|
287
|
-
return {
|
|
288
|
-
kind: 'undeclared-host' as const,
|
|
289
|
-
message: `Network host is not declared by capability permissions: ${host}`,
|
|
290
|
-
}
|
|
291
|
-
}),
|
|
292
|
-
]
|
|
293
|
-
const contractStatus: CapabilityRunContract['status'] = (() => {
|
|
294
|
-
if (failures.length > 0) {
|
|
295
|
-
return 'failed'
|
|
296
|
-
}
|
|
297
|
-
if (options.execution.status === 'error') {
|
|
298
|
-
return 'unknown'
|
|
299
|
-
}
|
|
300
|
-
return 'passed'
|
|
301
|
-
})()
|
|
302
|
-
const trustBefore = options.capability.manifest.status
|
|
303
|
-
const nextCapability = (() => {
|
|
304
|
-
if (contractStatus !== 'failed' || trustBefore !== 'trusted') {
|
|
305
|
-
return options.capability
|
|
306
|
-
}
|
|
307
|
-
return updateCapabilityManifest({
|
|
308
|
-
id: options.capability.manifest.id,
|
|
309
|
-
cwd: options.cwd,
|
|
310
|
-
patch: { status: 'draft' },
|
|
311
|
-
})
|
|
312
|
-
})()
|
|
313
|
-
const contract: CapabilityRunContract = {
|
|
314
|
-
schemaVersion: 1,
|
|
315
|
-
fingerprint,
|
|
316
|
-
status: contractStatus,
|
|
317
|
-
failures,
|
|
318
|
-
output: {
|
|
319
|
-
status: options.execution.status === 'error' ? 'unknown' : outputValidation.valid ? 'passed' : 'failed',
|
|
320
|
-
errors: outputValidation.errors,
|
|
321
|
-
},
|
|
322
|
-
network: {
|
|
323
|
-
status: network.status,
|
|
324
|
-
observedHosts: network.observedHosts,
|
|
325
|
-
undeclaredHosts: network.undeclaredHosts,
|
|
326
|
-
},
|
|
327
|
-
trust: {
|
|
328
|
-
before: trustBefore,
|
|
329
|
-
after: nextCapability.manifest.status,
|
|
330
|
-
downgraded: trustBefore === 'trusted' && nextCapability.manifest.status === 'draft',
|
|
331
|
-
},
|
|
332
|
-
}
|
|
333
|
-
const contractError = (() => {
|
|
334
|
-
if (contractStatus !== 'failed') {
|
|
335
|
-
return undefined
|
|
336
|
-
}
|
|
337
|
-
return new Error(
|
|
338
|
-
[
|
|
339
|
-
'Capability execution completed but contract conformance failed.',
|
|
340
|
-
...failures.map((failure) => {
|
|
341
|
-
return failure.message
|
|
342
|
-
}),
|
|
343
|
-
trustBefore === 'trusted'
|
|
344
|
-
? 'The capability was moved to draft. Do not automatically retry a write operation.'
|
|
345
|
-
: 'The capability remains draft. Do not automatically retry a write operation.',
|
|
346
|
-
].join('\n'),
|
|
347
|
-
)
|
|
348
|
-
})()
|
|
349
|
-
const runRecord = buildCapabilityRunRecord({
|
|
350
|
-
capability: options.capability,
|
|
351
|
-
operation: options.operation,
|
|
352
|
-
status: options.execution.status === 'error' || contractError ? 'error' : 'success',
|
|
353
|
-
durationMs: Date.now() - options.startedAt,
|
|
354
|
-
inputHash: options.inputHash,
|
|
355
|
-
error: options.execution.error || contractError?.message,
|
|
356
|
-
url: options.execution.url,
|
|
357
|
-
contract,
|
|
358
|
-
})
|
|
359
|
-
appendCapabilityRun({ capability: options.capability, record: runRecord })
|
|
360
|
-
return {
|
|
361
|
-
capability: nextCapability,
|
|
362
|
-
output: options.execution.output,
|
|
363
|
-
runRecord,
|
|
364
|
-
contractError,
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
export function readCapabilityExecutionObservation(value: unknown): {
|
|
369
|
-
output: unknown
|
|
370
|
-
observedNetworkUrls: string[]
|
|
371
|
-
url?: string
|
|
372
|
-
error?: string
|
|
373
|
-
} {
|
|
374
|
-
if (!isCapabilityExecutionEnvelope(value)) {
|
|
375
|
-
return { output: value, observedNetworkUrls: [] }
|
|
376
|
-
}
|
|
377
|
-
return {
|
|
378
|
-
output: value.output,
|
|
379
|
-
observedNetworkUrls: value.observedNetworkUrls,
|
|
380
|
-
url: value.url,
|
|
381
|
-
error: value.error,
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
export function normalizeCapabilityExecutionText(options: { text: string; output: unknown; error?: string }): string {
|
|
386
|
-
const markerIndex = options.text.lastIndexOf('[return value]')
|
|
387
|
-
if (markerIndex === -1) {
|
|
388
|
-
return options.error || options.text
|
|
389
|
-
}
|
|
390
|
-
const prefix = options.text.slice(0, markerIndex).trimEnd()
|
|
391
|
-
const resultText: string = (() => {
|
|
392
|
-
if (options.error) {
|
|
393
|
-
return options.error
|
|
394
|
-
}
|
|
395
|
-
if (options.output === undefined) {
|
|
396
|
-
return ''
|
|
397
|
-
}
|
|
398
|
-
const formatted =
|
|
399
|
-
typeof options.output === 'string'
|
|
400
|
-
? options.output
|
|
401
|
-
: util.inspect(options.output, {
|
|
402
|
-
depth: 4,
|
|
403
|
-
colors: false,
|
|
404
|
-
maxArrayLength: 100,
|
|
405
|
-
maxStringLength: 1000,
|
|
406
|
-
breakLength: 80,
|
|
407
|
-
})
|
|
408
|
-
return formatted.trim() ? `[return value] ${formatted}` : ''
|
|
409
|
-
})()
|
|
410
|
-
return (
|
|
411
|
-
[prefix, resultText]
|
|
412
|
-
.filter((value) => {
|
|
413
|
-
return value.length > 0
|
|
414
|
-
})
|
|
415
|
-
.join('\n')
|
|
416
|
-
.trim() || 'Code executed successfully (no output)'
|
|
417
|
-
)
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function isCapabilityExecutionEnvelope(value: unknown): value is CapabilityExecutionEnvelope {
|
|
421
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
422
|
-
return false
|
|
423
|
-
}
|
|
424
|
-
const candidate = value as Partial<CapabilityExecutionEnvelope>
|
|
425
|
-
return (
|
|
426
|
-
candidate.__tabwrightCapabilityEnvelope === 1 &&
|
|
427
|
-
Array.isArray(candidate.observedNetworkUrls) &&
|
|
428
|
-
candidate.observedNetworkUrls.every((url) => {
|
|
429
|
-
return typeof url === 'string'
|
|
430
|
-
}) &&
|
|
431
|
-
(candidate.url === undefined || typeof candidate.url === 'string') &&
|
|
432
|
-
(candidate.error === undefined || typeof candidate.error === 'string')
|
|
433
|
-
)
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
function validateObservedNetworkUrls(options: {
|
|
437
|
-
capability: CapabilityRecord
|
|
438
|
-
operation: ResolvedCapabilityOperation
|
|
439
|
-
executionStatus: 'success' | 'error'
|
|
440
|
-
observedNetworkUrls: string[]
|
|
441
|
-
}): {
|
|
442
|
-
status: CapabilityContractCheckStatus
|
|
443
|
-
observedHosts: string[]
|
|
444
|
-
undeclaredHosts: string[]
|
|
445
|
-
} {
|
|
446
|
-
const observations = options.observedNetworkUrls.flatMap((rawUrl) => {
|
|
447
|
-
try {
|
|
448
|
-
const url = new URL(rawUrl)
|
|
449
|
-
return [{ url: url.toString(), host: url.origin }]
|
|
450
|
-
} catch {
|
|
451
|
-
return []
|
|
452
|
-
}
|
|
453
|
-
})
|
|
454
|
-
const observedHosts = [...new Set(observations.map((observation) => observation.host))].sort()
|
|
455
|
-
if (observations.length === 0) {
|
|
456
|
-
return {
|
|
457
|
-
status: options.executionStatus === 'error' ? 'unknown' : 'not-applicable',
|
|
458
|
-
observedHosts,
|
|
459
|
-
undeclaredHosts: [],
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
const networkPermissions = (options.operation.permissions || options.capability.manifest.permissions).filter(
|
|
464
|
-
(permission) => {
|
|
465
|
-
return permission === 'network' || permission.startsWith('network:')
|
|
466
|
-
},
|
|
467
|
-
)
|
|
468
|
-
if (networkPermissions.includes('network')) {
|
|
469
|
-
return {
|
|
470
|
-
status: options.executionStatus === 'error' ? 'unknown' : 'passed',
|
|
471
|
-
observedHosts,
|
|
472
|
-
undeclaredHosts: [],
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
const scopedPermissions = networkPermissions.flatMap((permission) => {
|
|
476
|
-
return permission.startsWith('network:') ? [permission.slice('network:'.length)] : []
|
|
477
|
-
})
|
|
478
|
-
if (options.capability.manifest.runtime === 'browser' && scopedPermissions.length === 0) {
|
|
479
|
-
return {
|
|
480
|
-
status: options.executionStatus === 'error' ? 'unknown' : 'not-applicable',
|
|
481
|
-
observedHosts,
|
|
482
|
-
undeclaredHosts: [],
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
const undeclaredHosts = [
|
|
487
|
-
...new Set(
|
|
488
|
-
observations.flatMap((observation) => {
|
|
489
|
-
const declared = scopedPermissions.some((pattern) => {
|
|
490
|
-
return matchesGlob({ value: observation.url, pattern })
|
|
491
|
-
})
|
|
492
|
-
return declared ? [] : [observation.host]
|
|
493
|
-
}),
|
|
494
|
-
),
|
|
495
|
-
].sort()
|
|
496
|
-
return {
|
|
497
|
-
status: undeclaredHosts.length > 0 ? 'failed' : options.executionStatus === 'error' ? 'unknown' : 'passed',
|
|
498
|
-
observedHosts,
|
|
499
|
-
undeclaredHosts,
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
function matchesGlob(options: { value: string; pattern: string }): boolean {
|
|
504
|
-
const escaped = options.pattern
|
|
505
|
-
.split('*')
|
|
506
|
-
.map((part) => {
|
|
507
|
-
return part.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
|
|
508
|
-
})
|
|
509
|
-
.join('.*')
|
|
510
|
-
return new RegExp(`^${escaped}$`).test(options.value)
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
export function buildCapabilityRunRecord(options: {
|
|
514
|
-
capability: CapabilityRecord
|
|
515
|
-
operation: ResolvedCapabilityOperation
|
|
516
|
-
status: 'success' | 'error'
|
|
517
|
-
durationMs: number
|
|
518
|
-
inputHash: string
|
|
519
|
-
error?: string
|
|
520
|
-
url?: string
|
|
521
|
-
contract?: CapabilityRunContract
|
|
522
|
-
}): CapabilityRunRecord {
|
|
523
|
-
return {
|
|
524
|
-
id: options.capability.manifest.id,
|
|
525
|
-
operation: options.operation.id,
|
|
526
|
-
status: options.status,
|
|
527
|
-
durationMs: options.durationMs,
|
|
528
|
-
inputHash: options.inputHash,
|
|
529
|
-
error: options.error,
|
|
530
|
-
url: options.url,
|
|
531
|
-
contract: options.contract,
|
|
532
|
-
createdAt: new Date().toISOString(),
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
export function validateCapabilityUrl(options: { capability: CapabilityRecord; url: string; force?: boolean }): void {
|
|
537
|
-
if (options.force) {
|
|
538
|
-
return
|
|
539
|
-
}
|
|
540
|
-
if (capabilityMatchesUrl({ capability: options.capability.manifest, url: options.url })) {
|
|
541
|
-
return
|
|
542
|
-
}
|
|
543
|
-
throw new Error(`Capability ${options.capability.manifest.id} does not match current page URL: ${options.url}`)
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
function validateCapabilityRunnable(options: {
|
|
547
|
-
capability: CapabilityRecord
|
|
548
|
-
input: unknown
|
|
549
|
-
force?: boolean
|
|
550
|
-
confirmation?: string
|
|
551
|
-
}): ResolvedCapabilityOperation {
|
|
552
|
-
if (options.capability.manifest.status === 'disabled') {
|
|
553
|
-
throw new Error(`Capability is disabled: ${options.capability.manifest.id}`)
|
|
554
|
-
}
|
|
555
|
-
if (getCapabilityContractHealth(options.capability).state === 'drifted' && !options.force) {
|
|
556
|
-
throw new Error(
|
|
557
|
-
`Capability ${options.capability.manifest.id} failed conformance for its current contract. Repair it and run with --force before trusting it again.`,
|
|
558
|
-
)
|
|
559
|
-
}
|
|
560
|
-
if (options.capability.manifest.status !== 'trusted' && !options.force) {
|
|
561
|
-
throw new Error(`Capability is ${options.capability.manifest.status}. Run with --force or trust it first.`)
|
|
562
|
-
}
|
|
563
|
-
const operation = resolveCapabilityOperation({ capability: options.capability, input: options.input })
|
|
564
|
-
const validation = validateJsonAgainstSchema({
|
|
565
|
-
schema: operation.inputSchema,
|
|
566
|
-
value: options.input,
|
|
567
|
-
label: 'input',
|
|
568
|
-
})
|
|
569
|
-
if (!validation.valid) {
|
|
570
|
-
throw new Error(`Invalid capability input:\n${validation.errors.join('\n')}`)
|
|
571
|
-
}
|
|
572
|
-
if (operation.requiresConfirmation && options.confirmation !== operation.confirmationToken) {
|
|
573
|
-
throw new Error(
|
|
574
|
-
`Capability ${options.capability.manifest.id}${operation.id ? ` operation ${operation.id}` : ''} requires explicit user confirmation for its ${operation.sideEffect} side effect. After approval, rerun with --confirm ${operation.confirmationToken}.`,
|
|
575
|
-
)
|
|
576
|
-
}
|
|
577
|
-
return operation
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
async function executeNodeCapabilityScript(options: {
|
|
581
|
-
capability: CapabilityRecord
|
|
582
|
-
operation: ResolvedCapabilityOperation
|
|
583
|
-
input: unknown
|
|
584
|
-
timeout: number
|
|
585
|
-
}): Promise<NodeCapabilityExecution> {
|
|
586
|
-
const script = fs.readFileSync(options.capability.scriptPath, 'utf-8')
|
|
587
|
-
const secrets = readCapabilitySecrets({ capability: options.capability })
|
|
588
|
-
const artifacts = createCapabilityArtifacts({ capability: options.capability })
|
|
589
|
-
const observedNetworkUrls: Set<string> = new Set()
|
|
590
|
-
const observedFetch: typeof fetch = async (input, init) => {
|
|
591
|
-
const requestUrl = input instanceof Request ? input.url : input.toString()
|
|
592
|
-
observedNetworkUrls.add(requestUrl)
|
|
593
|
-
const response = await fetch(input, init)
|
|
594
|
-
if (response.url) {
|
|
595
|
-
observedNetworkUrls.add(response.url)
|
|
596
|
-
}
|
|
597
|
-
return response
|
|
598
|
-
}
|
|
599
|
-
const vmContext = vm.createContext({
|
|
600
|
-
input: options.input,
|
|
601
|
-
capability: {
|
|
602
|
-
id: options.capability.manifest.id,
|
|
603
|
-
title: options.capability.manifest.title,
|
|
604
|
-
description: options.capability.manifest.description,
|
|
605
|
-
operation: options.operation.id,
|
|
606
|
-
permissions: options.operation.permissions || options.capability.manifest.permissions,
|
|
607
|
-
runtime: options.capability.manifest.runtime,
|
|
608
|
-
},
|
|
609
|
-
secrets,
|
|
610
|
-
artifacts,
|
|
611
|
-
console,
|
|
612
|
-
fetch: observedFetch,
|
|
613
|
-
URL,
|
|
614
|
-
URLSearchParams,
|
|
615
|
-
Headers,
|
|
616
|
-
Request,
|
|
617
|
-
Response,
|
|
618
|
-
FormData,
|
|
619
|
-
Buffer,
|
|
620
|
-
TextEncoder,
|
|
621
|
-
TextDecoder,
|
|
622
|
-
AbortController,
|
|
623
|
-
AbortSignal,
|
|
624
|
-
structuredClone,
|
|
625
|
-
setTimeout,
|
|
626
|
-
clearTimeout,
|
|
627
|
-
crypto,
|
|
628
|
-
})
|
|
629
|
-
const wrappedCode = [
|
|
630
|
-
'const __tabwrightCapabilityOutput = await (async () => {',
|
|
631
|
-
script,
|
|
632
|
-
'\n})();',
|
|
633
|
-
'return __tabwrightCapabilityOutput === undefined ? undefined : JSON.parse(JSON.stringify(__tabwrightCapabilityOutput));',
|
|
634
|
-
`//# sourceURL=tabwright-node-capability://${options.capability.manifest.id}`,
|
|
635
|
-
'',
|
|
636
|
-
].join('\n')
|
|
637
|
-
|
|
638
|
-
const timeout = createCapabilityTimeout({ timeout: options.timeout })
|
|
639
|
-
try {
|
|
640
|
-
const output = await Promise.race([
|
|
641
|
-
vm.runInContext(`(async () => { ${wrappedCode} })()`, vmContext, {
|
|
642
|
-
timeout: options.timeout,
|
|
643
|
-
displayErrors: true,
|
|
644
|
-
}),
|
|
645
|
-
timeout.promise,
|
|
646
|
-
])
|
|
647
|
-
return { output, observedNetworkUrls: [...observedNetworkUrls] }
|
|
648
|
-
} catch (error) {
|
|
649
|
-
throw new ObservedCapabilityExecutionError({
|
|
650
|
-
cause: error,
|
|
651
|
-
observedNetworkUrls: [...observedNetworkUrls],
|
|
652
|
-
})
|
|
653
|
-
} finally {
|
|
654
|
-
timeout.cancel()
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
function createCapabilityTimeout(options: { timeout: number }): {
|
|
659
|
-
promise: Promise<never>
|
|
660
|
-
cancel: () => void
|
|
661
|
-
} {
|
|
662
|
-
const controller = new AbortController()
|
|
663
|
-
const promise = new Promise<never>((_, reject) => {
|
|
664
|
-
const timer = setTimeout(() => {
|
|
665
|
-
reject(new Error(`Capability execution timed out after ${options.timeout}ms`))
|
|
666
|
-
}, options.timeout)
|
|
667
|
-
controller.signal.addEventListener(
|
|
668
|
-
'abort',
|
|
669
|
-
() => {
|
|
670
|
-
clearTimeout(timer)
|
|
671
|
-
},
|
|
672
|
-
{ once: true },
|
|
673
|
-
)
|
|
674
|
-
})
|
|
675
|
-
return {
|
|
676
|
-
promise,
|
|
677
|
-
cancel: () => {
|
|
678
|
-
controller.abort()
|
|
679
|
-
},
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
function createCapabilityArtifacts(options: { capability: CapabilityRecord }): CapabilityArtifacts {
|
|
684
|
-
const root = path.join(options.capability.dir, 'artifacts')
|
|
685
|
-
return {
|
|
686
|
-
root,
|
|
687
|
-
path: (pathOptions) => {
|
|
688
|
-
return resolveArtifactPath({ root, filename: pathOptions.filename })
|
|
689
|
-
},
|
|
690
|
-
writeJson: (writeOptions) => {
|
|
691
|
-
return writeArtifactText({
|
|
692
|
-
root,
|
|
693
|
-
filename: writeOptions.filename,
|
|
694
|
-
text: `${JSON.stringify(writeOptions.value, null, 2)}\n`,
|
|
695
|
-
})
|
|
696
|
-
},
|
|
697
|
-
writeText: (writeOptions) => {
|
|
698
|
-
return writeArtifactText({ root, filename: writeOptions.filename, text: writeOptions.text })
|
|
699
|
-
},
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
function writeArtifactText(options: { root: string; filename: string; text: string }): string {
|
|
704
|
-
const filePath = resolveArtifactPath({ root: options.root, filename: options.filename })
|
|
705
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true })
|
|
706
|
-
fs.writeFileSync(filePath, options.text)
|
|
707
|
-
return filePath
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
function resolveArtifactPath(options: { root: string; filename: string }): string {
|
|
711
|
-
const root = path.resolve(options.root)
|
|
712
|
-
if (!options.filename.trim()) {
|
|
713
|
-
throw new Error('Artifact filename must not be empty')
|
|
714
|
-
}
|
|
715
|
-
const filePath = path.resolve(root, options.filename)
|
|
716
|
-
if (filePath !== root && !filePath.startsWith(`${root}${path.sep}`)) {
|
|
717
|
-
throw new Error(`Artifact filename must stay inside artifacts directory: ${options.filename}`)
|
|
718
|
-
}
|
|
719
|
-
return filePath
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
function formatNodeOutput(output: unknown): string {
|
|
723
|
-
return `[return value] ${util.inspect(output, {
|
|
724
|
-
depth: 4,
|
|
725
|
-
colors: false,
|
|
726
|
-
maxArrayLength: 100,
|
|
727
|
-
maxStringLength: 1000,
|
|
728
|
-
breakLength: 80,
|
|
729
|
-
})}`
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
function buildCapabilityCode(options: {
|
|
733
|
-
capability: CapabilityRecord
|
|
734
|
-
operation: ResolvedCapabilityOperation
|
|
735
|
-
script: string
|
|
736
|
-
input: unknown
|
|
737
|
-
force?: boolean
|
|
738
|
-
}): string {
|
|
739
|
-
const inputLiteral = JSON.stringify(options.input)
|
|
740
|
-
const capabilityLiteral = JSON.stringify({
|
|
741
|
-
id: options.capability.manifest.id,
|
|
742
|
-
title: options.capability.manifest.title,
|
|
743
|
-
description: options.capability.manifest.description,
|
|
744
|
-
operation: options.operation.id,
|
|
745
|
-
permissions: options.operation.permissions || options.capability.manifest.permissions,
|
|
746
|
-
})
|
|
747
|
-
const matchLiteral = JSON.stringify(options.operation.match)
|
|
748
|
-
return [
|
|
749
|
-
`const input = ${inputLiteral};`,
|
|
750
|
-
`const capability = ${capabilityLiteral};`,
|
|
751
|
-
`const __tabwrightCapabilityMatch = ${matchLiteral};`,
|
|
752
|
-
`const __tabwrightCapabilityForce = ${options.force ? 'true' : 'false'};`,
|
|
753
|
-
'if (!__tabwrightCapabilityForce && __tabwrightCapabilityMatch.length > 0) {',
|
|
754
|
-
' const __currentUrl = page.url();',
|
|
755
|
-
' const __matched = __tabwrightCapabilityMatch.some((pattern) => {',
|
|
756
|
-
" const escaped = pattern.split('*').map((part) => part.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')).join('.*');",
|
|
757
|
-
' return new RegExp(`^${escaped}$`).test(__currentUrl);',
|
|
758
|
-
' });',
|
|
759
|
-
' if (!__matched) {',
|
|
760
|
-
' throw new Error(`Capability ${capability.id} does not match current page URL: ${__currentUrl}`);',
|
|
761
|
-
' }',
|
|
762
|
-
'}',
|
|
763
|
-
'const __tabwrightCapabilityObservedNetworkUrls = new Set();',
|
|
764
|
-
'const __tabwrightCapabilityOnRequest = (request) => {',
|
|
765
|
-
' __tabwrightCapabilityObservedNetworkUrls.add(request.url());',
|
|
766
|
-
'};',
|
|
767
|
-
"page.on('request', __tabwrightCapabilityOnRequest);",
|
|
768
|
-
'try {',
|
|
769
|
-
' const __tabwrightCapabilityOutput = await (async () => {',
|
|
770
|
-
options.script,
|
|
771
|
-
'\n })();',
|
|
772
|
-
' return {',
|
|
773
|
-
' __tabwrightCapabilityEnvelope: 1,',
|
|
774
|
-
' output: __tabwrightCapabilityOutput === undefined ? undefined : JSON.parse(JSON.stringify(__tabwrightCapabilityOutput)),',
|
|
775
|
-
' observedNetworkUrls: [...__tabwrightCapabilityObservedNetworkUrls],',
|
|
776
|
-
' url: page.url(),',
|
|
777
|
-
' };',
|
|
778
|
-
'} catch (__tabwrightCapabilityError) {',
|
|
779
|
-
' return {',
|
|
780
|
-
' __tabwrightCapabilityEnvelope: 1,',
|
|
781
|
-
' output: undefined,',
|
|
782
|
-
' observedNetworkUrls: [...__tabwrightCapabilityObservedNetworkUrls],',
|
|
783
|
-
' url: page.url(),',
|
|
784
|
-
' error: __tabwrightCapabilityError instanceof Error',
|
|
785
|
-
' ? (__tabwrightCapabilityError.stack || __tabwrightCapabilityError.message)',
|
|
786
|
-
' : String(__tabwrightCapabilityError),',
|
|
787
|
-
' };',
|
|
788
|
-
'} finally {',
|
|
789
|
-
" page.off('request', __tabwrightCapabilityOnRequest);",
|
|
790
|
-
'}',
|
|
791
|
-
`//# sourceURL=tabwright-capability://${options.capability.manifest.id}`,
|
|
792
|
-
'',
|
|
793
|
-
].join('\n')
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
function hashInput(input: unknown): string {
|
|
797
|
-
return crypto
|
|
798
|
-
.createHash('sha256')
|
|
799
|
-
.update(JSON.stringify(input) || 'undefined')
|
|
800
|
-
.digest('hex')
|
|
801
|
-
}
|