tabwright 1.0.0
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/LICENSE +21 -0
- package/bin.js +4 -0
- package/dist/a11y-client.js +204 -0
- package/dist/agent-skills/tabwright/SKILL.md +119 -0
- package/dist/aria-snapshot.d.ts +262 -0
- package/dist/aria-snapshot.d.ts.map +1 -0
- package/dist/aria-snapshot.js +1256 -0
- package/dist/aria-snapshot.js.map +1 -0
- package/dist/aria-snapshot.test.d.ts +2 -0
- package/dist/aria-snapshot.test.d.ts.map +1 -0
- package/dist/aria-snapshot.test.js +270 -0
- package/dist/aria-snapshot.test.js.map +1 -0
- package/dist/aria-snapshot.unit.test.d.ts +2 -0
- package/dist/aria-snapshot.unit.test.d.ts.map +1 -0
- package/dist/aria-snapshot.unit.test.js +542 -0
- package/dist/aria-snapshot.unit.test.js.map +1 -0
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts +5 -0
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts.map +1 -0
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js +5 -0
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js.map +1 -0
- package/dist/bippy.js +894 -0
- package/dist/browser-config.d.ts +13 -0
- package/dist/browser-config.d.ts.map +1 -0
- package/dist/browser-config.js +126 -0
- package/dist/browser-config.js.map +1 -0
- package/dist/browser-install.d.ts +16 -0
- package/dist/browser-install.d.ts.map +1 -0
- package/dist/browser-install.js +238 -0
- package/dist/browser-install.js.map +1 -0
- package/dist/browser-launch.d.ts +17 -0
- package/dist/browser-launch.d.ts.map +1 -0
- package/dist/browser-launch.js +44 -0
- package/dist/browser-launch.js.map +1 -0
- package/dist/builtin-capabilities.d.ts +28 -0
- package/dist/builtin-capabilities.d.ts.map +1 -0
- package/dist/builtin-capabilities.js +2673 -0
- package/dist/builtin-capabilities.js.map +1 -0
- package/dist/capability-agent-skill.d.ts +60 -0
- package/dist/capability-agent-skill.d.ts.map +1 -0
- package/dist/capability-agent-skill.js +225 -0
- package/dist/capability-agent-skill.js.map +1 -0
- package/dist/capability-auth-state.d.ts +34 -0
- package/dist/capability-auth-state.d.ts.map +1 -0
- package/dist/capability-auth-state.js +157 -0
- package/dist/capability-auth-state.js.map +1 -0
- package/dist/capability-auth.d.ts +36 -0
- package/dist/capability-auth.d.ts.map +1 -0
- package/dist/capability-auth.js +198 -0
- package/dist/capability-auth.js.map +1 -0
- package/dist/capability-cli-confirmation.test.d.ts +2 -0
- package/dist/capability-cli-confirmation.test.d.ts.map +1 -0
- package/dist/capability-cli-confirmation.test.js +79 -0
- package/dist/capability-cli-confirmation.test.js.map +1 -0
- package/dist/capability-options.d.ts +20 -0
- package/dist/capability-options.d.ts.map +1 -0
- package/dist/capability-options.js +31 -0
- package/dist/capability-options.js.map +1 -0
- package/dist/capability-options.test.d.ts +2 -0
- package/dist/capability-options.test.d.ts.map +1 -0
- package/dist/capability-options.test.js +81 -0
- package/dist/capability-options.test.js.map +1 -0
- package/dist/capability-package.d.ts +27 -0
- package/dist/capability-package.d.ts.map +1 -0
- package/dist/capability-package.js +444 -0
- package/dist/capability-package.js.map +1 -0
- package/dist/capability-package.test.d.ts +2 -0
- package/dist/capability-package.test.d.ts.map +1 -0
- package/dist/capability-package.test.js +179 -0
- package/dist/capability-package.test.js.map +1 -0
- package/dist/capability-registry.d.ts +262 -0
- package/dist/capability-registry.d.ts.map +1 -0
- package/dist/capability-registry.js +931 -0
- package/dist/capability-registry.js.map +1 -0
- package/dist/capability-registry.test.d.ts +2 -0
- package/dist/capability-registry.test.d.ts.map +1 -0
- package/dist/capability-registry.test.js +1683 -0
- package/dist/capability-registry.test.js.map +1 -0
- package/dist/capability-runner.d.ts +99 -0
- package/dist/capability-runner.d.ts.map +1 -0
- package/dist/capability-runner.js +608 -0
- package/dist/capability-runner.js.map +1 -0
- package/dist/capability-search-relevance.test.d.ts +2 -0
- package/dist/capability-search-relevance.test.d.ts.map +1 -0
- package/dist/capability-search-relevance.test.js +67 -0
- package/dist/capability-search-relevance.test.js.map +1 -0
- package/dist/capability-studio.d.ts +11 -0
- package/dist/capability-studio.d.ts.map +1 -0
- package/dist/capability-studio.js +593 -0
- package/dist/capability-studio.js.map +1 -0
- package/dist/capability-studio.test.d.ts +2 -0
- package/dist/capability-studio.test.d.ts.map +1 -0
- package/dist/capability-studio.test.js +41 -0
- package/dist/capability-studio.test.js.map +1 -0
- package/dist/cdp-log.d.ts +19 -0
- package/dist/cdp-log.d.ts.map +1 -0
- package/dist/cdp-log.js +83 -0
- package/dist/cdp-log.js.map +1 -0
- package/dist/cdp-log.test.d.ts +2 -0
- package/dist/cdp-log.test.d.ts.map +1 -0
- package/dist/cdp-log.test.js +109 -0
- package/dist/cdp-log.test.js.map +1 -0
- package/dist/cdp-relay.d.ts +19 -0
- package/dist/cdp-relay.d.ts.map +1 -0
- package/dist/cdp-relay.js +2375 -0
- package/dist/cdp-relay.js.map +1 -0
- package/dist/cdp-session.d.ts +37 -0
- package/dist/cdp-session.d.ts.map +1 -0
- package/dist/cdp-session.js +36 -0
- package/dist/cdp-session.js.map +1 -0
- package/dist/cdp-types.d.ts +65 -0
- package/dist/cdp-types.d.ts.map +1 -0
- package/dist/cdp-types.js +91 -0
- package/dist/cdp-types.js.map +1 -0
- package/dist/channel-owner-inspect.test.d.ts +2 -0
- package/dist/channel-owner-inspect.test.d.ts.map +1 -0
- package/dist/channel-owner-inspect.test.js +75 -0
- package/dist/channel-owner-inspect.test.js.map +1 -0
- package/dist/chrome-discovery.d.ts +65 -0
- package/dist/chrome-discovery.d.ts.map +1 -0
- package/dist/chrome-discovery.js +173 -0
- package/dist/chrome-discovery.js.map +1 -0
- package/dist/chrome-discovery.test.d.ts +2 -0
- package/dist/chrome-discovery.test.d.ts.map +1 -0
- package/dist/chrome-discovery.test.js +41 -0
- package/dist/chrome-discovery.test.js.map +1 -0
- package/dist/clean-html.d.ts +11 -0
- package/dist/clean-html.d.ts.map +1 -0
- package/dist/clean-html.js +106 -0
- package/dist/clean-html.js.map +1 -0
- package/dist/cli-help.test.d.ts +2 -0
- package/dist/cli-help.test.d.ts.map +1 -0
- package/dist/cli-help.test.js +98 -0
- package/dist/cli-help.test.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2709 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud-client.d.ts +56 -0
- package/dist/cloud-client.d.ts.map +1 -0
- package/dist/cloud-client.js +127 -0
- package/dist/cloud-client.js.map +1 -0
- package/dist/create-logger.d.ts +9 -0
- package/dist/create-logger.d.ts.map +1 -0
- package/dist/create-logger.js +27 -0
- package/dist/create-logger.js.map +1 -0
- package/dist/debugger-api.md +458 -0
- package/dist/debugger-examples-types.d.ts +24 -0
- package/dist/debugger-examples-types.d.ts.map +1 -0
- package/dist/debugger-examples-types.js +2 -0
- package/dist/debugger-examples-types.js.map +1 -0
- package/dist/debugger-examples.d.ts +6 -0
- package/dist/debugger-examples.d.ts.map +1 -0
- package/dist/debugger-examples.js +53 -0
- package/dist/debugger-examples.js.map +1 -0
- package/dist/debugger.d.ts +381 -0
- package/dist/debugger.d.ts.map +1 -0
- package/dist/debugger.js +630 -0
- package/dist/debugger.js.map +1 -0
- package/dist/diff-utils.d.ts +20 -0
- package/dist/diff-utils.d.ts.map +1 -0
- package/dist/diff-utils.js +50 -0
- package/dist/diff-utils.js.map +1 -0
- package/dist/diff-utils.test.d.ts +2 -0
- package/dist/diff-utils.test.d.ts.map +1 -0
- package/dist/diff-utils.test.js +137 -0
- package/dist/diff-utils.test.js.map +1 -0
- package/dist/doctor.d.ts +44 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +246 -0
- package/dist/doctor.js.map +1 -0
- package/dist/doctor.test.d.ts +2 -0
- package/dist/doctor.test.d.ts.map +1 -0
- package/dist/doctor.test.js +208 -0
- package/dist/doctor.test.js.map +1 -0
- package/dist/editor-api.md +374 -0
- package/dist/editor-examples.d.ts +11 -0
- package/dist/editor-examples.d.ts.map +1 -0
- package/dist/editor-examples.js +124 -0
- package/dist/editor-examples.js.map +1 -0
- package/dist/editor.d.ts +203 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +363 -0
- package/dist/editor.js.map +1 -0
- package/dist/env-compat.d.ts +2 -0
- package/dist/env-compat.d.ts.map +1 -0
- package/dist/env-compat.js +27 -0
- package/dist/env-compat.js.map +1 -0
- package/dist/executor.d.ts +229 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +1465 -0
- package/dist/executor.js.map +1 -0
- package/dist/executor.unit.test.d.ts +2 -0
- package/dist/executor.unit.test.d.ts.map +1 -0
- package/dist/executor.unit.test.js +143 -0
- package/dist/executor.unit.test.js.map +1 -0
- package/dist/extension/_locales/en/messages.json +278 -0
- package/dist/extension/_locales/zh_CN/messages.json +256 -0
- package/dist/extension/assets/options-CYH96Lcx.css +1349 -0
- package/dist/extension/background.js +3994 -0
- package/dist/extension/icons/SolarCursorSquareBold.png +0 -0
- package/dist/extension/icons/icon-black-128.png +0 -0
- package/dist/extension/icons/icon-black-16.png +0 -0
- package/dist/extension/icons/icon-black-32.png +0 -0
- package/dist/extension/icons/icon-black-48.png +0 -0
- package/dist/extension/icons/icon-gray-128.png +0 -0
- package/dist/extension/icons/icon-gray-16.png +0 -0
- package/dist/extension/icons/icon-gray-32.png +0 -0
- package/dist/extension/icons/icon-gray-48.png +0 -0
- package/dist/extension/icons/icon-green-128.png +0 -0
- package/dist/extension/icons/icon-green-16.png +0 -0
- package/dist/extension/icons/icon-green-32.png +0 -0
- package/dist/extension/icons/icon-green-48.png +0 -0
- package/dist/extension/icons/tabwright-icon-black.png +0 -0
- package/dist/extension/icons/tabwright-icon-gray-disabled.png +0 -0
- package/dist/extension/icons/tabwright-icon-gray-disabled.svg +1 -0
- package/dist/extension/manifest.json +54 -0
- package/dist/extension/options.js +16145 -0
- package/dist/extension/rrweb-recorder.js +12952 -0
- package/dist/extension/src/options.html +165 -0
- package/dist/extension/src/prism-bash.min.js +1 -0
- package/dist/extension/src/prism.min.js +1 -0
- package/dist/extension/src/welcome.html +396 -0
- package/dist/extension-connection.test.d.ts +2 -0
- package/dist/extension-connection.test.d.ts.map +1 -0
- package/dist/extension-connection.test.js +708 -0
- package/dist/extension-connection.test.js.map +1 -0
- package/dist/extension-icon-warning.test.d.ts +2 -0
- package/dist/extension-icon-warning.test.d.ts.map +1 -0
- package/dist/extension-icon-warning.test.js +33 -0
- package/dist/extension-icon-warning.test.js.map +1 -0
- package/dist/ghost-browser.d.ts +62 -0
- package/dist/ghost-browser.d.ts.map +1 -0
- package/dist/ghost-browser.js +107 -0
- package/dist/ghost-browser.js.map +1 -0
- package/dist/ghost-cursor-client.js +374 -0
- package/dist/ghost-cursor-controller.d.ts +46 -0
- package/dist/ghost-cursor-controller.d.ts.map +1 -0
- package/dist/ghost-cursor-controller.js +98 -0
- package/dist/ghost-cursor-controller.js.map +1 -0
- package/dist/ghost-cursor.d.ts +27 -0
- package/dist/ghost-cursor.d.ts.map +1 -0
- package/dist/ghost-cursor.js +79 -0
- package/dist/ghost-cursor.js.map +1 -0
- package/dist/htmlrewrite.d.ts +8 -0
- package/dist/htmlrewrite.d.ts.map +1 -0
- package/dist/htmlrewrite.js +339 -0
- package/dist/htmlrewrite.js.map +1 -0
- package/dist/htmlrewrite.test.d.ts +2 -0
- package/dist/htmlrewrite.test.d.ts.map +1 -0
- package/dist/htmlrewrite.test.js +7975 -0
- package/dist/htmlrewrite.test.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/kill-port.d.ts +29 -0
- package/dist/kill-port.d.ts.map +1 -0
- package/dist/kill-port.js +190 -0
- package/dist/kill-port.js.map +1 -0
- package/dist/kitty-graphics.d.ts +22 -0
- package/dist/kitty-graphics.d.ts.map +1 -0
- package/dist/kitty-graphics.js +71 -0
- package/dist/kitty-graphics.js.map +1 -0
- package/dist/kitty-graphics.test.d.ts +2 -0
- package/dist/kitty-graphics.test.d.ts.map +1 -0
- package/dist/kitty-graphics.test.js +125 -0
- package/dist/kitty-graphics.test.js.map +1 -0
- package/dist/locator-selector.test.d.ts +2 -0
- package/dist/locator-selector.test.d.ts.map +1 -0
- package/dist/locator-selector.test.js +98 -0
- package/dist/locator-selector.test.js.map +1 -0
- package/dist/mcp-client.d.ts +20 -0
- package/dist/mcp-client.d.ts.map +1 -0
- package/dist/mcp-client.js +56 -0
- package/dist/mcp-client.js.map +1 -0
- package/dist/mcp.d.ts +6 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +511 -0
- package/dist/mcp.js.map +1 -0
- package/dist/on-mouse-action.test.d.ts +2 -0
- package/dist/on-mouse-action.test.d.ts.map +1 -0
- package/dist/on-mouse-action.test.js +180 -0
- package/dist/on-mouse-action.test.js.map +1 -0
- package/dist/options-page.test.d.ts +2 -0
- package/dist/options-page.test.d.ts.map +1 -0
- package/dist/options-page.test.js +773 -0
- package/dist/options-page.test.js.map +1 -0
- package/dist/package-paths.d.ts +4 -0
- package/dist/package-paths.d.ts.map +1 -0
- package/dist/package-paths.js +30 -0
- package/dist/package-paths.js.map +1 -0
- package/dist/page-markdown.d.ts +40 -0
- package/dist/page-markdown.d.ts.map +1 -0
- package/dist/page-markdown.js +181 -0
- package/dist/page-markdown.js.map +1 -0
- package/dist/performance-examples.d.ts +5 -0
- package/dist/performance-examples.d.ts.map +1 -0
- package/dist/performance-examples.js +112 -0
- package/dist/performance-examples.js.map +1 -0
- package/dist/performance-profiling.md +417 -0
- package/dist/playwright-import.d.ts +19 -0
- package/dist/playwright-import.d.ts.map +1 -0
- package/dist/playwright-import.js +40 -0
- package/dist/playwright-import.js.map +1 -0
- package/dist/popup-relocation.test.d.ts +7 -0
- package/dist/popup-relocation.test.d.ts.map +1 -0
- package/dist/popup-relocation.test.js +139 -0
- package/dist/popup-relocation.test.js.map +1 -0
- package/dist/product-paths.d.ts +9 -0
- package/dist/product-paths.d.ts.map +1 -0
- package/dist/product-paths.js +24 -0
- package/dist/product-paths.js.map +1 -0
- package/dist/product-paths.test.d.ts +2 -0
- package/dist/product-paths.test.d.ts.map +1 -0
- package/dist/product-paths.test.js +39 -0
- package/dist/product-paths.test.js.map +1 -0
- package/dist/prompt.md +1004 -0
- package/dist/protocol.d.ts +248 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +59 -0
- package/dist/protocol.js.map +1 -0
- package/dist/protocol.test.d.ts +2 -0
- package/dist/protocol.test.d.ts.map +1 -0
- package/dist/protocol.test.js +31 -0
- package/dist/protocol.test.js.map +1 -0
- package/dist/react-source.d.ts +57 -0
- package/dist/react-source.d.ts.map +1 -0
- package/dist/react-source.js +254 -0
- package/dist/react-source.js.map +1 -0
- package/dist/readability.js +1674 -0
- package/dist/relay-client.d.ts +104 -0
- package/dist/relay-client.d.ts.map +1 -0
- package/dist/relay-client.js +426 -0
- package/dist/relay-client.js.map +1 -0
- package/dist/relay-client.test.d.ts +2 -0
- package/dist/relay-client.test.d.ts.map +1 -0
- package/dist/relay-client.test.js +305 -0
- package/dist/relay-client.test.js.map +1 -0
- package/dist/relay-core.test.d.ts +2 -0
- package/dist/relay-core.test.d.ts.map +1 -0
- package/dist/relay-core.test.js +1427 -0
- package/dist/relay-core.test.js.map +1 -0
- package/dist/relay-navigation.test.d.ts +2 -0
- package/dist/relay-navigation.test.d.ts.map +1 -0
- package/dist/relay-navigation.test.js +661 -0
- package/dist/relay-navigation.test.js.map +1 -0
- package/dist/relay-session.test.d.ts +2 -0
- package/dist/relay-session.test.d.ts.map +1 -0
- package/dist/relay-session.test.js +1121 -0
- package/dist/relay-session.test.js.map +1 -0
- package/dist/relay-state.d.ts +178 -0
- package/dist/relay-state.d.ts.map +1 -0
- package/dist/relay-state.js +346 -0
- package/dist/relay-state.js.map +1 -0
- package/dist/relay-state.test.d.ts +2 -0
- package/dist/relay-state.test.d.ts.map +1 -0
- package/dist/relay-state.test.js +594 -0
- package/dist/relay-state.test.js.map +1 -0
- package/dist/replay-ai-index.d.ts +99 -0
- package/dist/replay-ai-index.d.ts.map +1 -0
- package/dist/replay-ai-index.js +677 -0
- package/dist/replay-ai-index.js.map +1 -0
- package/dist/replay-ai-index.test.d.ts +2 -0
- package/dist/replay-ai-index.test.d.ts.map +1 -0
- package/dist/replay-ai-index.test.js +255 -0
- package/dist/replay-ai-index.test.js.map +1 -0
- package/dist/replay-cli.test.d.ts +2 -0
- package/dist/replay-cli.test.d.ts.map +1 -0
- package/dist/replay-cli.test.js +275 -0
- package/dist/replay-cli.test.js.map +1 -0
- package/dist/replay-eval.d.ts +44 -0
- package/dist/replay-eval.d.ts.map +1 -0
- package/dist/replay-eval.js +902 -0
- package/dist/replay-eval.js.map +1 -0
- package/dist/replay-handoff.d.ts +29 -0
- package/dist/replay-handoff.d.ts.map +1 -0
- package/dist/replay-handoff.js +83 -0
- package/dist/replay-handoff.js.map +1 -0
- package/dist/replay-handoff.test.d.ts +2 -0
- package/dist/replay-handoff.test.d.ts.map +1 -0
- package/dist/replay-handoff.test.js +123 -0
- package/dist/replay-handoff.test.js.map +1 -0
- package/dist/replay-workflow-compiler.d.ts +44 -0
- package/dist/replay-workflow-compiler.d.ts.map +1 -0
- package/dist/replay-workflow-compiler.js +601 -0
- package/dist/replay-workflow-compiler.js.map +1 -0
- package/dist/replay-workflow-compiler.test.d.ts +2 -0
- package/dist/replay-workflow-compiler.test.d.ts.map +1 -0
- package/dist/replay-workflow-compiler.test.js +223 -0
- package/dist/replay-workflow-compiler.test.js.map +1 -0
- package/dist/rrweb-recording-relay.d.ts +56 -0
- package/dist/rrweb-recording-relay.d.ts.map +1 -0
- package/dist/rrweb-recording-relay.js +299 -0
- package/dist/rrweb-recording-relay.js.map +1 -0
- package/dist/rrweb-recording-relay.test.d.ts +2 -0
- package/dist/rrweb-recording-relay.test.d.ts.map +1 -0
- package/dist/rrweb-recording-relay.test.js +85 -0
- package/dist/rrweb-recording-relay.test.js.map +1 -0
- package/dist/rrweb-recording.d.ts +104 -0
- package/dist/rrweb-recording.d.ts.map +1 -0
- package/dist/rrweb-recording.js +180 -0
- package/dist/rrweb-recording.js.map +1 -0
- package/dist/scoped-fs.d.ts +95 -0
- package/dist/scoped-fs.d.ts.map +1 -0
- package/dist/scoped-fs.js +358 -0
- package/dist/scoped-fs.js.map +1 -0
- package/dist/scoped-fs.test.d.ts +5 -0
- package/dist/scoped-fs.test.d.ts.map +1 -0
- package/dist/scoped-fs.test.js +73 -0
- package/dist/scoped-fs.test.js.map +1 -0
- package/dist/selector-generator.js +7378 -0
- package/dist/skill-stub.test.d.ts +2 -0
- package/dist/skill-stub.test.d.ts.map +1 -0
- package/dist/skill-stub.test.js +22 -0
- package/dist/skill-stub.test.js.map +1 -0
- package/dist/snapshot-tools.test.d.ts +2 -0
- package/dist/snapshot-tools.test.d.ts.map +1 -0
- package/dist/snapshot-tools.test.js +856 -0
- package/dist/snapshot-tools.test.js.map +1 -0
- package/dist/start-relay-server.d.ts +6 -0
- package/dist/start-relay-server.d.ts.map +1 -0
- package/dist/start-relay-server.js +57 -0
- package/dist/start-relay-server.js.map +1 -0
- package/dist/styles-api.md +124 -0
- package/dist/styles-examples.d.ts +8 -0
- package/dist/styles-examples.d.ts.map +1 -0
- package/dist/styles-examples.js +64 -0
- package/dist/styles-examples.js.map +1 -0
- package/dist/styles.d.ts +27 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +231 -0
- package/dist/styles.js.map +1 -0
- package/dist/tabwright-agent-skill.d.ts +30 -0
- package/dist/tabwright-agent-skill.d.ts.map +1 -0
- package/dist/tabwright-agent-skill.js +74 -0
- package/dist/tabwright-agent-skill.js.map +1 -0
- package/dist/tabwright-agent-skill.test.d.ts +2 -0
- package/dist/tabwright-agent-skill.test.d.ts.map +1 -0
- package/dist/tabwright-agent-skill.test.js +51 -0
- package/dist/tabwright-agent-skill.test.js.map +1 -0
- package/dist/test-declarations.d.ts +13 -0
- package/dist/test-declarations.d.ts.map +1 -0
- package/dist/test-declarations.js +2 -0
- package/dist/test-declarations.js.map +1 -0
- package/dist/test-utils.d.ts +69 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/test-utils.js +448 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/test-utils.test.d.ts +2 -0
- package/dist/test-utils.test.d.ts.map +1 -0
- package/dist/test-utils.test.js +55 -0
- package/dist/test-utils.test.js.map +1 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +60 -0
- package/dist/utils.js.map +1 -0
- package/dist/wait-for-page-load.d.ts +16 -0
- package/dist/wait-for-page-load.d.ts.map +1 -0
- package/dist/wait-for-page-load.js +146 -0
- package/dist/wait-for-page-load.js.map +1 -0
- package/dist/workflow-capability.d.ts +72 -0
- package/dist/workflow-capability.d.ts.map +1 -0
- package/dist/workflow-capability.js +316 -0
- package/dist/workflow-capability.js.map +1 -0
- package/dist/workflow-script-flow.test.d.ts +2 -0
- package/dist/workflow-script-flow.test.d.ts.map +1 -0
- package/dist/workflow-script-flow.test.js +285 -0
- package/dist/workflow-script-flow.test.js.map +1 -0
- package/package.json +80 -0
- package/src/__snapshots__/x.com.processed.html +1003 -0
- package/src/__snapshots__/x.com.processed.withStyles.html +2720 -0
- package/src/a11y-client.ts +241 -0
- package/src/agent-skills/conan-config/SKILL.md +141 -0
- package/src/agent-skills/conan-config/agents/openai.yaml +4 -0
- package/src/aria-snapshot.test.ts +311 -0
- package/src/aria-snapshot.ts +1681 -0
- package/src/aria-snapshot.unit.test.ts +615 -0
- package/src/aria-snapshots/github-interactive.txt +193 -0
- package/src/aria-snapshots/github-raw.txt +309 -0
- package/src/aria-snapshots/hackernews-interactive.txt +477 -0
- package/src/aria-snapshots/hackernews-raw.txt +428 -0
- package/src/aria-snapshots/prosemirror-interactive.txt +66 -0
- package/src/aria-snapshots/prosemirror-raw.txt +145 -0
- 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 +5 -0
- package/src/assets/cursors/screen-studio/pointer-macos-tahoe.svg +18 -0
- package/src/assets/x.com.html +32946 -0
- package/src/browser-config.ts +179 -0
- package/src/browser-install.ts +284 -0
- package/src/browser-launch.ts +75 -0
- package/src/builtin-capabilities.ts +2765 -0
- package/src/capability-agent-skill.ts +305 -0
- package/src/capability-auth-state.ts +197 -0
- package/src/capability-auth.ts +249 -0
- package/src/capability-cli-confirmation.test.ts +90 -0
- package/src/capability-options.test.ts +89 -0
- package/src/capability-options.ts +57 -0
- package/src/capability-package.test.ts +204 -0
- package/src/capability-package.ts +555 -0
- package/src/capability-registry.test.ts +1905 -0
- package/src/capability-registry.ts +1234 -0
- package/src/capability-runner.ts +801 -0
- package/src/capability-search-relevance.test.ts +73 -0
- package/src/capability-studio.test.ts +45 -0
- package/src/capability-studio.ts +641 -0
- package/src/cdp-log.test.ts +131 -0
- package/src/cdp-log.ts +112 -0
- package/src/cdp-relay.ts +2944 -0
- package/src/cdp-session.ts +77 -0
- package/src/cdp-types.ts +158 -0
- package/src/channel-owner-inspect.test.ts +94 -0
- package/src/chrome-discovery.test.ts +50 -0
- package/src/chrome-discovery.ts +220 -0
- package/src/clean-html.ts +141 -0
- package/src/cli-help.test.ts +123 -0
- package/src/cli.ts +3181 -0
- package/src/cloud-client.ts +179 -0
- package/src/create-logger.ts +38 -0
- package/src/debugger-examples-types.ts +16 -0
- package/src/debugger-examples.ts +66 -0
- package/src/debugger.ts +708 -0
- package/src/diff-utils.test.ts +152 -0
- package/src/diff-utils.ts +70 -0
- package/src/doctor.test.ts +244 -0
- package/src/doctor.ts +321 -0
- package/src/editor-examples.ts +158 -0
- package/src/editor.ts +426 -0
- package/src/env-compat.ts +28 -0
- package/src/executor.ts +1824 -0
- package/src/executor.unit.test.ts +168 -0
- package/src/extension-connection.test.ts +855 -0
- package/src/extension-icon-warning.test.ts +45 -0
- package/src/ghost-browser.ts +149 -0
- package/src/ghost-cursor-client.ts +494 -0
- package/src/ghost-cursor-controller.ts +129 -0
- package/src/ghost-cursor.ts +123 -0
- package/src/htmlrewrite.test.ts +8008 -0
- package/src/htmlrewrite.ts +390 -0
- package/src/index.ts +53 -0
- package/src/kill-port.ts +219 -0
- package/src/kitty-graphics.test.ts +139 -0
- package/src/kitty-graphics.ts +79 -0
- package/src/locator-selector.test.ts +119 -0
- package/src/mcp-client.ts +78 -0
- package/src/mcp.ts +629 -0
- package/src/on-mouse-action.test.ts +226 -0
- package/src/options-page.test.ts +839 -0
- package/src/package-paths.ts +38 -0
- package/src/page-markdown.ts +240 -0
- package/src/performance-examples.ts +186 -0
- package/src/playwright-import.ts +59 -0
- package/src/popup-relocation.test.ts +163 -0
- package/src/product-paths.test.ts +47 -0
- package/src/product-paths.ts +28 -0
- package/src/protocol.test.ts +52 -0
- package/src/protocol.ts +351 -0
- package/src/react-source.ts +379 -0
- package/src/relay-client.test.ts +375 -0
- package/src/relay-client.ts +572 -0
- package/src/relay-core.test.ts +1603 -0
- package/src/relay-navigation.test.ts +790 -0
- package/src/relay-session.test.ts +1375 -0
- package/src/relay-state.test.ts +729 -0
- package/src/relay-state.ts +561 -0
- package/src/replay-ai-index.test.ts +278 -0
- package/src/replay-ai-index.ts +872 -0
- package/src/replay-cli.test.ts +325 -0
- package/src/replay-eval.ts +1039 -0
- package/src/replay-handoff.test.ts +163 -0
- package/src/replay-handoff.ts +109 -0
- package/src/replay-workflow-compiler.test.ts +250 -0
- package/src/replay-workflow-compiler.ts +700 -0
- package/src/resource.md +409 -0
- package/src/rrweb-recording-relay.test.ts +99 -0
- package/src/rrweb-recording-relay.ts +400 -0
- package/src/rrweb-recording.ts +322 -0
- package/src/scoped-fs.test.ts +80 -0
- package/src/scoped-fs.ts +420 -0
- package/src/skill-stub.test.ts +24 -0
- package/src/skill.md +1413 -0
- package/src/snapshot-tools.test.ts +1017 -0
- package/src/snapshots/hacker-news-accessibility-full.md +81 -0
- package/src/snapshots/hacker-news-accessibility-interactive.md +43 -0
- package/src/snapshots/page-markdown-output.txt +16 -0
- package/src/snapshots/shadcn-ui-accessibility-full.md +201 -0
- package/src/snapshots/shadcn-ui-accessibility-interactive.md +109 -0
- package/src/start-relay-server.ts +69 -0
- package/src/styles-examples.ts +84 -0
- package/src/styles.ts +343 -0
- package/src/tabwright-agent-skill.test.ts +61 -0
- package/src/tabwright-agent-skill.ts +105 -0
- package/src/test-declarations.ts +13 -0
- package/src/test-utils.test.ts +70 -0
- package/src/test-utils.ts +566 -0
- package/src/utils.ts +78 -0
- package/src/wait-for-page-load.ts +198 -0
- package/src/workflow-capability.ts +417 -0
- package/src/workflow-script-flow.test.ts +388 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import {
|
|
3
|
+
readCapabilitySecrets,
|
|
4
|
+
requireCapability,
|
|
5
|
+
writeCapabilitySecrets,
|
|
6
|
+
type CapabilityRecord,
|
|
7
|
+
} from './capability-registry.js'
|
|
8
|
+
import { writeStoredCapabilityAuthState } from './capability-auth-state.js'
|
|
9
|
+
import type { ExecuteResult } from './executor.js'
|
|
10
|
+
|
|
11
|
+
export interface CapabilityAuthExecutor {
|
|
12
|
+
execute(
|
|
13
|
+
code: string,
|
|
14
|
+
timeout?: number,
|
|
15
|
+
options?: { includeStructuredResult?: boolean },
|
|
16
|
+
): Promise<ExecuteResult>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CapabilityAuthRefreshResult {
|
|
20
|
+
capability: CapabilityRecord
|
|
21
|
+
saved: boolean
|
|
22
|
+
secretKey: string
|
|
23
|
+
cookieCount: number
|
|
24
|
+
cookieNames: string[]
|
|
25
|
+
urls: string[]
|
|
26
|
+
expiresAt?: string
|
|
27
|
+
path: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CapabilityAuthCookie {
|
|
31
|
+
name: string
|
|
32
|
+
value: string
|
|
33
|
+
expires?: number
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function refreshCapabilityAuthWithExecutor(options: {
|
|
37
|
+
executor: CapabilityAuthExecutor
|
|
38
|
+
id: string
|
|
39
|
+
cwd?: string
|
|
40
|
+
timeout?: number
|
|
41
|
+
browserKey?: string
|
|
42
|
+
}): Promise<CapabilityAuthRefreshResult> {
|
|
43
|
+
const capability = requireCapability({ id: options.id, cwd: options.cwd })
|
|
44
|
+
if (capability.manifest.auth.type !== 'cookie' || capability.manifest.auth.refresh !== 'from-browser') {
|
|
45
|
+
throw new Error(`Capability ${options.id} does not declare browser-refreshable cookie auth`)
|
|
46
|
+
}
|
|
47
|
+
if (capability.manifest.auth.browserUrls.length === 0) {
|
|
48
|
+
throw new Error(`Capability ${options.id} auth.browserUrls is required for cookie refresh`)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const executeResult = await options.executor.execute(buildCookieRefreshCode({ capability }), options.timeout || 10000, {
|
|
52
|
+
includeStructuredResult: true,
|
|
53
|
+
})
|
|
54
|
+
if (executeResult.isError) {
|
|
55
|
+
throw new Error(`Failed to refresh capability auth: ${executeResult.text}`)
|
|
56
|
+
}
|
|
57
|
+
const parsed = parseRefreshResult(executeResult.structuredResult)
|
|
58
|
+
writeStoredCapabilityAuthState({
|
|
59
|
+
capability,
|
|
60
|
+
state: {
|
|
61
|
+
schemaVersion: 1,
|
|
62
|
+
refreshedAt: new Date().toISOString(),
|
|
63
|
+
expiresAt: parsed.expiresAt,
|
|
64
|
+
cookieNames: parsed.cookieNames,
|
|
65
|
+
browserKey: options.browserKey,
|
|
66
|
+
},
|
|
67
|
+
})
|
|
68
|
+
return {
|
|
69
|
+
capability,
|
|
70
|
+
...parsed,
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function buildCookieRefreshCode(options: { capability: CapabilityRecord }): string {
|
|
75
|
+
const secretKey = options.capability.manifest.auth.secretKey || 'cookieHeader'
|
|
76
|
+
const secretsPath = path.join(options.capability.dir, 'secrets.json')
|
|
77
|
+
return [
|
|
78
|
+
'const fs = await globalThis.import("node:fs")',
|
|
79
|
+
`const urls = ${JSON.stringify(options.capability.manifest.auth.browserUrls)};`,
|
|
80
|
+
`const requiredCookieNames = ${JSON.stringify(options.capability.manifest.auth.requiredCookieNames)};`,
|
|
81
|
+
`const secretKey = ${JSON.stringify(secretKey)};`,
|
|
82
|
+
`const secretsPath = ${JSON.stringify(secretsPath)};`,
|
|
83
|
+
`const secretsDir = ${JSON.stringify(options.capability.dir)};`,
|
|
84
|
+
'const cdp = await getCDPSession({ page });',
|
|
85
|
+
'const result = await cdp.send("Network.getCookies", { urls });',
|
|
86
|
+
'const cookies = Array.isArray(result.cookies) ? result.cookies : [];',
|
|
87
|
+
'const cookieNames = cookies.map((cookie) => cookie.name).filter((name) => typeof name === "string");',
|
|
88
|
+
'const missingCookieNames = requiredCookieNames.filter((name) => !cookieNames.includes(name));',
|
|
89
|
+
'if (missingCookieNames.length > 0) {',
|
|
90
|
+
' throw new Error(`Missing required cookies: ${missingCookieNames.join(", ")}`);',
|
|
91
|
+
'}',
|
|
92
|
+
'const cookieHeader = cookies.map((cookie) => `${cookie.name}=${cookie.value}`).join("; ");',
|
|
93
|
+
'if (!cookieHeader) {',
|
|
94
|
+
' throw new Error("No cookies were available for capability auth refresh");',
|
|
95
|
+
'}',
|
|
96
|
+
'const existingSecrets = fs.existsSync(secretsPath) ? JSON.parse(fs.readFileSync(secretsPath, "utf-8")) : {};',
|
|
97
|
+
'const nextSecrets = {',
|
|
98
|
+
' ...existingSecrets,',
|
|
99
|
+
' [secretKey]: cookieHeader,',
|
|
100
|
+
' updatedAt: new Date().toISOString(),',
|
|
101
|
+
'};',
|
|
102
|
+
'fs.mkdirSync(secretsDir, { recursive: true });',
|
|
103
|
+
'fs.writeFileSync(secretsPath, JSON.stringify(nextSecrets, null, 2), { mode: 0o600 });',
|
|
104
|
+
'if (process.platform !== "win32") {',
|
|
105
|
+
' fs.chmodSync(secretsPath, 0o600);',
|
|
106
|
+
'}',
|
|
107
|
+
'const expiryCookies = requiredCookieNames.length > 0',
|
|
108
|
+
' ? cookies.filter((cookie) => requiredCookieNames.includes(cookie.name))',
|
|
109
|
+
' : [];',
|
|
110
|
+
'const expiryValues = expiryCookies.map((cookie) => cookie.expires).filter((expires) => typeof expires === "number" && expires > 0);',
|
|
111
|
+
'const expiresAt = expiryCookies.length > 0 && expiryValues.length === expiryCookies.length',
|
|
112
|
+
' ? new Date(Math.min(...expiryValues) * 1000).toISOString()',
|
|
113
|
+
' : undefined;',
|
|
114
|
+
'return {',
|
|
115
|
+
' saved: true,',
|
|
116
|
+
' secretKey,',
|
|
117
|
+
' cookieCount: cookies.length,',
|
|
118
|
+
' cookieNames,',
|
|
119
|
+
' urls,',
|
|
120
|
+
' expiresAt,',
|
|
121
|
+
' path: secretsPath,',
|
|
122
|
+
'};',
|
|
123
|
+
`//# sourceURL=tabwright-capability-auth://${options.capability.manifest.id}`,
|
|
124
|
+
'',
|
|
125
|
+
].join('\n')
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function refreshCapabilityAuthFromCookies(options: {
|
|
129
|
+
id: string
|
|
130
|
+
cookies: CapabilityAuthCookie[]
|
|
131
|
+
cwd?: string
|
|
132
|
+
browserKey?: string
|
|
133
|
+
}): CapabilityAuthRefreshResult {
|
|
134
|
+
const capability = requireBrowserRefreshableCookieCapability({ id: options.id, cwd: options.cwd })
|
|
135
|
+
const cookieNames = options.cookies.map((cookie) => {
|
|
136
|
+
return cookie.name
|
|
137
|
+
})
|
|
138
|
+
const missingCookieNames = capability.manifest.auth.requiredCookieNames.filter((name) => {
|
|
139
|
+
return !cookieNames.includes(name)
|
|
140
|
+
})
|
|
141
|
+
if (missingCookieNames.length > 0) {
|
|
142
|
+
throw new Error(`Missing required cookies: ${missingCookieNames.join(', ')}`)
|
|
143
|
+
}
|
|
144
|
+
const cookieHeader = options.cookies
|
|
145
|
+
.map((cookie) => {
|
|
146
|
+
return `${cookie.name}=${cookie.value}`
|
|
147
|
+
})
|
|
148
|
+
.join('; ')
|
|
149
|
+
if (!cookieHeader) {
|
|
150
|
+
throw new Error('No cookies were available for capability auth refresh')
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const secretKey = capability.manifest.auth.secretKey || 'cookieHeader'
|
|
154
|
+
const existingSecrets = readCapabilitySecrets({ capability })
|
|
155
|
+
writeCapabilitySecrets({
|
|
156
|
+
capability,
|
|
157
|
+
secrets: {
|
|
158
|
+
...existingSecrets,
|
|
159
|
+
[secretKey]: cookieHeader,
|
|
160
|
+
updatedAt: new Date().toISOString(),
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
const requiredCookies = capability.manifest.auth.requiredCookieNames.map((name) => {
|
|
165
|
+
return options.cookies.find((cookie) => {
|
|
166
|
+
return cookie.name === name
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
const expiryValues = requiredCookies
|
|
170
|
+
.map((cookie) => {
|
|
171
|
+
return cookie?.expires
|
|
172
|
+
})
|
|
173
|
+
.filter((expires): expires is number => {
|
|
174
|
+
return typeof expires === 'number' && expires > 0
|
|
175
|
+
})
|
|
176
|
+
// Do not invent an expiry for session cookies: only all timestamped required cookies produce a deadline.
|
|
177
|
+
const expiresAt =
|
|
178
|
+
requiredCookies.length > 0 && expiryValues.length === requiredCookies.length
|
|
179
|
+
? new Date(Math.min(...expiryValues) * 1000).toISOString()
|
|
180
|
+
: undefined
|
|
181
|
+
writeStoredCapabilityAuthState({
|
|
182
|
+
capability,
|
|
183
|
+
state: {
|
|
184
|
+
schemaVersion: 1,
|
|
185
|
+
refreshedAt: new Date().toISOString(),
|
|
186
|
+
expiresAt,
|
|
187
|
+
cookieNames,
|
|
188
|
+
browserKey: options.browserKey,
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
return {
|
|
192
|
+
capability,
|
|
193
|
+
saved: true,
|
|
194
|
+
secretKey,
|
|
195
|
+
cookieCount: options.cookies.length,
|
|
196
|
+
cookieNames,
|
|
197
|
+
urls: capability.manifest.auth.browserUrls,
|
|
198
|
+
expiresAt,
|
|
199
|
+
path: path.join(capability.dir, 'secrets.json'),
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function parseRefreshResult(value: unknown): Omit<CapabilityAuthRefreshResult, 'capability'> {
|
|
204
|
+
if (!isRecord(value)) {
|
|
205
|
+
throw new Error('Capability auth refresh did not return an object')
|
|
206
|
+
}
|
|
207
|
+
const saved = value.saved === true
|
|
208
|
+
const secretKey = typeof value.secretKey === 'string' ? value.secretKey : ''
|
|
209
|
+
const cookieCount = typeof value.cookieCount === 'number' ? value.cookieCount : 0
|
|
210
|
+
const cookieNames = Array.isArray(value.cookieNames)
|
|
211
|
+
? value.cookieNames.filter((item): item is string => {
|
|
212
|
+
return typeof item === 'string'
|
|
213
|
+
})
|
|
214
|
+
: []
|
|
215
|
+
const urls = Array.isArray(value.urls)
|
|
216
|
+
? value.urls.filter((item): item is string => {
|
|
217
|
+
return typeof item === 'string'
|
|
218
|
+
})
|
|
219
|
+
: []
|
|
220
|
+
const expiresAt = typeof value.expiresAt === 'string' ? value.expiresAt : undefined
|
|
221
|
+
const secretsPath = typeof value.path === 'string' ? value.path : ''
|
|
222
|
+
if (!saved || !secretKey || !secretsPath) {
|
|
223
|
+
throw new Error('Capability auth refresh returned an incomplete result')
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
saved,
|
|
227
|
+
secretKey,
|
|
228
|
+
cookieCount,
|
|
229
|
+
cookieNames,
|
|
230
|
+
urls,
|
|
231
|
+
expiresAt,
|
|
232
|
+
path: secretsPath,
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function requireBrowserRefreshableCookieCapability(options: { id: string; cwd?: string }): CapabilityRecord {
|
|
237
|
+
const capability = requireCapability({ id: options.id, cwd: options.cwd })
|
|
238
|
+
if (capability.manifest.auth.type !== 'cookie' || capability.manifest.auth.refresh !== 'from-browser') {
|
|
239
|
+
throw new Error(`Capability ${options.id} does not declare browser-refreshable cookie auth`)
|
|
240
|
+
}
|
|
241
|
+
if (capability.manifest.auth.browserUrls.length === 0) {
|
|
242
|
+
throw new Error(`Capability ${options.id} auth.browserUrls is required for cookie refresh`)
|
|
243
|
+
}
|
|
244
|
+
return capability
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
248
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
249
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { execFile } from 'node:child_process'
|
|
4
|
+
import { promisify } from 'node:util'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
import { describe, expect, test } from 'vitest'
|
|
7
|
+
import { createCapability, updateCapabilityManifest, updateCapabilityScript } from './capability-registry.js'
|
|
8
|
+
|
|
9
|
+
const execFileAsync = promisify(execFile)
|
|
10
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
const tabwrightDir = path.resolve(currentDir, '..')
|
|
12
|
+
const viteNodeBinary = path.join(
|
|
13
|
+
tabwrightDir,
|
|
14
|
+
'node_modules',
|
|
15
|
+
'.bin',
|
|
16
|
+
process.platform === 'win32' ? 'vite-node.cmd' : 'vite-node',
|
|
17
|
+
)
|
|
18
|
+
const cliPath = path.join(currentDir, 'cli.ts')
|
|
19
|
+
|
|
20
|
+
function createTempDir(prefix: string): string {
|
|
21
|
+
const tempRoot = path.join(tabwrightDir, 'tmp')
|
|
22
|
+
fs.mkdirSync(tempRoot, { recursive: true })
|
|
23
|
+
return fs.mkdtempSync(path.join(tempRoot, prefix))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function runCli(options: { cwd: string; args: string[] }): Promise<{ stdout: string; stderr: string }> {
|
|
27
|
+
return execFileAsync(viteNodeBinary, [cliPath, ...options.args], {
|
|
28
|
+
cwd: options.cwd,
|
|
29
|
+
env: process.env,
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('capability CLI confirmation', () => {
|
|
34
|
+
test('force cannot execute a confirmation-required script without the exact id', async () => {
|
|
35
|
+
const cwd = createTempDir('capability-cli-confirmation-')
|
|
36
|
+
try {
|
|
37
|
+
const capability = createCapability({
|
|
38
|
+
id: 'confirmed-cli-write',
|
|
39
|
+
location: 'project',
|
|
40
|
+
cwd,
|
|
41
|
+
runtime: 'node',
|
|
42
|
+
})
|
|
43
|
+
updateCapabilityScript({
|
|
44
|
+
id: capability.manifest.id,
|
|
45
|
+
cwd,
|
|
46
|
+
source: 'artifacts.writeText({ filename: "executed.txt", text: "yes" }); return { ok: true };',
|
|
47
|
+
})
|
|
48
|
+
updateCapabilityManifest({
|
|
49
|
+
id: capability.manifest.id,
|
|
50
|
+
cwd,
|
|
51
|
+
allowUnvalidatedTrust: true,
|
|
52
|
+
patch: { status: 'trusted', sideEffect: 'write', requiresConfirmation: true },
|
|
53
|
+
})
|
|
54
|
+
const markerPath = path.join(capability.dir, 'artifacts', 'executed.txt')
|
|
55
|
+
|
|
56
|
+
await expect(
|
|
57
|
+
runCli({
|
|
58
|
+
cwd,
|
|
59
|
+
args: ['capability', 'run', capability.manifest.id, '--force', '--input-json', '{}', '--json'],
|
|
60
|
+
}),
|
|
61
|
+
).rejects.toMatchObject({
|
|
62
|
+
code: 1,
|
|
63
|
+
stderr: expect.stringContaining('requires explicit user confirmation'),
|
|
64
|
+
})
|
|
65
|
+
expect(fs.existsSync(markerPath)).toBe(false)
|
|
66
|
+
|
|
67
|
+
const runStartedAt = Date.now()
|
|
68
|
+
const { stdout, stderr } = await runCli({
|
|
69
|
+
cwd,
|
|
70
|
+
args: [
|
|
71
|
+
'capability',
|
|
72
|
+
'run',
|
|
73
|
+
capability.manifest.id,
|
|
74
|
+
'--force',
|
|
75
|
+
'--confirm',
|
|
76
|
+
capability.manifest.id,
|
|
77
|
+
'--input-json',
|
|
78
|
+
'{}',
|
|
79
|
+
'--json',
|
|
80
|
+
],
|
|
81
|
+
})
|
|
82
|
+
expect(JSON.parse(stdout)).toMatchObject({ capability: capability.manifest.id, output: { ok: true } })
|
|
83
|
+
expect(stderr).toBe('')
|
|
84
|
+
expect(fs.readFileSync(markerPath, 'utf-8')).toBe('yes')
|
|
85
|
+
expect(Date.now() - runStartedAt).toBeLessThan(5000)
|
|
86
|
+
} finally {
|
|
87
|
+
fs.rmSync(cwd, { recursive: true, force: true })
|
|
88
|
+
}
|
|
89
|
+
}, 30000)
|
|
90
|
+
})
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { describe, expect, test } from 'vitest'
|
|
4
|
+
import { createCapability } from './capability-registry.js'
|
|
5
|
+
import { listCapabilityOptions } from './capability-options.js'
|
|
6
|
+
|
|
7
|
+
function createTempDir(prefix: string): string {
|
|
8
|
+
const tempRoot = path.join(process.cwd(), 'tmp')
|
|
9
|
+
fs.mkdirSync(tempRoot, { recursive: true })
|
|
10
|
+
return fs.mkdtempSync(path.join(tempRoot, prefix))
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
describe('capability options view', () => {
|
|
14
|
+
test('lists capabilities with read-only agent skill status', () => {
|
|
15
|
+
const cwd = createTempDir('capability-options-')
|
|
16
|
+
try {
|
|
17
|
+
const capability = createCapability({
|
|
18
|
+
id: 'options-tool',
|
|
19
|
+
title: 'Options Tool',
|
|
20
|
+
location: 'project',
|
|
21
|
+
cwd,
|
|
22
|
+
})
|
|
23
|
+
const skillPath = path.join(capability.dir, 'agent-skills', 'codex', 'SKILL.md')
|
|
24
|
+
fs.mkdirSync(path.dirname(skillPath), { recursive: true })
|
|
25
|
+
fs.writeFileSync(skillPath, '---\nname: options-tool\n---\n')
|
|
26
|
+
|
|
27
|
+
const response = listCapabilityOptions({ cwd })
|
|
28
|
+
expect(response.cwd).toBe(cwd)
|
|
29
|
+
expect(response.capabilities).toEqual(
|
|
30
|
+
expect.arrayContaining([
|
|
31
|
+
expect.objectContaining({
|
|
32
|
+
id: 'options-tool',
|
|
33
|
+
title: 'Options Tool',
|
|
34
|
+
agentSkill: expect.objectContaining({
|
|
35
|
+
draftExists: true,
|
|
36
|
+
initCommand: 'tabwright capability skill init options-tool',
|
|
37
|
+
installCommand: 'tabwright capability skill install options-tool',
|
|
38
|
+
}),
|
|
39
|
+
}),
|
|
40
|
+
]),
|
|
41
|
+
)
|
|
42
|
+
} finally {
|
|
43
|
+
fs.rmSync(cwd, { recursive: true, force: true })
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('keeps the capability list available when run logs or entry scripts are damaged', () => {
|
|
48
|
+
const cwd = createTempDir('capability-options-damaged-')
|
|
49
|
+
try {
|
|
50
|
+
const damagedRuns = createCapability({
|
|
51
|
+
id: 'damaged-runs',
|
|
52
|
+
title: 'Damaged Runs',
|
|
53
|
+
location: 'project',
|
|
54
|
+
cwd,
|
|
55
|
+
})
|
|
56
|
+
fs.writeFileSync(path.join(damagedRuns.dir, 'runs.jsonl'), '{"id":\n')
|
|
57
|
+
|
|
58
|
+
const missingScript = createCapability({
|
|
59
|
+
id: 'missing-script',
|
|
60
|
+
title: 'Missing Script',
|
|
61
|
+
location: 'project',
|
|
62
|
+
cwd,
|
|
63
|
+
})
|
|
64
|
+
fs.rmSync(missingScript.scriptPath)
|
|
65
|
+
|
|
66
|
+
const response = listCapabilityOptions({ cwd })
|
|
67
|
+
const damagedRunsItem = response.capabilities.find((capability) => capability.id === 'damaged-runs')
|
|
68
|
+
const missingScriptItem = response.capabilities.find((capability) => capability.id === 'missing-script')
|
|
69
|
+
|
|
70
|
+
expect(damagedRunsItem).toEqual(expect.objectContaining({ recentRuns: [] }))
|
|
71
|
+
expect(missingScriptItem).toEqual(
|
|
72
|
+
expect.objectContaining({
|
|
73
|
+
lifecycle: expect.objectContaining({
|
|
74
|
+
stage: 'drifted',
|
|
75
|
+
contractHealth: expect.objectContaining({
|
|
76
|
+
state: 'drifted',
|
|
77
|
+
reasons: expect.arrayContaining([expect.stringContaining('Cannot validate the capability entry script')]),
|
|
78
|
+
}),
|
|
79
|
+
}),
|
|
80
|
+
autonomousInvocation: expect.objectContaining({
|
|
81
|
+
allowed: false,
|
|
82
|
+
}),
|
|
83
|
+
}),
|
|
84
|
+
)
|
|
85
|
+
} finally {
|
|
86
|
+
fs.rmSync(cwd, { recursive: true, force: true })
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listCapabilities,
|
|
3
|
+
toCapabilityContract,
|
|
4
|
+
type CapabilityRecord,
|
|
5
|
+
} from './capability-registry.js'
|
|
6
|
+
import {
|
|
7
|
+
getCapabilityAgentSkillStatus,
|
|
8
|
+
type CapabilityAgentSkillStatus,
|
|
9
|
+
} from './capability-agent-skill.js'
|
|
10
|
+
import { getCapabilityAuthState } from './capability-auth-state.js'
|
|
11
|
+
|
|
12
|
+
export interface CapabilityOptionsItem extends Record<string, unknown> {
|
|
13
|
+
agentSkill: CapabilityAgentSkillStatus
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CapabilityOptionsListResponse {
|
|
17
|
+
cwd: string
|
|
18
|
+
capabilities: CapabilityOptionsItem[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CapabilityOptionsDetailResponse {
|
|
22
|
+
cwd: string
|
|
23
|
+
capability: CapabilityOptionsItem
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function listCapabilityOptions(options: { cwd: string }): CapabilityOptionsListResponse {
|
|
27
|
+
return {
|
|
28
|
+
cwd: options.cwd,
|
|
29
|
+
capabilities: listCapabilities({ cwd: options.cwd }).map((capability) => {
|
|
30
|
+
return toCapabilityOptionsItem(capability)
|
|
31
|
+
}),
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getCapabilityOptionsDetail(options: {
|
|
36
|
+
cwd: string
|
|
37
|
+
id: string
|
|
38
|
+
}): CapabilityOptionsDetailResponse | null {
|
|
39
|
+
const capability = listCapabilities({ cwd: options.cwd }).find((candidate) => {
|
|
40
|
+
return candidate.manifest.id === options.id
|
|
41
|
+
})
|
|
42
|
+
if (!capability) {
|
|
43
|
+
return null
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
cwd: options.cwd,
|
|
47
|
+
capability: toCapabilityOptionsItem(capability),
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function toCapabilityOptionsItem(capability: CapabilityRecord): CapabilityOptionsItem {
|
|
52
|
+
return {
|
|
53
|
+
...toCapabilityContract(capability),
|
|
54
|
+
authState: getCapabilityAuthState({ capability }),
|
|
55
|
+
agentSkill: getCapabilityAgentSkillStatus({ capability }),
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
4
|
+
import { installCapabilityPackage, packCapability } from './capability-package.js'
|
|
5
|
+
import { createCapability, updateCapabilityManifest, updateCapabilityScript, writeCapabilitySecrets } from './capability-registry.js'
|
|
6
|
+
|
|
7
|
+
describe('capability package sharing', () => {
|
|
8
|
+
let testRoot: string
|
|
9
|
+
let sourceCwd: string
|
|
10
|
+
let recipientCwd: string
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
const tmpRoot = path.join(process.cwd(), 'tmp')
|
|
14
|
+
fs.mkdirSync(tmpRoot, { recursive: true })
|
|
15
|
+
testRoot = fs.mkdtempSync(path.join(tmpRoot, 'capability-package-'))
|
|
16
|
+
sourceCwd = path.join(testRoot, 'source')
|
|
17
|
+
recipientCwd = path.join(testRoot, 'recipient')
|
|
18
|
+
fs.mkdirSync(sourceCwd, { recursive: true })
|
|
19
|
+
fs.mkdirSync(recipientCwd, { recursive: true })
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
vi.unstubAllGlobals()
|
|
24
|
+
fs.rmSync(testRoot, { recursive: true, force: true })
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('packs only shareable files and installs the recipient copy as draft', async () => {
|
|
28
|
+
const source = createCapability({
|
|
29
|
+
id: 'shared-query',
|
|
30
|
+
title: 'Shared query',
|
|
31
|
+
description: 'Queries shared data.',
|
|
32
|
+
location: 'project',
|
|
33
|
+
cwd: sourceCwd,
|
|
34
|
+
runtime: 'node',
|
|
35
|
+
})
|
|
36
|
+
updateCapabilityScript({
|
|
37
|
+
id: source.manifest.id,
|
|
38
|
+
cwd: sourceCwd,
|
|
39
|
+
source: 'return { ok: true }\n',
|
|
40
|
+
})
|
|
41
|
+
updateCapabilityManifest({
|
|
42
|
+
id: source.manifest.id,
|
|
43
|
+
cwd: sourceCwd,
|
|
44
|
+
allowUnvalidatedTrust: true,
|
|
45
|
+
patch: {
|
|
46
|
+
status: 'trusted',
|
|
47
|
+
auth: {
|
|
48
|
+
type: 'cookie',
|
|
49
|
+
refresh: 'from-browser',
|
|
50
|
+
browserUrls: ['https://example.com'],
|
|
51
|
+
requiredCookieNames: ['session'],
|
|
52
|
+
failureSignals: ['unauthorized'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
const capabilityDir = source.dir
|
|
57
|
+
writeCapabilitySecrets({ capability: source, secrets: { cookieHeader: 'secret-value' } })
|
|
58
|
+
fs.writeFileSync(path.join(capabilityDir, 'runs.jsonl'), '{"private":"run"}\n')
|
|
59
|
+
fs.mkdirSync(path.join(capabilityDir, 'artifacts'), { recursive: true })
|
|
60
|
+
fs.writeFileSync(path.join(capabilityDir, 'artifacts', 'private.json'), '{}\n')
|
|
61
|
+
fs.mkdirSync(path.join(capabilityDir, 'agent-skills', 'codex', 'agents'), { recursive: true })
|
|
62
|
+
fs.writeFileSync(
|
|
63
|
+
path.join(capabilityDir, 'agent-skills', 'codex', 'SKILL.md'),
|
|
64
|
+
'---\nname: shared-query\ndescription: Use shared query.\n---\n',
|
|
65
|
+
)
|
|
66
|
+
fs.writeFileSync(path.join(capabilityDir, 'agent-skills', 'codex', 'agents', 'openai.yaml'), 'name: Shared query\n')
|
|
67
|
+
|
|
68
|
+
const archivePath = path.join(testRoot, 'shared-query.tgz')
|
|
69
|
+
const packed = await packCapability({ id: source.manifest.id, cwd: sourceCwd, output: archivePath })
|
|
70
|
+
const installed = await installCapabilityPackage({
|
|
71
|
+
source: packed.path,
|
|
72
|
+
cwd: recipientCwd,
|
|
73
|
+
location: 'project',
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
expect(packed.files).toEqual([
|
|
77
|
+
'README.md',
|
|
78
|
+
'agent-skills/codex/SKILL.md',
|
|
79
|
+
'agent-skills/codex/agents/openai.yaml',
|
|
80
|
+
'capability.json',
|
|
81
|
+
'script.js',
|
|
82
|
+
])
|
|
83
|
+
expect(installed.capability.manifest.status).toBe('draft')
|
|
84
|
+
expect(fs.readFileSync(installed.capability.scriptPath, 'utf-8')).toBe('return { ok: true }\n')
|
|
85
|
+
expect(installed.agentSkillAvailable).toBe(true)
|
|
86
|
+
expect(fs.existsSync(path.join(installed.capability.dir, 'secrets.json'))).toBe(false)
|
|
87
|
+
expect(fs.existsSync(path.join(installed.capability.dir, 'runs.jsonl'))).toBe(false)
|
|
88
|
+
expect(fs.existsSync(path.join(installed.capability.dir, 'artifacts'))).toBe(false)
|
|
89
|
+
expect(installed.integrity).toBe(packed.integrity)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it('installs directly from a capability directory without copying local state', async () => {
|
|
93
|
+
const source = createCapability({
|
|
94
|
+
id: 'directory-query',
|
|
95
|
+
location: 'project',
|
|
96
|
+
cwd: sourceCwd,
|
|
97
|
+
runtime: 'node',
|
|
98
|
+
})
|
|
99
|
+
updateCapabilityScript({ id: source.manifest.id, cwd: sourceCwd, source: 'return input\n' })
|
|
100
|
+
writeCapabilitySecrets({ capability: source, secrets: { token: 'do-not-copy' } })
|
|
101
|
+
|
|
102
|
+
const installed = await installCapabilityPackage({
|
|
103
|
+
source: source.dir,
|
|
104
|
+
cwd: recipientCwd,
|
|
105
|
+
location: 'project',
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
expect(installed.capability.manifest.status).toBe('draft')
|
|
109
|
+
expect(fs.existsSync(path.join(installed.capability.dir, 'secrets.json'))).toBe(false)
|
|
110
|
+
expect(installed.files).toEqual(['README.md', 'capability.json', 'script.js'])
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('requires force before replacing package files and clears recipient authentication', async () => {
|
|
114
|
+
const source = createCapability({
|
|
115
|
+
id: 'replace-query',
|
|
116
|
+
location: 'project',
|
|
117
|
+
cwd: sourceCwd,
|
|
118
|
+
runtime: 'node',
|
|
119
|
+
})
|
|
120
|
+
updateCapabilityScript({ id: source.manifest.id, cwd: sourceCwd, source: 'return { version: 2 }\n' })
|
|
121
|
+
const archive = await packCapability({
|
|
122
|
+
id: source.manifest.id,
|
|
123
|
+
cwd: sourceCwd,
|
|
124
|
+
output: path.join(testRoot, 'replace-query.tgz'),
|
|
125
|
+
})
|
|
126
|
+
const existing = createCapability({
|
|
127
|
+
id: source.manifest.id,
|
|
128
|
+
location: 'project',
|
|
129
|
+
cwd: recipientCwd,
|
|
130
|
+
runtime: 'node',
|
|
131
|
+
})
|
|
132
|
+
writeCapabilitySecrets({ capability: existing, secrets: { token: 'recipient-only' } })
|
|
133
|
+
fs.writeFileSync(path.join(existing.dir, 'auth-state.json'), '{"schemaVersion":1}\n')
|
|
134
|
+
|
|
135
|
+
await expect(
|
|
136
|
+
installCapabilityPackage({ source: archive.path, cwd: recipientCwd, location: 'project' }),
|
|
137
|
+
).rejects.toThrow('Use --force')
|
|
138
|
+
|
|
139
|
+
const installed = await installCapabilityPackage({
|
|
140
|
+
source: archive.path,
|
|
141
|
+
cwd: recipientCwd,
|
|
142
|
+
location: 'project',
|
|
143
|
+
overwrite: true,
|
|
144
|
+
})
|
|
145
|
+
expect(fs.readFileSync(installed.capability.scriptPath, 'utf-8')).toBe('return { version: 2 }\n')
|
|
146
|
+
expect(fs.existsSync(path.join(installed.capability.dir, 'secrets.json'))).toBe(false)
|
|
147
|
+
expect(fs.existsSync(path.join(installed.capability.dir, 'auth-state.json'))).toBe(false)
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('installs a package downloaded from an HTTPS URL', async () => {
|
|
151
|
+
const source = createCapability({
|
|
152
|
+
id: 'remote-query',
|
|
153
|
+
location: 'project',
|
|
154
|
+
cwd: sourceCwd,
|
|
155
|
+
runtime: 'node',
|
|
156
|
+
})
|
|
157
|
+
const packed = await packCapability({
|
|
158
|
+
id: source.manifest.id,
|
|
159
|
+
cwd: sourceCwd,
|
|
160
|
+
output: path.join(testRoot, 'remote-query.tgz'),
|
|
161
|
+
})
|
|
162
|
+
const archive = fs.readFileSync(packed.path)
|
|
163
|
+
vi.stubGlobal(
|
|
164
|
+
'fetch',
|
|
165
|
+
vi.fn(async () => {
|
|
166
|
+
return new Response(archive, {
|
|
167
|
+
status: 200,
|
|
168
|
+
headers: { 'content-length': String(archive.length) },
|
|
169
|
+
})
|
|
170
|
+
}),
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
const installed = await installCapabilityPackage({
|
|
174
|
+
source: 'https://example.com/remote-query.tgz',
|
|
175
|
+
cwd: recipientCwd,
|
|
176
|
+
location: 'project',
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
expect(installed.source).toBe('https://example.com/remote-query.tgz')
|
|
180
|
+
expect(installed.capability.manifest.id).toBe('remote-query')
|
|
181
|
+
expect(installed.capability.manifest.status).toBe('draft')
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
it('requires force before overwriting an existing package archive', async () => {
|
|
185
|
+
const source = createCapability({
|
|
186
|
+
id: 'archive-overwrite',
|
|
187
|
+
location: 'project',
|
|
188
|
+
cwd: sourceCwd,
|
|
189
|
+
runtime: 'node',
|
|
190
|
+
})
|
|
191
|
+
const output = path.join(testRoot, 'archive-overwrite.tgz')
|
|
192
|
+
await packCapability({ id: source.manifest.id, cwd: sourceCwd, output })
|
|
193
|
+
|
|
194
|
+
await expect(packCapability({ id: source.manifest.id, cwd: sourceCwd, output })).rejects.toThrow('Use --force')
|
|
195
|
+
|
|
196
|
+
const overwritten = await packCapability({
|
|
197
|
+
id: source.manifest.id,
|
|
198
|
+
cwd: sourceCwd,
|
|
199
|
+
output,
|
|
200
|
+
overwrite: true,
|
|
201
|
+
})
|
|
202
|
+
expect(fs.existsSync(overwritten.path)).toBe(true)
|
|
203
|
+
})
|
|
204
|
+
})
|