gsd-pi 2.82.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -32
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +10 -1
- package/dist/resources/extensions/browser-tools/tools/screenshot.js +1 -0
- package/dist/resources/extensions/browser-tools/tools/zoom.js +1 -0
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +1 -1
- 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 +19 -6
- package/dist/resources/extensions/gsd/auto/orchestrator.js +124 -6
- package/dist/resources/extensions/gsd/auto/phases.js +90 -31
- package/dist/resources/extensions/gsd/auto/session.js +4 -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 +246 -133
- package/dist/resources/extensions/gsd/auto-prompts.js +13 -5
- package/dist/resources/extensions/gsd/auto-recovery.js +71 -14
- package/dist/resources/extensions/gsd/auto-start.js +87 -14
- package/dist/resources/extensions/gsd/auto-verification.js +45 -26
- package/dist/resources/extensions/gsd/auto-worktree.js +176 -10
- package/dist/resources/extensions/gsd/auto.js +178 -63
- 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 +9 -2
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +55 -12
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +17 -3
- 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 +39 -1
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +15 -2
- 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/context-store.js +112 -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-writer.js +150 -84
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -2
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/dist/resources/extensions/gsd/doctor-git-checks.js +87 -7
- 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 +3 -3
- package/dist/resources/extensions/gsd/git-service.js +45 -3
- package/dist/resources/extensions/gsd/gsd-db.js +21 -6
- package/dist/resources/extensions/gsd/guided-flow-queue.js +4 -3
- package/dist/resources/extensions/gsd/guided-flow.js +101 -116
- package/dist/resources/extensions/gsd/guided-unit-context.js +23 -0
- package/dist/resources/extensions/gsd/knowledge-backfill.js +144 -0
- package/dist/resources/extensions/gsd/knowledge-capture.js +136 -0
- package/dist/resources/extensions/gsd/knowledge-parser.js +154 -0
- package/dist/resources/extensions/gsd/knowledge-projection.js +210 -0
- package/dist/resources/extensions/gsd/markdown-renderer.js +16 -9
- package/dist/resources/extensions/gsd/md-importer.js +1 -1
- package/dist/resources/extensions/gsd/memory-backfill.js +73 -17
- package/dist/resources/extensions/gsd/memory-consolidation-scanner.js +222 -0
- package/dist/resources/extensions/gsd/migrate/command.js +5 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/migrate/preview.js +9 -0
- package/dist/resources/extensions/gsd/migrate/transformer.js +51 -4
- package/dist/resources/extensions/gsd/migrate/writer.js +11 -1
- 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 +48 -12
- 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/post-execution-checks.js +73 -2
- package/dist/resources/extensions/gsd/pre-execution-checks.js +28 -1
- 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/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/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/prompts/system.md +2 -2
- package/dist/resources/extensions/gsd/provider-switch-observer.js +146 -0
- package/dist/resources/extensions/gsd/queue-reorder-ui.js +30 -13
- 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 +3 -3
- package/dist/resources/extensions/gsd/status-guards.js +11 -0
- package/dist/resources/extensions/gsd/templates/knowledge.md +2 -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 +87 -14
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +119 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +32 -10
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +68 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -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/shared/html-shell.js +388 -0
- 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/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-b23b3f6858dc6dc8.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 +6 -5
- 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 +14 -3
- 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-parity.test.ts +244 -0
- 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-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/index.d.ts +2 -2
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +1 -1
- package/packages/pi-ai/dist/index.js.map +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/dist/providers/transform-messages.d.ts +11 -0
- package/packages/pi-ai/dist/providers/transform-messages.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/transform-messages.js +20 -0
- package/packages/pi-ai/dist/providers/transform-messages.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/index.ts +7 -2
- 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/src/providers/transform-messages.ts +24 -0
- 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/sdk.js +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +4 -4
- package/packages/pi-coding-agent/dist/core/system-prompt.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/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/dist/tests/system-prompt-file-safety.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-file-safety.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-file-safety.test.js +17 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-file-safety.test.js.map +1 -0
- 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/sdk.ts +1 -1
- package/packages/pi-coding-agent/src/core/system-prompt.ts +4 -4
- 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/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/src/tests/system-prompt-file-safety.test.ts +22 -0
- 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/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 +5 -0
- 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/terminal.ts +11 -0
- package/packages/pi-tui/src/tui.ts +6 -0
- 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/browser-tools/tools/screenshot.ts +1 -0
- package/src/resources/extensions/browser-tools/tools/zoom.ts +1 -0
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +1 -1
- 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 +9 -0
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +59 -16
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +22 -6
- package/src/resources/extensions/gsd/auto/orchestrator.ts +129 -6
- package/src/resources/extensions/gsd/auto/phases.ts +104 -38
- package/src/resources/extensions/gsd/auto/session.ts +4 -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 +279 -144
- package/src/resources/extensions/gsd/auto-prompts.ts +13 -5
- package/src/resources/extensions/gsd/auto-recovery.ts +74 -11
- package/src/resources/extensions/gsd/auto-start.ts +94 -12
- package/src/resources/extensions/gsd/auto-verification.ts +58 -36
- package/src/resources/extensions/gsd/auto-worktree.ts +193 -10
- package/src/resources/extensions/gsd/auto.ts +187 -61
- 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 +10 -2
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +58 -15
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +20 -4
- 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 +42 -1
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +19 -2
- 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/context-store.ts +120 -1
- 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-writer.ts +167 -84
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -2
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/src/resources/extensions/gsd/doctor-git-checks.ts +89 -7
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor-types.ts +3 -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 +3 -3
- package/src/resources/extensions/gsd/git-service.ts +51 -4
- package/src/resources/extensions/gsd/gsd-db.ts +21 -6
- package/src/resources/extensions/gsd/guided-flow-queue.ts +4 -3
- package/src/resources/extensions/gsd/guided-flow.ts +134 -133
- package/src/resources/extensions/gsd/guided-unit-context.ts +30 -0
- package/src/resources/extensions/gsd/knowledge-backfill.ts +164 -0
- package/src/resources/extensions/gsd/knowledge-capture.ts +160 -0
- package/src/resources/extensions/gsd/knowledge-parser.ts +174 -0
- package/src/resources/extensions/gsd/knowledge-projection.ts +241 -0
- package/src/resources/extensions/gsd/markdown-renderer.ts +16 -9
- package/src/resources/extensions/gsd/md-importer.ts +1 -1
- package/src/resources/extensions/gsd/memory-backfill.ts +89 -17
- package/src/resources/extensions/gsd/memory-consolidation-scanner.ts +277 -0
- package/src/resources/extensions/gsd/migrate/command.ts +5 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/migrate/preview.ts +10 -0
- package/src/resources/extensions/gsd/migrate/transformer.ts +58 -4
- package/src/resources/extensions/gsd/migrate/writer.ts +14 -1
- 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 +54 -12
- 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/post-execution-checks.ts +87 -2
- package/src/resources/extensions/gsd/pre-execution-checks.ts +32 -1
- 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/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/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/prompts/system.md +2 -2
- package/src/resources/extensions/gsd/provider-switch-observer.ts +185 -0
- package/src/resources/extensions/gsd/queue-reorder-ui.ts +31 -13
- 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 +3 -3
- package/src/resources/extensions/gsd/status-guards.ts +13 -0
- package/src/resources/extensions/gsd/templates/knowledge.md +2 -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 +131 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +487 -4
- 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 +91 -6
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +4 -4
- 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/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/browser-tools-compatibility-declarations.test.ts +62 -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 +11 -2
- 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/context-store-decisions-from-memories.test.ts +312 -0
- 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-writer.test.ts +13 -8
- package/src/resources/extensions/gsd/tests/decisions-projection-from-memories.test.ts +453 -0
- package/src/resources/extensions/gsd/tests/decisions-stop-table-writes.test.ts +348 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +59 -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 +27 -0
- package/src/resources/extensions/gsd/tests/doctor-empty-worktree.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/freeform-decisions.test.ts +8 -4
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/gsd-tools.test.ts +11 -7
- 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/integration/doctor-git.test.ts +44 -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 +112 -1
- package/src/resources/extensions/gsd/tests/integration/integration-lifecycle.test.ts +13 -5
- package/src/resources/extensions/gsd/tests/integration/migrate-command.test.ts +48 -3
- 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 +46 -0
- package/src/resources/extensions/gsd/tests/knowledge-backfill-projection.test.ts +323 -0
- package/src/resources/extensions/gsd/tests/knowledge-capture.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +47 -2
- package/src/resources/extensions/gsd/tests/load-knowledge-block-rules-only.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/memory-consolidation-scanner.test.ts +316 -0
- package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/migrate-transformer.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +6 -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 +63 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- 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-sketch-render.test.ts +157 -0
- 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 +251 -2
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +17 -0
- 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 +86 -0
- 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 +53 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +8 -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/provider-switch-observer.test.ts +252 -0
- 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/run-uat-replay-cap.test.ts +2 -3
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +16 -4
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- 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 +13 -1
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -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 +103 -7
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +29 -2
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -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/write-gate-planning-unit.test.ts +54 -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 +97 -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 +47 -11
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +78 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +4 -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/shared/html-shell.ts +412 -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/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-9ecfd95f343793f0.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/{S44UQTFCUdA44dkjfYt6S → qoMxZh-xuwuvpFW0x0k01}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{S44UQTFCUdA44dkjfYt6S → qoMxZh-xuwuvpFW0x0k01}/_ssgManifest.js +0 -0
|
@@ -252,7 +252,17 @@ function gitPathspecForWorktreePath(basePath: string, targetPath: string): strin
|
|
|
252
252
|
let base = basePath;
|
|
253
253
|
let target = targetPath;
|
|
254
254
|
try {
|
|
255
|
-
base =
|
|
255
|
+
base = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
256
|
+
cwd: basePath,
|
|
257
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
258
|
+
encoding: "utf-8",
|
|
259
|
+
}).trim() || basePath;
|
|
260
|
+
} catch {
|
|
261
|
+
/* keep original */
|
|
262
|
+
void base;
|
|
263
|
+
}
|
|
264
|
+
try {
|
|
265
|
+
base = realpathSync.native(base);
|
|
256
266
|
} catch {
|
|
257
267
|
/* keep original */
|
|
258
268
|
void base;
|
|
@@ -269,6 +279,10 @@ function gitPathspecForWorktreePath(basePath: string, targetPath: string): strin
|
|
|
269
279
|
return rel.replaceAll("\\", "/");
|
|
270
280
|
}
|
|
271
281
|
|
|
282
|
+
export function _gitPathspecForWorktreePath(basePath: string, targetPath: string): string | null {
|
|
283
|
+
return gitPathspecForWorktreePath(basePath, targetPath);
|
|
284
|
+
}
|
|
285
|
+
|
|
272
286
|
function gitRemoteExists(basePath: string, remote: string): boolean {
|
|
273
287
|
try {
|
|
274
288
|
execFileSync("git", ["remote", "get-url", remote], {
|
|
@@ -282,6 +296,50 @@ function gitRemoteExists(basePath: string, remote: string): boolean {
|
|
|
282
296
|
}
|
|
283
297
|
}
|
|
284
298
|
|
|
299
|
+
function findRegularMergeChangedPaths(basePath: string, milestoneBranch: string, mainBranch: string): Set<string> {
|
|
300
|
+
const changedPaths = new Set<string>();
|
|
301
|
+
let mergeLog = "";
|
|
302
|
+
try {
|
|
303
|
+
mergeLog = execFileSync("git", ["rev-list", "--merges", "--parents", mainBranch], {
|
|
304
|
+
cwd: basePath,
|
|
305
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
306
|
+
encoding: "utf-8",
|
|
307
|
+
}).trim();
|
|
308
|
+
} catch (err) {
|
|
309
|
+
logWarning("worktree", `regular merge lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
310
|
+
return changedPaths;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
for (const line of mergeLog.split("\n").filter(Boolean)) {
|
|
314
|
+
const [mergeCommit, firstParent, ...otherParents] = line.split(" ");
|
|
315
|
+
if (!mergeCommit || !firstParent || otherParents.length === 0) continue;
|
|
316
|
+
const mergedMilestone = otherParents.some((parent) => {
|
|
317
|
+
try {
|
|
318
|
+
return nativeIsAncestor(basePath, milestoneBranch, parent);
|
|
319
|
+
} catch {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
if (!mergedMilestone) continue;
|
|
324
|
+
|
|
325
|
+
try {
|
|
326
|
+
const output = execFileSync("git", ["diff", "--name-only", firstParent, mergeCommit], {
|
|
327
|
+
cwd: basePath,
|
|
328
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
329
|
+
encoding: "utf-8",
|
|
330
|
+
}).trim();
|
|
331
|
+
for (const path of output.split("\n").filter(Boolean)) {
|
|
332
|
+
if (!path.startsWith(".gsd/")) changedPaths.add(path);
|
|
333
|
+
}
|
|
334
|
+
} catch (err) {
|
|
335
|
+
logWarning("worktree", `regular merge diff lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
336
|
+
}
|
|
337
|
+
return changedPaths;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return changedPaths;
|
|
341
|
+
}
|
|
342
|
+
|
|
285
343
|
function clearProjectRootStateFiles(basePath: string, milestoneId: string): void {
|
|
286
344
|
const gsdDir = gsdRoot(basePath);
|
|
287
345
|
// Phase C pt 2: auto.lock removed from this list — the file is gone
|
|
@@ -949,7 +1007,73 @@ export function enterBranchModeForMilestone(
|
|
|
949
1007
|
});
|
|
950
1008
|
}
|
|
951
1009
|
|
|
952
|
-
|
|
1010
|
+
checkoutBranchWithStashGuard(basePath, branch, `enter-branch-mode:${milestoneId}`);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
export function checkoutBranchWithStashGuard(
|
|
1014
|
+
basePath: string,
|
|
1015
|
+
branch: string,
|
|
1016
|
+
reason: string,
|
|
1017
|
+
): void {
|
|
1018
|
+
let stashMarker: string | null = null;
|
|
1019
|
+
let stashed = false;
|
|
1020
|
+
|
|
1021
|
+
const status = nativeWorkingTreeStatus(basePath).trim();
|
|
1022
|
+
if (status.length > 0) {
|
|
1023
|
+
stashMarker = `gsd-checkout-stash:${reason}:${process.pid}:${Date.now()}:${process.hrtime.bigint().toString(36)}`;
|
|
1024
|
+
const stashListBefore = execFileSync("git", ["stash", "list"], {
|
|
1025
|
+
cwd: basePath,
|
|
1026
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1027
|
+
encoding: "utf-8",
|
|
1028
|
+
});
|
|
1029
|
+
execFileSync(
|
|
1030
|
+
"git",
|
|
1031
|
+
["stash", "push", "--include-untracked", "-m", `gsd: checkout stash [${stashMarker}]`],
|
|
1032
|
+
{
|
|
1033
|
+
cwd: basePath,
|
|
1034
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1035
|
+
encoding: "utf-8",
|
|
1036
|
+
},
|
|
1037
|
+
);
|
|
1038
|
+
const stashListAfter = execFileSync("git", ["stash", "list"], {
|
|
1039
|
+
cwd: basePath,
|
|
1040
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1041
|
+
encoding: "utf-8",
|
|
1042
|
+
});
|
|
1043
|
+
stashed = stashListAfter !== stashListBefore;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// Checkout and stash-restore are split so we can distinguish two failure
|
|
1047
|
+
// modes: (a) checkout failed → HEAD did not move, restore stash and rethrow;
|
|
1048
|
+
// (b) checkout succeeded but stash pop failed → HEAD moved to `branch` but
|
|
1049
|
+
// the working-tree changes remain in the stash list. We surface a distinct
|
|
1050
|
+
// error in case (b) so callers don't assume the branch switch was rolled back.
|
|
1051
|
+
try {
|
|
1052
|
+
nativeCheckoutBranch(basePath, branch);
|
|
1053
|
+
} catch (checkoutErr) {
|
|
1054
|
+
if (stashed) {
|
|
1055
|
+
try {
|
|
1056
|
+
popStashByRef(basePath, stashMarker);
|
|
1057
|
+
} catch (restoreErr) {
|
|
1058
|
+
logWarning("worktree", `git stash pop failed during checkout restore: ${restoreErr instanceof Error ? restoreErr.message : String(restoreErr)}`);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
throw checkoutErr;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
if (stashed) {
|
|
1065
|
+
try {
|
|
1066
|
+
popStashByRef(basePath, stashMarker);
|
|
1067
|
+
} catch (popErr) {
|
|
1068
|
+
const msg = popErr instanceof Error ? popErr.message : String(popErr);
|
|
1069
|
+
const wrapped = new Error(
|
|
1070
|
+
`checkout to '${branch}' succeeded but stash restore failed; working tree changes remain in the stash list. Original error: ${msg}`,
|
|
1071
|
+
);
|
|
1072
|
+
const ref = (popErr as { stashRef?: string } | null)?.stashRef;
|
|
1073
|
+
if (ref) (wrapped as { stashRef?: string }).stashRef = ref;
|
|
1074
|
+
throw wrapped;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
953
1077
|
}
|
|
954
1078
|
|
|
955
1079
|
// ─── Public API ────────────────────────────────────────────────────────────
|
|
@@ -1739,6 +1863,66 @@ export function mergeMilestoneToMain(
|
|
|
1739
1863
|
}
|
|
1740
1864
|
}
|
|
1741
1865
|
|
|
1866
|
+
// Already regular-merged milestones can skip the squash path and proceed to cleanup (#5831).
|
|
1867
|
+
if (nativeIsAncestor(originalBasePath_, milestoneBranch, mainBranch)) {
|
|
1868
|
+
const codeChanges = nativeDiffNumstat(
|
|
1869
|
+
originalBasePath_,
|
|
1870
|
+
mainBranch,
|
|
1871
|
+
milestoneBranch,
|
|
1872
|
+
).filter((entry) => !entry.path.startsWith(".gsd/"));
|
|
1873
|
+
if (codeChanges.length > 0) {
|
|
1874
|
+
const regularMergeChangedPaths = findRegularMergeChangedPaths(
|
|
1875
|
+
originalBasePath_,
|
|
1876
|
+
milestoneBranch,
|
|
1877
|
+
mainBranch,
|
|
1878
|
+
);
|
|
1879
|
+
const unanchoredCodeChanges = codeChanges.filter((entry) =>
|
|
1880
|
+
regularMergeChangedPaths.has(entry.path)
|
|
1881
|
+
);
|
|
1882
|
+
if (unanchoredCodeChanges.length > 0) {
|
|
1883
|
+
process.chdir(previousCwd);
|
|
1884
|
+
throw new GSDError(
|
|
1885
|
+
GSD_GIT_ERROR,
|
|
1886
|
+
`Milestone branch "${milestoneBranch}" is reachable from "${mainBranch}" ` +
|
|
1887
|
+
`but has ${unanchoredCodeChanges.length} milestone-touched code file(s) not on current "${mainBranch}". ` +
|
|
1888
|
+
`Aborting worktree teardown to prevent data loss.`,
|
|
1889
|
+
);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
debugLog("mergeMilestoneToMain", {
|
|
1893
|
+
action: "skip-squash-already-merged",
|
|
1894
|
+
milestoneId,
|
|
1895
|
+
milestoneBranch,
|
|
1896
|
+
mainBranch,
|
|
1897
|
+
});
|
|
1898
|
+
try {
|
|
1899
|
+
clearProjectRootStateFiles(originalBasePath_, milestoneId);
|
|
1900
|
+
} catch (err) {
|
|
1901
|
+
logWarning("worktree", `clearProjectRootStateFiles failed during already-merged cleanup: ${err instanceof Error ? err.message : String(err)}`);
|
|
1902
|
+
}
|
|
1903
|
+
try {
|
|
1904
|
+
removeWorktree(originalBasePath_, milestoneId, {
|
|
1905
|
+
branch: milestoneBranch,
|
|
1906
|
+
deleteBranch: false,
|
|
1907
|
+
});
|
|
1908
|
+
} catch (err) {
|
|
1909
|
+
logWarning("worktree", `worktree removal failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1910
|
+
}
|
|
1911
|
+
try {
|
|
1912
|
+
nativeBranchDelete(originalBasePath_, milestoneBranch);
|
|
1913
|
+
} catch (err) {
|
|
1914
|
+
logWarning("worktree", `git branch-delete failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1915
|
+
}
|
|
1916
|
+
setActiveWorkspace(null);
|
|
1917
|
+
nudgeGitBranchCache(previousCwd);
|
|
1918
|
+
try {
|
|
1919
|
+
process.chdir(originalBasePath_);
|
|
1920
|
+
} catch (err) {
|
|
1921
|
+
logWarning("worktree", `chdir to project root after already-merged cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1922
|
+
}
|
|
1923
|
+
return { commitMessage, pushed: false, prCreated: false, codeFilesChanged: true };
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1742
1926
|
// 7. Shelter queued milestone directories before the squash merge (#2505).
|
|
1743
1927
|
// The milestone branch may contain copies of queued milestone dirs (via
|
|
1744
1928
|
// copyPlanningArtifacts), so `git merge --squash` rejects when those same
|
|
@@ -1874,14 +2058,6 @@ export function mergeMilestoneToMain(
|
|
|
1874
2058
|
logWarning("worktree", `git stash failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1875
2059
|
}
|
|
1876
2060
|
|
|
1877
|
-
if (needsDbCycle && dbPathToReopen) {
|
|
1878
|
-
try {
|
|
1879
|
-
openDatabase(dbPathToReopen);
|
|
1880
|
-
} catch (err) {
|
|
1881
|
-
logWarning("worktree", `post-stash db reopen failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
2061
|
// 7b. Clean up stale merge state before attempting squash merge (#2912).
|
|
1886
2062
|
// A leftover MERGE_HEAD (from a previous failed merge, libgit2 native path,
|
|
1887
2063
|
// or interrupted operation) causes `git merge --squash` to refuse with
|
|
@@ -1891,6 +2067,13 @@ export function mergeMilestoneToMain(
|
|
|
1891
2067
|
|
|
1892
2068
|
// 8. Squash merge — auto-resolve .gsd/ state file conflicts (#530)
|
|
1893
2069
|
const mergeResult = nativeMergeSquash(originalBasePath_, milestoneBranch);
|
|
2070
|
+
if (needsDbCycle && dbPathToReopen) {
|
|
2071
|
+
try {
|
|
2072
|
+
openDatabase(dbPathToReopen);
|
|
2073
|
+
} catch (err) {
|
|
2074
|
+
logWarning("worktree", `post-merge db reopen failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
1894
2077
|
|
|
1895
2078
|
if (!mergeResult.success) {
|
|
1896
2079
|
// Dirty working tree — the merge was rejected before it started (e.g.
|
|
@@ -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,12 +241,14 @@ 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 } 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";
|
|
247
248
|
import { resolveManifest } from "./unit-context-manifest.js";
|
|
248
249
|
import { classifyFailure } from "./recovery-classification.js";
|
|
250
|
+
import { supportsStructuredQuestions } from "./workflow-mcp.js";
|
|
251
|
+
import type { MinimalModelRegistry } from "./context-budget.js";
|
|
249
252
|
// Slice-level parallelism (#2340)
|
|
250
253
|
import { getEligibleSlices } from "./slice-parallel-eligibility.js";
|
|
251
254
|
import { startSliceParallel } from "./slice-parallel-orchestrator.js";
|
|
@@ -314,6 +317,13 @@ import { normalizeRealPath } from "./paths.js";
|
|
|
314
317
|
/** Throttle STATE.md rebuilds — at most once per 30 seconds */
|
|
315
318
|
const STATE_REBUILD_MIN_INTERVAL_MS = 30_000;
|
|
316
319
|
|
|
320
|
+
export function formatAutoStopNotification(prefix: string, totals: { cost: number; tokens: { total: number } }, unitCount: number): string {
|
|
321
|
+
return [
|
|
322
|
+
`${prefix}.`,
|
|
323
|
+
`Session: ${formatCost(totals.cost)} · ${formatTokenCount(totals.tokens.total)} tokens · ${unitCount} units`,
|
|
324
|
+
].join("\n");
|
|
325
|
+
}
|
|
326
|
+
|
|
317
327
|
/**
|
|
318
328
|
* Phase B — register this auto-mode process in the workers table so other
|
|
319
329
|
* workers and janitors can detect liveness via heartbeat. Best-effort: if
|
|
@@ -1019,6 +1029,8 @@ export async function rerootCommandSession(
|
|
|
1019
1029
|
}
|
|
1020
1030
|
|
|
1021
1031
|
export async function cleanupAfterLoopExit(ctx: ExtensionContext): Promise<void> {
|
|
1032
|
+
const preserveStepSurface = s.preserveStepSurfaceAfterLoopExit;
|
|
1033
|
+
const preservePausedSurface = s.paused;
|
|
1022
1034
|
s.currentUnit = null;
|
|
1023
1035
|
s.active = false;
|
|
1024
1036
|
deactivateGSD();
|
|
@@ -1041,21 +1053,24 @@ export async function cleanupAfterLoopExit(ctx: ExtensionContext): Promise<void>
|
|
|
1041
1053
|
// A transient provider-error pause intentionally leaves the paused badge
|
|
1042
1054
|
// visible so the user still has a resumable auto-mode signal on screen.
|
|
1043
1055
|
if (!s.paused) {
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1056
|
+
if (preserveStepSurface) {
|
|
1057
|
+
s.preserveStepSurfaceAfterLoopExit = false;
|
|
1058
|
+
} else {
|
|
1059
|
+
ctx.ui.setStatus("gsd-auto", undefined);
|
|
1060
|
+
ctx.ui.setWidget("gsd-progress", undefined);
|
|
1061
|
+
if (s.completionStopInProgress) {
|
|
1062
|
+
s.completionStopInProgress = false;
|
|
1063
|
+
}
|
|
1064
|
+
initHealthWidget(ctx);
|
|
1047
1065
|
}
|
|
1048
|
-
initHealthWidget(ctx);
|
|
1049
1066
|
}
|
|
1050
1067
|
|
|
1051
|
-
// ADR-016 phase 3 (#5693): the stop-path basePath restore routes
|
|
1052
|
-
// `Lifecycle.restoreToProjectRoot()`, the sole owner of
|
|
1053
|
-
//
|
|
1054
|
-
//
|
|
1055
|
-
//
|
|
1056
|
-
|
|
1057
|
-
// session-state mutation.
|
|
1058
|
-
if (s.originalBasePath) {
|
|
1068
|
+
// ADR-016 phase 3 (#5693): the stop-path basePath restore + chdir routes
|
|
1069
|
+
// through `Lifecycle.restoreToProjectRoot()`, the sole owner of both
|
|
1070
|
+
// `s.basePath` mutation and the paired `process.chdir` for auto-loop
|
|
1071
|
+
// transitions. The verb assigns `s.basePath` before any throwable work, so
|
|
1072
|
+
// a thrown error still leaves basePath restored.
|
|
1073
|
+
if (s.originalBasePath && !preserveStepSurface && !preservePausedSurface) {
|
|
1059
1074
|
try {
|
|
1060
1075
|
buildLifecycle().restoreToProjectRoot();
|
|
1061
1076
|
} catch (err) {
|
|
@@ -1065,14 +1080,9 @@ export async function cleanupAfterLoopExit(ctx: ExtensionContext): Promise<void>
|
|
|
1065
1080
|
{ file: "auto.ts" },
|
|
1066
1081
|
);
|
|
1067
1082
|
}
|
|
1068
|
-
try {
|
|
1069
|
-
process.chdir(s.originalBasePath);
|
|
1070
|
-
} catch (err) {
|
|
1071
|
-
logWarning("engine", `basePath restore/chdir failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
1072
|
-
}
|
|
1073
1083
|
}
|
|
1074
1084
|
|
|
1075
|
-
if (s.originalBasePath && s.cmdCtx) {
|
|
1085
|
+
if (s.originalBasePath && s.cmdCtx && !preserveStepSurface && !preservePausedSurface) {
|
|
1076
1086
|
const result = await rerootCommandSession(s.cmdCtx, s.originalBasePath);
|
|
1077
1087
|
if (result.status === "cancelled") {
|
|
1078
1088
|
logWarning("engine", "post-loop session re-root was cancelled", { file: "auto.ts", basePath: s.originalBasePath });
|
|
@@ -1384,20 +1394,14 @@ export async function stopAuto(
|
|
|
1384
1394
|
}
|
|
1385
1395
|
|
|
1386
1396
|
// ── Step 7: Restore basePath and chdir (ADR-016 phase 3, #5693) ──
|
|
1387
|
-
// `restoreToProjectRoot`
|
|
1388
|
-
// no
|
|
1397
|
+
// `restoreToProjectRoot` owns both s.basePath restore and process.chdir;
|
|
1398
|
+
// no paired chdir is needed at the call site.
|
|
1389
1399
|
if (s.originalBasePath) {
|
|
1390
1400
|
try {
|
|
1391
1401
|
buildLifecycle().restoreToProjectRoot();
|
|
1392
1402
|
} catch (e) {
|
|
1393
1403
|
debugLog("stop-cleanup-basepath", { error: e instanceof Error ? e.message : String(e) });
|
|
1394
1404
|
}
|
|
1395
|
-
try {
|
|
1396
|
-
process.chdir(s.basePath);
|
|
1397
|
-
} catch (err) {
|
|
1398
|
-
/* best-effort */
|
|
1399
|
-
logWarning("engine", `chdir failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
1400
|
-
}
|
|
1401
1405
|
}
|
|
1402
1406
|
|
|
1403
1407
|
// Re-root the active command session/tool runtime after worktree teardown.
|
|
@@ -1426,7 +1430,7 @@ export async function stopAuto(
|
|
|
1426
1430
|
if (ledger && ledger.units.length > 0) {
|
|
1427
1431
|
const totals = getProjectTotals(ledger.units);
|
|
1428
1432
|
ctx?.ui.notify(
|
|
1429
|
-
|
|
1433
|
+
formatAutoStopNotification(notificationPrefix, totals, ledger.units.length),
|
|
1430
1434
|
"info",
|
|
1431
1435
|
);
|
|
1432
1436
|
} else {
|
|
@@ -1733,7 +1737,6 @@ export async function pauseAuto(
|
|
|
1733
1737
|
restoreProjectRootEnv();
|
|
1734
1738
|
restoreMilestoneLockEnv();
|
|
1735
1739
|
s.pendingVerificationRetry = null;
|
|
1736
|
-
s.verificationRetryCount.clear();
|
|
1737
1740
|
ctx?.ui.setStatus("gsd-auto", "paused");
|
|
1738
1741
|
ctx?.ui.setWidget("gsd-progress", undefined);
|
|
1739
1742
|
const resumeCmd = s.stepMode ? "/gsd next" : "/gsd auto";
|
|
@@ -1792,6 +1795,82 @@ function buildLifecycle(): WorktreeLifecycle {
|
|
|
1792
1795
|
return new WorktreeLifecycle(s, buildWorktreeLifecycleDeps());
|
|
1793
1796
|
}
|
|
1794
1797
|
|
|
1798
|
+
/**
|
|
1799
|
+
* Build the production `DispatchAdapter` used by `createWiredAutoOrchestrationModule`.
|
|
1800
|
+
*
|
|
1801
|
+
* Exported so tests can verify parity with `runDispatch`'s `resolveDispatch` call —
|
|
1802
|
+
* the wired adapter must derive `structuredQuestionsAvailable`, `sessionContextWindow`,
|
|
1803
|
+
* `sessionProvider`, and `modelRegistry` the same way phases.ts:runDispatch does.
|
|
1804
|
+
*/
|
|
1805
|
+
export function createWiredDispatchAdapter(
|
|
1806
|
+
ctx: ExtensionContext,
|
|
1807
|
+
pi: ExtensionAPI,
|
|
1808
|
+
dispatchBasePath: string,
|
|
1809
|
+
): DispatchAdapter {
|
|
1810
|
+
return {
|
|
1811
|
+
async decideNextUnit(input) {
|
|
1812
|
+
const state = input.stateSnapshot;
|
|
1813
|
+
const active = state.activeMilestone;
|
|
1814
|
+
if (!active) return null;
|
|
1815
|
+
|
|
1816
|
+
const prefs = loadEffectiveGSDPreferences(dispatchBasePath)?.preferences;
|
|
1817
|
+
|
|
1818
|
+
// Derive session-derived dispatch inputs the same way phases.ts:runDispatch does
|
|
1819
|
+
// (#5789). Prefer caller-supplied values when present so test harnesses and
|
|
1820
|
+
// alternative wirings can inject deterministic snapshots; otherwise pull from
|
|
1821
|
+
// the captured pi/ctx references.
|
|
1822
|
+
const sessionProvider = input.sessionProvider ?? ctx.model?.provider;
|
|
1823
|
+
const sessionContextWindow = input.sessionContextWindow ?? ctx.model?.contextWindow;
|
|
1824
|
+
const modelRegistry = input.modelRegistry ?? (ctx.modelRegistry as MinimalModelRegistry | undefined);
|
|
1825
|
+
const authMode =
|
|
1826
|
+
sessionProvider && typeof ctx.modelRegistry?.getProviderAuthMode === "function"
|
|
1827
|
+
? ctx.modelRegistry.getProviderAuthMode(sessionProvider)
|
|
1828
|
+
: undefined;
|
|
1829
|
+
const activeTools = typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [];
|
|
1830
|
+
// Mirrors runDispatch: deep-planning keeps approval gates in plain chat
|
|
1831
|
+
// because structured questions can be cancelled outside the chat turn on
|
|
1832
|
+
// some transports.
|
|
1833
|
+
const structuredQuestionsAvailable =
|
|
1834
|
+
input.structuredQuestionsAvailable ??
|
|
1835
|
+
(prefs?.planning_depth === "deep"
|
|
1836
|
+
? "false"
|
|
1837
|
+
: supportsStructuredQuestions(activeTools, {
|
|
1838
|
+
authMode,
|
|
1839
|
+
baseUrl: ctx.model?.baseUrl,
|
|
1840
|
+
})
|
|
1841
|
+
? "true"
|
|
1842
|
+
: "false");
|
|
1843
|
+
|
|
1844
|
+
const action = await resolveDispatch({
|
|
1845
|
+
basePath: dispatchBasePath,
|
|
1846
|
+
mid: active.id,
|
|
1847
|
+
midTitle: active.title,
|
|
1848
|
+
state,
|
|
1849
|
+
prefs,
|
|
1850
|
+
structuredQuestionsAvailable,
|
|
1851
|
+
sessionContextWindow,
|
|
1852
|
+
sessionProvider,
|
|
1853
|
+
modelRegistry,
|
|
1854
|
+
});
|
|
1855
|
+
|
|
1856
|
+
if (action.action === "stop") {
|
|
1857
|
+
return {
|
|
1858
|
+
kind: "blocked",
|
|
1859
|
+
reason: action.reason,
|
|
1860
|
+
action: action.level === "warning" ? "pause" : "stop",
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
if (action.action !== "dispatch") return null;
|
|
1864
|
+
return {
|
|
1865
|
+
unitType: action.unitType,
|
|
1866
|
+
unitId: action.unitId,
|
|
1867
|
+
reason: action.matchedRule ?? "dispatch",
|
|
1868
|
+
preconditions: [],
|
|
1869
|
+
};
|
|
1870
|
+
},
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1795
1874
|
/**
|
|
1796
1875
|
* Thin entry glue for the new Auto Orchestration module.
|
|
1797
1876
|
*
|
|
@@ -1801,7 +1880,7 @@ function buildLifecycle(): WorktreeLifecycle {
|
|
|
1801
1880
|
*/
|
|
1802
1881
|
export function createWiredAutoOrchestrationModule(
|
|
1803
1882
|
ctx: ExtensionContext,
|
|
1804
|
-
|
|
1883
|
+
pi: ExtensionAPI,
|
|
1805
1884
|
dispatchBasePath: string,
|
|
1806
1885
|
runtimeBasePath = resolveProjectRoot(dispatchBasePath),
|
|
1807
1886
|
): AutoOrchestrationModule {
|
|
@@ -1830,30 +1909,7 @@ export function createWiredAutoOrchestrationModule(
|
|
|
1830
1909
|
};
|
|
1831
1910
|
},
|
|
1832
1911
|
},
|
|
1833
|
-
dispatch:
|
|
1834
|
-
async decideNextUnit(input) {
|
|
1835
|
-
const state = input.stateSnapshot;
|
|
1836
|
-
const active = state.activeMilestone;
|
|
1837
|
-
if (!active) return null;
|
|
1838
|
-
|
|
1839
|
-
const prefs = loadEffectiveGSDPreferences(dispatchBasePath)?.preferences;
|
|
1840
|
-
const action = await resolveDispatch({
|
|
1841
|
-
basePath: dispatchBasePath,
|
|
1842
|
-
mid: active.id,
|
|
1843
|
-
midTitle: active.title,
|
|
1844
|
-
state,
|
|
1845
|
-
prefs,
|
|
1846
|
-
});
|
|
1847
|
-
|
|
1848
|
-
if (action.action !== "dispatch") return null;
|
|
1849
|
-
return {
|
|
1850
|
-
unitType: action.unitType,
|
|
1851
|
-
unitId: action.unitId,
|
|
1852
|
-
reason: action.matchedRule ?? "dispatch",
|
|
1853
|
-
preconditions: [],
|
|
1854
|
-
};
|
|
1855
|
-
},
|
|
1856
|
-
},
|
|
1912
|
+
dispatch: createWiredDispatchAdapter(ctx, pi, dispatchBasePath),
|
|
1857
1913
|
recovery: {
|
|
1858
1914
|
async classifyAndRecover(input) {
|
|
1859
1915
|
const recovery = classifyFailure(input);
|
|
@@ -1902,12 +1958,25 @@ export function createWiredAutoOrchestrationModule(
|
|
|
1902
1958
|
async cleanupOnStop() {},
|
|
1903
1959
|
},
|
|
1904
1960
|
health: {
|
|
1961
|
+
checkResourcesStale() {
|
|
1962
|
+
return checkResourcesStale(s.resourceVersionOnStart);
|
|
1963
|
+
},
|
|
1905
1964
|
async preAdvanceGate() {
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1965
|
+
try {
|
|
1966
|
+
const gate = await preDispatchHealthGate(dispatchBasePath);
|
|
1967
|
+
if (gate.proceed) {
|
|
1968
|
+
return {
|
|
1969
|
+
kind: "pass",
|
|
1970
|
+
fixesApplied: gate.fixesApplied,
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
return {
|
|
1974
|
+
kind: "fail",
|
|
1975
|
+
reason: gate.reason ?? "Pre-dispatch health check failed — run /gsd doctor for details.",
|
|
1976
|
+
};
|
|
1977
|
+
} catch (error) {
|
|
1978
|
+
return { kind: "threw", error };
|
|
1979
|
+
}
|
|
1911
1980
|
},
|
|
1912
1981
|
async postAdvanceRecord(result) {
|
|
1913
1982
|
if (result.kind === "error") {
|
|
@@ -1975,11 +2044,60 @@ export function createWiredAutoOrchestrationModule(
|
|
|
1975
2044
|
}
|
|
1976
2045
|
},
|
|
1977
2046
|
},
|
|
2047
|
+
uokGate: {
|
|
2048
|
+
async emit(input) {
|
|
2049
|
+
const prefs = loadEffectiveGSDPreferences(dispatchBasePath)?.preferences;
|
|
2050
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
2051
|
+
if (!uokFlags.gates) return;
|
|
2052
|
+
const milestoneId = input.milestoneId ?? s.currentMilestoneId ?? undefined;
|
|
2053
|
+
try {
|
|
2054
|
+
const { UokGateRunner } = await import("./uok/gate-runner.js");
|
|
2055
|
+
const runner = new UokGateRunner();
|
|
2056
|
+
runner.register({
|
|
2057
|
+
id: input.gateId,
|
|
2058
|
+
type: input.gateType,
|
|
2059
|
+
execute: async () => ({
|
|
2060
|
+
outcome: input.outcome,
|
|
2061
|
+
failureClass: input.failureClass,
|
|
2062
|
+
rationale: input.rationale,
|
|
2063
|
+
findings: input.findings ?? "",
|
|
2064
|
+
}),
|
|
2065
|
+
});
|
|
2066
|
+
await runner.run(input.gateId, {
|
|
2067
|
+
basePath: dispatchBasePath,
|
|
2068
|
+
traceId: `pre-dispatch:${flowId}`,
|
|
2069
|
+
turnId: `orch-${seq}`,
|
|
2070
|
+
milestoneId,
|
|
2071
|
+
unitType: "pre-dispatch",
|
|
2072
|
+
unitId: `orch-${seq}`,
|
|
2073
|
+
});
|
|
2074
|
+
} catch (err) {
|
|
2075
|
+
logWarning("engine", `uok gate emit failed: ${getErrorMessage(err)}`, {
|
|
2076
|
+
file: "auto.ts",
|
|
2077
|
+
gateId: input.gateId,
|
|
2078
|
+
gateType: input.gateType,
|
|
2079
|
+
...(milestoneId ? { milestoneId } : {}),
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
},
|
|
1978
2084
|
};
|
|
1979
2085
|
|
|
1980
2086
|
return createAutoOrchestrator(deps);
|
|
1981
2087
|
}
|
|
1982
2088
|
|
|
2089
|
+
function notifyResumeBlocked(ctx: ExtensionContext, result: Extract<AutoAdvanceResult, { kind: "blocked" }>): void {
|
|
2090
|
+
const resumeCmd = s.stepMode ? "/gsd next" : "/gsd auto";
|
|
2091
|
+
ctx.ui.notify(`Auto-mode blocked: ${result.reason}. Fix and run ${resumeCmd} to resume.`, "warning");
|
|
2092
|
+
setLifecycleOutcome(ctx, {
|
|
2093
|
+
status: "blocked",
|
|
2094
|
+
title: "Auto-mode blocked",
|
|
2095
|
+
detail: result.reason,
|
|
2096
|
+
nextAction: `Fix the blocker, then run ${resumeCmd} to resume.`,
|
|
2097
|
+
commands: ["/gsd status for overview", `${resumeCmd} to resume`, "/gsd doctor to diagnose"],
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
|
|
1983
2101
|
function ensureOrchestrationModule(ctx: ExtensionContext, pi: ExtensionAPI, basePath: string): void {
|
|
1984
2102
|
s.orchestration = createWiredAutoOrchestrationModule(ctx, pi, basePath, lockBase());
|
|
1985
2103
|
}
|
|
@@ -2317,7 +2435,7 @@ export async function startAuto(
|
|
|
2317
2435
|
// This closes the journal gap reported in #3348 where the worker wrote side
|
|
2318
2436
|
// effects (SUMMARY.md, DB updates) but died before emitting unit-end.
|
|
2319
2437
|
emitCrashRecoveredUnitEnd(base, freshStartAssessment.lock);
|
|
2320
|
-
|
|
2438
|
+
clearStaleWorkerLock(base);
|
|
2321
2439
|
}
|
|
2322
2440
|
|
|
2323
2441
|
if (!s.paused) {
|
|
@@ -2388,6 +2506,8 @@ export async function startAuto(
|
|
|
2388
2506
|
s.unitLifetimeDispatches.clear();
|
|
2389
2507
|
if (!getLedger()) initMetrics(base);
|
|
2390
2508
|
if (s.currentMilestoneId) setActiveMilestoneId(base, s.currentMilestoneId);
|
|
2509
|
+
await openProjectDbIfPresent(base);
|
|
2510
|
+
registerAutoWorkerForSession(s, base);
|
|
2391
2511
|
|
|
2392
2512
|
// Re-register health level notification callback lost across process restart
|
|
2393
2513
|
setLevelChangeCallback((_from, to, summary) => {
|
|
@@ -2495,7 +2615,12 @@ export async function startAuto(
|
|
|
2495
2615
|
pi.events.emit(CMUX_CHANNELS.LOG, { preferences: loadEffectiveGSDPreferences(s.basePath || undefined)?.preferences, message: s.stepMode ? "Step-mode resumed." : "Auto-mode resumed.", level: "progress" });
|
|
2496
2616
|
|
|
2497
2617
|
try {
|
|
2498
|
-
await s.orchestration?.resume();
|
|
2618
|
+
const resumeResult = await s.orchestration?.resume();
|
|
2619
|
+
if (resumeResult?.kind === "blocked") {
|
|
2620
|
+
notifyResumeBlocked(ctx, resumeResult);
|
|
2621
|
+
await cleanupAfterLoopExit(ctx);
|
|
2622
|
+
return;
|
|
2623
|
+
}
|
|
2499
2624
|
} catch (err) {
|
|
2500
2625
|
debugLog("resume-orchestration-resume", { error: err instanceof Error ? err.message : String(err) });
|
|
2501
2626
|
}
|
|
@@ -2516,6 +2641,7 @@ export async function startAuto(
|
|
|
2516
2641
|
const bootstrapDeps: BootstrapDeps = {
|
|
2517
2642
|
shouldUseWorktreeIsolation,
|
|
2518
2643
|
registerSigtermHandler,
|
|
2644
|
+
registerAutoWorkerForSession: (projectRoot) => registerAutoWorkerForSession(s, projectRoot),
|
|
2519
2645
|
lockBase,
|
|
2520
2646
|
buildLifecycle,
|
|
2521
2647
|
};
|