@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
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
// the real collaborators (state-reconciliation, doctor-proactive,
|
|
10
10
|
// auto-dispatch, recovery-classification, tool-contract, worktree-safety,
|
|
11
11
|
// uok/gate-runner, journal, session-lock, ctx.ui.notify) directly.
|
|
12
|
-
import { debugCount, debugTime } from "../debug-logger.js";
|
|
12
|
+
import { debugCount, debugLog, debugTime } from "../debug-logger.js";
|
|
13
13
|
import { reconcileBeforeDispatch } from "../state-reconciliation.js";
|
|
14
|
+
import { isLegalEdge, IllegalPhaseTransitionError } from "../state-transition-matrix.js";
|
|
14
15
|
import { resolveDispatch } from "../auto-dispatch.js";
|
|
15
16
|
import { classifyFailure } from "../recovery-classification.js";
|
|
16
17
|
import { verifyExpectedArtifact, refreshRecoveryDbForArtifact } from "../auto-recovery.js";
|
|
@@ -24,22 +25,26 @@ import { checkResourcesStale, autoWorktreeBranch, mergeMilestoneToMain } from ".
|
|
|
24
25
|
import { getSessionLockStatus } from "../session-lock.js";
|
|
25
26
|
import { resolveUokFlags } from "../uok/flags.js";
|
|
26
27
|
import { emitJournalEvent as _emitJournalEvent } from "../journal.js";
|
|
27
|
-
import { loadEffectiveGSDPreferences, getIsolationMode } from "../preferences.js";
|
|
28
|
-
import { detectWorktreeName, resolveProjectRoot } from "../worktree.js";
|
|
28
|
+
import { loadEffectiveGSDPreferences, getIsolationMode, resolveEffectiveUnitIsolationMode } from "../preferences.js";
|
|
29
|
+
import { detectWorktreeName, getMainBranch, resolveProjectRoot, resolveWorktreeProjectRoot, } from "../worktree.js";
|
|
30
|
+
import { getPriorSliceCompletionBlocker } from "../dispatch-guard.js";
|
|
29
31
|
import { GitServiceImpl } from "../git-service.js";
|
|
30
32
|
import { WorktreeStateProjection } from "../worktree-state-projection.js";
|
|
31
33
|
import { WorktreeLifecycle } from "../worktree-lifecycle.js";
|
|
34
|
+
import { createMilestoneMergeTransaction } from "../milestone-merge-transaction.js";
|
|
32
35
|
import { createWorkspace, scopeMilestone } from "../workspace.js";
|
|
33
36
|
import { supportsStructuredQuestions } from "../workflow-mcp.js";
|
|
34
|
-
import { getToolBaselineSnapshot } from "../auto-model-selection.js";
|
|
37
|
+
import { getRegisteredToolSnapshot, getToolBaselineSnapshot } from "../auto-model-selection.js";
|
|
35
38
|
import { deriveState } from "../state.js";
|
|
36
39
|
import { parseUnitId } from "../unit-id.js";
|
|
37
40
|
import { isClosedStatus } from "../status-guards.js";
|
|
38
|
-
import { isDbAvailable, getSlice, getTask,
|
|
41
|
+
import { isDbAvailable, getSlice, getTask, } from "../gsd-db.js";
|
|
42
|
+
import { refreshWorkflowDatabaseFromDisk } from "../db-workspace.js";
|
|
39
43
|
import { getErrorMessage } from "../error-utils.js";
|
|
40
44
|
import { logWarning } from "../workflow-logger.js";
|
|
41
45
|
import { existsSync, readFileSync } from "node:fs";
|
|
42
46
|
import { join } from "node:path";
|
|
47
|
+
import { evaluateAllCompleteSettlement } from "../milestone-settlement.js";
|
|
43
48
|
function now() {
|
|
44
49
|
return Date.now();
|
|
45
50
|
}
|
|
@@ -52,16 +57,24 @@ function now() {
|
|
|
52
57
|
* preserved across the eventual cutover (issue #5791).
|
|
53
58
|
*/
|
|
54
59
|
export const STUCK_WINDOW_SIZE = 6;
|
|
55
|
-
function
|
|
60
|
+
function noRemainingUnitsOutcome(stateSnapshot) {
|
|
56
61
|
if (stateSnapshot.phase === "complete") {
|
|
57
|
-
return
|
|
62
|
+
return {
|
|
63
|
+
code: "all-complete",
|
|
64
|
+
displayReason: "All milestones complete",
|
|
65
|
+
allMilestonesComplete: true,
|
|
66
|
+
};
|
|
58
67
|
}
|
|
59
|
-
return
|
|
68
|
+
return {
|
|
69
|
+
code: "no-remaining-units",
|
|
70
|
+
displayReason: "No remaining units",
|
|
71
|
+
allMilestonesComplete: false,
|
|
72
|
+
};
|
|
60
73
|
}
|
|
61
74
|
function getAlreadyClosedDispatchReason(unitType, unitId) {
|
|
62
75
|
if (!isDbAvailable())
|
|
63
76
|
return null;
|
|
64
|
-
|
|
77
|
+
refreshWorkflowDatabaseFromDisk();
|
|
65
78
|
const { milestone, slice, task } = parseUnitId(unitId);
|
|
66
79
|
if (unitType === "execute-task" && milestone && slice && task) {
|
|
67
80
|
const row = getTask(milestone, slice, task);
|
|
@@ -127,6 +140,7 @@ export async function decideOrchestratorDispatch(ctx, pi, dispatchBasePath, sess
|
|
|
127
140
|
// active set may be narrowed by the prior unit before selectAndApplyModel
|
|
128
141
|
// restores it, causing false transport-preflight failures (#477 follow-up).
|
|
129
142
|
const activeTools = getToolBaselineSnapshot(pi);
|
|
143
|
+
const registeredTools = getRegisteredToolSnapshot(pi);
|
|
130
144
|
// Mirrors runDispatch: deep-planning keeps approval gates in plain chat
|
|
131
145
|
// because structured questions can be cancelled outside the chat turn on
|
|
132
146
|
// some transports.
|
|
@@ -168,6 +182,7 @@ export async function decideOrchestratorDispatch(ctx, pi, dispatchBasePath, sess
|
|
|
168
182
|
sessionProvider,
|
|
169
183
|
modelRegistry,
|
|
170
184
|
activeTools,
|
|
185
|
+
registeredTools,
|
|
171
186
|
sessionAuthMode: authMode,
|
|
172
187
|
sessionBaseUrl: ctx.model?.baseUrl,
|
|
173
188
|
});
|
|
@@ -230,6 +245,10 @@ export class AutoOrchestrator {
|
|
|
230
245
|
lastAdvanceKey = null;
|
|
231
246
|
lastFinalizedUnitKey = null;
|
|
232
247
|
dispatchKeyWindow = [];
|
|
248
|
+
// ADR-030 Phase Transition Invariant: the prior advance's reconciled Phase,
|
|
249
|
+
// the "from" endpoint of the edge check. In-memory; reset on start/resume/stop
|
|
250
|
+
// so the first advance of a session has no edge to assert.
|
|
251
|
+
lastDerivedPhase = null;
|
|
233
252
|
// #442: the unit key we last attempted graduated stuck-recovery for. Bounds
|
|
234
253
|
// recovery to one attempt per stuck episode per run (reset on start/resume/
|
|
235
254
|
// stop), mirroring the legacy Level-1-then-Level-2 escalation in phases.ts.
|
|
@@ -412,6 +431,47 @@ export class AutoOrchestrator {
|
|
|
412
431
|
decideNextUnit(input) {
|
|
413
432
|
return decideOrchestratorDispatch(this.ctx, this.pi, this.dispatchBasePath, this.s, input);
|
|
414
433
|
}
|
|
434
|
+
evaluateNoRemainingUnitsSettlement(stateSnapshot) {
|
|
435
|
+
const settlement = evaluateAllCompleteSettlement({
|
|
436
|
+
milestoneId: this.s.currentMilestoneId ?? stateSnapshot.activeMilestone?.id,
|
|
437
|
+
statePhase: stateSnapshot.phase,
|
|
438
|
+
basePath: this.s.basePath || this.getLiveDispatchBasePath(),
|
|
439
|
+
originalBasePath: this.s.originalBasePath || this.runtimeBasePath,
|
|
440
|
+
milestoneMerged: this.s.milestoneMergedInPhases,
|
|
441
|
+
});
|
|
442
|
+
this.s.milestoneSettlement = settlement;
|
|
443
|
+
if (settlement.ok)
|
|
444
|
+
return null;
|
|
445
|
+
return {
|
|
446
|
+
kind: "blocked",
|
|
447
|
+
reason: settlement.message,
|
|
448
|
+
action: settlement.action,
|
|
449
|
+
stateSnapshot,
|
|
450
|
+
terminalOutcome: {
|
|
451
|
+
code: "settlement-blocked",
|
|
452
|
+
displayReason: settlement.message,
|
|
453
|
+
nextAction: settlement.nextAction,
|
|
454
|
+
milestoneId: settlement.milestoneId,
|
|
455
|
+
allMilestonesComplete: false,
|
|
456
|
+
},
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
clearPendingDispatch() {
|
|
460
|
+
this.s.pendingOrchestrationDispatch = null;
|
|
461
|
+
}
|
|
462
|
+
findPriorSliceCompletionBlocker(unitType, unitId) {
|
|
463
|
+
const guardBasePath = resolveWorktreeProjectRoot(this.getLiveDispatchBasePath(), this.s.originalBasePath);
|
|
464
|
+
let mainBranch = "main";
|
|
465
|
+
try {
|
|
466
|
+
mainBranch = getMainBranch(guardBasePath);
|
|
467
|
+
}
|
|
468
|
+
catch (err) {
|
|
469
|
+
// Preserve legacy dispatch behavior: fall back to main when branch
|
|
470
|
+
// discovery fails, then let the guard make the progression decision.
|
|
471
|
+
logWarning("engine", `branch discovery failed, falling back to main: ${getErrorMessage(err)}`, { file: "orchestrator.ts" });
|
|
472
|
+
}
|
|
473
|
+
return getPriorSliceCompletionBlocker(guardBasePath, mainBranch, unitType, unitId);
|
|
474
|
+
}
|
|
415
475
|
// ── ToolContractAdapter (folded) ─────────────────────────────────────────
|
|
416
476
|
compileUnitToolContract(unitType) {
|
|
417
477
|
const result = compileUnitToolContract(unitType);
|
|
@@ -421,8 +481,7 @@ export class AutoOrchestrator {
|
|
|
421
481
|
}
|
|
422
482
|
// ── WorktreeAdapter (folded) ─────────────────────────────────────────────
|
|
423
483
|
getEffectiveUnitIsolationMode(basePath) {
|
|
424
|
-
|
|
425
|
-
return configuredMode === "worktree" && this.s.isolationDegraded ? "branch" : configuredMode;
|
|
484
|
+
return resolveEffectiveUnitIsolationMode(getIsolationMode(basePath), this.s.isolationDegraded, this.s.strandedRecoveryIsolationMode);
|
|
426
485
|
}
|
|
427
486
|
buildLifecycle() {
|
|
428
487
|
return new WorktreeLifecycle(this.s, {
|
|
@@ -431,7 +490,7 @@ export class AutoOrchestrator {
|
|
|
431
490
|
return new GitServiceImpl(basePath, gitConfig);
|
|
432
491
|
},
|
|
433
492
|
worktreeProjection: new WorktreeStateProjection(),
|
|
434
|
-
mergeMilestoneToMain,
|
|
493
|
+
mergeMilestoneToMain: createMilestoneMergeTransaction(mergeMilestoneToMain),
|
|
435
494
|
});
|
|
436
495
|
}
|
|
437
496
|
rebuildScope(rawPath, milestoneId) {
|
|
@@ -521,6 +580,21 @@ export class AutoOrchestrator {
|
|
|
521
580
|
const recovery = classifyFailure(input);
|
|
522
581
|
return { action: recovery.action, reason: recovery.reason };
|
|
523
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
* ADR-030 Phase Transition Invariant (advisory mode). The matrix is an
|
|
585
|
+
* assertion, not a decision-maker — deriveState already chose the phase; we
|
|
586
|
+
* only observe illegal *derived* edges that survived reconciliation. The
|
|
587
|
+
* matrix is still a sparse hardening spec, so this is telemetry-only (no
|
|
588
|
+
* block) until it is expanded into a validated legal-edge graph. To enforce:
|
|
589
|
+
* `throw violation;` instead of logging — recovery-classification maps
|
|
590
|
+
* IllegalPhaseTransitionError to kind "illegal-transition" (escalate).
|
|
591
|
+
*/
|
|
592
|
+
observePhaseTransition(from, to) {
|
|
593
|
+
if (isLegalEdge(from, to))
|
|
594
|
+
return;
|
|
595
|
+
const violation = new IllegalPhaseTransitionError(from, to);
|
|
596
|
+
debugLog("phase-transition-advisory", { from, to, message: violation.message });
|
|
597
|
+
}
|
|
524
598
|
// ── Lifecycle verbs ──────────────────────────────────────────────────────
|
|
525
599
|
/**
|
|
526
600
|
* #442: graduated stuck recovery, ported from the legacy
|
|
@@ -581,6 +655,7 @@ export class AutoOrchestrator {
|
|
|
581
655
|
this.lastFinalizedUnitKey = null;
|
|
582
656
|
this.dispatchKeyWindow = [];
|
|
583
657
|
this.lastStuckRecoveryKey = null;
|
|
658
|
+
this.lastDerivedPhase = null;
|
|
584
659
|
this.status.phase = "running";
|
|
585
660
|
this.bumpTransition();
|
|
586
661
|
this.journalTransition({ name: "start" });
|
|
@@ -666,12 +741,30 @@ export class AutoOrchestrator {
|
|
|
666
741
|
this.postAdvanceRecord(blocked);
|
|
667
742
|
return blocked;
|
|
668
743
|
}
|
|
744
|
+
const reconciledPhase = reconciliation.stateSnapshot.phase;
|
|
745
|
+
if (this.lastDerivedPhase !== null) {
|
|
746
|
+
this.observePhaseTransition(this.lastDerivedPhase, reconciledPhase);
|
|
747
|
+
}
|
|
748
|
+
this.lastDerivedPhase = reconciledPhase;
|
|
669
749
|
const decision = await this.decideNextUnit({ stateSnapshot: reconciliation.stateSnapshot });
|
|
670
750
|
if (!decision) {
|
|
751
|
+
const settlementBlock = this.evaluateNoRemainingUnitsSettlement(reconciliation.stateSnapshot);
|
|
752
|
+
if (settlementBlock) {
|
|
753
|
+
this.status.phase = "paused";
|
|
754
|
+
this.status.activeUnit = undefined;
|
|
755
|
+
this.lastAdvanceKey = null;
|
|
756
|
+
this.dispatchKeyWindow = [];
|
|
757
|
+
this.bumpTransition();
|
|
758
|
+
this.journalTransition({ name: "advance-blocked", reason: settlementBlock.reason });
|
|
759
|
+
this.postAdvanceRecord(settlementBlock);
|
|
760
|
+
return settlementBlock;
|
|
761
|
+
}
|
|
762
|
+
const terminalOutcome = noRemainingUnitsOutcome(reconciliation.stateSnapshot);
|
|
671
763
|
const stopped = {
|
|
672
764
|
kind: "stopped",
|
|
673
|
-
reason:
|
|
765
|
+
reason: terminalOutcome.displayReason,
|
|
674
766
|
stateSnapshot: reconciliation.stateSnapshot,
|
|
767
|
+
terminalOutcome,
|
|
675
768
|
};
|
|
676
769
|
this.status.phase = "stopped";
|
|
677
770
|
this.status.activeUnit = undefined;
|
|
@@ -706,6 +799,24 @@ export class AutoOrchestrator {
|
|
|
706
799
|
this.postAdvanceRecord(blocked);
|
|
707
800
|
return blocked;
|
|
708
801
|
}
|
|
802
|
+
const priorSliceBlocker = this.findPriorSliceCompletionBlocker(decision.unitType, decision.unitId);
|
|
803
|
+
if (priorSliceBlocker) {
|
|
804
|
+
this.clearPendingDispatch();
|
|
805
|
+
const blocked = {
|
|
806
|
+
kind: "blocked",
|
|
807
|
+
reason: priorSliceBlocker,
|
|
808
|
+
action: "stop",
|
|
809
|
+
stateSnapshot: reconciliation.stateSnapshot,
|
|
810
|
+
};
|
|
811
|
+
this.journalTransition({
|
|
812
|
+
name: "advance-blocked",
|
|
813
|
+
reason: blocked.reason,
|
|
814
|
+
unitType: decision.unitType,
|
|
815
|
+
unitId: decision.unitId,
|
|
816
|
+
});
|
|
817
|
+
this.postAdvanceRecord(blocked);
|
|
818
|
+
return blocked;
|
|
819
|
+
}
|
|
709
820
|
const nextKey = `${decision.unitType}:${decision.unitId}`;
|
|
710
821
|
// Record every dispatch decision in the ring buffer before pre-flight
|
|
711
822
|
// checks so the stuck-loop detector observes the full decision history
|
|
@@ -721,8 +832,10 @@ export class AutoOrchestrator {
|
|
|
721
832
|
// actually completed on disk with a stale DB. Verify + recover before
|
|
722
833
|
// hard-stopping (legacy graduated stuck-recovery parity).
|
|
723
834
|
if (this.tryStuckArtifactRecovery(decision.unitType, decision.unitId)) {
|
|
835
|
+
this.clearPendingDispatch();
|
|
724
836
|
return this.stuckRecovered(decision, reconciliation.stateSnapshot);
|
|
725
837
|
}
|
|
838
|
+
this.clearPendingDispatch();
|
|
726
839
|
const blocked = {
|
|
727
840
|
kind: "blocked",
|
|
728
841
|
reason: `state did not advance after finalized ${decision.unitType} ${decision.unitId}`,
|
|
@@ -745,6 +858,7 @@ export class AutoOrchestrator {
|
|
|
745
858
|
// checks coexist: idempotency for the common immediate-repeat case,
|
|
746
859
|
// stuck-loop for the saturated-window case.
|
|
747
860
|
if (this.lastAdvanceKey === nextKey && matchingCount < STUCK_WINDOW_SIZE) {
|
|
861
|
+
this.clearPendingDispatch();
|
|
748
862
|
const blocked = { kind: "blocked", reason: "idempotent advance: unit already active", action: "pause" };
|
|
749
863
|
this.journalTransition({
|
|
750
864
|
name: "advance-blocked",
|
|
@@ -764,8 +878,10 @@ export class AutoOrchestrator {
|
|
|
764
878
|
// complete on disk (stale DB) and recover if so — legacy graduated
|
|
765
879
|
// stuck-recovery parity. Otherwise hard-stop with a diagnosable reason.
|
|
766
880
|
if (this.tryStuckArtifactRecovery(decision.unitType, decision.unitId)) {
|
|
881
|
+
this.clearPendingDispatch();
|
|
767
882
|
return this.stuckRecovered(decision, reconciliation.stateSnapshot);
|
|
768
883
|
}
|
|
884
|
+
this.clearPendingDispatch();
|
|
769
885
|
const blocked = {
|
|
770
886
|
kind: "blocked",
|
|
771
887
|
reason: `stuck-loop: ${nextKey} picked ${matchingCount} times`,
|
|
@@ -782,6 +898,7 @@ export class AutoOrchestrator {
|
|
|
782
898
|
}
|
|
783
899
|
const contract = this.compileUnitToolContract(decision.unitType);
|
|
784
900
|
if (!contract.ok) {
|
|
901
|
+
this.clearPendingDispatch();
|
|
785
902
|
const blocked = {
|
|
786
903
|
kind: "blocked",
|
|
787
904
|
reason: contract.reason,
|
|
@@ -799,6 +916,7 @@ export class AutoOrchestrator {
|
|
|
799
916
|
}
|
|
800
917
|
const worktree = await this.prepareWorktreeForUnit(decision.unitType, decision.unitId);
|
|
801
918
|
if (!worktree.ok) {
|
|
919
|
+
this.clearPendingDispatch();
|
|
802
920
|
const blocked = {
|
|
803
921
|
kind: "blocked",
|
|
804
922
|
reason: worktree.reason,
|
|
@@ -885,8 +1003,12 @@ export class AutoOrchestrator {
|
|
|
885
1003
|
async resume() {
|
|
886
1004
|
this.lastAdvanceKey = null;
|
|
887
1005
|
this.lastFinalizedUnitKey = null;
|
|
888
|
-
|
|
1006
|
+
// Preserve dispatchKeyWindow across resume so stuck-loop detection
|
|
1007
|
+
// accumulates across pause/resume cycles rather than resetting each time.
|
|
889
1008
|
this.lastStuckRecoveryKey = null;
|
|
1009
|
+
// ADR-030: drop the prior "from" — the first advance after resume has no
|
|
1010
|
+
// edge to assert (avoids a false illegal-edge across the pause boundary).
|
|
1011
|
+
this.lastDerivedPhase = null;
|
|
890
1012
|
this.status.phase = "running";
|
|
891
1013
|
this.bumpTransition();
|
|
892
1014
|
this.journalTransition({ name: "resume" });
|
|
@@ -902,7 +1024,12 @@ export class AutoOrchestrator {
|
|
|
902
1024
|
this.status.activeUnit = undefined;
|
|
903
1025
|
this.lastAdvanceKey = null;
|
|
904
1026
|
this.lastFinalizedUnitKey = null;
|
|
905
|
-
this.
|
|
1027
|
+
this.lastDerivedPhase = null;
|
|
1028
|
+
// Preserve dispatchKeyWindow on pause so stuck-loop detection accumulates
|
|
1029
|
+
// across pause/resume cycles. Only clear on a hard stop.
|
|
1030
|
+
if (reason !== "pause") {
|
|
1031
|
+
this.dispatchKeyWindow = [];
|
|
1032
|
+
}
|
|
906
1033
|
this.lastStuckRecoveryKey = null;
|
|
907
1034
|
this.bumpTransition();
|
|
908
1035
|
this.journalTransition({ name: "stop", reason });
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { importExtensionModule } from "@gsd/pi-coding-agent";
|
|
12
12
|
import { USER_DRIVEN_DEEP_UNITS, isAwaitingUserInput, } from "../auto-post-unit.js";
|
|
13
13
|
import { lastAssistantText } from "../user-input-boundary.js";
|
|
14
|
+
import { resolveEffectiveUnitIsolationMode } from "../preferences.js";
|
|
14
15
|
import { MAX_RECOVERY_CHARS, BUDGET_THRESHOLDS, MAX_FINALIZE_TIMEOUTS, } from "./types.js";
|
|
15
16
|
import { detectStuck } from "./detect-stuck.js";
|
|
16
17
|
import { runUnit } from "./run-unit.js";
|
|
@@ -33,7 +34,8 @@ import { writeUnitRuntimeRecord } from "../unit-runtime.js";
|
|
|
33
34
|
import { withTimeout, FINALIZE_PRE_TIMEOUT_MS, FINALIZE_POST_TIMEOUT_MS } from "./finalize-timeout.js";
|
|
34
35
|
import { getEligibleSlices } from "../slice-parallel-eligibility.js";
|
|
35
36
|
import { isSliceParallelActive, startSliceParallel } from "../slice-parallel-orchestrator.js";
|
|
36
|
-
import { isDbAvailable, getMilestoneSlices, getSlice, getTask
|
|
37
|
+
import { isDbAvailable, getMilestoneSlices, getSlice, getTask } from "../gsd-db.js";
|
|
38
|
+
import { refreshWorkflowDatabaseFromDisk } from "../db-workspace.js";
|
|
37
39
|
import { isClosedStatus } from "../status-guards.js";
|
|
38
40
|
import { setRuntimeKv } from "../db/runtime-kv.js";
|
|
39
41
|
import { getLatestForUnit } from "../db/unit-dispatches.js";
|
|
@@ -49,7 +51,7 @@ import { resolveSafetyHarnessConfig } from "../safety/safety-harness.js";
|
|
|
49
51
|
import { getContextPauseAction } from "../auto-budget.js";
|
|
50
52
|
import { getWorkflowTransportSupportError, getRequiredWorkflowToolsForAutoUnit, supportsStructuredQuestions, } from "../workflow-mcp.js";
|
|
51
53
|
import { prepareWorkflowMcpForProject } from "../workflow-mcp-auto-prep.js";
|
|
52
|
-
import {
|
|
54
|
+
import { applyThinkingLevelForModel, floorThinkingLevelForUnit, getRegisteredToolSnapshot, getToolBaselineSnapshot, } from "../auto-model-selection.js";
|
|
53
55
|
import { resolveManifest } from "../unit-context-manifest.js";
|
|
54
56
|
import { createWorktreeSafetyModule } from "../worktree-safety.js";
|
|
55
57
|
import { isSuspiciousGhostCompletion } from "../auto-unit-closeout.js";
|
|
@@ -156,7 +158,7 @@ function rememberRetryDispatch(s, unit, iterData) {
|
|
|
156
158
|
function getAlreadyClosedDispatchReason(unitType, unitId) {
|
|
157
159
|
if (!isDbAvailable())
|
|
158
160
|
return null;
|
|
159
|
-
|
|
161
|
+
refreshWorkflowDatabaseFromDisk();
|
|
160
162
|
const { milestone, slice, task } = parseUnitId(unitId);
|
|
161
163
|
if (unitType === "execute-task" && milestone && slice && task) {
|
|
162
164
|
const row = getTask(milestone, slice, task);
|
|
@@ -264,7 +266,11 @@ async function validateSourceWriteWorktreeSafety(ic, unitType, unitId, milestone
|
|
|
264
266
|
if (!writesSource)
|
|
265
267
|
return null;
|
|
266
268
|
const projectRoot = s.canonicalProjectRoot ?? resolveWorktreeProjectRoot(s.basePath, s.originalBasePath);
|
|
267
|
-
|
|
269
|
+
// A degraded session already fell back to the milestone branch in the
|
|
270
|
+
// project root — validating against the canonical worktree root there
|
|
271
|
+
// would fail every dispatch with a false invalid-root. The same applies
|
|
272
|
+
// to a stranded-recovery session that adopted the milestone branch.
|
|
273
|
+
const isolationMode = resolveEffectiveUnitIsolationMode(deps.getIsolationMode(projectRoot), s.isolationDegraded, s.strandedRecoveryIsolationMode);
|
|
268
274
|
if (isolationMode !== "worktree")
|
|
269
275
|
return null;
|
|
270
276
|
const safety = createWorktreeSafetyModule();
|
|
@@ -447,6 +453,14 @@ export async function _runMilestoneMergeWithStashRestore(ic, milestoneId, option
|
|
|
447
453
|
const exitResult = deps.lifecycle.exitMilestone(milestoneId, { merge: true }, ctx.ui);
|
|
448
454
|
if (exitResult.ok) {
|
|
449
455
|
s.milestoneMergedInPhases = true;
|
|
456
|
+
try {
|
|
457
|
+
const projectRoot = s.originalBasePath || s.canonicalProjectRoot || s.basePath;
|
|
458
|
+
const { rebuildMarkdownProjectionsFromDb } = await import("../commands-maintenance.js");
|
|
459
|
+
await rebuildMarkdownProjectionsFromDb(projectRoot);
|
|
460
|
+
}
|
|
461
|
+
catch (err) {
|
|
462
|
+
logWarning("engine", `markdown projection rebuild after milestone merge failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
463
|
+
}
|
|
450
464
|
}
|
|
451
465
|
else {
|
|
452
466
|
mergeError = exitResult.cause ?? new Error(`exit ${exitResult.reason}`);
|
|
@@ -929,6 +943,19 @@ export async function runPreDispatch(ic, loopState) {
|
|
|
929
943
|
catch (e) {
|
|
930
944
|
logWarning("engine", "STATE.md rebuild failed after milestone transition", { error: String(e) });
|
|
931
945
|
}
|
|
946
|
+
// Re-project ROADMAP/PLAN markdown from the authoritative DB. Worktree DB
|
|
947
|
+
// reconciliation during merge can leave main-branch markdown stale relative
|
|
948
|
+
// to gsd.db (the 3M/3S/10T vs 3M/5S/16T drift class at /gsd startup).
|
|
949
|
+
try {
|
|
950
|
+
const { rebuildMarkdownProjectionsFromDb } = await import("../commands-maintenance.js");
|
|
951
|
+
await rebuildMarkdownProjectionsFromDb(s.canonicalProjectRoot);
|
|
952
|
+
if (s.basePath !== s.canonicalProjectRoot) {
|
|
953
|
+
await rebuildMarkdownProjectionsFromDb(s.basePath);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
catch (e) {
|
|
957
|
+
logWarning("engine", "markdown projection rebuild failed after milestone transition", { error: String(e) });
|
|
958
|
+
}
|
|
932
959
|
}
|
|
933
960
|
if (mid) {
|
|
934
961
|
s.currentMilestoneId = mid;
|
|
@@ -1082,6 +1109,7 @@ export async function runDispatch(ic, preData, loopState) {
|
|
|
1082
1109
|
// Checking a stale-narrowed set causes false transport-preflight warnings
|
|
1083
1110
|
// that repeat on every /gsd auto resume (#477 follow-up).
|
|
1084
1111
|
const activeTools = getToolBaselineSnapshot(pi);
|
|
1112
|
+
const registeredTools = getRegisteredToolSnapshot(pi);
|
|
1085
1113
|
// Deep planning intentionally keeps human checkpoints in plain chat. In
|
|
1086
1114
|
// Claude Code/local MCP transports, structured question requests can be
|
|
1087
1115
|
// cancelled outside the normal chat flow, which made approval gates easy to
|
|
@@ -1105,6 +1133,7 @@ export async function runDispatch(ic, preData, loopState) {
|
|
|
1105
1133
|
sessionProvider: ctx.model?.provider,
|
|
1106
1134
|
modelRegistry: ctx.modelRegistry,
|
|
1107
1135
|
activeTools,
|
|
1136
|
+
registeredTools,
|
|
1108
1137
|
sessionBaseUrl: ctx.model?.baseUrl,
|
|
1109
1138
|
sessionAuthMode: authMode,
|
|
1110
1139
|
});
|
|
@@ -1131,6 +1160,7 @@ export async function runDispatch(ic, preData, loopState) {
|
|
|
1131
1160
|
sessionProvider: ctx.model?.provider,
|
|
1132
1161
|
modelRegistry: ctx.modelRegistry,
|
|
1133
1162
|
activeTools,
|
|
1163
|
+
registeredTools,
|
|
1134
1164
|
sessionBaseUrl: ctx.model?.baseUrl,
|
|
1135
1165
|
sessionAuthMode: authMode,
|
|
1136
1166
|
});
|
|
@@ -95,7 +95,8 @@ export async function runUnit(ctx, pi, s, unitType, unitId, prompt) {
|
|
|
95
95
|
unitId,
|
|
96
96
|
error: msg,
|
|
97
97
|
});
|
|
98
|
-
|
|
98
|
+
const isStructural = sessionErr instanceof TypeError || /is not a function/i.test(msg);
|
|
99
|
+
return { status: "cancelled", errorContext: { message: `Session creation failed: ${msg}`, category: "session-failed", isTransient: !isStructural } };
|
|
99
100
|
}
|
|
100
101
|
if (sessionTimeoutHandle)
|
|
101
102
|
clearTimeout(sessionTimeoutHandle);
|
|
@@ -143,6 +143,8 @@ export class AutoSession {
|
|
|
143
143
|
/** Set to true after phases.ts successfully calls mergeAndExit, so that
|
|
144
144
|
* stopAuto does not attempt the same merge a second time (#2645). */
|
|
145
145
|
milestoneMergedInPhases = false;
|
|
146
|
+
/** Last milestone settlement result observed by Auto Orchestration. */
|
|
147
|
+
milestoneSettlement = null;
|
|
146
148
|
// #4765 — slice-cadence collapse: main-branch SHAs at the moment each
|
|
147
149
|
// milestone's first slice merge began. Used by resquashMilestoneOnMain at
|
|
148
150
|
// milestone completion to collapse N slice commits into one. Cleared when
|
|
@@ -311,6 +313,7 @@ export class AutoSession {
|
|
|
311
313
|
this.strandedRecoveryIsolationMode = null;
|
|
312
314
|
this.rootWriteBaseline = null;
|
|
313
315
|
this.milestoneMergedInPhases = false;
|
|
316
|
+
this.milestoneSettlement = null;
|
|
314
317
|
this.milestoneStartShas = new Map();
|
|
315
318
|
this.checkpointSha = null;
|
|
316
319
|
// Signal handler
|
|
@@ -16,6 +16,7 @@ import { parseUnitId } from "./unit-id.js";
|
|
|
16
16
|
import { logWarning } from "./workflow-logger.js";
|
|
17
17
|
import { formattedShortcutPair } from "./shortcut-defs.js";
|
|
18
18
|
import { readUnitRuntimeRecord } from "./unit-runtime.js";
|
|
19
|
+
import { describeMilestoneReadinessPhase } from "./milestone-readiness.js";
|
|
19
20
|
const ACTIVE_SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
20
21
|
// ─── UAT Slice Extraction ─────────────────────────────────────────────────────
|
|
21
22
|
/**
|
|
@@ -84,6 +85,18 @@ export function unitPhaseLabel(unitType) {
|
|
|
84
85
|
default: return unitType.toUpperCase();
|
|
85
86
|
}
|
|
86
87
|
}
|
|
88
|
+
export function formatToolSurfaceSnapshot(snapshot) {
|
|
89
|
+
if (!snapshot)
|
|
90
|
+
return null;
|
|
91
|
+
const counts = [
|
|
92
|
+
`model ${snapshot.modelFacingToolNames.length}`,
|
|
93
|
+
`registered ${snapshot.registeredToolNames.length}`,
|
|
94
|
+
`scoped ${snapshot.scopedToolNames.length}`,
|
|
95
|
+
`presented ${snapshot.presentedToolNames.length}`,
|
|
96
|
+
];
|
|
97
|
+
const label = snapshot.unitType ?? snapshot.phase ?? snapshot.source;
|
|
98
|
+
return `${label}: ${counts.join(" / ")}`;
|
|
99
|
+
}
|
|
87
100
|
function peekNext(unitType, state) {
|
|
88
101
|
// Show active hook info in progress display
|
|
89
102
|
const activeHookState = getActiveHook();
|
|
@@ -118,11 +131,10 @@ export function describeNextUnit(state) {
|
|
|
118
131
|
const sTitle = state.activeSlice?.title;
|
|
119
132
|
const tid = state.activeTask?.id;
|
|
120
133
|
const tTitle = state.activeTask?.title;
|
|
134
|
+
const readinessDescription = describeMilestoneReadinessPhase(state.phase);
|
|
135
|
+
if (readinessDescription)
|
|
136
|
+
return readinessDescription;
|
|
121
137
|
switch (state.phase) {
|
|
122
|
-
case "needs-discussion":
|
|
123
|
-
return { label: "Discuss milestone draft", description: "Milestone has a draft context — needs discussion before planning." };
|
|
124
|
-
case "pre-planning":
|
|
125
|
-
return { label: "Research & plan milestone", description: "Scout the landscape and create the roadmap." };
|
|
126
138
|
case "planning":
|
|
127
139
|
return { label: `Plan ${sid}: ${sTitle}`, description: "Research and decompose into tasks." };
|
|
128
140
|
case "executing":
|
|
@@ -37,7 +37,7 @@ import { probeGitConflictState } from "./git-conflict-state.js";
|
|
|
37
37
|
import { runTurnGitAction } from "./git-service.js";
|
|
38
38
|
import { parseUnitId } from "./unit-id.js";
|
|
39
39
|
import { resolveExpectedArtifactPath } from "./auto-artifact-paths.js";
|
|
40
|
-
import {
|
|
40
|
+
import { formatCloseoutProofBlock, proveMilestoneCloseout, } from "./milestone-closeout-proof.js";
|
|
41
41
|
function resolveExistingExpectedArtifact(unitType, unitId, basePath) {
|
|
42
42
|
const artifactPath = resolveExpectedArtifactPath(unitType, unitId, basePath);
|
|
43
43
|
return artifactPath && existsSync(artifactPath) ? artifactPath : null;
|
|
@@ -518,7 +518,7 @@ export const DISPATCH_RULES = [
|
|
|
518
518
|
},
|
|
519
519
|
{
|
|
520
520
|
name: "run-uat (post-completion)",
|
|
521
|
-
match: async ({ state, mid, basePath, prefs, sessionProvider, sessionAuthMode, activeTools, sessionBaseUrl }) => {
|
|
521
|
+
match: async ({ state, mid, basePath, prefs, sessionProvider, sessionAuthMode, activeTools, registeredTools, sessionBaseUrl, }) => {
|
|
522
522
|
const needsRunUat = await checkNeedsRunUat(basePath, mid, state, prefs);
|
|
523
523
|
if (!needsRunUat)
|
|
524
524
|
return null;
|
|
@@ -533,6 +533,7 @@ export const DISPATCH_RULES = [
|
|
|
533
533
|
const browserToolError = getUatBrowserToolSupportError({
|
|
534
534
|
uatType,
|
|
535
535
|
activeTools,
|
|
536
|
+
registeredTools,
|
|
536
537
|
milestoneId: mid,
|
|
537
538
|
sliceId,
|
|
538
539
|
});
|
|
@@ -1425,11 +1426,11 @@ export const DISPATCH_RULES = [
|
|
|
1425
1426
|
};
|
|
1426
1427
|
}
|
|
1427
1428
|
if (milestone) {
|
|
1428
|
-
const
|
|
1429
|
-
if (!
|
|
1429
|
+
const closeoutProof = proveMilestoneCloseout(mid, { refreshFromDisk: true });
|
|
1430
|
+
if (!closeoutProof.ok) {
|
|
1430
1431
|
return {
|
|
1431
1432
|
action: "stop",
|
|
1432
|
-
reason:
|
|
1433
|
+
reason: formatCloseoutProofBlock(closeoutProof),
|
|
1433
1434
|
level: "warning",
|
|
1434
1435
|
};
|
|
1435
1436
|
}
|
|
@@ -90,6 +90,14 @@ export function getToolBaselineSnapshot(pi) {
|
|
|
90
90
|
return live;
|
|
91
91
|
return [...new Set([...baseline, ...live])];
|
|
92
92
|
}
|
|
93
|
+
export function getRegisteredToolSnapshot(pi) {
|
|
94
|
+
if (typeof pi.getAllTools !== "function")
|
|
95
|
+
return getToolBaselineSnapshot(pi);
|
|
96
|
+
const names = pi.getAllTools()
|
|
97
|
+
.map((tool) => tool.name)
|
|
98
|
+
.filter((name) => typeof name === "string" && name.length > 0);
|
|
99
|
+
return [...new Set(names)];
|
|
100
|
+
}
|
|
93
101
|
/**
|
|
94
102
|
* Models eligible for the pre-dispatch policy gate. Prefer registry-available
|
|
95
103
|
* models; when that list is empty (common after worktree resume before registry
|
|
@@ -28,7 +28,8 @@ import { regenerateIfMissing } from "./workflow-projections.js";
|
|
|
28
28
|
import { WorktreeStateProjection } from "./worktree-state-projection.js";
|
|
29
29
|
import { createWorkspace, scopeMilestone } from "./workspace.js";
|
|
30
30
|
import { normalizeWorktreePathForCompare } from "./worktree-root.js";
|
|
31
|
-
import { isDbAvailable,
|
|
31
|
+
import { isDbAvailable, getTask, getSlice, getMilestone, getMilestoneSlices, updateTaskStatus, _getAdapter, getVerificationEvidence } from "./gsd-db.js";
|
|
32
|
+
import { getWorkflowDatabasePath, refreshWorkflowDatabaseFromDisk } from "./db-workspace.js";
|
|
32
33
|
import { renderPlanCheckboxes, renderRoadmapFromDb } from "./markdown-renderer.js";
|
|
33
34
|
import { parseRoadmap as parseLegacyRoadmap } from "./parsers-legacy.js";
|
|
34
35
|
import { consumeSignal } from "./session-status-io.js";
|
|
@@ -38,7 +39,7 @@ import { debugLog } from "./debug-logger.js";
|
|
|
38
39
|
import { runSafely } from "./auto-utils.js";
|
|
39
40
|
import { isMilestoneCloseoutSettled, runMilestoneCloseoutGitHub, } from "./milestone-closeout.js";
|
|
40
41
|
import { getEvidence, clearEvidenceFromDisk, isExecutionToolName } from "./safety/evidence-collector.js";
|
|
41
|
-
import { validateFileChanges } from "./safety/file-change-validator.js";
|
|
42
|
+
import { validateFileChanges, effectiveFileChangeAllowlist } from "./safety/file-change-validator.js";
|
|
42
43
|
import { crossReferenceEvidence } from "./safety/evidence-cross-ref.js";
|
|
43
44
|
import { validateContent } from "./safety/content-validator.js";
|
|
44
45
|
import { resolveSafetyHarnessConfig } from "./safety/safety-harness.js";
|
|
@@ -506,9 +507,10 @@ export function _hasExecutionToolCallsInSessionForTest(entries) {
|
|
|
506
507
|
if (e?.type === "toolCall" && isExecutionToolName(e?.name ?? e?.toolName)) {
|
|
507
508
|
return true;
|
|
508
509
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
510
|
+
// Accept both session-manager entries ({type: "message", message}) and
|
|
511
|
+
// bare agent-end messages ({role, content}) — the auto loop passes the
|
|
512
|
+
// latter via opts.agentEndMessages.
|
|
513
|
+
const msg = e?.type === "message" ? e?.message : e;
|
|
512
514
|
if (!msg || msg.role !== "assistant" || !Array.isArray(msg.content))
|
|
513
515
|
continue;
|
|
514
516
|
for (const block of msg.content) {
|
|
@@ -1052,9 +1054,9 @@ export async function postUnitPreVerification(pctx, opts) {
|
|
|
1052
1054
|
if (!opts?.skipSettleDelay) {
|
|
1053
1055
|
await new Promise(r => setTimeout(r, 100));
|
|
1054
1056
|
}
|
|
1055
|
-
const dbPath =
|
|
1057
|
+
const dbPath = getWorkflowDatabasePath();
|
|
1056
1058
|
if (isDbAvailable() && dbPath && dbPath !== ":memory:") {
|
|
1057
|
-
const refreshed =
|
|
1059
|
+
const refreshed = refreshWorkflowDatabaseFromDisk();
|
|
1058
1060
|
if (!refreshed) {
|
|
1059
1061
|
logWarning("db", "post-unit database refresh failed; derived state may be stale");
|
|
1060
1062
|
}
|
|
@@ -1288,6 +1290,7 @@ export async function postUnitPreVerification(pctx, opts) {
|
|
|
1288
1290
|
const safetyConfig = resolveSafetyHarnessConfig(prefs?.safety_harness);
|
|
1289
1291
|
if (safetyConfig.enabled) {
|
|
1290
1292
|
const { milestone: sMid, slice: sSid, task: sTid } = parseUnitId(s.currentUnit.id);
|
|
1293
|
+
const fileChangeAllowlist = effectiveFileChangeAllowlist(safetyConfig.file_change_allowlist, prefs?.git?.manage_gitignore);
|
|
1291
1294
|
// File change validation (execute-task only, after unit execution)
|
|
1292
1295
|
if (safetyConfig.file_change_validation && s.currentUnit.type === "execute-task" && sMid && sSid && sTid) {
|
|
1293
1296
|
try {
|
|
@@ -1302,7 +1305,7 @@ export async function postUnitPreVerification(pctx, opts) {
|
|
|
1302
1305
|
const plannedFiles = getPlannedKeyFiles(sliceTaskRows.map((taskRow) => ({
|
|
1303
1306
|
files: taskRow.files,
|
|
1304
1307
|
})));
|
|
1305
|
-
const audit = validateFileChanges(s.basePath, expectedOutput, plannedFiles,
|
|
1308
|
+
const audit = validateFileChanges(s.basePath, expectedOutput, plannedFiles, fileChangeAllowlist);
|
|
1306
1309
|
if (audit && audit.violations.length > 0) {
|
|
1307
1310
|
const warnings = audit.violations.filter(v => v.severity === "warning");
|
|
1308
1311
|
for (const v of warnings) {
|
|
@@ -1318,7 +1321,7 @@ export async function postUnitPreVerification(pctx, opts) {
|
|
|
1318
1321
|
if (taskRow) {
|
|
1319
1322
|
const expectedOutput = taskRow.expected_output ?? [];
|
|
1320
1323
|
const plannedFiles = taskRow.files ?? [];
|
|
1321
|
-
const audit = validateFileChanges(s.basePath, expectedOutput, plannedFiles,
|
|
1324
|
+
const audit = validateFileChanges(s.basePath, expectedOutput, plannedFiles, fileChangeAllowlist);
|
|
1322
1325
|
if (audit && audit.violations.length > 0) {
|
|
1323
1326
|
const warnings = audit.violations.filter(v => v.severity === "warning");
|
|
1324
1327
|
for (const v of warnings) {
|