@opengsd/gsd-pi 1.2.0-dev.844675c9 → 1.2.0-dev.84c56d87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-style.d.ts +17 -0
- package/dist/cli-style.js +28 -0
- package/dist/cli-web-branch.d.ts +2 -0
- package/dist/cli-web-branch.js +9 -2
- package/dist/cli.js +1 -1
- package/dist/headless-events.d.ts +4 -2
- package/dist/headless-events.js +7 -29
- package/dist/help-text.js +5 -0
- package/dist/models-resolver.d.ts +3 -13
- package/dist/models-resolver.js +3 -22
- package/dist/resource-loader.js +2 -14
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/ask-user-questions.js +78 -23
- package/dist/resources/extensions/bg-shell/utilities.js +5 -2
- package/dist/resources/extensions/browser-tools/engine/managed-gsd-browser.js +209 -88
- package/dist/resources/extensions/browser-tools/engine/selection.js +73 -5
- package/dist/resources/extensions/browser-tools/index.js +69 -12
- package/dist/resources/extensions/claude-code-cli/models.js +9 -0
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +122 -234
- package/dist/resources/extensions/claude-code-cli/turn-assembler.js +224 -0
- package/dist/resources/extensions/github-sync/templates.js +3 -3
- package/dist/resources/extensions/gsd/artifact-projection.js +14 -0
- package/dist/resources/extensions/gsd/auto/loop.js +74 -56
- package/dist/resources/extensions/gsd/auto/orchestrator.js +142 -15
- package/dist/resources/extensions/gsd/auto/phases.js +34 -4
- package/dist/resources/extensions/gsd/auto/run-unit.js +2 -1
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +16 -4
- package/dist/resources/extensions/gsd/auto-dispatch.js +6 -5
- package/dist/resources/extensions/gsd/auto-model-selection.js +8 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +23 -11
- package/dist/resources/extensions/gsd/auto-prompts.js +84 -8
- package/dist/resources/extensions/gsd/auto-recovery.js +48 -49
- package/dist/resources/extensions/gsd/auto-runtime-state.js +14 -0
- package/dist/resources/extensions/gsd/auto-start.js +24 -37
- package/dist/resources/extensions/gsd/auto-timers.js +16 -2
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +50 -0
- package/dist/resources/extensions/gsd/auto-unit-tool-scope.js +11 -45
- package/dist/resources/extensions/gsd/auto-verification.js +7 -7
- package/dist/resources/extensions/gsd/auto-worktree-repair.js +10 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +53 -368
- package/dist/resources/extensions/gsd/auto.js +19 -27
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +3 -2
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +28 -37
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +20 -43
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +19 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +209 -149
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +93 -8
- package/dist/resources/extensions/gsd/branch-patterns.js +2 -0
- package/dist/resources/extensions/gsd/browser-evidence.js +8 -2
- package/dist/resources/extensions/gsd/captures.js +5 -15
- package/dist/resources/extensions/gsd/closeout-consistency-gate.js +21 -4
- package/dist/resources/extensions/gsd/closeout-recovery.js +3 -2
- package/dist/resources/extensions/gsd/codebase-generator.js +8 -4
- package/dist/resources/extensions/gsd/commands/catalog.js +6 -62
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +3 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +20 -0
- package/dist/resources/extensions/gsd/commands-inspect.js +4 -8
- package/dist/resources/extensions/gsd/commands-maintenance.js +61 -41
- package/dist/resources/extensions/gsd/commands-ship.js +2 -2
- package/dist/resources/extensions/gsd/commands-verdict.js +12 -2
- package/dist/resources/extensions/gsd/crash-recovery.js +4 -12
- package/dist/resources/extensions/gsd/db/engine.js +755 -0
- package/dist/resources/extensions/gsd/db/queries.js +372 -0
- package/dist/resources/extensions/gsd/db/sql-constants.js +11 -0
- package/dist/resources/extensions/gsd/db/writers/cascades.js +194 -0
- package/dist/resources/extensions/gsd/db/writers/import-restore.js +182 -0
- package/dist/resources/extensions/gsd/db/writers/memory.js +149 -0
- package/dist/resources/extensions/gsd/db/writers/reconcile.js +458 -0
- package/dist/resources/extensions/gsd/db/writers/status.js +70 -0
- package/dist/resources/extensions/gsd/db-workspace.js +103 -0
- package/dist/resources/extensions/gsd/delegation-policy.js +2 -10
- package/dist/resources/extensions/gsd/discussion-handoff.js +218 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +9 -0
- package/dist/resources/extensions/gsd/doctor-environment.js +5 -11
- package/dist/resources/extensions/gsd/doctor-format.js +9 -6
- package/dist/resources/extensions/gsd/doctor-git-checks.js +4 -3
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +21 -16
- package/dist/resources/extensions/gsd/doctor.js +16 -9
- package/dist/resources/extensions/gsd/error-classifier.js +10 -1
- package/dist/resources/extensions/gsd/git-conflict-state.js +16 -1
- package/dist/resources/extensions/gsd/git-service.js +1 -0
- package/dist/resources/extensions/gsd/gitignore.js +3 -0
- package/dist/resources/extensions/gsd/gsd-db.js +183 -2048
- package/dist/resources/extensions/gsd/guidance.js +98 -0
- package/dist/resources/extensions/gsd/guided-flow.js +83 -471
- package/dist/resources/extensions/gsd/guided-unit-completion.js +225 -0
- package/dist/resources/extensions/gsd/markdown-renderer.js +2 -1
- package/dist/resources/extensions/gsd/mcp-filter.js +4 -20
- package/dist/resources/extensions/gsd/mcp-tool-name.js +18 -0
- package/dist/resources/extensions/gsd/md-importer.js +4 -3
- package/dist/resources/extensions/gsd/memory-consolidation-scanner.js +1 -1
- package/dist/resources/extensions/gsd/migrate/safety.js +22 -11
- package/dist/resources/extensions/gsd/migration-auto-check.js +27 -5
- package/dist/resources/extensions/gsd/milestone-closeout-proof.js +72 -0
- package/dist/resources/extensions/gsd/milestone-closeout.js +12 -4
- package/dist/resources/extensions/gsd/milestone-merge-transaction.js +10 -0
- package/dist/resources/extensions/gsd/milestone-planning-persistence.js +156 -0
- package/dist/resources/extensions/gsd/milestone-readiness.js +77 -0
- package/dist/resources/extensions/gsd/milestone-settlement.js +50 -0
- package/dist/resources/extensions/gsd/milestone-validation-evidence.js +73 -0
- package/dist/resources/extensions/gsd/milestone-validation-verdict.js +57 -0
- package/dist/resources/extensions/gsd/model-cost-table.js +1 -0
- package/dist/resources/extensions/gsd/model-router.js +3 -0
- package/dist/resources/extensions/gsd/notification-store.js +11 -4
- package/dist/resources/extensions/gsd/parallel-eligibility.js +3 -6
- package/dist/resources/extensions/gsd/parallel-merge.js +14 -11
- package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +11 -7
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +3 -2
- package/dist/resources/extensions/gsd/paths.js +37 -24
- package/dist/resources/extensions/gsd/pre-execution-checks.js +91 -3
- package/dist/resources/extensions/gsd/preferences-diagnostics.js +67 -0
- package/dist/resources/extensions/gsd/preferences-models.js +12 -46
- package/dist/resources/extensions/gsd/preferences.js +161 -29
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/execute-task.md +2 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-project.md +3 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +2 -1
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -1
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/system.md +1 -1
- package/dist/resources/extensions/gsd/provider-error-guidance.js +1 -5
- package/dist/resources/extensions/gsd/provider-payload-policy.js +83 -0
- package/dist/resources/extensions/gsd/provider-switch-observer.js +1 -1
- package/dist/resources/extensions/gsd/publication.js +87 -0
- package/dist/resources/extensions/gsd/pull-request-process.js +13 -0
- package/dist/resources/extensions/gsd/quality-gate-closure.js +109 -0
- package/dist/resources/extensions/gsd/question-transport.js +86 -0
- package/dist/resources/extensions/gsd/recovery-classification.js +41 -87
- package/dist/resources/extensions/gsd/roadmap-slices.js +8 -2
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +37 -4
- package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +7 -2
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +10 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +3 -2
- package/dist/resources/extensions/gsd/state-transition-matrix.js +38 -0
- package/dist/resources/extensions/gsd/state.js +14 -25
- package/dist/resources/extensions/gsd/status-guards.js +56 -8
- package/dist/resources/extensions/gsd/stop-notice.js +57 -0
- package/dist/resources/extensions/gsd/templates/plan.md +7 -0
- package/dist/resources/extensions/gsd/templates/project.md +1 -0
- package/dist/resources/extensions/gsd/templates/roadmap.md +1 -1
- package/dist/resources/extensions/gsd/templates/uat.md +5 -1
- package/dist/resources/extensions/gsd/tool-contract.js +52 -8
- package/dist/resources/extensions/gsd/tool-presentation-plan.js +15 -34
- package/dist/resources/extensions/gsd/tool-surface-readiness.js +56 -0
- package/dist/resources/extensions/gsd/tool-surface-snapshot.js +17 -0
- package/dist/resources/extensions/gsd/tools/complete-slice.js +24 -43
- package/dist/resources/extensions/gsd/tools/exec-tool.js +5 -8
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +15 -143
- package/dist/resources/extensions/gsd/tools/plan-slice.js +12 -6
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +39 -0
- package/dist/resources/extensions/gsd/tools/reopen-milestone.js +11 -29
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +14 -33
- package/dist/resources/extensions/gsd/tools/skip-slice.js +18 -36
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +15 -78
- package/dist/resources/extensions/gsd/uat-policy.js +17 -10
- package/dist/resources/extensions/gsd/uat-run.js +9 -14
- package/dist/resources/extensions/gsd/undo.js +8 -7
- package/dist/resources/extensions/gsd/unit-closeout.js +138 -0
- package/dist/resources/extensions/gsd/unit-context-composer.js +49 -21
- package/dist/resources/extensions/gsd/unit-context-manifest.js +4 -27
- package/dist/resources/extensions/gsd/unit-registry.js +337 -0
- package/dist/resources/extensions/gsd/unit-runtime.js +3 -2
- package/dist/resources/extensions/gsd/unit-tool-contracts.js +9 -181
- package/dist/resources/extensions/gsd/user-input-boundary.js +23 -0
- package/dist/resources/extensions/gsd/validation-block-guard.js +2 -0
- package/dist/resources/extensions/gsd/web-app-uat.js +117 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +15 -102
- package/dist/resources/extensions/gsd/workflow-reconcile.js +4 -3
- package/dist/resources/extensions/gsd/workflow-tool-surface.js +46 -0
- package/dist/resources/extensions/gsd/workspace-git-guard.js +2 -0
- package/dist/resources/extensions/gsd/worktree-git-recovery.js +293 -0
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +9 -1
- package/dist/resources/extensions/gsd/worktree-manager.js +45 -28
- package/dist/resources/extensions/gsd/worktree-placement.js +59 -0
- package/dist/resources/extensions/gsd/worktree-reentry.js +12 -8
- package/dist/resources/extensions/gsd/worktree-root.js +28 -6
- package/dist/resources/extensions/gsd/worktree-safety.js +8 -5
- package/dist/resources/extensions/gsd/worktree-session-state.js +12 -11
- package/dist/resources/extensions/gsd/worktree-state-projection.js +33 -4
- package/dist/resources/extensions/gsd/worktree-telemetry.js +12 -0
- package/dist/resources/extensions/search-the-web/native-search.js +5 -3
- package/dist/resources/extensions/shared/browser-contract.js +59 -0
- package/dist/resources/extensions/shared/gsd-browser-cli.js +72 -4
- package/dist/resources/extensions/shared/interview-ui.js +2 -2
- package/dist/resources/shared/claude-runtime-floor.js +182 -0
- package/dist/resources/skills/create-skill/references/executable-code.md +1 -1
- package/dist/resources/skills/create-skill/workflows/add-reference.md +8 -3
- package/dist/resources/skills/create-skill/workflows/add-script.md +4 -2
- package/dist/resources/skills/create-skill/workflows/add-template.md +3 -1
- package/dist/resources/skills/create-skill/workflows/add-workflow.md +8 -3
- package/dist/resources/skills/create-skill/workflows/upgrade-to-router.md +10 -5
- package/dist/resources/skills/create-skill/workflows/verify-skill.md +9 -4
- package/dist/resources/skills/gsd-browser/SKILL.md +1 -1
- package/dist/resources/skills/spike-wrap-up/SKILL.md +9 -9
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/update-cmd.js +20 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +6 -6
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +8 -8
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/mcp-connections/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +6 -6
- package/dist/web/standalone/.next/server/chunks/5124.js +1 -1
- package/dist/web/standalone/.next/server/chunks/{5047.js → 5942.js} +2 -2
- package/dist/web/standalone/.next/server/chunks/8357.js +1 -1
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/2659.b7b129ee6a769448.js +1 -0
- package/dist/web/standalone/.next/static/chunks/2772.bfa657f49f955239.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{3616.4113d484a994e411.js → 3616.3c60753b8ffcbd2e.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/4283.e4873b058df143a1.js +2 -0
- package/dist/web/standalone/.next/static/chunks/5826.a46ecdd1cfe8dabc.js +1 -0
- package/dist/web/standalone/.next/static/chunks/796.cf859a427a2cb2ac.js +10 -0
- package/dist/web/standalone/.next/static/chunks/8785.2e5a118797fb2dd2.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-dda80a1ef5587410.js → webpack-fbea77b5f9953368.js} +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/dist/web/standalone/node_modules/postcss/lib/container.js +18 -26
- package/dist/web/standalone/node_modules/postcss/lib/css-syntax-error.js +14 -47
- package/dist/web/standalone/node_modules/postcss/lib/declaration.js +4 -4
- package/dist/web/standalone/node_modules/postcss/lib/fromJSON.js +3 -3
- package/dist/web/standalone/node_modules/postcss/lib/input.js +29 -54
- package/dist/web/standalone/node_modules/postcss/lib/lazy-result.js +37 -47
- package/dist/web/standalone/node_modules/postcss/lib/map-generator.js +9 -26
- package/dist/web/standalone/node_modules/postcss/lib/no-work-result.js +55 -57
- package/dist/web/standalone/node_modules/postcss/lib/node.js +31 -99
- package/dist/web/standalone/node_modules/postcss/lib/parse.js +1 -1
- package/dist/web/standalone/node_modules/postcss/lib/parser.js +9 -10
- package/dist/web/standalone/node_modules/postcss/lib/postcss.js +12 -12
- package/dist/web/standalone/node_modules/postcss/lib/previous-map.js +11 -30
- package/dist/web/standalone/node_modules/postcss/lib/processor.js +7 -7
- package/dist/web/standalone/node_modules/postcss/lib/result.js +5 -5
- package/dist/web/standalone/node_modules/postcss/lib/rule.js +6 -6
- package/dist/web/standalone/node_modules/postcss/lib/stringifier.js +28 -69
- package/dist/web/standalone/node_modules/postcss/lib/tokenize.js +2 -6
- package/dist/web/standalone/node_modules/postcss/package.json +48 -48
- package/dist/web/standalone/package.json +1 -1
- package/dist/web-mode.d.ts +2 -0
- package/dist/web-mode.js +20 -8
- package/dist/worktree-cli.js +3 -6
- package/dist/worktree-status-banner.js +7 -11
- package/package.json +2 -1
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/dist/workflow.d.ts +4 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.d.ts +2 -0
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.js +14 -0
- package/packages/gsd-agent-core/dist/session/agent-session-extensions.js.map +1 -1
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +3 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +106 -40
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.js +6 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/dist/cli.js +6 -3
- package/packages/mcp-server/dist/cli.js.map +1 -1
- package/packages/mcp-server/dist/server.d.ts +10 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +8 -0
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +49 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +48 -22
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +3 -3
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/image-models.generated.d.ts +2 -2
- package/packages/pi-ai/dist/image-models.generated.js +6 -6
- package/packages/pi-ai/dist/image-models.generated.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +455 -546
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +481 -599
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.js +3 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.js.map +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/dist/components/input.js +1 -1
- package/packages/pi-tui/dist/components/input.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +39 -30
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.js +22 -0
- package/packages/pi-tui/dist/stdin-buffer.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +9 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/extensions/ask-user-questions.ts +87 -24
- package/src/resources/extensions/bg-shell/utilities.ts +5 -2
- package/src/resources/extensions/browser-tools/engine/managed-gsd-browser.ts +265 -98
- package/src/resources/extensions/browser-tools/engine/selection.ts +90 -4
- package/src/resources/extensions/browser-tools/index.ts +71 -13
- package/src/resources/extensions/browser-tools/tests/browser-engine-selection.test.mjs +83 -13
- package/src/resources/extensions/browser-tools/tests/managed-gsd-browser-tools.test.mjs +136 -0
- package/src/resources/extensions/claude-code-cli/models.ts +9 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +148 -285
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +268 -0
- package/src/resources/extensions/claude-code-cli/turn-assembler.ts +287 -0
- package/src/resources/extensions/github-sync/templates.ts +3 -3
- package/src/resources/extensions/github-sync/tests/templates.test.ts +2 -2
- package/src/resources/extensions/gsd/artifact-projection.ts +31 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +32 -2
- package/src/resources/extensions/gsd/auto/loop-deps.ts +3 -1
- package/src/resources/extensions/gsd/auto/loop.ts +83 -61
- package/src/resources/extensions/gsd/auto/orchestrator.ts +164 -17
- package/src/resources/extensions/gsd/auto/phases.ts +45 -4
- package/src/resources/extensions/gsd/auto/run-unit.ts +2 -1
- package/src/resources/extensions/gsd/auto/session.ts +4 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +18 -4
- package/src/resources/extensions/gsd/auto-dispatch.ts +20 -7
- package/src/resources/extensions/gsd/auto-model-selection.ts +8 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +29 -10
- package/src/resources/extensions/gsd/auto-prompts.ts +110 -9
- package/src/resources/extensions/gsd/auto-recovery.ts +50 -50
- package/src/resources/extensions/gsd/auto-runtime-state.ts +26 -0
- package/src/resources/extensions/gsd/auto-start.ts +29 -35
- package/src/resources/extensions/gsd/auto-timers.ts +16 -2
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +54 -0
- package/src/resources/extensions/gsd/auto-unit-tool-scope.ts +19 -47
- package/src/resources/extensions/gsd/auto-verification.ts +7 -8
- package/src/resources/extensions/gsd/auto-worktree-repair.ts +13 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +68 -384
- package/src/resources/extensions/gsd/auto.ts +35 -32
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +3 -5
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +29 -37
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +20 -43
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +24 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +251 -161
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +136 -6
- package/src/resources/extensions/gsd/branch-patterns.ts +3 -0
- package/src/resources/extensions/gsd/browser-evidence.ts +18 -2
- package/src/resources/extensions/gsd/captures.ts +5 -16
- package/src/resources/extensions/gsd/closeout-consistency-gate.ts +27 -5
- package/src/resources/extensions/gsd/closeout-recovery.ts +2 -1
- package/src/resources/extensions/gsd/codebase-generator.ts +9 -5
- package/src/resources/extensions/gsd/commands/catalog.ts +6 -68
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +3 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +18 -0
- package/src/resources/extensions/gsd/commands-inspect.ts +7 -8
- package/src/resources/extensions/gsd/commands-maintenance.ts +74 -40
- package/src/resources/extensions/gsd/commands-ship.ts +2 -2
- package/src/resources/extensions/gsd/commands-verdict.ts +19 -2
- package/src/resources/extensions/gsd/crash-recovery.ts +3 -9
- package/src/resources/extensions/gsd/db/engine.ts +809 -0
- package/src/resources/extensions/gsd/db/queries.ts +453 -0
- package/src/resources/extensions/gsd/db/sql-constants.ts +12 -0
- package/src/resources/extensions/gsd/db/writers/cascades.ts +237 -0
- package/src/resources/extensions/gsd/db/writers/import-restore.ts +310 -0
- package/src/resources/extensions/gsd/db/writers/memory.ts +220 -0
- package/src/resources/extensions/gsd/db/writers/reconcile.ts +500 -0
- package/src/resources/extensions/gsd/db/writers/status.ts +88 -0
- package/src/resources/extensions/gsd/db-workspace.ts +170 -0
- package/src/resources/extensions/gsd/delegation-policy.ts +3 -11
- package/src/resources/extensions/gsd/discussion-handoff.ts +276 -0
- package/src/resources/extensions/gsd/docs/preferences-reference.md +9 -0
- package/src/resources/extensions/gsd/doctor-environment.ts +5 -13
- package/src/resources/extensions/gsd/doctor-format.ts +12 -7
- package/src/resources/extensions/gsd/doctor-git-checks.ts +3 -3
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +22 -17
- package/src/resources/extensions/gsd/doctor.ts +15 -5
- package/src/resources/extensions/gsd/error-classifier.ts +12 -1
- package/src/resources/extensions/gsd/git-conflict-state.ts +17 -1
- package/src/resources/extensions/gsd/git-service.ts +1 -0
- package/src/resources/extensions/gsd/gitignore.ts +3 -0
- package/src/resources/extensions/gsd/gsd-db.ts +185 -2373
- package/src/resources/extensions/gsd/guidance.ts +139 -0
- package/src/resources/extensions/gsd/guided-flow.ts +95 -561
- package/src/resources/extensions/gsd/guided-unit-completion.ts +275 -0
- package/src/resources/extensions/gsd/markdown-renderer.ts +2 -1
- package/src/resources/extensions/gsd/mcp-filter.ts +4 -24
- package/src/resources/extensions/gsd/mcp-tool-name.ts +30 -0
- package/src/resources/extensions/gsd/md-importer.ts +3 -3
- package/src/resources/extensions/gsd/memory-consolidation-scanner.ts +1 -1
- package/src/resources/extensions/gsd/migrate/safety.ts +20 -9
- package/src/resources/extensions/gsd/migration-auto-check.ts +30 -5
- package/src/resources/extensions/gsd/milestone-closeout-proof.ts +131 -0
- package/src/resources/extensions/gsd/milestone-closeout.ts +12 -4
- package/src/resources/extensions/gsd/milestone-merge-transaction.ts +47 -0
- package/src/resources/extensions/gsd/milestone-planning-persistence.ts +224 -0
- package/src/resources/extensions/gsd/milestone-readiness.ts +125 -0
- package/src/resources/extensions/gsd/milestone-settlement.ts +81 -0
- package/src/resources/extensions/gsd/milestone-validation-evidence.ts +95 -0
- package/src/resources/extensions/gsd/milestone-validation-verdict.ts +80 -0
- package/src/resources/extensions/gsd/model-cost-table.ts +1 -0
- package/src/resources/extensions/gsd/model-router.ts +3 -0
- package/src/resources/extensions/gsd/notification-store.ts +26 -3
- package/src/resources/extensions/gsd/parallel-eligibility.ts +4 -5
- package/src/resources/extensions/gsd/parallel-merge.ts +12 -9
- package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +10 -7
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +6 -2
- package/src/resources/extensions/gsd/paths.ts +42 -22
- package/src/resources/extensions/gsd/pre-execution-checks.ts +109 -3
- package/src/resources/extensions/gsd/preferences-diagnostics.ts +98 -0
- package/src/resources/extensions/gsd/preferences-models.ts +10 -46
- package/src/resources/extensions/gsd/preferences-types.ts +16 -0
- package/src/resources/extensions/gsd/preferences.ts +191 -28
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/execute-task.md +2 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-project.md +3 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +2 -1
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -1
- package/src/resources/extensions/gsd/prompts/replan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/system.md +1 -1
- package/src/resources/extensions/gsd/provider-error-guidance.ts +4 -9
- package/src/resources/extensions/gsd/provider-payload-policy.ts +140 -0
- package/src/resources/extensions/gsd/provider-switch-observer.ts +1 -1
- package/src/resources/extensions/gsd/publication.ts +122 -0
- package/src/resources/extensions/gsd/pull-request-process.ts +41 -0
- package/src/resources/extensions/gsd/quality-gate-closure.ts +140 -0
- package/src/resources/extensions/gsd/question-transport.ts +138 -0
- package/src/resources/extensions/gsd/recovery-classification.ts +47 -88
- package/src/resources/extensions/gsd/roadmap-slices.ts +8 -2
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +36 -4
- package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +7 -2
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +14 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +6 -2
- package/src/resources/extensions/gsd/state-transition-matrix.ts +42 -0
- package/src/resources/extensions/gsd/state.ts +19 -26
- package/src/resources/extensions/gsd/status-guards.ts +59 -8
- package/src/resources/extensions/gsd/stop-notice.ts +75 -0
- package/src/resources/extensions/gsd/templates/plan.md +7 -0
- package/src/resources/extensions/gsd/templates/project.md +1 -0
- package/src/resources/extensions/gsd/templates/roadmap.md +1 -1
- package/src/resources/extensions/gsd/templates/uat.md +5 -1
- package/src/resources/extensions/gsd/tests/ask-user-questions-render.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +29 -1
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +444 -5
- package/src/resources/extensions/gsd/tests/auto-milestone-target.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection-tool-poisoning.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +133 -4
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/auto-post-unit-evidence-crossref-4909.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-worktree-repair.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/browser-automation-contract-fixture.ts +39 -0
- package/src/resources/extensions/gsd/tests/browser-contract.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/canonical-milestone-root.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +66 -1
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/commands-dispatcher-workspace-git.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +46 -8
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +34 -3
- package/src/resources/extensions/gsd/tests/dispatch-run-uat-browser-tools.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/doctor-scope-db-unavailable.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/evidence-xref-gsd-exec.test.ts +157 -0
- package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +35 -1
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +33 -1
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-no-blockers.md +1 -5
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-with-blockers.md +1 -5
- package/src/resources/extensions/gsd/tests/gate-state-canonicalization.test.ts +48 -1
- package/src/resources/extensions/gsd/tests/guidance.test.ts +125 -0
- package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +58 -15
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +74 -59
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/integration/gsd-integration-fixture.ts +80 -0
- package/src/resources/extensions/gsd/tests/mcp-tool-name.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +143 -1
- package/src/resources/extensions/gsd/tests/milestone-closeout-proof.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/milestone-closeout.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/milestone-merge-transaction.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/milestone-readiness.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/milestone-validation-evidence.test.ts +41 -0
- package/src/resources/extensions/gsd/tests/milestone-validation-verdict.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/notification-store.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/planning-crossval.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +193 -1
- package/src/resources/extensions/gsd/tests/preferences-diagnostics.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +183 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/provider-error-guidance.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/provider-payload-policy.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/publication.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/pull-request-process.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/recovery-classification-illegal-transition.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +342 -1
- package/src/resources/extensions/gsd/tests/roadmap-parse-regression.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +26 -1
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +80 -0
- package/src/resources/extensions/gsd/tests/session-switch-clears-pending-autostart.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +144 -7
- package/src/resources/extensions/gsd/tests/stale-queued-milestone.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/state-transition-matrix.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/status-guards.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/stop-notice.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/tool-availability-audit.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +35 -42
- package/src/resources/extensions/gsd/tests/tool-surface-readiness.test.ts +155 -0
- package/src/resources/extensions/gsd/tests/uat-policy.test.ts +24 -6
- package/src/resources/extensions/gsd/tests/unit-closeout.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +70 -2
- package/src/resources/extensions/gsd/tests/unit-registry.test.ts +163 -0
- package/src/resources/extensions/gsd/tests/user-input-boundary.test.ts +86 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/web-app-uat.test.ts +193 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +128 -11
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/workspace-git-preflight.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +41 -4
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +43 -1
- package/src/resources/extensions/gsd/tests/worktree-placement.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/worktree-projection-writers.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-reentry.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-safety.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +12 -6
- package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +121 -0
- package/src/resources/extensions/gsd/tool-contract.ts +86 -8
- package/src/resources/extensions/gsd/tool-presentation-plan.ts +16 -33
- package/src/resources/extensions/gsd/tool-surface-readiness.ts +76 -0
- package/src/resources/extensions/gsd/tool-surface-snapshot.ts +47 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +23 -58
- package/src/resources/extensions/gsd/tools/exec-tool.ts +5 -8
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +19 -160
- package/src/resources/extensions/gsd/tools/plan-slice.ts +12 -6
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +43 -0
- package/src/resources/extensions/gsd/tools/reopen-milestone.ts +11 -38
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +14 -42
- package/src/resources/extensions/gsd/tools/skip-slice.ts +18 -44
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +25 -84
- package/src/resources/extensions/gsd/uat-policy.ts +20 -10
- package/src/resources/extensions/gsd/uat-run.ts +10 -14
- package/src/resources/extensions/gsd/undo.ts +9 -8
- package/src/resources/extensions/gsd/unit-closeout.ts +201 -0
- package/src/resources/extensions/gsd/unit-context-composer.ts +97 -21
- package/src/resources/extensions/gsd/unit-context-manifest.ts +4 -28
- package/src/resources/extensions/gsd/unit-registry.ts +412 -0
- package/src/resources/extensions/gsd/unit-runtime.ts +3 -2
- package/src/resources/extensions/gsd/unit-tool-contracts.ts +27 -191
- package/src/resources/extensions/gsd/user-input-boundary.ts +18 -0
- package/src/resources/extensions/gsd/validation-block-guard.ts +2 -0
- package/src/resources/extensions/gsd/web-app-uat.ts +144 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +22 -110
- package/src/resources/extensions/gsd/workflow-reconcile.ts +3 -3
- package/src/resources/extensions/gsd/workflow-tool-surface.ts +76 -0
- package/src/resources/extensions/gsd/workspace-git-guard.ts +1 -0
- package/src/resources/extensions/gsd/worktree-git-recovery.ts +314 -0
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +17 -17
- package/src/resources/extensions/gsd/worktree-manager.ts +47 -28
- package/src/resources/extensions/gsd/worktree-placement.ts +63 -0
- package/src/resources/extensions/gsd/worktree-reentry.ts +10 -7
- package/src/resources/extensions/gsd/worktree-root.ts +29 -6
- package/src/resources/extensions/gsd/worktree-safety.ts +8 -5
- package/src/resources/extensions/gsd/worktree-session-state.ts +11 -11
- package/src/resources/extensions/gsd/worktree-state-projection.ts +55 -7
- package/src/resources/extensions/gsd/worktree-telemetry.ts +16 -0
- package/src/resources/extensions/search-the-web/native-search.ts +5 -3
- package/src/resources/extensions/shared/browser-contract.ts +66 -0
- package/src/resources/extensions/shared/gsd-browser-cli.ts +88 -4
- package/src/resources/extensions/shared/interview-ui.ts +15 -2
- package/src/resources/shared/claude-runtime-floor.ts +248 -0
- package/src/resources/skills/create-skill/references/executable-code.md +1 -1
- package/src/resources/skills/create-skill/workflows/add-reference.md +8 -3
- package/src/resources/skills/create-skill/workflows/add-script.md +4 -2
- package/src/resources/skills/create-skill/workflows/add-template.md +3 -1
- package/src/resources/skills/create-skill/workflows/add-workflow.md +8 -3
- package/src/resources/skills/create-skill/workflows/upgrade-to-router.md +10 -5
- package/src/resources/skills/create-skill/workflows/verify-skill.md +9 -4
- package/src/resources/skills/gsd-browser/SKILL.md +1 -1
- package/src/resources/skills/spike-wrap-up/SKILL.md +9 -9
- package/dist/web/standalone/.next/static/chunks/2659.feb6499ca863ebfc.js +0 -1
- package/dist/web/standalone/.next/static/chunks/2772.151789db0edea835.js +0 -1
- package/dist/web/standalone/.next/static/chunks/4283.10a065467b5340d8.js +0 -2
- package/dist/web/standalone/.next/static/chunks/5826.960dc4634cc9b0d3.js +0 -1
- package/dist/web/standalone/.next/static/chunks/796.46f811c0fac23aab.js +0 -10
- package/dist/web/standalone/.next/static/chunks/8785.d32f7a61f55c1600.js +0 -1
- /package/dist/web/standalone/.next/static/{Qbr81pQ-pbQXP4bq2VXLv → AOpDeK_gJHU8OZjRo31gQ}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Qbr81pQ-pbQXP4bq2VXLv → AOpDeK_gJHU8OZjRo31gQ}/_ssgManifest.js +0 -0
|
@@ -21,8 +21,9 @@ import { getPendingGatesForTurn } from "./gsd-db.js";
|
|
|
21
21
|
import { assertGateCoverage, getGatesForTurn, } from "./gate-registry.js";
|
|
22
22
|
import { formatDecisionsCompact, formatRequirementsCompact } from "./structured-data-formatter.js";
|
|
23
23
|
import { readPhaseAnchor, formatAnchorForPrompt } from "./phase-anchor.js";
|
|
24
|
-
import { composeContextModeInstructions, composeInlinedContext, composeUnitContext } from "./unit-context-composer.js";
|
|
24
|
+
import { composeContextModeInstructions, composeContractedUnitContext, composeInlinedContext, composeUnitContext, } from "./unit-context-composer.js";
|
|
25
25
|
import { resolveManifest } from "./unit-context-manifest.js";
|
|
26
|
+
import { compileUnitContextContract } from "./tool-contract.js";
|
|
26
27
|
import { readCompactionSnapshot } from "./compaction-snapshot.js";
|
|
27
28
|
import { logWarning } from "./workflow-logger.js";
|
|
28
29
|
import { inlineGraphSubgraph } from "./graph-context.js";
|
|
@@ -33,6 +34,7 @@ import { buildSkillActivationBlock, buildSkillDiscoveryVars } from "./skill-acti
|
|
|
33
34
|
import { findMilestoneIds } from "./milestone-ids.js";
|
|
34
35
|
import { buildRunUatPresentationForType, RUN_UAT_TOOL_PRESENTATION_PLAN_ID } from "./tool-presentation-plan.js";
|
|
35
36
|
import { resolveEffectiveUatType, shouldDispatchUatForContent } from "./uat-policy.js";
|
|
37
|
+
import { buildWebAppUatGuidanceBlock } from "./web-app-uat.js";
|
|
36
38
|
export { buildSkillActivationBlock, buildSkillDiscoveryVars };
|
|
37
39
|
// ─── Preamble Cap ─────────────────────────────────────────────────────────────
|
|
38
40
|
/**
|
|
@@ -229,6 +231,29 @@ function prependContextModeToBlock(unitType, base, block, renderMode = "standalo
|
|
|
229
231
|
return contextMode;
|
|
230
232
|
return `${contextMode}\n\n${block}`;
|
|
231
233
|
}
|
|
234
|
+
function requireUnitPromptContextContract(unitType) {
|
|
235
|
+
const result = compileUnitContextContract(unitType);
|
|
236
|
+
if (result.ok)
|
|
237
|
+
return result.contract;
|
|
238
|
+
throw new Error(result.detail);
|
|
239
|
+
}
|
|
240
|
+
function requireComposedArtifactBlock(blocks, unitType, key) {
|
|
241
|
+
const block = blocks.find((item) => item.key === key);
|
|
242
|
+
if (!block) {
|
|
243
|
+
throw new Error(`Unit Context Contract for ${unitType} did not compose required artifact ${key}`);
|
|
244
|
+
}
|
|
245
|
+
return block.body;
|
|
246
|
+
}
|
|
247
|
+
function renderExecuteTaskOnDemandContext(base, mid, sid, artifacts) {
|
|
248
|
+
if (!artifacts.includes("slice-research"))
|
|
249
|
+
return "";
|
|
250
|
+
const researchPath = relSliceFile(base, mid, sid, "RESEARCH");
|
|
251
|
+
return [
|
|
252
|
+
"## On-demand Context",
|
|
253
|
+
"",
|
|
254
|
+
`Slice research is available at \`${researchPath}\`. Read it only if the inlined task plan, slice plan excerpt, and carry-forward context do not explain a required implementation detail.`,
|
|
255
|
+
].join("\n");
|
|
256
|
+
}
|
|
232
257
|
// ─── Executor Constraints ─────────────────────────────────────────────────────
|
|
233
258
|
/**
|
|
234
259
|
* Format executor context constraints for injection into the plan-slice prompt.
|
|
@@ -1745,6 +1770,13 @@ export async function buildPlanMilestonePrompt(mid, midTitle, base, level) {
|
|
|
1745
1770
|
else {
|
|
1746
1771
|
trackPromptContext(contextTelemetry, "knowledge", "skipped", null, "missing");
|
|
1747
1772
|
}
|
|
1773
|
+
const webAppUatGuidance = buildWebAppUatGuidanceBlock(base);
|
|
1774
|
+
if (webAppUatGuidance) {
|
|
1775
|
+
pushTracked("web-app-uat", webAppUatGuidance);
|
|
1776
|
+
}
|
|
1777
|
+
else {
|
|
1778
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "skipped", null, "not a web app");
|
|
1779
|
+
}
|
|
1748
1780
|
pushTracked("templates", inlineTemplate("roadmap", "Roadmap"));
|
|
1749
1781
|
if (inlineLevel === "full") {
|
|
1750
1782
|
pushTracked("templates", inlineTemplate("decisions", "Decisions"));
|
|
@@ -2032,6 +2064,14 @@ async function renderSlicePrompt(options) {
|
|
|
2032
2064
|
else {
|
|
2033
2065
|
trackPromptContext(contextTelemetry, "graph-subgraph", "skipped", null, "missing");
|
|
2034
2066
|
}
|
|
2067
|
+
const webAppUatGuidance = buildWebAppUatGuidanceBlock(base);
|
|
2068
|
+
if (webAppUatGuidance) {
|
|
2069
|
+
inlined.push(webAppUatGuidance);
|
|
2070
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "inline", webAppUatGuidance);
|
|
2071
|
+
}
|
|
2072
|
+
else {
|
|
2073
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "skipped", null, "not a web app");
|
|
2074
|
+
}
|
|
2035
2075
|
const planTemplateInline = level === "minimal" ? inlineCompactTemplate("plan", "Slice Plan") : inlineTemplate("plan", "Slice Plan");
|
|
2036
2076
|
inlined.push(planTemplateInline);
|
|
2037
2077
|
trackPromptContext(contextTelemetry, "templates", "inline", planTemplateInline);
|
|
@@ -2106,6 +2146,9 @@ export async function buildPlanSlicePrompt(mid, _midTitle, sid, sTitle, base, le
|
|
|
2106
2146
|
`Either (a) add an earlier task that creates X on disk before the task that needs it, ` +
|
|
2107
2147
|
`or (b) if this task IS the one that creates X, move X from inputs to expected_output. ` +
|
|
2108
2148
|
`Do NOT put X in a task's expected_output if that task only reads or verifies X — only tasks that actually write X to disk should list it in expected_output.\n` +
|
|
2149
|
+
`- **"[file] X: ... GSD planning artifacts are projections preloaded as context / written by workflow tools"**: ` +
|
|
2150
|
+
`Remove X from the task's inputs, files, and expectedOutput entirely. Planning artifacts (anything under .gsd/, .planning/, or .audits/, or names like M001-CONTEXT.md / S01-PLAN.md) are preloaded as context and written by workflow tools — ` +
|
|
2151
|
+
`do NOT add a task that creates X and do NOT move X to expectedOutput.\n` +
|
|
2109
2152
|
`- **"[file] X: Task T_early reads X but it's created by task T_late (sequence violation)"**: ` +
|
|
2110
2153
|
`Either (a) reorder tasks so T_late (the creator) runs before T_early (the reader), ` +
|
|
2111
2154
|
`or (b) if T_late doesn't actually create X (it only reads/tests it), remove X from T_late's expected_output entirely.\n` +
|
|
@@ -2173,7 +2216,7 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2173
2216
|
const taskPlanPath = resolveTaskFile(base, mid, sid, tid, "PLAN");
|
|
2174
2217
|
const taskPlanContent = taskPlanPath ? await loadFile(taskPlanPath) : null;
|
|
2175
2218
|
const taskPlanRelPath = relSlicePath(base, mid, sid) + `/tasks/${tid}-PLAN.md`;
|
|
2176
|
-
const
|
|
2219
|
+
const taskPlanContext = taskPlanContent
|
|
2177
2220
|
? [
|
|
2178
2221
|
"## Inlined Task Plan (authoritative local execution contract)",
|
|
2179
2222
|
`Source: \`${taskPlanRelPath}\``,
|
|
@@ -2184,11 +2227,11 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2184
2227
|
"## Inlined Task Plan (authoritative local execution contract)",
|
|
2185
2228
|
`Task plan not found at dispatch time. Read \`${taskPlanRelPath}\` before executing.`,
|
|
2186
2229
|
].join("\n");
|
|
2187
|
-
trackPromptContext(contextTelemetry, "task-plan", taskPlanContent ? "inline" : "on-demand",
|
|
2230
|
+
trackPromptContext(contextTelemetry, "task-plan", taskPlanContent ? "inline" : "on-demand", taskPlanContext, taskPlanContent ? undefined : "missing at dispatch");
|
|
2188
2231
|
const slicePlanPath = resolveSliceFile(base, mid, sid, "PLAN");
|
|
2189
2232
|
const slicePlanContent = slicePlanPath ? await loadFile(slicePlanPath) : null;
|
|
2190
|
-
const
|
|
2191
|
-
trackPromptContext(contextTelemetry, "slice-plan",
|
|
2233
|
+
const slicePlanContext = extractSliceExecutionExcerpt(slicePlanContent, relSliceFile(base, mid, sid, "PLAN"));
|
|
2234
|
+
trackPromptContext(contextTelemetry, "slice-plan", slicePlanContext ? "excerpt" : "skipped", slicePlanContext, slicePlanContext ? undefined : "missing");
|
|
2192
2235
|
// Check for continue file (new naming or legacy)
|
|
2193
2236
|
const continueFile = resolveSliceFile(base, mid, sid, "CONTINUE");
|
|
2194
2237
|
const legacyContinueDir = resolveSlicePath(base, mid, sid);
|
|
@@ -2287,6 +2330,30 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2287
2330
|
trackPromptContext(contextTelemetry, "decisions-template", "on-demand", decisionsOnDemandET);
|
|
2288
2331
|
}
|
|
2289
2332
|
trackPromptContext(contextTelemetry, "templates", "inline", inlinedTemplates, inlineLevel);
|
|
2333
|
+
const contextContract = requireUnitPromptContextContract("execute-task");
|
|
2334
|
+
const contractedContext = await composeContractedUnitContext(contextContract, {
|
|
2335
|
+
base: { unitType: "execute-task", basePath: base, milestoneId: mid, sliceId: sid, taskId: tid },
|
|
2336
|
+
resolveArtifact: async (key) => {
|
|
2337
|
+
switch (key) {
|
|
2338
|
+
case "task-plan":
|
|
2339
|
+
return taskPlanContext;
|
|
2340
|
+
case "slice-plan":
|
|
2341
|
+
return slicePlanContext;
|
|
2342
|
+
case "prior-task-summaries":
|
|
2343
|
+
return finalCarryForward;
|
|
2344
|
+
case "templates":
|
|
2345
|
+
return inlinedTemplates;
|
|
2346
|
+
default:
|
|
2347
|
+
return null;
|
|
2348
|
+
}
|
|
2349
|
+
},
|
|
2350
|
+
});
|
|
2351
|
+
const taskPlanInline = requireComposedArtifactBlock(contractedContext.blocks, "execute-task", "task-plan");
|
|
2352
|
+
const slicePlanExcerpt = requireComposedArtifactBlock(contractedContext.blocks, "execute-task", "slice-plan");
|
|
2353
|
+
const contractedCarryForward = requireComposedArtifactBlock(contractedContext.blocks, "execute-task", "prior-task-summaries");
|
|
2354
|
+
const contractedTemplates = requireComposedArtifactBlock(contractedContext.blocks, "execute-task", "templates");
|
|
2355
|
+
const onDemandContext = renderExecuteTaskOnDemandContext(base, mid, sid, contractedContext.onDemand);
|
|
2356
|
+
trackPromptContext(contextTelemetry, "slice-research", onDemandContext ? "on-demand" : "skipped", onDemandContext, onDemandContext ? undefined : "not declared by contract");
|
|
2290
2357
|
const prompt = loadPrompt("execute-task", {
|
|
2291
2358
|
overridesSection,
|
|
2292
2359
|
runtimeContext,
|
|
@@ -2298,11 +2365,12 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2298
2365
|
taskPlanPath: taskPlanRelPath,
|
|
2299
2366
|
taskPlanInline,
|
|
2300
2367
|
slicePlanExcerpt,
|
|
2301
|
-
carryForwardSection:
|
|
2368
|
+
carryForwardSection: contractedCarryForward,
|
|
2302
2369
|
resumeSection,
|
|
2303
2370
|
priorTaskLines: priorLines,
|
|
2371
|
+
onDemandContext,
|
|
2304
2372
|
taskSummaryPath,
|
|
2305
|
-
inlinedTemplates,
|
|
2373
|
+
inlinedTemplates: contractedTemplates,
|
|
2306
2374
|
verificationBudget,
|
|
2307
2375
|
gatesToClose,
|
|
2308
2376
|
skillActivation: buildSkillActivationBlock({
|
|
@@ -2313,7 +2381,7 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
2313
2381
|
taskId: tid,
|
|
2314
2382
|
taskTitle: tTitle,
|
|
2315
2383
|
taskPlanContent,
|
|
2316
|
-
extraContext: [taskPlanInline, slicePlanExcerpt,
|
|
2384
|
+
extraContext: [taskPlanInline, slicePlanExcerpt, contractedCarryForward, resumeSection],
|
|
2317
2385
|
unitType: "execute-task",
|
|
2318
2386
|
}),
|
|
2319
2387
|
});
|
|
@@ -2424,6 +2492,14 @@ export async function buildCompleteSlicePrompt(mid, midTitle, sid, sTitle, base,
|
|
|
2424
2492
|
body = `${body}\n\n---\n\n${knowledgeInlineCS}`;
|
|
2425
2493
|
}
|
|
2426
2494
|
}
|
|
2495
|
+
const webAppUatGuidance = buildWebAppUatGuidanceBlock(base);
|
|
2496
|
+
if (webAppUatGuidance && body) {
|
|
2497
|
+
body = `${webAppUatGuidance}\n\n---\n\n${body}`;
|
|
2498
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "inline", webAppUatGuidance);
|
|
2499
|
+
}
|
|
2500
|
+
else {
|
|
2501
|
+
trackPromptContext(contextTelemetry, "web-app-uat", "skipped", null, webAppUatGuidance ? "missing composed body" : "not a web app");
|
|
2502
|
+
}
|
|
2427
2503
|
// Overrides section prepends to the top of the inlined context —
|
|
2428
2504
|
// standard pattern for slice-level builders (until composer v2 lands
|
|
2429
2505
|
// the prepend contract).
|
|
@@ -14,7 +14,8 @@ import { appendEvent } from "./workflow-events.js";
|
|
|
14
14
|
import { atomicWriteSync } from "./atomic-write.js";
|
|
15
15
|
import { clearParseCache } from "./files.js";
|
|
16
16
|
import { parseRoadmap as parseLegacyRoadmap, parsePlan as parseLegacyPlan } from "./parsers-legacy.js";
|
|
17
|
-
import { isDbAvailable, getTask, getSlice, getSliceTasks, getPendingGatesForTurn, updateTaskStatus, updateSliceStatus, insertSlice, getMilestone,
|
|
17
|
+
import { isDbAvailable, getTask, getSlice, getSliceTasks, getPendingGatesForTurn, updateTaskStatus, updateSliceStatus, insertSlice, getMilestone, updateMilestoneStatus, transaction, } from "./gsd-db.js";
|
|
18
|
+
import { refreshWorkflowDatabaseFromDisk } from "./db-workspace.js";
|
|
18
19
|
import { isValidationTerminal } from "./state.js";
|
|
19
20
|
import { getErrorMessage } from "./error-utils.js";
|
|
20
21
|
import { logWarning, logError } from "./workflow-logger.js";
|
|
@@ -32,7 +33,7 @@ import { isGsdWorktreePath } from "./worktree-root.js";
|
|
|
32
33
|
import { resolveCanonicalMilestoneRoot } from "./worktree-manager.js";
|
|
33
34
|
import { hasImplementationArtifacts } from "./milestone-implementation-evidence.js";
|
|
34
35
|
import { loadAllCaptures, loadPendingCaptures } from "./captures.js";
|
|
35
|
-
import {
|
|
36
|
+
import { proveMilestoneCloseout, } from "./milestone-closeout-proof.js";
|
|
36
37
|
// Re-export so existing consumers of auto-recovery.ts keep working.
|
|
37
38
|
export { resolveExpectedArtifactPath, diagnoseExpectedArtifact };
|
|
38
39
|
export { classifyMilestoneSummaryContent, } from "./milestone-summary-classifier.js";
|
|
@@ -66,12 +67,24 @@ function resolveArtifactVerificationBase(unitId, base) {
|
|
|
66
67
|
return base;
|
|
67
68
|
return resolveCanonicalMilestoneRoot(base, milestone);
|
|
68
69
|
}
|
|
70
|
+
function closeoutProofRecoveryReason(reason) {
|
|
71
|
+
switch (reason) {
|
|
72
|
+
case "slice-missing":
|
|
73
|
+
return "complete-milestone-slices-missing";
|
|
74
|
+
case "summary-artifact-missing":
|
|
75
|
+
return "complete-milestone-summary-missing";
|
|
76
|
+
case "summary-artifact-failed":
|
|
77
|
+
return "complete-milestone-summary-failed";
|
|
78
|
+
default:
|
|
79
|
+
return `complete-milestone-${reason}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
69
82
|
export function refreshRecoveryDbForArtifact(unitType, unitId, basePath) {
|
|
70
83
|
if (unitType !== "plan-slice" && unitType !== "execute-task" && unitType !== "complete-milestone")
|
|
71
84
|
return { ok: true };
|
|
72
85
|
if (!isDbAvailable())
|
|
73
86
|
return { ok: true };
|
|
74
|
-
if (!
|
|
87
|
+
if (!refreshWorkflowDatabaseFromDisk()) {
|
|
75
88
|
return {
|
|
76
89
|
ok: false,
|
|
77
90
|
fatal: unitType === "execute-task" || unitType === "complete-milestone",
|
|
@@ -100,50 +113,29 @@ export function refreshRecoveryDbForArtifact(unitType, unitId, basePath) {
|
|
|
100
113
|
}
|
|
101
114
|
if (isClosedStatus(milestone.status))
|
|
102
115
|
return { ok: true };
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
ok: false,
|
|
116
|
-
fatal: true,
|
|
117
|
-
reason: "complete-milestone-slices-missing",
|
|
118
|
-
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but no slices exist in the DB.`,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
const openSlice = slices.find((slice) => !isClosedStatus(slice.status));
|
|
122
|
-
if (openSlice) {
|
|
123
|
-
return {
|
|
124
|
-
ok: false,
|
|
125
|
-
fatal: true,
|
|
126
|
-
reason: "complete-milestone-slice-open",
|
|
127
|
-
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but slice ${openSlice.id} is still "${openSlice.status}" in the DB.`,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
for (const slice of slices) {
|
|
131
|
-
const openTask = getSliceTasks(mid, slice.id).find((task) => !isClosedStatus(task.status));
|
|
132
|
-
if (openTask) {
|
|
116
|
+
const artifactBasePath = resolveArtifactVerificationBase(unitId, basePath);
|
|
117
|
+
const closeoutProof = proveMilestoneCloseout(mid, {
|
|
118
|
+
allowOpenMilestone: true,
|
|
119
|
+
summaryArtifactBasePath: artifactBasePath,
|
|
120
|
+
implementationEvidence: {
|
|
121
|
+
basePath,
|
|
122
|
+
requirement: "present",
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
if (!closeoutProof.ok) {
|
|
126
|
+
if (closeoutProof.reason === "implementation-evidence-missing") {
|
|
133
127
|
return {
|
|
134
128
|
ok: false,
|
|
135
129
|
fatal: true,
|
|
136
|
-
reason: "complete-milestone-
|
|
137
|
-
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but
|
|
130
|
+
reason: "complete-milestone-implementation-missing",
|
|
131
|
+
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but implementation evidence is not present.`,
|
|
138
132
|
};
|
|
139
133
|
}
|
|
140
|
-
}
|
|
141
|
-
if (hasImplementationArtifacts(basePath, mid) !== "present") {
|
|
142
134
|
return {
|
|
143
135
|
ok: false,
|
|
144
136
|
fatal: true,
|
|
145
|
-
reason:
|
|
146
|
-
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but
|
|
137
|
+
reason: closeoutProofRecoveryReason(closeoutProof.reason),
|
|
138
|
+
message: `Stuck recovery found complete-milestone ${unitId} artifacts, but ${closeoutProof.message}`,
|
|
147
139
|
};
|
|
148
140
|
}
|
|
149
141
|
updateMilestoneStatus(mid, "complete", new Date().toISOString());
|
|
@@ -457,7 +449,7 @@ export function verifyExpectedArtifact(unitType, unitId, base) {
|
|
|
457
449
|
try {
|
|
458
450
|
let taskIds = null;
|
|
459
451
|
if (isDbAvailable()) {
|
|
460
|
-
const refreshed =
|
|
452
|
+
const refreshed = refreshWorkflowDatabaseFromDisk();
|
|
461
453
|
if (refreshed) {
|
|
462
454
|
const tasks = getSliceTasks(mid, sid);
|
|
463
455
|
if (tasks.length > 0)
|
|
@@ -569,17 +561,24 @@ export function verifyExpectedArtifact(unitType, unitId, base) {
|
|
|
569
561
|
// A milestone with only .gsd/ plan files and zero implementation code is
|
|
570
562
|
// not genuinely complete — the LLM wrote plan files but skipped actual work.
|
|
571
563
|
if (unitType === "complete-milestone") {
|
|
572
|
-
const summaryOutcome = classifyMilestoneSummaryContent(readFileSync(absPath, "utf-8"));
|
|
573
|
-
if (summaryOutcome === "failure")
|
|
574
|
-
return false;
|
|
575
564
|
const { milestone: mid } = parseUnitId(unitId);
|
|
576
|
-
if (mid
|
|
577
|
-
const closeoutGate = checkCloseoutConsistencyGate(mid, { refreshFromDisk: true });
|
|
578
|
-
if (!closeoutGate.ok)
|
|
579
|
-
return false;
|
|
580
|
-
}
|
|
581
|
-
if (hasImplementationArtifacts(base, mid) === "absent")
|
|
565
|
+
if (!mid)
|
|
582
566
|
return false;
|
|
567
|
+
const closeoutProof = proveMilestoneCloseout(mid, {
|
|
568
|
+
refreshFromDisk: true,
|
|
569
|
+
summaryArtifactBasePath: artifactBase,
|
|
570
|
+
implementationEvidence: {
|
|
571
|
+
basePath: base,
|
|
572
|
+
requirement: "not-absent",
|
|
573
|
+
},
|
|
574
|
+
});
|
|
575
|
+
if (!closeoutProof.ok) {
|
|
576
|
+
if (!isDbAvailable() && closeoutProof.reason === "db-unavailable") {
|
|
577
|
+
const summaryOutcome = classifyMilestoneSummaryContent(readFileSync(absPath, "utf-8"));
|
|
578
|
+
return summaryOutcome !== "failure" && hasImplementationArtifacts(base, mid) !== "absent";
|
|
579
|
+
}
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
583
582
|
}
|
|
584
583
|
return true;
|
|
585
584
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// GSD auto-mode runtime state
|
|
2
2
|
import { AutoSession } from "./auto/session.js";
|
|
3
3
|
import { isDeterministicPolicyError, isQueuedUserMessageSkip, isToolInvocationError, markToolEnd as markTrackedToolEnd, markToolStart as markTrackedToolStart, } from "./auto-tool-tracking.js";
|
|
4
|
+
// Re-exported as a pure pass-through. Must stay UNGATED (no autoSession.active
|
|
5
|
+
// argument, unlike markToolStart at the bottom of this file) so it is true in
|
|
6
|
+
// foreground where the foreground approval-gate pause consults it.
|
|
7
|
+
export { isInteractiveElicitationInFlight } from "./auto-tool-tracking.js";
|
|
8
|
+
import { createToolSurfaceSnapshot, } from "./tool-surface-snapshot.js";
|
|
4
9
|
export const autoSession = new AutoSession();
|
|
10
|
+
let currentToolSurfaceSnapshot = null;
|
|
5
11
|
export function getAutoRuntimeSnapshot() {
|
|
6
12
|
const orchestrationStatus = autoSession.orchestration?.getStatus();
|
|
7
13
|
return {
|
|
@@ -12,8 +18,16 @@ export function getAutoRuntimeSnapshot() {
|
|
|
12
18
|
orchestrationPhase: orchestrationStatus?.phase,
|
|
13
19
|
orchestrationTransitionCount: orchestrationStatus?.transitionCount,
|
|
14
20
|
orchestrationLastTransitionAt: orchestrationStatus?.lastTransitionAt,
|
|
21
|
+
toolSurface: autoSession.active || autoSession.paused ? currentToolSurfaceSnapshot : null,
|
|
15
22
|
};
|
|
16
23
|
}
|
|
24
|
+
export function recordAutoToolSurfaceSnapshot(input) {
|
|
25
|
+
currentToolSurfaceSnapshot = createToolSurfaceSnapshot(input);
|
|
26
|
+
return currentToolSurfaceSnapshot;
|
|
27
|
+
}
|
|
28
|
+
export function clearAutoToolSurfaceSnapshot() {
|
|
29
|
+
currentToolSurfaceSnapshot = null;
|
|
30
|
+
}
|
|
17
31
|
export function isAutoActive() {
|
|
18
32
|
return autoSession.active;
|
|
19
33
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* remains in auto.ts — this module handles only the fresh-start path.
|
|
12
12
|
*/
|
|
13
13
|
import { deriveState } from "./state.js";
|
|
14
|
+
import { findWorktreeSegment, isGsdWorktreePath } from "./worktree-root.js";
|
|
14
15
|
import { loadFile, getManifestStatus } from "./files.js";
|
|
15
16
|
import { loadEffectiveGSDPreferences, resolveSkillDiscoveryMode, getIsolationMode, } from "./preferences.js";
|
|
16
17
|
import { ensureGsdSymlink, isInheritedRepo, validateProjectId } from "./repo-identity.js";
|
|
@@ -24,7 +25,8 @@ import { ensureGitignore, untrackRuntimeFiles } from "./gitignore.js";
|
|
|
24
25
|
import { nativeIsRepo, nativeInit, nativeAddAll, nativeCommit, nativeGetCurrentBranch, nativeDetectMainBranch, nativeBranchList, nativeBranchExists, nativeBranchListMerged, nativeBranchDelete, nativeWorktreeRemove, nativeCommitCountBetween, nativeHasChanges, } from "./native-git-bridge.js";
|
|
25
26
|
import { GitServiceImpl } from "./git-service.js";
|
|
26
27
|
import { captureIntegrationBranch, detectWorktreeName, setActiveMilestoneId, } from "./worktree.js";
|
|
27
|
-
import { getAutoWorktreePath
|
|
28
|
+
import { getAutoWorktreePath } from "./auto-worktree.js";
|
|
29
|
+
import { checkoutBranchWithStashGuard } from "./worktree-git-recovery.js";
|
|
28
30
|
import { readResourceVersion, cleanStaleRuntimeUnits } from "./auto-worktree.js";
|
|
29
31
|
import { worktreePath as getWorktreeDir, isInsideWorktreesDir } from "./worktree-manager.js";
|
|
30
32
|
import { emitWorktreeOrphaned } from "./worktree-telemetry.js";
|
|
@@ -34,7 +36,8 @@ import { initRoutingHistory } from "./routing-history.js";
|
|
|
34
36
|
import { restoreHookState, resetHookState } from "./post-unit-hooks.js";
|
|
35
37
|
import { resetProactiveHealing, setLevelChangeCallback } from "./doctor-proactive.js";
|
|
36
38
|
import { snapshotSkills } from "./skill-discovery.js";
|
|
37
|
-
import { isDbAvailable, getMilestone, getAllMilestones, insertMilestone,
|
|
39
|
+
import { isDbAvailable, getMilestone, getAllMilestones, insertMilestone, updateMilestoneStatus } from "./gsd-db.js";
|
|
40
|
+
import { getWorkflowDatabaseStatus, openExistingWorkflowDatabase, openWorkflowDatabase, resolveProjectRootDbPath, } from "./db-workspace.js";
|
|
38
41
|
import { isClosedStatus } from "./status-guards.js";
|
|
39
42
|
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
40
43
|
import { extractVerdict } from "./verdict-parser.js";
|
|
@@ -44,8 +47,6 @@ import { debugLog, enableDebug, isDebugEnabled, getDebugLogPath, } from "./debug
|
|
|
44
47
|
import { logWarning, logError } from "./workflow-logger.js";
|
|
45
48
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, } from "node:fs";
|
|
46
49
|
import { join } from "node:path";
|
|
47
|
-
import { sep as pathSep } from "node:path";
|
|
48
|
-
import { resolveProjectRootDbPath } from "./bootstrap/dynamic-tools.js";
|
|
49
50
|
import { validateDirectory } from "./validate-directory.js";
|
|
50
51
|
import { isCustomProvider, resolveDefaultSessionModel, resolveDynamicRoutingConfig, } from "./preferences-models.js";
|
|
51
52
|
import { getSessionModelOverride } from "./session-model-override.js";
|
|
@@ -76,11 +77,9 @@ export async function openProjectDbIfPresent(basePath) {
|
|
|
76
77
|
const gsdDbPath = resolveProjectRootDbPath(basePath);
|
|
77
78
|
if (!existsSync(gsdDbPath) || isDbAvailable())
|
|
78
79
|
return;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
catch (err) {
|
|
83
|
-
logWarning("engine", `gsd-db: failed to open existing database: ${err instanceof Error ? err.message : String(err)}`);
|
|
80
|
+
const result = openExistingWorkflowDatabase(basePath);
|
|
81
|
+
if (!result.ok && result.reason === "open-failed") {
|
|
82
|
+
logWarning("engine", `gsd-db: failed to open existing database: ${result.error?.message ?? "open failed"}`);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
export function reconcileProjectMilestonesFromDisk(basePath) {
|
|
@@ -405,7 +404,7 @@ export function auditOrphanedMilestoneBranches(basePath, _isolationMode, gitDeps
|
|
|
405
404
|
}
|
|
406
405
|
}
|
|
407
406
|
else {
|
|
408
|
-
warnings.push(`Orphaned worktree directory for ${milestoneId} is outside
|
|
407
|
+
warnings.push(`Orphaned worktree directory for ${milestoneId} is outside the GSD worktrees containers — skipping removal for safety.`);
|
|
409
408
|
}
|
|
410
409
|
}
|
|
411
410
|
else {
|
|
@@ -524,7 +523,7 @@ export function auditOrphanedMilestoneBranches(basePath, _isolationMode, gitDeps
|
|
|
524
523
|
if (!existsSync(wtDir))
|
|
525
524
|
continue;
|
|
526
525
|
if (!isInsideWorktreesDir(basePath, wtDir)) {
|
|
527
|
-
warnings.push(`Orphaned worktree directory for ${m.id} is outside
|
|
526
|
+
warnings.push(`Orphaned worktree directory for ${m.id} is outside the GSD worktrees containers — skipping removal for safety.`);
|
|
528
527
|
continue;
|
|
529
528
|
}
|
|
530
529
|
// Try `git worktree remove` first in case the dir is still registered
|
|
@@ -1012,7 +1011,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1012
1011
|
(state.phase === "pre-planning" || state.phase === "complete") &&
|
|
1013
1012
|
survivorIsolationMode !== "none" &&
|
|
1014
1013
|
!detectWorktreeName(base) &&
|
|
1015
|
-
!base
|
|
1014
|
+
!isGsdWorktreePath(base)) {
|
|
1016
1015
|
const milestoneBranch = `milestone/${survivorMilestoneId}`;
|
|
1017
1016
|
const { nativeBranchExists } = await import("./native-git-bridge.js");
|
|
1018
1017
|
hasSurvivorBranch = nativeBranchExists(base, milestoneBranch);
|
|
@@ -1248,16 +1247,13 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1248
1247
|
// (ADR-016 phase 2 / B2, #5620). The redundant assignment that used to
|
|
1249
1248
|
// live here is gone.
|
|
1250
1249
|
const isUnderGsdWorktrees = (p) => {
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
if (p.includes(marker))
|
|
1250
|
+
const normalized = p.replaceAll("\\", "/");
|
|
1251
|
+
if (findWorktreeSegment(normalized) !== null)
|
|
1254
1252
|
return true;
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
const symlinkRe = new RegExp(`\\${pathSep}\\.gsd\\${pathSep}projects\\${pathSep}[a-f0-9]+\\${pathSep}worktrees(?:\\${pathSep}|$)`);
|
|
1260
|
-
return symlinkRe.test(p);
|
|
1253
|
+
// The container directory itself (no trailing worktree name), in any layout.
|
|
1254
|
+
return normalized.endsWith("/.gsd/worktrees")
|
|
1255
|
+
|| normalized.endsWith("/.gsd-worktrees")
|
|
1256
|
+
|| /\/\.gsd\/projects\/[^/]+\/worktrees$/.test(normalized);
|
|
1261
1257
|
};
|
|
1262
1258
|
if (s.currentMilestoneId &&
|
|
1263
1259
|
(getIsolationMode(base) !== "none" || strandedRecoveryAction?.recoveryMode) &&
|
|
@@ -1295,23 +1291,14 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1295
1291
|
}
|
|
1296
1292
|
// ── DB lifecycle ──
|
|
1297
1293
|
const gsdDbPath = resolveProjectRootDbPath(s.basePath);
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
|
|
1301
|
-
const { openDatabase: openDb } = await import("./gsd-db.js");
|
|
1302
|
-
openDb(gsdDbPath);
|
|
1303
|
-
}
|
|
1304
|
-
catch (err) {
|
|
1305
|
-
logError("engine", `failed to initialize project database: ${err.message}`);
|
|
1306
|
-
}
|
|
1294
|
+
const initialDbOpen = openWorkflowDatabase(s.basePath);
|
|
1295
|
+
if (!initialDbOpen.ok && initialDbOpen.reason === "open-failed") {
|
|
1296
|
+
logError("engine", `failed to initialize project database: ${initialDbOpen.error?.message ?? "open failed"}`);
|
|
1307
1297
|
}
|
|
1308
1298
|
if (_shouldAbortBootstrapForUnavailableDbForTest(gsdDbPath, isDbAvailable())) {
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
}
|
|
1313
|
-
catch (err) {
|
|
1314
|
-
logError("engine", `failed to open existing database: ${err.message}`);
|
|
1299
|
+
const retryDbOpen = openWorkflowDatabase(s.basePath);
|
|
1300
|
+
if (!retryDbOpen.ok && retryDbOpen.reason === "open-failed") {
|
|
1301
|
+
logError("engine", `failed to open existing database: ${retryDbOpen.error?.message ?? "open failed"}`);
|
|
1315
1302
|
}
|
|
1316
1303
|
}
|
|
1317
1304
|
// Gate: abort bootstrap if the DB file exists but the provider is
|
|
@@ -1320,7 +1307,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
1320
1307
|
// call returns "db_unavailable", triggering artifact-retry which
|
|
1321
1308
|
// re-dispatches the same task — producing an infinite loop (#2419).
|
|
1322
1309
|
if (existsSync(gsdDbPath) && !isDbAvailable()) {
|
|
1323
|
-
const dbStatus =
|
|
1310
|
+
const dbStatus = getWorkflowDatabaseStatus();
|
|
1324
1311
|
const phaseHint = dbStatus.lastPhase === "open"
|
|
1325
1312
|
? "The database file could not be opened"
|
|
1326
1313
|
: dbStatus.lastPhase === "initSchema"
|
|
@@ -233,11 +233,24 @@ export function startUnitSupervision(sctx) {
|
|
|
233
233
|
}
|
|
234
234
|
}, 15000);
|
|
235
235
|
// ── 3. Hard timeout ──
|
|
236
|
-
|
|
236
|
+
const hardTimeoutBody = async () => {
|
|
237
237
|
try {
|
|
238
238
|
s.unitTimeoutHandle = null;
|
|
239
239
|
if (!s.active)
|
|
240
240
|
return;
|
|
241
|
+
// User-interactive tools (ask_user_questions, secure_env_collect) block
|
|
242
|
+
// waiting for human input by design. Unlike the idle watchdog (above),
|
|
243
|
+
// the hard timeout had no interactive exemption, so a long human
|
|
244
|
+
// deliberation crossing the hard cap would still closeout + recover
|
|
245
|
+
// (triggerTurn) and abort the turn hosting the elicitation, reintroducing
|
|
246
|
+
// the self-cancel loop on slow answers (#2676). Re-arm instead of firing
|
|
247
|
+
// while a human is being asked, mirroring the idle watchdog's
|
|
248
|
+
// refresh-and-return. Conditional on hasInteractiveToolInFlight(), so a
|
|
249
|
+
// genuinely hung non-interactive unit still hits the hard cap.
|
|
250
|
+
if (getInFlightToolCount() > 0 && hasInteractiveToolInFlight()) {
|
|
251
|
+
s.unitTimeoutHandle = setTimeout(hardTimeoutBody, hardTimeoutMs);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
241
254
|
const expectedCurrentUnit = s.currentUnit
|
|
242
255
|
? { type: s.currentUnit.type, id: s.currentUnit.id, startedAt: s.currentUnit.startedAt }
|
|
243
256
|
: null;
|
|
@@ -269,7 +282,8 @@ export function startUnitSupervision(sctx) {
|
|
|
269
282
|
logWarning("timer", `notification failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
270
283
|
}
|
|
271
284
|
}
|
|
272
|
-
}
|
|
285
|
+
};
|
|
286
|
+
s.unitTimeoutHandle = setTimeout(hardTimeoutBody, hardTimeoutMs);
|
|
273
287
|
// ── 4. Context-pressure continue-here monitor ──
|
|
274
288
|
if (s.continueHereHandle) {
|
|
275
289
|
clearInterval(s.continueHereHandle);
|
|
@@ -4,12 +4,23 @@
|
|
|
4
4
|
* can distinguish "waiting for tool completion" from "truly idle".
|
|
5
5
|
*/
|
|
6
6
|
import { stripMcpToolPrefix } from "@gsd/pi-ai";
|
|
7
|
+
import { TOOL_SURFACE_NOT_READY } from "./tool-surface-readiness.js";
|
|
7
8
|
const inFlightTools = new Map();
|
|
8
9
|
/**
|
|
9
10
|
* Tools that block waiting for human input by design.
|
|
10
11
|
* The idle watchdog must not treat these as stalled.
|
|
11
12
|
*/
|
|
12
13
|
const INTERACTIVE_TOOLS = new Set(["ask_user_questions", "secure_env_collect"]);
|
|
14
|
+
/**
|
|
15
|
+
* Mode-agnostic refcount of in-flight interactive elicitations that are an
|
|
16
|
+
* active human boundary (the model ASKED via ask_user_questions). Unlike the
|
|
17
|
+
* `inFlightTools` Map, this is NOT gated by auto-session.active, so it is true
|
|
18
|
+
* in FOREGROUND (where s.active is false). Kept SEPARATE from inFlightTools so
|
|
19
|
+
* getInFlightToolCount()/getOldestInFlightToolAgeMs()/hasInteractiveToolInFlight()
|
|
20
|
+
* and the auto-watchdog accounting are byte-for-byte unchanged. A refcount (not
|
|
21
|
+
* a boolean) handles nested/back-to-back elicitations in a single turn.
|
|
22
|
+
*/
|
|
23
|
+
let interactiveElicitationDepth = 0;
|
|
13
24
|
/**
|
|
14
25
|
* Mark a tool execution as in-flight.
|
|
15
26
|
* Records start time and tool name so the idle watchdog can detect tools
|
|
@@ -26,6 +37,27 @@ export function markToolStart(toolCallId, isActive, toolName) {
|
|
|
26
37
|
export function markToolEnd(toolCallId) {
|
|
27
38
|
inFlightTools.delete(toolCallId);
|
|
28
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Mark an interactive elicitation (the model asking via ask_user_questions) as
|
|
42
|
+
* in flight. Ungated by auto-session.active so it is observable in foreground.
|
|
43
|
+
*/
|
|
44
|
+
export function markInteractiveElicitationStart() {
|
|
45
|
+
interactiveElicitationDepth++;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Mark an interactive elicitation as completed. Idempotent below zero.
|
|
49
|
+
*/
|
|
50
|
+
export function markInteractiveElicitationEnd() {
|
|
51
|
+
if (interactiveElicitationDepth > 0)
|
|
52
|
+
interactiveElicitationDepth--;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns true if any interactive elicitation is currently the active human
|
|
56
|
+
* boundary. True in ALL modes (foreground and auto) while one is in flight.
|
|
57
|
+
*/
|
|
58
|
+
export function isInteractiveElicitationInFlight() {
|
|
59
|
+
return interactiveElicitationDepth > 0;
|
|
60
|
+
}
|
|
29
61
|
/**
|
|
30
62
|
* Returns the age (ms) of the oldest currently in-flight tool, or 0 if none.
|
|
31
63
|
*/
|
|
@@ -75,6 +107,7 @@ export function hasInteractiveToolInFlight() {
|
|
|
75
107
|
*/
|
|
76
108
|
export function clearInFlightTools() {
|
|
77
109
|
inFlightTools.clear();
|
|
110
|
+
interactiveElicitationDepth = 0;
|
|
78
111
|
}
|
|
79
112
|
// ─── Tool invocation error classification (#2883) ────────────────────────
|
|
80
113
|
/**
|
|
@@ -85,6 +118,14 @@ export function clearInFlightTools() {
|
|
|
85
118
|
*/
|
|
86
119
|
const TOOL_INVOCATION_ERROR_RE = /Validation failed for tool|Input validation error|Invalid arguments for tool|MCP error -32602|No such tool available|Expected ',' or '\}'(?: after property value)?(?: in JSON)?|Unexpected end of JSON|Unexpected token.*in JSON|does not provide an export named|Named export .* not found|Cannot find module|ERR_MODULE_NOT_FOUND|ERR_MODULE_NOT_EXPORTED|ERR_PACKAGE_PATH_NOT_EXPORTED/i;
|
|
87
120
|
const DETERMINISTIC_POLICY_ERROR_RE = /(?:^|\b)(?:HARD BLOCK:|Blocked: \/gsd queue is a planning tool|Direct writes to \.gsd\/STATE\.md and \.gsd\/gsd\.db are blocked|This is a mechanical gate)/i;
|
|
121
|
+
/**
|
|
122
|
+
* Matches the runtime's "tool not registered" error. Unlike the deterministic
|
|
123
|
+
* invocation failures above, this one is usually transient: the workflow MCP
|
|
124
|
+
* server registers its tool surface asynchronously after session start, so a
|
|
125
|
+
* Unit's first tool call can race the registration. Callers should retry
|
|
126
|
+
* (bounded) instead of breaking the loop.
|
|
127
|
+
*/
|
|
128
|
+
const TOOL_UNAVAILABLE_ERROR_RE = new RegExp(`No such tool available|${TOOL_SURFACE_NOT_READY}`, "i");
|
|
88
129
|
/**
|
|
89
130
|
* Returns true if the error message indicates a deterministic invocation or
|
|
90
131
|
* policy failure (as opposed to a normal tool execution error).
|
|
@@ -94,6 +135,15 @@ export function isToolInvocationError(errorMsg) {
|
|
|
94
135
|
return false;
|
|
95
136
|
return TOOL_INVOCATION_ERROR_RE.test(errorMsg) || isDeterministicPolicyError(errorMsg);
|
|
96
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Returns true if the error message indicates the called tool was not on the
|
|
140
|
+
* session's tool surface (MCP startup race — see TOOL_UNAVAILABLE_ERROR_RE).
|
|
141
|
+
*/
|
|
142
|
+
export function isToolUnavailableError(errorMsg) {
|
|
143
|
+
if (!errorMsg)
|
|
144
|
+
return false;
|
|
145
|
+
return TOOL_UNAVAILABLE_ERROR_RE.test(errorMsg);
|
|
146
|
+
}
|
|
97
147
|
/**
|
|
98
148
|
* Returns true if the error message indicates the tool was skipped because
|
|
99
149
|
* a queued user message interrupted the turn (#3595). Retrying will produce
|