@opengsd/gsd-pi 1.2.0-dev.844675c9 → 1.2.0-dev.955e4da0
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/bg-shell/utilities.js +2 -2
- package/dist/resources/extensions/claude-code-cli/models.js +9 -0
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +92 -230
- 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 +142 -15
- package/dist/resources/extensions/gsd/auto/phases.js +34 -4
- 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 +12 -9
- 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 +20 -36
- 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-repair.js +10 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +34 -289
- package/dist/resources/extensions/gsd/auto.js +15 -14
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +28 -37
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +20 -43
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +131 -140
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +89 -8
- package/dist/resources/extensions/gsd/captures.js +5 -13
- package/dist/resources/extensions/gsd/closeout-consistency-gate.js +21 -4
- package/dist/resources/extensions/gsd/closeout-recovery.js +3 -2
- package/dist/resources/extensions/gsd/codebase-generator.js +8 -4
- package/dist/resources/extensions/gsd/commands/catalog.js +6 -62
- 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/engine.js +755 -0
- package/dist/resources/extensions/gsd/db/queries.js +372 -0
- package/dist/resources/extensions/gsd/db/sql-constants.js +11 -0
- package/dist/resources/extensions/gsd/db/writers/cascades.js +194 -0
- package/dist/resources/extensions/gsd/db/writers/import-restore.js +182 -0
- package/dist/resources/extensions/gsd/db/writers/memory.js +149 -0
- package/dist/resources/extensions/gsd/db/writers/reconcile.js +458 -0
- package/dist/resources/extensions/gsd/db/writers/status.js +70 -0
- 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-environment.js +8 -10
- package/dist/resources/extensions/gsd/doctor-git-checks.js +4 -3
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +9 -2
- 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/git-service.js +1 -0
- package/dist/resources/extensions/gsd/gitignore.js +3 -0
- package/dist/resources/extensions/gsd/gsd-db.js +183 -2048
- package/dist/resources/extensions/gsd/guided-flow.js +68 -471
- 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 +19 -11
- package/dist/resources/extensions/gsd/migration-auto-check.js +27 -5
- 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/model-cost-table.js +1 -0
- package/dist/resources/extensions/gsd/model-router.js +3 -0
- package/dist/resources/extensions/gsd/parallel-eligibility.js +3 -6
- package/dist/resources/extensions/gsd/parallel-merge.js +14 -11
- package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +7 -5
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +3 -2
- package/dist/resources/extensions/gsd/paths.js +10 -24
- package/dist/resources/extensions/gsd/preferences-diagnostics.js +67 -0
- package/dist/resources/extensions/gsd/preferences.js +161 -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/recovery-classification.js +12 -1
- package/dist/resources/extensions/gsd/roadmap-slices.js +8 -2
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +37 -4
- package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +7 -2
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +10 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +3 -2
- package/dist/resources/extensions/gsd/state-transition-matrix.js +38 -0
- package/dist/resources/extensions/gsd/state.js +13 -5
- package/dist/resources/extensions/gsd/status-guards.js +56 -8
- 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/complete-slice.js +24 -43
- package/dist/resources/extensions/gsd/tools/exec-tool.js +5 -5
- 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/reopen-milestone.js +11 -29
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +14 -33
- package/dist/resources/extensions/gsd/tools/skip-slice.js +18 -36
- 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/undo.js +8 -7
- 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-git-recovery.js +287 -0
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +9 -1
- package/dist/resources/extensions/gsd/worktree-manager.js +45 -28
- package/dist/resources/extensions/gsd/worktree-placement.js +59 -0
- package/dist/resources/extensions/gsd/worktree-reentry.js +12 -8
- package/dist/resources/extensions/gsd/worktree-root.js +17 -6
- package/dist/resources/extensions/gsd/worktree-safety.js +8 -5
- package/dist/resources/extensions/gsd/worktree-session-state.js +12 -10
- 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/resources/skills/gsd-browser/SKILL.md +1 -1
- 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 +12 -12
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/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/api/boot/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/mcp-connections/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +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 +12 -12
- package/dist/web/standalone/.next/server/chunks/{5047.js → 5942.js} +2 -2
- 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/dist/worktree-status-banner.js +7 -3
- 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/components/tool-execution.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +3 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
- 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 +32 -22
- 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/image-models.generated.d.ts +2 -2
- package/packages/pi-ai/dist/image-models.generated.js +6 -6
- package/packages/pi-ai/dist/image-models.generated.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +295 -98
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +309 -154
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.js +3 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.js.map +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/bg-shell/utilities.ts +2 -2
- package/src/resources/extensions/claude-code-cli/models.ts +9 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +114 -281
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +268 -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 +3 -1
- package/src/resources/extensions/gsd/auto/loop.ts +83 -61
- package/src/resources/extensions/gsd/auto/orchestrator.ts +164 -17
- package/src/resources/extensions/gsd/auto/phases.ts +45 -4
- 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 +16 -8
- 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 +25 -34
- 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-repair.ts +13 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +53 -306
- package/src/resources/extensions/gsd/auto.ts +27 -17
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +29 -37
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +20 -43
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +147 -153
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +132 -6
- package/src/resources/extensions/gsd/captures.ts +5 -14
- package/src/resources/extensions/gsd/closeout-consistency-gate.ts +27 -5
- package/src/resources/extensions/gsd/closeout-recovery.ts +2 -1
- package/src/resources/extensions/gsd/codebase-generator.ts +9 -5
- package/src/resources/extensions/gsd/commands/catalog.ts +6 -68
- 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/engine.ts +809 -0
- package/src/resources/extensions/gsd/db/queries.ts +453 -0
- package/src/resources/extensions/gsd/db/sql-constants.ts +12 -0
- package/src/resources/extensions/gsd/db/writers/cascades.ts +237 -0
- package/src/resources/extensions/gsd/db/writers/import-restore.ts +310 -0
- package/src/resources/extensions/gsd/db/writers/memory.ts +220 -0
- package/src/resources/extensions/gsd/db/writers/reconcile.ts +500 -0
- package/src/resources/extensions/gsd/db/writers/status.ts +88 -0
- 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-environment.ts +8 -11
- package/src/resources/extensions/gsd/doctor-git-checks.ts +3 -3
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +10 -3
- 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/git-service.ts +1 -0
- package/src/resources/extensions/gsd/gitignore.ts +3 -0
- package/src/resources/extensions/gsd/gsd-db.ts +185 -2373
- package/src/resources/extensions/gsd/guided-flow.ts +81 -561
- 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 +17 -9
- package/src/resources/extensions/gsd/migration-auto-check.ts +30 -5
- 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/model-cost-table.ts +1 -0
- package/src/resources/extensions/gsd/model-router.ts +3 -0
- package/src/resources/extensions/gsd/parallel-eligibility.ts +4 -5
- package/src/resources/extensions/gsd/parallel-merge.ts +12 -9
- package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +6 -5
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +6 -2
- package/src/resources/extensions/gsd/paths.ts +9 -22
- 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 +191 -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/recovery-classification.ts +14 -1
- package/src/resources/extensions/gsd/roadmap-slices.ts +8 -2
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +36 -4
- package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +7 -2
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +14 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +6 -2
- package/src/resources/extensions/gsd/state-transition-matrix.ts +42 -0
- package/src/resources/extensions/gsd/state.ts +15 -5
- package/src/resources/extensions/gsd/status-guards.ts +59 -8
- 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 +444 -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-paused-ui-cleanup.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/auto-post-unit-evidence-crossref-4909.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-worktree-repair.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/canonical-milestone-root.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +22 -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/evidence-xref-gsd-exec.test.ts +157 -0
- package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +33 -1
- 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/integration/auto-worktree-milestone-merge.test.ts +5 -4
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/mcp-tool-name.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +143 -1
- 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/recovery-classification-illegal-transition.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +185 -1
- 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/safety-harness-false-positives.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +80 -0
- package/src/resources/extensions/gsd/tests/session-switch-clears-pending-autostart.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +144 -7
- 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/state-transition-matrix.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/status-guards.test.ts +38 -0
- 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-lifecycle.test.ts +41 -4
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +43 -1
- package/src/resources/extensions/gsd/tests/worktree-placement.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/worktree-projection-writers.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-reentry.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-safety.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +12 -6
- package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +121 -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/complete-slice.ts +23 -58
- package/src/resources/extensions/gsd/tools/exec-tool.ts +5 -5
- 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/reopen-milestone.ts +11 -38
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +14 -42
- package/src/resources/extensions/gsd/tools/skip-slice.ts +18 -44
- 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/undo.ts +9 -8
- 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-git-recovery.ts +308 -0
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +17 -17
- package/src/resources/extensions/gsd/worktree-manager.ts +47 -28
- package/src/resources/extensions/gsd/worktree-placement.ts +63 -0
- package/src/resources/extensions/gsd/worktree-reentry.ts +10 -7
- package/src/resources/extensions/gsd/worktree-root.ts +17 -6
- package/src/resources/extensions/gsd/worktree-safety.ts +8 -5
- package/src/resources/extensions/gsd/worktree-session-state.ts +12 -10
- 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/src/resources/skills/gsd-browser/SKILL.md +1 -1
- 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 → C24pqUd-aru-l0Dp0gLZP}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Qbr81pQ-pbQXP4bq2VXLv → C24pqUd-aru-l0Dp0gLZP}/_ssgManifest.js +0 -0
|
@@ -21,8 +21,9 @@ import { getPendingGatesForTurn } from "./gsd-db.js";
|
|
|
21
21
|
import { assertGateCoverage, getGatesForTurn, } from "./gate-registry.js";
|
|
22
22
|
import { formatDecisionsCompact, formatRequirementsCompact } from "./structured-data-formatter.js";
|
|
23
23
|
import { readPhaseAnchor, formatAnchorForPrompt } from "./phase-anchor.js";
|
|
24
|
-
import { composeContextModeInstructions, composeInlinedContext, composeUnitContext } from "./unit-context-composer.js";
|
|
24
|
+
import { composeContextModeInstructions, composeContractedUnitContext, composeInlinedContext, composeUnitContext, } from "./unit-context-composer.js";
|
|
25
25
|
import { resolveManifest } from "./unit-context-manifest.js";
|
|
26
|
+
import { compileUnitContextContract } from "./tool-contract.js";
|
|
26
27
|
import { readCompactionSnapshot } from "./compaction-snapshot.js";
|
|
27
28
|
import { logWarning } from "./workflow-logger.js";
|
|
28
29
|
import { inlineGraphSubgraph } from "./graph-context.js";
|
|
@@ -33,6 +34,7 @@ import { buildSkillActivationBlock, buildSkillDiscoveryVars } from "./skill-acti
|
|
|
33
34
|
import { findMilestoneIds } from "./milestone-ids.js";
|
|
34
35
|
import { buildRunUatPresentationForType, RUN_UAT_TOOL_PRESENTATION_PLAN_ID } from "./tool-presentation-plan.js";
|
|
35
36
|
import { resolveEffectiveUatType, shouldDispatchUatForContent } from "./uat-policy.js";
|
|
37
|
+
import { buildWebAppUatGuidanceBlock } from "./web-app-uat.js";
|
|
36
38
|
export { buildSkillActivationBlock, buildSkillDiscoveryVars };
|
|
37
39
|
// ─── Preamble Cap ─────────────────────────────────────────────────────────────
|
|
38
40
|
/**
|
|
@@ -229,6 +231,29 @@ function prependContextModeToBlock(unitType, base, block, renderMode = "standalo
|
|
|
229
231
|
return contextMode;
|
|
230
232
|
return `${contextMode}\n\n${block}`;
|
|
231
233
|
}
|
|
234
|
+
function requireUnitPromptContextContract(unitType) {
|
|
235
|
+
const result = compileUnitContextContract(unitType);
|
|
236
|
+
if (result.ok)
|
|
237
|
+
return result.contract;
|
|
238
|
+
throw new Error(result.detail);
|
|
239
|
+
}
|
|
240
|
+
function requireComposedArtifactBlock(blocks, unitType, key) {
|
|
241
|
+
const block = blocks.find((item) => item.key === key);
|
|
242
|
+
if (!block) {
|
|
243
|
+
throw new Error(`Unit Context Contract for ${unitType} did not compose required artifact ${key}`);
|
|
244
|
+
}
|
|
245
|
+
return block.body;
|
|
246
|
+
}
|
|
247
|
+
function renderExecuteTaskOnDemandContext(base, mid, sid, artifacts) {
|
|
248
|
+
if (!artifacts.includes("slice-research"))
|
|
249
|
+
return "";
|
|
250
|
+
const researchPath = relSliceFile(base, mid, sid, "RESEARCH");
|
|
251
|
+
return [
|
|
252
|
+
"## On-demand Context",
|
|
253
|
+
"",
|
|
254
|
+
`Slice research is available at \`${researchPath}\`. Read it only if the inlined task plan, slice plan excerpt, and carry-forward context do not explain a required implementation detail.`,
|
|
255
|
+
].join("\n");
|
|
256
|
+
}
|
|
232
257
|
// ─── Executor Constraints ─────────────────────────────────────────────────────
|
|
233
258
|
/**
|
|
234
259
|
* Format executor context constraints for injection into the plan-slice prompt.
|
|
@@ -1745,6 +1770,13 @@ export async function buildPlanMilestonePrompt(mid, midTitle, base, level) {
|
|
|
1745
1770
|
else {
|
|
1746
1771
|
trackPromptContext(contextTelemetry, "knowledge", "skipped", null, "missing");
|
|
1747
1772
|
}
|
|
1773
|
+
const webAppUatGuidance = buildWebAppUatGuidanceBlock(base);
|
|
1774
|
+
if (webAppUatGuidance) {
|
|
1775
|
+
pushTracked("web-app-uat", webAppUatGuidance);
|
|
1776
|
+
}
|
|
1777
|
+
else {
|
|
1778
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "skipped", null, "not a web app");
|
|
1779
|
+
}
|
|
1748
1780
|
pushTracked("templates", inlineTemplate("roadmap", "Roadmap"));
|
|
1749
1781
|
if (inlineLevel === "full") {
|
|
1750
1782
|
pushTracked("templates", inlineTemplate("decisions", "Decisions"));
|
|
@@ -2032,6 +2064,14 @@ async function renderSlicePrompt(options) {
|
|
|
2032
2064
|
else {
|
|
2033
2065
|
trackPromptContext(contextTelemetry, "graph-subgraph", "skipped", null, "missing");
|
|
2034
2066
|
}
|
|
2067
|
+
const webAppUatGuidance = buildWebAppUatGuidanceBlock(base);
|
|
2068
|
+
if (webAppUatGuidance) {
|
|
2069
|
+
inlined.push(webAppUatGuidance);
|
|
2070
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "inline", webAppUatGuidance);
|
|
2071
|
+
}
|
|
2072
|
+
else {
|
|
2073
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "skipped", null, "not a web app");
|
|
2074
|
+
}
|
|
2035
2075
|
const planTemplateInline = level === "minimal" ? inlineCompactTemplate("plan", "Slice Plan") : inlineTemplate("plan", "Slice Plan");
|
|
2036
2076
|
inlined.push(planTemplateInline);
|
|
2037
2077
|
trackPromptContext(contextTelemetry, "templates", "inline", planTemplateInline);
|
|
@@ -2173,7 +2213,7 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2173
2213
|
const taskPlanPath = resolveTaskFile(base, mid, sid, tid, "PLAN");
|
|
2174
2214
|
const taskPlanContent = taskPlanPath ? await loadFile(taskPlanPath) : null;
|
|
2175
2215
|
const taskPlanRelPath = relSlicePath(base, mid, sid) + `/tasks/${tid}-PLAN.md`;
|
|
2176
|
-
const
|
|
2216
|
+
const taskPlanContext = taskPlanContent
|
|
2177
2217
|
? [
|
|
2178
2218
|
"## Inlined Task Plan (authoritative local execution contract)",
|
|
2179
2219
|
`Source: \`${taskPlanRelPath}\``,
|
|
@@ -2184,11 +2224,11 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2184
2224
|
"## Inlined Task Plan (authoritative local execution contract)",
|
|
2185
2225
|
`Task plan not found at dispatch time. Read \`${taskPlanRelPath}\` before executing.`,
|
|
2186
2226
|
].join("\n");
|
|
2187
|
-
trackPromptContext(contextTelemetry, "task-plan", taskPlanContent ? "inline" : "on-demand",
|
|
2227
|
+
trackPromptContext(contextTelemetry, "task-plan", taskPlanContent ? "inline" : "on-demand", taskPlanContext, taskPlanContent ? undefined : "missing at dispatch");
|
|
2188
2228
|
const slicePlanPath = resolveSliceFile(base, mid, sid, "PLAN");
|
|
2189
2229
|
const slicePlanContent = slicePlanPath ? await loadFile(slicePlanPath) : null;
|
|
2190
|
-
const
|
|
2191
|
-
trackPromptContext(contextTelemetry, "slice-plan",
|
|
2230
|
+
const slicePlanContext = extractSliceExecutionExcerpt(slicePlanContent, relSliceFile(base, mid, sid, "PLAN"));
|
|
2231
|
+
trackPromptContext(contextTelemetry, "slice-plan", slicePlanContext ? "excerpt" : "skipped", slicePlanContext, slicePlanContext ? undefined : "missing");
|
|
2192
2232
|
// Check for continue file (new naming or legacy)
|
|
2193
2233
|
const continueFile = resolveSliceFile(base, mid, sid, "CONTINUE");
|
|
2194
2234
|
const legacyContinueDir = resolveSlicePath(base, mid, sid);
|
|
@@ -2287,6 +2327,30 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2287
2327
|
trackPromptContext(contextTelemetry, "decisions-template", "on-demand", decisionsOnDemandET);
|
|
2288
2328
|
}
|
|
2289
2329
|
trackPromptContext(contextTelemetry, "templates", "inline", inlinedTemplates, inlineLevel);
|
|
2330
|
+
const contextContract = requireUnitPromptContextContract("execute-task");
|
|
2331
|
+
const contractedContext = await composeContractedUnitContext(contextContract, {
|
|
2332
|
+
base: { unitType: "execute-task", basePath: base, milestoneId: mid, sliceId: sid, taskId: tid },
|
|
2333
|
+
resolveArtifact: async (key) => {
|
|
2334
|
+
switch (key) {
|
|
2335
|
+
case "task-plan":
|
|
2336
|
+
return taskPlanContext;
|
|
2337
|
+
case "slice-plan":
|
|
2338
|
+
return slicePlanContext;
|
|
2339
|
+
case "prior-task-summaries":
|
|
2340
|
+
return finalCarryForward;
|
|
2341
|
+
case "templates":
|
|
2342
|
+
return inlinedTemplates;
|
|
2343
|
+
default:
|
|
2344
|
+
return null;
|
|
2345
|
+
}
|
|
2346
|
+
},
|
|
2347
|
+
});
|
|
2348
|
+
const taskPlanInline = requireComposedArtifactBlock(contractedContext.blocks, "execute-task", "task-plan");
|
|
2349
|
+
const slicePlanExcerpt = requireComposedArtifactBlock(contractedContext.blocks, "execute-task", "slice-plan");
|
|
2350
|
+
const contractedCarryForward = requireComposedArtifactBlock(contractedContext.blocks, "execute-task", "prior-task-summaries");
|
|
2351
|
+
const contractedTemplates = requireComposedArtifactBlock(contractedContext.blocks, "execute-task", "templates");
|
|
2352
|
+
const onDemandContext = renderExecuteTaskOnDemandContext(base, mid, sid, contractedContext.onDemand);
|
|
2353
|
+
trackPromptContext(contextTelemetry, "slice-research", onDemandContext ? "on-demand" : "skipped", onDemandContext, onDemandContext ? undefined : "not declared by contract");
|
|
2290
2354
|
const prompt = loadPrompt("execute-task", {
|
|
2291
2355
|
overridesSection,
|
|
2292
2356
|
runtimeContext,
|
|
@@ -2298,11 +2362,12 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2298
2362
|
taskPlanPath: taskPlanRelPath,
|
|
2299
2363
|
taskPlanInline,
|
|
2300
2364
|
slicePlanExcerpt,
|
|
2301
|
-
carryForwardSection:
|
|
2365
|
+
carryForwardSection: contractedCarryForward,
|
|
2302
2366
|
resumeSection,
|
|
2303
2367
|
priorTaskLines: priorLines,
|
|
2368
|
+
onDemandContext,
|
|
2304
2369
|
taskSummaryPath,
|
|
2305
|
-
inlinedTemplates,
|
|
2370
|
+
inlinedTemplates: contractedTemplates,
|
|
2306
2371
|
verificationBudget,
|
|
2307
2372
|
gatesToClose,
|
|
2308
2373
|
skillActivation: buildSkillActivationBlock({
|
|
@@ -2313,7 +2378,7 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2313
2378
|
taskId: tid,
|
|
2314
2379
|
taskTitle: tTitle,
|
|
2315
2380
|
taskPlanContent,
|
|
2316
|
-
extraContext: [taskPlanInline, slicePlanExcerpt,
|
|
2381
|
+
extraContext: [taskPlanInline, slicePlanExcerpt, contractedCarryForward, resumeSection],
|
|
2317
2382
|
unitType: "execute-task",
|
|
2318
2383
|
}),
|
|
2319
2384
|
});
|
|
@@ -2424,6 +2489,14 @@ export async function buildCompleteSlicePrompt(mid, midTitle, sid, sTitle, base,
|
|
|
2424
2489
|
body = `${body}\n\n---\n\n${knowledgeInlineCS}`;
|
|
2425
2490
|
}
|
|
2426
2491
|
}
|
|
2492
|
+
const webAppUatGuidance = buildWebAppUatGuidanceBlock(base);
|
|
2493
|
+
if (webAppUatGuidance && body) {
|
|
2494
|
+
body = `${webAppUatGuidance}\n\n---\n\n${body}`;
|
|
2495
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "inline", webAppUatGuidance);
|
|
2496
|
+
}
|
|
2497
|
+
else {
|
|
2498
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "skipped", null, webAppUatGuidance ? "missing composed body" : "not a web app");
|
|
2499
|
+
}
|
|
2427
2500
|
// Overrides section prepends to the top of the inlined context —
|
|
2428
2501
|
// standard pattern for slice-level builders (until composer v2 lands
|
|
2429
2502
|
// the prepend contract).
|
|
@@ -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
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* remains in auto.ts — this module handles only the fresh-start path.
|
|
12
12
|
*/
|
|
13
13
|
import { deriveState } from "./state.js";
|
|
14
|
+
import { findWorktreeSegment, isGsdWorktreePath } from "./worktree-root.js";
|
|
14
15
|
import { loadFile, getManifestStatus } from "./files.js";
|
|
15
16
|
import { loadEffectiveGSDPreferences, resolveSkillDiscoveryMode, getIsolationMode, } from "./preferences.js";
|
|
16
17
|
import { ensureGsdSymlink, isInheritedRepo, validateProjectId } from "./repo-identity.js";
|
|
@@ -34,7 +35,8 @@ import { initRoutingHistory } from "./routing-history.js";
|
|
|
34
35
|
import { restoreHookState, resetHookState } from "./post-unit-hooks.js";
|
|
35
36
|
import { resetProactiveHealing, setLevelChangeCallback } from "./doctor-proactive.js";
|
|
36
37
|
import { snapshotSkills } from "./skill-discovery.js";
|
|
37
|
-
import { isDbAvailable, getMilestone, getAllMilestones, insertMilestone,
|
|
38
|
+
import { isDbAvailable, getMilestone, getAllMilestones, insertMilestone, updateMilestoneStatus } from "./gsd-db.js";
|
|
39
|
+
import { getWorkflowDatabaseStatus, openExistingWorkflowDatabase, openWorkflowDatabase, resolveProjectRootDbPath, } from "./db-workspace.js";
|
|
38
40
|
import { isClosedStatus } from "./status-guards.js";
|
|
39
41
|
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
40
42
|
import { extractVerdict } from "./verdict-parser.js";
|
|
@@ -44,8 +46,6 @@ import { debugLog, enableDebug, isDebugEnabled, getDebugLogPath, } from "./debug
|
|
|
44
46
|
import { logWarning, logError } from "./workflow-logger.js";
|
|
45
47
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, } from "node:fs";
|
|
46
48
|
import { join } from "node:path";
|
|
47
|
-
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) {
|
|
@@ -405,7 +403,7 @@ export function auditOrphanedMilestoneBranches(basePath, _isolationMode, gitDeps
|
|
|
405
403
|
}
|
|
406
404
|
}
|
|
407
405
|
else {
|
|
408
|
-
warnings.push(`Orphaned worktree directory for ${milestoneId} is outside
|
|
406
|
+
warnings.push(`Orphaned worktree directory for ${milestoneId} is outside the GSD worktrees containers — skipping removal for safety.`);
|
|
409
407
|
}
|
|
410
408
|
}
|
|
411
409
|
else {
|
|
@@ -524,7 +522,7 @@ export function auditOrphanedMilestoneBranches(basePath, _isolationMode, gitDeps
|
|
|
524
522
|
if (!existsSync(wtDir))
|
|
525
523
|
continue;
|
|
526
524
|
if (!isInsideWorktreesDir(basePath, wtDir)) {
|
|
527
|
-
warnings.push(`Orphaned worktree directory for ${m.id} is outside
|
|
525
|
+
warnings.push(`Orphaned worktree directory for ${m.id} is outside the GSD worktrees containers — skipping removal for safety.`);
|
|
528
526
|
continue;
|
|
529
527
|
}
|
|
530
528
|
// Try `git worktree remove` first in case the dir is still registered
|
|
@@ -1012,7 +1010,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1012
1010
|
(state.phase === "pre-planning" || state.phase === "complete") &&
|
|
1013
1011
|
survivorIsolationMode !== "none" &&
|
|
1014
1012
|
!detectWorktreeName(base) &&
|
|
1015
|
-
!base
|
|
1013
|
+
!isGsdWorktreePath(base)) {
|
|
1016
1014
|
const milestoneBranch = `milestone/${survivorMilestoneId}`;
|
|
1017
1015
|
const { nativeBranchExists } = await import("./native-git-bridge.js");
|
|
1018
1016
|
hasSurvivorBranch = nativeBranchExists(base, milestoneBranch);
|
|
@@ -1248,16 +1246,11 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1248
1246
|
// (ADR-016 phase 2 / B2, #5620). The redundant assignment that used to
|
|
1249
1247
|
// live here is gone.
|
|
1250
1248
|
const isUnderGsdWorktrees = (p) => {
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
if (p.includes(marker))
|
|
1249
|
+
const normalized = p.replaceAll("\\", "/");
|
|
1250
|
+
if (findWorktreeSegment(normalized) !== null)
|
|
1254
1251
|
return true;
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
return true;
|
|
1258
|
-
// Symlink-resolved layout: /.gsd/projects/<hash>/worktrees/
|
|
1259
|
-
const symlinkRe = new RegExp(`\\${pathSep}\\.gsd\\${pathSep}projects\\${pathSep}[a-f0-9]+\\${pathSep}worktrees(?:\\${pathSep}|$)`);
|
|
1260
|
-
return symlinkRe.test(p);
|
|
1252
|
+
// The container directory itself (no trailing worktree name).
|
|
1253
|
+
return normalized.endsWith("/.gsd/worktrees") || normalized.endsWith("/.gsd-worktrees");
|
|
1261
1254
|
};
|
|
1262
1255
|
if (s.currentMilestoneId &&
|
|
1263
1256
|
(getIsolationMode(base) !== "none" || strandedRecoveryAction?.recoveryMode) &&
|
|
@@ -1295,23 +1288,14 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1295
1288
|
}
|
|
1296
1289
|
// ── DB lifecycle ──
|
|
1297
1290
|
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
|
-
}
|
|
1291
|
+
const initialDbOpen = openWorkflowDatabase(s.basePath);
|
|
1292
|
+
if (!initialDbOpen.ok && initialDbOpen.reason === "open-failed") {
|
|
1293
|
+
logError("engine", `failed to initialize project database: ${initialDbOpen.error?.message ?? "open failed"}`);
|
|
1307
1294
|
}
|
|
1308
1295
|
if (_shouldAbortBootstrapForUnavailableDbForTest(gsdDbPath, isDbAvailable())) {
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
}
|
|
1313
|
-
catch (err) {
|
|
1314
|
-
logError("engine", `failed to open existing database: ${err.message}`);
|
|
1296
|
+
const retryDbOpen = openWorkflowDatabase(s.basePath);
|
|
1297
|
+
if (!retryDbOpen.ok && retryDbOpen.reason === "open-failed") {
|
|
1298
|
+
logError("engine", `failed to open existing database: ${retryDbOpen.error?.message ?? "open failed"}`);
|
|
1315
1299
|
}
|
|
1316
1300
|
}
|
|
1317
1301
|
// Gate: abort bootstrap if the DB file exists but the provider is
|
|
@@ -1320,7 +1304,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1320
1304
|
// call returns "db_unavailable", triggering artifact-retry which
|
|
1321
1305
|
// re-dispatches the same task — producing an infinite loop (#2419).
|
|
1322
1306
|
if (existsSync(gsdDbPath) && !isDbAvailable()) {
|
|
1323
|
-
const dbStatus =
|
|
1307
|
+
const dbStatus = getWorkflowDatabaseStatus();
|
|
1324
1308
|
const phaseHint = dbStatus.lastPhase === "open"
|
|
1325
1309
|
? "The database file could not be opened"
|
|
1326
1310
|
: 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 [
|