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,641 @@
|
|
|
1
|
+
import http from 'node:http'
|
|
2
|
+
import {
|
|
3
|
+
createCapability,
|
|
4
|
+
listCapabilities,
|
|
5
|
+
readCapabilityScript,
|
|
6
|
+
toCapabilitySummary,
|
|
7
|
+
updateCapabilityManifest,
|
|
8
|
+
updateCapabilityScript,
|
|
9
|
+
type CapabilityManifestPatch,
|
|
10
|
+
type CapabilityOperation,
|
|
11
|
+
type CapabilityRoutingHint,
|
|
12
|
+
type CapabilityStatus,
|
|
13
|
+
} from './capability-registry.js'
|
|
14
|
+
|
|
15
|
+
export interface CapabilityStudioServer {
|
|
16
|
+
host: string
|
|
17
|
+
port: number
|
|
18
|
+
close(): Promise<void>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function startCapabilityStudio(options: {
|
|
22
|
+
host: string
|
|
23
|
+
port: number
|
|
24
|
+
cwd: string
|
|
25
|
+
}): Promise<CapabilityStudioServer> {
|
|
26
|
+
const server = http.createServer(async (request, response) => {
|
|
27
|
+
try {
|
|
28
|
+
await handleRequest({ request, response, cwd: options.cwd })
|
|
29
|
+
} catch (error) {
|
|
30
|
+
sendJson({
|
|
31
|
+
response,
|
|
32
|
+
status: 500,
|
|
33
|
+
value: { error: error instanceof Error ? error.message : String(error) },
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
await new Promise<void>((resolve, reject) => {
|
|
39
|
+
server.once('error', reject)
|
|
40
|
+
server.listen(options.port, options.host, () => {
|
|
41
|
+
server.off('error', reject)
|
|
42
|
+
resolve()
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const address = server.address()
|
|
47
|
+
const port = typeof address === 'object' && address ? address.port : options.port
|
|
48
|
+
return {
|
|
49
|
+
host: options.host,
|
|
50
|
+
port,
|
|
51
|
+
close: () => {
|
|
52
|
+
return new Promise<void>((resolve, reject) => {
|
|
53
|
+
server.close((error) => {
|
|
54
|
+
if (error) {
|
|
55
|
+
reject(error)
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
resolve()
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function handleRequest(options: {
|
|
66
|
+
request: http.IncomingMessage
|
|
67
|
+
response: http.ServerResponse
|
|
68
|
+
cwd: string
|
|
69
|
+
}): Promise<void> {
|
|
70
|
+
const url = new URL(options.request.url || '/', 'http://localhost')
|
|
71
|
+
if (options.request.method === 'GET' && url.pathname === '/') {
|
|
72
|
+
sendHtml({ response: options.response, html: renderStudioHtml() })
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (options.request.method === 'GET' && url.pathname === '/api/capabilities') {
|
|
77
|
+
sendJson({
|
|
78
|
+
response: options.response,
|
|
79
|
+
value: listCapabilities({ cwd: options.cwd }).map(toCapabilitySummary),
|
|
80
|
+
})
|
|
81
|
+
return
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const capabilityMatch = /^\/api\/capabilities\/([^/]+)(?:\/([^/]+))?$/.exec(url.pathname)
|
|
85
|
+
if (!capabilityMatch) {
|
|
86
|
+
sendJson({ response: options.response, status: 404, value: { error: 'Not found' } })
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const id = decodeURIComponent(capabilityMatch[1] || '')
|
|
91
|
+
const action = capabilityMatch[2]
|
|
92
|
+
|
|
93
|
+
if (options.request.method === 'GET' && !action) {
|
|
94
|
+
const capability = listCapabilities({ cwd: options.cwd }).find((candidate) => {
|
|
95
|
+
return candidate.manifest.id === id
|
|
96
|
+
})
|
|
97
|
+
if (!capability) {
|
|
98
|
+
sendJson({ response: options.response, status: 404, value: { error: `Capability not found: ${id}` } })
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
sendJson({
|
|
102
|
+
response: options.response,
|
|
103
|
+
value: {
|
|
104
|
+
...toCapabilitySummary(capability),
|
|
105
|
+
script: readCapabilityScript({ id, cwd: options.cwd }),
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (options.request.method === 'POST' && !action) {
|
|
112
|
+
const body = await readJsonBody(options.request)
|
|
113
|
+
const capability = createCapability({
|
|
114
|
+
id,
|
|
115
|
+
title: typeof body.title === 'string' ? body.title : undefined,
|
|
116
|
+
description: typeof body.description === 'string' ? body.description : undefined,
|
|
117
|
+
location: body.project === true ? 'project' : 'user',
|
|
118
|
+
cwd: options.cwd,
|
|
119
|
+
createdBy: 'user',
|
|
120
|
+
})
|
|
121
|
+
sendJson({ response: options.response, value: toCapabilitySummary(capability) })
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (options.request.method === 'PUT' && action === 'script') {
|
|
126
|
+
const body = await readJsonBody(options.request)
|
|
127
|
+
if (typeof body.source !== 'string') {
|
|
128
|
+
sendJson({ response: options.response, status: 400, value: { error: 'source must be string' } })
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
const capability = updateCapabilityScript({ id, cwd: options.cwd, source: body.source })
|
|
132
|
+
sendJson({ response: options.response, value: toCapabilitySummary(capability) })
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (options.request.method === 'PATCH' && action === 'manifest') {
|
|
137
|
+
const body = await readJsonBody(options.request)
|
|
138
|
+
const patch = buildManifestPatch(body)
|
|
139
|
+
const capability = updateCapabilityManifest({ id, cwd: options.cwd, patch })
|
|
140
|
+
sendJson({ response: options.response, value: toCapabilitySummary(capability) })
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
sendJson({ response: options.response, status: 404, value: { error: 'Not found' } })
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function buildManifestPatch(body: Record<string, unknown>): CapabilityManifestPatch {
|
|
148
|
+
const patch: CapabilityManifestPatch = {}
|
|
149
|
+
if (typeof body.title === 'string') {
|
|
150
|
+
patch.title = body.title
|
|
151
|
+
}
|
|
152
|
+
if (typeof body.description === 'string') {
|
|
153
|
+
patch.description = body.description
|
|
154
|
+
}
|
|
155
|
+
if (isCapabilityStatus(body.status)) {
|
|
156
|
+
patch.status = body.status
|
|
157
|
+
}
|
|
158
|
+
if (Array.isArray(body.match) && body.match.every((item) => typeof item === 'string')) {
|
|
159
|
+
patch.match = body.match
|
|
160
|
+
}
|
|
161
|
+
if (isCapabilityRoutingHint(body.routingHint)) {
|
|
162
|
+
patch.routingHint = body.routingHint
|
|
163
|
+
}
|
|
164
|
+
if (Array.isArray(body.permissions) && body.permissions.every((item) => typeof item === 'string')) {
|
|
165
|
+
patch.permissions = body.permissions
|
|
166
|
+
}
|
|
167
|
+
if (Array.isArray(body.whenToUse) && body.whenToUse.every((item) => typeof item === 'string')) {
|
|
168
|
+
patch.whenToUse = body.whenToUse
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(body.whenNotToUse) && body.whenNotToUse.every((item) => typeof item === 'string')) {
|
|
171
|
+
patch.whenNotToUse = body.whenNotToUse
|
|
172
|
+
}
|
|
173
|
+
if (Array.isArray(body.tags) && body.tags.every((item) => typeof item === 'string')) {
|
|
174
|
+
patch.tags = body.tags
|
|
175
|
+
}
|
|
176
|
+
if (body.sideEffect === 'read' || body.sideEffect === 'write' || body.sideEffect === 'dangerous') {
|
|
177
|
+
patch.sideEffect = body.sideEffect
|
|
178
|
+
}
|
|
179
|
+
if (typeof body.requiresConfirmation === 'boolean') {
|
|
180
|
+
patch.requiresConfirmation = body.requiresConfirmation
|
|
181
|
+
}
|
|
182
|
+
if (isRecord(body.auth)) {
|
|
183
|
+
patch.auth = {
|
|
184
|
+
type:
|
|
185
|
+
body.auth.type === 'cookie' || body.auth.type === 'token' || body.auth.type === 'custom'
|
|
186
|
+
? body.auth.type
|
|
187
|
+
: 'none',
|
|
188
|
+
refresh: body.auth.refresh === 'manual' || body.auth.refresh === 'from-browser' ? body.auth.refresh : 'none',
|
|
189
|
+
secretKey: typeof body.auth.secretKey === 'string' ? body.auth.secretKey : undefined,
|
|
190
|
+
browserUrls: Array.isArray(body.auth.browserUrls)
|
|
191
|
+
? body.auth.browserUrls.filter((item): item is string => {
|
|
192
|
+
return typeof item === 'string'
|
|
193
|
+
})
|
|
194
|
+
: [],
|
|
195
|
+
requiredCookieNames: Array.isArray(body.auth.requiredCookieNames)
|
|
196
|
+
? body.auth.requiredCookieNames.filter((item): item is string => {
|
|
197
|
+
return typeof item === 'string'
|
|
198
|
+
})
|
|
199
|
+
: [],
|
|
200
|
+
failureSignals: Array.isArray(body.auth.failureSignals)
|
|
201
|
+
? body.auth.failureSignals.filter((item): item is string => {
|
|
202
|
+
return typeof item === 'string'
|
|
203
|
+
})
|
|
204
|
+
: [],
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (Array.isArray(body.examples)) {
|
|
208
|
+
patch.examples = body.examples
|
|
209
|
+
.filter((item) => {
|
|
210
|
+
return isRecord(item)
|
|
211
|
+
})
|
|
212
|
+
.map((item) => {
|
|
213
|
+
return {
|
|
214
|
+
description: typeof item.description === 'string' ? item.description : undefined,
|
|
215
|
+
input: item.input,
|
|
216
|
+
output: item.output,
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
if (isRecord(body.inputSchema)) {
|
|
221
|
+
patch.inputSchema = body.inputSchema
|
|
222
|
+
}
|
|
223
|
+
if (isRecord(body.outputSchema)) {
|
|
224
|
+
patch.outputSchema = body.outputSchema
|
|
225
|
+
}
|
|
226
|
+
const operations = parseCapabilityOperations(body.operations)
|
|
227
|
+
if (operations) {
|
|
228
|
+
patch.operations = operations
|
|
229
|
+
}
|
|
230
|
+
return patch
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function parseCapabilityOperations(value: unknown): Record<string, CapabilityOperation> | undefined {
|
|
234
|
+
if (!isRecord(value)) {
|
|
235
|
+
return undefined
|
|
236
|
+
}
|
|
237
|
+
return Object.fromEntries(
|
|
238
|
+
Object.entries(value).map(([id, rawOperation]) => {
|
|
239
|
+
if (!isRecord(rawOperation)) {
|
|
240
|
+
throw new Error(`Capability operation ${id} must be an object`)
|
|
241
|
+
}
|
|
242
|
+
const operation: CapabilityOperation = {
|
|
243
|
+
title: typeof rawOperation.title === 'string' ? rawOperation.title : '',
|
|
244
|
+
description: typeof rawOperation.description === 'string' ? rawOperation.description : '',
|
|
245
|
+
match: Array.isArray(rawOperation.match)
|
|
246
|
+
? rawOperation.match.filter((item): item is string => {
|
|
247
|
+
return typeof item === 'string'
|
|
248
|
+
})
|
|
249
|
+
: [],
|
|
250
|
+
routingHint: isCapabilityRoutingHint(rawOperation.routingHint) ? rawOperation.routingHint : 'search-first',
|
|
251
|
+
inputSchema: isRecord(rawOperation.inputSchema) ? rawOperation.inputSchema : {},
|
|
252
|
+
outputSchema: isRecord(rawOperation.outputSchema) ? rawOperation.outputSchema : {},
|
|
253
|
+
permissions: Array.isArray(rawOperation.permissions)
|
|
254
|
+
? rawOperation.permissions.filter((item): item is string => {
|
|
255
|
+
return typeof item === 'string'
|
|
256
|
+
})
|
|
257
|
+
: undefined,
|
|
258
|
+
sideEffect:
|
|
259
|
+
rawOperation.sideEffect === 'write' || rawOperation.sideEffect === 'dangerous'
|
|
260
|
+
? rawOperation.sideEffect
|
|
261
|
+
: 'read',
|
|
262
|
+
requiresConfirmation: rawOperation.requiresConfirmation === true,
|
|
263
|
+
}
|
|
264
|
+
return [id, operation]
|
|
265
|
+
}),
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function isCapabilityStatus(value: unknown): value is CapabilityStatus {
|
|
270
|
+
return value === 'draft' || value === 'trusted' || value === 'disabled'
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function isCapabilityRoutingHint(value: unknown): value is CapabilityRoutingHint {
|
|
274
|
+
return value === 'search-first' || value === 'exact-match-direct-run'
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async function readJsonBody(request: http.IncomingMessage): Promise<Record<string, unknown>> {
|
|
278
|
+
const chunks: Buffer[] = []
|
|
279
|
+
for await (const chunk of request) {
|
|
280
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
|
|
281
|
+
}
|
|
282
|
+
if (chunks.length === 0) {
|
|
283
|
+
return {}
|
|
284
|
+
}
|
|
285
|
+
const parsed = JSON.parse(Buffer.concat(chunks).toString('utf-8'))
|
|
286
|
+
if (!isRecord(parsed)) {
|
|
287
|
+
throw new Error('JSON body must be object')
|
|
288
|
+
}
|
|
289
|
+
return parsed
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
293
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function sendJson(options: { response: http.ServerResponse; value: unknown; status?: number }): void {
|
|
297
|
+
options.response.writeHead(options.status || 200, {
|
|
298
|
+
'content-type': 'application/json; charset=utf-8',
|
|
299
|
+
'cache-control': 'no-store',
|
|
300
|
+
})
|
|
301
|
+
options.response.end(JSON.stringify(options.value, null, 2))
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function sendHtml(options: { response: http.ServerResponse; html: string }): void {
|
|
305
|
+
options.response.writeHead(200, {
|
|
306
|
+
'content-type': 'text/html; charset=utf-8',
|
|
307
|
+
'cache-control': 'no-store',
|
|
308
|
+
})
|
|
309
|
+
options.response.end(options.html)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function renderStudioHtml(): string {
|
|
313
|
+
return `<!doctype html>
|
|
314
|
+
<html lang="en">
|
|
315
|
+
<head>
|
|
316
|
+
<meta charset="utf-8" />
|
|
317
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
318
|
+
<title>Tabwright Studio</title>
|
|
319
|
+
<style>
|
|
320
|
+
:root {
|
|
321
|
+
color-scheme: light;
|
|
322
|
+
--bg: #f7f8fa;
|
|
323
|
+
--panel: #ffffff;
|
|
324
|
+
--text: #16181d;
|
|
325
|
+
--muted: #687081;
|
|
326
|
+
--line: #d9dee8;
|
|
327
|
+
--blue: #246bfe;
|
|
328
|
+
--green: #157f4f;
|
|
329
|
+
--red: #c7362f;
|
|
330
|
+
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
331
|
+
--sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
332
|
+
}
|
|
333
|
+
* { box-sizing: border-box; }
|
|
334
|
+
body {
|
|
335
|
+
margin: 0;
|
|
336
|
+
font-family: var(--sans);
|
|
337
|
+
background: var(--bg);
|
|
338
|
+
color: var(--text);
|
|
339
|
+
}
|
|
340
|
+
.shell {
|
|
341
|
+
display: grid;
|
|
342
|
+
grid-template-columns: 320px 1fr;
|
|
343
|
+
min-height: 100vh;
|
|
344
|
+
}
|
|
345
|
+
aside {
|
|
346
|
+
border-right: 1px solid var(--line);
|
|
347
|
+
background: var(--panel);
|
|
348
|
+
padding: 16px;
|
|
349
|
+
overflow: auto;
|
|
350
|
+
}
|
|
351
|
+
main {
|
|
352
|
+
padding: 20px;
|
|
353
|
+
overflow: auto;
|
|
354
|
+
}
|
|
355
|
+
.topbar, .row, .actions {
|
|
356
|
+
display: flex;
|
|
357
|
+
align-items: center;
|
|
358
|
+
gap: 8px;
|
|
359
|
+
}
|
|
360
|
+
.topbar {
|
|
361
|
+
justify-content: space-between;
|
|
362
|
+
margin-bottom: 16px;
|
|
363
|
+
}
|
|
364
|
+
h1, h2 {
|
|
365
|
+
margin: 0;
|
|
366
|
+
letter-spacing: 0;
|
|
367
|
+
}
|
|
368
|
+
h1 { font-size: 18px; }
|
|
369
|
+
h2 { font-size: 20px; }
|
|
370
|
+
button, input, textarea, select {
|
|
371
|
+
font: inherit;
|
|
372
|
+
border: 1px solid var(--line);
|
|
373
|
+
border-radius: 6px;
|
|
374
|
+
background: #fff;
|
|
375
|
+
color: var(--text);
|
|
376
|
+
}
|
|
377
|
+
button {
|
|
378
|
+
min-height: 32px;
|
|
379
|
+
padding: 0 10px;
|
|
380
|
+
cursor: pointer;
|
|
381
|
+
}
|
|
382
|
+
button.primary {
|
|
383
|
+
border-color: var(--blue);
|
|
384
|
+
background: var(--blue);
|
|
385
|
+
color: #fff;
|
|
386
|
+
}
|
|
387
|
+
button.danger {
|
|
388
|
+
border-color: var(--red);
|
|
389
|
+
color: var(--red);
|
|
390
|
+
}
|
|
391
|
+
input, select {
|
|
392
|
+
height: 34px;
|
|
393
|
+
padding: 0 10px;
|
|
394
|
+
}
|
|
395
|
+
textarea {
|
|
396
|
+
width: 100%;
|
|
397
|
+
min-height: 380px;
|
|
398
|
+
padding: 12px;
|
|
399
|
+
resize: vertical;
|
|
400
|
+
font-family: var(--mono);
|
|
401
|
+
font-size: 13px;
|
|
402
|
+
line-height: 1.5;
|
|
403
|
+
}
|
|
404
|
+
.list {
|
|
405
|
+
display: grid;
|
|
406
|
+
gap: 8px;
|
|
407
|
+
}
|
|
408
|
+
.item {
|
|
409
|
+
width: 100%;
|
|
410
|
+
text-align: left;
|
|
411
|
+
padding: 10px;
|
|
412
|
+
border: 1px solid var(--line);
|
|
413
|
+
border-radius: 8px;
|
|
414
|
+
background: #fff;
|
|
415
|
+
}
|
|
416
|
+
.item.active {
|
|
417
|
+
border-color: var(--blue);
|
|
418
|
+
box-shadow: inset 3px 0 0 var(--blue);
|
|
419
|
+
}
|
|
420
|
+
.title {
|
|
421
|
+
font-weight: 650;
|
|
422
|
+
margin-bottom: 4px;
|
|
423
|
+
}
|
|
424
|
+
.meta {
|
|
425
|
+
color: var(--muted);
|
|
426
|
+
font-size: 12px;
|
|
427
|
+
}
|
|
428
|
+
.grid {
|
|
429
|
+
display: grid;
|
|
430
|
+
grid-template-columns: minmax(0, 1fr) 260px;
|
|
431
|
+
gap: 16px;
|
|
432
|
+
align-items: start;
|
|
433
|
+
}
|
|
434
|
+
.panel {
|
|
435
|
+
background: var(--panel);
|
|
436
|
+
border: 1px solid var(--line);
|
|
437
|
+
border-radius: 8px;
|
|
438
|
+
padding: 14px;
|
|
439
|
+
}
|
|
440
|
+
label {
|
|
441
|
+
display: grid;
|
|
442
|
+
gap: 6px;
|
|
443
|
+
font-size: 12px;
|
|
444
|
+
color: var(--muted);
|
|
445
|
+
margin-bottom: 10px;
|
|
446
|
+
}
|
|
447
|
+
.empty {
|
|
448
|
+
color: var(--muted);
|
|
449
|
+
padding: 40px 0;
|
|
450
|
+
text-align: center;
|
|
451
|
+
}
|
|
452
|
+
.status-trusted { color: var(--green); }
|
|
453
|
+
.status-draft { color: var(--muted); }
|
|
454
|
+
.status-disabled { color: var(--red); }
|
|
455
|
+
@media (max-width: 840px) {
|
|
456
|
+
.shell { grid-template-columns: 1fr; }
|
|
457
|
+
aside { border-right: 0; border-bottom: 1px solid var(--line); }
|
|
458
|
+
.grid { grid-template-columns: 1fr; }
|
|
459
|
+
}
|
|
460
|
+
</style>
|
|
461
|
+
</head>
|
|
462
|
+
<body>
|
|
463
|
+
<div class="shell">
|
|
464
|
+
<aside>
|
|
465
|
+
<div class="topbar">
|
|
466
|
+
<h1>Tabwright Studio</h1>
|
|
467
|
+
<button id="refresh">Refresh</button>
|
|
468
|
+
</div>
|
|
469
|
+
<div class="row" style="margin-bottom: 12px;">
|
|
470
|
+
<input id="newId" placeholder="new-capability" style="min-width: 0; flex: 1;" />
|
|
471
|
+
<button id="create" class="primary">Create</button>
|
|
472
|
+
</div>
|
|
473
|
+
<div id="list" class="list"></div>
|
|
474
|
+
</aside>
|
|
475
|
+
<main>
|
|
476
|
+
<div id="empty" class="empty">Select a capability.</div>
|
|
477
|
+
<div id="detail" hidden>
|
|
478
|
+
<div class="topbar">
|
|
479
|
+
<div>
|
|
480
|
+
<h2 id="detailTitle"></h2>
|
|
481
|
+
<div id="detailMeta" class="meta"></div>
|
|
482
|
+
</div>
|
|
483
|
+
<div class="actions">
|
|
484
|
+
<button id="saveManifest">Save manifest</button>
|
|
485
|
+
<button id="saveScript" class="primary">Save script</button>
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
<div class="grid">
|
|
489
|
+
<section class="panel">
|
|
490
|
+
<textarea id="script"></textarea>
|
|
491
|
+
</section>
|
|
492
|
+
<section class="panel">
|
|
493
|
+
<label>Title<input id="title" /></label>
|
|
494
|
+
<label>Description<input id="description" /></label>
|
|
495
|
+
<label>Status
|
|
496
|
+
<select id="status">
|
|
497
|
+
<option value="draft">draft</option>
|
|
498
|
+
<option value="trusted">trusted</option>
|
|
499
|
+
<option value="disabled">disabled</option>
|
|
500
|
+
</select>
|
|
501
|
+
</label>
|
|
502
|
+
<label>Routing hint
|
|
503
|
+
<select id="routingHint">
|
|
504
|
+
<option value="search-first">search-first</option>
|
|
505
|
+
<option value="exact-match-direct-run">exact-match-direct-run</option>
|
|
506
|
+
</select>
|
|
507
|
+
</label>
|
|
508
|
+
<label>Match patterns<textarea id="match" style="min-height: 90px;"></textarea></label>
|
|
509
|
+
<label>Permissions<textarea id="permissions" style="min-height: 90px;"></textarea></label>
|
|
510
|
+
<label>Input schema<textarea id="inputSchema" style="min-height: 140px;"></textarea></label>
|
|
511
|
+
<label>Output schema<textarea id="outputSchema" style="min-height: 140px;"></textarea></label>
|
|
512
|
+
<label>Operations<textarea id="operations" style="min-height: 220px;"></textarea></label>
|
|
513
|
+
</section>
|
|
514
|
+
</div>
|
|
515
|
+
</div>
|
|
516
|
+
</main>
|
|
517
|
+
</div>
|
|
518
|
+
<script>
|
|
519
|
+
const state = { capabilities: [], selectedId: null }
|
|
520
|
+
const el = (id) => document.getElementById(id)
|
|
521
|
+
|
|
522
|
+
async function api(path, options = {}) {
|
|
523
|
+
const response = await fetch(path, {
|
|
524
|
+
...options,
|
|
525
|
+
headers: {
|
|
526
|
+
'content-type': 'application/json',
|
|
527
|
+
...(options.headers || {}),
|
|
528
|
+
},
|
|
529
|
+
})
|
|
530
|
+
const data = await response.json()
|
|
531
|
+
if (!response.ok) {
|
|
532
|
+
throw new Error(data.error || response.statusText)
|
|
533
|
+
}
|
|
534
|
+
return data
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function renderList() {
|
|
538
|
+
el('list').innerHTML = ''
|
|
539
|
+
for (const capability of state.capabilities) {
|
|
540
|
+
const button = document.createElement('button')
|
|
541
|
+
button.className = 'item' + (capability.id === state.selectedId ? ' active' : '')
|
|
542
|
+
button.innerHTML = '<div class="title">' + escapeHtml(capability.title) + '</div>' +
|
|
543
|
+
'<div class="meta"><span class="status-' + capability.status + '">' + capability.status + '</span> · ' +
|
|
544
|
+
escapeHtml(capability.location) + ' · ' + escapeHtml(capability.id) + '</div>'
|
|
545
|
+
button.onclick = () => { selectCapability(capability.id) }
|
|
546
|
+
el('list').appendChild(button)
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
async function refresh() {
|
|
551
|
+
state.capabilities = await api('/api/capabilities')
|
|
552
|
+
renderList()
|
|
553
|
+
if (state.selectedId) {
|
|
554
|
+
await selectCapability(state.selectedId)
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
async function selectCapability(id) {
|
|
559
|
+
state.selectedId = id
|
|
560
|
+
renderList()
|
|
561
|
+
const capability = await api('/api/capabilities/' + encodeURIComponent(id))
|
|
562
|
+
el('empty').hidden = true
|
|
563
|
+
el('detail').hidden = false
|
|
564
|
+
el('detailTitle').textContent = capability.title
|
|
565
|
+
el('detailMeta').textContent = capability.id + ' · ' + capability.dir
|
|
566
|
+
el('title').value = capability.title || ''
|
|
567
|
+
el('description').value = capability.description || ''
|
|
568
|
+
el('status').value = capability.status || 'draft'
|
|
569
|
+
el('routingHint').value = capability.routingHint || 'search-first'
|
|
570
|
+
el('match').value = (capability.match || []).join('\\n')
|
|
571
|
+
el('permissions').value = (capability.permissions || []).join('\\n')
|
|
572
|
+
el('inputSchema').value = JSON.stringify(capability.inputSchema || {}, null, 2)
|
|
573
|
+
el('outputSchema').value = JSON.stringify(capability.outputSchema || {}, null, 2)
|
|
574
|
+
el('operations').value = JSON.stringify(capability.operations || {}, null, 2)
|
|
575
|
+
el('script').value = capability.script || ''
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
async function createCapability() {
|
|
579
|
+
const id = el('newId').value.trim()
|
|
580
|
+
if (!id) return
|
|
581
|
+
await api('/api/capabilities/' + encodeURIComponent(id), {
|
|
582
|
+
method: 'POST',
|
|
583
|
+
body: JSON.stringify({ title: id }),
|
|
584
|
+
})
|
|
585
|
+
el('newId').value = ''
|
|
586
|
+
await refresh()
|
|
587
|
+
await selectCapability(id)
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async function saveManifest() {
|
|
591
|
+
if (!state.selectedId) return
|
|
592
|
+
await api('/api/capabilities/' + encodeURIComponent(state.selectedId) + '/manifest', {
|
|
593
|
+
method: 'PATCH',
|
|
594
|
+
body: JSON.stringify({
|
|
595
|
+
title: el('title').value,
|
|
596
|
+
description: el('description').value,
|
|
597
|
+
status: el('status').value,
|
|
598
|
+
routingHint: el('routingHint').value,
|
|
599
|
+
match: lines(el('match').value),
|
|
600
|
+
permissions: lines(el('permissions').value),
|
|
601
|
+
inputSchema: JSON.parse(el('inputSchema').value || '{}'),
|
|
602
|
+
outputSchema: JSON.parse(el('outputSchema').value || '{}'),
|
|
603
|
+
operations: JSON.parse(el('operations').value || '{}'),
|
|
604
|
+
}),
|
|
605
|
+
})
|
|
606
|
+
await refresh()
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
async function saveScript() {
|
|
610
|
+
if (!state.selectedId) return
|
|
611
|
+
await api('/api/capabilities/' + encodeURIComponent(state.selectedId) + '/script', {
|
|
612
|
+
method: 'PUT',
|
|
613
|
+
body: JSON.stringify({ source: el('script').value }),
|
|
614
|
+
})
|
|
615
|
+
await refresh()
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
function lines(value) {
|
|
619
|
+
return value.split('\\n').map((line) => line.trim()).filter(Boolean)
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function escapeHtml(value) {
|
|
623
|
+
return String(value).replace(/[&<>"']/g, (char) => ({
|
|
624
|
+
'&': '&',
|
|
625
|
+
'<': '<',
|
|
626
|
+
'>': '>',
|
|
627
|
+
'"': '"',
|
|
628
|
+
"'": ''',
|
|
629
|
+
})[char])
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
el('refresh').onclick = () => { refresh().catch(alertError) }
|
|
633
|
+
el('create').onclick = () => { createCapability().catch(alertError) }
|
|
634
|
+
el('saveManifest').onclick = () => { saveManifest().catch(alertError) }
|
|
635
|
+
el('saveScript').onclick = () => { saveScript().catch(alertError) }
|
|
636
|
+
function alertError(error) { alert(error.message || String(error)) }
|
|
637
|
+
refresh().catch(alertError)
|
|
638
|
+
</script>
|
|
639
|
+
</body>
|
|
640
|
+
</html>`
|
|
641
|
+
}
|