gsd-pi 2.78.0 → 2.78.1-dev.8a893322c
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/README.md +60 -23
- package/dist/bundled-resource-path.d.ts +7 -0
- package/dist/bundled-resource-path.js +34 -2
- package/dist/claude-cli-check.js +104 -33
- package/dist/cli-policy.d.ts +13 -0
- package/dist/cli-policy.js +17 -0
- package/dist/cli.js +95 -55
- package/dist/headless-query.d.ts +22 -0
- package/dist/headless-query.js +43 -8
- package/dist/headless.d.ts +10 -0
- package/dist/headless.js +16 -1
- package/dist/loader.js +9 -13
- package/dist/onboarding.d.ts +10 -0
- package/dist/onboarding.js +2 -2
- package/dist/provider-migrations.d.ts +2 -2
- package/dist/provider-migrations.js +5 -2
- package/dist/resource-loader.d.ts +5 -2
- package/dist/resource-loader.js +30 -13
- package/dist/resources/.managed-resources-content-hash +1 -0
- package/dist/resources/extensions/claude-code-cli/readiness.js +128 -32
- package/dist/resources/extensions/google-search/index.js +2 -6
- package/dist/resources/extensions/gsd/auto/loop.js +23 -0
- package/dist/resources/extensions/gsd/auto/phases.js +5 -13
- package/dist/resources/extensions/gsd/auto/run-unit.js +3 -1
- package/dist/resources/extensions/gsd/auto/session.js +5 -6
- package/dist/resources/extensions/gsd/auto-dashboard.js +3 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +18 -6
- package/dist/resources/extensions/gsd/auto-prompts.js +63 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +43 -4
- package/dist/resources/extensions/gsd/auto-runtime-state.js +31 -0
- package/dist/resources/extensions/gsd/auto-start.js +1 -1
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +2 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +60 -13
- package/dist/resources/extensions/gsd/auto.js +14 -5
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +14 -2
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +7 -5
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +5 -4
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +112 -31
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +11 -6
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +22 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +45 -8
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +121 -3
- package/dist/resources/extensions/gsd/commands/catalog.js +76 -5
- package/dist/resources/extensions/gsd/commands/handlers/core.js +23 -1
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +8 -0
- package/dist/resources/extensions/gsd/commands-config.js +3 -2
- package/dist/resources/extensions/gsd/commands-extensions.js +46 -3
- package/dist/resources/extensions/gsd/commands-handlers.js +3 -2
- package/dist/resources/extensions/gsd/commands-mcp-status.js +3 -1
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +10 -1
- package/dist/resources/extensions/gsd/commands-worktree.js +309 -0
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/dist/resources/extensions/gsd/doctor-providers.js +2 -1
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +39 -1
- package/dist/resources/extensions/gsd/error-classifier.js +1 -1
- package/dist/resources/extensions/gsd/forensics.js +10 -8
- package/dist/resources/extensions/gsd/git-service.js +12 -5
- package/dist/resources/extensions/gsd/gsd-db.js +11 -2
- package/dist/resources/extensions/gsd/guided-flow.js +25 -24
- package/dist/resources/extensions/gsd/home-dir.js +16 -0
- package/dist/resources/extensions/gsd/key-manager.js +2 -1
- package/dist/resources/extensions/gsd/memory-store.js +66 -31
- package/dist/resources/extensions/gsd/migrate/command.js +3 -2
- package/dist/resources/extensions/gsd/milestone-id-reservation.js +36 -0
- package/dist/resources/extensions/gsd/model-router.js +114 -9
- package/dist/resources/extensions/gsd/native-git-bridge.js +7 -1
- package/dist/resources/extensions/gsd/preferences-models.js +91 -15
- package/dist/resources/extensions/gsd/preferences-types.js +2 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +32 -0
- package/dist/resources/extensions/gsd/preferences.js +5 -3
- package/dist/resources/extensions/gsd/prompt-loader.js +23 -12
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +10 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +10 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +10 -0
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +10 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +9 -3
- package/dist/resources/extensions/gsd/state.js +42 -0
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/dist/resources/extensions/gsd/tools/memory-tools.js +18 -1
- package/dist/resources/extensions/gsd/unit-context-manifest.js +29 -4
- package/dist/resources/extensions/gsd/visualizer-overlay.js +1 -1
- package/dist/resources/extensions/gsd/watch/header-renderer.js +3 -1
- package/dist/resources/extensions/gsd/worktree-command.js +26 -46
- package/dist/resources/extensions/gsd/worktree-manager.js +20 -1
- package/dist/resources/extensions/gsd/worktree-resolver.js +4 -13
- package/dist/resources/extensions/gsd/worktree-root.js +124 -0
- package/dist/resources/extensions/gsd/worktree-session-state.js +33 -0
- package/dist/resources/extensions/gsd/worktree.js +4 -115
- package/dist/resources/extensions/mcp-client/index.js +6 -9
- package/dist/resources/extensions/ollama/index.js +15 -2
- package/dist/resources/extensions/ollama/model-capabilities.js +31 -0
- package/dist/resources/extensions/ollama/ollama-client.js +40 -4
- package/dist/resources/extensions/slash-commands/create-extension.js +36 -22
- package/dist/resources/extensions/subagent/index.js +324 -178
- package/dist/resources/skills/create-gsd-extension/SKILL.md +9 -5
- package/dist/resources/skills/create-gsd-extension/references/custom-commands.md +1 -1
- package/dist/resources/skills/create-gsd-extension/references/custom-rendering.md +5 -5
- package/dist/resources/skills/create-gsd-extension/references/custom-tools.md +4 -4
- package/dist/resources/skills/create-gsd-extension/references/custom-ui.md +6 -6
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +3 -3
- package/dist/resources/skills/create-gsd-extension/references/packaging-distribution.md +1 -1
- package/dist/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +3 -3
- package/dist/resources/skills/create-gsd-extension/workflows/create-extension.md +32 -12
- package/dist/rtk-shared.d.ts +3 -0
- package/dist/rtk-shared.js +17 -0
- package/dist/rtk.d.ts +2 -5
- package/dist/rtk.js +3 -20
- package/dist/runtime-checks.d.ts +27 -0
- package/dist/runtime-checks.js +38 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +15 -15
- package/dist/web/standalone/.next/build-manifest.json +4 -4
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +44 -4
- package/dist/web/standalone/.next/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +4 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +15 -15
- package/dist/web/standalone/.next/server/chunks/63.js +3 -3
- package/dist/web/standalone/.next/server/chunks/6897.js +1 -1
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +2 -2
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/server/webpack-runtime.js +1 -1
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +1 -0
- package/dist/web/standalone/.next/static/chunks/2824.08296bc2f9654698.js +1 -0
- package/dist/web/standalone/.next/static/chunks/3026.3af53b279375f082.js +1 -0
- package/dist/web/standalone/.next/static/chunks/315.6f68ae79b67d25cf.js +1 -0
- package/dist/web/standalone/.next/static/chunks/3497.4bfc60a3b3dea717.js +1 -0
- package/dist/web/standalone/.next/static/chunks/5516.4a07c872b5c3a663.js +1 -0
- package/dist/web/standalone/.next/static/chunks/8336.31b019697882acfb.js +10 -0
- package/dist/web/standalone/.next/static/chunks/8845.c9702695e8c5a9c5.js +2 -0
- package/dist/web/standalone/.next/static/chunks/9058.01ef3a463bda88f1.js +20 -0
- package/dist/web/standalone/.next/static/chunks/9441.1081da1125d1764f.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-9bf2e0c50fb2ca05.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
- package/dist/web/standalone/.next/static/chunks/webpack-f9f0dc45e4f3ac10.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/package.json +2 -1
- package/dist/web/standalone/server.js +1 -1
- package/dist/welcome-screen.js +27 -1
- package/dist/worktree-cli.d.ts +1 -0
- package/dist/worktree-cli.js +9 -3
- package/dist/worktree-status-banner.d.ts +1 -0
- package/dist/worktree-status-banner.js +132 -0
- package/package.json +1 -3
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/dist/alias-telemetry.d.ts +8 -0
- package/packages/mcp-server/dist/alias-telemetry.d.ts.map +1 -0
- package/packages/mcp-server/dist/alias-telemetry.js +30 -0
- package/packages/mcp-server/dist/alias-telemetry.js.map +1 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +74 -46
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/alias-telemetry.test.ts +78 -0
- package/packages/mcp-server/src/alias-telemetry.ts +30 -0
- package/packages/mcp-server/src/workflow-tools.test.ts +78 -0
- package/packages/mcp-server/src/workflow-tools.ts +93 -58
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.js +231 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +48 -19
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +13 -0
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.js +24 -3
- package/packages/pi-ai/dist/utils/repair-tool-json.js.map +1 -1
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js +26 -0
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/providers/anthropic-shared.cache-breakpoint.test.ts +289 -0
- package/packages/pi-ai/src/providers/anthropic-shared.ts +52 -20
- package/packages/pi-ai/src/types.ts +13 -0
- package/packages/pi-ai/src/utils/repair-tool-json.ts +24 -3
- package/packages/pi-ai/src/utils/tests/repair-tool-json.test.ts +32 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +6 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +4 -0
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +19 -2
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +10 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +18 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +13 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +20 -16
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/token-telemetry.d.ts +37 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.js +49 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +133 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +14 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.js +78 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.js +181 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.js.map +1 -0
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +7 -0
- package/packages/pi-coding-agent/src/core/messages.ts +4 -0
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +32 -2
- package/packages/pi-coding-agent/src/core/model-registry.ts +21 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +33 -15
- package/packages/pi-coding-agent/src/core/token-telemetry.ts +77 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +212 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +17 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +1 -1
- package/packages/pi-coding-agent/src/tests/system-prompt-cache-stability.test.ts +102 -0
- package/packages/pi-coding-agent/src/tests/token-telemetry.test.ts +200 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +17 -3
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js +161 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js.map +1 -0
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +20 -3
- package/packages/pi-tui/src/components/__tests__/leak-fixes-runtime.test.ts +219 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +130 -30
- package/src/resources/extensions/google-search/index.ts +2 -9
- package/src/resources/extensions/gsd/auto/loop.ts +24 -2
- package/src/resources/extensions/gsd/auto/phases.ts +6 -14
- package/src/resources/extensions/gsd/auto/run-unit.ts +3 -1
- package/src/resources/extensions/gsd/auto/session.ts +5 -6
- package/src/resources/extensions/gsd/auto/types.ts +1 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +3 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +18 -6
- package/src/resources/extensions/gsd/auto-prompts.ts +60 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +46 -8
- package/src/resources/extensions/gsd/auto-runtime-state.ts +51 -0
- package/src/resources/extensions/gsd/auto-start.ts +1 -1
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +2 -4
- package/src/resources/extensions/gsd/auto-worktree.ts +82 -12
- package/src/resources/extensions/gsd/auto.ts +14 -4
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +15 -13
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +8 -7
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +10 -9
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +121 -31
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +12 -6
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +20 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +50 -8
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +141 -11
- package/src/resources/extensions/gsd/commands/catalog.ts +82 -5
- package/src/resources/extensions/gsd/commands/handlers/core.ts +23 -1
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +10 -0
- package/src/resources/extensions/gsd/commands-config.ts +3 -2
- package/src/resources/extensions/gsd/commands-extensions.ts +43 -3
- package/src/resources/extensions/gsd/commands-handlers.ts +3 -2
- package/src/resources/extensions/gsd/commands-mcp-status.ts +3 -1
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +15 -1
- package/src/resources/extensions/gsd/commands-worktree.ts +383 -0
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/src/resources/extensions/gsd/doctor-providers.ts +2 -1
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +39 -1
- package/src/resources/extensions/gsd/doctor-types.ts +3 -1
- package/src/resources/extensions/gsd/error-classifier.ts +1 -1
- package/src/resources/extensions/gsd/forensics.ts +12 -7
- package/src/resources/extensions/gsd/git-service.ts +13 -5
- package/src/resources/extensions/gsd/gsd-db.ts +12 -2
- package/src/resources/extensions/gsd/guided-flow.ts +27 -26
- package/src/resources/extensions/gsd/home-dir.ts +19 -0
- package/src/resources/extensions/gsd/journal.ts +4 -1
- package/src/resources/extensions/gsd/key-manager.ts +2 -1
- package/src/resources/extensions/gsd/memory-store.ts +81 -28
- package/src/resources/extensions/gsd/migrate/command.ts +3 -2
- package/src/resources/extensions/gsd/milestone-id-reservation.ts +47 -0
- package/src/resources/extensions/gsd/model-router.ts +172 -9
- package/src/resources/extensions/gsd/native-git-bridge.ts +7 -1
- package/src/resources/extensions/gsd/preferences-models.ts +101 -15
- package/src/resources/extensions/gsd/preferences-types.ts +6 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +35 -0
- package/src/resources/extensions/gsd/preferences.ts +16 -2
- package/src/resources/extensions/gsd/prompt-loader.ts +26 -12
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +10 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +10 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +10 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +10 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +9 -3
- package/src/resources/extensions/gsd/state.ts +42 -0
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +178 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +24 -5
- package/src/resources/extensions/gsd/tests/auto-supervisor.test.mjs +21 -4
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/budget-prediction.test.ts +138 -211
- package/src/resources/extensions/gsd/tests/bundled-skill-triggers.test.ts +50 -27
- package/src/resources/extensions/gsd/tests/commands-extensions-version-compare.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/commands-worktree-clean.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +142 -59
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +7 -4
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +89 -32
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +41 -23
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +3 -43
- package/src/resources/extensions/gsd/tests/debug-logger.test.ts +5 -3
- package/src/resources/extensions/gsd/tests/deferred-milestone-dir-4996.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/discuss-empty-db-fallback.test.ts +22 -87
- package/src/resources/extensions/gsd/tests/discuss-queued-milestones.test.ts +7 -118
- package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +18 -60
- package/src/resources/extensions/gsd/tests/doctor-orphan-milestone-4996.test.ts +100 -0
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +14 -76
- package/src/resources/extensions/gsd/tests/ensure-preconditions-guard-4996.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +22 -83
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +1 -63
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed-runtime.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +26 -1
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell-runtime.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/google-search-stub.test.ts +25 -65
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/gsd-no-project-error-runtime.test.ts +81 -0
- package/src/resources/extensions/gsd/tests/headless-answers.test.ts +14 -4
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +22 -12
- package/src/resources/extensions/gsd/tests/help-menu-coverage.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/home-dir.test.ts +52 -0
- package/src/resources/extensions/gsd/tests/import-done-milestones-runtime.test.ts +145 -0
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +72 -1
- package/src/resources/extensions/gsd/tests/integration/token-savings.test.ts +0 -23
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +128 -0
- package/src/resources/extensions/gsd/tests/memory-tools.test.ts +33 -1
- package/src/resources/extensions/gsd/tests/merge-self-branch-guard.test.ts +124 -0
- package/src/resources/extensions/gsd/tests/milestone-id-gap-reuse-4996.test.ts +152 -0
- package/src/resources/extensions/gsd/tests/milestone-report-path.test.ts +18 -1
- package/src/resources/extensions/gsd/tests/model-router.test.ts +169 -8
- package/src/resources/extensions/gsd/tests/native-git-infra-errors.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +32 -43
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +4 -10
- package/src/resources/extensions/gsd/tests/preferences.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/register-hooks-compaction-checkpoint.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +168 -19
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +23 -1
- package/src/resources/extensions/gsd/tests/steer-worktree-path.test.ts +17 -1
- package/src/resources/extensions/gsd/tests/system-context-message-routing.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +51 -4
- package/src/resources/extensions/gsd/tests/turn-epoch.test.ts +7 -16
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +38 -3
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +5 -7
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +34 -33
- package/src/resources/extensions/gsd/tests/worktree.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +131 -1
- package/src/resources/extensions/gsd/tools/memory-tools.ts +17 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +44 -12
- package/src/resources/extensions/gsd/visualizer-overlay.ts +1 -1
- package/src/resources/extensions/gsd/watch/header-renderer.ts +3 -1
- package/src/resources/extensions/gsd/workflow-logger.ts +1 -0
- package/src/resources/extensions/gsd/worktree-command.ts +31 -44
- package/src/resources/extensions/gsd/worktree-manager.ts +40 -1
- package/src/resources/extensions/gsd/worktree-resolver.ts +4 -14
- package/src/resources/extensions/gsd/worktree-root.ts +144 -0
- package/src/resources/extensions/gsd/worktree-session-state.ts +35 -0
- package/src/resources/extensions/gsd/worktree.ts +8 -119
- package/src/resources/extensions/mcp-client/index.ts +6 -10
- package/src/resources/extensions/mcp-client/tests/global-config.test.ts +91 -0
- package/src/resources/extensions/ollama/index.ts +16 -2
- package/src/resources/extensions/ollama/model-capabilities.ts +34 -0
- package/src/resources/extensions/ollama/ollama-client.ts +41 -4
- package/src/resources/extensions/ollama/tests/model-capabilities.test.ts +96 -0
- package/src/resources/extensions/ollama/tests/ollama-client-timeout-env.test.ts +147 -0
- package/src/resources/extensions/slash-commands/create-extension.ts +38 -24
- package/src/resources/extensions/subagent/index.ts +165 -7
- package/src/resources/skills/create-gsd-extension/SKILL.md +9 -5
- package/src/resources/skills/create-gsd-extension/references/custom-commands.md +1 -1
- package/src/resources/skills/create-gsd-extension/references/custom-rendering.md +5 -5
- package/src/resources/skills/create-gsd-extension/references/custom-tools.md +4 -4
- package/src/resources/skills/create-gsd-extension/references/custom-ui.md +6 -6
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +3 -3
- package/src/resources/skills/create-gsd-extension/references/packaging-distribution.md +1 -1
- package/src/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +3 -3
- package/src/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +2 -2
- package/src/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +3 -3
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +58 -0
- package/src/resources/skills/create-gsd-extension/workflows/create-extension.md +32 -12
- package/dist/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +0 -601
- package/dist/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +0 -651
- package/dist/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +0 -91
- package/dist/resources/extensions/gsd/tests/auto-supervisor.test.mjs +0 -53
- package/dist/resources/extensions/gsd/tests/dist-redirect.mjs +0 -112
- package/dist/resources/extensions/gsd/tests/resolve-ts-hooks.mjs +0 -23
- package/dist/resources/extensions/gsd/tests/resolve-ts.mjs +0 -5
- package/dist/resources/skills/github-workflows/references/gh/tests/__init__.py +0 -0
- package/dist/resources/skills/github-workflows/references/gh/tests/test_github_project_setup.py +0 -608
- package/dist/web/standalone/.next/static/chunks/2826.e9f5195e91f9cad2.js +0 -11
- package/dist/web/standalone/.next/static/chunks/3621.fc7480022c972438.js +0 -20
- package/dist/web/standalone/.next/static/chunks/app/page-151349214571e2b6.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
- package/dist/web/standalone/.next/static/chunks/webpack-2e68521d7c82f7c2.js +0 -1
- package/src/resources/extensions/gsd/tests/copy-planning-artifacts-samepath.test.ts +0 -22
- package/src/resources/extensions/gsd/tests/discuss-slice-structured-questions.test.ts +0 -47
- package/src/resources/extensions/gsd/tests/empty-content-abort-loop.test.ts +0 -75
- /package/dist/web/standalone/.next/static/{C1zT2kEfoLhDdbWPWKrXd → QK8fABiGPmonfTgboN0Y9}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{C1zT2kEfoLhDdbWPWKrXd → QK8fABiGPmonfTgboN0Y9}/_ssgManifest.js +0 -0
|
@@ -1,651 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* browser-tools — Node-side unit tests
|
|
3
|
-
*
|
|
4
|
-
* Uses jiti for TypeScript imports (the resolve-ts ESM hook breaks on core.js),
|
|
5
|
-
* node:test for the runner, and node:assert/strict for assertions.
|
|
6
|
-
*
|
|
7
|
-
* Tests pure functions from utils.ts, state.ts accessors, evaluate-helpers.ts
|
|
8
|
-
* syntax, and constrainScreenshot from capture.ts.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const { describe, it, beforeEach } = require("node:test");
|
|
12
|
-
const assert = require("node:assert/strict");
|
|
13
|
-
const jiti = require("jiti")(__filename, { interopDefault: true, debug: false });
|
|
14
|
-
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// Module imports via jiti
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
parseRef,
|
|
21
|
-
formatVersionedRef,
|
|
22
|
-
staleRefGuidance,
|
|
23
|
-
formatCompactStateSummary,
|
|
24
|
-
verificationFromChecks,
|
|
25
|
-
verificationLine,
|
|
26
|
-
sanitizeArtifactName,
|
|
27
|
-
isCriticalResourceType,
|
|
28
|
-
getUrlHash,
|
|
29
|
-
firstErrorLine,
|
|
30
|
-
formatArtifactTimestamp,
|
|
31
|
-
} = jiti("../utils.ts");
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
getBrowser,
|
|
35
|
-
setBrowser,
|
|
36
|
-
getContext,
|
|
37
|
-
setContext,
|
|
38
|
-
getActiveFrame,
|
|
39
|
-
setActiveFrame,
|
|
40
|
-
getSessionStartedAt,
|
|
41
|
-
setSessionStartedAt,
|
|
42
|
-
getSessionArtifactDir,
|
|
43
|
-
setSessionArtifactDir,
|
|
44
|
-
getCurrentRefMap,
|
|
45
|
-
setCurrentRefMap,
|
|
46
|
-
getRefVersion,
|
|
47
|
-
setRefVersion,
|
|
48
|
-
getRefMetadata,
|
|
49
|
-
setRefMetadata,
|
|
50
|
-
getLastActionBeforeState,
|
|
51
|
-
setLastActionBeforeState,
|
|
52
|
-
getLastActionAfterState,
|
|
53
|
-
setLastActionAfterState,
|
|
54
|
-
resetAllState,
|
|
55
|
-
} = jiti("../state.ts");
|
|
56
|
-
|
|
57
|
-
const { EVALUATE_HELPERS_SOURCE } = jiti("../evaluate-helpers.ts");
|
|
58
|
-
|
|
59
|
-
const { constrainScreenshot } = jiti("../capture.ts");
|
|
60
|
-
|
|
61
|
-
// ---------------------------------------------------------------------------
|
|
62
|
-
// utils.ts — parseRef
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
|
|
65
|
-
describe("parseRef", () => {
|
|
66
|
-
it("parses a valid versioned ref", () => {
|
|
67
|
-
const result = parseRef("@v3:e12");
|
|
68
|
-
assert.deepStrictEqual(result, {
|
|
69
|
-
key: "e12",
|
|
70
|
-
version: 3,
|
|
71
|
-
display: "@v3:e12",
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("parses a ref without leading @", () => {
|
|
76
|
-
const result = parseRef("v1:e5");
|
|
77
|
-
assert.deepStrictEqual(result, {
|
|
78
|
-
key: "e5",
|
|
79
|
-
version: 1,
|
|
80
|
-
display: "@v1:e5",
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("handles legacy (unversioned) format", () => {
|
|
85
|
-
const result = parseRef("@e7");
|
|
86
|
-
assert.deepStrictEqual(result, {
|
|
87
|
-
key: "e7",
|
|
88
|
-
version: null,
|
|
89
|
-
display: "@e7",
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("trims whitespace", () => {
|
|
94
|
-
const result = parseRef(" @v2:e1 ");
|
|
95
|
-
assert.equal(result.key, "e1");
|
|
96
|
-
assert.equal(result.version, 2);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("is case-insensitive", () => {
|
|
100
|
-
const result = parseRef("@V10:E3");
|
|
101
|
-
assert.equal(result.key, "e3");
|
|
102
|
-
assert.equal(result.version, 10);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// ---------------------------------------------------------------------------
|
|
107
|
-
// utils.ts — formatVersionedRef
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
|
|
110
|
-
describe("formatVersionedRef", () => {
|
|
111
|
-
it("formats a versioned ref string", () => {
|
|
112
|
-
assert.equal(formatVersionedRef(5, "e3"), "@v5:e3");
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it("formats version 0", () => {
|
|
116
|
-
assert.equal(formatVersionedRef(0, "e1"), "@v0:e1");
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// ---------------------------------------------------------------------------
|
|
121
|
-
// utils.ts — staleRefGuidance
|
|
122
|
-
// ---------------------------------------------------------------------------
|
|
123
|
-
|
|
124
|
-
describe("staleRefGuidance", () => {
|
|
125
|
-
it("includes the ref display and reason", () => {
|
|
126
|
-
const result = staleRefGuidance("@v2:e5", "element removed");
|
|
127
|
-
assert.ok(result.includes("@v2:e5"));
|
|
128
|
-
assert.ok(result.includes("element removed"));
|
|
129
|
-
assert.ok(result.includes("browser_snapshot_refs"));
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// ---------------------------------------------------------------------------
|
|
134
|
-
// utils.ts — formatCompactStateSummary
|
|
135
|
-
// ---------------------------------------------------------------------------
|
|
136
|
-
|
|
137
|
-
describe("formatCompactStateSummary", () => {
|
|
138
|
-
it("formats a compact page state into a readable summary", () => {
|
|
139
|
-
/** @type {import('../state.ts').CompactPageState} */
|
|
140
|
-
const mockState = {
|
|
141
|
-
url: "http://localhost:3000/dashboard",
|
|
142
|
-
title: "Dashboard",
|
|
143
|
-
focus: "input#search",
|
|
144
|
-
headings: ["Welcome", "Recent Activity"],
|
|
145
|
-
bodyText: "",
|
|
146
|
-
counts: {
|
|
147
|
-
landmarks: 3,
|
|
148
|
-
buttons: 5,
|
|
149
|
-
links: 12,
|
|
150
|
-
inputs: 2,
|
|
151
|
-
},
|
|
152
|
-
dialog: { count: 0, title: "" },
|
|
153
|
-
selectorStates: {},
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const summary = formatCompactStateSummary(mockState);
|
|
157
|
-
assert.ok(summary.includes("Title: Dashboard"));
|
|
158
|
-
assert.ok(summary.includes("URL: http://localhost:3000/dashboard"));
|
|
159
|
-
assert.ok(summary.includes("3 landmarks"));
|
|
160
|
-
assert.ok(summary.includes("5 buttons"));
|
|
161
|
-
assert.ok(summary.includes("12 links"));
|
|
162
|
-
assert.ok(summary.includes("2 inputs"));
|
|
163
|
-
assert.ok(summary.includes("Focused: input#search"));
|
|
164
|
-
assert.ok(summary.includes('H1 "Welcome"'));
|
|
165
|
-
assert.ok(summary.includes('H2 "Recent Activity"'));
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it("omits focus line when empty", () => {
|
|
169
|
-
const mockState = {
|
|
170
|
-
url: "http://example.com",
|
|
171
|
-
title: "Test",
|
|
172
|
-
focus: "",
|
|
173
|
-
headings: [],
|
|
174
|
-
bodyText: "",
|
|
175
|
-
counts: { landmarks: 0, buttons: 0, links: 0, inputs: 0 },
|
|
176
|
-
dialog: { count: 0, title: "" },
|
|
177
|
-
selectorStates: {},
|
|
178
|
-
};
|
|
179
|
-
const summary = formatCompactStateSummary(mockState);
|
|
180
|
-
assert.ok(!summary.includes("Focused:"));
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it("includes dialog title when present", () => {
|
|
184
|
-
const mockState = {
|
|
185
|
-
url: "http://example.com",
|
|
186
|
-
title: "Test",
|
|
187
|
-
focus: "",
|
|
188
|
-
headings: [],
|
|
189
|
-
bodyText: "",
|
|
190
|
-
counts: { landmarks: 0, buttons: 0, links: 0, inputs: 0 },
|
|
191
|
-
dialog: { count: 1, title: "Confirm Delete" },
|
|
192
|
-
selectorStates: {},
|
|
193
|
-
};
|
|
194
|
-
const summary = formatCompactStateSummary(mockState);
|
|
195
|
-
assert.ok(summary.includes('Active dialog: "Confirm Delete"'));
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
// ---------------------------------------------------------------------------
|
|
200
|
-
// utils.ts — verificationFromChecks
|
|
201
|
-
// ---------------------------------------------------------------------------
|
|
202
|
-
|
|
203
|
-
describe("verificationFromChecks", () => {
|
|
204
|
-
it("returns verified=true when at least one check passes", () => {
|
|
205
|
-
const checks = [
|
|
206
|
-
{ name: "url_changed", passed: true },
|
|
207
|
-
{ name: "title_changed", passed: false },
|
|
208
|
-
];
|
|
209
|
-
const result = verificationFromChecks(checks);
|
|
210
|
-
assert.equal(result.verified, true);
|
|
211
|
-
assert.ok(result.verificationSummary.includes("PASS"));
|
|
212
|
-
assert.ok(result.verificationSummary.includes("url_changed"));
|
|
213
|
-
assert.equal(result.retryHint, undefined);
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
it("returns verified=false when no checks pass", () => {
|
|
217
|
-
const checks = [
|
|
218
|
-
{ name: "url_changed", passed: false },
|
|
219
|
-
{ name: "title_changed", passed: false },
|
|
220
|
-
];
|
|
221
|
-
const result = verificationFromChecks(checks, "try clicking again");
|
|
222
|
-
assert.equal(result.verified, false);
|
|
223
|
-
assert.ok(result.verificationSummary.includes("SOFT-FAIL"));
|
|
224
|
-
assert.equal(result.retryHint, "try clicking again");
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
it("lists multiple passing checks", () => {
|
|
228
|
-
const checks = [
|
|
229
|
-
{ name: "a", passed: true },
|
|
230
|
-
{ name: "b", passed: true },
|
|
231
|
-
];
|
|
232
|
-
const result = verificationFromChecks(checks);
|
|
233
|
-
assert.ok(result.verificationSummary.includes("a"));
|
|
234
|
-
assert.ok(result.verificationSummary.includes("b"));
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
// ---------------------------------------------------------------------------
|
|
239
|
-
// utils.ts — verificationLine
|
|
240
|
-
// ---------------------------------------------------------------------------
|
|
241
|
-
|
|
242
|
-
describe("verificationLine", () => {
|
|
243
|
-
it("formats a verification result into a single line", () => {
|
|
244
|
-
const result = {
|
|
245
|
-
verified: true,
|
|
246
|
-
checks: [],
|
|
247
|
-
verificationSummary: "PASS (url_changed)",
|
|
248
|
-
};
|
|
249
|
-
const line = verificationLine(result);
|
|
250
|
-
assert.equal(line, "Verification: PASS (url_changed)");
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
// ---------------------------------------------------------------------------
|
|
255
|
-
// utils.ts — sanitizeArtifactName
|
|
256
|
-
// ---------------------------------------------------------------------------
|
|
257
|
-
|
|
258
|
-
describe("sanitizeArtifactName", () => {
|
|
259
|
-
it("passes through valid names", () => {
|
|
260
|
-
assert.equal(sanitizeArtifactName("my-trace", "default"), "my-trace");
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it("replaces special characters with hyphens", () => {
|
|
264
|
-
assert.equal(sanitizeArtifactName("hello world!@#", "default"), "hello-world");
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it("strips leading/trailing hyphens", () => {
|
|
268
|
-
assert.equal(sanitizeArtifactName(" --foo-- ", "default"), "foo");
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
it("returns fallback for empty string", () => {
|
|
272
|
-
assert.equal(sanitizeArtifactName("", "fallback"), "fallback");
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it("returns fallback for whitespace-only string", () => {
|
|
276
|
-
assert.equal(sanitizeArtifactName(" ", "fallback"), "fallback");
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
it("returns fallback for all-special-chars string", () => {
|
|
280
|
-
assert.equal(sanitizeArtifactName("@#$%", "default"), "default");
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
it("preserves dots and underscores", () => {
|
|
284
|
-
assert.equal(sanitizeArtifactName("file_name.ext", "default"), "file_name.ext");
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
// ---------------------------------------------------------------------------
|
|
289
|
-
// utils.ts — isCriticalResourceType
|
|
290
|
-
// ---------------------------------------------------------------------------
|
|
291
|
-
|
|
292
|
-
describe("isCriticalResourceType", () => {
|
|
293
|
-
it("returns true for document", () => {
|
|
294
|
-
assert.equal(isCriticalResourceType("document"), true);
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
it("returns true for fetch", () => {
|
|
298
|
-
assert.equal(isCriticalResourceType("fetch"), true);
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
it("returns true for xhr", () => {
|
|
302
|
-
assert.equal(isCriticalResourceType("xhr"), true);
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
it("returns false for image", () => {
|
|
306
|
-
assert.equal(isCriticalResourceType("image"), false);
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
it("returns false for font", () => {
|
|
310
|
-
assert.equal(isCriticalResourceType("font"), false);
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
it("returns false for stylesheet", () => {
|
|
314
|
-
assert.equal(isCriticalResourceType("stylesheet"), false);
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
it("returns false for script", () => {
|
|
318
|
-
assert.equal(isCriticalResourceType("script"), false);
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
// ---------------------------------------------------------------------------
|
|
323
|
-
// utils.ts — getUrlHash
|
|
324
|
-
// ---------------------------------------------------------------------------
|
|
325
|
-
|
|
326
|
-
describe("getUrlHash", () => {
|
|
327
|
-
it("returns the hash from a URL", () => {
|
|
328
|
-
assert.equal(getUrlHash("http://example.com/page#section"), "#section");
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it("returns empty string when no hash", () => {
|
|
332
|
-
assert.equal(getUrlHash("http://example.com/page"), "");
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
it("returns empty string for invalid URL", () => {
|
|
336
|
-
assert.equal(getUrlHash("not-a-url"), "");
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
// ---------------------------------------------------------------------------
|
|
341
|
-
// utils.ts — firstErrorLine
|
|
342
|
-
// ---------------------------------------------------------------------------
|
|
343
|
-
|
|
344
|
-
describe("firstErrorLine", () => {
|
|
345
|
-
it("extracts first line from an Error", () => {
|
|
346
|
-
const err = new Error("line1\nline2\nline3");
|
|
347
|
-
assert.equal(firstErrorLine(err), "line1");
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it("handles string errors", () => {
|
|
351
|
-
assert.equal(firstErrorLine("something broke"), "something broke");
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
it("handles null/undefined", () => {
|
|
355
|
-
assert.equal(firstErrorLine(null), "unknown error");
|
|
356
|
-
assert.equal(firstErrorLine(undefined), "unknown error");
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
it("handles objects without message property", () => {
|
|
360
|
-
// {} has no .message, so falls to String({}) = "[object Object]"
|
|
361
|
-
assert.equal(firstErrorLine({}), "[object Object]");
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
it("handles objects with empty message", () => {
|
|
365
|
-
assert.equal(firstErrorLine({ message: "" }), "unknown error");
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
// ---------------------------------------------------------------------------
|
|
370
|
-
// utils.ts — formatArtifactTimestamp
|
|
371
|
-
// ---------------------------------------------------------------------------
|
|
372
|
-
|
|
373
|
-
describe("formatArtifactTimestamp", () => {
|
|
374
|
-
it("formats a timestamp into an ISO-like string with dashes", () => {
|
|
375
|
-
// 2024-01-15T10:30:45.123Z
|
|
376
|
-
const ts = new Date("2024-01-15T10:30:45.123Z").getTime();
|
|
377
|
-
const result = formatArtifactTimestamp(ts);
|
|
378
|
-
// Should replace colons and dots with dashes
|
|
379
|
-
assert.ok(!result.includes(":"));
|
|
380
|
-
assert.ok(!result.includes("."));
|
|
381
|
-
assert.ok(result.includes("2024-01-15"));
|
|
382
|
-
});
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
// ---------------------------------------------------------------------------
|
|
386
|
-
// evaluate-helpers.ts — EVALUATE_HELPERS_SOURCE
|
|
387
|
-
// ---------------------------------------------------------------------------
|
|
388
|
-
|
|
389
|
-
describe("EVALUATE_HELPERS_SOURCE", () => {
|
|
390
|
-
// Behaviour test: executing the source in a Node vm sandbox must
|
|
391
|
-
// populate a `window.__pi` namespace with every expected helper.
|
|
392
|
-
// No source grep — we actually run the code and verify the resulting
|
|
393
|
-
// object shape.
|
|
394
|
-
it("executing the source assigns all expected helpers to window.__pi", () => {
|
|
395
|
-
const vm = require("node:vm");
|
|
396
|
-
const expectedFunctions = [
|
|
397
|
-
"cssPath",
|
|
398
|
-
"simpleHash",
|
|
399
|
-
"isVisible",
|
|
400
|
-
"isEnabled",
|
|
401
|
-
"inferRole",
|
|
402
|
-
"accessibleName",
|
|
403
|
-
"isInteractiveEl",
|
|
404
|
-
"domPath",
|
|
405
|
-
"selectorHints",
|
|
406
|
-
];
|
|
407
|
-
|
|
408
|
-
// Playwright evaluates the source in a page context where `window`
|
|
409
|
-
// exists, so the helpers attach to `window.__pi`. Provide a minimal
|
|
410
|
-
// window stub in a vm context so we avoid polluting the test globals.
|
|
411
|
-
const sandbox = { window: {} };
|
|
412
|
-
const script = new vm.Script(EVALUATE_HELPERS_SOURCE);
|
|
413
|
-
script.runInNewContext(sandbox, { timeout: 1000 });
|
|
414
|
-
|
|
415
|
-
assert.ok(
|
|
416
|
-
sandbox.window.__pi && typeof sandbox.window.__pi === "object",
|
|
417
|
-
"executing EVALUATE_HELPERS_SOURCE must assign window.__pi",
|
|
418
|
-
);
|
|
419
|
-
|
|
420
|
-
for (const fnName of expectedFunctions) {
|
|
421
|
-
assert.equal(
|
|
422
|
-
typeof sandbox.window.__pi[fnName],
|
|
423
|
-
"function",
|
|
424
|
-
`window.__pi.${fnName} must be a function after executing the source`,
|
|
425
|
-
);
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
// ---------------------------------------------------------------------------
|
|
431
|
-
// state.ts — accessor round-trips
|
|
432
|
-
// ---------------------------------------------------------------------------
|
|
433
|
-
|
|
434
|
-
describe("state accessors", () => {
|
|
435
|
-
beforeEach(() => {
|
|
436
|
-
resetAllState();
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
it("setBrowser/getBrowser round-trip", () => {
|
|
440
|
-
assert.equal(getBrowser(), null);
|
|
441
|
-
const fakeBrowser = { close: () => {} };
|
|
442
|
-
setBrowser(fakeBrowser);
|
|
443
|
-
assert.equal(getBrowser(), fakeBrowser);
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
it("setContext/getContext round-trip", () => {
|
|
447
|
-
assert.equal(getContext(), null);
|
|
448
|
-
const fakeContext = { newPage: () => {} };
|
|
449
|
-
setContext(fakeContext);
|
|
450
|
-
assert.equal(getContext(), fakeContext);
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
it("setActiveFrame/getActiveFrame round-trip", () => {
|
|
454
|
-
assert.equal(getActiveFrame(), null);
|
|
455
|
-
const fakeFrame = { name: () => "test" };
|
|
456
|
-
setActiveFrame(fakeFrame);
|
|
457
|
-
assert.equal(getActiveFrame(), fakeFrame);
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
it("setSessionStartedAt/getSessionStartedAt round-trip", () => {
|
|
461
|
-
assert.equal(getSessionStartedAt(), null);
|
|
462
|
-
setSessionStartedAt(1234567890);
|
|
463
|
-
assert.equal(getSessionStartedAt(), 1234567890);
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
it("setSessionArtifactDir/getSessionArtifactDir round-trip", () => {
|
|
467
|
-
assert.equal(getSessionArtifactDir(), null);
|
|
468
|
-
setSessionArtifactDir("/tmp/artifacts");
|
|
469
|
-
assert.equal(getSessionArtifactDir(), "/tmp/artifacts");
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
it("setCurrentRefMap/getCurrentRefMap round-trip", () => {
|
|
473
|
-
assert.deepStrictEqual(getCurrentRefMap(), {});
|
|
474
|
-
const refMap = { e1: { ref: "e1", tag: "button" } };
|
|
475
|
-
setCurrentRefMap(refMap);
|
|
476
|
-
assert.deepStrictEqual(getCurrentRefMap(), refMap);
|
|
477
|
-
});
|
|
478
|
-
|
|
479
|
-
it("setRefVersion/getRefVersion round-trip", () => {
|
|
480
|
-
assert.equal(getRefVersion(), 0);
|
|
481
|
-
setRefVersion(5);
|
|
482
|
-
assert.equal(getRefVersion(), 5);
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
it("setRefMetadata/getRefMetadata round-trip", () => {
|
|
486
|
-
assert.equal(getRefMetadata(), null);
|
|
487
|
-
const metadata = { url: "http://test.com", timestamp: 123, interactiveOnly: true, limit: 40, version: 1 };
|
|
488
|
-
setRefMetadata(metadata);
|
|
489
|
-
assert.deepStrictEqual(getRefMetadata(), metadata);
|
|
490
|
-
});
|
|
491
|
-
|
|
492
|
-
it("setLastActionBeforeState/getLastActionBeforeState round-trip", () => {
|
|
493
|
-
assert.equal(getLastActionBeforeState(), null);
|
|
494
|
-
const state = { url: "http://test.com", title: "Test", focus: "", headings: [], bodyText: "", counts: { landmarks: 0, buttons: 0, links: 0, inputs: 0 }, dialog: { count: 0, title: "" }, selectorStates: {} };
|
|
495
|
-
setLastActionBeforeState(state);
|
|
496
|
-
assert.deepStrictEqual(getLastActionBeforeState(), state);
|
|
497
|
-
});
|
|
498
|
-
|
|
499
|
-
it("setLastActionAfterState/getLastActionAfterState round-trip", () => {
|
|
500
|
-
assert.equal(getLastActionAfterState(), null);
|
|
501
|
-
const state = { url: "http://test.com/after", title: "After", focus: "", headings: [], bodyText: "", counts: { landmarks: 0, buttons: 0, links: 0, inputs: 0 }, dialog: { count: 0, title: "" }, selectorStates: {} };
|
|
502
|
-
setLastActionAfterState(state);
|
|
503
|
-
assert.deepStrictEqual(getLastActionAfterState(), state);
|
|
504
|
-
});
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
// ---------------------------------------------------------------------------
|
|
508
|
-
// state.ts — resetAllState
|
|
509
|
-
// ---------------------------------------------------------------------------
|
|
510
|
-
|
|
511
|
-
describe("resetAllState", () => {
|
|
512
|
-
it("clears all state back to defaults", () => {
|
|
513
|
-
// Set various state values
|
|
514
|
-
setBrowser({ close: () => {} });
|
|
515
|
-
setContext({ newPage: () => {} });
|
|
516
|
-
setActiveFrame({ name: () => "frame" });
|
|
517
|
-
setSessionStartedAt(9999);
|
|
518
|
-
setSessionArtifactDir("/tmp/test");
|
|
519
|
-
setCurrentRefMap({ e1: {} });
|
|
520
|
-
setRefVersion(10);
|
|
521
|
-
setRefMetadata({ url: "http://x", timestamp: 1, interactiveOnly: true, limit: 40, version: 1 });
|
|
522
|
-
setLastActionBeforeState({ url: "before" });
|
|
523
|
-
setLastActionAfterState({ url: "after" });
|
|
524
|
-
|
|
525
|
-
// Reset
|
|
526
|
-
resetAllState();
|
|
527
|
-
|
|
528
|
-
// Verify all cleared
|
|
529
|
-
assert.equal(getBrowser(), null);
|
|
530
|
-
assert.equal(getContext(), null);
|
|
531
|
-
assert.equal(getActiveFrame(), null);
|
|
532
|
-
assert.equal(getSessionStartedAt(), null);
|
|
533
|
-
assert.equal(getSessionArtifactDir(), null);
|
|
534
|
-
assert.deepStrictEqual(getCurrentRefMap(), {});
|
|
535
|
-
assert.equal(getRefVersion(), 0);
|
|
536
|
-
assert.equal(getRefMetadata(), null);
|
|
537
|
-
assert.equal(getLastActionBeforeState(), null);
|
|
538
|
-
assert.equal(getLastActionAfterState(), null);
|
|
539
|
-
});
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
// ---------------------------------------------------------------------------
|
|
543
|
-
// capture.ts — constrainScreenshot
|
|
544
|
-
// ---------------------------------------------------------------------------
|
|
545
|
-
|
|
546
|
-
describe("constrainScreenshot", () => {
|
|
547
|
-
// Helper: create a synthetic JPEG buffer via sharp
|
|
548
|
-
async function createTestJpeg(width, height) {
|
|
549
|
-
const sharp = require("sharp");
|
|
550
|
-
return sharp({
|
|
551
|
-
create: {
|
|
552
|
-
width,
|
|
553
|
-
height,
|
|
554
|
-
channels: 3,
|
|
555
|
-
background: { r: 128, g: 128, b: 128 },
|
|
556
|
-
},
|
|
557
|
-
})
|
|
558
|
-
.jpeg({ quality: 80 })
|
|
559
|
-
.toBuffer();
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// Helper: create a synthetic PNG buffer via sharp
|
|
563
|
-
async function createTestPng(width, height) {
|
|
564
|
-
const sharp = require("sharp");
|
|
565
|
-
return sharp({
|
|
566
|
-
create: {
|
|
567
|
-
width,
|
|
568
|
-
height,
|
|
569
|
-
channels: 4,
|
|
570
|
-
background: { r: 128, g: 128, b: 128, alpha: 1 },
|
|
571
|
-
},
|
|
572
|
-
})
|
|
573
|
-
.png()
|
|
574
|
-
.toBuffer();
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
it("passes through a small JPEG unchanged", async () => {
|
|
578
|
-
const buf = await createTestJpeg(800, 600);
|
|
579
|
-
const result = await constrainScreenshot(null, buf, "image/jpeg", 80);
|
|
580
|
-
// Should return the same buffer (no resize needed)
|
|
581
|
-
assert.equal(Buffer.isBuffer(result), true);
|
|
582
|
-
const sharp = require("sharp");
|
|
583
|
-
const meta = await sharp(result).metadata();
|
|
584
|
-
assert.equal(meta.width, 800);
|
|
585
|
-
assert.equal(meta.height, 600);
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
it("resizes an oversized JPEG within 1568px", async () => {
|
|
589
|
-
const buf = await createTestJpeg(3000, 2000);
|
|
590
|
-
const result = await constrainScreenshot(null, buf, "image/jpeg", 80);
|
|
591
|
-
assert.equal(Buffer.isBuffer(result), true);
|
|
592
|
-
|
|
593
|
-
const sharp = require("sharp");
|
|
594
|
-
const meta = await sharp(result).metadata();
|
|
595
|
-
// Both dimensions should be <= 1568
|
|
596
|
-
assert.ok(meta.width <= 1568, `width ${meta.width} should be <= 1568`);
|
|
597
|
-
assert.ok(meta.height <= 1568, `height ${meta.height} should be <= 1568`);
|
|
598
|
-
// Aspect ratio preserved: 3000/2000 = 1.5, so width = 1568, height ~= 1045
|
|
599
|
-
assert.equal(meta.width, 1568);
|
|
600
|
-
assert.ok(meta.height > 1000 && meta.height < 1100);
|
|
601
|
-
assert.equal(meta.format, "jpeg");
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
it("resizes an oversized PNG and returns PNG", async () => {
|
|
605
|
-
const buf = await createTestPng(2500, 1800);
|
|
606
|
-
const result = await constrainScreenshot(null, buf, "image/png", 80);
|
|
607
|
-
assert.equal(Buffer.isBuffer(result), true);
|
|
608
|
-
|
|
609
|
-
const sharp = require("sharp");
|
|
610
|
-
const meta = await sharp(result).metadata();
|
|
611
|
-
assert.ok(meta.width <= 1568, `width ${meta.width} should be <= 1568`);
|
|
612
|
-
assert.ok(meta.height <= 1568, `height ${meta.height} should be <= 1568`);
|
|
613
|
-
assert.equal(meta.format, "png");
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
it("handles an image where only height exceeds the limit", async () => {
|
|
617
|
-
const buf = await createTestJpeg(1000, 9000);
|
|
618
|
-
const result = await constrainScreenshot(null, buf, "image/jpeg", 80);
|
|
619
|
-
const sharp = require("sharp");
|
|
620
|
-
const meta = await sharp(result).metadata();
|
|
621
|
-
assert.ok(meta.width <= 1568);
|
|
622
|
-
assert.ok(meta.height <= 8000);
|
|
623
|
-
// Height was the constraining dimension
|
|
624
|
-
assert.equal(meta.height, 8000);
|
|
625
|
-
});
|
|
626
|
-
});
|
|
627
|
-
|
|
628
|
-
// ---------------------------------------------------------------------------
|
|
629
|
-
// browser_save_pdf — tool registration
|
|
630
|
-
// ---------------------------------------------------------------------------
|
|
631
|
-
|
|
632
|
-
describe("browser_save_pdf tool registration", () => {
|
|
633
|
-
it("registerPdfTools exports a function", () => {
|
|
634
|
-
const { registerPdfTools } = jiti("../tools/pdf.ts");
|
|
635
|
-
assert.equal(typeof registerPdfTools, "function", "registerPdfTools should be a function");
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
it("tool can be registered with a mock pi", () => {
|
|
639
|
-
const { registerPdfTools } = jiti("../tools/pdf.ts");
|
|
640
|
-
const registeredTools = [];
|
|
641
|
-
const mockPi = {
|
|
642
|
-
registerTool: (tool) => registeredTools.push(tool),
|
|
643
|
-
};
|
|
644
|
-
const mockDeps = {};
|
|
645
|
-
registerPdfTools(mockPi, mockDeps);
|
|
646
|
-
assert.equal(registeredTools.length, 1, "should register exactly 1 tool");
|
|
647
|
-
assert.equal(registeredTools[0].name, "browser_save_pdf", "tool name should be browser_save_pdf");
|
|
648
|
-
assert.ok(registeredTools[0].parameters, "tool should have parameters schema");
|
|
649
|
-
assert.equal(typeof registeredTools[0].execute, "function", "tool should have execute function");
|
|
650
|
-
});
|
|
651
|
-
});
|