@opengsd/gsd-pi 1.2.0-dev.844675c9 → 1.2.0-dev.b1abb545
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/dist/cli-web-branch.d.ts +2 -0
- package/dist/cli-web-branch.js +9 -2
- package/dist/help-text.js +5 -0
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/ask-user-questions.js +78 -23
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +84 -228
- package/dist/resources/extensions/claude-code-cli/turn-assembler.js +224 -0
- package/dist/resources/extensions/github-sync/templates.js +3 -3
- package/dist/resources/extensions/gsd/artifact-projection.js +14 -0
- package/dist/resources/extensions/gsd/auto/loop.js +74 -56
- package/dist/resources/extensions/gsd/auto/orchestrator.js +109 -11
- package/dist/resources/extensions/gsd/auto/phases.js +28 -3
- package/dist/resources/extensions/gsd/auto/run-unit.js +2 -1
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +16 -4
- package/dist/resources/extensions/gsd/auto-dispatch.js +6 -5
- package/dist/resources/extensions/gsd/auto-model-selection.js +8 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +4 -3
- package/dist/resources/extensions/gsd/auto-prompts.js +81 -8
- package/dist/resources/extensions/gsd/auto-recovery.js +48 -49
- package/dist/resources/extensions/gsd/auto-runtime-state.js +14 -0
- package/dist/resources/extensions/gsd/auto-start.js +12 -23
- package/dist/resources/extensions/gsd/auto-timers.js +16 -2
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +32 -0
- package/dist/resources/extensions/gsd/auto-unit-tool-scope.js +4 -29
- package/dist/resources/extensions/gsd/auto-verification.js +7 -7
- package/dist/resources/extensions/gsd/auto-worktree.js +21 -19
- package/dist/resources/extensions/gsd/auto.js +11 -7
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +28 -37
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +11 -37
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +100 -138
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +63 -4
- package/dist/resources/extensions/gsd/closeout-consistency-gate.js +21 -4
- package/dist/resources/extensions/gsd/codebase-generator.js +8 -4
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +3 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +20 -0
- package/dist/resources/extensions/gsd/commands-inspect.js +4 -8
- package/dist/resources/extensions/gsd/commands-maintenance.js +61 -41
- package/dist/resources/extensions/gsd/commands-ship.js +2 -2
- package/dist/resources/extensions/gsd/commands-verdict.js +12 -2
- package/dist/resources/extensions/gsd/db-workspace.js +103 -0
- package/dist/resources/extensions/gsd/delegation-policy.js +2 -10
- package/dist/resources/extensions/gsd/discussion-handoff.js +218 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +9 -0
- package/dist/resources/extensions/gsd/doctor.js +16 -9
- package/dist/resources/extensions/gsd/error-classifier.js +1 -1
- package/dist/resources/extensions/gsd/git-conflict-state.js +16 -1
- package/dist/resources/extensions/gsd/gsd-db.js +12 -0
- package/dist/resources/extensions/gsd/guided-flow.js +34 -468
- package/dist/resources/extensions/gsd/guided-unit-completion.js +225 -0
- package/dist/resources/extensions/gsd/markdown-renderer.js +2 -1
- package/dist/resources/extensions/gsd/mcp-filter.js +2 -1
- package/dist/resources/extensions/gsd/mcp-tool-name.js +26 -0
- package/dist/resources/extensions/gsd/md-importer.js +4 -3
- package/dist/resources/extensions/gsd/migrate/safety.js +2 -2
- package/dist/resources/extensions/gsd/migration-auto-check.js +3 -2
- package/dist/resources/extensions/gsd/milestone-closeout-proof.js +72 -0
- package/dist/resources/extensions/gsd/milestone-closeout.js +12 -4
- package/dist/resources/extensions/gsd/milestone-merge-transaction.js +10 -0
- package/dist/resources/extensions/gsd/milestone-planning-persistence.js +156 -0
- package/dist/resources/extensions/gsd/milestone-readiness.js +77 -0
- package/dist/resources/extensions/gsd/milestone-settlement.js +50 -0
- package/dist/resources/extensions/gsd/milestone-validation-evidence.js +73 -0
- package/dist/resources/extensions/gsd/milestone-validation-verdict.js +57 -0
- package/dist/resources/extensions/gsd/parallel-eligibility.js +3 -6
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +3 -2
- package/dist/resources/extensions/gsd/preferences-diagnostics.js +67 -0
- package/dist/resources/extensions/gsd/preferences.js +147 -29
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/execute-task.md +2 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +3 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/system.md +1 -1
- package/dist/resources/extensions/gsd/provider-payload-policy.js +83 -0
- package/dist/resources/extensions/gsd/pull-request-process.js +13 -0
- package/dist/resources/extensions/gsd/quality-gate-closure.js +109 -0
- package/dist/resources/extensions/gsd/question-transport.js +86 -0
- package/dist/resources/extensions/gsd/roadmap-slices.js +8 -2
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +3 -2
- package/dist/resources/extensions/gsd/state.js +13 -5
- package/dist/resources/extensions/gsd/templates/plan.md +7 -0
- package/dist/resources/extensions/gsd/templates/project.md +1 -0
- package/dist/resources/extensions/gsd/templates/roadmap.md +1 -1
- package/dist/resources/extensions/gsd/templates/uat.md +5 -1
- package/dist/resources/extensions/gsd/tool-contract.js +52 -8
- package/dist/resources/extensions/gsd/tool-presentation-plan.js +15 -34
- package/dist/resources/extensions/gsd/tool-surface-snapshot.js +17 -0
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +15 -143
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +39 -0
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +15 -78
- package/dist/resources/extensions/gsd/uat-policy.js +16 -10
- package/dist/resources/extensions/gsd/uat-run.js +9 -14
- package/dist/resources/extensions/gsd/unit-context-composer.js +40 -20
- package/dist/resources/extensions/gsd/unit-runtime.js +3 -2
- package/dist/resources/extensions/gsd/unit-tool-contracts.js +2 -1
- package/dist/resources/extensions/gsd/user-input-boundary.js +23 -0
- package/dist/resources/extensions/gsd/validation-block-guard.js +2 -0
- package/dist/resources/extensions/gsd/web-app-uat.js +80 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +15 -102
- package/dist/resources/extensions/gsd/workflow-reconcile.js +4 -3
- package/dist/resources/extensions/gsd/workflow-tool-surface.js +46 -0
- package/dist/resources/extensions/gsd/workspace-git-guard.js +2 -0
- package/dist/resources/extensions/gsd/worktree-state-projection.js +33 -4
- package/dist/resources/extensions/gsd/worktree-telemetry.js +12 -0
- package/dist/resources/extensions/shared/interview-ui.js +2 -2
- package/dist/resources/shared/claude-runtime-floor.js +182 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/update-cmd.js +20 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -7
- 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 +8 -8
- 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.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- 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 +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -7
- package/dist/web/standalone/.next/server/chunks/8357.js +1 -1
- 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/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/2659.b7b129ee6a769448.js +1 -0
- package/dist/web/standalone/.next/static/chunks/2772.bfa657f49f955239.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{3616.4113d484a994e411.js → 3616.3c60753b8ffcbd2e.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/4283.e4873b058df143a1.js +2 -0
- package/dist/web/standalone/.next/static/chunks/5826.a46ecdd1cfe8dabc.js +1 -0
- package/dist/web/standalone/.next/static/chunks/796.cf859a427a2cb2ac.js +10 -0
- package/dist/web/standalone/.next/static/chunks/8785.2e5a118797fb2dd2.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-dda80a1ef5587410.js → webpack-fbea77b5f9953368.js} +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/dist/web-mode.d.ts +2 -0
- package/dist/web-mode.js +20 -8
- package/package.json +2 -1
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.d.ts +2 -0
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.js +14 -0
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.js.map +1 -1
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +106 -40
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.js +6 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/dist/server.d.ts +10 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +8 -0
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +41 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +2 -1
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +3 -3
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +8 -93
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +35 -120
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/dist/components/input.js +1 -1
- package/packages/pi-tui/dist/components/input.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +39 -30
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.js +22 -0
- package/packages/pi-tui/dist/stdin-buffer.js.map +1 -1
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/extensions/ask-user-questions.ts +87 -24
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +108 -281
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +240 -0
- package/src/resources/extensions/claude-code-cli/turn-assembler.ts +287 -0
- package/src/resources/extensions/github-sync/templates.ts +3 -3
- package/src/resources/extensions/github-sync/tests/templates.test.ts +2 -2
- package/src/resources/extensions/gsd/artifact-projection.ts +31 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +32 -2
- package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -0
- package/src/resources/extensions/gsd/auto/loop.ts +83 -61
- package/src/resources/extensions/gsd/auto/orchestrator.ts +125 -12
- package/src/resources/extensions/gsd/auto/phases.ts +35 -3
- package/src/resources/extensions/gsd/auto/run-unit.ts +2 -1
- package/src/resources/extensions/gsd/auto/session.ts +4 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +18 -4
- package/src/resources/extensions/gsd/auto-dispatch.ts +20 -7
- package/src/resources/extensions/gsd/auto-model-selection.ts +8 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +4 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +107 -9
- package/src/resources/extensions/gsd/auto-recovery.ts +50 -50
- package/src/resources/extensions/gsd/auto-runtime-state.ts +26 -0
- package/src/resources/extensions/gsd/auto-start.ts +17 -20
- package/src/resources/extensions/gsd/auto-timers.ts +16 -2
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +35 -0
- package/src/resources/extensions/gsd/auto-unit-tool-scope.ts +9 -30
- package/src/resources/extensions/gsd/auto-verification.ts +7 -8
- package/src/resources/extensions/gsd/auto-worktree.ts +33 -26
- package/src/resources/extensions/gsd/auto.ts +15 -8
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +29 -37
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +10 -37
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +116 -151
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +107 -3
- package/src/resources/extensions/gsd/closeout-consistency-gate.ts +27 -5
- package/src/resources/extensions/gsd/codebase-generator.ts +9 -5
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +3 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +18 -0
- package/src/resources/extensions/gsd/commands-inspect.ts +7 -8
- package/src/resources/extensions/gsd/commands-maintenance.ts +74 -40
- package/src/resources/extensions/gsd/commands-ship.ts +2 -2
- package/src/resources/extensions/gsd/commands-verdict.ts +19 -2
- package/src/resources/extensions/gsd/db-workspace.ts +170 -0
- package/src/resources/extensions/gsd/delegation-policy.ts +3 -11
- package/src/resources/extensions/gsd/discussion-handoff.ts +276 -0
- package/src/resources/extensions/gsd/docs/preferences-reference.md +9 -0
- package/src/resources/extensions/gsd/doctor.ts +15 -5
- package/src/resources/extensions/gsd/error-classifier.ts +1 -1
- package/src/resources/extensions/gsd/git-conflict-state.ts +17 -1
- package/src/resources/extensions/gsd/gsd-db.ts +12 -0
- package/src/resources/extensions/gsd/guided-flow.ts +47 -558
- package/src/resources/extensions/gsd/guided-unit-completion.ts +275 -0
- package/src/resources/extensions/gsd/markdown-renderer.ts +2 -1
- package/src/resources/extensions/gsd/mcp-filter.ts +2 -1
- package/src/resources/extensions/gsd/mcp-tool-name.ts +35 -0
- package/src/resources/extensions/gsd/md-importer.ts +3 -3
- package/src/resources/extensions/gsd/migrate/safety.ts +2 -2
- package/src/resources/extensions/gsd/migration-auto-check.ts +2 -2
- package/src/resources/extensions/gsd/milestone-closeout-proof.ts +131 -0
- package/src/resources/extensions/gsd/milestone-closeout.ts +12 -4
- package/src/resources/extensions/gsd/milestone-merge-transaction.ts +47 -0
- package/src/resources/extensions/gsd/milestone-planning-persistence.ts +224 -0
- package/src/resources/extensions/gsd/milestone-readiness.ts +125 -0
- package/src/resources/extensions/gsd/milestone-settlement.ts +81 -0
- package/src/resources/extensions/gsd/milestone-validation-evidence.ts +95 -0
- package/src/resources/extensions/gsd/milestone-validation-verdict.ts +80 -0
- package/src/resources/extensions/gsd/parallel-eligibility.ts +4 -5
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +6 -2
- package/src/resources/extensions/gsd/preferences-diagnostics.ts +98 -0
- package/src/resources/extensions/gsd/preferences-types.ts +16 -0
- package/src/resources/extensions/gsd/preferences.ts +173 -28
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/execute-task.md +2 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +3 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/system.md +1 -1
- package/src/resources/extensions/gsd/provider-payload-policy.ts +140 -0
- package/src/resources/extensions/gsd/pull-request-process.ts +41 -0
- package/src/resources/extensions/gsd/quality-gate-closure.ts +140 -0
- package/src/resources/extensions/gsd/question-transport.ts +138 -0
- package/src/resources/extensions/gsd/roadmap-slices.ts +8 -2
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +6 -2
- package/src/resources/extensions/gsd/state.ts +15 -5
- package/src/resources/extensions/gsd/templates/plan.md +7 -0
- package/src/resources/extensions/gsd/templates/project.md +1 -0
- package/src/resources/extensions/gsd/templates/roadmap.md +1 -1
- package/src/resources/extensions/gsd/templates/uat.md +5 -1
- package/src/resources/extensions/gsd/tests/ask-user-questions-render.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +29 -1
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +321 -5
- package/src/resources/extensions/gsd/tests/auto-milestone-target.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection-tool-poisoning.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +133 -4
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/canonical-milestone-root.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/commands-dispatcher-workspace-git.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +38 -1
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +34 -3
- package/src/resources/extensions/gsd/tests/dispatch-run-uat-browser-tools.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/doctor-scope-db-unavailable.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-no-blockers.md +1 -5
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-with-blockers.md +1 -5
- package/src/resources/extensions/gsd/tests/gate-state-canonicalization.test.ts +48 -1
- package/src/resources/extensions/gsd/tests/mcp-tool-name.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/milestone-closeout-proof.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/milestone-closeout.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/milestone-merge-transaction.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/milestone-readiness.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/milestone-validation-evidence.test.ts +41 -0
- package/src/resources/extensions/gsd/tests/milestone-validation-verdict.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/planning-crossval.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/preferences-diagnostics.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +183 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/provider-payload-policy.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/pull-request-process.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +94 -0
- package/src/resources/extensions/gsd/tests/roadmap-parse-regression.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +25 -1
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +80 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +101 -1
- package/src/resources/extensions/gsd/tests/stale-queued-milestone.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/tool-availability-audit.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +35 -42
- package/src/resources/extensions/gsd/tests/uat-policy.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/user-input-boundary.test.ts +86 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/web-app-uat.test.ts +150 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +126 -9
- package/src/resources/extensions/gsd/tests/workspace-git-preflight.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/worktree-projection-writers.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +79 -0
- package/src/resources/extensions/gsd/tool-contract.ts +86 -8
- package/src/resources/extensions/gsd/tool-presentation-plan.ts +16 -33
- package/src/resources/extensions/gsd/tool-surface-snapshot.ts +47 -0
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +19 -160
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +43 -0
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +25 -84
- package/src/resources/extensions/gsd/uat-policy.ts +19 -10
- package/src/resources/extensions/gsd/uat-run.ts +10 -14
- package/src/resources/extensions/gsd/unit-context-composer.ts +85 -20
- package/src/resources/extensions/gsd/unit-runtime.ts +3 -2
- package/src/resources/extensions/gsd/unit-tool-contracts.ts +2 -1
- package/src/resources/extensions/gsd/user-input-boundary.ts +18 -0
- package/src/resources/extensions/gsd/validation-block-guard.ts +2 -0
- package/src/resources/extensions/gsd/web-app-uat.ts +101 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +22 -110
- package/src/resources/extensions/gsd/workflow-reconcile.ts +3 -3
- package/src/resources/extensions/gsd/workflow-tool-surface.ts +73 -0
- package/src/resources/extensions/gsd/workspace-git-guard.ts +1 -0
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +7 -16
- package/src/resources/extensions/gsd/worktree-state-projection.ts +55 -7
- package/src/resources/extensions/gsd/worktree-telemetry.ts +16 -0
- package/src/resources/extensions/shared/interview-ui.ts +15 -2
- package/src/resources/shared/claude-runtime-floor.ts +248 -0
- package/dist/web/standalone/.next/static/chunks/2659.feb6499ca863ebfc.js +0 -1
- package/dist/web/standalone/.next/static/chunks/2772.151789db0edea835.js +0 -1
- package/dist/web/standalone/.next/static/chunks/4283.10a065467b5340d8.js +0 -2
- package/dist/web/standalone/.next/static/chunks/5826.960dc4634cc9b0d3.js +0 -1
- package/dist/web/standalone/.next/static/chunks/796.46f811c0fac23aab.js +0 -10
- package/dist/web/standalone/.next/static/chunks/8785.d32f7a61f55c1600.js +0 -1
- /package/dist/web/standalone/.next/static/{Qbr81pQ-pbQXP4bq2VXLv → 3PtrU9qGPEXwNLWkIyiqk}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Qbr81pQ-pbQXP4bq2VXLv → 3PtrU9qGPEXwNLWkIyiqk}/_ssgManifest.js +0 -0
|
@@ -14,7 +14,8 @@ import { appendEvent } from "./workflow-events.js";
|
|
|
14
14
|
import { atomicWriteSync } from "./atomic-write.js";
|
|
15
15
|
import { clearParseCache } from "./files.js";
|
|
16
16
|
import { parseRoadmap as parseLegacyRoadmap, parsePlan as parseLegacyPlan } from "./parsers-legacy.js";
|
|
17
|
-
import { isDbAvailable, getTask, getSlice, getSliceTasks, getPendingGatesForTurn, updateTaskStatus, updateSliceStatus, insertSlice, getMilestone,
|
|
17
|
+
import { isDbAvailable, getTask, getSlice, getSliceTasks, getPendingGatesForTurn, updateTaskStatus, updateSliceStatus, insertSlice, getMilestone, updateMilestoneStatus, transaction, } from "./gsd-db.js";
|
|
18
|
+
import { refreshWorkflowDatabaseFromDisk } from "./db-workspace.js";
|
|
18
19
|
import { isValidationTerminal } from "./state.js";
|
|
19
20
|
import { getErrorMessage } from "./error-utils.js";
|
|
20
21
|
import { logWarning, logError } from "./workflow-logger.js";
|
|
@@ -32,7 +33,7 @@ import { isGsdWorktreePath } from "./worktree-root.js";
|
|
|
32
33
|
import { resolveCanonicalMilestoneRoot } from "./worktree-manager.js";
|
|
33
34
|
import { hasImplementationArtifacts } from "./milestone-implementation-evidence.js";
|
|
34
35
|
import { loadAllCaptures, loadPendingCaptures } from "./captures.js";
|
|
35
|
-
import {
|
|
36
|
+
import { proveMilestoneCloseout, } from "./milestone-closeout-proof.js";
|
|
36
37
|
// Re-export so existing consumers of auto-recovery.ts keep working.
|
|
37
38
|
export { resolveExpectedArtifactPath, diagnoseExpectedArtifact };
|
|
38
39
|
export { classifyMilestoneSummaryContent, } from "./milestone-summary-classifier.js";
|
|
@@ -66,12 +67,24 @@ function resolveArtifactVerificationBase(unitId, base) {
|
|
|
66
67
|
return base;
|
|
67
68
|
return resolveCanonicalMilestoneRoot(base, milestone);
|
|
68
69
|
}
|
|
70
|
+
function closeoutProofRecoveryReason(reason) {
|
|
71
|
+
switch (reason) {
|
|
72
|
+
case "slice-missing":
|
|
73
|
+
return "complete-milestone-slices-missing";
|
|
74
|
+
case "summary-artifact-missing":
|
|
75
|
+
return "complete-milestone-summary-missing";
|
|
76
|
+
case "summary-artifact-failed":
|
|
77
|
+
return "complete-milestone-summary-failed";
|
|
78
|
+
default:
|
|
79
|
+
return `complete-milestone-${reason}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
69
82
|
export function refreshRecoveryDbForArtifact(unitType, unitId, basePath) {
|
|
70
83
|
if (unitType !== "plan-slice" && unitType !== "execute-task" && unitType !== "complete-milestone")
|
|
71
84
|
return { ok: true };
|
|
72
85
|
if (!isDbAvailable())
|
|
73
86
|
return { ok: true };
|
|
74
|
-
if (!
|
|
87
|
+
if (!refreshWorkflowDatabaseFromDisk()) {
|
|
75
88
|
return {
|
|
76
89
|
ok: false,
|
|
77
90
|
fatal: unitType === "execute-task" || unitType === "complete-milestone",
|
|
@@ -100,50 +113,29 @@ export function refreshRecoveryDbForArtifact(unitType, unitId, basePath) {
|
|
|
100
113
|
}
|
|
101
114
|
if (isClosedStatus(milestone.status))
|
|
102
115
|
return { ok: true };
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
ok: false,
|
|
116
|
-
fatal: true,
|
|
117
|
-
reason: "complete-milestone-slices-missing",
|
|
118
|
-
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but no slices exist in the DB.`,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
const openSlice = slices.find((slice) => !isClosedStatus(slice.status));
|
|
122
|
-
if (openSlice) {
|
|
123
|
-
return {
|
|
124
|
-
ok: false,
|
|
125
|
-
fatal: true,
|
|
126
|
-
reason: "complete-milestone-slice-open",
|
|
127
|
-
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but slice ${openSlice.id} is still "${openSlice.status}" in the DB.`,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
for (const slice of slices) {
|
|
131
|
-
const openTask = getSliceTasks(mid, slice.id).find((task) => !isClosedStatus(task.status));
|
|
132
|
-
if (openTask) {
|
|
116
|
+
const artifactBasePath = resolveArtifactVerificationBase(unitId, basePath);
|
|
117
|
+
const closeoutProof = proveMilestoneCloseout(mid, {
|
|
118
|
+
allowOpenMilestone: true,
|
|
119
|
+
summaryArtifactBasePath: artifactBasePath,
|
|
120
|
+
implementationEvidence: {
|
|
121
|
+
basePath,
|
|
122
|
+
requirement: "present",
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
if (!closeoutProof.ok) {
|
|
126
|
+
if (closeoutProof.reason === "implementation-evidence-missing") {
|
|
133
127
|
return {
|
|
134
128
|
ok: false,
|
|
135
129
|
fatal: true,
|
|
136
|
-
reason: "complete-milestone-
|
|
137
|
-
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but
|
|
130
|
+
reason: "complete-milestone-implementation-missing",
|
|
131
|
+
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but implementation evidence is not present.`,
|
|
138
132
|
};
|
|
139
133
|
}
|
|
140
|
-
}
|
|
141
|
-
if (hasImplementationArtifacts(basePath, mid) !== "present") {
|
|
142
134
|
return {
|
|
143
135
|
ok: false,
|
|
144
136
|
fatal: true,
|
|
145
|
-
reason:
|
|
146
|
-
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but
|
|
137
|
+
reason: closeoutProofRecoveryReason(closeoutProof.reason),
|
|
138
|
+
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but ${closeoutProof.message}`,
|
|
147
139
|
};
|
|
148
140
|
}
|
|
149
141
|
updateMilestoneStatus(mid, "complete", new Date().toISOString());
|
|
@@ -457,7 +449,7 @@ export function verifyExpectedArtifact(unitType, unitId, base) {
|
|
|
457
449
|
try {
|
|
458
450
|
let taskIds = null;
|
|
459
451
|
if (isDbAvailable()) {
|
|
460
|
-
const refreshed =
|
|
452
|
+
const refreshed = refreshWorkflowDatabaseFromDisk();
|
|
461
453
|
if (refreshed) {
|
|
462
454
|
const tasks = getSliceTasks(mid, sid);
|
|
463
455
|
if (tasks.length > 0)
|
|
@@ -569,17 +561,24 @@ export function verifyExpectedArtifact(unitType, unitId, base) {
|
|
|
569
561
|
// A milestone with only .gsd/ plan files and zero implementation code is
|
|
570
562
|
// not genuinely complete — the LLM wrote plan files but skipped actual work.
|
|
571
563
|
if (unitType === "complete-milestone") {
|
|
572
|
-
const summaryOutcome = classifyMilestoneSummaryContent(readFileSync(absPath, "utf-8"));
|
|
573
|
-
if (summaryOutcome === "failure")
|
|
574
|
-
return false;
|
|
575
564
|
const { milestone: mid } = parseUnitId(unitId);
|
|
576
|
-
if (mid
|
|
577
|
-
const closeoutGate = checkCloseoutConsistencyGate(mid, { refreshFromDisk: true });
|
|
578
|
-
if (!closeoutGate.ok)
|
|
579
|
-
return false;
|
|
580
|
-
}
|
|
581
|
-
if (hasImplementationArtifacts(base, mid) === "absent")
|
|
565
|
+
if (!mid)
|
|
582
566
|
return false;
|
|
567
|
+
const closeoutProof = proveMilestoneCloseout(mid, {
|
|
568
|
+
refreshFromDisk: true,
|
|
569
|
+
summaryArtifactBasePath: artifactBase,
|
|
570
|
+
implementationEvidence: {
|
|
571
|
+
basePath: base,
|
|
572
|
+
requirement: "not-absent",
|
|
573
|
+
},
|
|
574
|
+
});
|
|
575
|
+
if (!closeoutProof.ok) {
|
|
576
|
+
if (!isDbAvailable() && closeoutProof.reason === "db-unavailable") {
|
|
577
|
+
const summaryOutcome = classifyMilestoneSummaryContent(readFileSync(absPath, "utf-8"));
|
|
578
|
+
return summaryOutcome !== "failure" && hasImplementationArtifacts(base, mid) !== "absent";
|
|
579
|
+
}
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
583
582
|
}
|
|
584
583
|
return true;
|
|
585
584
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// GSD auto-mode runtime state
|
|
2
2
|
import { AutoSession } from "./auto/session.js";
|
|
3
3
|
import { isDeterministicPolicyError, isQueuedUserMessageSkip, isToolInvocationError, markToolEnd as markTrackedToolEnd, markToolStart as markTrackedToolStart, } from "./auto-tool-tracking.js";
|
|
4
|
+
// Re-exported as a pure pass-through. Must stay UNGATED (no autoSession.active
|
|
5
|
+
// argument, unlike markToolStart at the bottom of this file) so it is true in
|
|
6
|
+
// foreground where the foreground approval-gate pause consults it.
|
|
7
|
+
export { isInteractiveElicitationInFlight } from "./auto-tool-tracking.js";
|
|
8
|
+
import { createToolSurfaceSnapshot, } from "./tool-surface-snapshot.js";
|
|
4
9
|
export const autoSession = new AutoSession();
|
|
10
|
+
let currentToolSurfaceSnapshot = null;
|
|
5
11
|
export function getAutoRuntimeSnapshot() {
|
|
6
12
|
const orchestrationStatus = autoSession.orchestration?.getStatus();
|
|
7
13
|
return {
|
|
@@ -12,8 +18,16 @@ export function getAutoRuntimeSnapshot() {
|
|
|
12
18
|
orchestrationPhase: orchestrationStatus?.phase,
|
|
13
19
|
orchestrationTransitionCount: orchestrationStatus?.transitionCount,
|
|
14
20
|
orchestrationLastTransitionAt: orchestrationStatus?.lastTransitionAt,
|
|
21
|
+
toolSurface: autoSession.active || autoSession.paused ? currentToolSurfaceSnapshot : null,
|
|
15
22
|
};
|
|
16
23
|
}
|
|
24
|
+
export function recordAutoToolSurfaceSnapshot(input) {
|
|
25
|
+
currentToolSurfaceSnapshot = createToolSurfaceSnapshot(input);
|
|
26
|
+
return currentToolSurfaceSnapshot;
|
|
27
|
+
}
|
|
28
|
+
export function clearAutoToolSurfaceSnapshot() {
|
|
29
|
+
currentToolSurfaceSnapshot = null;
|
|
30
|
+
}
|
|
17
31
|
export function isAutoActive() {
|
|
18
32
|
return autoSession.active;
|
|
19
33
|
}
|
|
@@ -34,7 +34,8 @@ import { initRoutingHistory } from "./routing-history.js";
|
|
|
34
34
|
import { restoreHookState, resetHookState } from "./post-unit-hooks.js";
|
|
35
35
|
import { resetProactiveHealing, setLevelChangeCallback } from "./doctor-proactive.js";
|
|
36
36
|
import { snapshotSkills } from "./skill-discovery.js";
|
|
37
|
-
import { isDbAvailable, getMilestone, getAllMilestones, insertMilestone,
|
|
37
|
+
import { isDbAvailable, getMilestone, getAllMilestones, insertMilestone, updateMilestoneStatus } from "./gsd-db.js";
|
|
38
|
+
import { getWorkflowDatabaseStatus, openExistingWorkflowDatabase, openWorkflowDatabase, resolveProjectRootDbPath, } from "./db-workspace.js";
|
|
38
39
|
import { isClosedStatus } from "./status-guards.js";
|
|
39
40
|
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
40
41
|
import { extractVerdict } from "./verdict-parser.js";
|
|
@@ -45,7 +46,6 @@ import { logWarning, logError } from "./workflow-logger.js";
|
|
|
45
46
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, } from "node:fs";
|
|
46
47
|
import { join } from "node:path";
|
|
47
48
|
import { sep as pathSep } from "node:path";
|
|
48
|
-
import { resolveProjectRootDbPath } from "./bootstrap/dynamic-tools.js";
|
|
49
49
|
import { validateDirectory } from "./validate-directory.js";
|
|
50
50
|
import { isCustomProvider, resolveDefaultSessionModel, resolveDynamicRoutingConfig, } from "./preferences-models.js";
|
|
51
51
|
import { getSessionModelOverride } from "./session-model-override.js";
|
|
@@ -76,11 +76,9 @@ export async function openProjectDbIfPresent(basePath) {
|
|
|
76
76
|
const gsdDbPath = resolveProjectRootDbPath(basePath);
|
|
77
77
|
if (!existsSync(gsdDbPath) || isDbAvailable())
|
|
78
78
|
return;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
catch (err) {
|
|
83
|
-
logWarning("engine", `gsd-db: failed to open existing database: ${err instanceof Error ? err.message : String(err)}`);
|
|
79
|
+
const result = openExistingWorkflowDatabase(basePath);
|
|
80
|
+
if (!result.ok && result.reason === "open-failed") {
|
|
81
|
+
logWarning("engine", `gsd-db: failed to open existing database: ${result.error?.message ?? "open failed"}`);
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
export function reconcileProjectMilestonesFromDisk(basePath) {
|
|
@@ -1295,23 +1293,14 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1295
1293
|
}
|
|
1296
1294
|
// ── DB lifecycle ──
|
|
1297
1295
|
const gsdDbPath = resolveProjectRootDbPath(s.basePath);
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
|
|
1301
|
-
const { openDatabase: openDb } = await import("./gsd-db.js");
|
|
1302
|
-
openDb(gsdDbPath);
|
|
1303
|
-
}
|
|
1304
|
-
catch (err) {
|
|
1305
|
-
logError("engine", `failed to initialize project database: ${err.message}`);
|
|
1306
|
-
}
|
|
1296
|
+
const initialDbOpen = openWorkflowDatabase(s.basePath);
|
|
1297
|
+
if (!initialDbOpen.ok && initialDbOpen.reason === "open-failed") {
|
|
1298
|
+
logError("engine", `failed to initialize project database: ${initialDbOpen.error?.message ?? "open failed"}`);
|
|
1307
1299
|
}
|
|
1308
1300
|
if (_shouldAbortBootstrapForUnavailableDbForTest(gsdDbPath, isDbAvailable())) {
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
}
|
|
1313
|
-
catch (err) {
|
|
1314
|
-
logError("engine", `failed to open existing database: ${err.message}`);
|
|
1301
|
+
const retryDbOpen = openWorkflowDatabase(s.basePath);
|
|
1302
|
+
if (!retryDbOpen.ok && retryDbOpen.reason === "open-failed") {
|
|
1303
|
+
logError("engine", `failed to open existing database: ${retryDbOpen.error?.message ?? "open failed"}`);
|
|
1315
1304
|
}
|
|
1316
1305
|
}
|
|
1317
1306
|
// Gate: abort bootstrap if the DB file exists but the provider is
|
|
@@ -1320,7 +1309,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1320
1309
|
// call returns "db_unavailable", triggering artifact-retry which
|
|
1321
1310
|
// re-dispatches the same task — producing an infinite loop (#2419).
|
|
1322
1311
|
if (existsSync(gsdDbPath) && !isDbAvailable()) {
|
|
1323
|
-
const dbStatus =
|
|
1312
|
+
const dbStatus = getWorkflowDatabaseStatus();
|
|
1324
1313
|
const phaseHint = dbStatus.lastPhase === "open"
|
|
1325
1314
|
? "The database file could not be opened"
|
|
1326
1315
|
: dbStatus.lastPhase === "initSchema"
|
|
@@ -233,11 +233,24 @@ export function startUnitSupervision(sctx) {
|
|
|
233
233
|
}
|
|
234
234
|
}, 15000);
|
|
235
235
|
// ── 3. Hard timeout ──
|
|
236
|
-
|
|
236
|
+
const hardTimeoutBody = async () => {
|
|
237
237
|
try {
|
|
238
238
|
s.unitTimeoutHandle = null;
|
|
239
239
|
if (!s.active)
|
|
240
240
|
return;
|
|
241
|
+
// User-interactive tools (ask_user_questions, secure_env_collect) block
|
|
242
|
+
// waiting for human input by design. Unlike the idle watchdog (above),
|
|
243
|
+
// the hard timeout had no interactive exemption, so a long human
|
|
244
|
+
// deliberation crossing the hard cap would still closeout + recover
|
|
245
|
+
// (triggerTurn) and abort the turn hosting the elicitation, reintroducing
|
|
246
|
+
// the self-cancel loop on slow answers (#2676). Re-arm instead of firing
|
|
247
|
+
// while a human is being asked, mirroring the idle watchdog's
|
|
248
|
+
// refresh-and-return. Conditional on hasInteractiveToolInFlight(), so a
|
|
249
|
+
// genuinely hung non-interactive unit still hits the hard cap.
|
|
250
|
+
if (getInFlightToolCount() > 0 && hasInteractiveToolInFlight()) {
|
|
251
|
+
s.unitTimeoutHandle = setTimeout(hardTimeoutBody, hardTimeoutMs);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
241
254
|
const expectedCurrentUnit = s.currentUnit
|
|
242
255
|
? { type: s.currentUnit.type, id: s.currentUnit.id, startedAt: s.currentUnit.startedAt }
|
|
243
256
|
: null;
|
|
@@ -269,7 +282,8 @@ export function startUnitSupervision(sctx) {
|
|
|
269
282
|
logWarning("timer", `notification failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
270
283
|
}
|
|
271
284
|
}
|
|
272
|
-
}
|
|
285
|
+
};
|
|
286
|
+
s.unitTimeoutHandle = setTimeout(hardTimeoutBody, hardTimeoutMs);
|
|
273
287
|
// ── 4. Context-pressure continue-here monitor ──
|
|
274
288
|
if (s.continueHereHandle) {
|
|
275
289
|
clearInterval(s.continueHereHandle);
|
|
@@ -10,6 +10,16 @@ const inFlightTools = new Map();
|
|
|
10
10
|
* The idle watchdog must not treat these as stalled.
|
|
11
11
|
*/
|
|
12
12
|
const INTERACTIVE_TOOLS = new Set(["ask_user_questions", "secure_env_collect"]);
|
|
13
|
+
/**
|
|
14
|
+
* Mode-agnostic refcount of in-flight interactive elicitations that are an
|
|
15
|
+
* active human boundary (the model ASKED via ask_user_questions). Unlike the
|
|
16
|
+
* `inFlightTools` Map, this is NOT gated by auto-session.active, so it is true
|
|
17
|
+
* in FOREGROUND (where s.active is false). Kept SEPARATE from inFlightTools so
|
|
18
|
+
* getInFlightToolCount()/getOldestInFlightToolAgeMs()/hasInteractiveToolInFlight()
|
|
19
|
+
* and the auto-watchdog accounting are byte-for-byte unchanged. A refcount (not
|
|
20
|
+
* a boolean) handles nested/back-to-back elicitations in a single turn.
|
|
21
|
+
*/
|
|
22
|
+
let interactiveElicitationDepth = 0;
|
|
13
23
|
/**
|
|
14
24
|
* Mark a tool execution as in-flight.
|
|
15
25
|
* Records start time and tool name so the idle watchdog can detect tools
|
|
@@ -26,6 +36,27 @@ export function markToolStart(toolCallId, isActive, toolName) {
|
|
|
26
36
|
export function markToolEnd(toolCallId) {
|
|
27
37
|
inFlightTools.delete(toolCallId);
|
|
28
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Mark an interactive elicitation (the model asking via ask_user_questions) as
|
|
41
|
+
* in flight. Ungated by auto-session.active so it is observable in foreground.
|
|
42
|
+
*/
|
|
43
|
+
export function markInteractiveElicitationStart() {
|
|
44
|
+
interactiveElicitationDepth++;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Mark an interactive elicitation as completed. Idempotent below zero.
|
|
48
|
+
*/
|
|
49
|
+
export function markInteractiveElicitationEnd() {
|
|
50
|
+
if (interactiveElicitationDepth > 0)
|
|
51
|
+
interactiveElicitationDepth--;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns true if any interactive elicitation is currently the active human
|
|
55
|
+
* boundary. True in ALL modes (foreground and auto) while one is in flight.
|
|
56
|
+
*/
|
|
57
|
+
export function isInteractiveElicitationInFlight() {
|
|
58
|
+
return interactiveElicitationDepth > 0;
|
|
59
|
+
}
|
|
29
60
|
/**
|
|
30
61
|
* Returns the age (ms) of the oldest currently in-flight tool, or 0 if none.
|
|
31
62
|
*/
|
|
@@ -75,6 +106,7 @@ export function hasInteractiveToolInFlight() {
|
|
|
75
106
|
*/
|
|
76
107
|
export function clearInFlightTools() {
|
|
77
108
|
inFlightTools.clear();
|
|
109
|
+
interactiveElicitationDepth = 0;
|
|
78
110
|
}
|
|
79
111
|
// ─── Tool invocation error classification (#2883) ────────────────────────
|
|
80
112
|
/**
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import { parseUnitId } from "./unit-id.js";
|
|
2
2
|
import { AUTO_UNIT_SCOPED_TOOLS, getForbiddenGsdToolReason, } from "./unit-tool-contracts.js";
|
|
3
|
+
import { WORKFLOW_TOOL_ALIAS_PAIRS, canonicalWorkflowSurfaceToolName, isWorkflowSurfaceAliasTool, stripMcpToolPrefix, } from "./workflow-tool-surface.js";
|
|
3
4
|
export { AUTO_UNIT_SCOPED_TOOLS, RUN_UAT_BROWSER_TOOL_NAMES, } from "./unit-tool-contracts.js";
|
|
4
|
-
const WORKFLOW_TOOL_ALIASES = {
|
|
5
|
-
gsd_save_decision: "gsd_decision_save",
|
|
6
|
-
gsd_update_requirement: "gsd_requirement_update",
|
|
7
|
-
gsd_save_requirement: "gsd_requirement_save",
|
|
8
|
-
gsd_save_summary: "gsd_summary_save",
|
|
9
|
-
gsd_generate_milestone_id: "gsd_milestone_generate_id",
|
|
10
|
-
gsd_milestone_plan: "gsd_plan_milestone",
|
|
11
|
-
gsd_slice_plan: "gsd_plan_slice",
|
|
12
|
-
gsd_task_plan: "gsd_plan_task",
|
|
13
|
-
gsd_slice_replan: "gsd_replan_slice",
|
|
14
|
-
gsd_complete_slice: "gsd_slice_complete",
|
|
15
|
-
gsd_milestone_complete: "gsd_complete_milestone",
|
|
16
|
-
gsd_milestone_validate: "gsd_validate_milestone",
|
|
17
|
-
gsd_roadmap_reassess: "gsd_reassess_roadmap",
|
|
18
|
-
gsd_complete_task: "gsd_task_complete",
|
|
19
|
-
gsd_reopen_task: "gsd_task_reopen",
|
|
20
|
-
gsd_reopen_slice: "gsd_slice_reopen",
|
|
21
|
-
gsd_reopen_milestone: "gsd_milestone_reopen",
|
|
22
|
-
};
|
|
23
5
|
const EXECUTE_TASK_UNIT_TYPES = new Set([
|
|
24
6
|
"execute-task",
|
|
25
7
|
"execute-task-simple",
|
|
@@ -42,25 +24,18 @@ const EXTRA_SCOPED_GSD_LIFECYCLE_TOOLS = [
|
|
|
42
24
|
];
|
|
43
25
|
const SCOPED_GSD_LIFECYCLE_TOOLS = new Set([
|
|
44
26
|
...Object.values(AUTO_UNIT_SCOPED_TOOLS).flat(),
|
|
45
|
-
...
|
|
27
|
+
...WORKFLOW_TOOL_ALIAS_PAIRS.map(({ canonical }) => canonical),
|
|
46
28
|
...EXTRA_SCOPED_GSD_LIFECYCLE_TOOLS,
|
|
47
29
|
]
|
|
48
30
|
.filter((tool) => tool.startsWith("gsd_"))
|
|
49
31
|
.map(canonicalWorkflowToolName));
|
|
50
32
|
export const GSD_PHASE_SCOPE_DISPLAY_REASON = "This GSD phase only allows its scoped workflow tools.";
|
|
51
33
|
export const GSD_SECTION_CLOSE_GATE_DISPLAY_REASON = "Gates here close by writing summary sections — gsd_save_gate_result isn't needed.";
|
|
52
|
-
function stripMcpToolPrefix(toolName) {
|
|
53
|
-
if (!toolName.startsWith("mcp__"))
|
|
54
|
-
return toolName;
|
|
55
|
-
const toolSeparator = toolName.indexOf("__", "mcp__".length);
|
|
56
|
-
return toolSeparator >= 0 ? toolName.slice(toolSeparator + 2) : toolName;
|
|
57
|
-
}
|
|
58
34
|
export function canonicalWorkflowToolName(toolName) {
|
|
59
|
-
|
|
60
|
-
return WORKFLOW_TOOL_ALIASES[base] ?? base;
|
|
35
|
+
return canonicalWorkflowSurfaceToolName(toolName);
|
|
61
36
|
}
|
|
62
37
|
export function isWorkflowAliasTool(toolName) {
|
|
63
|
-
return
|
|
38
|
+
return isWorkflowSurfaceAliasTool(toolName);
|
|
64
39
|
}
|
|
65
40
|
function hardBlockReason(unitType, what) {
|
|
66
41
|
return [
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// File Purpose: Post-unit verification gate for GSD auto-mode units.
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { gsdProjectionRoot, resolveSlicePath, resolveMilestoneFile } from "./paths.js";
|
|
5
|
+
import { resolveMilestoneValidationVerdict } from "./milestone-validation-verdict.js";
|
|
5
6
|
import { resolveCanonicalMilestoneRoot } from "./worktree-manager.js";
|
|
6
7
|
import { parseUnitId } from "./unit-id.js";
|
|
7
8
|
import { isDbAvailable, getTask, getSliceTasks, getMilestoneSlices } from "./gsd-db.js";
|
|
8
9
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
9
|
-
import { extractVerdict } from "./verdict-parser.js";
|
|
10
10
|
import { isClosedStatus } from "./status-guards.js";
|
|
11
11
|
import { loadFile } from "./files.js";
|
|
12
12
|
import { parseRoadmap } from "./parsers-legacy.js";
|
|
@@ -214,22 +214,22 @@ async function runValidateMilestonePostCheck(vctx, pauseAuto) {
|
|
|
214
214
|
};
|
|
215
215
|
const validationBasePath = resolveCanonicalMilestoneRoot(s.basePath, mid);
|
|
216
216
|
const validationFile = join(gsdProjectionRoot(validationBasePath), "milestones", mid, `${mid}-VALIDATION.md`);
|
|
217
|
-
|
|
217
|
+
const validationContent = await loadFile(validationFile);
|
|
218
|
+
if (validationContent !== null && validationContent.trim() === "") {
|
|
218
219
|
if (await reassessmentInvalidatedValidation()) {
|
|
219
220
|
clearValidationRetry();
|
|
220
221
|
return "continue";
|
|
221
222
|
}
|
|
222
|
-
return setToolFailureRetry("You must call gsd_validate_milestone to persist the validation results.
|
|
223
|
+
return setToolFailureRetry("You must call gsd_validate_milestone to persist the validation results. VALIDATION.md exists but is empty.");
|
|
223
224
|
}
|
|
224
|
-
const
|
|
225
|
-
if (!
|
|
225
|
+
const verdict = await resolveMilestoneValidationVerdict(s.basePath, mid);
|
|
226
|
+
if (!verdict) {
|
|
226
227
|
if (await reassessmentInvalidatedValidation()) {
|
|
227
228
|
clearValidationRetry();
|
|
228
229
|
return "continue";
|
|
229
230
|
}
|
|
230
|
-
return setToolFailureRetry("You must call gsd_validate_milestone to persist the validation results. VALIDATION.md
|
|
231
|
+
return setToolFailureRetry("You must call gsd_validate_milestone to persist the validation results. No VALIDATION.md was created.");
|
|
231
232
|
}
|
|
232
|
-
const verdict = extractVerdict(validationContent);
|
|
233
233
|
if (verdict === "needs-attention") {
|
|
234
234
|
ctx.ui.notify(`Milestone ${mid} validation returned verdict=needs-attention. Pausing for human review.`, "error");
|
|
235
235
|
process.stderr.write([
|
|
@@ -10,15 +10,16 @@
|
|
|
10
10
|
import { existsSync, cpSync, readFileSync, readdirSync, mkdirSync, realpathSync, rmSync, unlinkSync, lstatSync as lstatSyncFn, } from "node:fs";
|
|
11
11
|
import { dirname, isAbsolute, join, relative, resolve, sep as pathSep } from "node:path";
|
|
12
12
|
import { GSDError, GSD_IO_ERROR, GSD_GIT_ERROR } from "./errors.js";
|
|
13
|
-
import { reconcileWorktreeDb, isDbAvailable, getMilestone, getMilestoneSlices, getSliceTasks,
|
|
13
|
+
import { reconcileWorktreeDb, isDbAvailable, getMilestone, getMilestoneSlices, getSliceTasks, } from "./gsd-db.js";
|
|
14
|
+
import { closeWorkflowDatabase, getWorkflowDatabasePath, openWorkflowDatabasePath, } from "./db-workspace.js";
|
|
14
15
|
import { execFileSync } from "node:child_process";
|
|
15
16
|
import { gsdRoot, resolveGsdPathContract } from "./paths.js";
|
|
16
17
|
import { createWorktree, removeWorktree, resolveGitDir, worktreePath, isInsideWorktreesDir, } from "./worktree-manager.js";
|
|
17
18
|
import { detectWorktreeName, nudgeGitBranchCache, } from "./worktree.js";
|
|
18
19
|
import { isGsdWorktreePath, normalizeWorktreePathForCompare, resolveWorktreeProjectRoot, } from "./worktree-root.js";
|
|
19
20
|
import { autoResolveSafeConflictPaths } from "./git-conflict-resolve.js";
|
|
20
|
-
import { MergeConflictError,
|
|
21
|
-
import {
|
|
21
|
+
import { MergeConflictError, readIntegrationBranch, resolveMilestoneIntegrationBranch, RUNTIME_EXCLUSION_PATHS } from "./git-service.js";
|
|
22
|
+
import { buildPullRequestEvidence, createDraftPullRequestFromEvidence, } from "./pull-request-process.js";
|
|
22
23
|
import { debugLog } from "./debug-logger.js";
|
|
23
24
|
import { logWarning, logError } from "./workflow-logger.js";
|
|
24
25
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
@@ -26,10 +27,11 @@ import { MILESTONE_ID_RE } from "./milestone-ids.js";
|
|
|
26
27
|
import { runWorktreePostCreateHook } from "./worktree-post-create-hook.js";
|
|
27
28
|
import { classifyProject } from "./detection.js";
|
|
28
29
|
import { nativeGetCurrentBranch, nativeDetectMainBranch, nativeWorkingTreeStatus, nativeAddAllWithExclusions, nativeCommit, nativeCheckoutBranch, nativeMergeSquash, nativeMergeRegular, nativeConflictFiles, nativeAddPaths, nativeRmForce, nativeBranchDelete, nativeBranchForceReset, nativeBranchExists, nativeDiffNumstat, nativeUpdateRef, nativeIsAncestor, nativeMergeAbort, nativeWorktreeList, nativeLsFiles, } from "./native-git-bridge.js";
|
|
29
|
-
import { CLOSEOUT_CONSISTENCY_BLOCKED_REASON,
|
|
30
|
+
import { CLOSEOUT_CONSISTENCY_BLOCKED_REASON, } from "./closeout-consistency-gate.js";
|
|
31
|
+
import { formatCloseoutProofBlock, proveMilestoneCloseout, } from "./milestone-closeout-proof.js";
|
|
30
32
|
import { gsdHome } from "./gsd-home.js";
|
|
31
33
|
import { createWorkspace } from "./workspace.js";
|
|
32
|
-
import {
|
|
34
|
+
import { WorktreeStateProjection } from "./worktree-state-projection.js";
|
|
33
35
|
const PROJECT_PREFERENCES_FILE = "PREFERENCES.md";
|
|
34
36
|
const LEGACY_PROJECT_PREFERENCES_FILE = "preferences.md";
|
|
35
37
|
const LEGACY_DEEP_SETUP_RUNTIME_UNIT_FILES = new Set([
|
|
@@ -479,7 +481,7 @@ function cleanupConflictState(basePath) {
|
|
|
479
481
|
* the bodies with raw paths.
|
|
480
482
|
*/
|
|
481
483
|
export function syncProjectRootToWorktree(projectRoot, worktreePath_, milestoneId) {
|
|
482
|
-
|
|
484
|
+
new WorktreeStateProjection().projectRootToWorktreePaths(projectRoot, worktreePath_, milestoneId);
|
|
483
485
|
}
|
|
484
486
|
/**
|
|
485
487
|
* Path-string entry point to WorktreeStateProjection.projectWorktreeToRoot.
|
|
@@ -487,7 +489,7 @@ export function syncProjectRootToWorktree(projectRoot, worktreePath_, milestoneI
|
|
|
487
489
|
* the projection-invariant tests can exercise the body with raw paths.
|
|
488
490
|
*/
|
|
489
491
|
export function syncStateToProjectRoot(worktreePath_, projectRoot, milestoneId) {
|
|
490
|
-
|
|
492
|
+
new WorktreeStateProjection().projectWorktreeToRootPaths(worktreePath_, projectRoot, milestoneId);
|
|
491
493
|
}
|
|
492
494
|
// ─── Resource Staleness ───────────────────────────────────────────────────
|
|
493
495
|
/**
|
|
@@ -829,7 +831,7 @@ export function syncGsdStateToWorktree(mainBasePath, worktreePath_) {
|
|
|
829
831
|
* the shared project DB or the pre-upgrade DB reconciliation path above.
|
|
830
832
|
*/
|
|
831
833
|
export function syncWorktreeStateBack(mainBasePath, worktreePath, milestoneId) {
|
|
832
|
-
return
|
|
834
|
+
return new WorktreeStateProjection().finalizeProjectionForMergePaths(mainBasePath, worktreePath, milestoneId);
|
|
833
835
|
}
|
|
834
836
|
export { runWorktreePostCreateHook } from "./worktree-post-create-hook.js";
|
|
835
837
|
// ─── Auto-Worktree Branch Naming ───────────────────────────────────────────
|
|
@@ -1519,10 +1521,10 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1519
1521
|
const worktreeDbPath = join(contract.worktreeGsd ?? join(worktreeCwd, ".gsd"), "gsd.db");
|
|
1520
1522
|
const mainDbPath = contract.projectDb;
|
|
1521
1523
|
try {
|
|
1522
|
-
const activeDbPath =
|
|
1524
|
+
const activeDbPath = getWorkflowDatabasePath();
|
|
1523
1525
|
if (activeDbPath && _shouldReconcileWorktreeDb(activeDbPath, mainDbPath)) {
|
|
1524
|
-
|
|
1525
|
-
if (!
|
|
1526
|
+
closeWorkflowDatabase();
|
|
1527
|
+
if (!openWorkflowDatabasePath(mainDbPath)) {
|
|
1526
1528
|
throw new Error(`cannot open project DB at ${mainDbPath}`);
|
|
1527
1529
|
}
|
|
1528
1530
|
}
|
|
@@ -1535,9 +1537,9 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1535
1537
|
logError("worktree", message);
|
|
1536
1538
|
throw new GSDError(GSD_GIT_ERROR, `${message}. Recovery reason: ${CLOSEOUT_CONSISTENCY_BLOCKED_REASON}.`);
|
|
1537
1539
|
}
|
|
1538
|
-
const
|
|
1539
|
-
if (!
|
|
1540
|
-
throw new GSDError(GSD_GIT_ERROR,
|
|
1540
|
+
const closeoutProof = proveMilestoneCloseout(milestoneId);
|
|
1541
|
+
if (!closeoutProof.ok) {
|
|
1542
|
+
throw new GSDError(GSD_GIT_ERROR, formatCloseoutProofBlock(closeoutProof));
|
|
1541
1543
|
}
|
|
1542
1544
|
}
|
|
1543
1545
|
// 2. Get completed slices for commit message
|
|
@@ -1840,10 +1842,10 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1840
1842
|
// stashing so Windows releases the handles; reopen after. No-op on
|
|
1841
1843
|
// POSIX, where advisory locks don't block git.
|
|
1842
1844
|
const needsDbCycle = process.platform === "win32" && isDbAvailable();
|
|
1843
|
-
const dbPathToReopen = needsDbCycle ?
|
|
1845
|
+
const dbPathToReopen = needsDbCycle ? getWorkflowDatabasePath() : null;
|
|
1844
1846
|
if (needsDbCycle) {
|
|
1845
1847
|
try {
|
|
1846
|
-
|
|
1848
|
+
closeWorkflowDatabase();
|
|
1847
1849
|
}
|
|
1848
1850
|
catch (err) {
|
|
1849
1851
|
logWarning("worktree", `pre-stash db close failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -1888,7 +1890,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1888
1890
|
: nativeMergeSquash(originalBasePath_, milestoneBranch);
|
|
1889
1891
|
if (needsDbCycle && dbPathToReopen) {
|
|
1890
1892
|
try {
|
|
1891
|
-
|
|
1893
|
+
openWorkflowDatabasePath(dbPathToReopen);
|
|
1892
1894
|
}
|
|
1893
1895
|
catch (err) {
|
|
1894
1896
|
logWarning("worktree", `post-merge db reopen failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -2213,7 +2215,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
2213
2215
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2214
2216
|
encoding: "utf-8",
|
|
2215
2217
|
});
|
|
2216
|
-
const prEvidence =
|
|
2218
|
+
const prEvidence = buildPullRequestEvidence({
|
|
2217
2219
|
milestoneId,
|
|
2218
2220
|
milestoneTitle,
|
|
2219
2221
|
changeType: "feat",
|
|
@@ -2222,7 +2224,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
2222
2224
|
rollbackNotes: ["Close the draft PR or revert the merge commit if review finds a behavior regression."],
|
|
2223
2225
|
how: "Generated by git.auto_pr after the milestone branch was pushed and merged locally.",
|
|
2224
2226
|
});
|
|
2225
|
-
const prUrl =
|
|
2227
|
+
const prUrl = createDraftPullRequestFromEvidence(originalBasePath_, milestoneId, prEvidence, {
|
|
2226
2228
|
head: milestoneBranch,
|
|
2227
2229
|
base: prTarget,
|
|
2228
2230
|
});
|