gsd-pi 2.82.0-dev.ed17d078d → 3.0.0-dev.8b8d129d7
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 +93 -18
- package/dist/cli.js +20 -9
- package/dist/headless.js +9 -2
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +10 -1
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +44 -6
- package/dist/resources/extensions/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
- package/dist/resources/extensions/gsd/auto/loop.js +110 -37
- package/dist/resources/extensions/gsd/auto/orchestrator.js +12 -1
- package/dist/resources/extensions/gsd/auto/phases.js +97 -38
- package/dist/resources/extensions/gsd/auto/session.js +6 -0
- package/dist/resources/extensions/gsd/auto/workflow-kernel.js +3 -0
- package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +66 -1
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +1 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +20 -19
- package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +278 -137
- package/dist/resources/extensions/gsd/auto-prompts.js +36 -10
- package/dist/resources/extensions/gsd/auto-recovery.js +79 -14
- package/dist/resources/extensions/gsd/auto-start.js +87 -14
- package/dist/resources/extensions/gsd/auto-timers.js +11 -3
- package/dist/resources/extensions/gsd/auto-verification.js +102 -34
- package/dist/resources/extensions/gsd/auto-worktree.js +178 -11
- package/dist/resources/extensions/gsd/auto.js +98 -54
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +31 -7
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +10 -9
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +5 -4
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +24 -9
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +10 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +38 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +20 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +2 -0
- package/dist/resources/extensions/gsd/commands-mcp-status.js +9 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +7 -2
- package/dist/resources/extensions/gsd/commands-verdict.js +139 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +43 -5
- package/dist/resources/extensions/gsd/db/milestone-leases.js +24 -0
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
- package/dist/resources/extensions/gsd/db-base-schema.js +2 -0
- package/dist/resources/extensions/gsd/db-migration-steps.js +4 -0
- package/dist/resources/extensions/gsd/db-task-slice-rows.js +2 -0
- package/dist/resources/extensions/gsd/dispatch-guard.js +46 -2
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +8 -0
- package/dist/resources/extensions/gsd/doctor-git-checks.js +46 -1
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
- package/dist/resources/extensions/gsd/doctor.js +2 -28
- package/dist/resources/extensions/gsd/export-html.js +27 -425
- package/dist/resources/extensions/gsd/forensics.js +8 -3
- package/dist/resources/extensions/gsd/git-service.js +138 -10
- package/dist/resources/extensions/gsd/gsd-db.js +76 -33
- package/dist/resources/extensions/gsd/guided-flow-queue.js +4 -3
- package/dist/resources/extensions/gsd/guided-flow.js +110 -117
- package/dist/resources/extensions/gsd/guided-unit-context.js +23 -0
- package/dist/resources/extensions/gsd/init-wizard.js +17 -2
- package/dist/resources/extensions/gsd/markdown-renderer.js +10 -8
- package/dist/resources/extensions/gsd/mcp-filter.js +58 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/migration-auto-check.js +12 -17
- package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
- package/dist/resources/extensions/gsd/native-git-bridge.js +57 -14
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +3 -0
- package/dist/resources/extensions/gsd/paths.js +4 -0
- package/dist/resources/extensions/gsd/pending-auto-start.js +52 -0
- package/dist/resources/extensions/gsd/planning-path-scope.js +9 -3
- package/dist/resources/extensions/gsd/post-execution-checks.js +73 -9
- package/dist/resources/extensions/gsd/pre-execution-checks.js +38 -11
- package/dist/resources/extensions/gsd/preferences-mcp.js +19 -0
- package/dist/resources/extensions/gsd/preferences-types.js +2 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +138 -0
- package/dist/resources/extensions/gsd/preferences.js +2 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/dist/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/dist/resources/extensions/gsd/prompts/forensics.md +3 -3
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/dist/resources/extensions/gsd/prompts/queue.md +4 -4
- package/dist/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/queue-reorder-ui.js +30 -13
- package/dist/resources/extensions/gsd/repository-registry.js +44 -0
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +2 -0
- package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +42 -18
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +59 -2
- package/dist/resources/extensions/gsd/smart-entry-routing.js +36 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +9 -14
- package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +19 -24
- package/dist/resources/extensions/gsd/state.js +14 -4
- package/dist/resources/extensions/gsd/status-guards.js +14 -2
- package/dist/resources/extensions/gsd/templates/plan.md +9 -5
- package/dist/resources/extensions/gsd/templates/task-plan.md +10 -2
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -8
- package/dist/resources/extensions/gsd/tools/complete-slice.js +6 -8
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +151 -15
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +119 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +36 -17
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +142 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/workflow-manifest.js +2 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +17 -1
- package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +54 -10
- package/dist/resources/extensions/gsd/worktree-manager.js +1 -1
- package/dist/resources/extensions/gsd/worktree-state-projection.js +31 -0
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- package/dist/resources/extensions/shared/interview-ui.js +6 -4
- package/dist/resources/extensions/subagent/index.js +448 -78
- package/dist/resources/extensions/subagent/launch.js +77 -0
- package/dist/resources/extensions/subagent/run-store.js +148 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.js +3 -1
- package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
- package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/dist/resources/extensions/visual-brief/index.js +5 -0
- package/dist/resources/extensions/visual-brief/page-contract.js +124 -0
- package/dist/resources/extensions/visual-brief/prompts.js +140 -0
- package/dist/resources/skills/forensics/SKILL.md +1 -1
- 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 +9 -9
- 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/react-loadable-manifest.json +5 -5
- 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.js.nft.json +1 -1
- 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 +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
- 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 +4 -5
- 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 +2 -5
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -7
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -7
- 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 +4 -5
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +9 -9
- package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- 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/2973.33f26573894b6153.js +2 -0
- package/dist/web/standalone/.next/static/chunks/8359.65b24fac92188a6b.js +10 -0
- package/dist/web/standalone/.next/static/chunks/9441.ff70bb53f6835771.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-855d616060cb6e59.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +4 -4
- package/packages/contracts/dist/rpc.test.js +7 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +21 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +24 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/src/rpc.test.ts +8 -0
- package/packages/contracts/src/workflow.ts +24 -0
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/README.md +13 -4
- package/packages/mcp-server/dist/workflow-tools.d.ts +0 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +80 -0
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/workflow-tools.test.ts +23 -1
- package/packages/mcp-server/src/workflow-tools.ts +168 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/native/tsconfig.json +2 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +5 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.js +41 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +5 -6
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.test.ts +49 -0
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +7 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
- package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
- package/packages/pi-ai/src/providers/simple-options.ts +5 -6
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +44 -3
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +6 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +7 -2
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js +14 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +24 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +71 -97
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +7 -7
- 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 +11 -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-ordering.test.js +25 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +2 -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 +24 -10
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +53 -3
- package/packages/pi-coding-agent/src/core/compaction/compaction.test.ts +23 -1
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +7 -2
- package/packages/pi-coding-agent/src/core/sdk.ts +1 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +23 -7
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +75 -102
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +15 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +9 -9
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +30 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +29 -10
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/terminal.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.js +103 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +45 -2
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/terminal.d.ts +2 -0
- package/packages/pi-tui/dist/terminal.d.ts.map +1 -1
- package/packages/pi-tui/dist/terminal.js +12 -0
- package/packages/pi-tui/dist/terminal.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +106 -27
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/terminal.test.ts +121 -0
- package/packages/pi-tui/src/__tests__/tui.test.ts +59 -2
- package/packages/pi-tui/src/terminal.ts +11 -0
- package/packages/pi-tui/src/tui.ts +108 -27
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +10 -1
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +52 -6
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +49 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +17 -6
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +111 -38
- package/src/resources/extensions/gsd/auto/orchestrator.ts +12 -1
- package/src/resources/extensions/gsd/auto/phases.ts +115 -49
- package/src/resources/extensions/gsd/auto/session.ts +16 -0
- package/src/resources/extensions/gsd/auto/types.ts +3 -0
- package/src/resources/extensions/gsd/auto/workflow-kernel.ts +5 -1
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +72 -1
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +1 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +21 -19
- package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +312 -148
- package/src/resources/extensions/gsd/auto-prompts.ts +36 -13
- package/src/resources/extensions/gsd/auto-recovery.ts +83 -11
- package/src/resources/extensions/gsd/auto-start.ts +94 -12
- package/src/resources/extensions/gsd/auto-timers.ts +10 -3
- package/src/resources/extensions/gsd/auto-verification.ts +124 -42
- package/src/resources/extensions/gsd/auto-worktree.ts +195 -11
- package/src/resources/extensions/gsd/auto.ts +91 -42
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +42 -7
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +10 -9
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +5 -4
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +27 -10
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +10 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +41 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +21 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +2 -0
- package/src/resources/extensions/gsd/commands-mcp-status.ts +8 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +8 -3
- package/src/resources/extensions/gsd/commands-verdict.ts +202 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +44 -4
- package/src/resources/extensions/gsd/db/milestone-leases.ts +26 -0
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
- package/src/resources/extensions/gsd/db-base-schema.ts +2 -0
- package/src/resources/extensions/gsd/db-migration-steps.ts +5 -0
- package/src/resources/extensions/gsd/db-task-slice-rows.ts +4 -0
- package/src/resources/extensions/gsd/dispatch-guard.ts +60 -2
- package/src/resources/extensions/gsd/docs/preferences-reference.md +8 -0
- package/src/resources/extensions/gsd/doctor-git-checks.ts +45 -1
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor-types.ts +1 -0
- package/src/resources/extensions/gsd/doctor.ts +2 -27
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/forensics.ts +7 -3
- package/src/resources/extensions/gsd/git-service.ts +166 -11
- package/src/resources/extensions/gsd/gsd-db.ts +80 -31
- package/src/resources/extensions/gsd/guided-flow-queue.ts +4 -3
- package/src/resources/extensions/gsd/guided-flow.ts +142 -134
- package/src/resources/extensions/gsd/guided-unit-context.ts +30 -0
- package/src/resources/extensions/gsd/init-wizard.ts +17 -2
- package/src/resources/extensions/gsd/journal.ts +8 -1
- package/src/resources/extensions/gsd/markdown-renderer.ts +10 -8
- package/src/resources/extensions/gsd/mcp-filter.ts +80 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/migration-auto-check.ts +15 -23
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
- package/src/resources/extensions/gsd/native-git-bridge.ts +63 -14
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +3 -0
- package/src/resources/extensions/gsd/paths.ts +5 -0
- package/src/resources/extensions/gsd/pending-auto-start.ts +79 -0
- package/src/resources/extensions/gsd/planning-path-scope.ts +10 -2
- package/src/resources/extensions/gsd/post-execution-checks.ts +87 -12
- package/src/resources/extensions/gsd/pre-execution-checks.ts +49 -11
- package/src/resources/extensions/gsd/preferences-mcp.ts +27 -0
- package/src/resources/extensions/gsd/preferences-types.ts +33 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +145 -0
- package/src/resources/extensions/gsd/preferences.ts +5 -0
- package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/src/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/src/resources/extensions/gsd/prompts/forensics.md +3 -3
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/src/resources/extensions/gsd/prompts/queue.md +4 -4
- package/src/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/queue-reorder-ui.ts +31 -13
- package/src/resources/extensions/gsd/repository-registry.ts +77 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +2 -0
- package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +54 -19
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +52 -1
- package/src/resources/extensions/gsd/smart-entry-routing.ts +77 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +12 -15
- package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +17 -25
- package/src/resources/extensions/gsd/state.ts +15 -4
- package/src/resources/extensions/gsd/status-guards.ts +16 -2
- package/src/resources/extensions/gsd/templates/plan.md +9 -5
- package/src/resources/extensions/gsd/templates/task-plan.md +10 -2
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +300 -1
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +174 -8
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +151 -12
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +53 -2
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +18 -6
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +129 -6
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-stop-notification.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +32 -4
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +378 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +5 -9
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +86 -2
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/db-task-slice-rows.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +61 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/doctor-empty-worktree.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/doctor-forensics-db-open-regression.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +97 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/gsdroot-worktree-detection.test.ts +5 -2
- package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +59 -11
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/guided-tool-contract.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +7 -7
- package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +199 -2
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +49 -3
- package/src/resources/extensions/gsd/tests/journal.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/mcp-filter.test.ts +287 -0
- package/src/resources/extensions/gsd/tests/mcp-status.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +26 -18
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +80 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/parallel-orchestrator-zombie-cleanup.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
- package/src/resources/extensions/gsd/tests/pending-autostart-scope.test.ts +29 -5
- package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +343 -3
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +18 -1
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -3
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +84 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/preferences-mcp.test.ts +128 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +37 -1
- package/src/resources/extensions/gsd/tests/quality-gates.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/queue-reorder-ui.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +89 -2
- package/src/resources/extensions/gsd/tests/repository-registry.test.ts +52 -0
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +2 -3
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +72 -1
- package/src/resources/extensions/gsd/tests/smart-entry-routing.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +53 -2
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +119 -23
- package/src/resources/extensions/gsd/tests/status-guards.test.ts +17 -1
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +128 -9
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +111 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +29 -2
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +42 -1
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +173 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-kernel.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +19 -1
- package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/worktree-preferences-sync.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +59 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +8 -10
- package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -8
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
- package/src/resources/extensions/gsd/tools/plan-slice.ts +172 -12
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +135 -0
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +51 -18
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +170 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-manifest.ts +2 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +18 -1
- package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +61 -10
- package/src/resources/extensions/gsd/worktree-manager.ts +1 -1
- package/src/resources/extensions/gsd/worktree-state-projection.ts +43 -0
- package/src/resources/extensions/shared/html-shell.ts +412 -0
- package/src/resources/extensions/shared/interview-ui.ts +6 -4
- package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +15 -0
- package/src/resources/extensions/subagent/index.ts +567 -103
- package/src/resources/extensions/subagent/launch.ts +131 -0
- package/src/resources/extensions/subagent/run-store.ts +218 -0
- package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
- package/src/resources/extensions/ttsr/ttsr-manager.ts +5 -1
- package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
- package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/src/resources/extensions/visual-brief/index.ts +8 -0
- package/src/resources/extensions/visual-brief/page-contract.ts +136 -0
- package/src/resources/extensions/visual-brief/prompts.ts +183 -0
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +212 -0
- package/src/resources/skills/forensics/SKILL.md +1 -1
- package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/8359.e059d86b255fce1c.js +0 -10
- package/dist/web/standalone/.next/static/chunks/9441.1081da1125d1764f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
- package/dist/web/standalone/.next/static/css/54ec2745c1da488b.css +0 -1
- package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
- package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- /package/dist/web/standalone/.next/static/{YEvjuT-fsFfYQhDSWtueS → _kljR-_Miq_YV1IW0wpRO}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{YEvjuT-fsFfYQhDSWtueS → _kljR-_Miq_YV1IW0wpRO}/_ssgManifest.js +0 -0
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
import {
|
|
59
59
|
writeLock,
|
|
60
60
|
clearLock,
|
|
61
|
+
clearStaleWorkerLock,
|
|
61
62
|
readCrashLock,
|
|
62
63
|
isLockProcessAlive,
|
|
63
64
|
formatCrashInfo,
|
|
@@ -240,7 +241,7 @@ import { runAutoLoopWithUok } from "./uok/kernel.js";
|
|
|
240
241
|
import { resolveUokFlags } from "./uok/flags.js";
|
|
241
242
|
import { validateDirectory } from "./validate-directory.js";
|
|
242
243
|
import { createAutoOrchestrator } from "./auto/orchestrator.js";
|
|
243
|
-
import type { AutoOrchestrationModule, AutoOrchestratorDeps, DispatchAdapter } from "./auto/contracts.js";
|
|
244
|
+
import type { AutoAdvanceResult, AutoOrchestrationModule, AutoOrchestratorDeps, DispatchAdapter } from "./auto/contracts.js";
|
|
244
245
|
import { reconcileBeforeDispatch } from "./state-reconciliation.js";
|
|
245
246
|
import { compileUnitToolContract } from "./tool-contract.js";
|
|
246
247
|
import { createWorktreeSafetyModule } from "./worktree-safety.js";
|
|
@@ -283,6 +284,7 @@ import type {
|
|
|
283
284
|
UnitRouting,
|
|
284
285
|
StartModel,
|
|
285
286
|
AutoSession,
|
|
287
|
+
PendingOrchestrationDispatch,
|
|
286
288
|
} from "./auto/session.js";
|
|
287
289
|
export {
|
|
288
290
|
STUB_RECOVERY_THRESHOLD,
|
|
@@ -316,6 +318,13 @@ import { normalizeRealPath } from "./paths.js";
|
|
|
316
318
|
/** Throttle STATE.md rebuilds — at most once per 30 seconds */
|
|
317
319
|
const STATE_REBUILD_MIN_INTERVAL_MS = 30_000;
|
|
318
320
|
|
|
321
|
+
export function formatAutoStopNotification(prefix: string, totals: { cost: number; tokens: { total: number } }, unitCount: number): string {
|
|
322
|
+
return [
|
|
323
|
+
`${prefix}.`,
|
|
324
|
+
`Session: ${formatCost(totals.cost)} · ${formatTokenCount(totals.tokens.total)} tokens · ${unitCount} units`,
|
|
325
|
+
].join("\n");
|
|
326
|
+
}
|
|
327
|
+
|
|
319
328
|
/**
|
|
320
329
|
* Phase B — register this auto-mode process in the workers table so other
|
|
321
330
|
* workers and janitors can detect liveness via heartbeat. Best-effort: if
|
|
@@ -1021,6 +1030,8 @@ export async function rerootCommandSession(
|
|
|
1021
1030
|
}
|
|
1022
1031
|
|
|
1023
1032
|
export async function cleanupAfterLoopExit(ctx: ExtensionContext): Promise<void> {
|
|
1033
|
+
const preserveStepSurface = s.preserveStepSurfaceAfterLoopExit;
|
|
1034
|
+
const preservePausedSurface = s.paused;
|
|
1024
1035
|
s.currentUnit = null;
|
|
1025
1036
|
s.active = false;
|
|
1026
1037
|
deactivateGSD();
|
|
@@ -1043,21 +1054,24 @@ export async function cleanupAfterLoopExit(ctx: ExtensionContext): Promise<void>
|
|
|
1043
1054
|
// A transient provider-error pause intentionally leaves the paused badge
|
|
1044
1055
|
// visible so the user still has a resumable auto-mode signal on screen.
|
|
1045
1056
|
if (!s.paused) {
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1057
|
+
if (preserveStepSurface) {
|
|
1058
|
+
s.preserveStepSurfaceAfterLoopExit = false;
|
|
1059
|
+
} else {
|
|
1060
|
+
ctx.ui.setStatus("gsd-auto", undefined);
|
|
1061
|
+
ctx.ui.setWidget("gsd-progress", undefined);
|
|
1062
|
+
if (s.completionStopInProgress) {
|
|
1063
|
+
s.completionStopInProgress = false;
|
|
1064
|
+
}
|
|
1065
|
+
initHealthWidget(ctx);
|
|
1049
1066
|
}
|
|
1050
|
-
initHealthWidget(ctx);
|
|
1051
1067
|
}
|
|
1052
1068
|
|
|
1053
|
-
// ADR-016 phase 3 (#5693): the stop-path basePath restore routes
|
|
1054
|
-
// `Lifecycle.restoreToProjectRoot()`, the sole owner of
|
|
1055
|
-
//
|
|
1056
|
-
//
|
|
1057
|
-
//
|
|
1058
|
-
|
|
1059
|
-
// session-state mutation.
|
|
1060
|
-
if (s.originalBasePath) {
|
|
1069
|
+
// ADR-016 phase 3 (#5693): the stop-path basePath restore + chdir routes
|
|
1070
|
+
// through `Lifecycle.restoreToProjectRoot()`, the sole owner of both
|
|
1071
|
+
// `s.basePath` mutation and the paired `process.chdir` for auto-loop
|
|
1072
|
+
// transitions. The verb assigns `s.basePath` before any throwable work, so
|
|
1073
|
+
// a thrown error still leaves basePath restored.
|
|
1074
|
+
if (s.originalBasePath && !preserveStepSurface && !preservePausedSurface) {
|
|
1061
1075
|
try {
|
|
1062
1076
|
buildLifecycle().restoreToProjectRoot();
|
|
1063
1077
|
} catch (err) {
|
|
@@ -1067,14 +1081,9 @@ export async function cleanupAfterLoopExit(ctx: ExtensionContext): Promise<void>
|
|
|
1067
1081
|
{ file: "auto.ts" },
|
|
1068
1082
|
);
|
|
1069
1083
|
}
|
|
1070
|
-
try {
|
|
1071
|
-
process.chdir(s.originalBasePath);
|
|
1072
|
-
} catch (err) {
|
|
1073
|
-
logWarning("engine", `basePath restore/chdir failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
1074
|
-
}
|
|
1075
1084
|
}
|
|
1076
1085
|
|
|
1077
|
-
if (s.originalBasePath && s.cmdCtx) {
|
|
1086
|
+
if (s.originalBasePath && s.cmdCtx && !preserveStepSurface && !preservePausedSurface) {
|
|
1078
1087
|
const result = await rerootCommandSession(s.cmdCtx, s.originalBasePath);
|
|
1079
1088
|
if (result.status === "cancelled") {
|
|
1080
1089
|
logWarning("engine", "post-loop session re-root was cancelled", { file: "auto.ts", basePath: s.originalBasePath });
|
|
@@ -1185,6 +1194,8 @@ export async function stopAuto(
|
|
|
1185
1194
|
? "merge-conflict"
|
|
1186
1195
|
: rawReason.startsWith("Merge error") || rawReason.startsWith("Merge failed")
|
|
1187
1196
|
? "merge-failed"
|
|
1197
|
+
: rawReason.startsWith("Slice-parallel dispatched")
|
|
1198
|
+
? "stop"
|
|
1188
1199
|
: rawReason.startsWith("slice-merge-conflict")
|
|
1189
1200
|
? "slice-merge-conflict"
|
|
1190
1201
|
: rawReason === "All milestones complete"
|
|
@@ -1386,20 +1397,14 @@ export async function stopAuto(
|
|
|
1386
1397
|
}
|
|
1387
1398
|
|
|
1388
1399
|
// ── Step 7: Restore basePath and chdir (ADR-016 phase 3, #5693) ──
|
|
1389
|
-
// `restoreToProjectRoot`
|
|
1390
|
-
// no
|
|
1400
|
+
// `restoreToProjectRoot` owns both s.basePath restore and process.chdir;
|
|
1401
|
+
// no paired chdir is needed at the call site.
|
|
1391
1402
|
if (s.originalBasePath) {
|
|
1392
1403
|
try {
|
|
1393
1404
|
buildLifecycle().restoreToProjectRoot();
|
|
1394
1405
|
} catch (e) {
|
|
1395
1406
|
debugLog("stop-cleanup-basepath", { error: e instanceof Error ? e.message : String(e) });
|
|
1396
1407
|
}
|
|
1397
|
-
try {
|
|
1398
|
-
process.chdir(s.basePath);
|
|
1399
|
-
} catch (err) {
|
|
1400
|
-
/* best-effort */
|
|
1401
|
-
logWarning("engine", `chdir failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
1402
|
-
}
|
|
1403
1408
|
}
|
|
1404
1409
|
|
|
1405
1410
|
// Re-root the active command session/tool runtime after worktree teardown.
|
|
@@ -1428,7 +1433,7 @@ export async function stopAuto(
|
|
|
1428
1433
|
if (ledger && ledger.units.length > 0) {
|
|
1429
1434
|
const totals = getProjectTotals(ledger.units);
|
|
1430
1435
|
ctx?.ui.notify(
|
|
1431
|
-
|
|
1436
|
+
formatAutoStopNotification(notificationPrefix, totals, ledger.units.length),
|
|
1432
1437
|
"info",
|
|
1433
1438
|
);
|
|
1434
1439
|
} else {
|
|
@@ -1735,7 +1740,6 @@ export async function pauseAuto(
|
|
|
1735
1740
|
restoreProjectRootEnv();
|
|
1736
1741
|
restoreMilestoneLockEnv();
|
|
1737
1742
|
s.pendingVerificationRetry = null;
|
|
1738
|
-
s.verificationRetryCount.clear();
|
|
1739
1743
|
ctx?.ui.setStatus("gsd-auto", "paused");
|
|
1740
1744
|
ctx?.ui.setWidget("gsd-progress", undefined);
|
|
1741
1745
|
const resumeCmd = s.stepMode ? "/gsd next" : "/gsd auto";
|
|
@@ -1805,6 +1809,7 @@ export function createWiredDispatchAdapter(
|
|
|
1805
1809
|
ctx: ExtensionContext,
|
|
1806
1810
|
pi: ExtensionAPI,
|
|
1807
1811
|
dispatchBasePath: string,
|
|
1812
|
+
session?: AutoSession,
|
|
1808
1813
|
): DispatchAdapter {
|
|
1809
1814
|
return {
|
|
1810
1815
|
async decideNextUnit(input) {
|
|
@@ -1846,13 +1851,37 @@ export function createWiredDispatchAdapter(
|
|
|
1846
1851
|
midTitle: active.title,
|
|
1847
1852
|
state,
|
|
1848
1853
|
prefs,
|
|
1854
|
+
session: input.session,
|
|
1849
1855
|
structuredQuestionsAvailable,
|
|
1850
1856
|
sessionContextWindow,
|
|
1851
1857
|
sessionProvider,
|
|
1852
1858
|
modelRegistry,
|
|
1853
1859
|
});
|
|
1854
1860
|
|
|
1855
|
-
if (action.action
|
|
1861
|
+
if (action.action === "stop") {
|
|
1862
|
+
if (session) session.pendingOrchestrationDispatch = null;
|
|
1863
|
+
return {
|
|
1864
|
+
kind: "blocked",
|
|
1865
|
+
reason: action.reason,
|
|
1866
|
+
action: action.level === "warning" ? "pause" : "stop",
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1869
|
+
if (action.action !== "dispatch") {
|
|
1870
|
+
if (session) session.pendingOrchestrationDispatch = null;
|
|
1871
|
+
return null;
|
|
1872
|
+
}
|
|
1873
|
+
if (session) {
|
|
1874
|
+
const pending: PendingOrchestrationDispatch = {
|
|
1875
|
+
unitType: action.unitType,
|
|
1876
|
+
unitId: action.unitId,
|
|
1877
|
+
prompt: action.prompt,
|
|
1878
|
+
pauseAfterUatDispatch: action.pauseAfterDispatch ?? false,
|
|
1879
|
+
state,
|
|
1880
|
+
mid: active.id,
|
|
1881
|
+
midTitle: active.title,
|
|
1882
|
+
};
|
|
1883
|
+
session.pendingOrchestrationDispatch = pending;
|
|
1884
|
+
}
|
|
1856
1885
|
return {
|
|
1857
1886
|
unitType: action.unitType,
|
|
1858
1887
|
unitId: action.unitId,
|
|
@@ -1901,7 +1930,7 @@ export function createWiredAutoOrchestrationModule(
|
|
|
1901
1930
|
};
|
|
1902
1931
|
},
|
|
1903
1932
|
},
|
|
1904
|
-
dispatch: createWiredDispatchAdapter(ctx, pi, dispatchBasePath),
|
|
1933
|
+
dispatch: createWiredDispatchAdapter(ctx, pi, dispatchBasePath, s),
|
|
1905
1934
|
recovery: {
|
|
1906
1935
|
async classifyAndRecover(input) {
|
|
1907
1936
|
const recovery = classifyFailure(input);
|
|
@@ -1997,22 +2026,22 @@ export function createWiredAutoOrchestrationModule(
|
|
|
1997
2026
|
},
|
|
1998
2027
|
async journalTransition(event) {
|
|
1999
2028
|
const eventType = event.name === "start"
|
|
2000
|
-
? "iteration-start"
|
|
2029
|
+
? "orchestrator-iteration-start"
|
|
2001
2030
|
: event.name === "resume"
|
|
2002
|
-
? "iteration-start"
|
|
2031
|
+
? "orchestrator-iteration-start"
|
|
2003
2032
|
: event.name === "advance"
|
|
2004
|
-
? "dispatch-match"
|
|
2033
|
+
? "orchestrator-dispatch-match"
|
|
2005
2034
|
: event.name === "advance-blocked"
|
|
2006
|
-
? "guard-block"
|
|
2035
|
+
? "orchestrator-guard-block"
|
|
2007
2036
|
: event.name === "advance-stopped"
|
|
2008
|
-
? "dispatch-stop"
|
|
2037
|
+
? "orchestrator-dispatch-stop"
|
|
2009
2038
|
: event.name === "advance-error"
|
|
2010
|
-
? "iteration-end"
|
|
2039
|
+
? "orchestrator-iteration-end"
|
|
2011
2040
|
: event.name === "advance-paused" || event.name === "advance-retry"
|
|
2012
|
-
? "guard-block"
|
|
2041
|
+
? "orchestrator-guard-block"
|
|
2013
2042
|
: event.name === "stop"
|
|
2014
|
-
? "terminal"
|
|
2015
|
-
: "iteration-end";
|
|
2043
|
+
? "orchestrator-terminal"
|
|
2044
|
+
: "orchestrator-iteration-end";
|
|
2016
2045
|
|
|
2017
2046
|
_emitJournalEvent(runtimeBasePath, {
|
|
2018
2047
|
ts: new Date().toISOString(),
|
|
@@ -2078,6 +2107,18 @@ export function createWiredAutoOrchestrationModule(
|
|
|
2078
2107
|
return createAutoOrchestrator(deps);
|
|
2079
2108
|
}
|
|
2080
2109
|
|
|
2110
|
+
function notifyResumeBlocked(ctx: ExtensionContext, result: Extract<AutoAdvanceResult, { kind: "blocked" }>): void {
|
|
2111
|
+
const resumeCmd = s.stepMode ? "/gsd next" : "/gsd auto";
|
|
2112
|
+
ctx.ui.notify(`Auto-mode blocked: ${result.reason}. Fix and run ${resumeCmd} to resume.`, "warning");
|
|
2113
|
+
setLifecycleOutcome(ctx, {
|
|
2114
|
+
status: "blocked",
|
|
2115
|
+
title: "Auto-mode blocked",
|
|
2116
|
+
detail: result.reason,
|
|
2117
|
+
nextAction: `Fix the blocker, then run ${resumeCmd} to resume.`,
|
|
2118
|
+
commands: ["/gsd status for overview", `${resumeCmd} to resume`, "/gsd doctor to diagnose"],
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2081
2122
|
function ensureOrchestrationModule(ctx: ExtensionContext, pi: ExtensionAPI, basePath: string): void {
|
|
2082
2123
|
s.orchestration = createWiredAutoOrchestrationModule(ctx, pi, basePath, lockBase());
|
|
2083
2124
|
}
|
|
@@ -2415,7 +2456,7 @@ export async function startAuto(
|
|
|
2415
2456
|
// This closes the journal gap reported in #3348 where the worker wrote side
|
|
2416
2457
|
// effects (SUMMARY.md, DB updates) but died before emitting unit-end.
|
|
2417
2458
|
emitCrashRecoveredUnitEnd(base, freshStartAssessment.lock);
|
|
2418
|
-
|
|
2459
|
+
clearStaleWorkerLock(base);
|
|
2419
2460
|
}
|
|
2420
2461
|
|
|
2421
2462
|
if (!s.paused) {
|
|
@@ -2486,6 +2527,8 @@ export async function startAuto(
|
|
|
2486
2527
|
s.unitLifetimeDispatches.clear();
|
|
2487
2528
|
if (!getLedger()) initMetrics(base);
|
|
2488
2529
|
if (s.currentMilestoneId) setActiveMilestoneId(base, s.currentMilestoneId);
|
|
2530
|
+
await openProjectDbIfPresent(base);
|
|
2531
|
+
registerAutoWorkerForSession(s, base);
|
|
2489
2532
|
|
|
2490
2533
|
// Re-register health level notification callback lost across process restart
|
|
2491
2534
|
setLevelChangeCallback((_from, to, summary) => {
|
|
@@ -2593,7 +2636,12 @@ export async function startAuto(
|
|
|
2593
2636
|
pi.events.emit(CMUX_CHANNELS.LOG, { preferences: loadEffectiveGSDPreferences(s.basePath || undefined)?.preferences, message: s.stepMode ? "Step-mode resumed." : "Auto-mode resumed.", level: "progress" });
|
|
2594
2637
|
|
|
2595
2638
|
try {
|
|
2596
|
-
await s.orchestration?.resume();
|
|
2639
|
+
const resumeResult = await s.orchestration?.resume();
|
|
2640
|
+
if (resumeResult?.kind === "blocked") {
|
|
2641
|
+
notifyResumeBlocked(ctx, resumeResult);
|
|
2642
|
+
await cleanupAfterLoopExit(ctx);
|
|
2643
|
+
return;
|
|
2644
|
+
}
|
|
2597
2645
|
} catch (err) {
|
|
2598
2646
|
debugLog("resume-orchestration-resume", { error: err instanceof Error ? err.message : String(err) });
|
|
2599
2647
|
}
|
|
@@ -2614,6 +2662,7 @@ export async function startAuto(
|
|
|
2614
2662
|
const bootstrapDeps: BootstrapDeps = {
|
|
2615
2663
|
shouldUseWorktreeIsolation,
|
|
2616
2664
|
registerSigtermHandler,
|
|
2665
|
+
registerAutoWorkerForSession: (projectRoot) => registerAutoWorkerForSession(s, projectRoot),
|
|
2617
2666
|
lockBase,
|
|
2618
2667
|
buildLifecycle,
|
|
2619
2668
|
};
|
|
@@ -32,6 +32,7 @@ import { shouldIgnoreAgentEndForActiveUnit } from "../auto/unit-runner-events.js
|
|
|
32
32
|
import { resolveModelId } from "../auto-model-selection.js";
|
|
33
33
|
import { resolveProjectRoot } from "../worktree.js";
|
|
34
34
|
import { clearDiscussionFlowState } from "./write-gate.js";
|
|
35
|
+
import { clearGuidedUnitContext } from "../guided-unit-context.js";
|
|
35
36
|
import { resumeAutoAfterProviderDelay } from "./provider-error-resume.js";
|
|
36
37
|
import {
|
|
37
38
|
classifyError,
|
|
@@ -48,6 +49,11 @@ const MAX_NETWORK_RETRIES = 2;
|
|
|
48
49
|
function isObjectRecord(value: unknown): value is Record<string, unknown> {
|
|
49
50
|
return !!value && typeof value === "object";
|
|
50
51
|
}
|
|
52
|
+
|
|
53
|
+
export function _hasEmptyAgentEndContent(content: unknown): boolean {
|
|
54
|
+
return content == null || (Array.isArray(content) && content.length === 0);
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
/**
|
|
52
58
|
* Cap on auto-resume attempts for sustained transient-provider errors.
|
|
53
59
|
*
|
|
@@ -94,6 +100,14 @@ export function isUserInitiatedAbortMessage(message: string | undefined | null):
|
|
|
94
100
|
return /\b(?:claude code process aborted by user|request aborted by user|process aborted by user)\b/i.test(message);
|
|
95
101
|
}
|
|
96
102
|
|
|
103
|
+
export function shouldDeferTransientErrorToCoreRetry(
|
|
104
|
+
cls: ErrorClass,
|
|
105
|
+
rawErrorMsg: string,
|
|
106
|
+
): boolean {
|
|
107
|
+
if (!isTransient(cls) || cls.kind === "rate-limit") return false;
|
|
108
|
+
return !/retry failed after \d+ attempts:/i.test(rawErrorMsg);
|
|
109
|
+
}
|
|
110
|
+
|
|
97
111
|
function isBareClaudeCodeSessionSwitchAbortMarker(message: string | undefined | null): boolean {
|
|
98
112
|
if (!message) return false;
|
|
99
113
|
const normalized = message.trim().replace(/\s+/g, " ").toLowerCase();
|
|
@@ -196,6 +210,14 @@ export function resolveAgentEndErrorDisplay(
|
|
|
196
210
|
return rawErrorMsg;
|
|
197
211
|
}
|
|
198
212
|
|
|
213
|
+
export function isTerminalDeletedWorktreeProviderError(
|
|
214
|
+
message: string | undefined | null,
|
|
215
|
+
): boolean {
|
|
216
|
+
if (!message) return false;
|
|
217
|
+
if (!/\bdoes not exist\b/i.test(message)) return false;
|
|
218
|
+
return /[/\\]\.gsd[/\\](?:projects[/\\][^/\\]+[/\\])?worktrees[/\\][^/\\\s"']+/i.test(message);
|
|
219
|
+
}
|
|
220
|
+
|
|
199
221
|
async function pauseTransientWithBackoff(
|
|
200
222
|
cls: ErrorClass,
|
|
201
223
|
pi: ExtensionAPI,
|
|
@@ -244,9 +266,11 @@ export async function handleAgentEnd(
|
|
|
244
266
|
// falsely report files as missing — producing a spurious "ready signal
|
|
245
267
|
// rejected" loop even though the files are on disk.
|
|
246
268
|
clearPathCache();
|
|
269
|
+
const basePath = resolveAgentEndBasePath();
|
|
270
|
+
clearGuidedUnitContext(basePath);
|
|
247
271
|
|
|
248
272
|
try {
|
|
249
|
-
if (await checkDeepProjectSetupAfterTurn(event, ctx,
|
|
273
|
+
if (await checkDeepProjectSetupAfterTurn(event, ctx, basePath)) {
|
|
250
274
|
return;
|
|
251
275
|
}
|
|
252
276
|
} catch (err) {
|
|
@@ -254,8 +278,8 @@ export async function handleAgentEnd(
|
|
|
254
278
|
logWarning("bootstrap", `checkDeepProjectSetupAfterTurn failed: ${message}`);
|
|
255
279
|
}
|
|
256
280
|
|
|
257
|
-
if (checkAutoStartAfterDiscuss()) {
|
|
258
|
-
clearDiscussionFlowState(
|
|
281
|
+
if (checkAutoStartAfterDiscuss(basePath)) {
|
|
282
|
+
clearDiscussionFlowState(basePath ?? process.cwd());
|
|
259
283
|
return;
|
|
260
284
|
}
|
|
261
285
|
|
|
@@ -263,14 +287,14 @@ export async function handleAgentEnd(
|
|
|
263
287
|
// are missing, `checkAutoStartAfterDiscuss` returns false silently. Surface
|
|
264
288
|
// that and nudge the LLM to complete the writes before the user hits the
|
|
265
289
|
// downstream "All milestones complete" warning loop.
|
|
266
|
-
if (maybeHandleReadyPhraseWithoutFiles(event)) return;
|
|
290
|
+
if (maybeHandleReadyPhraseWithoutFiles(event, basePath)) return;
|
|
267
291
|
|
|
268
292
|
// #4573 — Empty-turn recovery: if the LLM announced intent in prose but
|
|
269
293
|
// emitted no tool calls, nudge it to execute. Fires only when auto-mode is
|
|
270
294
|
// active or a discussion autostart is pending (non-auto interactive discuss
|
|
271
295
|
// is user-driven). Runs before `isAutoActive` early return so pending
|
|
272
296
|
// discussions (where isAutoActive may be false) still get recovered.
|
|
273
|
-
if (maybeHandleEmptyIntentTurn(event, isAutoActive())) return;
|
|
297
|
+
if (maybeHandleEmptyIntentTurn(event, isAutoActive(), basePath)) return;
|
|
274
298
|
|
|
275
299
|
if (!isAutoActive()) return;
|
|
276
300
|
|
|
@@ -310,7 +334,7 @@ export async function handleAgentEnd(
|
|
|
310
334
|
// that carry error context — e.g. errorMessage field or non-empty content
|
|
311
335
|
// indicating a mid-stream failure. (#2695)
|
|
312
336
|
const content = "content" in lastMsg ? lastMsg.content : undefined;
|
|
313
|
-
const hasEmptyContent =
|
|
337
|
+
const hasEmptyContent = _hasEmptyAgentEndContent(content);
|
|
314
338
|
const hasErrorMessage = "errorMessage" in lastMsg && !!lastMsg.errorMessage;
|
|
315
339
|
|
|
316
340
|
if (hasEmptyContent && !hasErrorMessage) {
|
|
@@ -355,6 +379,17 @@ export async function handleAgentEnd(
|
|
|
355
379
|
rawErrorMsg,
|
|
356
380
|
"content" in lastMsg ? lastMsg.content : undefined,
|
|
357
381
|
);
|
|
382
|
+
if (
|
|
383
|
+
isAutoCompletionStopInProgress() &&
|
|
384
|
+
isTerminalDeletedWorktreeProviderError(`${rawErrorMsg}\n${displayMsg}`)
|
|
385
|
+
) {
|
|
386
|
+
resetRetryState(retryState);
|
|
387
|
+
logWarning(
|
|
388
|
+
"bootstrap",
|
|
389
|
+
`Ignoring stale deleted-worktree provider error during terminal completion reroot: ${displayMsg || rawErrorMsg}`,
|
|
390
|
+
);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
358
393
|
const errorDetail = displayMsg ? `: ${displayMsg}` : "";
|
|
359
394
|
const explicitRetryAfterMs = ("retryAfterMs" in lastMsg && typeof lastMsg.retryAfterMs === "number") ? lastMsg.retryAfterMs : undefined;
|
|
360
395
|
|
|
@@ -461,7 +496,7 @@ export async function handleAgentEnd(
|
|
|
461
496
|
// Core retries transient failures in-session after this handler.
|
|
462
497
|
// Keep that behavior for non-rate-limit classes to avoid pause/retry races,
|
|
463
498
|
// but let rate-limit continue into model fallback logic below (#4373).
|
|
464
|
-
if (
|
|
499
|
+
if (shouldDeferTransientErrorToCoreRetry(cls, rawErrorMsg)) {
|
|
465
500
|
return;
|
|
466
501
|
}
|
|
467
502
|
|
|
@@ -487,17 +487,18 @@ export function registerDbTools(pi: ExtensionAPI): void {
|
|
|
487
487
|
promptGuidelines: [
|
|
488
488
|
"Use gsd_plan_milestone for milestone planning instead of writing ROADMAP.md directly.",
|
|
489
489
|
"Keep parameters flat and provide the full milestone planning payload, including slices.",
|
|
490
|
+
"Milestone and slice titles must not contain forward slash (/), en dash, or em dash characters.",
|
|
490
491
|
"The tool validates input, writes milestone and slice planning data transactionally, renders ROADMAP.md from DB, and clears both state and parse caches after success.",
|
|
491
492
|
"Use the canonical name gsd_plan_milestone; gsd_milestone_plan is only an alias.",
|
|
492
493
|
],
|
|
493
494
|
parameters: Type.Object({
|
|
494
495
|
// ── Core identification + content (required) ──────────────────────
|
|
495
496
|
milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
|
|
496
|
-
title: Type.String({ description: "Milestone title" }),
|
|
497
|
+
title: Type.String({ description: "Milestone title; must not contain forward slash (/), en dash, or em dash characters" }),
|
|
497
498
|
vision: Type.String({ description: "Milestone vision" }),
|
|
498
499
|
slices: Type.Array(Type.Object({
|
|
499
500
|
sliceId: Type.String({ description: "Slice ID (e.g. S01)" }),
|
|
500
|
-
title: Type.String({ description: "Slice title" }),
|
|
501
|
+
title: Type.String({ description: "Slice title; must not contain forward slash (/), en dash, or em dash characters" }),
|
|
501
502
|
risk: Type.String({ description: "Slice risk" }),
|
|
502
503
|
depends: Type.Array(Type.String(), { description: "Slice dependency IDs" }),
|
|
503
504
|
demo: Type.String({ description: "Roadmap demo text / After this" }),
|
|
@@ -570,10 +571,10 @@ export function registerDbTools(pi: ExtensionAPI): void {
|
|
|
570
571
|
title: Type.String({ description: "Task title" }),
|
|
571
572
|
description: Type.String({ description: "Task description / steps block" }),
|
|
572
573
|
estimate: Type.String({ description: "Task estimate string" }),
|
|
573
|
-
files: Type.Array(Type.String(), { description: "
|
|
574
|
+
files: Type.Array(Type.String(), { description: "Array<string> of files likely touched; pass [\"path\"] or [], never a single string" }),
|
|
574
575
|
verify: Type.String({ description: "Verification command or block" }),
|
|
575
|
-
inputs: Type.Array(Type.String(), { description: "
|
|
576
|
-
expectedOutput: Type.Array(Type.String(), { description: "
|
|
576
|
+
inputs: Type.Array(Type.String(), { description: "Array<string> of input files or references; pass [\"path\"] or [], never a single string" }),
|
|
577
|
+
expectedOutput: Type.Array(Type.String(), { description: "Array<string> of expected output files or artifacts; pass [\"path\"] or [], never a single string" }),
|
|
577
578
|
observabilityImpact: Type.Optional(Type.String({ description: "Task observability impact" })),
|
|
578
579
|
}), { description: "Planned tasks for the slice" }),
|
|
579
580
|
// ── Enrichment metadata (optional — defaults to empty) ────────────
|
|
@@ -650,10 +651,10 @@ export function registerDbTools(pi: ExtensionAPI): void {
|
|
|
650
651
|
title: Type.String({ description: "Task title" }),
|
|
651
652
|
description: Type.String({ description: "Task description / steps block" }),
|
|
652
653
|
estimate: Type.String({ description: "Task estimate string" }),
|
|
653
|
-
files: Type.Array(Type.String(), { description: "
|
|
654
|
+
files: Type.Array(Type.String(), { description: "Array<string> of files likely touched; pass [\"path\"] or [], never a single string" }),
|
|
654
655
|
verify: Type.String({ description: "Verification command or block" }),
|
|
655
|
-
inputs: Type.Array(Type.String(), { description: "
|
|
656
|
-
expectedOutput: Type.Array(Type.String(), { description: "
|
|
656
|
+
inputs: Type.Array(Type.String(), { description: "Array<string> of input files or references; pass [\"path\"] or [], never a single string" }),
|
|
657
|
+
expectedOutput: Type.Array(Type.String(), { description: "Array<string> of expected output files or artifacts; pass [\"path\"] or [], never a single string" }),
|
|
657
658
|
observabilityImpact: Type.Optional(Type.String({ description: "Task observability impact" })),
|
|
658
659
|
// Single-writer v3 audit trail (Stream 2): caller-provided actor identity + causation.
|
|
659
660
|
actorName: Type.Optional(Type.String({ description: "Caller-provided actor identity for the audit trail (e.g. 'executor-01', 'gsd-orchestrator')" })),
|
|
@@ -912,7 +913,7 @@ export function registerDbTools(pi: ExtensionAPI): void {
|
|
|
912
913
|
label: "Skip Slice",
|
|
913
914
|
description:
|
|
914
915
|
"Mark a slice as skipped so auto-mode advances past it without executing. " +
|
|
915
|
-
"Non-closed tasks within the slice are cascaded to skipped so milestone completion is not blocked by leftover pending tasks
|
|
916
|
+
"Non-closed tasks within the slice are cascaded to skipped so milestone completion is not blocked by leftover pending tasks. " +
|
|
916
917
|
"The slice data is preserved for reference. The state machine treats skipped slices like completed ones for dependency satisfaction.",
|
|
917
918
|
promptSnippet: "Skip a GSD slice (mark as skipped, auto-mode will advance past it)",
|
|
918
919
|
promptGuidelines: [
|
|
@@ -31,6 +31,7 @@ import { resolveWorktreeProjectRoot } from "../worktree-root.js";
|
|
|
31
31
|
import { extractSubagentAgentClasses } from "./subagent-input.js";
|
|
32
32
|
import { approvalGateIdForUnit, isExplicitApprovalResponse, shouldPauseForUserApprovalQuestion } from "../user-input-boundary.js";
|
|
33
33
|
import { resolveSkillManifest } from "../skill-manifest.js";
|
|
34
|
+
import { getGuidedUnitContext } from "../guided-unit-context.js";
|
|
34
35
|
|
|
35
36
|
let approvalQuestionAbortInFlight = false;
|
|
36
37
|
|
|
@@ -772,7 +773,8 @@ export function registerHooks(
|
|
|
772
773
|
// subagent dispatch. Closes the b23 bug class where a discuss-milestone
|
|
773
774
|
// turn used the host Edit tool to modify user source files.
|
|
774
775
|
const dash = getAutoRuntimeSnapshot();
|
|
775
|
-
const
|
|
776
|
+
const guidedUnit = getGuidedUnitContext(discussionBasePath);
|
|
777
|
+
const activeUnitType = dash.currentUnit?.type ?? guidedUnit?.unitType;
|
|
776
778
|
if (activeUnitType) {
|
|
777
779
|
const manifest = resolveManifest(activeUnitType);
|
|
778
780
|
if (manifest) {
|
|
@@ -791,7 +793,7 @@ export function registerHooks(
|
|
|
791
793
|
const planningGuard = shouldBlockPlanningUnit(
|
|
792
794
|
event.toolName,
|
|
793
795
|
planningInput,
|
|
794
|
-
dash.basePath || discussionBasePath,
|
|
796
|
+
dash.basePath || guidedUnit?.basePath || discussionBasePath,
|
|
795
797
|
activeUnitType,
|
|
796
798
|
manifest.tools,
|
|
797
799
|
agentClasses,
|
|
@@ -805,11 +807,10 @@ export function registerHooks(
|
|
|
805
807
|
// git.isolation=worktree but auto-mode hasn't created the milestone
|
|
806
808
|
// worktree yet. Without this, writes silently orphan outside git history.
|
|
807
809
|
if (isToolCallEventType("write", event) || isToolCallEventType("edit", event)) {
|
|
808
|
-
const wtBasePath = resolveWorktreeProjectRoot(dash.basePath ?? discussionBasePath);
|
|
809
810
|
const wtGuard = shouldBlockWorktreeWrite(
|
|
810
811
|
event.toolName,
|
|
811
812
|
event.input.path,
|
|
812
|
-
|
|
813
|
+
dash.basePath ?? discussionBasePath,
|
|
813
814
|
isAutoActive(),
|
|
814
815
|
dash.currentUnit?.type,
|
|
815
816
|
);
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
export function extractSubagentAgentClasses(input: unknown): string[] {
|
|
2
2
|
if (!input || typeof input !== "object") return [];
|
|
3
3
|
|
|
4
|
-
const record = input as Record<string, unknown>;
|
|
5
4
|
const agentClasses: string[] = [];
|
|
5
|
+
const visited = new WeakSet<object>();
|
|
6
6
|
const addAgentClass = (value: unknown): void => {
|
|
7
|
-
if (typeof value
|
|
7
|
+
if (typeof value !== "string") return;
|
|
8
|
+
const normalized = value.trim().replace(/\.md$/i, "");
|
|
9
|
+
if (normalized.length > 0) agentClasses.push(normalized);
|
|
8
10
|
};
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
const visitItems = (value: unknown): void => {
|
|
10
13
|
if (!Array.isArray(value)) return;
|
|
11
14
|
for (const item of value) {
|
|
12
|
-
|
|
15
|
+
visit(item);
|
|
13
16
|
}
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const visit = (value: unknown): void => {
|
|
20
|
+
if (!value || typeof value !== "object") return;
|
|
21
|
+
if (visited.has(value)) return;
|
|
22
|
+
visited.add(value);
|
|
23
|
+
const record = value as Record<string, unknown>;
|
|
24
|
+
addAgentClass(record.agent);
|
|
25
|
+
visitItems(record.tasks);
|
|
26
|
+
visitItems(record.chain);
|
|
27
|
+
visitItems(record.parallel);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
visit(input);
|
|
19
31
|
return agentClasses;
|
|
20
32
|
}
|
|
@@ -5,7 +5,7 @@ import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
|
5
5
|
import { minimatch } from "minimatch";
|
|
6
6
|
|
|
7
7
|
import { getIsolationMode } from "../preferences.js";
|
|
8
|
-
import type
|
|
8
|
+
import { compileSubagentPermissionContract, type ToolsPolicy } from "../unit-context-manifest.js";
|
|
9
9
|
import { logWarning } from "../workflow-logger.js";
|
|
10
10
|
import { isGsdWorktreePath, resolveWorktreeProjectRoot } from "../worktree-root.js";
|
|
11
11
|
|
|
@@ -64,7 +64,8 @@ const QUEUE_SAFE_TOOLS = new Set([
|
|
|
64
64
|
* env / printenv — print environment variables
|
|
65
65
|
* true / false — shell no-ops / test exit codes
|
|
66
66
|
*/
|
|
67
|
-
const BASH_READ_ONLY_RE = /^\s*(cat|head|tail|less|more|wc|file|stat|du|df|which|type|echo|printf|ls|find|grep|rg|awk|sed\b(?!.*-i)|sort|uniq|diff|comm|tr|cut|tee\s+-a\s+\/dev\/null|git\s+(log|show|diff|status|branch|tag|remote|rev-parse|ls-files|blame|shortlog|describe|stash\s+list|config\s+--get|cat-file)|gh\s+(issue|pr|api|repo|release)\s+(view|list|diff|status|checks)|mkdir\s+-p\s+\.gsd|rtk\s|npm\s+run\s+(test|test:\w+|lint|lint:\w+|typecheck|type-check|type-check:\w+|check|verify|audit|outdated|format:check|ci|validate)\b|npm\s+(ls|list|info|view|show|outdated|audit|explain|doctor|ping|--version|-v)\b|npx\s|tsx\s|node\s+(--print|--version|-v\b)|python[23]?\s+(-c\s+'[^']*'|--version|-V\b|-m\s+(pip\s+show|pip\s+list|site))|pip[23]?\s+(show|list|freeze|check|index\s+versions)\b|jq\s|yq\s|curl\s+(-s\b|--silent\b)(?!\s+[^|>]*\s-[oO]\b)(?!\s+[^|>]*\s--output\b)[^|>]*$|openssl\s+(version|x509|s_client)|env\b|printenv\b|true\b|false\b)/;
|
|
67
|
+
const BASH_READ_ONLY_RE = /^\s*((?:cd|pushd|popd)(?:\s|$)|cat|head|tail|less|more|wc|file|stat|du|df|which|type|echo|printf|ls|find|grep|rg|awk|sed\b(?!.*-i)|sort|uniq|diff|comm|tr|cut|tee\s+-a\s+\/dev\/null|git\s+(log|show|diff|status|branch|tag|remote|rev-parse|ls-files|blame|shortlog|describe|stash\s+list|config\s+--get|cat-file)|gh\s+(issue|pr|api|repo|release)\s+(view|list|diff|status|checks)|mkdir\s+-p\s+\.gsd|rtk\s|npm\s+run\s+(test|test:\w+|lint|lint:\w+|typecheck|type-check|type-check:\w+|check|verify|audit|outdated|format:check|ci|validate)\b|npm\s+(ls|list|info|view|show|outdated|audit|explain|doctor|ping|--version|-v)\b|npx\s|tsx\s|node\s+(--print|--version|-v\b)|python[23]?\s+(-c\s+'[^']*'|--version|-V\b|-m\s+(pip\s+show|pip\s+list|site))|pip[23]?\s+(show|list|freeze|check|index\s+versions)\b|jq\s|yq\s|curl\s+(-s\b|--silent\b)(?!\s+[^|>]*\s-[oO]\b)(?!\s+[^|>]*\s--output\b)[^|>]*$|openssl\s+(version|x509|s_client)|env\b|printenv\b|true\b|false\b)/;
|
|
68
|
+
const BASH_VERIFICATION_RE = /^\s*(npm\s+(run\s+(build|test|test:\w+|lint|lint:\w+|typecheck|type-check|verify|ci|validate)\b|test\b)|pnpm\s+(build|test|lint|typecheck|verify)\b|yarn\s+(build|test|lint|typecheck|verify)\b|vitest\b|jest\b|go\s+test\b)/;
|
|
68
69
|
|
|
69
70
|
interface InMemoryWriteGateState {
|
|
70
71
|
verifiedDepthMilestones: Set<string>;
|
|
@@ -747,7 +748,7 @@ function matchesAllowedGlob(absPath: string, basePath: string, globs: readonly s
|
|
|
747
748
|
function blockReason(unitType: string, mode: string, what: string): string {
|
|
748
749
|
return [
|
|
749
750
|
`HARD BLOCK: unit "${unitType}" runs under tools-policy "${mode}" — ${what}.`,
|
|
750
|
-
`This is a mechanical gate enforced by manifest.tools
|
|
751
|
+
`This is a mechanical gate enforced by manifest.tools. You MUST NOT proceed,`,
|
|
751
752
|
`retry the same call, or rationalize past this block. If you need to write user source,`,
|
|
752
753
|
`the work belongs in execute-task, not in a planning unit.`,
|
|
753
754
|
].join(" ");
|
|
@@ -767,6 +768,9 @@ function blockReason(unitType: string, mode: string, what: string): string {
|
|
|
767
768
|
* and listed in the policy's allowedSubagents.
|
|
768
769
|
* - "docs" → like "planning" but also allows writes to paths
|
|
769
770
|
* matching `allowedPathGlobs` relative to basePath.
|
|
771
|
+
* - "verification"
|
|
772
|
+
* → allows Bash for project verification commands, but keeps
|
|
773
|
+
* writes restricted to .gsd/ and blocks subagent dispatch.
|
|
770
774
|
*
|
|
771
775
|
* `pathOrCommand` is the file path for write/edit-shaped tools and the
|
|
772
776
|
* shell command for bash. Other tools ignore this argument.
|
|
@@ -804,14 +808,15 @@ export function shouldBlockPlanningUnit(
|
|
|
804
808
|
return { block: true, reason: blockReason(unitType, policy.mode, `tool "${tool}" is not on the read-only allowlist`) };
|
|
805
809
|
}
|
|
806
810
|
|
|
807
|
-
// planning / planning-dispatch / docs modes share the same surface for safe tools, bash, and subagent.
|
|
811
|
+
// planning / planning-dispatch / docs / verification modes share the same surface for safe tools, bash, and subagent.
|
|
808
812
|
if (PLANNING_SAFE_TOOLS.has(tool)) return { block: false };
|
|
809
813
|
if (tool.startsWith("gsd_")) return { block: false };
|
|
810
814
|
|
|
811
815
|
if (PLANNING_SUBAGENT_TOOLS.has(tool)) {
|
|
812
816
|
if (policy.mode === "planning-dispatch") {
|
|
813
817
|
const requested = (agentClasses ?? []).map(a => a.trim()).filter(Boolean);
|
|
814
|
-
const
|
|
818
|
+
const dispatchContract = compileSubagentPermissionContract(policy);
|
|
819
|
+
const allowedSubagents = dispatchContract.allowedSubagents;
|
|
815
820
|
const allowed = new Set(allowedSubagents);
|
|
816
821
|
// When agentClasses is undefined, the caller has not been updated to extract
|
|
817
822
|
// agent identities yet. Block and warn so stale callers surface in telemetry
|
|
@@ -861,6 +866,17 @@ export function shouldBlockPlanningUnit(
|
|
|
861
866
|
}
|
|
862
867
|
|
|
863
868
|
if (tool === "bash") {
|
|
869
|
+
if (policy.mode === "verification") {
|
|
870
|
+
if (BASH_VERIFICATION_RE.test(pathOrCommand) || BASH_READ_ONLY_RE.test(pathOrCommand)) return { block: false };
|
|
871
|
+
return {
|
|
872
|
+
block: true,
|
|
873
|
+
reason: blockReason(
|
|
874
|
+
unitType,
|
|
875
|
+
policy.mode,
|
|
876
|
+
`bash is restricted to build/test verification commands (npm run build, npm test, etc.); cannot run "${pathOrCommand.slice(0, 80)}${pathOrCommand.length > 80 ? "…" : ""}"`,
|
|
877
|
+
),
|
|
878
|
+
};
|
|
879
|
+
}
|
|
864
880
|
if (BASH_READ_ONLY_RE.test(pathOrCommand)) return { block: false };
|
|
865
881
|
return {
|
|
866
882
|
block: true,
|
|
@@ -951,9 +967,9 @@ function isPathContained(target: string, container: string): boolean {
|
|
|
951
967
|
* while `git.isolation: worktree` is in effect and auto-mode hasn't created
|
|
952
968
|
* (or flipped cwd into) the milestone worktree.
|
|
953
969
|
*
|
|
954
|
-
* Pure / unit-testable. Callers in `register-hooks.ts` supply the
|
|
955
|
-
* project root and current auto liveness;
|
|
956
|
-
* realpath resolution.
|
|
970
|
+
* Pure / unit-testable. Callers in `register-hooks.ts` supply the effective
|
|
971
|
+
* execution base path (worker cwd or project root) and current auto liveness;
|
|
972
|
+
* this function does no I/O beyond realpath resolution.
|
|
957
973
|
*
|
|
958
974
|
* Allow rules (in order):
|
|
959
975
|
* 1. Tool isn't a planning-write (write/edit/multi_edit/notebook_edit).
|
|
@@ -991,10 +1007,11 @@ export function shouldBlockWorktreeWrite(
|
|
|
991
1007
|
};
|
|
992
1008
|
}
|
|
993
1009
|
|
|
994
|
-
// Resolve
|
|
1010
|
+
// Resolve relative targets against the effective execution base path, then
|
|
1011
|
+
// canonicalize against the project root to defeat
|
|
995
1012
|
// symlink-based escapes and prefix tricks (e.g. .gsd/worktrees-extra/).
|
|
996
1013
|
const projectRoot = resolveWorktreeProjectRoot(effectiveBasePath);
|
|
997
|
-
const absTarget = isAbsolute(targetPath) ? targetPath : resolve(
|
|
1014
|
+
const absTarget = isAbsolute(targetPath) ? targetPath : resolve(effectiveBasePath, targetPath);
|
|
998
1015
|
const realTarget = realpathOrResolve(absTarget);
|
|
999
1016
|
const realRoot = realpathOrResolve(projectRoot);
|
|
1000
1017
|
const realGsd = realpathOrResolve(join(projectRoot, ".gsd"));
|