gsd-pi 2.82.0-dev.725028083 → 2.82.0-dev.98ea09b1e
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 +4 -3
- 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/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/infra-errors.js +9 -3
- package/dist/resources/extensions/gsd/auto/loop.js +5 -5
- package/dist/resources/extensions/gsd/auto/orchestrator.js +124 -6
- package/dist/resources/extensions/gsd/auto/phases.js +8 -1
- package/dist/resources/extensions/gsd/auto/workflow-memory-pressure.js +12 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +13 -6
- package/dist/resources/extensions/gsd/auto-model-selection.js +2 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +233 -127
- package/dist/resources/extensions/gsd/auto-prompts.js +2 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +31 -1
- package/dist/resources/extensions/gsd/auto-start.js +85 -12
- package/dist/resources/extensions/gsd/auto-verification.js +28 -22
- package/dist/resources/extensions/gsd/auto-worktree.js +111 -1
- package/dist/resources/extensions/gsd/auto.js +158 -55
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +4 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +9 -8
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +21 -9
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +16 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +4 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +37 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +31 -5
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +3 -2
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -2
- 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/git-service.js +39 -1
- package/dist/resources/extensions/gsd/gsd-db.js +1 -0
- package/dist/resources/extensions/gsd/guided-flow.js +13 -6
- package/dist/resources/extensions/gsd/md-importer.js +1 -1
- package/dist/resources/extensions/gsd/migrate/command.js +5 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +10 -0
- package/dist/resources/extensions/gsd/migrate/preview.js +9 -0
- package/dist/resources/extensions/gsd/migrate/transformer.js +51 -4
- package/dist/resources/extensions/gsd/migrate/writer.js +11 -1
- 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 +48 -12
- package/dist/resources/extensions/gsd/post-execution-checks.js +73 -2
- package/dist/resources/extensions/gsd/pre-execution-checks.js +28 -1
- 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/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/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- 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/status-guards.js +4 -0
- package/dist/resources/extensions/gsd/templates/plan.md +8 -5
- package/dist/resources/extensions/gsd/templates/task-plan.md +4 -2
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -8
- package/dist/resources/extensions/gsd/tools/complete-slice.js +6 -8
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +7 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +89 -14
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +119 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +32 -10
- package/dist/resources/extensions/gsd/validation.js +23 -1
- package/dist/resources/extensions/gsd/verification-gate.js +68 -7
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/workflow-projections.js +6 -8
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +54 -10
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- 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/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/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
- 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 +3 -3
- 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/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 +14 -14
- 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.e059d86b255fce1c.js → 8359.7eb3bb8f8ecf4c01.js} +2 -2
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-9a4db269f9ed63ad.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +4 -4
- package/packages/contracts/dist/rpc.test.js +7 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +21 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +24 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/src/rpc.test.ts +8 -0
- package/packages/contracts/src/workflow.ts +24 -0
- package/packages/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/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/tsconfig.json +2 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- 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/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/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/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +5 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/tui.ts +6 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +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/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +59 -16
- package/src/resources/extensions/gsd/auto/infra-errors.ts +9 -3
- package/src/resources/extensions/gsd/auto/loop.ts +8 -5
- package/src/resources/extensions/gsd/auto/orchestrator.ts +129 -6
- package/src/resources/extensions/gsd/auto/phases.ts +7 -1
- package/src/resources/extensions/gsd/auto/workflow-memory-pressure.ts +13 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +14 -6
- package/src/resources/extensions/gsd/auto-model-selection.ts +2 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +266 -139
- package/src/resources/extensions/gsd/auto-prompts.ts +2 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -0
- package/src/resources/extensions/gsd/auto-start.ts +92 -9
- package/src/resources/extensions/gsd/auto-verification.ts +36 -34
- package/src/resources/extensions/gsd/auto-worktree.ts +119 -1
- package/src/resources/extensions/gsd/auto.ts +167 -53
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +6 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +9 -8
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +19 -7
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +19 -3
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +4 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +40 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/crash-recovery.ts +30 -4
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +4 -3
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -2
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +25 -13
- package/src/resources/extensions/gsd/doctor.ts +2 -27
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/git-service.ts +45 -1
- package/src/resources/extensions/gsd/gsd-db.ts +3 -0
- package/src/resources/extensions/gsd/guided-flow.ts +14 -7
- package/src/resources/extensions/gsd/md-importer.ts +1 -1
- package/src/resources/extensions/gsd/migrate/command.ts +5 -0
- package/src/resources/extensions/gsd/migrate/parsers.ts +11 -0
- package/src/resources/extensions/gsd/migrate/preview.ts +10 -0
- package/src/resources/extensions/gsd/migrate/transformer.ts +58 -4
- package/src/resources/extensions/gsd/migrate/writer.ts +14 -1
- 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 +54 -12
- package/src/resources/extensions/gsd/post-execution-checks.ts +87 -2
- package/src/resources/extensions/gsd/pre-execution-checks.ts +32 -1
- 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/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/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- 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/status-guards.ts +5 -0
- package/src/resources/extensions/gsd/templates/plan.md +8 -5
- package/src/resources/extensions/gsd/templates/task-plan.md +4 -2
- 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 +54 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +487 -4
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +12 -11
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +12 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +5 -9
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +43 -2
- package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +59 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-project-prompt-rendering.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +6 -6
- 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/integration/doctor-runtime.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +103 -1
- package/src/resources/extensions/gsd/tests/integration/migrate-command.test.ts +48 -3
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/migrate-transformer.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +24 -1
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +6 -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 +63 -2
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -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 +225 -1
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +17 -0
- 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 +86 -0
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/prompt-loader.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +46 -2
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +31 -1
- 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/stuck-state-via-db.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +86 -7
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +110 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/workflow-memory-pressure.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-git-pathspec.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +54 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +8 -10
- package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -8
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +5 -1
- package/src/resources/extensions/gsd/tools/plan-slice.ts +98 -12
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +135 -0
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +47 -11
- package/src/resources/extensions/gsd/validation.ts +23 -1
- package/src/resources/extensions/gsd/verification-gate.ts +78 -6
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +6 -8
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +61 -10
- package/src/resources/extensions/shared/html-shell.ts +412 -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/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/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/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/{KDRTXR-22LPCsa80X9dey → euQ0CLP_v8V4e76Tu3odJ}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{KDRTXR-22LPCsa80X9dey → euQ0CLP_v8V4e76Tu3odJ}/_ssgManifest.js +0 -0
|
@@ -22,7 +22,7 @@ import { gsdRoot, resolveMilestoneFile, resolveMilestonePath, resolveDir, milest
|
|
|
22
22
|
import { invalidateAllCaches } from "./cache.js";
|
|
23
23
|
import { clearActivityLogState } from "./activity-log.js";
|
|
24
24
|
import { synthesizeCrashRecovery, getDeepDiagnostic, readActiveMilestoneId, } from "./session-forensics.js";
|
|
25
|
-
import { writeLock, clearLock, readCrashLock, isLockProcessAlive, formatCrashInfo, emitCrashRecoveredUnitEnd, emitOpenUnitEndForUnit, } from "./crash-recovery.js";
|
|
25
|
+
import { writeLock, clearLock, clearStaleWorkerLock, readCrashLock, isLockProcessAlive, formatCrashInfo, emitCrashRecoveredUnitEnd, emitOpenUnitEndForUnit, } from "./crash-recovery.js";
|
|
26
26
|
import { acquireSessionLock, getSessionLockStatus, releaseSessionLock, updateSessionLock, } from "./session-lock.js";
|
|
27
27
|
import { resolveAutoSupervisorConfig, loadEffectiveGSDPreferences, getIsolationMode, } from "./preferences.js";
|
|
28
28
|
import { sendDesktopNotification } from "./notifications.js";
|
|
@@ -92,6 +92,7 @@ import { compileUnitToolContract } from "./tool-contract.js";
|
|
|
92
92
|
import { createWorktreeSafetyModule } from "./worktree-safety.js";
|
|
93
93
|
import { resolveManifest } from "./unit-context-manifest.js";
|
|
94
94
|
import { classifyFailure } from "./recovery-classification.js";
|
|
95
|
+
import { supportsStructuredQuestions } from "./workflow-mcp.js";
|
|
95
96
|
import { WorktreeLifecycle, } from "./worktree-lifecycle.js";
|
|
96
97
|
import { WorktreeStateProjection } from "./worktree-state-projection.js";
|
|
97
98
|
import { reorderForCaching } from "./prompt-ordering.js";
|
|
@@ -706,18 +707,17 @@ export async function cleanupAfterLoopExit(ctx) {
|
|
|
706
707
|
// visible so the user still has a resumable auto-mode signal on screen.
|
|
707
708
|
if (!s.paused) {
|
|
708
709
|
ctx.ui.setStatus("gsd-auto", undefined);
|
|
710
|
+
ctx.ui.setWidget("gsd-progress", undefined);
|
|
709
711
|
if (s.completionStopInProgress) {
|
|
710
712
|
s.completionStopInProgress = false;
|
|
711
713
|
}
|
|
712
714
|
initHealthWidget(ctx);
|
|
713
715
|
}
|
|
714
|
-
// ADR-016 phase 3 (#5693): the stop-path basePath restore routes
|
|
715
|
-
// `Lifecycle.restoreToProjectRoot()`, the sole owner of
|
|
716
|
-
//
|
|
717
|
-
//
|
|
718
|
-
//
|
|
719
|
-
// The chdir stays here because `restoreToProjectRoot` is a pure
|
|
720
|
-
// session-state mutation.
|
|
716
|
+
// ADR-016 phase 3 (#5693): the stop-path basePath restore + chdir routes
|
|
717
|
+
// through `Lifecycle.restoreToProjectRoot()`, the sole owner of both
|
|
718
|
+
// `s.basePath` mutation and the paired `process.chdir` for auto-loop
|
|
719
|
+
// transitions. The verb assigns `s.basePath` before any throwable work, so
|
|
720
|
+
// a thrown error still leaves basePath restored.
|
|
721
721
|
if (s.originalBasePath) {
|
|
722
722
|
try {
|
|
723
723
|
buildLifecycle().restoreToProjectRoot();
|
|
@@ -725,12 +725,6 @@ export async function cleanupAfterLoopExit(ctx) {
|
|
|
725
725
|
catch (err) {
|
|
726
726
|
logWarning("engine", `restore project root failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
727
727
|
}
|
|
728
|
-
try {
|
|
729
|
-
process.chdir(s.originalBasePath);
|
|
730
|
-
}
|
|
731
|
-
catch (err) {
|
|
732
|
-
logWarning("engine", `basePath restore/chdir failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
733
|
-
}
|
|
734
728
|
}
|
|
735
729
|
if (s.originalBasePath && s.cmdCtx) {
|
|
736
730
|
const result = await rerootCommandSession(s.cmdCtx, s.originalBasePath);
|
|
@@ -1001,8 +995,8 @@ export async function stopAuto(ctx, pi, reason, options = {}) {
|
|
|
1001
995
|
}
|
|
1002
996
|
}
|
|
1003
997
|
// ── Step 7: Restore basePath and chdir (ADR-016 phase 3, #5693) ──
|
|
1004
|
-
// `restoreToProjectRoot`
|
|
1005
|
-
// no
|
|
998
|
+
// `restoreToProjectRoot` owns both s.basePath restore and process.chdir;
|
|
999
|
+
// no paired chdir is needed at the call site.
|
|
1006
1000
|
if (s.originalBasePath) {
|
|
1007
1001
|
try {
|
|
1008
1002
|
buildLifecycle().restoreToProjectRoot();
|
|
@@ -1010,13 +1004,6 @@ export async function stopAuto(ctx, pi, reason, options = {}) {
|
|
|
1010
1004
|
catch (e) {
|
|
1011
1005
|
debugLog("stop-cleanup-basepath", { error: e instanceof Error ? e.message : String(e) });
|
|
1012
1006
|
}
|
|
1013
|
-
try {
|
|
1014
|
-
process.chdir(s.basePath);
|
|
1015
|
-
}
|
|
1016
|
-
catch (err) {
|
|
1017
|
-
/* best-effort */
|
|
1018
|
-
logWarning("engine", `chdir failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
1019
|
-
}
|
|
1020
1007
|
}
|
|
1021
1008
|
// Re-root the active command session/tool runtime after worktree teardown.
|
|
1022
1009
|
// mergeAndExit restores process.cwd(), but AgentSession has already captured
|
|
@@ -1385,6 +1372,73 @@ export function buildWorktreeLifecycleDeps() {
|
|
|
1385
1372
|
function buildLifecycle() {
|
|
1386
1373
|
return new WorktreeLifecycle(s, buildWorktreeLifecycleDeps());
|
|
1387
1374
|
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Build the production `DispatchAdapter` used by `createWiredAutoOrchestrationModule`.
|
|
1377
|
+
*
|
|
1378
|
+
* Exported so tests can verify parity with `runDispatch`'s `resolveDispatch` call —
|
|
1379
|
+
* the wired adapter must derive `structuredQuestionsAvailable`, `sessionContextWindow`,
|
|
1380
|
+
* `sessionProvider`, and `modelRegistry` the same way phases.ts:runDispatch does.
|
|
1381
|
+
*/
|
|
1382
|
+
export function createWiredDispatchAdapter(ctx, pi, dispatchBasePath) {
|
|
1383
|
+
return {
|
|
1384
|
+
async decideNextUnit(input) {
|
|
1385
|
+
const state = input.stateSnapshot;
|
|
1386
|
+
const active = state.activeMilestone;
|
|
1387
|
+
if (!active)
|
|
1388
|
+
return null;
|
|
1389
|
+
const prefs = loadEffectiveGSDPreferences(dispatchBasePath)?.preferences;
|
|
1390
|
+
// Derive session-derived dispatch inputs the same way phases.ts:runDispatch does
|
|
1391
|
+
// (#5789). Prefer caller-supplied values when present so test harnesses and
|
|
1392
|
+
// alternative wirings can inject deterministic snapshots; otherwise pull from
|
|
1393
|
+
// the captured pi/ctx references.
|
|
1394
|
+
const sessionProvider = input.sessionProvider ?? ctx.model?.provider;
|
|
1395
|
+
const sessionContextWindow = input.sessionContextWindow ?? ctx.model?.contextWindow;
|
|
1396
|
+
const modelRegistry = input.modelRegistry ?? ctx.modelRegistry;
|
|
1397
|
+
const authMode = sessionProvider && typeof ctx.modelRegistry?.getProviderAuthMode === "function"
|
|
1398
|
+
? ctx.modelRegistry.getProviderAuthMode(sessionProvider)
|
|
1399
|
+
: undefined;
|
|
1400
|
+
const activeTools = typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [];
|
|
1401
|
+
// Mirrors runDispatch: deep-planning keeps approval gates in plain chat
|
|
1402
|
+
// because structured questions can be cancelled outside the chat turn on
|
|
1403
|
+
// some transports.
|
|
1404
|
+
const structuredQuestionsAvailable = input.structuredQuestionsAvailable ??
|
|
1405
|
+
(prefs?.planning_depth === "deep"
|
|
1406
|
+
? "false"
|
|
1407
|
+
: supportsStructuredQuestions(activeTools, {
|
|
1408
|
+
authMode,
|
|
1409
|
+
baseUrl: ctx.model?.baseUrl,
|
|
1410
|
+
})
|
|
1411
|
+
? "true"
|
|
1412
|
+
: "false");
|
|
1413
|
+
const action = await resolveDispatch({
|
|
1414
|
+
basePath: dispatchBasePath,
|
|
1415
|
+
mid: active.id,
|
|
1416
|
+
midTitle: active.title,
|
|
1417
|
+
state,
|
|
1418
|
+
prefs,
|
|
1419
|
+
structuredQuestionsAvailable,
|
|
1420
|
+
sessionContextWindow,
|
|
1421
|
+
sessionProvider,
|
|
1422
|
+
modelRegistry,
|
|
1423
|
+
});
|
|
1424
|
+
if (action.action === "stop") {
|
|
1425
|
+
return {
|
|
1426
|
+
kind: "blocked",
|
|
1427
|
+
reason: action.reason,
|
|
1428
|
+
action: action.level === "warning" ? "pause" : "stop",
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
if (action.action !== "dispatch")
|
|
1432
|
+
return null;
|
|
1433
|
+
return {
|
|
1434
|
+
unitType: action.unitType,
|
|
1435
|
+
unitId: action.unitId,
|
|
1436
|
+
reason: action.matchedRule ?? "dispatch",
|
|
1437
|
+
preconditions: [],
|
|
1438
|
+
};
|
|
1439
|
+
},
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1388
1442
|
/**
|
|
1389
1443
|
* Thin entry glue for the new Auto Orchestration module.
|
|
1390
1444
|
*
|
|
@@ -1392,7 +1446,7 @@ function buildLifecycle() {
|
|
|
1392
1446
|
* no behavior changes to the existing auto loop. It provides a concrete seam
|
|
1393
1447
|
* the next refactor steps can adopt incrementally.
|
|
1394
1448
|
*/
|
|
1395
|
-
export function createWiredAutoOrchestrationModule(ctx,
|
|
1449
|
+
export function createWiredAutoOrchestrationModule(ctx, pi, dispatchBasePath, runtimeBasePath = resolveProjectRoot(dispatchBasePath)) {
|
|
1396
1450
|
const flowId = `auto-orchestrator-${Date.now()}`;
|
|
1397
1451
|
let seq = 0;
|
|
1398
1452
|
const deps = {
|
|
@@ -1416,30 +1470,7 @@ export function createWiredAutoOrchestrationModule(ctx, _pi, dispatchBasePath, r
|
|
|
1416
1470
|
};
|
|
1417
1471
|
},
|
|
1418
1472
|
},
|
|
1419
|
-
dispatch:
|
|
1420
|
-
async decideNextUnit(input) {
|
|
1421
|
-
const state = input.stateSnapshot;
|
|
1422
|
-
const active = state.activeMilestone;
|
|
1423
|
-
if (!active)
|
|
1424
|
-
return null;
|
|
1425
|
-
const prefs = loadEffectiveGSDPreferences(dispatchBasePath)?.preferences;
|
|
1426
|
-
const action = await resolveDispatch({
|
|
1427
|
-
basePath: dispatchBasePath,
|
|
1428
|
-
mid: active.id,
|
|
1429
|
-
midTitle: active.title,
|
|
1430
|
-
state,
|
|
1431
|
-
prefs,
|
|
1432
|
-
});
|
|
1433
|
-
if (action.action !== "dispatch")
|
|
1434
|
-
return null;
|
|
1435
|
-
return {
|
|
1436
|
-
unitType: action.unitType,
|
|
1437
|
-
unitId: action.unitId,
|
|
1438
|
-
reason: action.matchedRule ?? "dispatch",
|
|
1439
|
-
preconditions: [],
|
|
1440
|
-
};
|
|
1441
|
-
},
|
|
1442
|
-
},
|
|
1473
|
+
dispatch: createWiredDispatchAdapter(ctx, pi, dispatchBasePath),
|
|
1443
1474
|
recovery: {
|
|
1444
1475
|
async classifyAndRecover(input) {
|
|
1445
1476
|
const recovery = classifyFailure(input);
|
|
@@ -1488,12 +1519,26 @@ export function createWiredAutoOrchestrationModule(ctx, _pi, dispatchBasePath, r
|
|
|
1488
1519
|
async cleanupOnStop() { },
|
|
1489
1520
|
},
|
|
1490
1521
|
health: {
|
|
1522
|
+
checkResourcesStale() {
|
|
1523
|
+
return checkResourcesStale(s.resourceVersionOnStart);
|
|
1524
|
+
},
|
|
1491
1525
|
async preAdvanceGate() {
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1526
|
+
try {
|
|
1527
|
+
const gate = await preDispatchHealthGate(dispatchBasePath);
|
|
1528
|
+
if (gate.proceed) {
|
|
1529
|
+
return {
|
|
1530
|
+
kind: "pass",
|
|
1531
|
+
fixesApplied: gate.fixesApplied,
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
return {
|
|
1535
|
+
kind: "fail",
|
|
1536
|
+
reason: gate.reason ?? "Pre-dispatch health check failed — run /gsd doctor for details.",
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
catch (error) {
|
|
1540
|
+
return { kind: "threw", error };
|
|
1541
|
+
}
|
|
1497
1542
|
},
|
|
1498
1543
|
async postAdvanceRecord(result) {
|
|
1499
1544
|
if (result.kind === "error") {
|
|
@@ -1561,9 +1606,59 @@ export function createWiredAutoOrchestrationModule(ctx, _pi, dispatchBasePath, r
|
|
|
1561
1606
|
}
|
|
1562
1607
|
},
|
|
1563
1608
|
},
|
|
1609
|
+
uokGate: {
|
|
1610
|
+
async emit(input) {
|
|
1611
|
+
const prefs = loadEffectiveGSDPreferences(dispatchBasePath)?.preferences;
|
|
1612
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
1613
|
+
if (!uokFlags.gates)
|
|
1614
|
+
return;
|
|
1615
|
+
const milestoneId = input.milestoneId ?? s.currentMilestoneId ?? undefined;
|
|
1616
|
+
try {
|
|
1617
|
+
const { UokGateRunner } = await import("./uok/gate-runner.js");
|
|
1618
|
+
const runner = new UokGateRunner();
|
|
1619
|
+
runner.register({
|
|
1620
|
+
id: input.gateId,
|
|
1621
|
+
type: input.gateType,
|
|
1622
|
+
execute: async () => ({
|
|
1623
|
+
outcome: input.outcome,
|
|
1624
|
+
failureClass: input.failureClass,
|
|
1625
|
+
rationale: input.rationale,
|
|
1626
|
+
findings: input.findings ?? "",
|
|
1627
|
+
}),
|
|
1628
|
+
});
|
|
1629
|
+
await runner.run(input.gateId, {
|
|
1630
|
+
basePath: dispatchBasePath,
|
|
1631
|
+
traceId: `pre-dispatch:${flowId}`,
|
|
1632
|
+
turnId: `orch-${seq}`,
|
|
1633
|
+
milestoneId,
|
|
1634
|
+
unitType: "pre-dispatch",
|
|
1635
|
+
unitId: `orch-${seq}`,
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
catch (err) {
|
|
1639
|
+
logWarning("engine", `uok gate emit failed: ${getErrorMessage(err)}`, {
|
|
1640
|
+
file: "auto.ts",
|
|
1641
|
+
gateId: input.gateId,
|
|
1642
|
+
gateType: input.gateType,
|
|
1643
|
+
...(milestoneId ? { milestoneId } : {}),
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
},
|
|
1564
1648
|
};
|
|
1565
1649
|
return createAutoOrchestrator(deps);
|
|
1566
1650
|
}
|
|
1651
|
+
function notifyResumeBlocked(ctx, result) {
|
|
1652
|
+
const resumeCmd = s.stepMode ? "/gsd next" : "/gsd auto";
|
|
1653
|
+
ctx.ui.notify(`Auto-mode blocked: ${result.reason}. Fix and run ${resumeCmd} to resume.`, "warning");
|
|
1654
|
+
setLifecycleOutcome(ctx, {
|
|
1655
|
+
status: "blocked",
|
|
1656
|
+
title: "Auto-mode blocked",
|
|
1657
|
+
detail: result.reason,
|
|
1658
|
+
nextAction: `Fix the blocker, then run ${resumeCmd} to resume.`,
|
|
1659
|
+
commands: ["/gsd status for overview", `${resumeCmd} to resume`, "/gsd doctor to diagnose"],
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1567
1662
|
function ensureOrchestrationModule(ctx, pi, basePath) {
|
|
1568
1663
|
s.orchestration = createWiredAutoOrchestrationModule(ctx, pi, basePath, lockBase());
|
|
1569
1664
|
}
|
|
@@ -1848,7 +1943,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1848
1943
|
// This closes the journal gap reported in #3348 where the worker wrote side
|
|
1849
1944
|
// effects (SUMMARY.md, DB updates) but died before emitting unit-end.
|
|
1850
1945
|
emitCrashRecoveredUnitEnd(base, freshStartAssessment.lock);
|
|
1851
|
-
|
|
1946
|
+
clearStaleWorkerLock(base);
|
|
1852
1947
|
}
|
|
1853
1948
|
if (!s.paused) {
|
|
1854
1949
|
s.pendingCrashRecovery =
|
|
@@ -1911,6 +2006,8 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1911
2006
|
initMetrics(base);
|
|
1912
2007
|
if (s.currentMilestoneId)
|
|
1913
2008
|
setActiveMilestoneId(base, s.currentMilestoneId);
|
|
2009
|
+
await openProjectDbIfPresent(base);
|
|
2010
|
+
registerAutoWorkerForSession(s, base);
|
|
1914
2011
|
// Re-register health level notification callback lost across process restart
|
|
1915
2012
|
setLevelChangeCallback((_from, to, summary) => {
|
|
1916
2013
|
const level = to === "red" ? "error" : to === "yellow" ? "warning" : "info";
|
|
@@ -1986,7 +2083,12 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1986
2083
|
}
|
|
1987
2084
|
pi.events.emit(CMUX_CHANNELS.LOG, { preferences: loadEffectiveGSDPreferences(s.basePath || undefined)?.preferences, message: s.stepMode ? "Step-mode resumed." : "Auto-mode resumed.", level: "progress" });
|
|
1988
2085
|
try {
|
|
1989
|
-
await s.orchestration?.resume();
|
|
2086
|
+
const resumeResult = await s.orchestration?.resume();
|
|
2087
|
+
if (resumeResult?.kind === "blocked") {
|
|
2088
|
+
notifyResumeBlocked(ctx, resumeResult);
|
|
2089
|
+
await cleanupAfterLoopExit(ctx);
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
1990
2092
|
}
|
|
1991
2093
|
catch (err) {
|
|
1992
2094
|
debugLog("resume-orchestration-resume", { error: err instanceof Error ? err.message : String(err) });
|
|
@@ -2007,6 +2109,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
2007
2109
|
const bootstrapDeps = {
|
|
2008
2110
|
shouldUseWorktreeIsolation,
|
|
2009
2111
|
registerSigtermHandler,
|
|
2112
|
+
registerAutoWorkerForSession: (projectRoot) => registerAutoWorkerForSession(s, projectRoot),
|
|
2010
2113
|
lockBase,
|
|
2011
2114
|
buildLifecycle,
|
|
2012
2115
|
};
|
|
@@ -18,6 +18,9 @@ const MAX_NETWORK_RETRIES = 2;
|
|
|
18
18
|
function isObjectRecord(value) {
|
|
19
19
|
return !!value && typeof value === "object";
|
|
20
20
|
}
|
|
21
|
+
export function _hasEmptyAgentEndContent(content) {
|
|
22
|
+
return content == null || (Array.isArray(content) && content.length === 0);
|
|
23
|
+
}
|
|
21
24
|
/**
|
|
22
25
|
* Cap on auto-resume attempts for sustained transient-provider errors.
|
|
23
26
|
*
|
|
@@ -246,7 +249,7 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
246
249
|
// that carry error context — e.g. errorMessage field or non-empty content
|
|
247
250
|
// indicating a mid-stream failure. (#2695)
|
|
248
251
|
const content = "content" in lastMsg ? lastMsg.content : undefined;
|
|
249
|
-
const hasEmptyContent =
|
|
252
|
+
const hasEmptyContent = _hasEmptyAgentEndContent(content);
|
|
250
253
|
const hasErrorMessage = "errorMessage" in lastMsg && !!lastMsg.errorMessage;
|
|
251
254
|
if (hasEmptyContent && !hasErrorMessage) {
|
|
252
255
|
// Non-fatal: treat as a normal agent end so the loop can continue
|
|
@@ -468,17 +468,18 @@ export function registerDbTools(pi) {
|
|
|
468
468
|
promptGuidelines: [
|
|
469
469
|
"Use gsd_plan_milestone for milestone planning instead of writing ROADMAP.md directly.",
|
|
470
470
|
"Keep parameters flat and provide the full milestone planning payload, including slices.",
|
|
471
|
+
"Milestone and slice titles must not contain forward slash (/), en dash, or em dash characters.",
|
|
471
472
|
"The tool validates input, writes milestone and slice planning data transactionally, renders ROADMAP.md from DB, and clears both state and parse caches after success.",
|
|
472
473
|
"Use the canonical name gsd_plan_milestone; gsd_milestone_plan is only an alias.",
|
|
473
474
|
],
|
|
474
475
|
parameters: Type.Object({
|
|
475
476
|
// ── Core identification + content (required) ──────────────────────
|
|
476
477
|
milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
|
|
477
|
-
title: Type.String({ description: "Milestone title" }),
|
|
478
|
+
title: Type.String({ description: "Milestone title; must not contain forward slash (/), en dash, or em dash characters" }),
|
|
478
479
|
vision: Type.String({ description: "Milestone vision" }),
|
|
479
480
|
slices: Type.Array(Type.Object({
|
|
480
481
|
sliceId: Type.String({ description: "Slice ID (e.g. S01)" }),
|
|
481
|
-
title: Type.String({ description: "Slice title" }),
|
|
482
|
+
title: Type.String({ description: "Slice title; must not contain forward slash (/), en dash, or em dash characters" }),
|
|
482
483
|
risk: Type.String({ description: "Slice risk" }),
|
|
483
484
|
depends: Type.Array(Type.String(), { description: "Slice dependency IDs" }),
|
|
484
485
|
demo: Type.String({ description: "Roadmap demo text / After this" }),
|
|
@@ -546,10 +547,10 @@ export function registerDbTools(pi) {
|
|
|
546
547
|
title: Type.String({ description: "Task title" }),
|
|
547
548
|
description: Type.String({ description: "Task description / steps block" }),
|
|
548
549
|
estimate: Type.String({ description: "Task estimate string" }),
|
|
549
|
-
files: Type.Array(Type.String(), { description: "
|
|
550
|
+
files: Type.Array(Type.String(), { description: "Array<string> of files likely touched; pass [\"path\"] or [], never a single string" }),
|
|
550
551
|
verify: Type.String({ description: "Verification command or block" }),
|
|
551
|
-
inputs: Type.Array(Type.String(), { description: "
|
|
552
|
-
expectedOutput: Type.Array(Type.String(), { description: "
|
|
552
|
+
inputs: Type.Array(Type.String(), { description: "Array<string> of input files or references; pass [\"path\"] or [], never a single string" }),
|
|
553
|
+
expectedOutput: Type.Array(Type.String(), { description: "Array<string> of expected output files or artifacts; pass [\"path\"] or [], never a single string" }),
|
|
553
554
|
observabilityImpact: Type.Optional(Type.String({ description: "Task observability impact" })),
|
|
554
555
|
}), { description: "Planned tasks for the slice" }),
|
|
555
556
|
// ── Enrichment metadata (optional — defaults to empty) ────────────
|
|
@@ -622,10 +623,10 @@ export function registerDbTools(pi) {
|
|
|
622
623
|
title: Type.String({ description: "Task title" }),
|
|
623
624
|
description: Type.String({ description: "Task description / steps block" }),
|
|
624
625
|
estimate: Type.String({ description: "Task estimate string" }),
|
|
625
|
-
files: Type.Array(Type.String(), { description: "
|
|
626
|
+
files: Type.Array(Type.String(), { description: "Array<string> of files likely touched; pass [\"path\"] or [], never a single string" }),
|
|
626
627
|
verify: Type.String({ description: "Verification command or block" }),
|
|
627
|
-
inputs: Type.Array(Type.String(), { description: "
|
|
628
|
-
expectedOutput: Type.Array(Type.String(), { description: "
|
|
628
|
+
inputs: Type.Array(Type.String(), { description: "Array<string> of input files or references; pass [\"path\"] or [], never a single string" }),
|
|
629
|
+
expectedOutput: Type.Array(Type.String(), { description: "Array<string> of expected output files or artifacts; pass [\"path\"] or [], never a single string" }),
|
|
629
630
|
observabilityImpact: Type.Optional(Type.String({ description: "Task observability impact" })),
|
|
630
631
|
// Single-writer v3 audit trail (Stream 2): caller-provided actor identity + causation.
|
|
631
632
|
actorName: Type.Optional(Type.String({ description: "Caller-provided actor identity for the audit trail (e.g. 'executor-01', 'gsd-orchestrator')" })),
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
export function extractSubagentAgentClasses(input) {
|
|
2
2
|
if (!input || typeof input !== "object")
|
|
3
3
|
return [];
|
|
4
|
-
const record = input;
|
|
5
4
|
const agentClasses = [];
|
|
5
|
+
const visited = new WeakSet();
|
|
6
6
|
const addAgentClass = (value) => {
|
|
7
|
-
if (typeof value
|
|
8
|
-
|
|
7
|
+
if (typeof value !== "string")
|
|
8
|
+
return;
|
|
9
|
+
const normalized = value.trim().replace(/\.md$/i, "");
|
|
10
|
+
if (normalized.length > 0)
|
|
11
|
+
agentClasses.push(normalized);
|
|
9
12
|
};
|
|
10
|
-
const
|
|
13
|
+
const visitItems = (value) => {
|
|
11
14
|
if (!Array.isArray(value))
|
|
12
15
|
return;
|
|
13
16
|
for (const item of value) {
|
|
14
|
-
|
|
15
|
-
addAgentClass(item.agent);
|
|
17
|
+
visit(item);
|
|
16
18
|
}
|
|
17
19
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const visit = (value) => {
|
|
21
|
+
if (!value || typeof value !== "object")
|
|
22
|
+
return;
|
|
23
|
+
if (visited.has(value))
|
|
24
|
+
return;
|
|
25
|
+
visited.add(value);
|
|
26
|
+
const record = value;
|
|
27
|
+
addAgentClass(record.agent);
|
|
28
|
+
visitItems(record.tasks);
|
|
29
|
+
visitItems(record.chain);
|
|
30
|
+
visitItems(record.parallel);
|
|
31
|
+
};
|
|
32
|
+
visit(input);
|
|
21
33
|
return agentClasses;
|
|
22
34
|
}
|
|
@@ -3,6 +3,7 @@ import { copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, readlinkS
|
|
|
3
3
|
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
4
|
import { minimatch } from "minimatch";
|
|
5
5
|
import { getIsolationMode } from "../preferences.js";
|
|
6
|
+
import { compileSubagentPermissionContract } from "../unit-context-manifest.js";
|
|
6
7
|
import { logWarning } from "../workflow-logger.js";
|
|
7
8
|
import { isGsdWorktreePath, resolveWorktreeProjectRoot } from "../worktree-root.js";
|
|
8
9
|
/**
|
|
@@ -58,6 +59,7 @@ const QUEUE_SAFE_TOOLS = new Set([
|
|
|
58
59
|
* true / false — shell no-ops / test exit codes
|
|
59
60
|
*/
|
|
60
61
|
const BASH_READ_ONLY_RE = /^\s*(cat|head|tail|less|more|wc|file|stat|du|df|which|type|echo|printf|ls|find|grep|rg|awk|sed\b(?!.*-i)|sort|uniq|diff|comm|tr|cut|tee\s+-a\s+\/dev\/null|git\s+(log|show|diff|status|branch|tag|remote|rev-parse|ls-files|blame|shortlog|describe|stash\s+list|config\s+--get|cat-file)|gh\s+(issue|pr|api|repo|release)\s+(view|list|diff|status|checks)|mkdir\s+-p\s+\.gsd|rtk\s|npm\s+run\s+(test|test:\w+|lint|lint:\w+|typecheck|type-check|type-check:\w+|check|verify|audit|outdated|format:check|ci|validate)\b|npm\s+(ls|list|info|view|show|outdated|audit|explain|doctor|ping|--version|-v)\b|npx\s|tsx\s|node\s+(--print|--version|-v\b)|python[23]?\s+(-c\s+'[^']*'|--version|-V\b|-m\s+(pip\s+show|pip\s+list|site))|pip[23]?\s+(show|list|freeze|check|index\s+versions)\b|jq\s|yq\s|curl\s+(-s\b|--silent\b)(?!\s+[^|>]*\s-[oO]\b)(?!\s+[^|>]*\s--output\b)[^|>]*$|openssl\s+(version|x509|s_client)|env\b|printenv\b|true\b|false\b)/;
|
|
62
|
+
const BASH_VERIFICATION_RE = /^\s*(npm\s+(run\s+(build|test|test:\w+|lint|lint:\w+|typecheck|type-check|verify|ci|validate)\b|test\b)|pnpm\s+(build|test|lint|typecheck|verify)\b|yarn\s+(build|test|lint|typecheck|verify)\b|vitest\b|jest\b|go\s+test\b)/;
|
|
61
63
|
function createEmptyWriteGateState() {
|
|
62
64
|
return {
|
|
63
65
|
verifiedDepthMilestones: new Set(),
|
|
@@ -642,6 +644,9 @@ function blockReason(unitType, mode, what) {
|
|
|
642
644
|
* and listed in the policy's allowedSubagents.
|
|
643
645
|
* - "docs" → like "planning" but also allows writes to paths
|
|
644
646
|
* matching `allowedPathGlobs` relative to basePath.
|
|
647
|
+
* - "verification"
|
|
648
|
+
* → allows Bash for project verification commands, but keeps
|
|
649
|
+
* writes restricted to .gsd/ and blocks subagent dispatch.
|
|
645
650
|
*
|
|
646
651
|
* `pathOrCommand` is the file path for write/edit-shaped tools and the
|
|
647
652
|
* shell command for bash. Other tools ignore this argument.
|
|
@@ -673,7 +678,7 @@ export function shouldBlockPlanningUnit(toolName, pathOrCommand, basePath, unitT
|
|
|
673
678
|
// Unknown tool in read-only mode — block by default.
|
|
674
679
|
return { block: true, reason: blockReason(unitType, policy.mode, `tool "${tool}" is not on the read-only allowlist`) };
|
|
675
680
|
}
|
|
676
|
-
// planning / planning-dispatch / docs modes share the same surface for safe tools, bash, and subagent.
|
|
681
|
+
// planning / planning-dispatch / docs / verification modes share the same surface for safe tools, bash, and subagent.
|
|
677
682
|
if (PLANNING_SAFE_TOOLS.has(tool))
|
|
678
683
|
return { block: false };
|
|
679
684
|
if (tool.startsWith("gsd_"))
|
|
@@ -681,7 +686,8 @@ export function shouldBlockPlanningUnit(toolName, pathOrCommand, basePath, unitT
|
|
|
681
686
|
if (PLANNING_SUBAGENT_TOOLS.has(tool)) {
|
|
682
687
|
if (policy.mode === "planning-dispatch") {
|
|
683
688
|
const requested = (agentClasses ?? []).map(a => a.trim()).filter(Boolean);
|
|
684
|
-
const
|
|
689
|
+
const dispatchContract = compileSubagentPermissionContract(policy);
|
|
690
|
+
const allowedSubagents = dispatchContract.allowedSubagents;
|
|
685
691
|
const allowed = new Set(allowedSubagents);
|
|
686
692
|
// When agentClasses is undefined, the caller has not been updated to extract
|
|
687
693
|
// agent identities yet. Block and warn so stale callers surface in telemetry
|
|
@@ -718,6 +724,14 @@ export function shouldBlockPlanningUnit(toolName, pathOrCommand, basePath, unitT
|
|
|
718
724
|
return { block: true, reason: blockReason(unitType, policy.mode, `subagent dispatch is not permitted in planning units`) };
|
|
719
725
|
}
|
|
720
726
|
if (tool === "bash") {
|
|
727
|
+
if (policy.mode === "verification") {
|
|
728
|
+
if (BASH_VERIFICATION_RE.test(pathOrCommand) || BASH_READ_ONLY_RE.test(pathOrCommand))
|
|
729
|
+
return { block: false };
|
|
730
|
+
return {
|
|
731
|
+
block: true,
|
|
732
|
+
reason: blockReason(unitType, policy.mode, `bash is restricted to build/test verification commands (npm run build, npm test, etc.); cannot run "${pathOrCommand.slice(0, 80)}${pathOrCommand.length > 80 ? "…" : ""}"`),
|
|
733
|
+
};
|
|
734
|
+
}
|
|
721
735
|
if (BASH_READ_ONLY_RE.test(pathOrCommand))
|
|
722
736
|
return { block: false };
|
|
723
737
|
return {
|