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
|
@@ -173,7 +173,18 @@ function gitPathspecForWorktreePath(basePath, targetPath) {
|
|
|
173
173
|
let base = basePath;
|
|
174
174
|
let target = targetPath;
|
|
175
175
|
try {
|
|
176
|
-
base =
|
|
176
|
+
base = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
177
|
+
cwd: basePath,
|
|
178
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
179
|
+
encoding: "utf-8",
|
|
180
|
+
}).trim() || basePath;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
/* keep original */
|
|
184
|
+
void base;
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
base = realpathSync.native(base);
|
|
177
188
|
}
|
|
178
189
|
catch {
|
|
179
190
|
/* keep original */
|
|
@@ -191,6 +202,9 @@ function gitPathspecForWorktreePath(basePath, targetPath) {
|
|
|
191
202
|
return null;
|
|
192
203
|
return rel.replaceAll("\\", "/");
|
|
193
204
|
}
|
|
205
|
+
export function _gitPathspecForWorktreePath(basePath, targetPath) {
|
|
206
|
+
return gitPathspecForWorktreePath(basePath, targetPath);
|
|
207
|
+
}
|
|
194
208
|
function gitRemoteExists(basePath, remote) {
|
|
195
209
|
try {
|
|
196
210
|
execFileSync("git", ["remote", "get-url", remote], {
|
|
@@ -204,6 +218,52 @@ function gitRemoteExists(basePath, remote) {
|
|
|
204
218
|
return false;
|
|
205
219
|
}
|
|
206
220
|
}
|
|
221
|
+
function findRegularMergeChangedPaths(basePath, milestoneBranch, mainBranch) {
|
|
222
|
+
const changedPaths = new Set();
|
|
223
|
+
let mergeLog = "";
|
|
224
|
+
try {
|
|
225
|
+
mergeLog = execFileSync("git", ["rev-list", "--merges", "--parents", mainBranch], {
|
|
226
|
+
cwd: basePath,
|
|
227
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
228
|
+
encoding: "utf-8",
|
|
229
|
+
}).trim();
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
logWarning("worktree", `regular merge lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
233
|
+
return changedPaths;
|
|
234
|
+
}
|
|
235
|
+
for (const line of mergeLog.split("\n").filter(Boolean)) {
|
|
236
|
+
const [mergeCommit, firstParent, ...otherParents] = line.split(" ");
|
|
237
|
+
if (!mergeCommit || !firstParent || otherParents.length === 0)
|
|
238
|
+
continue;
|
|
239
|
+
const mergedMilestone = otherParents.some((parent) => {
|
|
240
|
+
try {
|
|
241
|
+
return nativeIsAncestor(basePath, milestoneBranch, parent);
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
if (!mergedMilestone)
|
|
248
|
+
continue;
|
|
249
|
+
try {
|
|
250
|
+
const output = execFileSync("git", ["diff", "--name-only", firstParent, mergeCommit], {
|
|
251
|
+
cwd: basePath,
|
|
252
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
253
|
+
encoding: "utf-8",
|
|
254
|
+
}).trim();
|
|
255
|
+
for (const path of output.split("\n").filter(Boolean)) {
|
|
256
|
+
if (!path.startsWith(".gsd/"))
|
|
257
|
+
changedPaths.add(path);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
logWarning("worktree", `regular merge diff lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
262
|
+
}
|
|
263
|
+
return changedPaths;
|
|
264
|
+
}
|
|
265
|
+
return changedPaths;
|
|
266
|
+
}
|
|
207
267
|
function clearProjectRootStateFiles(basePath, milestoneId) {
|
|
208
268
|
const gsdDir = gsdRoot(basePath);
|
|
209
269
|
// Phase C pt 2: auto.lock removed from this list — the file is gone
|
|
@@ -530,8 +590,9 @@ export function syncGsdStateToWorktree(mainBasePath, worktreePath_) {
|
|
|
530
590
|
// If both resolve to the same directory (symlink), no sync needed
|
|
531
591
|
if (isSamePath(mainGsd, wtGsd))
|
|
532
592
|
return { synced };
|
|
533
|
-
if (!existsSync(mainGsd)
|
|
593
|
+
if (!existsSync(mainGsd))
|
|
534
594
|
return { synced };
|
|
595
|
+
mkdirSync(wtGsd, { recursive: true });
|
|
535
596
|
// Sync root-level .gsd/ files (DECISIONS, REQUIREMENTS, PROJECT, KNOWLEDGE, etc.)
|
|
536
597
|
for (const f of ROOT_STATE_FILES) {
|
|
537
598
|
const src = join(mainGsd, f);
|
|
@@ -810,7 +871,63 @@ export function enterBranchModeForMilestone(basePath, milestoneId) {
|
|
|
810
871
|
reused: true,
|
|
811
872
|
});
|
|
812
873
|
}
|
|
813
|
-
|
|
874
|
+
checkoutBranchWithStashGuard(basePath, branch, `enter-branch-mode:${milestoneId}`);
|
|
875
|
+
}
|
|
876
|
+
export function checkoutBranchWithStashGuard(basePath, branch, reason) {
|
|
877
|
+
let stashMarker = null;
|
|
878
|
+
let stashed = false;
|
|
879
|
+
const status = nativeWorkingTreeStatus(basePath).trim();
|
|
880
|
+
if (status.length > 0) {
|
|
881
|
+
stashMarker = `gsd-checkout-stash:${reason}:${process.pid}:${Date.now()}:${process.hrtime.bigint().toString(36)}`;
|
|
882
|
+
const stashListBefore = execFileSync("git", ["stash", "list"], {
|
|
883
|
+
cwd: basePath,
|
|
884
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
885
|
+
encoding: "utf-8",
|
|
886
|
+
});
|
|
887
|
+
execFileSync("git", ["stash", "push", "--include-untracked", "-m", `gsd: checkout stash [${stashMarker}]`], {
|
|
888
|
+
cwd: basePath,
|
|
889
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
890
|
+
encoding: "utf-8",
|
|
891
|
+
});
|
|
892
|
+
const stashListAfter = execFileSync("git", ["stash", "list"], {
|
|
893
|
+
cwd: basePath,
|
|
894
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
895
|
+
encoding: "utf-8",
|
|
896
|
+
});
|
|
897
|
+
stashed = stashListAfter !== stashListBefore;
|
|
898
|
+
}
|
|
899
|
+
// Checkout and stash-restore are split so we can distinguish two failure
|
|
900
|
+
// modes: (a) checkout failed → HEAD did not move, restore stash and rethrow;
|
|
901
|
+
// (b) checkout succeeded but stash pop failed → HEAD moved to `branch` but
|
|
902
|
+
// the working-tree changes remain in the stash list. We surface a distinct
|
|
903
|
+
// error in case (b) so callers don't assume the branch switch was rolled back.
|
|
904
|
+
try {
|
|
905
|
+
nativeCheckoutBranch(basePath, branch);
|
|
906
|
+
}
|
|
907
|
+
catch (checkoutErr) {
|
|
908
|
+
if (stashed) {
|
|
909
|
+
try {
|
|
910
|
+
popStashByRef(basePath, stashMarker);
|
|
911
|
+
}
|
|
912
|
+
catch (restoreErr) {
|
|
913
|
+
logWarning("worktree", `git stash pop failed during checkout restore: ${restoreErr instanceof Error ? restoreErr.message : String(restoreErr)}`);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
throw checkoutErr;
|
|
917
|
+
}
|
|
918
|
+
if (stashed) {
|
|
919
|
+
try {
|
|
920
|
+
popStashByRef(basePath, stashMarker);
|
|
921
|
+
}
|
|
922
|
+
catch (popErr) {
|
|
923
|
+
const msg = popErr instanceof Error ? popErr.message : String(popErr);
|
|
924
|
+
const wrapped = new Error(`checkout to '${branch}' succeeded but stash restore failed; working tree changes remain in the stash list. Original error: ${msg}`);
|
|
925
|
+
const ref = popErr?.stashRef;
|
|
926
|
+
if (ref)
|
|
927
|
+
wrapped.stashRef = ref;
|
|
928
|
+
throw wrapped;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
814
931
|
}
|
|
815
932
|
// ─── Public API ────────────────────────────────────────────────────────────
|
|
816
933
|
/**
|
|
@@ -1482,6 +1599,56 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1482
1599
|
});
|
|
1483
1600
|
}
|
|
1484
1601
|
}
|
|
1602
|
+
// Already regular-merged milestones can skip the squash path and proceed to cleanup (#5831).
|
|
1603
|
+
if (nativeIsAncestor(originalBasePath_, milestoneBranch, mainBranch)) {
|
|
1604
|
+
const codeChanges = nativeDiffNumstat(originalBasePath_, mainBranch, milestoneBranch).filter((entry) => !entry.path.startsWith(".gsd/"));
|
|
1605
|
+
if (codeChanges.length > 0) {
|
|
1606
|
+
const regularMergeChangedPaths = findRegularMergeChangedPaths(originalBasePath_, milestoneBranch, mainBranch);
|
|
1607
|
+
const unanchoredCodeChanges = codeChanges.filter((entry) => regularMergeChangedPaths.has(entry.path));
|
|
1608
|
+
if (unanchoredCodeChanges.length > 0) {
|
|
1609
|
+
process.chdir(previousCwd);
|
|
1610
|
+
throw new GSDError(GSD_GIT_ERROR, `Milestone branch "${milestoneBranch}" is reachable from "${mainBranch}" ` +
|
|
1611
|
+
`but has ${unanchoredCodeChanges.length} milestone-touched code file(s) not on current "${mainBranch}". ` +
|
|
1612
|
+
`Aborting worktree teardown to prevent data loss.`);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
debugLog("mergeMilestoneToMain", {
|
|
1616
|
+
action: "skip-squash-already-merged",
|
|
1617
|
+
milestoneId,
|
|
1618
|
+
milestoneBranch,
|
|
1619
|
+
mainBranch,
|
|
1620
|
+
});
|
|
1621
|
+
try {
|
|
1622
|
+
clearProjectRootStateFiles(originalBasePath_, milestoneId);
|
|
1623
|
+
}
|
|
1624
|
+
catch (err) {
|
|
1625
|
+
logWarning("worktree", `clearProjectRootStateFiles failed during already-merged cleanup: ${err instanceof Error ? err.message : String(err)}`);
|
|
1626
|
+
}
|
|
1627
|
+
try {
|
|
1628
|
+
removeWorktree(originalBasePath_, milestoneId, {
|
|
1629
|
+
branch: milestoneBranch,
|
|
1630
|
+
deleteBranch: false,
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
catch (err) {
|
|
1634
|
+
logWarning("worktree", `worktree removal failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1635
|
+
}
|
|
1636
|
+
try {
|
|
1637
|
+
nativeBranchDelete(originalBasePath_, milestoneBranch);
|
|
1638
|
+
}
|
|
1639
|
+
catch (err) {
|
|
1640
|
+
logWarning("worktree", `git branch-delete failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1641
|
+
}
|
|
1642
|
+
setActiveWorkspace(null);
|
|
1643
|
+
nudgeGitBranchCache(previousCwd);
|
|
1644
|
+
try {
|
|
1645
|
+
process.chdir(originalBasePath_);
|
|
1646
|
+
}
|
|
1647
|
+
catch (err) {
|
|
1648
|
+
logWarning("worktree", `chdir to project root after already-merged cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1649
|
+
}
|
|
1650
|
+
return { commitMessage, pushed: false, prCreated: false, codeFilesChanged: true };
|
|
1651
|
+
}
|
|
1485
1652
|
// 7. Shelter queued milestone directories before the squash merge (#2505).
|
|
1486
1653
|
// The milestone branch may contain copies of queued milestone dirs (via
|
|
1487
1654
|
// copyPlanningArtifacts), so `git merge --squash` rejects when those same
|
|
@@ -1617,14 +1784,6 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1617
1784
|
// report the dirty tree if it fails.
|
|
1618
1785
|
logWarning("worktree", `git stash failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1619
1786
|
}
|
|
1620
|
-
if (needsDbCycle && dbPathToReopen) {
|
|
1621
|
-
try {
|
|
1622
|
-
openDatabase(dbPathToReopen);
|
|
1623
|
-
}
|
|
1624
|
-
catch (err) {
|
|
1625
|
-
logWarning("worktree", `post-stash db reopen failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
1787
|
// 7b. Clean up stale merge state before attempting squash merge (#2912).
|
|
1629
1788
|
// A leftover MERGE_HEAD (from a previous failed merge, libgit2 native path,
|
|
1630
1789
|
// or interrupted operation) causes `git merge --squash` to refuse with
|
|
@@ -1633,6 +1792,14 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1633
1792
|
removeMergeStateFiles(originalBasePath_, "pre-merge");
|
|
1634
1793
|
// 8. Squash merge — auto-resolve .gsd/ state file conflicts (#530)
|
|
1635
1794
|
const mergeResult = nativeMergeSquash(originalBasePath_, milestoneBranch);
|
|
1795
|
+
if (needsDbCycle && dbPathToReopen) {
|
|
1796
|
+
try {
|
|
1797
|
+
openDatabase(dbPathToReopen);
|
|
1798
|
+
}
|
|
1799
|
+
catch (err) {
|
|
1800
|
+
logWarning("worktree", `post-merge db reopen failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1636
1803
|
if (!mergeResult.success) {
|
|
1637
1804
|
// Dirty working tree — the merge was rejected before it started (e.g.
|
|
1638
1805
|
// untracked .gsd/ files left by syncStateToProjectRoot). Preserve the
|
|
@@ -22,7 +22,7 @@ import { gsdRoot, resolveMilestoneFile, resolveMilestonePath, resolveDir, milest
|
|
|
22
22
|
import { invalidateAllCaches } from "./cache.js";
|
|
23
23
|
import { clearActivityLogState } from "./activity-log.js";
|
|
24
24
|
import { synthesizeCrashRecovery, getDeepDiagnostic, readActiveMilestoneId, } from "./session-forensics.js";
|
|
25
|
-
import { writeLock, clearLock, readCrashLock, isLockProcessAlive, formatCrashInfo, emitCrashRecoveredUnitEnd, emitOpenUnitEndForUnit, } from "./crash-recovery.js";
|
|
25
|
+
import { writeLock, clearLock, clearStaleWorkerLock, readCrashLock, isLockProcessAlive, formatCrashInfo, emitCrashRecoveredUnitEnd, emitOpenUnitEndForUnit, } from "./crash-recovery.js";
|
|
26
26
|
import { acquireSessionLock, getSessionLockStatus, releaseSessionLock, updateSessionLock, } from "./session-lock.js";
|
|
27
27
|
import { resolveAutoSupervisorConfig, loadEffectiveGSDPreferences, getIsolationMode, } from "./preferences.js";
|
|
28
28
|
import { sendDesktopNotification } from "./notifications.js";
|
|
@@ -127,6 +127,12 @@ import { normalizeRealPath } from "./paths.js";
|
|
|
127
127
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
128
128
|
/** Throttle STATE.md rebuilds — at most once per 30 seconds */
|
|
129
129
|
const STATE_REBUILD_MIN_INTERVAL_MS = 30_000;
|
|
130
|
+
export function formatAutoStopNotification(prefix, totals, unitCount) {
|
|
131
|
+
return [
|
|
132
|
+
`${prefix}.`,
|
|
133
|
+
`Session: ${formatCost(totals.cost)} · ${formatTokenCount(totals.tokens.total)} tokens · ${unitCount} units`,
|
|
134
|
+
].join("\n");
|
|
135
|
+
}
|
|
130
136
|
/**
|
|
131
137
|
* Phase B — register this auto-mode process in the workers table so other
|
|
132
138
|
* workers and janitors can detect liveness via heartbeat. Best-effort: if
|
|
@@ -683,6 +689,8 @@ export async function rerootCommandSession(cmdCtx, workspaceRoot) {
|
|
|
683
689
|
}
|
|
684
690
|
}
|
|
685
691
|
export async function cleanupAfterLoopExit(ctx) {
|
|
692
|
+
const preserveStepSurface = s.preserveStepSurfaceAfterLoopExit;
|
|
693
|
+
const preservePausedSurface = s.paused;
|
|
686
694
|
s.currentUnit = null;
|
|
687
695
|
s.active = false;
|
|
688
696
|
deactivateGSD();
|
|
@@ -706,34 +714,32 @@ export async function cleanupAfterLoopExit(ctx) {
|
|
|
706
714
|
// A transient provider-error pause intentionally leaves the paused badge
|
|
707
715
|
// visible so the user still has a resumable auto-mode signal on screen.
|
|
708
716
|
if (!s.paused) {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
717
|
+
if (preserveStepSurface) {
|
|
718
|
+
s.preserveStepSurfaceAfterLoopExit = false;
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
ctx.ui.setStatus("gsd-auto", undefined);
|
|
722
|
+
ctx.ui.setWidget("gsd-progress", undefined);
|
|
723
|
+
if (s.completionStopInProgress) {
|
|
724
|
+
s.completionStopInProgress = false;
|
|
725
|
+
}
|
|
726
|
+
initHealthWidget(ctx);
|
|
712
727
|
}
|
|
713
|
-
initHealthWidget(ctx);
|
|
714
728
|
}
|
|
715
|
-
// ADR-016 phase 3 (#5693): the stop-path basePath restore routes
|
|
716
|
-
// `Lifecycle.restoreToProjectRoot()`, the sole owner of
|
|
717
|
-
//
|
|
718
|
-
//
|
|
719
|
-
//
|
|
720
|
-
|
|
721
|
-
// session-state mutation.
|
|
722
|
-
if (s.originalBasePath) {
|
|
729
|
+
// ADR-016 phase 3 (#5693): the stop-path basePath restore + chdir routes
|
|
730
|
+
// through `Lifecycle.restoreToProjectRoot()`, the sole owner of both
|
|
731
|
+
// `s.basePath` mutation and the paired `process.chdir` for auto-loop
|
|
732
|
+
// transitions. The verb assigns `s.basePath` before any throwable work, so
|
|
733
|
+
// a thrown error still leaves basePath restored.
|
|
734
|
+
if (s.originalBasePath && !preserveStepSurface && !preservePausedSurface) {
|
|
723
735
|
try {
|
|
724
736
|
buildLifecycle().restoreToProjectRoot();
|
|
725
737
|
}
|
|
726
738
|
catch (err) {
|
|
727
739
|
logWarning("engine", `restore project root failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
728
740
|
}
|
|
729
|
-
try {
|
|
730
|
-
process.chdir(s.originalBasePath);
|
|
731
|
-
}
|
|
732
|
-
catch (err) {
|
|
733
|
-
logWarning("engine", `basePath restore/chdir failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
734
|
-
}
|
|
735
741
|
}
|
|
736
|
-
if (s.originalBasePath && s.cmdCtx) {
|
|
742
|
+
if (s.originalBasePath && s.cmdCtx && !preserveStepSurface && !preservePausedSurface) {
|
|
737
743
|
const result = await rerootCommandSession(s.cmdCtx, s.originalBasePath);
|
|
738
744
|
if (result.status === "cancelled") {
|
|
739
745
|
logWarning("engine", "post-loop session re-root was cancelled", { file: "auto.ts", basePath: s.originalBasePath });
|
|
@@ -815,15 +821,17 @@ export async function stopAuto(ctx, pi, reason, options = {}) {
|
|
|
815
821
|
? "merge-conflict"
|
|
816
822
|
: rawReason.startsWith("Merge error") || rawReason.startsWith("Merge failed")
|
|
817
823
|
? "merge-failed"
|
|
818
|
-
: rawReason.startsWith("
|
|
819
|
-
? "
|
|
820
|
-
: rawReason
|
|
821
|
-
? "
|
|
822
|
-
: rawReason === "
|
|
823
|
-
? "
|
|
824
|
-
: rawReason === "
|
|
825
|
-
?
|
|
826
|
-
: "
|
|
824
|
+
: rawReason.startsWith("Slice-parallel dispatched")
|
|
825
|
+
? "stop"
|
|
826
|
+
: rawReason.startsWith("slice-merge-conflict")
|
|
827
|
+
? "slice-merge-conflict"
|
|
828
|
+
: rawReason === "All milestones complete"
|
|
829
|
+
? "all-complete"
|
|
830
|
+
: rawReason === "No active milestone"
|
|
831
|
+
? "no-active-milestone"
|
|
832
|
+
: rawReason === "stop" || rawReason === "pause"
|
|
833
|
+
? rawReason
|
|
834
|
+
: "other";
|
|
827
835
|
const telemetryBase = s.originalBasePath || s.basePath;
|
|
828
836
|
emitAutoExit(telemetryBase, {
|
|
829
837
|
reason: normalizedReason,
|
|
@@ -1002,8 +1010,8 @@ export async function stopAuto(ctx, pi, reason, options = {}) {
|
|
|
1002
1010
|
}
|
|
1003
1011
|
}
|
|
1004
1012
|
// ── Step 7: Restore basePath and chdir (ADR-016 phase 3, #5693) ──
|
|
1005
|
-
// `restoreToProjectRoot`
|
|
1006
|
-
// no
|
|
1013
|
+
// `restoreToProjectRoot` owns both s.basePath restore and process.chdir;
|
|
1014
|
+
// no paired chdir is needed at the call site.
|
|
1007
1015
|
if (s.originalBasePath) {
|
|
1008
1016
|
try {
|
|
1009
1017
|
buildLifecycle().restoreToProjectRoot();
|
|
@@ -1011,13 +1019,6 @@ export async function stopAuto(ctx, pi, reason, options = {}) {
|
|
|
1011
1019
|
catch (e) {
|
|
1012
1020
|
debugLog("stop-cleanup-basepath", { error: e instanceof Error ? e.message : String(e) });
|
|
1013
1021
|
}
|
|
1014
|
-
try {
|
|
1015
|
-
process.chdir(s.basePath);
|
|
1016
|
-
}
|
|
1017
|
-
catch (err) {
|
|
1018
|
-
/* best-effort */
|
|
1019
|
-
logWarning("engine", `chdir failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
1020
|
-
}
|
|
1021
1022
|
}
|
|
1022
1023
|
// Re-root the active command session/tool runtime after worktree teardown.
|
|
1023
1024
|
// mergeAndExit restores process.cwd(), but AgentSession has already captured
|
|
@@ -1044,7 +1045,7 @@ export async function stopAuto(ctx, pi, reason, options = {}) {
|
|
|
1044
1045
|
: `Auto-mode stopped${reasonSuffix}`;
|
|
1045
1046
|
if (ledger && ledger.units.length > 0) {
|
|
1046
1047
|
const totals = getProjectTotals(ledger.units);
|
|
1047
|
-
ctx?.ui.notify(
|
|
1048
|
+
ctx?.ui.notify(formatAutoStopNotification(notificationPrefix, totals, ledger.units.length), "info");
|
|
1048
1049
|
}
|
|
1049
1050
|
else {
|
|
1050
1051
|
ctx?.ui.notify(`${notificationPrefix}.`, "info");
|
|
@@ -1333,7 +1334,6 @@ export async function pauseAuto(ctx, _pi, _errorContext) {
|
|
|
1333
1334
|
restoreProjectRootEnv();
|
|
1334
1335
|
restoreMilestoneLockEnv();
|
|
1335
1336
|
s.pendingVerificationRetry = null;
|
|
1336
|
-
s.verificationRetryCount.clear();
|
|
1337
1337
|
ctx?.ui.setStatus("gsd-auto", "paused");
|
|
1338
1338
|
ctx?.ui.setWidget("gsd-progress", undefined);
|
|
1339
1339
|
const resumeCmd = s.stepMode ? "/gsd next" : "/gsd auto";
|
|
@@ -1393,7 +1393,7 @@ function buildLifecycle() {
|
|
|
1393
1393
|
* the wired adapter must derive `structuredQuestionsAvailable`, `sessionContextWindow`,
|
|
1394
1394
|
* `sessionProvider`, and `modelRegistry` the same way phases.ts:runDispatch does.
|
|
1395
1395
|
*/
|
|
1396
|
-
export function createWiredDispatchAdapter(ctx, pi, dispatchBasePath) {
|
|
1396
|
+
export function createWiredDispatchAdapter(ctx, pi, dispatchBasePath, session) {
|
|
1397
1397
|
return {
|
|
1398
1398
|
async decideNextUnit(input) {
|
|
1399
1399
|
const state = input.stateSnapshot;
|
|
@@ -1430,13 +1430,38 @@ export function createWiredDispatchAdapter(ctx, pi, dispatchBasePath) {
|
|
|
1430
1430
|
midTitle: active.title,
|
|
1431
1431
|
state,
|
|
1432
1432
|
prefs,
|
|
1433
|
+
session: input.session,
|
|
1433
1434
|
structuredQuestionsAvailable,
|
|
1434
1435
|
sessionContextWindow,
|
|
1435
1436
|
sessionProvider,
|
|
1436
1437
|
modelRegistry,
|
|
1437
1438
|
});
|
|
1438
|
-
if (action.action
|
|
1439
|
+
if (action.action === "stop") {
|
|
1440
|
+
if (session)
|
|
1441
|
+
session.pendingOrchestrationDispatch = null;
|
|
1442
|
+
return {
|
|
1443
|
+
kind: "blocked",
|
|
1444
|
+
reason: action.reason,
|
|
1445
|
+
action: action.level === "warning" ? "pause" : "stop",
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
if (action.action !== "dispatch") {
|
|
1449
|
+
if (session)
|
|
1450
|
+
session.pendingOrchestrationDispatch = null;
|
|
1439
1451
|
return null;
|
|
1452
|
+
}
|
|
1453
|
+
if (session) {
|
|
1454
|
+
const pending = {
|
|
1455
|
+
unitType: action.unitType,
|
|
1456
|
+
unitId: action.unitId,
|
|
1457
|
+
prompt: action.prompt,
|
|
1458
|
+
pauseAfterUatDispatch: action.pauseAfterDispatch ?? false,
|
|
1459
|
+
state,
|
|
1460
|
+
mid: active.id,
|
|
1461
|
+
midTitle: active.title,
|
|
1462
|
+
};
|
|
1463
|
+
session.pendingOrchestrationDispatch = pending;
|
|
1464
|
+
}
|
|
1440
1465
|
return {
|
|
1441
1466
|
unitType: action.unitType,
|
|
1442
1467
|
unitId: action.unitId,
|
|
@@ -1477,7 +1502,7 @@ export function createWiredAutoOrchestrationModule(ctx, pi, dispatchBasePath, ru
|
|
|
1477
1502
|
};
|
|
1478
1503
|
},
|
|
1479
1504
|
},
|
|
1480
|
-
dispatch: createWiredDispatchAdapter(ctx, pi, dispatchBasePath),
|
|
1505
|
+
dispatch: createWiredDispatchAdapter(ctx, pi, dispatchBasePath, s),
|
|
1481
1506
|
recovery: {
|
|
1482
1507
|
async classifyAndRecover(input) {
|
|
1483
1508
|
const recovery = classifyFailure(input);
|
|
@@ -1575,22 +1600,22 @@ export function createWiredAutoOrchestrationModule(ctx, pi, dispatchBasePath, ru
|
|
|
1575
1600
|
},
|
|
1576
1601
|
async journalTransition(event) {
|
|
1577
1602
|
const eventType = event.name === "start"
|
|
1578
|
-
? "iteration-start"
|
|
1603
|
+
? "orchestrator-iteration-start"
|
|
1579
1604
|
: event.name === "resume"
|
|
1580
|
-
? "iteration-start"
|
|
1605
|
+
? "orchestrator-iteration-start"
|
|
1581
1606
|
: event.name === "advance"
|
|
1582
|
-
? "dispatch-match"
|
|
1607
|
+
? "orchestrator-dispatch-match"
|
|
1583
1608
|
: event.name === "advance-blocked"
|
|
1584
|
-
? "guard-block"
|
|
1609
|
+
? "orchestrator-guard-block"
|
|
1585
1610
|
: event.name === "advance-stopped"
|
|
1586
|
-
? "dispatch-stop"
|
|
1611
|
+
? "orchestrator-dispatch-stop"
|
|
1587
1612
|
: event.name === "advance-error"
|
|
1588
|
-
? "iteration-end"
|
|
1613
|
+
? "orchestrator-iteration-end"
|
|
1589
1614
|
: event.name === "advance-paused" || event.name === "advance-retry"
|
|
1590
|
-
? "guard-block"
|
|
1615
|
+
? "orchestrator-guard-block"
|
|
1591
1616
|
: event.name === "stop"
|
|
1592
|
-
? "terminal"
|
|
1593
|
-
: "iteration-end";
|
|
1617
|
+
? "orchestrator-terminal"
|
|
1618
|
+
: "orchestrator-iteration-end";
|
|
1594
1619
|
_emitJournalEvent(runtimeBasePath, {
|
|
1595
1620
|
ts: new Date().toISOString(),
|
|
1596
1621
|
flowId,
|
|
@@ -1655,6 +1680,17 @@ export function createWiredAutoOrchestrationModule(ctx, pi, dispatchBasePath, ru
|
|
|
1655
1680
|
};
|
|
1656
1681
|
return createAutoOrchestrator(deps);
|
|
1657
1682
|
}
|
|
1683
|
+
function notifyResumeBlocked(ctx, result) {
|
|
1684
|
+
const resumeCmd = s.stepMode ? "/gsd next" : "/gsd auto";
|
|
1685
|
+
ctx.ui.notify(`Auto-mode blocked: ${result.reason}. Fix and run ${resumeCmd} to resume.`, "warning");
|
|
1686
|
+
setLifecycleOutcome(ctx, {
|
|
1687
|
+
status: "blocked",
|
|
1688
|
+
title: "Auto-mode blocked",
|
|
1689
|
+
detail: result.reason,
|
|
1690
|
+
nextAction: `Fix the blocker, then run ${resumeCmd} to resume.`,
|
|
1691
|
+
commands: ["/gsd status for overview", `${resumeCmd} to resume`, "/gsd doctor to diagnose"],
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1658
1694
|
function ensureOrchestrationModule(ctx, pi, basePath) {
|
|
1659
1695
|
s.orchestration = createWiredAutoOrchestrationModule(ctx, pi, basePath, lockBase());
|
|
1660
1696
|
}
|
|
@@ -1939,7 +1975,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1939
1975
|
// This closes the journal gap reported in #3348 where the worker wrote side
|
|
1940
1976
|
// effects (SUMMARY.md, DB updates) but died before emitting unit-end.
|
|
1941
1977
|
emitCrashRecoveredUnitEnd(base, freshStartAssessment.lock);
|
|
1942
|
-
|
|
1978
|
+
clearStaleWorkerLock(base);
|
|
1943
1979
|
}
|
|
1944
1980
|
if (!s.paused) {
|
|
1945
1981
|
s.pendingCrashRecovery =
|
|
@@ -2002,6 +2038,8 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
2002
2038
|
initMetrics(base);
|
|
2003
2039
|
if (s.currentMilestoneId)
|
|
2004
2040
|
setActiveMilestoneId(base, s.currentMilestoneId);
|
|
2041
|
+
await openProjectDbIfPresent(base);
|
|
2042
|
+
registerAutoWorkerForSession(s, base);
|
|
2005
2043
|
// Re-register health level notification callback lost across process restart
|
|
2006
2044
|
setLevelChangeCallback((_from, to, summary) => {
|
|
2007
2045
|
const level = to === "red" ? "error" : to === "yellow" ? "warning" : "info";
|
|
@@ -2077,7 +2115,12 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
2077
2115
|
}
|
|
2078
2116
|
pi.events.emit(CMUX_CHANNELS.LOG, { preferences: loadEffectiveGSDPreferences(s.basePath || undefined)?.preferences, message: s.stepMode ? "Step-mode resumed." : "Auto-mode resumed.", level: "progress" });
|
|
2079
2117
|
try {
|
|
2080
|
-
await s.orchestration?.resume();
|
|
2118
|
+
const resumeResult = await s.orchestration?.resume();
|
|
2119
|
+
if (resumeResult?.kind === "blocked") {
|
|
2120
|
+
notifyResumeBlocked(ctx, resumeResult);
|
|
2121
|
+
await cleanupAfterLoopExit(ctx);
|
|
2122
|
+
return;
|
|
2123
|
+
}
|
|
2081
2124
|
}
|
|
2082
2125
|
catch (err) {
|
|
2083
2126
|
debugLog("resume-orchestration-resume", { error: err instanceof Error ? err.message : String(err) });
|
|
@@ -2098,6 +2141,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
2098
2141
|
const bootstrapDeps = {
|
|
2099
2142
|
shouldUseWorktreeIsolation,
|
|
2100
2143
|
registerSigtermHandler,
|
|
2144
|
+
registerAutoWorkerForSession: (projectRoot) => registerAutoWorkerForSession(s, projectRoot),
|
|
2101
2145
|
lockBase,
|
|
2102
2146
|
buildLifecycle,
|
|
2103
2147
|
};
|
|
@@ -10,6 +10,7 @@ import { shouldIgnoreAgentEndForActiveUnit } from "../auto/unit-runner-events.js
|
|
|
10
10
|
import { resolveModelId } from "../auto-model-selection.js";
|
|
11
11
|
import { resolveProjectRoot } from "../worktree.js";
|
|
12
12
|
import { clearDiscussionFlowState } from "./write-gate.js";
|
|
13
|
+
import { clearGuidedUnitContext } from "../guided-unit-context.js";
|
|
13
14
|
import { resumeAutoAfterProviderDelay } from "./provider-error-resume.js";
|
|
14
15
|
import { classifyError, createRetryState, resetRetryState, isTransient, } from "../error-classifier.js";
|
|
15
16
|
import { blockModel, isModelBlocked } from "../blocked-models.js";
|
|
@@ -18,6 +19,9 @@ const MAX_NETWORK_RETRIES = 2;
|
|
|
18
19
|
function isObjectRecord(value) {
|
|
19
20
|
return !!value && typeof value === "object";
|
|
20
21
|
}
|
|
22
|
+
export function _hasEmptyAgentEndContent(content) {
|
|
23
|
+
return content == null || (Array.isArray(content) && content.length === 0);
|
|
24
|
+
}
|
|
21
25
|
/**
|
|
22
26
|
* Cap on auto-resume attempts for sustained transient-provider errors.
|
|
23
27
|
*
|
|
@@ -57,6 +61,11 @@ export function isUserInitiatedAbortMessage(message) {
|
|
|
57
61
|
return false;
|
|
58
62
|
return /\b(?:claude code process aborted by user|request aborted by user|process aborted by user)\b/i.test(message);
|
|
59
63
|
}
|
|
64
|
+
export function shouldDeferTransientErrorToCoreRetry(cls, rawErrorMsg) {
|
|
65
|
+
if (!isTransient(cls) || cls.kind === "rate-limit")
|
|
66
|
+
return false;
|
|
67
|
+
return !/retry failed after \d+ attempts:/i.test(rawErrorMsg);
|
|
68
|
+
}
|
|
60
69
|
function isBareClaudeCodeSessionSwitchAbortMarker(message) {
|
|
61
70
|
if (!message)
|
|
62
71
|
return false;
|
|
@@ -150,6 +159,13 @@ export function resolveAgentEndErrorDisplay(rawErrorMsg, content) {
|
|
|
150
159
|
}
|
|
151
160
|
return rawErrorMsg;
|
|
152
161
|
}
|
|
162
|
+
export function isTerminalDeletedWorktreeProviderError(message) {
|
|
163
|
+
if (!message)
|
|
164
|
+
return false;
|
|
165
|
+
if (!/\bdoes not exist\b/i.test(message))
|
|
166
|
+
return false;
|
|
167
|
+
return /[/\\]\.gsd[/\\](?:projects[/\\][^/\\]+[/\\])?worktrees[/\\][^/\\\s"']+/i.test(message);
|
|
168
|
+
}
|
|
153
169
|
async function pauseTransientWithBackoff(cls, pi, ctx, errorDetail, isRateLimit) {
|
|
154
170
|
retryState.consecutiveTransientCount += 1;
|
|
155
171
|
const baseRetryAfterMs = "retryAfterMs" in cls ? cls.retryAfterMs : 15_000;
|
|
@@ -187,8 +203,10 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
187
203
|
// falsely report files as missing — producing a spurious "ready signal
|
|
188
204
|
// rejected" loop even though the files are on disk.
|
|
189
205
|
clearPathCache();
|
|
206
|
+
const basePath = resolveAgentEndBasePath();
|
|
207
|
+
clearGuidedUnitContext(basePath);
|
|
190
208
|
try {
|
|
191
|
-
if (await checkDeepProjectSetupAfterTurn(event, ctx,
|
|
209
|
+
if (await checkDeepProjectSetupAfterTurn(event, ctx, basePath)) {
|
|
192
210
|
return;
|
|
193
211
|
}
|
|
194
212
|
}
|
|
@@ -196,22 +214,22 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
196
214
|
const message = err instanceof Error ? err.message : String(err);
|
|
197
215
|
logWarning("bootstrap", `checkDeepProjectSetupAfterTurn failed: ${message}`);
|
|
198
216
|
}
|
|
199
|
-
if (checkAutoStartAfterDiscuss()) {
|
|
200
|
-
clearDiscussionFlowState(
|
|
217
|
+
if (checkAutoStartAfterDiscuss(basePath)) {
|
|
218
|
+
clearDiscussionFlowState(basePath ?? process.cwd());
|
|
201
219
|
return;
|
|
202
220
|
}
|
|
203
221
|
// #4573 — When the LLM emits "Milestone X ready." but the required files
|
|
204
222
|
// are missing, `checkAutoStartAfterDiscuss` returns false silently. Surface
|
|
205
223
|
// that and nudge the LLM to complete the writes before the user hits the
|
|
206
224
|
// downstream "All milestones complete" warning loop.
|
|
207
|
-
if (maybeHandleReadyPhraseWithoutFiles(event))
|
|
225
|
+
if (maybeHandleReadyPhraseWithoutFiles(event, basePath))
|
|
208
226
|
return;
|
|
209
227
|
// #4573 — Empty-turn recovery: if the LLM announced intent in prose but
|
|
210
228
|
// emitted no tool calls, nudge it to execute. Fires only when auto-mode is
|
|
211
229
|
// active or a discussion autostart is pending (non-auto interactive discuss
|
|
212
230
|
// is user-driven). Runs before `isAutoActive` early return so pending
|
|
213
231
|
// discussions (where isAutoActive may be false) still get recovered.
|
|
214
|
-
if (maybeHandleEmptyIntentTurn(event, isAutoActive()))
|
|
232
|
+
if (maybeHandleEmptyIntentTurn(event, isAutoActive(), basePath))
|
|
215
233
|
return;
|
|
216
234
|
if (!isAutoActive())
|
|
217
235
|
return;
|
|
@@ -246,7 +264,7 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
246
264
|
// that carry error context — e.g. errorMessage field or non-empty content
|
|
247
265
|
// indicating a mid-stream failure. (#2695)
|
|
248
266
|
const content = "content" in lastMsg ? lastMsg.content : undefined;
|
|
249
|
-
const hasEmptyContent =
|
|
267
|
+
const hasEmptyContent = _hasEmptyAgentEndContent(content);
|
|
250
268
|
const hasErrorMessage = "errorMessage" in lastMsg && !!lastMsg.errorMessage;
|
|
251
269
|
if (hasEmptyContent && !hasErrorMessage) {
|
|
252
270
|
// Non-fatal: treat as a normal agent end so the loop can continue
|
|
@@ -292,6 +310,12 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
292
310
|
// the assistant message text content for display purposes only.
|
|
293
311
|
// Classification still uses rawErrorMsg to avoid false positives from prose.
|
|
294
312
|
const displayMsg = resolveAgentEndErrorDisplay(rawErrorMsg, "content" in lastMsg ? lastMsg.content : undefined);
|
|
313
|
+
if (isAutoCompletionStopInProgress() &&
|
|
314
|
+
isTerminalDeletedWorktreeProviderError(`${rawErrorMsg}\n${displayMsg}`)) {
|
|
315
|
+
resetRetryState(retryState);
|
|
316
|
+
logWarning("bootstrap", `Ignoring stale deleted-worktree provider error during terminal completion reroot: ${displayMsg || rawErrorMsg}`);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
295
319
|
const errorDetail = displayMsg ? `: ${displayMsg}` : "";
|
|
296
320
|
const explicitRetryAfterMs = ("retryAfterMs" in lastMsg && typeof lastMsg.retryAfterMs === "number") ? lastMsg.retryAfterMs : undefined;
|
|
297
321
|
// ── 1. Classify using rawErrorMsg to avoid prose false-positives ────
|
|
@@ -375,7 +399,7 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
375
399
|
// Core retries transient failures in-session after this handler.
|
|
376
400
|
// Keep that behavior for non-rate-limit classes to avoid pause/retry races,
|
|
377
401
|
// but let rate-limit continue into model fallback logic below (#4373).
|
|
378
|
-
if (
|
|
402
|
+
if (shouldDeferTransientErrorToCoreRetry(cls, rawErrorMsg)) {
|
|
379
403
|
return;
|
|
380
404
|
}
|
|
381
405
|
// Cap rate-limit backoff for CLI-style providers (openai-codex, google-gemini-cli)
|