gsd-pi 2.82.0-dev.ed17d078d → 3.0.0-dev.1b44e695b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -18
- package/dist/cli.js +20 -9
- package/dist/headless-ui.js +13 -6
- package/dist/headless.js +9 -2
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +10 -1
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +44 -6
- package/dist/resources/extensions/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +1 -1
- package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
- package/dist/resources/extensions/gsd/auto/loop.js +122 -40
- package/dist/resources/extensions/gsd/auto/orchestrator.js +15 -4
- package/dist/resources/extensions/gsd/auto/phases.js +134 -49
- package/dist/resources/extensions/gsd/auto/session.js +6 -0
- package/dist/resources/extensions/gsd/auto/unit-runner-events.js +7 -1
- package/dist/resources/extensions/gsd/auto/workflow-kernel.js +3 -0
- package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
- package/dist/resources/extensions/gsd/auto-budget.js +9 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +66 -1
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +1 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +144 -30
- package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +329 -137
- package/dist/resources/extensions/gsd/auto-prompts.js +36 -10
- package/dist/resources/extensions/gsd/auto-recovery.js +82 -16
- package/dist/resources/extensions/gsd/auto-start.js +99 -16
- package/dist/resources/extensions/gsd/auto-timers.js +11 -3
- package/dist/resources/extensions/gsd/auto-verification.js +146 -34
- package/dist/resources/extensions/gsd/auto-worktree.js +185 -26
- package/dist/resources/extensions/gsd/auto.js +135 -74
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +65 -10
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +13 -10
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +14 -4
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +24 -9
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +10 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +38 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +20 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +2 -0
- package/dist/resources/extensions/gsd/commands-mcp-status.js +9 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +10 -2
- package/dist/resources/extensions/gsd/commands-verdict.js +139 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +55 -7
- package/dist/resources/extensions/gsd/db/auto-workers.js +30 -0
- package/dist/resources/extensions/gsd/db/milestone-leases.js +24 -0
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
- package/dist/resources/extensions/gsd/db-base-schema.js +2 -0
- package/dist/resources/extensions/gsd/db-migration-steps.js +4 -0
- package/dist/resources/extensions/gsd/db-task-slice-rows.js +2 -0
- package/dist/resources/extensions/gsd/dispatch-guard.js +46 -2
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/dist/resources/extensions/gsd/doctor-git-checks.js +46 -1
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +28 -11
- package/dist/resources/extensions/gsd/doctor.js +2 -28
- package/dist/resources/extensions/gsd/export-html.js +27 -425
- package/dist/resources/extensions/gsd/forensics.js +10 -3
- package/dist/resources/extensions/gsd/git-service.js +152 -15
- package/dist/resources/extensions/gsd/gsd-db.js +76 -33
- package/dist/resources/extensions/gsd/guided-flow-queue.js +4 -3
- package/dist/resources/extensions/gsd/guided-flow.js +110 -117
- package/dist/resources/extensions/gsd/guided-unit-context.js +23 -0
- package/dist/resources/extensions/gsd/init-wizard.js +17 -2
- package/dist/resources/extensions/gsd/markdown-renderer.js +14 -11
- package/dist/resources/extensions/gsd/mcp-filter.js +58 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +121 -2
- package/dist/resources/extensions/gsd/migration-auto-check.js +12 -17
- package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
- package/dist/resources/extensions/gsd/native-git-bridge.js +57 -14
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +3 -0
- package/dist/resources/extensions/gsd/paths.js +4 -0
- package/dist/resources/extensions/gsd/pending-auto-start.js +52 -0
- package/dist/resources/extensions/gsd/planning-path-scope.js +9 -3
- package/dist/resources/extensions/gsd/post-execution-checks.js +73 -9
- package/dist/resources/extensions/gsd/pre-execution-checks.js +54 -19
- package/dist/resources/extensions/gsd/preferences-mcp.js +19 -0
- package/dist/resources/extensions/gsd/preferences-types.js +3 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +147 -0
- package/dist/resources/extensions/gsd/preferences.js +6 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/dist/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/dist/resources/extensions/gsd/prompts/forensics.md +3 -3
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/dist/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/dist/resources/extensions/gsd/prompts/queue.md +4 -4
- package/dist/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/queue-reorder-ui.js +30 -13
- package/dist/resources/extensions/gsd/repo-identity.js +39 -22
- package/dist/resources/extensions/gsd/repository-registry.js +44 -0
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +2 -0
- package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +42 -18
- package/dist/resources/extensions/gsd/session-lock.js +15 -2
- package/dist/resources/extensions/gsd/slice-parallel-conflict.js +2 -2
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +84 -5
- package/dist/resources/extensions/gsd/smart-entry-routing.js +36 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +9 -14
- package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +19 -24
- package/dist/resources/extensions/gsd/state.js +28 -7
- package/dist/resources/extensions/gsd/status-guards.js +14 -2
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/dist/resources/extensions/gsd/templates/plan.md +9 -5
- package/dist/resources/extensions/gsd/templates/task-plan.md +10 -2
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +15 -9
- package/dist/resources/extensions/gsd/tools/complete-slice.js +56 -10
- package/dist/resources/extensions/gsd/tools/exec-tool.js +87 -5
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +151 -15
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +32 -1
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +185 -40
- package/dist/resources/extensions/gsd/unit-context-composer.js +2 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +69 -17
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +142 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/workflow-manifest.js +2 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +17 -1
- package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +86 -19
- package/dist/resources/extensions/gsd/worktree-manager.js +11 -2
- package/dist/resources/extensions/gsd/worktree-safety.js +43 -4
- package/dist/resources/extensions/gsd/worktree-state-projection.js +31 -0
- package/dist/resources/extensions/gsd/worktree-telemetry.js +32 -0
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- package/dist/resources/extensions/shared/interview-ui.js +6 -4
- package/dist/resources/extensions/shared/next-action-ui.js +13 -5
- package/dist/resources/extensions/subagent/index.js +448 -78
- package/dist/resources/extensions/subagent/launch.js +77 -0
- package/dist/resources/extensions/subagent/run-store.js +148 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.js +3 -1
- package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
- package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/dist/resources/extensions/visual-brief/index.js +5 -0
- package/dist/resources/extensions/visual-brief/page-contract.js +124 -0
- package/dist/resources/extensions/visual-brief/prompts.js +140 -0
- package/dist/resources/skills/forensics/SKILL.md +1 -1
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -7
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +5 -5
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +4 -5
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -7
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -7
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +4 -5
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -7
- package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/2973.33f26573894b6153.js +2 -0
- package/dist/web/standalone/.next/static/chunks/8359.65b24fac92188a6b.js +10 -0
- package/dist/web/standalone/.next/static/chunks/9441.ff70bb53f6835771.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-855d616060cb6e59.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/dist/web/standalone/server.js +1 -1
- package/package.json +4 -4
- package/packages/contracts/dist/rpc.test.js +7 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +21 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +24 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/src/rpc.test.ts +8 -0
- package/packages/contracts/src/workflow.ts +24 -0
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/README.md +13 -4
- package/packages/mcp-server/dist/workflow-tools.d.ts +0 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +80 -0
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/workflow-tools.test.ts +23 -1
- package/packages/mcp-server/src/workflow-tools.ts +168 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/native/tsconfig.json +2 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +5 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.js +41 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +82 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js +52 -0
- package/packages/pi-ai/dist/providers/openai-codex-responses.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +2 -4
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +5 -6
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/simple-options.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js +50 -0
- package/packages/pi-ai/dist/providers/simple-options.test.js.map +1 -0
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.test.ts +49 -0
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +7 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.test.ts +63 -0
- package/packages/pi-ai/src/providers/openai-codex-responses.ts +91 -1
- package/packages/pi-ai/src/providers/simple-options.test.ts +60 -0
- package/packages/pi-ai/src/providers/simple-options.ts +5 -6
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js +66 -0
- package/packages/pi-coding-agent/dist/core/agent-session-thinking-level.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +44 -3
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +6 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +7 -2
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js +14 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +8 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +24 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +82 -97
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +7 -7
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js +25 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +24 -10
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-thinking-level.test.ts +79 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +53 -3
- package/packages/pi-coding-agent/src/core/compaction/compaction.test.ts +23 -1
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +7 -2
- package/packages/pi-coding-agent/src/core/sdk.ts +1 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +17 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +23 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +91 -102
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +15 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +9 -9
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +30 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +29 -10
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/terminal.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.js +103 -0
- package/packages/pi-tui/dist/__tests__/terminal.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +45 -2
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/terminal.d.ts +2 -0
- package/packages/pi-tui/dist/terminal.d.ts.map +1 -1
- package/packages/pi-tui/dist/terminal.js +12 -0
- package/packages/pi-tui/dist/terminal.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +106 -27
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/terminal.test.ts +121 -0
- package/packages/pi-tui/src/__tests__/tui.test.ts +59 -2
- package/packages/pi-tui/src/terminal.ts +11 -0
- package/packages/pi-tui/src/tui.ts +108 -27
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +10 -1
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +52 -6
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +49 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +19 -6
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +1 -0
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +123 -40
- package/src/resources/extensions/gsd/auto/orchestrator.ts +15 -4
- package/src/resources/extensions/gsd/auto/phases.ts +160 -60
- package/src/resources/extensions/gsd/auto/session.ts +16 -0
- package/src/resources/extensions/gsd/auto/types.ts +3 -0
- package/src/resources/extensions/gsd/auto/unit-runner-events.ts +6 -2
- package/src/resources/extensions/gsd/auto/workflow-kernel.ts +5 -1
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
- package/src/resources/extensions/gsd/auto-budget.ts +11 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +72 -1
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +1 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +164 -29
- package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +369 -148
- package/src/resources/extensions/gsd/auto-prompts.ts +36 -13
- package/src/resources/extensions/gsd/auto-recovery.ts +86 -13
- package/src/resources/extensions/gsd/auto-start.ts +109 -14
- package/src/resources/extensions/gsd/auto-timers.ts +10 -3
- package/src/resources/extensions/gsd/auto-verification.ts +174 -42
- package/src/resources/extensions/gsd/auto-worktree.ts +202 -30
- package/src/resources/extensions/gsd/auto.ts +172 -81
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +66 -10
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +13 -10
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +13 -4
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +27 -10
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +10 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +41 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +21 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +2 -0
- package/src/resources/extensions/gsd/commands-mcp-status.ts +8 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +11 -3
- package/src/resources/extensions/gsd/commands-verdict.ts +202 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +55 -6
- package/src/resources/extensions/gsd/db/auto-workers.ts +37 -0
- package/src/resources/extensions/gsd/db/milestone-leases.ts +26 -0
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
- package/src/resources/extensions/gsd/db-base-schema.ts +2 -0
- package/src/resources/extensions/gsd/db-migration-steps.ts +5 -0
- package/src/resources/extensions/gsd/db-task-slice-rows.ts +4 -0
- package/src/resources/extensions/gsd/dispatch-guard.ts +60 -2
- package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/src/resources/extensions/gsd/doctor-git-checks.ts +45 -1
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor-types.ts +1 -0
- package/src/resources/extensions/gsd/doctor.ts +2 -27
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/forensics.ts +9 -3
- package/src/resources/extensions/gsd/git-service.ts +182 -16
- package/src/resources/extensions/gsd/gsd-db.ts +80 -31
- package/src/resources/extensions/gsd/guided-flow-queue.ts +4 -3
- package/src/resources/extensions/gsd/guided-flow.ts +142 -134
- package/src/resources/extensions/gsd/guided-unit-context.ts +30 -0
- package/src/resources/extensions/gsd/init-wizard.ts +17 -2
- package/src/resources/extensions/gsd/journal.ts +8 -1
- package/src/resources/extensions/gsd/markdown-renderer.ts +14 -11
- package/src/resources/extensions/gsd/mcp-filter.ts +80 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +139 -2
- package/src/resources/extensions/gsd/migration-auto-check.ts +15 -23
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
- package/src/resources/extensions/gsd/native-git-bridge.ts +63 -14
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +3 -0
- package/src/resources/extensions/gsd/paths.ts +5 -0
- package/src/resources/extensions/gsd/pending-auto-start.ts +79 -0
- package/src/resources/extensions/gsd/planning-path-scope.ts +10 -2
- package/src/resources/extensions/gsd/post-execution-checks.ts +87 -12
- package/src/resources/extensions/gsd/pre-execution-checks.ts +67 -19
- package/src/resources/extensions/gsd/preferences-mcp.ts +27 -0
- package/src/resources/extensions/gsd/preferences-types.ts +35 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +154 -0
- package/src/resources/extensions/gsd/preferences.ts +9 -0
- package/src/resources/extensions/gsd/prompt-loader.ts +1 -1
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -8
- package/src/resources/extensions/gsd/prompts/discuss.md +9 -9
- package/src/resources/extensions/gsd/prompts/forensics.md +3 -3
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +4 -4
- package/src/resources/extensions/gsd/prompts/guided-discuss-requirements.md +3 -3
- package/src/resources/extensions/gsd/prompts/plan-slice.md +4 -4
- package/src/resources/extensions/gsd/prompts/queue.md +4 -4
- package/src/resources/extensions/gsd/prompts/reactive-execute.md +1 -1
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/queue-reorder-ui.ts +31 -13
- package/src/resources/extensions/gsd/repo-identity.ts +45 -25
- package/src/resources/extensions/gsd/repository-registry.ts +77 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +2 -0
- package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +54 -19
- package/src/resources/extensions/gsd/session-lock.ts +15 -2
- package/src/resources/extensions/gsd/slice-parallel-conflict.ts +2 -2
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +75 -3
- package/src/resources/extensions/gsd/smart-entry-routing.ts +77 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +12 -15
- package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +17 -25
- package/src/resources/extensions/gsd/state.ts +33 -7
- package/src/resources/extensions/gsd/status-guards.ts +16 -2
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/src/resources/extensions/gsd/templates/plan.md +9 -5
- package/src/resources/extensions/gsd/templates/task-plan.md +10 -2
- package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +10 -1
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +775 -34
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +245 -28
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +151 -12
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +53 -2
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +18 -6
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +136 -13
- package/src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-stop-notification.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/auto-workers.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +32 -4
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +378 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +55 -2
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +60 -9
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +104 -2
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/db-task-slice-rows.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +61 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +111 -1
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +140 -1
- package/src/resources/extensions/gsd/tests/doctor-empty-worktree.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/doctor-forensics-db-open-regression.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +97 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +99 -1
- package/src/resources/extensions/gsd/tests/execution-entry-missing-context-4671.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/gsdroot-worktree-detection.test.ts +5 -2
- package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/guided-flow-session-isolation.test.ts +59 -11
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/guided-tool-contract.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +7 -7
- package/src/resources/extensions/gsd/tests/hook-model-resolution.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/infra-error.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +226 -2
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +5 -21
- package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/interrupted-session-auto.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +49 -3
- package/src/resources/extensions/gsd/tests/journal.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/mcp-filter.test.ts +287 -0
- package/src/resources/extensions/gsd/tests/mcp-status.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/merge-self-branch-guard.test.ts +21 -40
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +59 -1
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +26 -18
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +80 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/parallel-orchestrator-zombie-cleanup.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
- package/src/resources/extensions/gsd/tests/pending-autostart-scope.test.ts +29 -5
- package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +343 -3
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +18 -1
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -3
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +84 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/preferences-mcp.test.ts +128 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +42 -1
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +37 -1
- package/src/resources/extensions/gsd/tests/quality-gates.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/queue-reorder-ui.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +89 -2
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +28 -1
- package/src/resources/extensions/gsd/tests/repository-registry.test.ts +52 -0
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +2 -3
- package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +59 -1
- package/src/resources/extensions/gsd/tests/slice-parallel-conflict.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +112 -1
- package/src/resources/extensions/gsd/tests/smart-entry-routing.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +94 -2
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +119 -23
- package/src/resources/extensions/gsd/tests/status-guards.test.ts +17 -1
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +131 -9
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +111 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +29 -2
- package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +42 -1
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +188 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-kernel.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +19 -1
- package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +153 -1
- package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +73 -2
- package/src/resources/extensions/gsd/tests/worktree-preferences-sync.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/worktree-safety.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +59 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +18 -10
- package/src/resources/extensions/gsd/tools/complete-slice.ts +57 -10
- package/src/resources/extensions/gsd/tools/exec-tool.ts +98 -5
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
- package/src/resources/extensions/gsd/tools/plan-slice.ts +172 -12
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +31 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +166 -17
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-composer.ts +3 -0
- package/src/resources/extensions/gsd/unit-context-manifest.ts +86 -19
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +170 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-manifest.ts +2 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +18 -1
- package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +98 -20
- package/src/resources/extensions/gsd/worktree-manager.ts +14 -2
- package/src/resources/extensions/gsd/worktree-safety.ts +57 -10
- package/src/resources/extensions/gsd/worktree-state-projection.ts +43 -0
- package/src/resources/extensions/gsd/worktree-telemetry.ts +39 -0
- package/src/resources/extensions/shared/html-shell.ts +412 -0
- package/src/resources/extensions/shared/interview-ui.ts +6 -4
- package/src/resources/extensions/shared/next-action-ui.ts +11 -5
- package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +15 -0
- package/src/resources/extensions/shared/tests/next-action-ui-hasui.test.ts +32 -0
- package/src/resources/extensions/subagent/index.ts +567 -103
- package/src/resources/extensions/subagent/launch.ts +131 -0
- package/src/resources/extensions/subagent/run-store.ts +218 -0
- package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
- package/src/resources/extensions/ttsr/ttsr-manager.ts +5 -1
- package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
- package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/src/resources/extensions/visual-brief/index.ts +8 -0
- package/src/resources/extensions/visual-brief/page-contract.ts +136 -0
- package/src/resources/extensions/visual-brief/prompts.ts +183 -0
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +212 -0
- package/src/resources/skills/forensics/SKILL.md +1 -1
- package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/8359.e059d86b255fce1c.js +0 -10
- package/dist/web/standalone/.next/static/chunks/9441.1081da1125d1764f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
- package/dist/web/standalone/.next/static/css/54ec2745c1da488b.css +0 -1
- package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
- package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- /package/dist/web/standalone/.next/static/{YEvjuT-fsFfYQhDSWtueS → Z8H5evS-hDo0qdP22XJPA}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{YEvjuT-fsFfYQhDSWtueS → Z8H5evS-hDo0qdP22XJPA}/_ssgManifest.js +0 -0
|
@@ -56,7 +56,7 @@ import { verifyExpectedArtifact, diagnoseExpectedArtifact, buildLoopRemediationS
|
|
|
56
56
|
import { writeUnitRuntimeRecord } from "../unit-runtime.js";
|
|
57
57
|
import { withTimeout, FINALIZE_PRE_TIMEOUT_MS, FINALIZE_POST_TIMEOUT_MS } from "./finalize-timeout.js";
|
|
58
58
|
import { getEligibleSlices } from "../slice-parallel-eligibility.js";
|
|
59
|
-
import { startSliceParallel } from "../slice-parallel-orchestrator.js";
|
|
59
|
+
import { isSliceParallelActive, startSliceParallel } from "../slice-parallel-orchestrator.js";
|
|
60
60
|
import { isDbAvailable, getMilestoneSlices } from "../gsd-db.js";
|
|
61
61
|
import { reconcileBeforeSpawn } from "../state-reconciliation.js";
|
|
62
62
|
import type { MinimalModelRegistry } from "../context-budget.js";
|
|
@@ -77,6 +77,10 @@ import { resolveManifest } from "../unit-context-manifest.js";
|
|
|
77
77
|
import { createWorktreeSafetyModule, type WorktreeSafetyResult } from "../worktree-safety.js";
|
|
78
78
|
import { isSuspiciousGhostCompletion } from "../auto-unit-closeout.js";
|
|
79
79
|
import { decideVerificationRetry, verificationRetryKey } from "./verification-retry-policy.js";
|
|
80
|
+
import { buildPhaseHandoffOutcome, setAutoOutcomeWidget } from "../auto-dashboard.js";
|
|
81
|
+
import { getConsecutiveDispatchBlocker } from "../dispatch-guard.js";
|
|
82
|
+
|
|
83
|
+
export const STUCK_WINDOW_SIZE = 6;
|
|
80
84
|
|
|
81
85
|
// ─── Path Comparison Helper ───────────────────────────────────────────────
|
|
82
86
|
/** Compare two paths for physical identity, tolerating trailing slashes and symlinks. */
|
|
@@ -146,7 +150,12 @@ export function shouldDegradeEmptyWorktreeToProjectRoot(
|
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
function unitWritesSource(unitType: string): boolean | null {
|
|
149
|
-
|
|
153
|
+
// Backward compatibility: sidecar queues from older builds may persist
|
|
154
|
+
// prefixed unit types (e.g. "sidecar/quick-task").
|
|
155
|
+
const normalizedUnitType = unitType.startsWith("sidecar/")
|
|
156
|
+
? unitType.slice("sidecar/".length)
|
|
157
|
+
: unitType;
|
|
158
|
+
const manifest = resolveManifest(normalizedUnitType);
|
|
150
159
|
if (!manifest) return null;
|
|
151
160
|
return manifest.tools.mode === "all" || manifest.tools.mode === "docs";
|
|
152
161
|
}
|
|
@@ -155,6 +164,13 @@ function formatWorktreeSafetyFailure(result: Extract<WorktreeSafetyResult, { ok:
|
|
|
155
164
|
return `Worktree Safety failed (${result.kind}): ${result.reason} ${result.remediation}`;
|
|
156
165
|
}
|
|
157
166
|
|
|
167
|
+
function formatWorktreeSafetyStopReason(result: Extract<WorktreeSafetyResult, { ok: false }>): string {
|
|
168
|
+
if (result.kind === "empty-worktree-with-project-content") {
|
|
169
|
+
return `Worktree Safety failed (${result.kind}). Run /gsd doctor fix, then /gsd auto.`;
|
|
170
|
+
}
|
|
171
|
+
return `Worktree Safety failed (${result.kind}).`;
|
|
172
|
+
}
|
|
173
|
+
|
|
158
174
|
function resolveEmptyWorktreeWithProjectContent(
|
|
159
175
|
unitRoot: string,
|
|
160
176
|
projectRoot: string,
|
|
@@ -203,7 +219,8 @@ async function validateSourceWriteWorktreeSafety(
|
|
|
203
219
|
if (!writesSource) return null;
|
|
204
220
|
|
|
205
221
|
const projectRoot = s.canonicalProjectRoot ?? resolveWorktreeProjectRoot(s.basePath, s.originalBasePath);
|
|
206
|
-
|
|
222
|
+
const isolationMode = deps.getIsolationMode(projectRoot);
|
|
223
|
+
if (isolationMode !== "worktree") return null;
|
|
207
224
|
|
|
208
225
|
const safety = createWorktreeSafetyModule();
|
|
209
226
|
const result = safety.validateUnitRoot({
|
|
@@ -213,6 +230,7 @@ async function validateSourceWriteWorktreeSafety(
|
|
|
213
230
|
projectRoot,
|
|
214
231
|
unitRoot: s.basePath,
|
|
215
232
|
milestoneId,
|
|
233
|
+
isolationMode,
|
|
216
234
|
expectedBranch: milestoneId ? deps.autoWorktreeBranch(milestoneId) : null,
|
|
217
235
|
emptyWorktreeWithProjectContent: resolveEmptyWorktreeWithProjectContent(s.basePath, projectRoot),
|
|
218
236
|
lease: s.workerId
|
|
@@ -237,7 +255,7 @@ async function validateSourceWriteWorktreeSafety(
|
|
|
237
255
|
projectRoot,
|
|
238
256
|
});
|
|
239
257
|
ctx.ui.notify(msg, "error");
|
|
240
|
-
await deps.stopAuto(ctx, pi,
|
|
258
|
+
await deps.stopAuto(ctx, pi, formatWorktreeSafetyStopReason(result));
|
|
241
259
|
return { action: "break", reason: result.kind };
|
|
242
260
|
}
|
|
243
261
|
|
|
@@ -567,6 +585,13 @@ export function _buildCancelledUnitStopReason(
|
|
|
567
585
|
};
|
|
568
586
|
}
|
|
569
587
|
|
|
588
|
+
export function _isPauseOriginCancelledResult(
|
|
589
|
+
isPaused: boolean,
|
|
590
|
+
errorContext?: { message: string; category: string },
|
|
591
|
+
): boolean {
|
|
592
|
+
return isPaused && !errorContext;
|
|
593
|
+
}
|
|
594
|
+
|
|
570
595
|
async function failClosedOnFinalizeTimeout(
|
|
571
596
|
ic: IterationContext,
|
|
572
597
|
iterData: IterationData,
|
|
@@ -859,6 +884,12 @@ export async function runPreDispatch(
|
|
|
859
884
|
isDbAvailable()
|
|
860
885
|
) {
|
|
861
886
|
try {
|
|
887
|
+
const projectRoot = _resolveDispatchGuardBasePath(s);
|
|
888
|
+
if (isSliceParallelActive(projectRoot)) {
|
|
889
|
+
ctx.ui.notify("Slice-parallel: workers are still running; waiting for completion before next dispatch.", "info");
|
|
890
|
+
await new Promise<void>((resolve) => setTimeout(resolve, 1000));
|
|
891
|
+
return { action: "continue" };
|
|
892
|
+
}
|
|
862
893
|
const dbSlices = getMilestoneSlices(mid);
|
|
863
894
|
if (dbSlices.length > 0) {
|
|
864
895
|
const doneIds = new Set(dbSlices.filter(sl => sl.status === "complete" || sl.status === "done").map(sl => sl.id));
|
|
@@ -881,7 +912,7 @@ export async function runPreDispatch(
|
|
|
881
912
|
);
|
|
882
913
|
// ADR-017 #5707: reconcile before spawning so each worker doesn't
|
|
883
914
|
// independently race on the same drift. Failure aborts the spawn.
|
|
884
|
-
const spawnGate = await reconcileBeforeSpawn(
|
|
915
|
+
const spawnGate = await reconcileBeforeSpawn(projectRoot);
|
|
885
916
|
if (!spawnGate.ok) {
|
|
886
917
|
ctx.ui.notify(
|
|
887
918
|
`Slice-parallel: aborting spawn — ${spawnGate.reason}`,
|
|
@@ -890,7 +921,7 @@ export async function runPreDispatch(
|
|
|
890
921
|
return { action: "break", reason: `slice-parallel-reconciliation-failed: ${spawnGate.reason}` };
|
|
891
922
|
}
|
|
892
923
|
const result = await startSliceParallel(
|
|
893
|
-
|
|
924
|
+
projectRoot,
|
|
894
925
|
mid,
|
|
895
926
|
eligible,
|
|
896
927
|
{
|
|
@@ -903,8 +934,7 @@ export async function runPreDispatch(
|
|
|
903
934
|
`Slice-parallel: started ${result.started.length} worker(s): ${result.started.join(", ")}.`,
|
|
904
935
|
"info",
|
|
905
936
|
);
|
|
906
|
-
|
|
907
|
-
return { action: "break", reason: "slice-parallel-dispatched" };
|
|
937
|
+
return { action: "continue" };
|
|
908
938
|
}
|
|
909
939
|
// Fall through to sequential if no workers started
|
|
910
940
|
}
|
|
@@ -1232,7 +1262,6 @@ export async function runDispatch(
|
|
|
1232
1262
|
): Promise<PhaseResult<IterationData>> {
|
|
1233
1263
|
const { ctx, pi, s, deps, prefs } = ic;
|
|
1234
1264
|
const { state, mid, midTitle } = preData;
|
|
1235
|
-
const STUCK_WINDOW_SIZE = 6;
|
|
1236
1265
|
const provider = ctx.model?.provider;
|
|
1237
1266
|
const authMode = provider && typeof ctx.modelRegistry?.getProviderAuthMode === "function"
|
|
1238
1267
|
? ctx.modelRegistry.getProviderAuthMode(provider)
|
|
@@ -1327,9 +1356,15 @@ export async function runDispatch(
|
|
|
1327
1356
|
}
|
|
1328
1357
|
|
|
1329
1358
|
const guardBasePath = _resolveDispatchGuardBasePath(s);
|
|
1359
|
+
let mainBranch = "main";
|
|
1360
|
+
try {
|
|
1361
|
+
mainBranch = deps.getMainBranch(guardBasePath);
|
|
1362
|
+
} catch (err) {
|
|
1363
|
+
debugLog("autoLoop", { phase: "getMainBranch-failed", error: String(err) });
|
|
1364
|
+
}
|
|
1330
1365
|
const priorSliceBlocker = deps.getPriorSliceCompletionBlocker(
|
|
1331
1366
|
guardBasePath,
|
|
1332
|
-
|
|
1367
|
+
mainBranch,
|
|
1333
1368
|
unitType,
|
|
1334
1369
|
unitId,
|
|
1335
1370
|
);
|
|
@@ -1339,6 +1374,18 @@ export async function runDispatch(
|
|
|
1339
1374
|
return { action: "break", reason: "prior-slice-blocker" };
|
|
1340
1375
|
}
|
|
1341
1376
|
|
|
1377
|
+
const consecutiveDispatchBlocker = getConsecutiveDispatchBlocker(
|
|
1378
|
+
loopState,
|
|
1379
|
+
state.phase,
|
|
1380
|
+
unitType,
|
|
1381
|
+
unitId,
|
|
1382
|
+
);
|
|
1383
|
+
if (consecutiveDispatchBlocker) {
|
|
1384
|
+
await deps.stopAuto(ctx, pi, consecutiveDispatchBlocker);
|
|
1385
|
+
debugLog("autoLoop", { phase: "exit", reason: "consecutive-dispatch-blocker" });
|
|
1386
|
+
return { action: "break", reason: "consecutive-dispatch-blocker" };
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1342
1389
|
const worktreeSafetyBlock = await validateSourceWriteWorktreeSafety(
|
|
1343
1390
|
ic,
|
|
1344
1391
|
unitType,
|
|
@@ -1355,9 +1402,14 @@ export async function runDispatch(
|
|
|
1355
1402
|
// Rules 1/3/4 can catch retry loops with repeated failure content (#5719).
|
|
1356
1403
|
// Rules 2/2b suppress legitimate retry backoff through the dispatch ledger.
|
|
1357
1404
|
loopState.recentUnits.push({ key: derivedKey });
|
|
1358
|
-
|
|
1405
|
+
while (loopState.recentUnits.length > STUCK_WINDOW_SIZE) {
|
|
1406
|
+
loopState.recentUnits.shift();
|
|
1407
|
+
}
|
|
1359
1408
|
|
|
1360
|
-
const stuckSignal = detectStuck(loopState.recentUnits
|
|
1409
|
+
const stuckSignal = detectStuck(loopState.recentUnits, {
|
|
1410
|
+
pendingRetry: !!s.pendingVerificationRetry,
|
|
1411
|
+
retryAttempt: s.pendingVerificationRetry?.attempt,
|
|
1412
|
+
});
|
|
1361
1413
|
if (stuckSignal) {
|
|
1362
1414
|
debugLog("autoLoop", {
|
|
1363
1415
|
phase: "stuck-check",
|
|
@@ -1412,7 +1464,6 @@ export async function runDispatch(
|
|
|
1412
1464
|
);
|
|
1413
1465
|
deps.invalidateAllCaches();
|
|
1414
1466
|
loopState.recentUnits.length = 0;
|
|
1415
|
-
loopState.stuckRecoveryAttempts = 0;
|
|
1416
1467
|
return { action: "continue" };
|
|
1417
1468
|
}
|
|
1418
1469
|
ctx.ui.notify(
|
|
@@ -1796,42 +1847,8 @@ export async function runUnitPhase(
|
|
|
1796
1847
|
s.currentUnit.id === unitId
|
|
1797
1848
|
);
|
|
1798
1849
|
const previousTier = s.currentUnitRouting?.tier;
|
|
1799
|
-
|
|
1800
|
-
// Scope workflow-logger buffer to this unit so post-finalize drains are
|
|
1801
|
-
// per-unit. Without this, the module-level _buffer accumulates across every
|
|
1802
|
-
// unit in the same Node process (see workflow-logger.ts module header).
|
|
1803
|
-
_resetLogs();
|
|
1804
1850
|
const dispatchKey = `${unitType}/${unitId}`;
|
|
1805
|
-
|
|
1806
|
-
s.currentUnit = { type: unitType, id: unitId, startedAt: Date.now() };
|
|
1807
|
-
s.lastGitActionFailure = null;
|
|
1808
|
-
s.lastGitActionStatus = null;
|
|
1809
|
-
s.lastUnitAgentEndMessages = null;
|
|
1810
|
-
setCurrentPhase(unitType, {
|
|
1811
|
-
basePath: s.basePath,
|
|
1812
|
-
traceId: ic.flowId,
|
|
1813
|
-
turnId: `iter-${ic.iteration}`,
|
|
1814
|
-
causedBy: "unit-start",
|
|
1815
|
-
});
|
|
1816
|
-
s.lastToolInvocationError = null; // #2883: clear stale error from previous unit
|
|
1817
|
-
const unitStartSeq = ic.nextSeq();
|
|
1818
|
-
deps.emitJournalEvent({ ts: new Date().toISOString(), flowId: ic.flowId, seq: unitStartSeq, eventType: "unit-start", data: { unitType, unitId } });
|
|
1819
|
-
deps.captureAvailableSkills();
|
|
1820
|
-
writeUnitRuntimeRecord(
|
|
1821
|
-
s.basePath,
|
|
1822
|
-
unitType,
|
|
1823
|
-
unitId,
|
|
1824
|
-
s.currentUnit.startedAt,
|
|
1825
|
-
{
|
|
1826
|
-
phase: "dispatched",
|
|
1827
|
-
wrapupWarningSent: false,
|
|
1828
|
-
timeoutAt: null,
|
|
1829
|
-
lastProgressAt: s.currentUnit.startedAt,
|
|
1830
|
-
progressCount: 0,
|
|
1831
|
-
lastProgressKind: "dispatch",
|
|
1832
|
-
recoveryAttempts: 0, // Reset so re-dispatched units get full recovery budget (#2322)
|
|
1833
|
-
},
|
|
1834
|
-
);
|
|
1851
|
+
const nextDispatchCount = (s.unitDispatchCount.get(dispatchKey) ?? 0) + 1;
|
|
1835
1852
|
|
|
1836
1853
|
// Status bar (widget + preconditions deferred until after model selection — see #2899)
|
|
1837
1854
|
ctx.ui.setStatus("gsd-auto", "auto");
|
|
@@ -1894,7 +1911,7 @@ export async function runUnitPhase(
|
|
|
1894
1911
|
: s.pendingCrashRecovery;
|
|
1895
1912
|
finalPrompt = `${capped}\n\n---\n\n${finalPrompt}`;
|
|
1896
1913
|
s.pendingCrashRecovery = null;
|
|
1897
|
-
} else if (
|
|
1914
|
+
} else if (nextDispatchCount > 1) {
|
|
1898
1915
|
const diagnostic = deps.getDeepDiagnostic(s.basePath);
|
|
1899
1916
|
if (diagnostic) {
|
|
1900
1917
|
const cappedDiag =
|
|
@@ -1902,7 +1919,11 @@ export async function runUnitPhase(
|
|
|
1902
1919
|
? diagnostic.slice(0, MAX_RECOVERY_CHARS) +
|
|
1903
1920
|
"\n\n[...diagnostic truncated to prevent memory exhaustion]"
|
|
1904
1921
|
: diagnostic;
|
|
1905
|
-
|
|
1922
|
+
const retryInstruction =
|
|
1923
|
+
unitType === "execute-task"
|
|
1924
|
+
? "The required artifact is `T##-SUMMARY.md`. Do NOT manually write this file. Call `gsd_task_complete` with `milestoneId`, `sliceId`, `taskId`, and the required completion fields. Do not re-run implementation work — call the tool."
|
|
1925
|
+
: "Fix whatever went wrong and make sure you write the required file this time.";
|
|
1926
|
+
finalPrompt = `**RETRY — your previous attempt did not produce the required artifact.**\n\nDiagnostic from previous attempt:\n${cappedDiag}\n\n${retryInstruction}\n\n---\n\n${finalPrompt}`;
|
|
1906
1927
|
}
|
|
1907
1928
|
}
|
|
1908
1929
|
|
|
@@ -1937,6 +1958,11 @@ export async function runUnitPhase(
|
|
|
1937
1958
|
}
|
|
1938
1959
|
|
|
1939
1960
|
// Select and apply model (with tier escalation on retry — normal units only)
|
|
1961
|
+
const prevUnitRouting = s.currentUnitRouting;
|
|
1962
|
+
const prevUnitModel = s.currentUnitModel;
|
|
1963
|
+
const prevDispatchedModelId = s.currentDispatchedModelId;
|
|
1964
|
+
const prevSessionModel = ctx.model;
|
|
1965
|
+
const prevSessionThinkingLevel = pi.getThinkingLevel();
|
|
1940
1966
|
const modelResult = await deps.selectAndApplyModel(
|
|
1941
1967
|
ctx,
|
|
1942
1968
|
pi,
|
|
@@ -2003,14 +2029,67 @@ export async function runUnitPhase(
|
|
|
2003
2029
|
? ctx.modelRegistry.getProviderAuthMode(ctx.model.provider)
|
|
2004
2030
|
: undefined,
|
|
2005
2031
|
baseUrl: (s.currentUnitModel as any)?.baseUrl ?? ctx.model?.baseUrl,
|
|
2032
|
+
activeTools: typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [],
|
|
2006
2033
|
},
|
|
2007
2034
|
);
|
|
2008
2035
|
if (compatibilityError) {
|
|
2036
|
+
s.currentUnitRouting = prevUnitRouting;
|
|
2037
|
+
s.currentUnitModel = prevUnitModel;
|
|
2038
|
+
s.currentDispatchedModelId = prevDispatchedModelId;
|
|
2039
|
+
if (s.checkpointSha) {
|
|
2040
|
+
cleanupCheckpoint(s.basePath, unitId);
|
|
2041
|
+
s.checkpointSha = null;
|
|
2042
|
+
}
|
|
2043
|
+
if (prevSessionModel) {
|
|
2044
|
+
const ok = await pi.setModel(prevSessionModel, { persist: false });
|
|
2045
|
+
if (!ok) {
|
|
2046
|
+
ctx.ui.notify("Failed to restore previous session model after compatibility check failure.", "warning");
|
|
2047
|
+
}
|
|
2048
|
+
if (prevSessionThinkingLevel) {
|
|
2049
|
+
pi.setThinkingLevel(prevSessionThinkingLevel);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2009
2052
|
ctx.ui.notify(compatibilityError, "error");
|
|
2010
2053
|
await deps.stopAuto(ctx, pi, compatibilityError);
|
|
2011
2054
|
return { action: "break", reason: "workflow-capability" };
|
|
2012
2055
|
}
|
|
2013
2056
|
|
|
2057
|
+
// Scope workflow-logger buffer to this unit so post-finalize drains are
|
|
2058
|
+
// per-unit. Without this, the module-level _buffer accumulates across every
|
|
2059
|
+
// unit in the same Node process (see workflow-logger.ts module header).
|
|
2060
|
+
_resetLogs();
|
|
2061
|
+
const unitStartedAt = Date.now();
|
|
2062
|
+
s.unitDispatchCount.set(dispatchKey, nextDispatchCount);
|
|
2063
|
+
s.currentUnit = { type: unitType, id: unitId, startedAt: unitStartedAt };
|
|
2064
|
+
s.lastGitActionFailure = null;
|
|
2065
|
+
s.lastGitActionStatus = null;
|
|
2066
|
+
s.lastUnitAgentEndMessages = null;
|
|
2067
|
+
setCurrentPhase(unitType, {
|
|
2068
|
+
basePath: s.basePath,
|
|
2069
|
+
traceId: ic.flowId,
|
|
2070
|
+
turnId: `iter-${ic.iteration}`,
|
|
2071
|
+
causedBy: "unit-start",
|
|
2072
|
+
});
|
|
2073
|
+
s.lastToolInvocationError = null; // #2883: clear stale error from previous unit
|
|
2074
|
+
const unitStartSeq = ic.nextSeq();
|
|
2075
|
+
deps.emitJournalEvent({ ts: new Date().toISOString(), flowId: ic.flowId, seq: unitStartSeq, eventType: "unit-start", data: { unitType, unitId } });
|
|
2076
|
+
deps.captureAvailableSkills();
|
|
2077
|
+
writeUnitRuntimeRecord(
|
|
2078
|
+
s.basePath,
|
|
2079
|
+
unitType,
|
|
2080
|
+
unitId,
|
|
2081
|
+
unitStartedAt,
|
|
2082
|
+
{
|
|
2083
|
+
phase: "dispatched",
|
|
2084
|
+
wrapupWarningSent: false,
|
|
2085
|
+
timeoutAt: null,
|
|
2086
|
+
lastProgressAt: unitStartedAt,
|
|
2087
|
+
progressCount: 0,
|
|
2088
|
+
lastProgressKind: "dispatch",
|
|
2089
|
+
recoveryAttempts: 0, // Reset so re-dispatched units get full recovery budget (#2322)
|
|
2090
|
+
},
|
|
2091
|
+
);
|
|
2092
|
+
|
|
2014
2093
|
// Progress widget + preconditions — deferred to after model selection so the
|
|
2015
2094
|
// widget's first render tick shows the correct model (#2899).
|
|
2016
2095
|
deps.updateProgressWidget(ctx, unitType, unitId, state);
|
|
@@ -2125,6 +2204,11 @@ export async function runUnitPhase(
|
|
|
2125
2204
|
}
|
|
2126
2205
|
|
|
2127
2206
|
if (unitResult.status === "cancelled") {
|
|
2207
|
+
if (_isPauseOriginCancelledResult(s.paused, unitResult.errorContext)) {
|
|
2208
|
+
debugLog("autoLoop", { phase: "cancelled-after-pause", unitType, unitId });
|
|
2209
|
+
return { action: "break", reason: "paused" };
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2128
2212
|
const errorCategory = unitResult.errorContext?.category;
|
|
2129
2213
|
// Provider-error pause: agent_end recovery normally pauses before this
|
|
2130
2214
|
// branch. Provider readiness failures happen before dispatch, so pause here
|
|
@@ -2328,18 +2412,17 @@ export async function runUnitPhase(
|
|
|
2328
2412
|
}
|
|
2329
2413
|
}
|
|
2330
2414
|
|
|
2415
|
+
const skipArtifactVerification = unitType.startsWith("hook/") || unitType === "custom-step";
|
|
2416
|
+
const artifactVerified =
|
|
2417
|
+
skipArtifactVerification ||
|
|
2418
|
+
verifyExpectedArtifact(unitType, unitId, s.basePath);
|
|
2331
2419
|
if (s.currentUnitRouting) {
|
|
2332
2420
|
deps.recordOutcome(
|
|
2333
2421
|
unitType,
|
|
2334
2422
|
s.currentUnitRouting.tier as "light" | "standard" | "heavy",
|
|
2335
|
-
|
|
2423
|
+
artifactVerified,
|
|
2336
2424
|
);
|
|
2337
2425
|
}
|
|
2338
|
-
|
|
2339
|
-
const skipArtifactVerification = unitType.startsWith("hook/") || unitType === "custom-step";
|
|
2340
|
-
const artifactVerified =
|
|
2341
|
-
skipArtifactVerification ||
|
|
2342
|
-
verifyExpectedArtifact(unitType, unitId, s.basePath);
|
|
2343
2426
|
if (artifactVerified) {
|
|
2344
2427
|
s.unitDispatchCount.delete(dispatchKey);
|
|
2345
2428
|
s.unitRecoveryCount.delete(`${unitType}/${unitId}`);
|
|
@@ -2364,7 +2447,11 @@ export async function runUnitPhase(
|
|
|
2364
2447
|
}
|
|
2365
2448
|
}
|
|
2366
2449
|
|
|
2367
|
-
|
|
2450
|
+
const unitEndStatus =
|
|
2451
|
+
!artifactVerified && unitResult.status === "completed"
|
|
2452
|
+
? "no-artifact"
|
|
2453
|
+
: unitResult.status;
|
|
2454
|
+
deps.emitJournalEvent({ ts: new Date().toISOString(), flowId: ic.flowId, seq: ic.nextSeq(), eventType: "unit-end", data: { unitType, unitId, status: unitEndStatus, artifactVerified, ...(unitResult.errorContext ? { errorContext: unitResult.errorContext } : {}) }, causedBy: { flowId: ic.flowId, seq: unitStartSeq } });
|
|
2368
2455
|
|
|
2369
2456
|
// ── Safety harness: checkpoint cleanup or rollback ──
|
|
2370
2457
|
if (s.checkpointSha) {
|
|
@@ -2439,6 +2526,8 @@ export async function runFinalize(
|
|
|
2439
2526
|
const preUnitSnapshot = s.currentUnit
|
|
2440
2527
|
? { type: s.currentUnit.type, id: s.currentUnit.id, startedAt: s.currentUnit.startedAt }
|
|
2441
2528
|
: null;
|
|
2529
|
+
s.currentUnit = null;
|
|
2530
|
+
clearCurrentPhase();
|
|
2442
2531
|
const preResultGuard = await withTimeout(
|
|
2443
2532
|
deps.postUnitPreVerification(postUnitCtx, preVerificationOpts),
|
|
2444
2533
|
FINALIZE_PRE_TIMEOUT_MS,
|
|
@@ -2596,10 +2685,21 @@ export async function runFinalize(
|
|
|
2596
2685
|
lastProgressAt: Date.now(),
|
|
2597
2686
|
lastProgressKind: "finalize-success",
|
|
2598
2687
|
});
|
|
2688
|
+
if (
|
|
2689
|
+
!preUnitSnapshot.type.startsWith("hook/") &&
|
|
2690
|
+
preUnitSnapshot.type !== "custom-step" &&
|
|
2691
|
+
preUnitSnapshot.type !== "complete-milestone"
|
|
2692
|
+
) {
|
|
2693
|
+
setAutoOutcomeWidget(ctx, {
|
|
2694
|
+
...buildPhaseHandoffOutcome({
|
|
2695
|
+
unitType: preUnitSnapshot.type,
|
|
2696
|
+
unitId: preUnitSnapshot.id,
|
|
2697
|
+
agentEndMessages: s.lastUnitAgentEndMessages,
|
|
2698
|
+
}),
|
|
2699
|
+
startedAt: s.autoStartTime,
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2599
2702
|
}
|
|
2600
|
-
s.currentUnit = null;
|
|
2601
|
-
clearCurrentPhase();
|
|
2602
|
-
|
|
2603
2703
|
// Surface accumulated workflow-logger issues for this unit to the user.
|
|
2604
2704
|
// Warnings/errors logged during the unit are buffered in the logger and
|
|
2605
2705
|
// drained here so the user sees a single consolidated post-unit alert.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Mutable auto-mode session state container.
|
|
1
3
|
/**
|
|
2
4
|
* AutoSession — encapsulates all mutable auto-mode state into a single instance.
|
|
3
5
|
*
|
|
@@ -52,6 +54,16 @@ export interface PendingVerificationRetry {
|
|
|
52
54
|
attempt: number;
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
export interface PendingOrchestrationDispatch {
|
|
58
|
+
unitType: string;
|
|
59
|
+
unitId: string;
|
|
60
|
+
prompt: string;
|
|
61
|
+
pauseAfterUatDispatch: boolean;
|
|
62
|
+
state: import("../types.js").GSDState;
|
|
63
|
+
mid: string | undefined;
|
|
64
|
+
midTitle: string | undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
/**
|
|
56
68
|
* A typed item enqueued by postUnitPostVerification for the main loop to
|
|
57
69
|
* drain via the standard runUnit path. Replaces inline dispatch
|
|
@@ -89,6 +101,7 @@ export class AutoSession {
|
|
|
89
101
|
active = false;
|
|
90
102
|
paused = false;
|
|
91
103
|
completionStopInProgress = false;
|
|
104
|
+
preserveStepSurfaceAfterLoopExit = false;
|
|
92
105
|
stepMode = false;
|
|
93
106
|
verbose = false;
|
|
94
107
|
activeEngineId: string | null = null;
|
|
@@ -241,6 +254,7 @@ export class AutoSession {
|
|
|
241
254
|
|
|
242
255
|
// ── Orchestration seam ───────────────────────────────────────────────────
|
|
243
256
|
orchestration: AutoOrchestrationModule | null = null;
|
|
257
|
+
pendingOrchestrationDispatch: PendingOrchestrationDispatch | null = null;
|
|
244
258
|
|
|
245
259
|
// ── Loop promise state ──────────────────────────────────────────────────
|
|
246
260
|
// Per-unit resolve function and session-switch guard live at module level
|
|
@@ -289,6 +303,7 @@ export class AutoSession {
|
|
|
289
303
|
this.active = false;
|
|
290
304
|
this.paused = false;
|
|
291
305
|
this.completionStopInProgress = false;
|
|
306
|
+
this.preserveStepSurfaceAfterLoopExit = false;
|
|
292
307
|
this.stepMode = false;
|
|
293
308
|
this.verbose = false;
|
|
294
309
|
this.activeEngineId = null;
|
|
@@ -372,6 +387,7 @@ export class AutoSession {
|
|
|
372
387
|
|
|
373
388
|
// Orchestration seam
|
|
374
389
|
this.orchestration = null;
|
|
390
|
+
this.pendingOrchestrationDispatch = null;
|
|
375
391
|
|
|
376
392
|
// Loop promise state lives in auto-loop.ts module scope
|
|
377
393
|
}
|
|
@@ -97,6 +97,9 @@ export interface LoopState {
|
|
|
97
97
|
stuckRecoveryAttempts: number;
|
|
98
98
|
/** Consecutive finalize timeout count — stops auto-mode after threshold. */
|
|
99
99
|
consecutiveFinalizeTimeouts: number;
|
|
100
|
+
consecutiveDispatchCount?: Map<string, number>;
|
|
101
|
+
lastDispatchedKey?: string | null;
|
|
102
|
+
lastDispatchPhase?: string | null;
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
/** Max consecutive finalize timeouts before hard-stopping auto-mode. */
|
|
@@ -9,7 +9,11 @@ export function isInternalSessionTransitionAbortEvent(
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function shouldIgnoreAgentEndForActiveUnit(
|
|
12
|
-
event: Pick<AgentEndEvent, "abortOrigin">,
|
|
12
|
+
event: Pick<AgentEndEvent, "abortOrigin" | "messages">,
|
|
13
13
|
): boolean {
|
|
14
|
-
|
|
14
|
+
if (!isInternalSessionTransitionAbortEvent(event)) return false;
|
|
15
|
+
const lastMsg = event.messages[event.messages.length - 1];
|
|
16
|
+
if (!lastMsg || typeof lastMsg !== "object") return true;
|
|
17
|
+
const stopReason = (lastMsg as { stopReason?: unknown }).stopReason;
|
|
18
|
+
return stopReason === "aborted" || stopReason === "error";
|
|
15
19
|
}
|
|
@@ -48,7 +48,8 @@ export type FinalizeDecision =
|
|
|
48
48
|
action: "retry";
|
|
49
49
|
ledgerErrorSummary: "finalize-retry";
|
|
50
50
|
}
|
|
51
|
-
| { action: "complete" }
|
|
51
|
+
| { action: "complete" }
|
|
52
|
+
| { action: "complete-and-break" };
|
|
52
53
|
|
|
53
54
|
export type EngineReconcileInput =
|
|
54
55
|
| { outcome: "milestone-complete" }
|
|
@@ -278,6 +279,9 @@ export function decideEngineDispatch(input: EngineDispatchInput): EngineDispatch
|
|
|
278
279
|
export function decideFinalizeResult(input: FinalizeInput): FinalizeDecision {
|
|
279
280
|
if (input.action === "break") {
|
|
280
281
|
const reason = input.reason ?? "unknown";
|
|
282
|
+
if (reason === "step-wizard") {
|
|
283
|
+
return { action: "complete-and-break" };
|
|
284
|
+
}
|
|
281
285
|
return {
|
|
282
286
|
action: "stop",
|
|
283
287
|
failureClass: reason === "git-closeout-failure" ? "git" : "closeout",
|
|
@@ -19,6 +19,19 @@ export interface MeasureMemoryPressureDeps {
|
|
|
19
19
|
heapLimitBytes: () => number;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Returns true on auto-mode startup, then every configured interval.
|
|
24
|
+
*
|
|
25
|
+
* Iteration 1 is checked explicitly so early session memory pressure cannot
|
|
26
|
+
* bypass the periodic interval guard.
|
|
27
|
+
*/
|
|
28
|
+
export function shouldCheckMemoryPressure(iteration: number, interval: number): boolean {
|
|
29
|
+
if (!Number.isInteger(interval) || interval <= 0) {
|
|
30
|
+
throw new Error("Memory pressure check interval must be a positive integer");
|
|
31
|
+
}
|
|
32
|
+
return iteration === 1 || iteration % interval === 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
22
35
|
function defaultHeapLimitBytes(): number {
|
|
23
36
|
const v8 = require("node:v8") as {
|
|
24
37
|
getHeapStatistics?: () => { heap_size_limit?: number };
|
|
@@ -30,3 +30,14 @@ export function getBudgetEnforcementAction(
|
|
|
30
30
|
if (enforcement === "pause") return "pause";
|
|
31
31
|
return "warn";
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
export function getUnitCostSpikeAction(
|
|
35
|
+
unitCostUsd: number,
|
|
36
|
+
rollingAvgUsd: number,
|
|
37
|
+
multiplier = 3.0,
|
|
38
|
+
): "none" | "pause" {
|
|
39
|
+
if (!Number.isFinite(unitCostUsd) || unitCostUsd < 0) return "none";
|
|
40
|
+
if (!Number.isFinite(rollingAvgUsd) || rollingAvgUsd <= 0) return "none";
|
|
41
|
+
if (!Number.isFinite(multiplier) || multiplier <= 0) return "none";
|
|
42
|
+
return unitCostUsd >= (rollingAvgUsd * multiplier) ? "pause" : "none";
|
|
43
|
+
}
|
|
@@ -120,6 +120,26 @@ export interface AutoOutcomeSurfaceSnapshot {
|
|
|
120
120
|
startedAt?: number;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
export function buildPhaseHandoffOutcome(input: {
|
|
124
|
+
unitType: string;
|
|
125
|
+
unitId: string;
|
|
126
|
+
agentEndMessages?: unknown[] | null;
|
|
127
|
+
}): AutoOutcomeSurfaceSnapshot {
|
|
128
|
+
const phase = unitPhaseLabel(input.unitType);
|
|
129
|
+
const detail =
|
|
130
|
+
extractLastAssistantSummary(input.agentEndMessages) ??
|
|
131
|
+
`Completed ${unitVerb(input.unitType)} ${input.unitId}.`;
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
status: "complete",
|
|
135
|
+
title: `${phase} complete`,
|
|
136
|
+
detail,
|
|
137
|
+
unitLabel: `${unitVerb(input.unitType)} ${input.unitId}`,
|
|
138
|
+
nextAction: "Preparing the next phase. Review this handoff while the next session starts.",
|
|
139
|
+
commands: ["/gsd status for overview", "/gsd visualize to inspect", "/gsd notifications for history"],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
123
143
|
// ─── Unit Description Helpers ─────────────────────────────────────────────────
|
|
124
144
|
|
|
125
145
|
export function unitVerb(unitType: string): string {
|
|
@@ -631,7 +651,6 @@ export function updateProgressWidget(
|
|
|
631
651
|
tierBadge?: string,
|
|
632
652
|
): void {
|
|
633
653
|
if (!ctx.hasUI) return;
|
|
634
|
-
ctx.ui.setWidget("gsd-outcome", undefined);
|
|
635
654
|
|
|
636
655
|
// Welcome header is a startup-only banner — permanently suppress it once
|
|
637
656
|
// auto-mode activates. The dashboard widget owns all status from here.
|
|
@@ -1145,3 +1164,55 @@ function normalizeRollupText(value: string | null | undefined): string | null {
|
|
|
1145
1164
|
if (!clean || clean === "(none)" || clean === "None." || clean === "Not provided.") return null;
|
|
1146
1165
|
return clean;
|
|
1147
1166
|
}
|
|
1167
|
+
|
|
1168
|
+
function isAssistantMessage(value: unknown): boolean {
|
|
1169
|
+
if (!value || typeof value !== "object") return false;
|
|
1170
|
+
const record = value as Record<string, unknown>;
|
|
1171
|
+
if (record.role === "assistant") return true;
|
|
1172
|
+
|
|
1173
|
+
const message = record.message;
|
|
1174
|
+
if (message && typeof message === "object") {
|
|
1175
|
+
return (message as Record<string, unknown>).role === "assistant";
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
return false;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function extractLastAssistantSummary(messages: unknown[] | null | undefined): string | null {
|
|
1182
|
+
if (!messages || messages.length === 0) return null;
|
|
1183
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
1184
|
+
if (!isAssistantMessage(messages[i])) continue;
|
|
1185
|
+
const text = extractMessageText(messages[i]);
|
|
1186
|
+
const clean = normalizeRollupText(text);
|
|
1187
|
+
if (clean) return truncateToWidth(clean, 220, "…");
|
|
1188
|
+
}
|
|
1189
|
+
return null;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
function extractMessageText(value: unknown): string | null {
|
|
1193
|
+
if (typeof value === "string") return value;
|
|
1194
|
+
if (!value || typeof value !== "object") return null;
|
|
1195
|
+
|
|
1196
|
+
const record = value as Record<string, unknown>;
|
|
1197
|
+
if (typeof record.content === "string") return record.content;
|
|
1198
|
+
|
|
1199
|
+
const message = record.message;
|
|
1200
|
+
if (message && typeof message === "object") {
|
|
1201
|
+
return extractMessageText(message);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
const content = record.content;
|
|
1205
|
+
if (Array.isArray(content)) {
|
|
1206
|
+
const parts = content
|
|
1207
|
+
.map((part) => {
|
|
1208
|
+
if (typeof part === "string") return part;
|
|
1209
|
+
if (!part || typeof part !== "object") return "";
|
|
1210
|
+
const partRecord = part as Record<string, unknown>;
|
|
1211
|
+
return typeof partRecord.text === "string" ? partRecord.text : "";
|
|
1212
|
+
})
|
|
1213
|
+
.filter(Boolean);
|
|
1214
|
+
return parts.length > 0 ? parts.join(" ") : null;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
return null;
|
|
1218
|
+
}
|
|
@@ -280,6 +280,7 @@ export async function dispatchDirectPhase(
|
|
|
280
280
|
unitType,
|
|
281
281
|
authMode: ctx.model?.provider ? ctx.modelRegistry.getProviderAuthMode(ctx.model.provider) : undefined,
|
|
282
282
|
baseUrl: ctx.model?.baseUrl,
|
|
283
|
+
activeTools: typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [],
|
|
283
284
|
},
|
|
284
285
|
);
|
|
285
286
|
if (compatibilityError) {
|