tabwright 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aria-snapshot.d.ts +0 -1
- package/dist/aria-snapshot.js +9 -1
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts +0 -1
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js +0 -1
- package/dist/bippy.js +1 -1
- package/dist/browser-config.d.ts +0 -1
- package/dist/browser-config.js +0 -1
- package/dist/browser-install.d.ts +0 -1
- package/dist/browser-install.js +0 -1
- package/dist/browser-launch.d.ts +0 -1
- package/dist/browser-launch.js +0 -1
- package/dist/builtin-capabilities.d.ts +0 -1
- package/dist/builtin-capabilities.js +0 -1
- package/dist/capability-agent-skill.d.ts +0 -1
- package/dist/capability-agent-skill.js +0 -1
- package/dist/capability-auth-state.d.ts +0 -1
- package/dist/capability-auth-state.js +0 -1
- package/dist/capability-auth.d.ts +0 -1
- package/dist/capability-auth.js +0 -1
- package/dist/capability-options.d.ts +0 -1
- package/dist/capability-options.js +0 -1
- package/dist/capability-package.d.ts +0 -1
- package/dist/capability-package.js +0 -1
- package/dist/capability-registry.d.ts +0 -1
- package/dist/capability-registry.js +0 -1
- package/dist/capability-runner.d.ts +0 -1
- package/dist/capability-runner.js +0 -1
- package/dist/capability-studio.d.ts +0 -1
- package/dist/capability-studio.js +0 -1
- package/dist/cdp-log.d.ts +0 -1
- package/dist/cdp-log.js +0 -1
- package/dist/cdp-relay.d.ts +0 -1
- package/dist/cdp-relay.js +0 -1
- package/dist/cdp-session.d.ts +0 -1
- package/dist/cdp-session.js +0 -1
- package/dist/cdp-types.d.ts +0 -1
- package/dist/cdp-types.js +0 -1
- package/dist/chrome-discovery.d.ts +0 -1
- package/dist/chrome-discovery.js +0 -1
- package/dist/clean-html.d.ts +0 -1
- package/dist/clean-html.js +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +9 -2
- package/dist/cloud-client.d.ts +0 -1
- package/dist/cloud-client.js +0 -1
- package/dist/create-logger.d.ts +0 -1
- package/dist/create-logger.js +0 -1
- package/dist/debugger-examples-types.d.ts +0 -1
- package/dist/debugger-examples-types.js +0 -1
- package/dist/debugger-examples.d.ts +0 -1
- package/dist/debugger-examples.js +0 -1
- package/dist/debugger.d.ts +0 -1
- package/dist/debugger.js +0 -1
- package/dist/diff-utils.d.ts +0 -1
- package/dist/diff-utils.js +0 -1
- package/dist/doctor.d.ts +0 -1
- package/dist/doctor.js +5 -7
- package/dist/editor-examples.d.ts +0 -1
- package/dist/editor-examples.js +0 -1
- package/dist/editor.d.ts +0 -1
- package/dist/editor.js +0 -1
- package/dist/env-compat.d.ts +0 -1
- package/dist/env-compat.js +0 -1
- package/dist/executor.d.ts +0 -1
- package/dist/executor.js +1 -2
- package/dist/extension/background.js +7 -3
- package/dist/extension/manifest.json +1 -1
- package/dist/ghost-browser.d.ts +0 -1
- package/dist/ghost-browser.js +0 -1
- package/dist/ghost-cursor-controller.d.ts +0 -1
- package/dist/ghost-cursor-controller.js +0 -1
- package/dist/ghost-cursor.d.ts +0 -1
- package/dist/ghost-cursor.js +0 -1
- package/dist/htmlrewrite.d.ts +0 -1
- package/dist/htmlrewrite.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/kill-port.d.ts +0 -1
- package/dist/kill-port.js +0 -1
- package/dist/kitty-graphics.d.ts +0 -1
- package/dist/kitty-graphics.js +0 -1
- package/dist/mcp.d.ts +0 -1
- package/dist/mcp.js +0 -1
- package/dist/package-paths.d.ts +0 -1
- package/dist/package-paths.js +0 -1
- package/dist/page-markdown.d.ts +0 -1
- package/dist/page-markdown.js +0 -1
- package/dist/performance-examples.d.ts +0 -1
- package/dist/performance-examples.js +0 -1
- package/dist/playwright-import.d.ts +0 -1
- package/dist/playwright-import.js +0 -1
- package/dist/product-paths.d.ts +0 -1
- package/dist/product-paths.js +0 -1
- package/dist/protocol.d.ts +0 -1
- package/dist/protocol.js +0 -1
- package/dist/react-source.d.ts +0 -1
- package/dist/react-source.js +0 -1
- package/dist/readability.js +1 -1
- package/dist/relay-client.d.ts +0 -1
- package/dist/relay-client.js +0 -1
- package/dist/relay-state.d.ts +0 -1
- package/dist/relay-state.js +0 -1
- package/dist/replay-ai-index.d.ts +0 -1
- package/dist/replay-ai-index.js +0 -1
- package/dist/replay-eval.d.ts +0 -1
- package/dist/replay-eval.js +0 -1
- package/dist/replay-handoff.d.ts +0 -1
- package/dist/replay-handoff.js +0 -1
- package/dist/replay-workflow-compiler.d.ts +0 -1
- package/dist/replay-workflow-compiler.js +0 -1
- package/dist/rrweb-recording-relay.d.ts +0 -1
- package/dist/rrweb-recording-relay.js +0 -1
- package/dist/rrweb-recording.d.ts +0 -1
- package/dist/rrweb-recording.js +0 -1
- package/dist/scoped-fs.d.ts +0 -1
- package/dist/scoped-fs.js +0 -1
- package/dist/selector-generator.js +1 -1
- package/dist/start-relay-server.d.ts +0 -1
- package/dist/start-relay-server.js +0 -1
- package/dist/styles-examples.d.ts +0 -1
- package/dist/styles-examples.js +0 -1
- package/dist/styles.d.ts +0 -1
- package/dist/styles.js +0 -1
- package/dist/tabwright-agent-skill.d.ts +0 -1
- package/dist/tabwright-agent-skill.js +0 -1
- package/dist/test-declarations.d.ts +0 -1
- package/dist/test-declarations.js +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +2 -2
- package/dist/wait-for-page-load.d.ts +0 -1
- package/dist/wait-for-page-load.js +0 -1
- package/dist/workflow-capability.d.ts +0 -1
- package/dist/workflow-capability.js +0 -1
- package/package.json +9 -4
- package/readme.md +35 -0
- package/dist/aria-snapshot.d.ts.map +0 -1
- package/dist/aria-snapshot.js.map +0 -1
- package/dist/aria-snapshot.test.d.ts +0 -2
- package/dist/aria-snapshot.test.d.ts.map +0 -1
- package/dist/aria-snapshot.test.js +0 -270
- package/dist/aria-snapshot.test.js.map +0 -1
- package/dist/aria-snapshot.unit.test.d.ts +0 -2
- package/dist/aria-snapshot.unit.test.d.ts.map +0 -1
- package/dist/aria-snapshot.unit.test.js +0 -542
- package/dist/aria-snapshot.unit.test.js.map +0 -1
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts.map +0 -1
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js.map +0 -1
- package/dist/browser-config.d.ts.map +0 -1
- package/dist/browser-config.js.map +0 -1
- package/dist/browser-install.d.ts.map +0 -1
- package/dist/browser-install.js.map +0 -1
- package/dist/browser-launch.d.ts.map +0 -1
- package/dist/browser-launch.js.map +0 -1
- package/dist/builtin-capabilities.d.ts.map +0 -1
- package/dist/builtin-capabilities.js.map +0 -1
- package/dist/capability-agent-skill.d.ts.map +0 -1
- package/dist/capability-agent-skill.js.map +0 -1
- package/dist/capability-auth-state.d.ts.map +0 -1
- package/dist/capability-auth-state.js.map +0 -1
- package/dist/capability-auth.d.ts.map +0 -1
- package/dist/capability-auth.js.map +0 -1
- package/dist/capability-cli-confirmation.test.d.ts +0 -2
- package/dist/capability-cli-confirmation.test.d.ts.map +0 -1
- package/dist/capability-cli-confirmation.test.js +0 -79
- package/dist/capability-cli-confirmation.test.js.map +0 -1
- package/dist/capability-options.d.ts.map +0 -1
- package/dist/capability-options.js.map +0 -1
- package/dist/capability-options.test.d.ts +0 -2
- package/dist/capability-options.test.d.ts.map +0 -1
- package/dist/capability-options.test.js +0 -81
- package/dist/capability-options.test.js.map +0 -1
- package/dist/capability-package.d.ts.map +0 -1
- package/dist/capability-package.js.map +0 -1
- package/dist/capability-package.test.d.ts +0 -2
- package/dist/capability-package.test.d.ts.map +0 -1
- package/dist/capability-package.test.js +0 -179
- package/dist/capability-package.test.js.map +0 -1
- package/dist/capability-registry.d.ts.map +0 -1
- package/dist/capability-registry.js.map +0 -1
- package/dist/capability-registry.test.d.ts +0 -2
- package/dist/capability-registry.test.d.ts.map +0 -1
- package/dist/capability-registry.test.js +0 -1683
- package/dist/capability-registry.test.js.map +0 -1
- package/dist/capability-runner.d.ts.map +0 -1
- package/dist/capability-runner.js.map +0 -1
- package/dist/capability-search-relevance.test.d.ts +0 -2
- package/dist/capability-search-relevance.test.d.ts.map +0 -1
- package/dist/capability-search-relevance.test.js +0 -67
- package/dist/capability-search-relevance.test.js.map +0 -1
- package/dist/capability-studio.d.ts.map +0 -1
- package/dist/capability-studio.js.map +0 -1
- package/dist/capability-studio.test.d.ts +0 -2
- package/dist/capability-studio.test.d.ts.map +0 -1
- package/dist/capability-studio.test.js +0 -41
- package/dist/capability-studio.test.js.map +0 -1
- package/dist/cdp-log.d.ts.map +0 -1
- package/dist/cdp-log.js.map +0 -1
- package/dist/cdp-log.test.d.ts +0 -2
- package/dist/cdp-log.test.d.ts.map +0 -1
- package/dist/cdp-log.test.js +0 -109
- package/dist/cdp-log.test.js.map +0 -1
- package/dist/cdp-relay.d.ts.map +0 -1
- package/dist/cdp-relay.js.map +0 -1
- package/dist/cdp-session.d.ts.map +0 -1
- package/dist/cdp-session.js.map +0 -1
- package/dist/cdp-types.d.ts.map +0 -1
- package/dist/cdp-types.js.map +0 -1
- package/dist/channel-owner-inspect.test.d.ts +0 -2
- package/dist/channel-owner-inspect.test.d.ts.map +0 -1
- package/dist/channel-owner-inspect.test.js +0 -75
- package/dist/channel-owner-inspect.test.js.map +0 -1
- package/dist/chrome-discovery.d.ts.map +0 -1
- package/dist/chrome-discovery.js.map +0 -1
- package/dist/chrome-discovery.test.d.ts +0 -2
- package/dist/chrome-discovery.test.d.ts.map +0 -1
- package/dist/chrome-discovery.test.js +0 -41
- package/dist/chrome-discovery.test.js.map +0 -1
- package/dist/clean-html.d.ts.map +0 -1
- package/dist/clean-html.js.map +0 -1
- package/dist/cli-help.test.d.ts +0 -2
- package/dist/cli-help.test.d.ts.map +0 -1
- package/dist/cli-help.test.js +0 -98
- package/dist/cli-help.test.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cloud-client.d.ts.map +0 -1
- package/dist/cloud-client.js.map +0 -1
- package/dist/create-logger.d.ts.map +0 -1
- package/dist/create-logger.js.map +0 -1
- package/dist/debugger-examples-types.d.ts.map +0 -1
- package/dist/debugger-examples-types.js.map +0 -1
- package/dist/debugger-examples.d.ts.map +0 -1
- package/dist/debugger-examples.js.map +0 -1
- package/dist/debugger.d.ts.map +0 -1
- package/dist/debugger.js.map +0 -1
- package/dist/diff-utils.d.ts.map +0 -1
- package/dist/diff-utils.js.map +0 -1
- package/dist/diff-utils.test.d.ts +0 -2
- package/dist/diff-utils.test.d.ts.map +0 -1
- package/dist/diff-utils.test.js +0 -137
- package/dist/diff-utils.test.js.map +0 -1
- package/dist/doctor.d.ts.map +0 -1
- package/dist/doctor.js.map +0 -1
- package/dist/doctor.test.d.ts +0 -2
- package/dist/doctor.test.d.ts.map +0 -1
- package/dist/doctor.test.js +0 -208
- package/dist/doctor.test.js.map +0 -1
- package/dist/editor-examples.d.ts.map +0 -1
- package/dist/editor-examples.js.map +0 -1
- package/dist/editor.d.ts.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/env-compat.d.ts.map +0 -1
- package/dist/env-compat.js.map +0 -1
- package/dist/executor.d.ts.map +0 -1
- package/dist/executor.js.map +0 -1
- package/dist/executor.unit.test.d.ts +0 -2
- package/dist/executor.unit.test.d.ts.map +0 -1
- package/dist/executor.unit.test.js +0 -143
- package/dist/executor.unit.test.js.map +0 -1
- package/dist/extension-connection.test.d.ts +0 -2
- package/dist/extension-connection.test.d.ts.map +0 -1
- package/dist/extension-connection.test.js +0 -708
- package/dist/extension-connection.test.js.map +0 -1
- package/dist/extension-icon-warning.test.d.ts +0 -2
- package/dist/extension-icon-warning.test.d.ts.map +0 -1
- package/dist/extension-icon-warning.test.js +0 -33
- package/dist/extension-icon-warning.test.js.map +0 -1
- package/dist/ghost-browser.d.ts.map +0 -1
- package/dist/ghost-browser.js.map +0 -1
- package/dist/ghost-cursor-controller.d.ts.map +0 -1
- package/dist/ghost-cursor-controller.js.map +0 -1
- package/dist/ghost-cursor.d.ts.map +0 -1
- package/dist/ghost-cursor.js.map +0 -1
- package/dist/htmlrewrite.d.ts.map +0 -1
- package/dist/htmlrewrite.js.map +0 -1
- package/dist/htmlrewrite.test.d.ts +0 -2
- package/dist/htmlrewrite.test.d.ts.map +0 -1
- package/dist/htmlrewrite.test.js +0 -7975
- package/dist/htmlrewrite.test.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kill-port.d.ts.map +0 -1
- package/dist/kill-port.js.map +0 -1
- package/dist/kitty-graphics.d.ts.map +0 -1
- package/dist/kitty-graphics.js.map +0 -1
- package/dist/kitty-graphics.test.d.ts +0 -2
- package/dist/kitty-graphics.test.d.ts.map +0 -1
- package/dist/kitty-graphics.test.js +0 -125
- package/dist/kitty-graphics.test.js.map +0 -1
- package/dist/locator-selector.test.d.ts +0 -2
- package/dist/locator-selector.test.d.ts.map +0 -1
- package/dist/locator-selector.test.js +0 -98
- package/dist/locator-selector.test.js.map +0 -1
- package/dist/mcp-client.d.ts +0 -20
- package/dist/mcp-client.d.ts.map +0 -1
- package/dist/mcp-client.js +0 -56
- package/dist/mcp-client.js.map +0 -1
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js.map +0 -1
- package/dist/on-mouse-action.test.d.ts +0 -2
- package/dist/on-mouse-action.test.d.ts.map +0 -1
- package/dist/on-mouse-action.test.js +0 -180
- package/dist/on-mouse-action.test.js.map +0 -1
- package/dist/options-page.test.d.ts +0 -2
- package/dist/options-page.test.d.ts.map +0 -1
- package/dist/options-page.test.js +0 -773
- package/dist/options-page.test.js.map +0 -1
- package/dist/package-paths.d.ts.map +0 -1
- package/dist/package-paths.js.map +0 -1
- package/dist/page-markdown.d.ts.map +0 -1
- package/dist/page-markdown.js.map +0 -1
- package/dist/performance-examples.d.ts.map +0 -1
- package/dist/performance-examples.js.map +0 -1
- package/dist/playwright-import.d.ts.map +0 -1
- package/dist/playwright-import.js.map +0 -1
- package/dist/popup-relocation.test.d.ts +0 -7
- package/dist/popup-relocation.test.d.ts.map +0 -1
- package/dist/popup-relocation.test.js +0 -139
- package/dist/popup-relocation.test.js.map +0 -1
- package/dist/product-paths.d.ts.map +0 -1
- package/dist/product-paths.js.map +0 -1
- package/dist/product-paths.test.d.ts +0 -2
- package/dist/product-paths.test.d.ts.map +0 -1
- package/dist/product-paths.test.js +0 -39
- package/dist/product-paths.test.js.map +0 -1
- package/dist/protocol.d.ts.map +0 -1
- package/dist/protocol.js.map +0 -1
- package/dist/protocol.test.d.ts +0 -2
- package/dist/protocol.test.d.ts.map +0 -1
- package/dist/protocol.test.js +0 -31
- package/dist/protocol.test.js.map +0 -1
- package/dist/react-source.d.ts.map +0 -1
- package/dist/react-source.js.map +0 -1
- package/dist/relay-client.d.ts.map +0 -1
- package/dist/relay-client.js.map +0 -1
- package/dist/relay-client.test.d.ts +0 -2
- package/dist/relay-client.test.d.ts.map +0 -1
- package/dist/relay-client.test.js +0 -305
- package/dist/relay-client.test.js.map +0 -1
- package/dist/relay-core.test.d.ts +0 -2
- package/dist/relay-core.test.d.ts.map +0 -1
- package/dist/relay-core.test.js +0 -1427
- package/dist/relay-core.test.js.map +0 -1
- package/dist/relay-navigation.test.d.ts +0 -2
- package/dist/relay-navigation.test.d.ts.map +0 -1
- package/dist/relay-navigation.test.js +0 -661
- package/dist/relay-navigation.test.js.map +0 -1
- package/dist/relay-session.test.d.ts +0 -2
- package/dist/relay-session.test.d.ts.map +0 -1
- package/dist/relay-session.test.js +0 -1121
- package/dist/relay-session.test.js.map +0 -1
- package/dist/relay-state.d.ts.map +0 -1
- package/dist/relay-state.js.map +0 -1
- package/dist/relay-state.test.d.ts +0 -2
- package/dist/relay-state.test.d.ts.map +0 -1
- package/dist/relay-state.test.js +0 -594
- package/dist/relay-state.test.js.map +0 -1
- package/dist/replay-ai-index.d.ts.map +0 -1
- package/dist/replay-ai-index.js.map +0 -1
- package/dist/replay-ai-index.test.d.ts +0 -2
- package/dist/replay-ai-index.test.d.ts.map +0 -1
- package/dist/replay-ai-index.test.js +0 -255
- package/dist/replay-ai-index.test.js.map +0 -1
- package/dist/replay-cli.test.d.ts +0 -2
- package/dist/replay-cli.test.d.ts.map +0 -1
- package/dist/replay-cli.test.js +0 -275
- package/dist/replay-cli.test.js.map +0 -1
- package/dist/replay-eval.d.ts.map +0 -1
- package/dist/replay-eval.js.map +0 -1
- package/dist/replay-handoff.d.ts.map +0 -1
- package/dist/replay-handoff.js.map +0 -1
- package/dist/replay-handoff.test.d.ts +0 -2
- package/dist/replay-handoff.test.d.ts.map +0 -1
- package/dist/replay-handoff.test.js +0 -123
- package/dist/replay-handoff.test.js.map +0 -1
- package/dist/replay-workflow-compiler.d.ts.map +0 -1
- package/dist/replay-workflow-compiler.js.map +0 -1
- package/dist/replay-workflow-compiler.test.d.ts +0 -2
- package/dist/replay-workflow-compiler.test.d.ts.map +0 -1
- package/dist/replay-workflow-compiler.test.js +0 -223
- package/dist/replay-workflow-compiler.test.js.map +0 -1
- package/dist/rrweb-recording-relay.d.ts.map +0 -1
- package/dist/rrweb-recording-relay.js.map +0 -1
- package/dist/rrweb-recording-relay.test.d.ts +0 -2
- package/dist/rrweb-recording-relay.test.d.ts.map +0 -1
- package/dist/rrweb-recording-relay.test.js +0 -85
- package/dist/rrweb-recording-relay.test.js.map +0 -1
- package/dist/rrweb-recording.d.ts.map +0 -1
- package/dist/rrweb-recording.js.map +0 -1
- package/dist/scoped-fs.d.ts.map +0 -1
- package/dist/scoped-fs.js.map +0 -1
- package/dist/scoped-fs.test.d.ts +0 -5
- package/dist/scoped-fs.test.d.ts.map +0 -1
- package/dist/scoped-fs.test.js +0 -73
- package/dist/scoped-fs.test.js.map +0 -1
- package/dist/skill-stub.test.d.ts +0 -2
- package/dist/skill-stub.test.d.ts.map +0 -1
- package/dist/skill-stub.test.js +0 -22
- package/dist/skill-stub.test.js.map +0 -1
- package/dist/snapshot-tools.test.d.ts +0 -2
- package/dist/snapshot-tools.test.d.ts.map +0 -1
- package/dist/snapshot-tools.test.js +0 -856
- package/dist/snapshot-tools.test.js.map +0 -1
- package/dist/start-relay-server.d.ts.map +0 -1
- package/dist/start-relay-server.js.map +0 -1
- package/dist/styles-examples.d.ts.map +0 -1
- package/dist/styles-examples.js.map +0 -1
- package/dist/styles.d.ts.map +0 -1
- package/dist/styles.js.map +0 -1
- package/dist/tabwright-agent-skill.d.ts.map +0 -1
- package/dist/tabwright-agent-skill.js.map +0 -1
- package/dist/tabwright-agent-skill.test.d.ts +0 -2
- package/dist/tabwright-agent-skill.test.d.ts.map +0 -1
- package/dist/tabwright-agent-skill.test.js +0 -51
- package/dist/tabwright-agent-skill.test.js.map +0 -1
- package/dist/test-declarations.d.ts.map +0 -1
- package/dist/test-declarations.js.map +0 -1
- package/dist/test-utils.d.ts +0 -69
- package/dist/test-utils.d.ts.map +0 -1
- package/dist/test-utils.js +0 -448
- package/dist/test-utils.js.map +0 -1
- package/dist/test-utils.test.d.ts +0 -2
- package/dist/test-utils.test.d.ts.map +0 -1
- package/dist/test-utils.test.js +0 -55
- package/dist/test-utils.test.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
- package/dist/wait-for-page-load.d.ts.map +0 -1
- package/dist/wait-for-page-load.js.map +0 -1
- package/dist/workflow-capability.d.ts.map +0 -1
- package/dist/workflow-capability.js.map +0 -1
- package/dist/workflow-script-flow.test.d.ts +0 -2
- package/dist/workflow-script-flow.test.d.ts.map +0 -1
- package/dist/workflow-script-flow.test.js +0 -285
- package/dist/workflow-script-flow.test.js.map +0 -1
- package/src/__snapshots__/x.com.processed.html +0 -1003
- package/src/__snapshots__/x.com.processed.withStyles.html +0 -2720
- package/src/a11y-client.ts +0 -241
- package/src/aria-snapshot.test.ts +0 -311
- package/src/aria-snapshot.ts +0 -1681
- package/src/aria-snapshot.unit.test.ts +0 -615
- package/src/aria-snapshots/github-interactive.txt +0 -193
- package/src/aria-snapshots/github-raw.txt +0 -309
- package/src/aria-snapshots/hackernews-interactive.txt +0 -477
- package/src/aria-snapshots/hackernews-raw.txt +0 -428
- package/src/aria-snapshots/prosemirror-interactive.txt +0 -66
- package/src/aria-snapshots/prosemirror-raw.txt +0 -145
- package/src/assets/aria-labels-hacker-news.png +0 -0
- package/src/assets/aria-labels-old-reddit.png +0 -0
- package/src/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.ts +0 -5
- package/src/assets/cursors/screen-studio/pointer-macos-tahoe.svg +0 -18
- package/src/assets/x.com.html +0 -32946
- package/src/browser-config.ts +0 -179
- package/src/browser-install.ts +0 -284
- package/src/browser-launch.ts +0 -75
- package/src/builtin-capabilities.ts +0 -2765
- package/src/capability-agent-skill.ts +0 -305
- package/src/capability-auth-state.ts +0 -197
- package/src/capability-auth.ts +0 -249
- package/src/capability-cli-confirmation.test.ts +0 -90
- package/src/capability-options.test.ts +0 -89
- package/src/capability-options.ts +0 -57
- package/src/capability-package.test.ts +0 -204
- package/src/capability-package.ts +0 -555
- package/src/capability-registry.test.ts +0 -1905
- package/src/capability-registry.ts +0 -1234
- package/src/capability-runner.ts +0 -801
- package/src/capability-search-relevance.test.ts +0 -73
- package/src/capability-studio.test.ts +0 -45
- package/src/capability-studio.ts +0 -641
- package/src/cdp-log.test.ts +0 -131
- package/src/cdp-log.ts +0 -112
- package/src/cdp-relay.ts +0 -2944
- package/src/cdp-session.ts +0 -77
- package/src/cdp-types.ts +0 -158
- package/src/channel-owner-inspect.test.ts +0 -94
- package/src/chrome-discovery.test.ts +0 -50
- package/src/chrome-discovery.ts +0 -220
- package/src/clean-html.ts +0 -141
- package/src/cli-help.test.ts +0 -123
- package/src/cli.ts +0 -3181
- package/src/cloud-client.ts +0 -179
- package/src/create-logger.ts +0 -38
- package/src/debugger-examples-types.ts +0 -16
- package/src/debugger-examples.ts +0 -66
- package/src/debugger.ts +0 -708
- package/src/diff-utils.test.ts +0 -152
- package/src/diff-utils.ts +0 -70
- package/src/doctor.test.ts +0 -244
- package/src/doctor.ts +0 -321
- package/src/editor-examples.ts +0 -158
- package/src/editor.ts +0 -426
- package/src/env-compat.ts +0 -28
- package/src/executor.ts +0 -1824
- package/src/executor.unit.test.ts +0 -168
- package/src/extension-connection.test.ts +0 -855
- package/src/extension-icon-warning.test.ts +0 -45
- package/src/ghost-browser.ts +0 -149
- package/src/ghost-cursor-client.ts +0 -494
- package/src/ghost-cursor-controller.ts +0 -129
- package/src/ghost-cursor.ts +0 -123
- package/src/htmlrewrite.test.ts +0 -8008
- package/src/htmlrewrite.ts +0 -390
- package/src/index.ts +0 -53
- package/src/kill-port.ts +0 -219
- package/src/kitty-graphics.test.ts +0 -139
- package/src/kitty-graphics.ts +0 -79
- package/src/locator-selector.test.ts +0 -119
- package/src/mcp-client.ts +0 -78
- package/src/mcp.ts +0 -629
- package/src/on-mouse-action.test.ts +0 -226
- package/src/options-page.test.ts +0 -839
- package/src/package-paths.ts +0 -38
- package/src/page-markdown.ts +0 -240
- package/src/performance-examples.ts +0 -186
- package/src/playwright-import.ts +0 -59
- package/src/popup-relocation.test.ts +0 -163
- package/src/product-paths.test.ts +0 -47
- package/src/product-paths.ts +0 -28
- package/src/protocol.test.ts +0 -52
- package/src/protocol.ts +0 -351
- package/src/react-source.ts +0 -379
- package/src/relay-client.test.ts +0 -375
- package/src/relay-client.ts +0 -572
- package/src/relay-core.test.ts +0 -1603
- package/src/relay-navigation.test.ts +0 -790
- package/src/relay-session.test.ts +0 -1375
- package/src/relay-state.test.ts +0 -729
- package/src/relay-state.ts +0 -561
- package/src/replay-ai-index.test.ts +0 -278
- package/src/replay-ai-index.ts +0 -872
- package/src/replay-cli.test.ts +0 -325
- package/src/replay-eval.ts +0 -1039
- package/src/replay-handoff.test.ts +0 -163
- package/src/replay-handoff.ts +0 -109
- package/src/replay-workflow-compiler.test.ts +0 -250
- package/src/replay-workflow-compiler.ts +0 -700
- package/src/resource.md +0 -409
- package/src/rrweb-recording-relay.test.ts +0 -99
- package/src/rrweb-recording-relay.ts +0 -400
- package/src/rrweb-recording.ts +0 -322
- package/src/scoped-fs.test.ts +0 -80
- package/src/scoped-fs.ts +0 -420
- package/src/skill-stub.test.ts +0 -24
- package/src/snapshot-tools.test.ts +0 -1017
- package/src/snapshots/hacker-news-accessibility-full.md +0 -81
- package/src/snapshots/hacker-news-accessibility-interactive.md +0 -43
- package/src/snapshots/page-markdown-output.txt +0 -16
- package/src/snapshots/shadcn-ui-accessibility-full.md +0 -201
- package/src/snapshots/shadcn-ui-accessibility-interactive.md +0 -109
- package/src/start-relay-server.ts +0 -69
- package/src/styles-examples.ts +0 -84
- package/src/styles.ts +0 -343
- package/src/tabwright-agent-skill.test.ts +0 -61
- package/src/tabwright-agent-skill.ts +0 -105
- package/src/test-declarations.ts +0 -13
- package/src/test-utils.test.ts +0 -70
- package/src/test-utils.ts +0 -566
- package/src/utils.ts +0 -78
- package/src/wait-for-page-load.ts +0 -198
- package/src/workflow-capability.ts +0 -417
- package/src/workflow-script-flow.test.ts +0 -388
|
@@ -1,555 +0,0 @@
|
|
|
1
|
-
import crypto from 'node:crypto'
|
|
2
|
-
import fs from 'node:fs'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import { Readable } from 'node:stream'
|
|
5
|
-
import { pipeline } from 'node:stream/promises'
|
|
6
|
-
import zlib from 'node:zlib'
|
|
7
|
-
import * as tar from 'tar-stream'
|
|
8
|
-
import { z } from 'zod'
|
|
9
|
-
import {
|
|
10
|
-
getCapabilityDir,
|
|
11
|
-
parseCapabilityManifest,
|
|
12
|
-
readCapability,
|
|
13
|
-
requireCapability,
|
|
14
|
-
type CapabilityLocation,
|
|
15
|
-
type CapabilityManifest,
|
|
16
|
-
type CapabilityRecord,
|
|
17
|
-
} from './capability-registry.js'
|
|
18
|
-
import { removeCapabilityAuthFiles } from './capability-auth-state.js'
|
|
19
|
-
|
|
20
|
-
const PACKAGE_METADATA_PATH = 'tabwright-package.json'
|
|
21
|
-
const LEGACY_PACKAGE_METADATA_PATH = 'playwriter-package.json'
|
|
22
|
-
const PACKAGE_ROOT = 'package'
|
|
23
|
-
const MAX_ARCHIVE_BYTES = 10 * 1024 * 1024
|
|
24
|
-
const MAX_EXTRACTED_BYTES = 20 * 1024 * 1024
|
|
25
|
-
const MAX_PACKAGE_FILES = 100
|
|
26
|
-
|
|
27
|
-
const CapabilityPackageMetadataSchema = z.object({
|
|
28
|
-
schemaVersion: z.literal(1),
|
|
29
|
-
capabilityId: z.string(),
|
|
30
|
-
packedAt: z.string(),
|
|
31
|
-
files: z.array(
|
|
32
|
-
z.object({
|
|
33
|
-
path: z.string(),
|
|
34
|
-
sha256: z.string(),
|
|
35
|
-
}),
|
|
36
|
-
),
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
interface CapabilityPackageFile {
|
|
40
|
-
path: string
|
|
41
|
-
content: Buffer
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface PackedCapability {
|
|
45
|
-
capabilityId: string
|
|
46
|
-
path: string
|
|
47
|
-
files: string[]
|
|
48
|
-
integrity: string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface InstalledCapabilityPackage {
|
|
52
|
-
source: string
|
|
53
|
-
capability: CapabilityRecord
|
|
54
|
-
files: string[]
|
|
55
|
-
integrity: string
|
|
56
|
-
agentSkillAvailable: boolean
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export async function packCapability(options: {
|
|
60
|
-
id: string
|
|
61
|
-
cwd?: string
|
|
62
|
-
output?: string
|
|
63
|
-
overwrite?: boolean
|
|
64
|
-
}): Promise<PackedCapability> {
|
|
65
|
-
const capability = requireCapability({ id: options.id, cwd: options.cwd })
|
|
66
|
-
const files = readCapabilityPackageFiles({
|
|
67
|
-
sourceDir: capability.dir,
|
|
68
|
-
manifest: {
|
|
69
|
-
...capability.manifest,
|
|
70
|
-
status: 'draft',
|
|
71
|
-
},
|
|
72
|
-
})
|
|
73
|
-
const metadata = buildPackageMetadata({ capabilityId: capability.manifest.id, files })
|
|
74
|
-
const archiveFiles: CapabilityPackageFile[] = [
|
|
75
|
-
...files,
|
|
76
|
-
{
|
|
77
|
-
path: PACKAGE_METADATA_PATH,
|
|
78
|
-
content: Buffer.from(`${JSON.stringify(metadata, null, 2)}\n`),
|
|
79
|
-
},
|
|
80
|
-
]
|
|
81
|
-
const outputPath = path.resolve(options.cwd || process.cwd(), options.output || `${capability.manifest.id}.tgz`)
|
|
82
|
-
if (fs.existsSync(outputPath) && !options.overwrite) {
|
|
83
|
-
throw new Error(`Capability package already exists: ${outputPath}. Use --force to overwrite it.`)
|
|
84
|
-
}
|
|
85
|
-
fs.mkdirSync(path.dirname(outputPath), { recursive: true })
|
|
86
|
-
const temporaryPath = `${outputPath}.partial-${process.pid}`
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
await writeArchive({ outputPath: temporaryPath, files: archiveFiles })
|
|
90
|
-
if (options.overwrite) {
|
|
91
|
-
fs.rmSync(outputPath, { force: true })
|
|
92
|
-
}
|
|
93
|
-
fs.renameSync(temporaryPath, outputPath)
|
|
94
|
-
} catch (error) {
|
|
95
|
-
if (fs.existsSync(temporaryPath)) {
|
|
96
|
-
fs.rmSync(temporaryPath, { force: true })
|
|
97
|
-
}
|
|
98
|
-
throw new Error(`Failed to pack capability ${capability.manifest.id}`, { cause: error })
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
capabilityId: capability.manifest.id,
|
|
103
|
-
path: outputPath,
|
|
104
|
-
files: files.map((file) => {
|
|
105
|
-
return file.path
|
|
106
|
-
}),
|
|
107
|
-
integrity: fileIntegrity(outputPath),
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export async function installCapabilityPackage(options: {
|
|
112
|
-
source: string
|
|
113
|
-
cwd?: string
|
|
114
|
-
location?: CapabilityLocation
|
|
115
|
-
overwrite?: boolean
|
|
116
|
-
}): Promise<InstalledCapabilityPackage> {
|
|
117
|
-
const cwd = options.cwd || process.cwd()
|
|
118
|
-
const source = await readPackageSource({ source: options.source, cwd })
|
|
119
|
-
const manifestFile = requirePackageFile({ files: source.files, filePath: 'capability.json' })
|
|
120
|
-
const manifest = parsePackageManifest(manifestFile.content)
|
|
121
|
-
validatePackageMetadata({ files: source.files, metadataFile: source.metadataFile, manifest })
|
|
122
|
-
const files = normalizeInstallFiles({ files: source.files, manifest })
|
|
123
|
-
|
|
124
|
-
const location = options.location || 'user'
|
|
125
|
-
const capabilityDir = getCapabilityDir({ id: manifest.id, location, cwd })
|
|
126
|
-
if (fs.existsSync(capabilityDir) && !options.overwrite) {
|
|
127
|
-
throw new Error(`Capability already exists: ${manifest.id}. Use --force to overwrite package files.`)
|
|
128
|
-
}
|
|
129
|
-
if (options.overwrite) {
|
|
130
|
-
fs.rmSync(path.join(capabilityDir, 'agent-skills'), { recursive: true, force: true })
|
|
131
|
-
removeCapabilityAuthFiles({ capabilityDir })
|
|
132
|
-
}
|
|
133
|
-
fs.mkdirSync(capabilityDir, { recursive: true })
|
|
134
|
-
files.map((file) => {
|
|
135
|
-
const destination = resolvePackageDestination({ capabilityDir, filePath: file.path })
|
|
136
|
-
fs.mkdirSync(path.dirname(destination), { recursive: true })
|
|
137
|
-
fs.writeFileSync(destination, file.content)
|
|
138
|
-
return destination
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
const capability = readCapability({ dir: capabilityDir, location })
|
|
142
|
-
return {
|
|
143
|
-
source: source.label,
|
|
144
|
-
capability,
|
|
145
|
-
files: files.map((file) => {
|
|
146
|
-
return file.path
|
|
147
|
-
}),
|
|
148
|
-
integrity: source.integrity,
|
|
149
|
-
agentSkillAvailable: fs.existsSync(path.join(capabilityDir, 'agent-skills', 'codex', 'SKILL.md')),
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function readCapabilityPackageFiles(options: {
|
|
154
|
-
sourceDir: string
|
|
155
|
-
manifest: CapabilityManifest
|
|
156
|
-
}): CapabilityPackageFile[] {
|
|
157
|
-
const entryPath = normalizeRelativePath(options.manifest.entry)
|
|
158
|
-
const requiredPaths = ['capability.json', entryPath]
|
|
159
|
-
const missing = requiredPaths.filter((filePath) => {
|
|
160
|
-
return !fs.existsSync(path.join(options.sourceDir, ...filePath.split('/')))
|
|
161
|
-
})
|
|
162
|
-
if (missing.length > 0) {
|
|
163
|
-
throw new Error(`Capability package is missing required files: ${missing.join(', ')}`)
|
|
164
|
-
}
|
|
165
|
-
const optionalPaths = ['README.md'].filter((filePath) => {
|
|
166
|
-
return fs.existsSync(path.join(options.sourceDir, filePath))
|
|
167
|
-
})
|
|
168
|
-
const agentSkillDir = path.join(options.sourceDir, 'agent-skills')
|
|
169
|
-
const agentSkillPaths = fs.existsSync(agentSkillDir)
|
|
170
|
-
? listRegularFiles({ dir: agentSkillDir }).map((filePath) => {
|
|
171
|
-
return path.posix.join('agent-skills', filePath)
|
|
172
|
-
})
|
|
173
|
-
: []
|
|
174
|
-
const packagePaths = [...new Set([...requiredPaths, ...optionalPaths, ...agentSkillPaths])].sort()
|
|
175
|
-
assertPackageLimits({ paths: packagePaths })
|
|
176
|
-
|
|
177
|
-
const files = packagePaths.map((filePath) => {
|
|
178
|
-
if (filePath === 'capability.json') {
|
|
179
|
-
return {
|
|
180
|
-
path: filePath,
|
|
181
|
-
content: Buffer.from(`${JSON.stringify(options.manifest, null, 2)}\n`),
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
const sourcePath = resolvePackageDestination({ capabilityDir: options.sourceDir, filePath })
|
|
185
|
-
const sourceStat = fs.lstatSync(sourcePath)
|
|
186
|
-
if (!sourceStat.isFile() || sourceStat.isSymbolicLink()) {
|
|
187
|
-
throw new Error(`Capability packages can only contain regular files: ${filePath}`)
|
|
188
|
-
}
|
|
189
|
-
return { path: filePath, content: fs.readFileSync(sourcePath) }
|
|
190
|
-
})
|
|
191
|
-
assertExtractedSize(files)
|
|
192
|
-
return files
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function listRegularFiles(options: { dir: string; prefix?: string }): string[] {
|
|
196
|
-
return fs.readdirSync(options.dir, { withFileTypes: true }).flatMap((entry) => {
|
|
197
|
-
const relativePath = path.posix.join(options.prefix || '', entry.name)
|
|
198
|
-
const absolutePath = path.join(options.dir, entry.name)
|
|
199
|
-
if (entry.isSymbolicLink()) {
|
|
200
|
-
throw new Error(`Capability packages cannot contain symbolic links: ${relativePath}`)
|
|
201
|
-
}
|
|
202
|
-
if (entry.isDirectory()) {
|
|
203
|
-
return listRegularFiles({ dir: absolutePath, prefix: relativePath })
|
|
204
|
-
}
|
|
205
|
-
if (!entry.isFile()) {
|
|
206
|
-
throw new Error(`Capability packages can only contain regular files: ${relativePath}`)
|
|
207
|
-
}
|
|
208
|
-
return [relativePath]
|
|
209
|
-
})
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function buildPackageMetadata(options: {
|
|
213
|
-
capabilityId: string
|
|
214
|
-
files: CapabilityPackageFile[]
|
|
215
|
-
}): z.infer<typeof CapabilityPackageMetadataSchema> {
|
|
216
|
-
return {
|
|
217
|
-
schemaVersion: 1,
|
|
218
|
-
capabilityId: options.capabilityId,
|
|
219
|
-
packedAt: new Date().toISOString(),
|
|
220
|
-
files: options.files.map((file) => {
|
|
221
|
-
return { path: file.path, sha256: bufferSha256(file.content) }
|
|
222
|
-
}),
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
async function writeArchive(options: { outputPath: string; files: CapabilityPackageFile[] }): Promise<void> {
|
|
227
|
-
const archive = tar.pack()
|
|
228
|
-
const output = pipeline(archive, zlib.createGzip({ level: 9 }), fs.createWriteStream(options.outputPath))
|
|
229
|
-
await Promise.all(
|
|
230
|
-
options.files.map((file) => {
|
|
231
|
-
return new Promise<void>((resolve, reject) => {
|
|
232
|
-
archive.entry(
|
|
233
|
-
{
|
|
234
|
-
name: path.posix.join(PACKAGE_ROOT, file.path),
|
|
235
|
-
size: file.content.length,
|
|
236
|
-
mode: 0o644,
|
|
237
|
-
mtime: new Date(0),
|
|
238
|
-
type: 'file',
|
|
239
|
-
},
|
|
240
|
-
file.content,
|
|
241
|
-
(error) => {
|
|
242
|
-
if (error) {
|
|
243
|
-
reject(error)
|
|
244
|
-
return
|
|
245
|
-
}
|
|
246
|
-
resolve()
|
|
247
|
-
},
|
|
248
|
-
)
|
|
249
|
-
})
|
|
250
|
-
}),
|
|
251
|
-
)
|
|
252
|
-
archive.finalize()
|
|
253
|
-
await output
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
async function readPackageSource(options: {
|
|
257
|
-
source: string
|
|
258
|
-
cwd: string
|
|
259
|
-
}): Promise<{
|
|
260
|
-
label: string
|
|
261
|
-
files: CapabilityPackageFile[]
|
|
262
|
-
metadataFile?: CapabilityPackageFile
|
|
263
|
-
integrity: string
|
|
264
|
-
}> {
|
|
265
|
-
const localPath = path.resolve(options.cwd, options.source)
|
|
266
|
-
if (fs.existsSync(localPath)) {
|
|
267
|
-
if (fs.statSync(localPath).isDirectory()) {
|
|
268
|
-
const manifestPath = path.join(localPath, 'capability.json')
|
|
269
|
-
if (!fs.existsSync(manifestPath)) {
|
|
270
|
-
throw new Error(`Capability directory is missing capability.json: ${localPath}`)
|
|
271
|
-
}
|
|
272
|
-
const manifest = parsePackageManifest(fs.readFileSync(manifestPath))
|
|
273
|
-
const files = readCapabilityPackageFiles({ sourceDir: localPath, manifest: { ...manifest, status: 'draft' } })
|
|
274
|
-
return {
|
|
275
|
-
label: localPath,
|
|
276
|
-
files,
|
|
277
|
-
integrity: filesIntegrity(files),
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
const archive = fs.readFileSync(localPath)
|
|
281
|
-
assertArchiveSize({ size: archive.length, label: localPath })
|
|
282
|
-
const extracted = await readArchive(archive)
|
|
283
|
-
return {
|
|
284
|
-
label: localPath,
|
|
285
|
-
files: extracted.files,
|
|
286
|
-
metadataFile: extracted.metadataFile,
|
|
287
|
-
integrity: bufferIntegrity(archive),
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (!/^https?:\/\//.test(options.source)) {
|
|
292
|
-
throw new Error(`Capability source not found: ${options.source}`)
|
|
293
|
-
}
|
|
294
|
-
const response = await fetch(options.source, { redirect: 'follow' })
|
|
295
|
-
if (!response.ok) {
|
|
296
|
-
throw new Error(`Failed to download capability package: ${response.status} ${response.statusText}`)
|
|
297
|
-
}
|
|
298
|
-
const contentLength = Number(response.headers.get('content-length') || 0)
|
|
299
|
-
assertArchiveSize({ size: contentLength, label: options.source })
|
|
300
|
-
const archive = Buffer.from(await response.arrayBuffer())
|
|
301
|
-
assertArchiveSize({ size: archive.length, label: options.source })
|
|
302
|
-
const extracted = await readArchive(archive)
|
|
303
|
-
return {
|
|
304
|
-
label: options.source,
|
|
305
|
-
files: extracted.files,
|
|
306
|
-
metadataFile: extracted.metadataFile,
|
|
307
|
-
integrity: bufferIntegrity(archive),
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
async function readArchive(archive: Buffer): Promise<{
|
|
312
|
-
files: CapabilityPackageFile[]
|
|
313
|
-
metadataFile: CapabilityPackageFile
|
|
314
|
-
}> {
|
|
315
|
-
const extracted = await extractArchiveFiles(archive)
|
|
316
|
-
const metadataFile =
|
|
317
|
-
extracted.find((file) => {
|
|
318
|
-
return file.path === PACKAGE_METADATA_PATH
|
|
319
|
-
}) || requirePackageFile({ files: extracted, filePath: LEGACY_PACKAGE_METADATA_PATH })
|
|
320
|
-
const files = extracted.filter((file) => {
|
|
321
|
-
return file.path !== PACKAGE_METADATA_PATH && file.path !== LEGACY_PACKAGE_METADATA_PATH
|
|
322
|
-
})
|
|
323
|
-
return { files, metadataFile }
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
async function extractArchiveFiles(archive: Buffer): Promise<CapabilityPackageFile[]> {
|
|
327
|
-
const extractor = tar.extract()
|
|
328
|
-
const files: CapabilityPackageFile[] = []
|
|
329
|
-
let totalBytes = 0
|
|
330
|
-
const extraction = new Promise<void>((resolve, reject) => {
|
|
331
|
-
extractor.on('entry', (header, stream, next) => {
|
|
332
|
-
const relativePath = normalizeArchiveEntryPath(header.name)
|
|
333
|
-
if (header.type === 'directory') {
|
|
334
|
-
stream.resume()
|
|
335
|
-
next()
|
|
336
|
-
return
|
|
337
|
-
}
|
|
338
|
-
if (header.type !== 'file' && header.type !== null && header.type !== undefined) {
|
|
339
|
-
stream.resume()
|
|
340
|
-
next(new Error(`Capability archives cannot contain ${header.type} entries: ${header.name}`))
|
|
341
|
-
return
|
|
342
|
-
}
|
|
343
|
-
readStreamWithLimit({ stream, limit: MAX_EXTRACTED_BYTES })
|
|
344
|
-
.then((content) => {
|
|
345
|
-
if (files.some((file) => file.path === relativePath)) {
|
|
346
|
-
next(new Error(`Capability package contains duplicate path: ${relativePath}`))
|
|
347
|
-
return
|
|
348
|
-
}
|
|
349
|
-
totalBytes += content.length
|
|
350
|
-
if (totalBytes > MAX_EXTRACTED_BYTES) {
|
|
351
|
-
next(new Error(`Capability package expands beyond ${MAX_EXTRACTED_BYTES} bytes`))
|
|
352
|
-
return
|
|
353
|
-
}
|
|
354
|
-
files.push({ path: relativePath, content })
|
|
355
|
-
if (files.length > MAX_PACKAGE_FILES) {
|
|
356
|
-
next(new Error(`Capability package exceeds ${MAX_PACKAGE_FILES} files`))
|
|
357
|
-
return
|
|
358
|
-
}
|
|
359
|
-
next()
|
|
360
|
-
})
|
|
361
|
-
.catch((error: unknown) => {
|
|
362
|
-
next(error)
|
|
363
|
-
})
|
|
364
|
-
})
|
|
365
|
-
extractor.on('finish', resolve)
|
|
366
|
-
extractor.on('error', reject)
|
|
367
|
-
})
|
|
368
|
-
await pipeline(Readable.from(archive), zlib.createGunzip(), extractor)
|
|
369
|
-
await extraction
|
|
370
|
-
assertExtractedSize(files, totalBytes)
|
|
371
|
-
return files
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
async function readStreamWithLimit(options: { stream: Readable; limit: number }): Promise<Buffer> {
|
|
375
|
-
const chunks: Buffer[] = []
|
|
376
|
-
let size = 0
|
|
377
|
-
for await (const rawChunk of options.stream) {
|
|
378
|
-
const chunk = Buffer.isBuffer(rawChunk) ? rawChunk : Buffer.from(rawChunk)
|
|
379
|
-
size += chunk.length
|
|
380
|
-
if (size > options.limit) {
|
|
381
|
-
throw new Error(`Capability package entry exceeds ${options.limit} bytes`)
|
|
382
|
-
}
|
|
383
|
-
chunks.push(chunk)
|
|
384
|
-
}
|
|
385
|
-
return Buffer.concat(chunks)
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function parsePackageManifest(content: Buffer): CapabilityManifest {
|
|
389
|
-
const raw: unknown = (() => {
|
|
390
|
-
try {
|
|
391
|
-
return JSON.parse(content.toString('utf-8'))
|
|
392
|
-
} catch (error) {
|
|
393
|
-
throw new Error('Capability package has invalid capability.json', { cause: error })
|
|
394
|
-
}
|
|
395
|
-
})()
|
|
396
|
-
return parseCapabilityManifest({
|
|
397
|
-
...assertJsonObject(raw),
|
|
398
|
-
status: 'draft',
|
|
399
|
-
})
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function normalizeInstallFiles(options: {
|
|
403
|
-
files: CapabilityPackageFile[]
|
|
404
|
-
manifest: CapabilityManifest
|
|
405
|
-
}): CapabilityPackageFile[] {
|
|
406
|
-
const entryPath = normalizeRelativePath(options.manifest.entry)
|
|
407
|
-
const allowed = options.files.filter((file) => {
|
|
408
|
-
return (
|
|
409
|
-
file.path === 'capability.json' ||
|
|
410
|
-
file.path === entryPath ||
|
|
411
|
-
file.path === 'README.md' ||
|
|
412
|
-
file.path.startsWith('agent-skills/')
|
|
413
|
-
)
|
|
414
|
-
})
|
|
415
|
-
requirePackageFile({ files: allowed, filePath: entryPath })
|
|
416
|
-
const normalizedManifest = {
|
|
417
|
-
...options.manifest,
|
|
418
|
-
status: 'draft' as const,
|
|
419
|
-
updatedAt: new Date().toISOString(),
|
|
420
|
-
}
|
|
421
|
-
return allowed.map((file) => {
|
|
422
|
-
if (file.path !== 'capability.json') {
|
|
423
|
-
return file
|
|
424
|
-
}
|
|
425
|
-
return {
|
|
426
|
-
path: file.path,
|
|
427
|
-
content: Buffer.from(`${JSON.stringify(normalizedManifest, null, 2)}\n`),
|
|
428
|
-
}
|
|
429
|
-
})
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function validatePackageMetadata(options: {
|
|
433
|
-
files: CapabilityPackageFile[]
|
|
434
|
-
metadataFile?: CapabilityPackageFile
|
|
435
|
-
manifest: CapabilityManifest
|
|
436
|
-
}): void {
|
|
437
|
-
if (!options.metadataFile) {
|
|
438
|
-
return
|
|
439
|
-
}
|
|
440
|
-
const metadata = CapabilityPackageMetadataSchema.parse(JSON.parse(options.metadataFile.content.toString('utf-8')))
|
|
441
|
-
if (metadata.capabilityId !== options.manifest.id) {
|
|
442
|
-
throw new Error(`Capability package id mismatch: ${metadata.capabilityId} !== ${options.manifest.id}`)
|
|
443
|
-
}
|
|
444
|
-
const actualHashes = new Map(
|
|
445
|
-
options.files.map((file) => {
|
|
446
|
-
return [file.path, bufferSha256(file.content)]
|
|
447
|
-
}),
|
|
448
|
-
)
|
|
449
|
-
const mismatches = metadata.files.filter((file) => {
|
|
450
|
-
return actualHashes.get(file.path) !== file.sha256
|
|
451
|
-
})
|
|
452
|
-
if (mismatches.length > 0 || metadata.files.length !== options.files.length) {
|
|
453
|
-
const detail = mismatches.length > 0 ? mismatches.map((file) => file.path).join(', ') : 'file count mismatch'
|
|
454
|
-
throw new Error(`Capability package integrity check failed: ${detail}`)
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
function requirePackageFile(options: {
|
|
459
|
-
files: CapabilityPackageFile[]
|
|
460
|
-
filePath: string
|
|
461
|
-
}): CapabilityPackageFile {
|
|
462
|
-
const file = options.files.find((candidate) => {
|
|
463
|
-
return candidate.path === options.filePath
|
|
464
|
-
})
|
|
465
|
-
if (!file) {
|
|
466
|
-
throw new Error(`Capability package is missing ${options.filePath}`)
|
|
467
|
-
}
|
|
468
|
-
return file
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
function normalizeArchiveEntryPath(entryPath: string): string {
|
|
472
|
-
const normalized = normalizeRelativePath(entryPath)
|
|
473
|
-
if (!normalized.startsWith(`${PACKAGE_ROOT}/`)) {
|
|
474
|
-
throw new Error(`Capability archive entries must stay under ${PACKAGE_ROOT}/: ${entryPath}`)
|
|
475
|
-
}
|
|
476
|
-
return normalizeRelativePath(normalized.slice(PACKAGE_ROOT.length + 1))
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
function normalizeRelativePath(filePath: string): string {
|
|
480
|
-
const slashPath = filePath.replaceAll('\\', '/')
|
|
481
|
-
const normalized = path.posix.normalize(slashPath)
|
|
482
|
-
if (
|
|
483
|
-
normalized === '.' ||
|
|
484
|
-
normalized.startsWith('/') ||
|
|
485
|
-
normalized === '..' ||
|
|
486
|
-
normalized.startsWith('../') ||
|
|
487
|
-
normalized.includes('\0')
|
|
488
|
-
) {
|
|
489
|
-
throw new Error(`Capability package path must be relative and stay inside the package: ${filePath}`)
|
|
490
|
-
}
|
|
491
|
-
return normalized
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
function resolvePackageDestination(options: { capabilityDir: string; filePath: string }): string {
|
|
495
|
-
const normalized = normalizeRelativePath(options.filePath)
|
|
496
|
-
const root = path.resolve(options.capabilityDir)
|
|
497
|
-
const destination = path.resolve(root, ...normalized.split('/'))
|
|
498
|
-
if (destination !== root && !destination.startsWith(`${root}${path.sep}`)) {
|
|
499
|
-
throw new Error(`Capability package path escapes its destination: ${options.filePath}`)
|
|
500
|
-
}
|
|
501
|
-
return destination
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
function assertPackageLimits(options: { paths: string[] }): void {
|
|
505
|
-
if (options.paths.length > MAX_PACKAGE_FILES) {
|
|
506
|
-
throw new Error(`Capability package exceeds ${MAX_PACKAGE_FILES} files`)
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
function assertArchiveSize(options: { size: number; label: string }): void {
|
|
511
|
-
if (options.size > MAX_ARCHIVE_BYTES) {
|
|
512
|
-
throw new Error(`Capability package exceeds ${MAX_ARCHIVE_BYTES} bytes: ${options.label}`)
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
function assertExtractedSize(files: CapabilityPackageFile[], knownSize?: number): void {
|
|
517
|
-
const totalBytes =
|
|
518
|
-
knownSize ??
|
|
519
|
-
files.reduce((total, file) => {
|
|
520
|
-
return total + file.content.length
|
|
521
|
-
}, 0)
|
|
522
|
-
if (totalBytes > MAX_EXTRACTED_BYTES) {
|
|
523
|
-
throw new Error(`Capability package expands beyond ${MAX_EXTRACTED_BYTES} bytes`)
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function assertJsonObject(value: unknown): Record<string, unknown> {
|
|
528
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
529
|
-
throw new Error('Capability package manifest must be an object')
|
|
530
|
-
}
|
|
531
|
-
return value as Record<string, unknown>
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
function bufferSha256(content: Buffer): string {
|
|
535
|
-
return crypto.createHash('sha256').update(content).digest('hex')
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function bufferIntegrity(content: Buffer): string {
|
|
539
|
-
return `sha256-${crypto.createHash('sha256').update(content).digest('base64')}`
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
function fileIntegrity(filePath: string): string {
|
|
543
|
-
return bufferIntegrity(fs.readFileSync(filePath))
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
function filesIntegrity(files: CapabilityPackageFile[]): string {
|
|
547
|
-
const hash = crypto.createHash('sha256')
|
|
548
|
-
files.map((file) => {
|
|
549
|
-
hash.update(file.path)
|
|
550
|
-
hash.update('\0')
|
|
551
|
-
hash.update(file.content)
|
|
552
|
-
return file.path
|
|
553
|
-
})
|
|
554
|
-
return `sha256-${hash.digest('base64')}`
|
|
555
|
-
}
|