gsd-pi 2.77.0-dev.eaa4973bc → 2.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/claude-cli-check.js +5 -1
- package/dist/headless.js +49 -4
- package/dist/loader.js +0 -0
- package/dist/resource-loader.d.ts +40 -0
- package/dist/resource-loader.js +32 -13
- package/dist/resources/extensions/browser-tools/capture.js +9 -0
- package/dist/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +8 -59
- package/dist/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +36 -24
- package/dist/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +69 -71
- package/dist/resources/extensions/browser-tools/tools/forms.js +5 -1
- package/dist/resources/extensions/browser-tools/tools/intent.js +5 -1
- package/dist/resources/extensions/claude-code-cli/readiness.js +5 -1
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +481 -17
- package/dist/resources/extensions/github-sync/templates.js +103 -0
- package/dist/resources/extensions/google-search/index.js +3 -2
- package/dist/resources/extensions/gsd/auto/loop.js +124 -2
- package/dist/resources/extensions/gsd/auto/phases.js +57 -39
- package/dist/resources/extensions/gsd/auto/session.js +6 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +142 -29
- package/dist/resources/extensions/gsd/auto-model-selection.js +124 -4
- package/dist/resources/extensions/gsd/auto-post-unit.js +150 -64
- package/dist/resources/extensions/gsd/auto-prompts.js +372 -104
- package/dist/resources/extensions/gsd/auto-recovery.js +197 -48
- package/dist/resources/extensions/gsd/auto-start.js +107 -29
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +47 -7
- package/dist/resources/extensions/gsd/auto-worktree.js +122 -26
- package/dist/resources/extensions/gsd/auto.js +76 -21
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +19 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +209 -0
- package/dist/resources/extensions/gsd/bootstrap/provider-error-resume.js +3 -6
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +7 -3
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +127 -9
- package/dist/resources/extensions/gsd/component-loader.js +447 -0
- package/dist/resources/extensions/gsd/component-types.js +69 -0
- package/dist/resources/extensions/gsd/context-store.js +23 -7
- package/dist/resources/extensions/gsd/detection.js +49 -1
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -17
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/dist/resources/extensions/gsd/forensics.js +106 -0
- package/dist/resources/extensions/gsd/gate-registry.js +2 -2
- package/dist/resources/extensions/gsd/git-constants.js +28 -1
- package/dist/resources/extensions/gsd/git-self-heal.js +27 -0
- package/dist/resources/extensions/gsd/git-service.js +126 -2
- package/dist/resources/extensions/gsd/gsd-db.js +6 -3
- package/dist/resources/extensions/gsd/guided-flow.js +39 -13
- package/dist/resources/extensions/gsd/memory-extractor.js +7 -1
- package/dist/resources/extensions/gsd/milestone-scope-classifier.js +299 -0
- package/dist/resources/extensions/gsd/milestone-summary-classifier.js +37 -0
- package/dist/resources/extensions/gsd/model-cost-table.js +3 -0
- package/dist/resources/extensions/gsd/model-router.js +6 -0
- package/dist/resources/extensions/gsd/native-git-bridge.js +34 -4
- package/dist/resources/extensions/gsd/preferences-validation.js +23 -0
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.js +4 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +6 -2
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +23 -4
- package/dist/resources/extensions/gsd/prompts/doctor-heal.md +5 -4
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +15 -2
- package/dist/resources/extensions/gsd/safety/git-checkpoint.js +11 -0
- package/dist/resources/extensions/gsd/service-tier.js +5 -2
- package/dist/resources/extensions/gsd/session-lock.js +19 -10
- package/dist/resources/extensions/gsd/skill-manifest.js +168 -0
- package/dist/resources/extensions/gsd/slice-cadence.js +238 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +278 -8
- package/dist/resources/extensions/gsd/state-transition-matrix.js +118 -0
- package/dist/resources/extensions/gsd/state.js +69 -58
- package/dist/resources/extensions/gsd/sync-lock.js +98 -42
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +7 -2
- package/dist/resources/extensions/gsd/unit-context-composer.js +147 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +370 -0
- package/dist/resources/extensions/gsd/uok/dispatch-envelope.js +33 -0
- package/dist/resources/extensions/gsd/uok/execution-graph.js +10 -0
- package/dist/resources/extensions/gsd/uok/gate-runner.js +53 -5
- package/dist/resources/extensions/gsd/uok/gitops.js +2 -1
- package/dist/resources/extensions/gsd/uok/loop-adapter.js +37 -10
- package/dist/resources/extensions/gsd/uok/parity-report.js +58 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +10 -4
- package/dist/resources/extensions/gsd/uok/writer.js +82 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +6 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +85 -8
- package/dist/resources/extensions/gsd/worktree-resolver.js +86 -7
- package/dist/resources/extensions/gsd/worktree-telemetry.js +198 -0
- package/dist/resources/extensions/mcp-client/index.js +3 -1
- package/dist/resources/extensions/ollama/index.js +5 -1
- package/dist/resources/extensions/remote-questions/manager.js +11 -5
- 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 +12 -12
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- 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 +2 -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 +12 -12
- package/dist/web/standalone/.next/server/chunks/1926.js +1 -1
- package/dist/web/standalone/.next/server/chunks/63.js +3 -3
- package/dist/web/standalone/.next/server/chunks/6897.js +2 -2
- 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.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/static/chunks/app/_not-found/{page-f2a7482d42a5614b.js → page-2f24283c162b6ab3.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-a16c7a7ecdf0c2cf.js → layout-9ecfd95f343793f0.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-151349214571e2b6.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.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/server.js +1 -1
- package/package.json +2 -3
- package/packages/daemon/package.json +2 -2
- package/packages/daemon/src/logger.ts +4 -3
- package/packages/mcp-server/dist/server.d.ts +24 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +88 -87
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +15 -6
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/mcp-server.test.ts +25 -3
- package/packages/mcp-server/src/readers/graph.test.ts +87 -15
- package/packages/mcp-server/src/secure-env-collect.test.ts +232 -237
- package/packages/mcp-server/src/server.ts +131 -105
- package/packages/mcp-server/src/workflow-tools.test.ts +85 -0
- package/packages/mcp-server/src/workflow-tools.ts +19 -6
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +2 -2
- package/packages/native/src/__tests__/_test-coverage-guard.test.mjs +98 -0
- package/packages/native/src/__tests__/module-compat.test.mjs +59 -27
- package/packages/native/src/__tests__/ps.test.mjs +14 -8
- package/packages/native/src/__tests__/stream-process.test.mjs +23 -2
- package/packages/native/src/__tests__/truncate.test.mjs +17 -2
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +5 -15
- package/packages/pi-agent-core/src/agent.test.ts +96 -102
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/models/capability-patches.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/capability-patches.js +9 -2
- package/packages/pi-ai/dist/models/capability-patches.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/index.d.ts +34 -0
- package/packages/pi-ai/dist/models/generated/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai-codex.js +17 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/openai.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai.js +17 -0
- package/packages/pi-ai/dist/models/generated/openai.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.test.js +43 -70
- package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
- package/packages/pi-ai/dist/models.test.js +36 -11
- package/packages/pi-ai/dist/models.test.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/scripts/generate-models.ts +44 -0
- package/packages/pi-ai/src/models/capability-patches.ts +10 -2
- package/packages/pi-ai/src/models/generated/openai-codex.ts +17 -0
- package/packages/pi-ai/src/models/generated/openai.ts +17 -0
- package/packages/pi-ai/src/models.generated.test.ts +46 -73
- package/packages/pi-ai/src/models.test.ts +48 -11
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +96 -32
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-model-switch.test.js +75 -12
- package/packages/pi-coding-agent/dist/core/agent-session-model-switch.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +99 -31
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +5 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +61 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lsp-integration.test.js +30 -4
- package/packages/pi-coding-agent/dist/core/lsp/lsp-integration.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +17 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js +76 -18
- package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.js +2 -6
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js +5 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retryable-error-regex.d.ts +18 -0
- package/packages/pi-coding-agent/dist/core/retryable-error-regex.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/retryable-error-regex.js +18 -0
- package/packages/pi-coding-agent/dist/core/retryable-error-regex.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +20 -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 +16 -2
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -0
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -0
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +36 -5
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js +20 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +30 -12
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +18 -3
- 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 +125 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +105 -13
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/tests/system-prompt-skill-filter.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-skill-filter.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-skill-filter.test.js +130 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-skill-filter.test.js.map +1 -0
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +113 -37
- package/packages/pi-coding-agent/src/core/agent-session-model-switch.test.ts +89 -17
- package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +112 -43
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +58 -0
- package/packages/pi-coding-agent/src/core/lsp/lsp-integration.test.ts +35 -4
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +20 -0
- package/packages/pi-coding-agent/src/core/resource-loader-cache-reset.test.ts +93 -28
- package/packages/pi-coding-agent/src/core/retry-handler.test.ts +5 -1
- package/packages/pi-coding-agent/src/core/retry-handler.ts +2 -8
- package/packages/pi-coding-agent/src/core/retryable-error-regex.ts +18 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +35 -1
- package/packages/pi-coding-agent/src/index.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +49 -3
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.test.ts +26 -20
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +48 -9
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +146 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +20 -3
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +2 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +119 -13
- package/packages/pi-coding-agent/src/tests/system-prompt-skill-filter.test.ts +157 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +18 -8
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js +128 -17
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js.map +1 -1
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js +37 -11
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js.map +1 -1
- package/packages/pi-tui/dist/__tests__/tui.test.js +18 -30
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/input.test.js +10 -3
- package/packages/pi-tui/dist/components/__tests__/input.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/loader.test.js +53 -9
- package/packages/pi-tui/dist/components/__tests__/loader.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js +6 -2
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js.map +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +14 -0
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +19 -0
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/components/image.test.js +6 -5
- package/packages/pi-tui/dist/components/image.test.js.map +1 -1
- package/packages/pi-tui/dist/editor-component.d.ts +2 -0
- package/packages/pi-tui/dist/editor-component.d.ts.map +1 -1
- package/packages/pi-tui/dist/editor-component.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +24 -8
- package/packages/pi-tui/src/__tests__/overlay-layout.test.ts +140 -17
- package/packages/pi-tui/src/__tests__/stdin-buffer.test.ts +42 -11
- package/packages/pi-tui/src/__tests__/tui.test.ts +18 -37
- package/packages/pi-tui/src/components/__tests__/input.test.ts +19 -3
- package/packages/pi-tui/src/components/__tests__/loader.test.ts +112 -35
- package/packages/pi-tui/src/components/__tests__/markdown-maxlines.test.ts +9 -2
- package/packages/pi-tui/src/components/editor.ts +22 -0
- package/packages/pi-tui/src/components/image.test.ts +10 -5
- package/packages/pi-tui/src/editor-component.ts +3 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/dist/rpc-client.test.js +101 -51
- package/packages/rpc-client/dist/rpc-client.test.js.map +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/src/rpc-client.test.ts +109 -52
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/package.json +1 -1
- package/scripts/install.js +15 -1
- package/src/resources/extensions/browser-tools/capture.ts +12 -0
- package/src/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +8 -59
- package/src/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +36 -24
- package/src/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +69 -71
- package/src/resources/extensions/browser-tools/tools/forms.ts +5 -1
- package/src/resources/extensions/browser-tools/tools/intent.ts +5 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +5 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +518 -19
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +919 -75
- package/src/resources/extensions/github-sync/templates.ts +151 -0
- package/src/resources/extensions/github-sync/tests/cli.test.ts +76 -7
- package/src/resources/extensions/github-sync/tests/templates.test.ts +92 -1
- package/src/resources/extensions/google-search/index.ts +3 -2
- package/src/resources/extensions/gsd/auto/loop.ts +142 -2
- package/src/resources/extensions/gsd/auto/phases.ts +62 -38
- package/src/resources/extensions/gsd/auto/session.ts +7 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +156 -29
- package/src/resources/extensions/gsd/auto-model-selection.ts +131 -4
- package/src/resources/extensions/gsd/auto-post-unit.ts +163 -73
- package/src/resources/extensions/gsd/auto-prompts.ts +385 -93
- package/src/resources/extensions/gsd/auto-recovery.ts +230 -51
- package/src/resources/extensions/gsd/auto-start.ts +127 -9
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +51 -7
- package/src/resources/extensions/gsd/auto-worktree.ts +130 -26
- package/src/resources/extensions/gsd/auto.ts +90 -23
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +20 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +221 -0
- package/src/resources/extensions/gsd/bootstrap/provider-error-resume.ts +3 -7
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +7 -3
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +158 -9
- package/src/resources/extensions/gsd/component-loader.ts +598 -0
- package/src/resources/extensions/gsd/component-types.ts +362 -0
- package/src/resources/extensions/gsd/context-store.ts +25 -8
- package/src/resources/extensions/gsd/detection.ts +58 -1
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -20
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/src/resources/extensions/gsd/forensics.ts +118 -1
- package/src/resources/extensions/gsd/gate-registry.ts +2 -2
- package/src/resources/extensions/gsd/git-constants.ts +30 -1
- package/src/resources/extensions/gsd/git-self-heal.ts +31 -0
- package/src/resources/extensions/gsd/git-service.ts +149 -2
- package/src/resources/extensions/gsd/gsd-db.ts +6 -3
- package/src/resources/extensions/gsd/guided-flow.ts +57 -14
- package/src/resources/extensions/gsd/journal.ts +11 -1
- package/src/resources/extensions/gsd/memory-extractor.ts +11 -3
- package/src/resources/extensions/gsd/milestone-scope-classifier.ts +366 -0
- package/src/resources/extensions/gsd/milestone-summary-classifier.ts +42 -0
- package/src/resources/extensions/gsd/model-cost-table.ts +3 -0
- package/src/resources/extensions/gsd/model-router.ts +6 -0
- package/src/resources/extensions/gsd/native-git-bridge.ts +34 -4
- package/src/resources/extensions/gsd/preferences-validation.ts +21 -0
- package/src/resources/extensions/gsd/prompt-cache-optimizer.ts +4 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +6 -2
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +23 -4
- package/src/resources/extensions/gsd/prompts/doctor-heal.md +5 -4
- package/src/resources/extensions/gsd/prompts/plan-slice.md +15 -2
- package/src/resources/extensions/gsd/safety/git-checkpoint.ts +15 -0
- package/src/resources/extensions/gsd/service-tier.ts +5 -2
- package/src/resources/extensions/gsd/session-lock.ts +20 -10
- package/src/resources/extensions/gsd/skill-manifest.ts +175 -0
- package/src/resources/extensions/gsd/slice-cadence.ts +299 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +309 -8
- package/src/resources/extensions/gsd/state-transition-matrix.ts +152 -0
- package/src/resources/extensions/gsd/state.ts +76 -66
- package/src/resources/extensions/gsd/sync-lock.ts +97 -39
- package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +270 -0
- package/src/resources/extensions/gsd/tests/artifacts-table-preserved-on-cache-invalidate.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +341 -0
- package/src/resources/extensions/gsd/tests/auto-discuss-milestone-deadlock-4973.test.ts +264 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +133 -292
- package/src/resources/extensions/gsd/tests/auto-model-selection-tool-poisoning.test.ts +742 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +61 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/auto-remediate-slice-status.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +8 -194
- package/src/resources/extensions/gsd/tests/auto-start-clean-runtime-db-gated.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/auto-start-cold-db-bootstrap.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-start-needs-discussion.test.ts +15 -58
- package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-thinking-restore.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/cache-staleness-regression.test.ts +17 -21
- package/src/resources/extensions/gsd/tests/canonical-milestone-root.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +263 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/complete-slice-composer.test.ts +192 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +16 -8
- package/src/resources/extensions/gsd/tests/component-loader.test.ts +589 -0
- package/src/resources/extensions/gsd/tests/component-types.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/context-store.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/copy-planning-artifacts-samepath.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/crash-recovery.test.ts +50 -1
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +159 -0
- package/src/resources/extensions/gsd/tests/db-access-guardrails.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/derive-state-crossval.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/derive-state-db-disk-reconcile.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +91 -3
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/discuss-slice-structured-questions.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/empty-content-abort-loop.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/execution-entry-missing-context-4671.test.ts +173 -0
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +139 -129
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +8 -104
- package/src/resources/extensions/gsd/tests/gate-state-canonicalization.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/gate-storage.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/google-search-stub.test.ts +14 -4
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +117 -0
- package/src/resources/extensions/gsd/tests/hook-key-parsing.test.ts +4 -55
- package/src/resources/extensions/gsd/tests/integration/all-milestones-complete-merge.test.ts +7 -56
- package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-proactive.test.ts +18 -2
- package/src/resources/extensions/gsd/tests/integration/queue-completed-milestone-perf.test.ts +10 -4
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +144 -7
- package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +2 -16
- package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +9 -3
- package/src/resources/extensions/gsd/tests/interrupted-session-ui.test.ts +6 -9
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +93 -1
- package/src/resources/extensions/gsd/tests/mcp-client-security.test.ts +8 -37
- package/src/resources/extensions/gsd/tests/memory-extractor.test.ts +5 -15
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +227 -55
- package/src/resources/extensions/gsd/tests/milestone-scope-classifier.test.ts +187 -0
- package/src/resources/extensions/gsd/tests/milestone-summary-classifier.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +9 -1
- package/src/resources/extensions/gsd/tests/model-router.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +6 -48
- package/src/resources/extensions/gsd/tests/notification-widget.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +59 -2
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +273 -130
- package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +301 -0
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +32 -1
- package/src/resources/extensions/gsd/tests/preferences-worktree-sync.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/prompt-cache-optimizer.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +15 -4
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +23 -24
- package/src/resources/extensions/gsd/tests/queue-auto-guard.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/queue-draft-detection.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/queued-discuss-fast-path.test.ts +4 -5
- package/src/resources/extensions/gsd/tests/ready-phrase-no-files-4573.test.ts +75 -2
- package/src/resources/extensions/gsd/tests/reassess-default-optin.test.ts +132 -0
- package/src/resources/extensions/gsd/tests/recovery-attempts-reset.test.ts +8 -40
- package/src/resources/extensions/gsd/tests/regex-hardening.test.ts +136 -256
- package/src/resources/extensions/gsd/tests/research-milestone-composer.test.ts +114 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/run-uat-composer.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/service-tier.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/sidecar-queue.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/silent-catch-diagnostics.test.ts +55 -95
- package/src/resources/extensions/gsd/tests/single-writer-v3-tool-surface.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +120 -1
- package/src/resources/extensions/gsd/tests/skill-manifest.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/slice-cadence.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +164 -1
- package/src/resources/extensions/gsd/tests/smart-entry-draft.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/stale-dirlistcache-4648.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +29 -5
- package/src/resources/extensions/gsd/tests/state-transition-matrix.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/stop-auto-race-null-unit.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/structured-data-formatter.test.ts +11 -92
- package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +7 -6
- package/src/resources/extensions/gsd/tests/survivor-branch-complete.test.ts +102 -101
- package/src/resources/extensions/gsd/tests/sync-lock.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/sync-worktree-skip-current.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/test-helpers.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/test-helpers.ts +153 -0
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +61 -1
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +355 -0
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +258 -0
- package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/uok-execution-graph.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/uok-gate-runner.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-wiring.test.ts +49 -26
- package/src/resources/extensions/gsd/tests/uok-loop-adapter-writer.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/uok-parity-report.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +19 -2
- package/src/resources/extensions/gsd/tests/uok-writer.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/verify-artifact-tightened.test.ts +144 -80
- package/src/resources/extensions/gsd/tests/visualizer-critical-path.test.ts +20 -54
- package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +342 -277
- package/src/resources/extensions/gsd/tests/worker-model-override.test.ts +37 -29
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +226 -266
- package/src/resources/extensions/gsd/tests/worktree-health-monorepo.test.ts +103 -67
- package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +92 -90
- package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +238 -59
- package/src/resources/extensions/gsd/tests/worktree-sync-overwrite-loop.test.ts +113 -161
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +210 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +262 -0
- package/src/resources/extensions/gsd/tests/write-gate-predicates.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +7 -5
- package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +80 -96
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +8 -2
- package/src/resources/extensions/gsd/types.ts +3 -3
- package/src/resources/extensions/gsd/unit-context-composer.ts +218 -0
- package/src/resources/extensions/gsd/unit-context-manifest.ts +574 -0
- package/src/resources/extensions/gsd/uok/contracts.ts +65 -0
- package/src/resources/extensions/gsd/uok/dispatch-envelope.ts +56 -0
- package/src/resources/extensions/gsd/uok/execution-graph.ts +22 -0
- package/src/resources/extensions/gsd/uok/gate-runner.ts +65 -5
- package/src/resources/extensions/gsd/uok/gitops.ts +6 -1
- package/src/resources/extensions/gsd/uok/loop-adapter.ts +45 -10
- package/src/resources/extensions/gsd/uok/parity-report.ts +84 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +13 -5
- package/src/resources/extensions/gsd/uok/writer.ts +113 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +6 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +108 -7
- package/src/resources/extensions/gsd/worktree-resolver.ts +96 -9
- package/src/resources/extensions/gsd/worktree-telemetry.ts +322 -0
- package/src/resources/extensions/mcp-client/index.ts +3 -1
- package/src/resources/extensions/mcp-client/tests/server-name-spaces.test.ts +70 -36
- package/src/resources/extensions/ollama/index.ts +5 -1
- package/src/resources/extensions/ollama/ollama-auth-mode.test.ts +123 -15
- package/src/resources/extensions/ollama/ollama-status-indicator.test.ts +206 -19
- package/src/resources/extensions/remote-questions/manager.ts +36 -4
- package/src/resources/extensions/remote-questions/tests/command-polling.test.ts +200 -190
- package/src/resources/extensions/shared/tests/interview-preview.test.ts +11 -3
- package/src/resources/extensions/voice/tests/linux-ready.test.ts +129 -113
- package/dist/web/standalone/.next/static/chunks/app/page-5b113fd32bc2a1c3.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +0 -1
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts +0 -2
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts.map +0 -1
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js +0 -289
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js.map +0 -1
- package/packages/pi-ai/src/utils/oauth/oauth-providers.test.ts +0 -363
- package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +0 -143
- package/src/resources/extensions/gsd/tests/complete-milestone-false-merge.test.ts +0 -157
- package/src/resources/extensions/gsd/tests/dashboard-model-label-ordering.test.ts +0 -107
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed.test.ts +0 -48
- package/src/resources/extensions/gsd/tests/forensics-context-persist.test.ts +0 -159
- package/src/resources/extensions/gsd/tests/forensics-db-completion.test.ts +0 -96
- package/src/resources/extensions/gsd/tests/forensics-dedup.test.ts +0 -79
- package/src/resources/extensions/gsd/tests/forensics-hook-key-parse.test.ts +0 -74
- package/src/resources/extensions/gsd/tests/forensics-journal.test.ts +0 -162
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell.test.ts +0 -38
- package/src/resources/extensions/gsd/tests/gsd-no-project-error.test.ts +0 -73
- package/src/resources/extensions/gsd/tests/idle-watchdog-stall-override.test.ts +0 -125
- package/src/resources/extensions/gsd/tests/import-done-milestones.test.ts +0 -42
- /package/dist/web/standalone/.next/static/{5wbu35_C2_MQ3Jj1lEVDx → C1zT2kEfoLhDdbWPWKrXd}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{5wbu35_C2_MQ3Jj1lEVDx → C1zT2kEfoLhDdbWPWKrXd}/_ssgManifest.js +0 -0
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { EventStream } from "@gsd/pi-ai";
|
|
11
11
|
import { execSync } from "node:child_process";
|
|
12
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
13
|
+
import { homedir } from "node:os";
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
12
16
|
import { PartialMessageBuilder, ZERO_USAGE, mapUsage } from "./partial-builder.js";
|
|
13
17
|
import { buildWorkflowMcpServers } from "../gsd/workflow-mcp.js";
|
|
14
18
|
import { showInterviewRound } from "../shared/tui.js";
|
|
@@ -45,32 +49,81 @@ export function getResultErrorMessage(result) {
|
|
|
45
49
|
// ---------------------------------------------------------------------------
|
|
46
50
|
// Claude binary resolution
|
|
47
51
|
// ---------------------------------------------------------------------------
|
|
48
|
-
/** Cached result of the
|
|
52
|
+
/** Cached result of the Claude executable/script resolution so lookup runs once per process. */
|
|
49
53
|
let cachedClaudePath = null;
|
|
54
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
50
55
|
/** Return the shell command used to locate the `claude` binary on the given platform. */
|
|
51
56
|
export function getClaudeLookupCommand(platform = process.platform) {
|
|
52
57
|
return platform === "win32" ? "where claude" : "which claude";
|
|
53
58
|
}
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Pick the most suitable path from `which`/`where` output.
|
|
61
|
+
*
|
|
62
|
+
* On Windows, `where claude` can return shim entries first (for example
|
|
63
|
+
* `...\\npm\\claude` / `...\\npm\\claude.cmd`) that the Claude Agent SDK treats
|
|
64
|
+
* as a native executable path and then fails to spawn. Prefer a native
|
|
65
|
+
* `.exe` candidate when present.
|
|
66
|
+
*/
|
|
67
|
+
export function parseClaudeLookupOutput(output, platform = process.platform) {
|
|
68
|
+
const lines = output
|
|
57
69
|
.toString()
|
|
58
|
-
.
|
|
59
|
-
.
|
|
70
|
+
.split(/\r?\n/)
|
|
71
|
+
.map((line) => line.trim())
|
|
72
|
+
.filter(Boolean);
|
|
73
|
+
if (lines.length === 0)
|
|
74
|
+
return "";
|
|
75
|
+
if (platform !== "win32")
|
|
76
|
+
return lines[0] ?? "";
|
|
77
|
+
const exeCandidate = lines.find((line) => /\.exe$/i.test(line));
|
|
78
|
+
if (exeCandidate)
|
|
79
|
+
return exeCandidate;
|
|
80
|
+
const cmdCandidate = lines.find((line) => /\.cmd$/i.test(line));
|
|
81
|
+
if (cmdCandidate)
|
|
82
|
+
return cmdCandidate;
|
|
83
|
+
return lines[0] ?? "";
|
|
84
|
+
}
|
|
85
|
+
/** Resolve the SDK-bundled cli.js path if available. */
|
|
86
|
+
export function resolveBundledClaudeCliPath() {
|
|
87
|
+
try {
|
|
88
|
+
const sdkEntry = requireFromHere.resolve("@anthropic-ai/claude-agent-sdk");
|
|
89
|
+
const cliPath = join(dirname(sdkEntry), "cli.js");
|
|
90
|
+
return existsSync(cliPath) ? cliPath : null;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
60
95
|
}
|
|
61
96
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
97
|
+
* Normalize a discovered path for Claude Agent SDK consumption.
|
|
98
|
+
*
|
|
99
|
+
* On Windows, the SDK treats non-`.js` paths as native binaries. NPM shims
|
|
100
|
+
* like `claude`/`claude.cmd` are not native binaries and can fail with
|
|
101
|
+
* `ENOENT`/`EINVAL` in that mode. When no `.exe` is available, prefer the
|
|
102
|
+
* SDK-bundled `cli.js` so the SDK runs via Node.
|
|
65
103
|
*/
|
|
104
|
+
export function normalizeClaudePathForSdk(resolvedPath, platform = process.platform, bundledCliPath = resolveBundledClaudeCliPath()) {
|
|
105
|
+
if (platform !== "win32")
|
|
106
|
+
return resolvedPath;
|
|
107
|
+
if (/\.exe$/i.test(resolvedPath))
|
|
108
|
+
return resolvedPath;
|
|
109
|
+
if (bundledCliPath)
|
|
110
|
+
return bundledCliPath;
|
|
111
|
+
return resolvedPath;
|
|
112
|
+
}
|
|
113
|
+
/** Resolve the path passed to `pathToClaudeCodeExecutable`. */
|
|
66
114
|
function getClaudePath() {
|
|
67
115
|
if (cachedClaudePath)
|
|
68
116
|
return cachedClaudePath;
|
|
117
|
+
const fallback = process.platform === "win32"
|
|
118
|
+
? (resolveBundledClaudeCliPath() ?? "claude.cmd")
|
|
119
|
+
: "claude";
|
|
69
120
|
try {
|
|
70
|
-
|
|
121
|
+
const lookupOutput = execSync(getClaudeLookupCommand(), { timeout: 5_000, stdio: "pipe" });
|
|
122
|
+
const parsed = parseClaudeLookupOutput(lookupOutput, process.platform);
|
|
123
|
+
cachedClaudePath = normalizeClaudePathForSdk(parsed || fallback, process.platform);
|
|
71
124
|
}
|
|
72
125
|
catch {
|
|
73
|
-
cachedClaudePath =
|
|
126
|
+
cachedClaudePath = fallback;
|
|
74
127
|
}
|
|
75
128
|
return cachedClaudePath;
|
|
76
129
|
}
|
|
@@ -433,6 +486,408 @@ async function promptTextInputElicitation(request, fields, ui, signal) {
|
|
|
433
486
|
}
|
|
434
487
|
return { action: "accept", content };
|
|
435
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* Known CLI tools where the subcommand verb changes the risk profile.
|
|
491
|
+
* Value = number of subcommand tokens (beyond the executable) to capture
|
|
492
|
+
* in the "Always Allow" permission pattern.
|
|
493
|
+
*
|
|
494
|
+
* `git push` and `git log` are very different → depth 1 → `Bash(git push:*)`
|
|
495
|
+
* `gh pr create` and `gh pr list` differ at depth 2 → `Bash(gh pr create:*)`
|
|
496
|
+
* `ping` is always safe → not listed → `Bash(ping:*)`
|
|
497
|
+
*/
|
|
498
|
+
const SUBCOMMAND_DEPTH = {
|
|
499
|
+
git: 1,
|
|
500
|
+
gh: 2,
|
|
501
|
+
npm: 1,
|
|
502
|
+
npx: 1,
|
|
503
|
+
yarn: 1,
|
|
504
|
+
pnpm: 1,
|
|
505
|
+
docker: 1,
|
|
506
|
+
kubectl: 1,
|
|
507
|
+
aws: 2,
|
|
508
|
+
az: 2,
|
|
509
|
+
gcloud: 2,
|
|
510
|
+
cargo: 1,
|
|
511
|
+
pip: 1,
|
|
512
|
+
pip3: 1,
|
|
513
|
+
brew: 1,
|
|
514
|
+
terraform: 1,
|
|
515
|
+
helm: 1,
|
|
516
|
+
dotnet: 1,
|
|
517
|
+
};
|
|
518
|
+
/** Command wrappers to skip when extracting the base executable. */
|
|
519
|
+
const CMD_PASSTHROUGH = new Set(["sudo", "env", "command"]);
|
|
520
|
+
/**
|
|
521
|
+
* Build a smart permission pattern for Bash "Always Allow".
|
|
522
|
+
*
|
|
523
|
+
* Simple commands → `Bash(ping:*)` (any args are fine)
|
|
524
|
+
* Subcommand-sensitive CLIs → `Bash(git push:*)` (verb is captured, args wildcarded)
|
|
525
|
+
*/
|
|
526
|
+
export function buildBashPermissionPattern(command) {
|
|
527
|
+
// When the command is a chain like "cd /foo && gh pr list", extract the
|
|
528
|
+
// last segment — `cd` is just setup, the meaningful operation is what follows.
|
|
529
|
+
const segments = command.split(/\s*(?:&&|\|\||;)\s*/);
|
|
530
|
+
// Skip leading `cd` (directory setup) and trailing error suppressors
|
|
531
|
+
// like `|| true`, `|| :`, `|| echo ...`. The meaningful command is
|
|
532
|
+
// the first segment that is *neither* of those.
|
|
533
|
+
const SETUP_RE = /^\s*cd\s/;
|
|
534
|
+
const SUPPRESSOR_RE = /^\s*(?:true|:|echo\b)/;
|
|
535
|
+
let meaningful;
|
|
536
|
+
if (segments.length > 1) {
|
|
537
|
+
// Strip suppressors, then strip cd prefixes; take the *last* remaining
|
|
538
|
+
// segment — that's the meaningful command.
|
|
539
|
+
const trimmed = segments.filter(s => !SUPPRESSOR_RE.test(s));
|
|
540
|
+
const core = trimmed.filter(s => !SETUP_RE.test(s));
|
|
541
|
+
meaningful = core.length > 0 ? core[core.length - 1] : trimmed[trimmed.length - 1];
|
|
542
|
+
}
|
|
543
|
+
meaningful = meaningful || segments[0] || command;
|
|
544
|
+
const rawTokens = meaningful.trim().split(/\s+/);
|
|
545
|
+
// Skip sudo/env wrappers and leading VAR=val assignments
|
|
546
|
+
let idx = 0;
|
|
547
|
+
while (idx < rawTokens.length) {
|
|
548
|
+
if (CMD_PASSTHROUGH.has(rawTokens[idx])) {
|
|
549
|
+
idx++;
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
if (/^[A-Za-z_]\w*=/.test(rawTokens[idx])) {
|
|
553
|
+
idx++;
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
const tokens = rawTokens.slice(idx).filter(Boolean);
|
|
559
|
+
if (tokens.length === 0)
|
|
560
|
+
return "Bash(*)";
|
|
561
|
+
// Strip path and .exe from executable name
|
|
562
|
+
const base = tokens[0].replace(/^.*[\\/]/, "").replace(/\.exe$/i, "");
|
|
563
|
+
const depth = SUBCOMMAND_DEPTH[base];
|
|
564
|
+
if (depth !== undefined) {
|
|
565
|
+
// Capture base + N subcommand tokens: "gh pr list" → Bash(gh pr list:*)
|
|
566
|
+
const significant = [base, ...tokens.slice(1, 1 + depth)].join(" ");
|
|
567
|
+
return `Bash(${significant}:*)`;
|
|
568
|
+
}
|
|
569
|
+
// Simple command — any args are fine: "ping" → Bash(ping:*)
|
|
570
|
+
return `Bash(${base}:*)`;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Build the list of granularity options presented after a user chooses
|
|
574
|
+
* "Always Allow" for a Bash command.
|
|
575
|
+
*
|
|
576
|
+
* Rather than assuming the user wants the default smart pattern, the UI
|
|
577
|
+
* shows every meaningful prefix so the user explicitly picks the scope:
|
|
578
|
+
*
|
|
579
|
+
* "gh pr list --limit 5" → [
|
|
580
|
+
* "Bash(gh:*)", // allow any gh command
|
|
581
|
+
* "Bash(gh pr:*)", // allow any gh pr subcommand
|
|
582
|
+
* "Bash(gh pr list:*)", // allow just this verb
|
|
583
|
+
* ]
|
|
584
|
+
*
|
|
585
|
+
* Flags (tokens starting with `-`) terminate the subcommand chain — they
|
|
586
|
+
* are call-site arguments, not stable verbs. Subcommand depth is capped
|
|
587
|
+
* at 3 to keep the menu short (max 4 options).
|
|
588
|
+
*
|
|
589
|
+
* Returns a single-entry list when there is no meaningful subcommand to
|
|
590
|
+
* choose from (e.g. `ls -la`). Callers can skip the second dialog in
|
|
591
|
+
* that case.
|
|
592
|
+
*/
|
|
593
|
+
export function buildBashPermissionPatternOptions(command) {
|
|
594
|
+
const segments = command.split(/\s*(?:&&|\|\||;)\s*/);
|
|
595
|
+
const SETUP_RE = /^\s*cd\s/;
|
|
596
|
+
const SUPPRESSOR_RE = /^\s*(?:true|:|echo\b)/;
|
|
597
|
+
let meaningful;
|
|
598
|
+
if (segments.length > 1) {
|
|
599
|
+
const trimmed = segments.filter(s => !SUPPRESSOR_RE.test(s));
|
|
600
|
+
const core = trimmed.filter(s => !SETUP_RE.test(s));
|
|
601
|
+
meaningful = core.length > 0 ? core[core.length - 1] : trimmed[trimmed.length - 1];
|
|
602
|
+
}
|
|
603
|
+
meaningful = meaningful || segments[0] || command;
|
|
604
|
+
const rawTokens = meaningful.trim().split(/\s+/);
|
|
605
|
+
let idx = 0;
|
|
606
|
+
while (idx < rawTokens.length) {
|
|
607
|
+
if (CMD_PASSTHROUGH.has(rawTokens[idx])) {
|
|
608
|
+
idx++;
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
if (/^[A-Za-z_]\w*=/.test(rawTokens[idx])) {
|
|
612
|
+
idx++;
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
const tokens = rawTokens.slice(idx).filter(Boolean);
|
|
618
|
+
if (tokens.length === 0)
|
|
619
|
+
return ["Bash(*)"];
|
|
620
|
+
const base = tokens[0].replace(/^.*[\\/]/, "").replace(/\.exe$/i, "");
|
|
621
|
+
// Collect up to 3 subcommand tokens, stopping at the first flag.
|
|
622
|
+
const subTokens = [];
|
|
623
|
+
for (let i = 1; i < tokens.length; i++) {
|
|
624
|
+
const t = tokens[i];
|
|
625
|
+
if (t.startsWith("-"))
|
|
626
|
+
break;
|
|
627
|
+
subTokens.push(t);
|
|
628
|
+
if (subTokens.length >= 3)
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
const patterns = [`Bash(${base}:*)`];
|
|
632
|
+
for (let i = 1; i <= subTokens.length; i++) {
|
|
633
|
+
patterns.push(`Bash(${[base, ...subTokens.slice(0, i)].join(" ")}:*)`);
|
|
634
|
+
}
|
|
635
|
+
return patterns;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Read Bash allow-rule patterns from project and user settings files.
|
|
639
|
+
*
|
|
640
|
+
* Returns the ruleContent portion (e.g. `"gh pr list:*"`) for each
|
|
641
|
+
* `Bash(...)` entry found in `permissions.allow`.
|
|
642
|
+
*/
|
|
643
|
+
function readBashAllowRulesFromSettings() {
|
|
644
|
+
const rules = [];
|
|
645
|
+
const paths = [
|
|
646
|
+
join(process.cwd(), ".claude", "settings.local.json"),
|
|
647
|
+
join(process.cwd(), ".claude", "settings.json"),
|
|
648
|
+
];
|
|
649
|
+
try {
|
|
650
|
+
paths.push(join(homedir(), ".claude", "settings.json"));
|
|
651
|
+
}
|
|
652
|
+
catch {
|
|
653
|
+
// homedir() can throw on some platforms
|
|
654
|
+
}
|
|
655
|
+
for (const settingsPath of paths) {
|
|
656
|
+
try {
|
|
657
|
+
if (!existsSync(settingsPath))
|
|
658
|
+
continue;
|
|
659
|
+
const raw = JSON.parse(readFileSync(settingsPath, "utf8"));
|
|
660
|
+
const allow = raw?.permissions?.allow;
|
|
661
|
+
if (!Array.isArray(allow))
|
|
662
|
+
continue;
|
|
663
|
+
for (const entry of allow) {
|
|
664
|
+
if (typeof entry !== "string")
|
|
665
|
+
continue;
|
|
666
|
+
const m = /^Bash\((.+)\)$/.exec(entry);
|
|
667
|
+
if (m)
|
|
668
|
+
rules.push(m[1]);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
catch {
|
|
672
|
+
// Ignore malformed settings files
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return rules;
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Check if a Bash compound command matches saved allow rules after
|
|
679
|
+
* extracting the meaningful segment.
|
|
680
|
+
*
|
|
681
|
+
* The SDK's built-in matcher refuses to match prefix rules against
|
|
682
|
+
* compound commands (e.g. `cd /path && gh pr list`). Claude Code
|
|
683
|
+
* routinely prepends `cd <cwd> &&` to commands, causing saved rules
|
|
684
|
+
* to never match on re-invocation. This function strips safe leading
|
|
685
|
+
* segments (only `cd` commands) and checks the remaining operation
|
|
686
|
+
* against saved rules.
|
|
687
|
+
*
|
|
688
|
+
* For compound commands, returns true only when all leading segments
|
|
689
|
+
* are `cd` commands and the final segment matches a saved rule.
|
|
690
|
+
* For simple (single-segment) commands, checks directly against saved
|
|
691
|
+
* rules — this covers the case where a rule was added mid-session and
|
|
692
|
+
* the SDK's in-memory cache is stale.
|
|
693
|
+
*/
|
|
694
|
+
export function bashCommandMatchesSavedRules(command) {
|
|
695
|
+
const segments = command.split(/\s*(?:&&|\|\||;)\s*/).filter(Boolean);
|
|
696
|
+
if (segments.length === 0)
|
|
697
|
+
return false;
|
|
698
|
+
let meaningful;
|
|
699
|
+
if (segments.length === 1) {
|
|
700
|
+
meaningful = segments[0].trim();
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
// Strip trailing error suppressors (|| true, || :, || echo ...)
|
|
704
|
+
// and leading cd segments. The first remaining segment is the
|
|
705
|
+
// meaningful command. All other non-cd, non-suppressor segments
|
|
706
|
+
// must be absent — otherwise we can't safely auto-approve.
|
|
707
|
+
const SETUP_RE = /^cd\s/;
|
|
708
|
+
const SUPPRESSOR_RE = /^\s*(?:true|:|echo\b)/;
|
|
709
|
+
const trimmed = segments.filter(s => !SUPPRESSOR_RE.test(s.trim()));
|
|
710
|
+
const core = trimmed.filter(s => !SETUP_RE.test(s.trim()));
|
|
711
|
+
if (core.length !== 1)
|
|
712
|
+
return false; // ambiguous — multiple real commands
|
|
713
|
+
meaningful = core[0].trim();
|
|
714
|
+
}
|
|
715
|
+
if (!meaningful)
|
|
716
|
+
return false;
|
|
717
|
+
const rules = readBashAllowRulesFromSettings();
|
|
718
|
+
if (rules.length === 0)
|
|
719
|
+
return false;
|
|
720
|
+
for (const rule of rules) {
|
|
721
|
+
const prefixMatch = /^(.+):\*$/.exec(rule);
|
|
722
|
+
if (prefixMatch) {
|
|
723
|
+
const prefix = prefixMatch[1];
|
|
724
|
+
if (meaningful === prefix || meaningful.startsWith(prefix + " ")) {
|
|
725
|
+
return true;
|
|
726
|
+
}
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
// Exact match
|
|
730
|
+
if (meaningful === rule)
|
|
731
|
+
return true;
|
|
732
|
+
}
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
/** Format the tool input into a human-readable summary for the permission prompt. */
|
|
736
|
+
function formatToolInput(toolName, input) {
|
|
737
|
+
// Bash — show the command
|
|
738
|
+
if (input.command && typeof input.command === "string") {
|
|
739
|
+
const cmd = input.command.length > 300 ? input.command.slice(0, 300) + "…" : input.command;
|
|
740
|
+
return cmd;
|
|
741
|
+
}
|
|
742
|
+
// File-oriented tools — show path
|
|
743
|
+
if (input.file_path && typeof input.file_path === "string") {
|
|
744
|
+
return `${toolName}: ${input.file_path}`;
|
|
745
|
+
}
|
|
746
|
+
// Generic fallback — compact JSON, truncated
|
|
747
|
+
const json = JSON.stringify(input);
|
|
748
|
+
if (json.length <= 200)
|
|
749
|
+
return json;
|
|
750
|
+
return json.slice(0, 200) + "…";
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Create a canUseTool handler that routes SDK permission requests through the
|
|
754
|
+
* extension UI's select dialog, or auto-approves when no UI is available.
|
|
755
|
+
*
|
|
756
|
+
* Presents three options:
|
|
757
|
+
* - **Allow** — approve this one invocation
|
|
758
|
+
* - **Always Allow** — approve and pass `suggestions` back as `updatedPermissions`
|
|
759
|
+
* so the SDK remembers the choice for the rest of the session
|
|
760
|
+
* - **Deny** — reject the invocation
|
|
761
|
+
*
|
|
762
|
+
* Follows the same pattern as {@link createClaudeCodeElicitationHandler}:
|
|
763
|
+
* takes an optional UI context and returns the callback or undefined.
|
|
764
|
+
*
|
|
765
|
+
* When UI is unavailable (headless / auto-mode sub-agents), returns a handler
|
|
766
|
+
* that always approves — replacing the old GSD_AUTO_MODE → bypassPermissions
|
|
767
|
+
* workaround.
|
|
768
|
+
*/
|
|
769
|
+
export function createClaudeCodeCanUseToolHandler(ui) {
|
|
770
|
+
if (!ui)
|
|
771
|
+
return undefined;
|
|
772
|
+
return async (toolName, _input, options) => {
|
|
773
|
+
// Abort early if the signal is already fired
|
|
774
|
+
if (options.signal.aborted) {
|
|
775
|
+
return { behavior: "deny", message: "Aborted", toolUseID: options.toolUseID };
|
|
776
|
+
}
|
|
777
|
+
// For Bash compound commands (e.g. "cd /path && gh pr list"),
|
|
778
|
+
// check if the meaningful operation matches a saved allow rule.
|
|
779
|
+
// The SDK's built-in matcher rejects prefix rules for compound
|
|
780
|
+
// commands, but cd-prefixed commands are routine and the actual
|
|
781
|
+
// operation is already approved.
|
|
782
|
+
if (toolName === "Bash" && typeof _input.command === "string") {
|
|
783
|
+
if (bashCommandMatchesSavedRules(_input.command)) {
|
|
784
|
+
return { behavior: "allow", updatedInput: _input, toolUseID: options.toolUseID };
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
const inputSummary = formatToolInput(toolName, _input);
|
|
788
|
+
const title = options.title || `Allow Claude Code to use: ${toolName}?`;
|
|
789
|
+
const body = [
|
|
790
|
+
options.description,
|
|
791
|
+
inputSummary,
|
|
792
|
+
].filter(Boolean).join("\n");
|
|
793
|
+
// The 2nd menu (level picker) lets the user choose the exact pattern,
|
|
794
|
+
// so the 1st menu just shows "Always Allow" without a command suffix.
|
|
795
|
+
const alwaysAllowLabel = "Always Allow";
|
|
796
|
+
try {
|
|
797
|
+
const choice = await ui.select(`${title}\n${body}`, ["Allow", alwaysAllowLabel, "Deny"], { signal: options.signal });
|
|
798
|
+
if (options.signal.aborted) {
|
|
799
|
+
return { behavior: "deny", message: "Aborted", toolUseID: options.toolUseID };
|
|
800
|
+
}
|
|
801
|
+
if (choice === alwaysAllowLabel) {
|
|
802
|
+
// Pass the SDK's own suggestions back as updatedPermissions so
|
|
803
|
+
// it knows how to persist them (PermissionUpdate[] shape).
|
|
804
|
+
// For Bash, patch the ruleContent with the user-chosen
|
|
805
|
+
// granularity pattern (e.g. "gh", "gh pr", "gh pr list") so
|
|
806
|
+
// the saved rule matches the scope the user actually wants.
|
|
807
|
+
let perms = options.suggestions;
|
|
808
|
+
let notifyLabel;
|
|
809
|
+
if (toolName === "Bash" && typeof _input.command === "string") {
|
|
810
|
+
// Present every meaningful prefix so the user picks the
|
|
811
|
+
// scope explicitly rather than getting a blanket match.
|
|
812
|
+
const patternOptions = buildBashPermissionPatternOptions(_input.command);
|
|
813
|
+
let chosenPattern;
|
|
814
|
+
if (patternOptions.length <= 1) {
|
|
815
|
+
// No subcommand choice to make (e.g. "ls -la") — use
|
|
816
|
+
// the single available pattern directly.
|
|
817
|
+
chosenPattern = patternOptions[0] ?? buildBashPermissionPattern(_input.command);
|
|
818
|
+
}
|
|
819
|
+
else {
|
|
820
|
+
const levelChoiceRaw = await ui.select("Save permission at which level?", patternOptions, { signal: options.signal });
|
|
821
|
+
if (options.signal.aborted) {
|
|
822
|
+
return { behavior: "deny", message: "Aborted", toolUseID: options.toolUseID };
|
|
823
|
+
}
|
|
824
|
+
const levelChoice = Array.isArray(levelChoiceRaw) ? levelChoiceRaw[0] : levelChoiceRaw;
|
|
825
|
+
if (!levelChoice || !patternOptions.includes(levelChoice)) {
|
|
826
|
+
// User dismissed the level picker — cancel the
|
|
827
|
+
// tool use. Falling back to a one-time allow
|
|
828
|
+
// here would leave the spawned agent running
|
|
829
|
+
// with no clear signal that the user bailed.
|
|
830
|
+
return {
|
|
831
|
+
behavior: "deny",
|
|
832
|
+
message: "User cancelled permission selection",
|
|
833
|
+
toolUseID: options.toolUseID,
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
chosenPattern = levelChoice;
|
|
837
|
+
}
|
|
838
|
+
notifyLabel = chosenPattern;
|
|
839
|
+
// Extract the ruleContent portion from "Bash(gh pr list:*)" → "gh pr list:*"
|
|
840
|
+
const ruleContent = chosenPattern.replace(/^Bash\(/, "").replace(/\)$/, "");
|
|
841
|
+
if (perms && Array.isArray(perms) && perms.length > 0) {
|
|
842
|
+
// Clone suggestions and patch ruleContent on any Bash addRules entry
|
|
843
|
+
perms = perms.map((s) => {
|
|
844
|
+
if (s.type === "addRules" && Array.isArray(s.rules)) {
|
|
845
|
+
return {
|
|
846
|
+
...s,
|
|
847
|
+
rules: s.rules.map((r) => r.toolName === "Bash" ? { ...r, ruleContent } : r),
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
return s;
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
// No suggestions from SDK — build a proper PermissionUpdate
|
|
855
|
+
perms = [{
|
|
856
|
+
type: "addRules",
|
|
857
|
+
rules: [{ toolName: "Bash", ruleContent }],
|
|
858
|
+
behavior: "allow",
|
|
859
|
+
destination: "localSettings",
|
|
860
|
+
}];
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
// Notify with the resolved pattern (label already previewed it)
|
|
864
|
+
if (notifyLabel) {
|
|
865
|
+
ui.notify(`Saved: ${notifyLabel}`, "info");
|
|
866
|
+
}
|
|
867
|
+
return {
|
|
868
|
+
behavior: "allow",
|
|
869
|
+
updatedInput: _input,
|
|
870
|
+
toolUseID: options.toolUseID,
|
|
871
|
+
...(perms ? { updatedPermissions: perms } : {}),
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
if (choice === "Allow") {
|
|
875
|
+
return {
|
|
876
|
+
behavior: "allow",
|
|
877
|
+
updatedInput: _input,
|
|
878
|
+
toolUseID: options.toolUseID,
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
return { behavior: "deny", message: "User denied", toolUseID: options.toolUseID };
|
|
882
|
+
}
|
|
883
|
+
catch {
|
|
884
|
+
return { behavior: "deny", message: "Aborted", toolUseID: options.toolUseID };
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
// ---------------------------------------------------------------------------
|
|
889
|
+
// Elicitation handler
|
|
890
|
+
// ---------------------------------------------------------------------------
|
|
436
891
|
/** Create an SDK elicitation handler that routes requests through the extension UI dialogs, or undefined if no UI is available. */
|
|
437
892
|
export function createClaudeCodeElicitationHandler(ui) {
|
|
438
893
|
if (!ui)
|
|
@@ -862,12 +1317,21 @@ async function pumpSdkMessages(model, context, options, stream) {
|
|
|
862
1317
|
const prompt = buildPromptFromContext(context);
|
|
863
1318
|
const queryPrompt = buildSdkQueryPrompt(context, prompt);
|
|
864
1319
|
const permissionMode = await resolveClaudePermissionMode();
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
1320
|
+
const uiContext = options?.extensionUIContext;
|
|
1321
|
+
const canUseToolHandler = createClaudeCodeCanUseToolHandler(uiContext);
|
|
1322
|
+
// When no UI is available (headless / auto-mode), auto-approve all
|
|
1323
|
+
// tool requests. This replaces the old bypassPermissions workaround.
|
|
1324
|
+
const canUseToolFallback = canUseToolHandler
|
|
1325
|
+
?? (async (_toolName, _input, opts) => ({ behavior: "allow", toolUseID: opts.toolUseID }));
|
|
1326
|
+
const sdkOpts = buildSdkOptions(modelId, prompt, { permissionMode }, {
|
|
1327
|
+
reasoning: options?.reasoning,
|
|
1328
|
+
canUseTool: canUseToolFallback,
|
|
1329
|
+
...(uiContext
|
|
1330
|
+
? {
|
|
1331
|
+
onElicitation: createClaudeCodeElicitationHandler(uiContext),
|
|
1332
|
+
}
|
|
1333
|
+
: {}),
|
|
1334
|
+
});
|
|
871
1335
|
const queryResult = sdk.query({
|
|
872
1336
|
prompt: queryPrompt,
|
|
873
1337
|
options: {
|
|
@@ -116,3 +116,106 @@ export function formatSummaryComment(data) {
|
|
|
116
116
|
}
|
|
117
117
|
return lines.join("\n");
|
|
118
118
|
}
|
|
119
|
+
export const SWARM_LANE_LABELS = {
|
|
120
|
+
workflow: "lane/workflow",
|
|
121
|
+
state: "lane/state",
|
|
122
|
+
writer: "lane/writer",
|
|
123
|
+
uok: "lane/uok",
|
|
124
|
+
github: "lane/github",
|
|
125
|
+
};
|
|
126
|
+
function checkedList(items, emptyLabel) {
|
|
127
|
+
if (!items?.length)
|
|
128
|
+
return [`- [ ] ${emptyLabel}`];
|
|
129
|
+
return items.map((item) => `- [ ] ${item}`);
|
|
130
|
+
}
|
|
131
|
+
export function formatSwarmLanePRBody(data) {
|
|
132
|
+
const lines = [];
|
|
133
|
+
const laneLabel = SWARM_LANE_LABELS[data.lane.id];
|
|
134
|
+
lines.push("## Swarm lane");
|
|
135
|
+
lines.push("");
|
|
136
|
+
lines.push(`**Lane:** \`${laneLabel}\``);
|
|
137
|
+
lines.push(`**Branch:** \`${data.lane.branch}\``);
|
|
138
|
+
if (data.lane.owner)
|
|
139
|
+
lines.push(`**Owner:** ${data.lane.owner}`);
|
|
140
|
+
if (data.lane.latestCommit)
|
|
141
|
+
lines.push(`**Latest commit:** \`${data.lane.latestCommit}\``);
|
|
142
|
+
lines.push("");
|
|
143
|
+
lines.push("## Impact area");
|
|
144
|
+
lines.push("");
|
|
145
|
+
lines.push(data.impactArea);
|
|
146
|
+
lines.push("");
|
|
147
|
+
lines.push("## Changed contracts");
|
|
148
|
+
lines.push(...checkedList(data.lane.changedContracts, "No shared contracts changed"));
|
|
149
|
+
lines.push("");
|
|
150
|
+
lines.push("## Transition risks");
|
|
151
|
+
lines.push(...checkedList(data.transitionRisks, "No transition risks identified"));
|
|
152
|
+
lines.push("");
|
|
153
|
+
lines.push("## Rollback plan");
|
|
154
|
+
lines.push(...checkedList(data.rollbackPlan, "Revert this lane PR"));
|
|
155
|
+
lines.push("");
|
|
156
|
+
lines.push("## Test evidence");
|
|
157
|
+
lines.push(...checkedList(data.lane.testEvidence, "Test evidence pending"));
|
|
158
|
+
lines.push("");
|
|
159
|
+
if (data.lane.blockers?.length) {
|
|
160
|
+
lines.push("## Blockers");
|
|
161
|
+
for (const blocker of data.lane.blockers)
|
|
162
|
+
lines.push(`- ${blocker}`);
|
|
163
|
+
lines.push("");
|
|
164
|
+
}
|
|
165
|
+
if (data.linkedIssue) {
|
|
166
|
+
lines.push(`Closes #${data.linkedIssue}`);
|
|
167
|
+
lines.push("");
|
|
168
|
+
}
|
|
169
|
+
lines.push("---");
|
|
170
|
+
lines.push("*Auto-generated by GSD GitHub Sync swarm routines*");
|
|
171
|
+
return lines.join("\n");
|
|
172
|
+
}
|
|
173
|
+
export function formatSwarmReleaseChecklistBody(data) {
|
|
174
|
+
const lines = [];
|
|
175
|
+
lines.push(`# UOK Swarm Release Checklist`);
|
|
176
|
+
lines.push("");
|
|
177
|
+
lines.push(`**Integration branch:** \`${data.integrationBranch}\``);
|
|
178
|
+
lines.push("");
|
|
179
|
+
lines.push("## Lane summary");
|
|
180
|
+
lines.push("");
|
|
181
|
+
lines.push("| Lane | Branch | Owner | Commit | Status |");
|
|
182
|
+
lines.push("|------|--------|-------|--------|--------|");
|
|
183
|
+
for (const lane of data.lanes) {
|
|
184
|
+
const owner = lane.owner ?? "";
|
|
185
|
+
const commit = lane.latestCommit ? `\`${lane.latestCommit}\`` : "";
|
|
186
|
+
const status = lane.blockers?.length ? "blocked" : "ready";
|
|
187
|
+
lines.push(`| \`${SWARM_LANE_LABELS[lane.id]}\` | \`${lane.branch}\` | ${owner} | ${commit} | ${status} |`);
|
|
188
|
+
}
|
|
189
|
+
lines.push("");
|
|
190
|
+
lines.push("## Required evidence");
|
|
191
|
+
lines.push("- [ ] Changed contracts summarized");
|
|
192
|
+
lines.push("- [ ] Transition matrix diff attached or linked");
|
|
193
|
+
lines.push("- [ ] Writer sequence proof attached or linked");
|
|
194
|
+
lines.push("- [ ] UOK parity report attached or linked");
|
|
195
|
+
lines.push("- [ ] Rollback drill evidence attached or linked");
|
|
196
|
+
lines.push("");
|
|
197
|
+
if (data.requiredChecks?.length) {
|
|
198
|
+
lines.push("## Required checks");
|
|
199
|
+
for (const check of data.requiredChecks)
|
|
200
|
+
lines.push(`- [ ] ${check}`);
|
|
201
|
+
lines.push("");
|
|
202
|
+
}
|
|
203
|
+
lines.push("## Parity report");
|
|
204
|
+
lines.push(data.parityReport ?? "Pending.");
|
|
205
|
+
lines.push("");
|
|
206
|
+
lines.push("## Rollback drill");
|
|
207
|
+
lines.push(data.rollbackDrill ?? "Pending.");
|
|
208
|
+
lines.push("");
|
|
209
|
+
lines.push("## Open risks");
|
|
210
|
+
if (data.openRisks?.length) {
|
|
211
|
+
for (const risk of data.openRisks)
|
|
212
|
+
lines.push(`- ${risk}`);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
lines.push("None.");
|
|
216
|
+
}
|
|
217
|
+
lines.push("");
|
|
218
|
+
lines.push("---");
|
|
219
|
+
lines.push("*Auto-generated by GSD GitHub Sync swarm routines*");
|
|
220
|
+
return lines.join("\n");
|
|
221
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default function (pi) {
|
|
2
2
|
pi.on("session_start", async (_event, ctx) => {
|
|
3
|
-
ctx.ui.notify("google_search
|
|
4
|
-
"
|
|
3
|
+
ctx.ui.notify("google_search is being extracted to @gsd-extensions/google-search " +
|
|
4
|
+
"(not yet published to npm). This stub will be replaced once the " +
|
|
5
|
+
"package is available. No action needed for now.", "warning");
|
|
5
6
|
});
|
|
6
7
|
}
|