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
package/src/styles.ts
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import type { ICDPSession } from './cdp-session.js'
|
|
2
|
+
import type { Locator } from '@xmorse/playwright-core'
|
|
3
|
+
|
|
4
|
+
export interface StyleSource {
|
|
5
|
+
url: string
|
|
6
|
+
line: number
|
|
7
|
+
column: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type StyleDeclarations = Record<string, string>
|
|
11
|
+
|
|
12
|
+
export interface StyleRule {
|
|
13
|
+
selector: string
|
|
14
|
+
source: StyleSource | null
|
|
15
|
+
origin: 'regular' | 'user-agent' | 'injected' | 'inspector'
|
|
16
|
+
declarations: StyleDeclarations
|
|
17
|
+
inheritedFrom: string | null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface StylesResult {
|
|
21
|
+
element: string
|
|
22
|
+
inlineStyle: StyleDeclarations | null
|
|
23
|
+
rules: StyleRule[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface CSSProperty {
|
|
27
|
+
name: string
|
|
28
|
+
value: string
|
|
29
|
+
important?: boolean
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface CSSStyle {
|
|
33
|
+
cssProperties: CSSProperty[]
|
|
34
|
+
cssText?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CSSRule {
|
|
38
|
+
selectorList: { text: string }
|
|
39
|
+
style: CSSStyle
|
|
40
|
+
styleSheetId?: string
|
|
41
|
+
origin: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface RuleMatch {
|
|
45
|
+
rule: CSSRule
|
|
46
|
+
matchingSelectors: number[]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface InheritedStyleEntry {
|
|
50
|
+
inlineStyle?: CSSStyle
|
|
51
|
+
matchedCSSRules: RuleMatch[]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface SourceRange {
|
|
55
|
+
startLine: number
|
|
56
|
+
startColumn: number
|
|
57
|
+
endLine: number
|
|
58
|
+
endColumn: number
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface CSSStyleSheetHeader {
|
|
62
|
+
styleSheetId: string
|
|
63
|
+
sourceURL?: string
|
|
64
|
+
origin: string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function getStylesForLocator({
|
|
68
|
+
locator,
|
|
69
|
+
cdp: cdpSession,
|
|
70
|
+
includeUserAgentStyles = false,
|
|
71
|
+
}: {
|
|
72
|
+
locator: Locator
|
|
73
|
+
cdp: ICDPSession
|
|
74
|
+
includeUserAgentStyles?: boolean
|
|
75
|
+
}): Promise<StylesResult> {
|
|
76
|
+
const cdp = cdpSession
|
|
77
|
+
await cdp.send('DOM.enable')
|
|
78
|
+
await cdp.send('CSS.enable')
|
|
79
|
+
|
|
80
|
+
const elementHandle = await locator.elementHandle()
|
|
81
|
+
if (!elementHandle) {
|
|
82
|
+
throw new Error('Could not get element handle from locator')
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const remoteObject = (elementHandle as any)._channel?.objectId
|
|
86
|
+
? { objectId: (elementHandle as any)._channel.objectId }
|
|
87
|
+
: null
|
|
88
|
+
|
|
89
|
+
let backendNodeId: number
|
|
90
|
+
if (remoteObject?.objectId) {
|
|
91
|
+
const nodeInfo = await cdp.send('DOM.describeNode', {
|
|
92
|
+
objectId: remoteObject.objectId,
|
|
93
|
+
})
|
|
94
|
+
backendNodeId = nodeInfo.node.backendNodeId
|
|
95
|
+
} else {
|
|
96
|
+
const box = await elementHandle.boundingBox()
|
|
97
|
+
if (!box) {
|
|
98
|
+
throw new Error('Element has no bounding box')
|
|
99
|
+
}
|
|
100
|
+
const docResult = await cdp.send('DOM.getDocument', { depth: 0 })
|
|
101
|
+
const nodeAtPoint = await cdp.send('DOM.getNodeForLocation', {
|
|
102
|
+
x: Math.round(box.x + box.width / 2),
|
|
103
|
+
y: Math.round(box.y + box.height / 2),
|
|
104
|
+
})
|
|
105
|
+
backendNodeId = nodeAtPoint.backendNodeId
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const pushResult = await cdp.send('DOM.pushNodesByBackendIdsToFrontend', {
|
|
109
|
+
backendNodeIds: [backendNodeId],
|
|
110
|
+
})
|
|
111
|
+
const nodeId = pushResult.nodeIds[0]
|
|
112
|
+
|
|
113
|
+
if (!nodeId) {
|
|
114
|
+
throw new Error('Could not get nodeId for element')
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const nodeInfo = await cdp.send('DOM.describeNode', { nodeId })
|
|
118
|
+
const elementDescription = formatElementDescription(nodeInfo.node)
|
|
119
|
+
|
|
120
|
+
const matchedStyles = await cdp.send('CSS.getMatchedStylesForNode', { nodeId })
|
|
121
|
+
|
|
122
|
+
const stylesheetUrls = new Map<string, string>()
|
|
123
|
+
|
|
124
|
+
const processStyleSheetId = async (styleSheetId: string | undefined): Promise<StyleSource | null> => {
|
|
125
|
+
if (!styleSheetId) {
|
|
126
|
+
return null
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (!stylesheetUrls.has(styleSheetId)) {
|
|
130
|
+
try {
|
|
131
|
+
const header = await cdp.send('CSS.getStyleSheetText', { styleSheetId })
|
|
132
|
+
stylesheetUrls.set(styleSheetId, '')
|
|
133
|
+
} catch {
|
|
134
|
+
stylesheetUrls.set(styleSheetId, '')
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return null
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const rules: StyleRule[] = []
|
|
142
|
+
|
|
143
|
+
if (matchedStyles.matchedCSSRules) {
|
|
144
|
+
for (const ruleMatch of matchedStyles.matchedCSSRules) {
|
|
145
|
+
const rule = ruleMatch.rule
|
|
146
|
+
const sourceRange = (rule as any).selectorList?.range as SourceRange | undefined
|
|
147
|
+
const styleSheetId = rule.styleSheetId
|
|
148
|
+
|
|
149
|
+
let source: StyleSource | null = null
|
|
150
|
+
if (styleSheetId && sourceRange) {
|
|
151
|
+
const styleSheet = (matchedStyles as any).cssStyleSheetHeaders?.find(
|
|
152
|
+
(h: CSSStyleSheetHeader) => h.styleSheetId === styleSheetId,
|
|
153
|
+
)
|
|
154
|
+
const url =
|
|
155
|
+
styleSheet?.sourceURL || (rule as any).origin === 'user-agent' ? 'user-agent' : `stylesheet:${styleSheetId}`
|
|
156
|
+
|
|
157
|
+
source = {
|
|
158
|
+
url: (rule as any).styleSheetId ? await getStylesheetUrl(cdp, styleSheetId) : 'user-agent',
|
|
159
|
+
line: sourceRange.startLine + 1,
|
|
160
|
+
column: sourceRange.startColumn,
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
rules.push({
|
|
165
|
+
selector: rule.selectorList.text,
|
|
166
|
+
source,
|
|
167
|
+
origin: rule.origin as StyleRule['origin'],
|
|
168
|
+
declarations: extractDeclarations(rule.style),
|
|
169
|
+
inheritedFrom: null,
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (matchedStyles.inherited) {
|
|
175
|
+
for (let i = 0; i < matchedStyles.inherited.length; i++) {
|
|
176
|
+
const inheritedEntry = matchedStyles.inherited[i] as InheritedStyleEntry
|
|
177
|
+
const ancestorDesc = `ancestor[${i + 1}]`
|
|
178
|
+
|
|
179
|
+
if (inheritedEntry.inlineStyle) {
|
|
180
|
+
const declarations = extractDeclarations(inheritedEntry.inlineStyle)
|
|
181
|
+
if (Object.keys(declarations).length > 0) {
|
|
182
|
+
rules.push({
|
|
183
|
+
selector: 'element.style',
|
|
184
|
+
source: null,
|
|
185
|
+
origin: 'regular',
|
|
186
|
+
declarations,
|
|
187
|
+
inheritedFrom: ancestorDesc,
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
for (const ruleMatch of inheritedEntry.matchedCSSRules) {
|
|
193
|
+
const rule = ruleMatch.rule
|
|
194
|
+
const sourceRange = (rule as any).selectorList?.range as SourceRange | undefined
|
|
195
|
+
const styleSheetId = rule.styleSheetId
|
|
196
|
+
|
|
197
|
+
let source: StyleSource | null = null
|
|
198
|
+
if (styleSheetId && sourceRange) {
|
|
199
|
+
source = {
|
|
200
|
+
url: await getStylesheetUrl(cdp, styleSheetId),
|
|
201
|
+
line: sourceRange.startLine + 1,
|
|
202
|
+
column: sourceRange.startColumn,
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const declarations = extractDeclarations(rule.style)
|
|
207
|
+
if (Object.keys(declarations).length > 0) {
|
|
208
|
+
rules.push({
|
|
209
|
+
selector: rule.selectorList.text,
|
|
210
|
+
source,
|
|
211
|
+
origin: rule.origin as StyleRule['origin'],
|
|
212
|
+
declarations,
|
|
213
|
+
inheritedFrom: ancestorDesc,
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
let inlineStyle: StyleDeclarations | null = null
|
|
221
|
+
if (matchedStyles.inlineStyle) {
|
|
222
|
+
const declarations = extractDeclarations(matchedStyles.inlineStyle as CSSStyle)
|
|
223
|
+
if (Object.keys(declarations).length > 0) {
|
|
224
|
+
inlineStyle = declarations
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const filteredRules = includeUserAgentStyles ? rules : rules.filter((r) => r.origin !== 'user-agent')
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
element: elementDescription,
|
|
232
|
+
inlineStyle,
|
|
233
|
+
rules: filteredRules,
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function extractDeclarations(style: CSSStyle): StyleDeclarations {
|
|
238
|
+
if (!style?.cssProperties) {
|
|
239
|
+
return {}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const result: StyleDeclarations = {}
|
|
243
|
+
for (const prop of style.cssProperties) {
|
|
244
|
+
if (!prop.value || prop.value === 'initial' || prop.name.startsWith('-webkit-')) {
|
|
245
|
+
continue
|
|
246
|
+
}
|
|
247
|
+
const value = prop.important ? `${prop.value} !important` : prop.value
|
|
248
|
+
result[prop.name] = value
|
|
249
|
+
}
|
|
250
|
+
return result
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function formatElementDescription(node: any): string {
|
|
254
|
+
let desc = node.localName || node.nodeName?.toLowerCase() || 'element'
|
|
255
|
+
|
|
256
|
+
if (node.attributes) {
|
|
257
|
+
const attrs: Record<string, string> = {}
|
|
258
|
+
for (let i = 0; i < node.attributes.length; i += 2) {
|
|
259
|
+
attrs[node.attributes[i]] = node.attributes[i + 1]
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (attrs.id) {
|
|
263
|
+
desc += `#${attrs.id}`
|
|
264
|
+
}
|
|
265
|
+
if (attrs.class) {
|
|
266
|
+
desc += `.${attrs.class.split(' ').join('.')}`
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return desc
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
async function getStylesheetUrl(cdp: ICDPSession, styleSheetId: string): Promise<string> {
|
|
274
|
+
try {
|
|
275
|
+
await cdp.send('CSS.getStyleSheetText', { styleSheetId })
|
|
276
|
+
return `stylesheet:${styleSheetId}`
|
|
277
|
+
} catch {
|
|
278
|
+
return `stylesheet:${styleSheetId}`
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export function formatStylesAsText(styles: StylesResult): string {
|
|
283
|
+
const lines: string[] = []
|
|
284
|
+
|
|
285
|
+
lines.push(`Element: ${styles.element}`)
|
|
286
|
+
lines.push('')
|
|
287
|
+
|
|
288
|
+
if (styles.inlineStyle) {
|
|
289
|
+
lines.push('Inline styles:')
|
|
290
|
+
for (const [prop, value] of Object.entries(styles.inlineStyle)) {
|
|
291
|
+
lines.push(` ${prop}: ${value}`)
|
|
292
|
+
}
|
|
293
|
+
lines.push('')
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const directRules = styles.rules.filter((r) => !r.inheritedFrom)
|
|
297
|
+
const inheritedRules = styles.rules.filter((r) => r.inheritedFrom)
|
|
298
|
+
|
|
299
|
+
if (directRules.length > 0) {
|
|
300
|
+
lines.push('Matched rules:')
|
|
301
|
+
for (const rule of directRules) {
|
|
302
|
+
lines.push(` ${rule.selector} {`)
|
|
303
|
+
const sourceInfo = rule.source ? ` /* ${rule.source.url}:${rule.source.line}:${rule.source.column} */` : ''
|
|
304
|
+
if (sourceInfo) {
|
|
305
|
+
lines.push(` ${sourceInfo}`)
|
|
306
|
+
}
|
|
307
|
+
for (const [prop, value] of Object.entries(rule.declarations)) {
|
|
308
|
+
lines.push(` ${prop}: ${value};`)
|
|
309
|
+
}
|
|
310
|
+
lines.push(' }')
|
|
311
|
+
}
|
|
312
|
+
lines.push('')
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (inheritedRules.length > 0) {
|
|
316
|
+
const byAncestor = new Map<string, StyleRule[]>()
|
|
317
|
+
for (const rule of inheritedRules) {
|
|
318
|
+
const key = rule.inheritedFrom!
|
|
319
|
+
if (!byAncestor.has(key)) {
|
|
320
|
+
byAncestor.set(key, [])
|
|
321
|
+
}
|
|
322
|
+
byAncestor.get(key)!.push(rule)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
for (const [ancestor, rules] of byAncestor) {
|
|
326
|
+
lines.push(`Inherited from ${ancestor}:`)
|
|
327
|
+
for (const rule of rules) {
|
|
328
|
+
lines.push(` ${rule.selector} {`)
|
|
329
|
+
const sourceInfo = rule.source ? ` /* ${rule.source.url}:${rule.source.line}:${rule.source.column} */` : ''
|
|
330
|
+
if (sourceInfo) {
|
|
331
|
+
lines.push(` ${sourceInfo}`)
|
|
332
|
+
}
|
|
333
|
+
for (const [prop, value] of Object.entries(rule.declarations)) {
|
|
334
|
+
lines.push(` ${prop}: ${value};`)
|
|
335
|
+
}
|
|
336
|
+
lines.push(' }')
|
|
337
|
+
}
|
|
338
|
+
lines.push('')
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return lines.join('\n')
|
|
343
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { afterEach, describe, expect, test } from 'vitest'
|
|
4
|
+
import { getTabwrightAgentSkillStatus, installTabwrightAgentSkill } from './tabwright-agent-skill.js'
|
|
5
|
+
|
|
6
|
+
const tempDirs: string[] = []
|
|
7
|
+
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
tempDirs.splice(0).map((dir) => {
|
|
10
|
+
fs.rmSync(dir, { recursive: true, force: true })
|
|
11
|
+
return dir
|
|
12
|
+
})
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
function createFixture(): { bundledSkillPath: string; codexHome: string } {
|
|
16
|
+
const tmpRoot = path.resolve(process.cwd(), '..', 'tmp')
|
|
17
|
+
fs.mkdirSync(tmpRoot, { recursive: true })
|
|
18
|
+
const dir = fs.mkdtempSync(path.join(tmpRoot, 'tabwright-agent-skill-test-'))
|
|
19
|
+
tempDirs.push(dir)
|
|
20
|
+
const bundledSkillPath = path.join(dir, 'bundled', 'SKILL.md')
|
|
21
|
+
fs.mkdirSync(path.dirname(bundledSkillPath), { recursive: true })
|
|
22
|
+
fs.writeFileSync(bundledSkillPath, '---\nname: tabwright\ndescription: Test skill\n---\n\nUse Tabwright.\n')
|
|
23
|
+
return { bundledSkillPath, codexHome: path.join(dir, 'codex-home') }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('Tabwright agent skill installation', () => {
|
|
27
|
+
test('installs the bundled skill and reports it current', () => {
|
|
28
|
+
const fixture = createFixture()
|
|
29
|
+
const missing = getTabwrightAgentSkillStatus(fixture)
|
|
30
|
+
expect(missing.state).toBe('missing')
|
|
31
|
+
expect(missing.installCommand).toBe('tabwright skill install --target codex')
|
|
32
|
+
|
|
33
|
+
const installed = installTabwrightAgentSkill(fixture)
|
|
34
|
+
expect(installed.fileStatus).toBe('created')
|
|
35
|
+
expect(installed.state).toBe('current')
|
|
36
|
+
expect(fs.readFileSync(installed.installedPath, 'utf-8')).toBe(
|
|
37
|
+
fs.readFileSync(fixture.bundledSkillPath, 'utf-8'),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const unchanged = installTabwrightAgentSkill(fixture)
|
|
41
|
+
expect(unchanged.fileStatus).toBe('unchanged')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('requires force before replacing a different installed skill', () => {
|
|
45
|
+
const fixture = createFixture()
|
|
46
|
+
const installedPath = path.join(fixture.codexHome, 'skills', 'tabwright', 'SKILL.md')
|
|
47
|
+
fs.mkdirSync(path.dirname(installedPath), { recursive: true })
|
|
48
|
+
fs.writeFileSync(installedPath, 'locally edited skill\n')
|
|
49
|
+
|
|
50
|
+
const outdated = getTabwrightAgentSkillStatus(fixture)
|
|
51
|
+
expect(outdated.state).toBe('outdated')
|
|
52
|
+
expect(outdated.installCommand).toBe('tabwright skill install --target codex --force')
|
|
53
|
+
expect(() => {
|
|
54
|
+
installTabwrightAgentSkill(fixture)
|
|
55
|
+
}).toThrow(/Use --force to overwrite/)
|
|
56
|
+
|
|
57
|
+
const updated = installTabwrightAgentSkill({ ...fixture, overwrite: true })
|
|
58
|
+
expect(updated.fileStatus).toBe('updated')
|
|
59
|
+
expect(updated.state).toBe('current')
|
|
60
|
+
})
|
|
61
|
+
})
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import crypto from 'node:crypto'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import os from 'node:os'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { getInstalledTabwrightPackageDir } from './package-paths.js'
|
|
6
|
+
|
|
7
|
+
export type TabwrightAgentSkillTarget = 'codex'
|
|
8
|
+
export type TabwrightAgentSkillState = 'missing' | 'current' | 'outdated'
|
|
9
|
+
|
|
10
|
+
export interface TabwrightAgentSkillStatus {
|
|
11
|
+
target: TabwrightAgentSkillTarget
|
|
12
|
+
state: TabwrightAgentSkillState
|
|
13
|
+
bundledPath: string
|
|
14
|
+
installedPath: string
|
|
15
|
+
bundledSha256: string
|
|
16
|
+
installedSha256?: string
|
|
17
|
+
installCommand: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface TabwrightAgentSkillInstallResult extends TabwrightAgentSkillStatus {
|
|
21
|
+
fileStatus: 'created' | 'updated' | 'unchanged'
|
|
22
|
+
next: string[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getBundledTabwrightAgentSkillPath(options: { bundledSkillPath?: string } = {}): string {
|
|
26
|
+
if (options.bundledSkillPath) {
|
|
27
|
+
return options.bundledSkillPath
|
|
28
|
+
}
|
|
29
|
+
const packageDir = getInstalledTabwrightPackageDir()
|
|
30
|
+
const repositoryRoot = path.join(packageDir, '..')
|
|
31
|
+
const packagedSkillPath = path.join(packageDir, 'dist', 'agent-skills', 'tabwright', 'SKILL.md')
|
|
32
|
+
const repositorySkillPath = path.join(repositoryRoot, 'skills', 'tabwright', 'SKILL.md')
|
|
33
|
+
const candidates = fs.existsSync(path.join(repositoryRoot, '.git'))
|
|
34
|
+
? [repositorySkillPath, packagedSkillPath]
|
|
35
|
+
: [packagedSkillPath]
|
|
36
|
+
const bundledPath = candidates.find((candidate) => {
|
|
37
|
+
return fs.existsSync(candidate)
|
|
38
|
+
})
|
|
39
|
+
if (!bundledPath) {
|
|
40
|
+
throw new Error(`Bundled Tabwright skill not found under ${packageDir}. Rebuild or reinstall the CLI.`)
|
|
41
|
+
}
|
|
42
|
+
return bundledPath
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getTabwrightAgentSkillStatus(options: {
|
|
46
|
+
target?: TabwrightAgentSkillTarget
|
|
47
|
+
codexHome?: string
|
|
48
|
+
bundledSkillPath?: string
|
|
49
|
+
} = {}): TabwrightAgentSkillStatus {
|
|
50
|
+
const target = options.target || 'codex'
|
|
51
|
+
const bundledPath = getBundledTabwrightAgentSkillPath({ bundledSkillPath: options.bundledSkillPath })
|
|
52
|
+
const installedPath = path.join(getCodexHome(options.codexHome), 'skills', 'tabwright', 'SKILL.md')
|
|
53
|
+
const bundledContent = fs.readFileSync(bundledPath, 'utf-8')
|
|
54
|
+
const installedContent = fs.existsSync(installedPath) ? fs.readFileSync(installedPath, 'utf-8') : undefined
|
|
55
|
+
const state: TabwrightAgentSkillState = (() => {
|
|
56
|
+
if (installedContent === undefined) {
|
|
57
|
+
return 'missing'
|
|
58
|
+
}
|
|
59
|
+
return installedContent === bundledContent ? 'current' : 'outdated'
|
|
60
|
+
})()
|
|
61
|
+
return {
|
|
62
|
+
target,
|
|
63
|
+
state,
|
|
64
|
+
bundledPath,
|
|
65
|
+
installedPath,
|
|
66
|
+
bundledSha256: sha256(bundledContent),
|
|
67
|
+
...(installedContent === undefined ? {} : { installedSha256: sha256(installedContent) }),
|
|
68
|
+
installCommand: `tabwright skill install --target ${target}${state === 'outdated' ? ' --force' : ''}`,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function installTabwrightAgentSkill(options: {
|
|
73
|
+
target?: TabwrightAgentSkillTarget
|
|
74
|
+
codexHome?: string
|
|
75
|
+
bundledSkillPath?: string
|
|
76
|
+
overwrite?: boolean
|
|
77
|
+
} = {}): TabwrightAgentSkillInstallResult {
|
|
78
|
+
const before = getTabwrightAgentSkillStatus(options)
|
|
79
|
+
if (before.state === 'current') {
|
|
80
|
+
return {
|
|
81
|
+
...before,
|
|
82
|
+
fileStatus: 'unchanged',
|
|
83
|
+
next: ['Restart or open a new Codex thread so it can load the Tabwright skill.'],
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (before.state === 'outdated' && !options.overwrite) {
|
|
87
|
+
throw new Error(`Installed Tabwright skill differs from this CLI: ${before.installedPath}. Use --force to overwrite.`)
|
|
88
|
+
}
|
|
89
|
+
fs.mkdirSync(path.dirname(before.installedPath), { recursive: true })
|
|
90
|
+
fs.copyFileSync(before.bundledPath, before.installedPath)
|
|
91
|
+
const after = getTabwrightAgentSkillStatus(options)
|
|
92
|
+
return {
|
|
93
|
+
...after,
|
|
94
|
+
fileStatus: before.state === 'missing' ? 'created' : 'updated',
|
|
95
|
+
next: ['Restart or open a new Codex thread so it can load the Tabwright skill.'],
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function getCodexHome(codexHome?: string): string {
|
|
100
|
+
return path.resolve(codexHome || process.env.CODEX_HOME || path.join(os.homedir(), '.codex'))
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function sha256(content: string): string {
|
|
104
|
+
return crypto.createHash('sha256').update(content).digest('hex')
|
|
105
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ExtensionState } from 'mcp-extension/src/types.js'
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
var toggleExtensionForActiveTab: () => Promise<{ isConnected: boolean; state: ExtensionState }>
|
|
5
|
+
var getExtensionState: () => ExtensionState
|
|
6
|
+
var disconnectEverything: () => Promise<void>
|
|
7
|
+
|
|
8
|
+
// Browser globals used in evaluate() calls
|
|
9
|
+
var window: any
|
|
10
|
+
var document: any
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { describe, expect, test } from 'vitest'
|
|
4
|
+
import { startTabwrightCDPRelayServer } from './cdp-relay.js'
|
|
5
|
+
import {
|
|
6
|
+
getExtensionServiceWorker,
|
|
7
|
+
getLegacyExtensionLaunchArgs,
|
|
8
|
+
isExtensionLoadUnavailableError,
|
|
9
|
+
launchPersistentContextWithExtensions,
|
|
10
|
+
} from './test-utils.js'
|
|
11
|
+
|
|
12
|
+
describe('extension test browser launch', () => {
|
|
13
|
+
test('builds the legacy extension launch fallback flags', () => {
|
|
14
|
+
const extensionPaths = ['./extension-one', './extension-two']
|
|
15
|
+
const args = getLegacyExtensionLaunchArgs({ extensionPaths })
|
|
16
|
+
const resolvedPaths = extensionPaths.map((extensionPath) => {
|
|
17
|
+
return path.resolve(extensionPath)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
expect(args).toContain(`--disable-extensions-except=${resolvedPaths.join(',')}`)
|
|
21
|
+
expect(args).toContain(`--load-extension=${resolvedPaths.join(',')}`)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('recognizes older browsers without Extensions.loadUnpacked', () => {
|
|
25
|
+
expect(
|
|
26
|
+
isExtensionLoadUnavailableError(
|
|
27
|
+
new Error("Protocol error (Extensions.loadUnpacked): 'Extensions.loadUnpacked' wasn't found"),
|
|
28
|
+
),
|
|
29
|
+
).toBe(true)
|
|
30
|
+
expect(isExtensionLoadUnavailableError(new Error('Method not found'))).toBe(true)
|
|
31
|
+
expect(isExtensionLoadUnavailableError(new Error('Manifest is invalid'))).toBe(false)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test.runIf(Boolean(process.env.PLAYWRITER_TEST_EXTENSION_PATH))(
|
|
35
|
+
'loads an unpacked extension in the installed Chrome build',
|
|
36
|
+
async () => {
|
|
37
|
+
const extensionPath = process.env.PLAYWRITER_TEST_EXTENSION_PATH
|
|
38
|
+
if (!extensionPath) {
|
|
39
|
+
throw new Error('PLAYWRITER_TEST_EXTENSION_PATH is required')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const tempRoot = path.join(process.cwd(), 'tmp')
|
|
43
|
+
fs.mkdirSync(tempRoot, { recursive: true })
|
|
44
|
+
const userDataDir = fs.mkdtempSync(path.join(tempRoot, 'pw-extension-load-test-'))
|
|
45
|
+
const relayServer = await startTabwrightCDPRelayServer({
|
|
46
|
+
port: Number(process.env.PLAYWRITER_TEST_RELAY_PORT) || 19_997,
|
|
47
|
+
})
|
|
48
|
+
try {
|
|
49
|
+
const browserContext = await launchPersistentContextWithExtensions({
|
|
50
|
+
userDataDir,
|
|
51
|
+
extensionPaths: [extensionPath],
|
|
52
|
+
})
|
|
53
|
+
try {
|
|
54
|
+
const serviceWorker = await getExtensionServiceWorker(browserContext).catch(async (error: unknown) => {
|
|
55
|
+
const session = await browserContext.browser()?.newBrowserCDPSession()
|
|
56
|
+
const targets = session ? await session.send('Target.getTargets') : null
|
|
57
|
+
throw new Error(`No extension service worker target was visible: ${JSON.stringify(targets)}`, { cause: error })
|
|
58
|
+
})
|
|
59
|
+
expect(serviceWorker.url()).toMatch(/^chrome-extension:\/\//)
|
|
60
|
+
} finally {
|
|
61
|
+
await browserContext.close()
|
|
62
|
+
}
|
|
63
|
+
} finally {
|
|
64
|
+
relayServer.close()
|
|
65
|
+
fs.rmSync(userDataDir, { recursive: true, force: true })
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
60_000,
|
|
69
|
+
)
|
|
70
|
+
})
|