@opengsd/gsd-pi 1.3.0-dev.65546769 → 1.3.0-dev.72e3af2a
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/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +11 -2
- package/dist/resources/extensions/google-cli/stream-adapter.js +82 -15
- package/dist/resources/extensions/gsd/artifact-verification.js +427 -0
- package/dist/resources/extensions/gsd/auto/orchestrator.js +12 -3
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto-artifact-paths.js +28 -1
- package/dist/resources/extensions/gsd/auto-dispatch.js +20 -19
- package/dist/resources/extensions/gsd/auto-prompts.js +26 -11
- package/dist/resources/extensions/gsd/auto-recovery.js +6 -507
- package/dist/resources/extensions/gsd/auto-runtime-state.js +4 -5
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +3 -3
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +103 -13
- package/dist/resources/extensions/gsd/bootstrap/core-session-tools.js +38 -0
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +6 -1
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +10 -19
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +46 -19
- package/dist/resources/extensions/gsd/bootstrap/tool-call-loop-guard.js +68 -10
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +1 -1
- package/dist/resources/extensions/gsd/commands-context.js +19 -1
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +16 -10
- package/dist/resources/extensions/gsd/commands-worktree.js +12 -10
- package/dist/resources/extensions/gsd/dashboard-overlay.js +32 -3
- package/dist/resources/extensions/gsd/db/queries.js +60 -0
- package/dist/resources/extensions/gsd/db-workspace.js +55 -3
- package/dist/resources/extensions/gsd/doctor-providers.js +92 -8
- package/dist/resources/extensions/gsd/exec-sandbox.js +45 -9
- package/dist/resources/extensions/gsd/forensics.js +2 -32
- package/dist/resources/extensions/gsd/git-service.js +4 -4
- package/dist/resources/extensions/gsd/guided-flow-queue.js +66 -5
- package/dist/resources/extensions/gsd/health-widget.js +55 -29
- package/dist/resources/extensions/gsd/layout-policy.js +3 -1
- package/dist/resources/extensions/gsd/markdown-renderer.js +8 -9
- package/dist/resources/extensions/gsd/memory-consolidation-scanner.js +44 -21
- package/dist/resources/extensions/gsd/migration-auto-check.js +22 -0
- package/dist/resources/extensions/gsd/milestone-ids.js +32 -2
- package/dist/resources/extensions/gsd/milestone-implementation-evidence.js +26 -20
- package/dist/resources/extensions/gsd/prompts/code-review.md +6 -4
- package/dist/resources/extensions/gsd/quick.js +45 -2
- package/dist/resources/extensions/gsd/session-forensics.js +11 -1
- package/dist/resources/extensions/gsd/skills/gsd-headless/references/commands.md +1 -1
- package/dist/resources/extensions/gsd/state/derive/cache.js +28 -0
- package/dist/resources/extensions/gsd/state/derive/db-open.js +39 -0
- package/dist/resources/extensions/gsd/state/derive/from-db.js +452 -0
- package/dist/resources/extensions/gsd/state/derive/index.js +75 -0
- package/dist/resources/extensions/gsd/state/derive/interrupted-work.js +21 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/stale-render.js +45 -2
- package/dist/resources/extensions/gsd/state-reconciliation/index.js +48 -23
- package/dist/resources/extensions/gsd/state-reconciliation/registry.js +32 -28
- package/dist/resources/extensions/gsd/state.js +12 -611
- package/dist/resources/extensions/gsd/tools/complete-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/complete-task.js +43 -14
- package/dist/resources/extensions/gsd/tools/exec-tool.js +7 -2
- package/dist/resources/extensions/gsd/unit-context-composer.js +23 -7
- package/dist/resources/extensions/gsd/unit-registry.js +32 -4
- package/dist/resources/extensions/gsd/unmerged-milestone-guard.js +33 -3
- package/dist/resources/extensions/gsd/validation-block-guard.js +9 -4
- package/dist/resources/extensions/gsd/workflow-projections.js +19 -14
- package/dist/resources/extensions/gsd/workspace-git-preflight.js +30 -1
- package/dist/resources/extensions/gsd/worktree-manager.js +44 -2
- 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 +10 -10
- 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 +9 -9
- 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_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 +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/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
- 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/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +10 -10
- 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 → 2659.58e950899a9bb82f.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/2772.a7c1fcc69a4685ef.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{3616.3c60753b8ffcbd2e.js → 3616.61a2af74bb8833c8.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{4283.8e446784528ed9dc.js → 4283.d0d9e0a955e441cb.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{5826.a46ecdd1cfe8dabc.js → 5826.5421d66c72b9f34e.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{8785.481aa5869991b760.js → 8785.e29b3134cab1d153.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/8937.640dc9c2aaa1dfad.js +10 -0
- package/dist/web/standalone/.next/static/chunks/app/{page-6644fc6ee8ca1247.js → page-72a856634ad14c10.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/webpack-9c401904f87ded16.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/package.json +1 -1
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/dist/workflow.d.ts +1 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +2 -0
- 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/agent-session.d.ts +1 -0
- package/packages/gsd-agent-core/dist/agent-session.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/agent-session.js +3 -0
- package/packages/gsd-agent-core/dist/agent-session.js.map +1 -1
- package/packages/gsd-agent-core/dist/extension-ui-snapshot.d.ts +41 -0
- package/packages/gsd-agent-core/dist/extension-ui-snapshot.d.ts.map +1 -0
- package/packages/gsd-agent-core/dist/extension-ui-snapshot.js +62 -0
- package/packages/gsd-agent-core/dist/extension-ui-snapshot.js.map +1 -0
- package/packages/gsd-agent-core/dist/index.d.ts +2 -0
- package/packages/gsd-agent-core/dist/index.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/index.js +2 -0
- package/packages/gsd-agent-core/dist/index.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-events.js +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-events.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-host.d.ts +1 -0
- package/packages/gsd-agent-core/dist/session/agent-session-host.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-host.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.d.ts +5 -0
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.js +60 -3
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.js.map +1 -1
- package/packages/gsd-agent-core/dist/transcript-store.d.ts +58 -0
- package/packages/gsd-agent-core/dist/transcript-store.d.ts.map +1 -0
- package/packages/gsd-agent-core/dist/transcript-store.js +132 -0
- package/packages/gsd-agent-core/dist/transcript-store.js.map +1 -0
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- 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 +25 -11
- 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-latency.d.ts +4 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller-latency.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller-latency.js +7 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller-latency.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts +3 -24
- 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 +26 -829
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-handoff-filter.d.ts +58 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-handoff-filter.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-handoff-filter.js +312 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-handoff-filter.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-pinned-zone.d.ts +31 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-pinned-zone.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-pinned-zone.js +130 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-pinned-zone.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-segment-walker.d.ts +15 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-segment-walker.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-segment-walker.js +258 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-segment-walker.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-tool-rollup.d.ts +13 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-tool-rollup.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-tool-rollup.js +118 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-tool-rollup.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.d.ts +9 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.js +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-state.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-ui-state.d.ts +54 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-ui-state.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-ui-state.js +20 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode-ui-state.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts +4 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js +9 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/streaming-render-state.d.ts +56 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/streaming-render-state.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/streaming-render-state.js +44 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/streaming-render-state.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/tui-transcript-tracker.d.ts +5 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/tui-transcript-tracker.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/tui-transcript-tracker.js +77 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/tui-transcript-tracker.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js +18 -0
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/README.md +1 -1
- package/packages/mcp-server/dist/server.d.ts +1 -1
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +3 -3
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +13 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +34 -20
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +4 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/README.md +3 -2
- package/packages/pi-coding-agent/dist/core/session-manager-context.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/session-manager-context.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-context.js +94 -0
- package/packages/pi-coding-agent/dist/core/session-manager-context.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-list.d.ts +8 -0
- package/packages/pi-coding-agent/dist/core/session-manager-list.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-list.js +244 -0
- package/packages/pi-coding-agent/dist/core/session-manager-list.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-migration.d.ts +12 -0
- package/packages/pi-coding-agent/dist/core/session-manager-migration.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-migration.js +84 -0
- package/packages/pi-coding-agent/dist/core/session-manager-migration.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-types.d.ts +135 -0
- package/packages/pi-coding-agent/dist/core/session-manager-types.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager-types.js +2 -0
- package/packages/pi-coding-agent/dist/core/session-manager-types.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +6 -154
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +22 -459
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme-schema.d.ts +75 -75
- package/packages/pi-coding-agent/dist/theme/theme-schema.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme-schema.js +1 -1
- package/packages/pi-coding-agent/dist/theme/theme-schema.js.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.js +11 -7
- package/packages/pi-coding-agent/dist/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/dist/theme/theme-schema.d.ts +75 -75
- package/pkg/dist/theme/theme-schema.d.ts.map +1 -1
- package/pkg/dist/theme/theme-schema.js +1 -1
- package/pkg/dist/theme/theme-schema.js.map +1 -1
- package/pkg/dist/theme/theme.d.ts.map +1 -1
- package/pkg/dist/theme/theme.js +11 -7
- package/pkg/dist/theme/theme.js.map +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +20 -2
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +80 -0
- package/src/resources/extensions/google-cli/stream-adapter.ts +106 -19
- package/src/resources/extensions/gsd/artifact-verification.ts +464 -0
- package/src/resources/extensions/gsd/auto/orchestrator.ts +25 -11
- package/src/resources/extensions/gsd/auto/session.ts +5 -0
- package/src/resources/extensions/gsd/auto-artifact-paths.ts +47 -1
- package/src/resources/extensions/gsd/auto-dispatch.ts +21 -23
- package/src/resources/extensions/gsd/auto-prompts.ts +38 -12
- package/src/resources/extensions/gsd/auto-recovery.ts +10 -508
- package/src/resources/extensions/gsd/auto-runtime-state.ts +4 -5
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +3 -2
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +125 -12
- package/src/resources/extensions/gsd/bootstrap/core-session-tools.ts +43 -0
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +6 -1
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +11 -19
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +52 -18
- package/src/resources/extensions/gsd/bootstrap/tool-call-loop-guard.ts +74 -10
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +1 -1
- package/src/resources/extensions/gsd/commands-context.ts +18 -1
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +14 -9
- package/src/resources/extensions/gsd/commands-worktree.ts +12 -10
- package/src/resources/extensions/gsd/dashboard-overlay.ts +32 -3
- package/src/resources/extensions/gsd/db/queries.ts +79 -0
- package/src/resources/extensions/gsd/db-workspace.ts +61 -3
- package/src/resources/extensions/gsd/doctor-providers.ts +103 -9
- package/src/resources/extensions/gsd/exec-sandbox.ts +49 -9
- package/src/resources/extensions/gsd/forensics.ts +2 -33
- package/src/resources/extensions/gsd/git-service.ts +5 -5
- package/src/resources/extensions/gsd/guided-flow-queue.ts +89 -4
- package/src/resources/extensions/gsd/health-widget.ts +69 -32
- package/src/resources/extensions/gsd/layout-policy.ts +2 -1
- package/src/resources/extensions/gsd/markdown-renderer.ts +8 -11
- package/src/resources/extensions/gsd/memory-consolidation-scanner.ts +51 -19
- package/src/resources/extensions/gsd/migration-auto-check.ts +23 -0
- package/src/resources/extensions/gsd/milestone-ids.ts +31 -2
- package/src/resources/extensions/gsd/milestone-implementation-evidence.ts +35 -21
- package/src/resources/extensions/gsd/prompts/code-review.md +6 -4
- package/src/resources/extensions/gsd/quick.ts +43 -2
- package/src/resources/extensions/gsd/session-forensics.ts +11 -1
- package/src/resources/extensions/gsd/skills/gsd-headless/references/commands.md +1 -1
- package/src/resources/extensions/gsd/state/derive/cache.ts +46 -0
- package/src/resources/extensions/gsd/state/derive/db-open.ts +45 -0
- package/src/resources/extensions/gsd/state/derive/from-db.ts +561 -0
- package/src/resources/extensions/gsd/state/derive/index.ts +104 -0
- package/src/resources/extensions/gsd/state/derive/interrupted-work.ts +31 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/stale-render.ts +81 -7
- package/src/resources/extensions/gsd/state-reconciliation/index.ts +50 -24
- package/src/resources/extensions/gsd/state-reconciliation/registry.ts +43 -28
- package/src/resources/extensions/gsd/state.ts +32 -732
- package/src/resources/extensions/gsd/tests/auto-artifact-paths.test.ts +98 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +111 -1
- package/src/resources/extensions/gsd/tests/commands-context.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/commands-gsd-core.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/commands-worktree-clean.test.ts +80 -0
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/complete-task-rollback-evidence.test.ts +48 -8
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/dashboard-overlay.test.ts +55 -2
- package/src/resources/extensions/gsd/tests/dispatch-rule-coverage.test.ts +26 -1
- package/src/resources/extensions/gsd/tests/doctor-forensics-db-open-regression.test.ts +70 -2
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/exec-graceful-kill.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/exec-tool.test.ts +45 -1
- package/src/resources/extensions/gsd/tests/forensics-error-filter.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-milestone-prompt-rendering.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +268 -3
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +119 -1
- package/src/resources/extensions/gsd/tests/integration/queue-active-milestone-context-budget.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/integration/quick-branch-lifecycle.test.ts +56 -9
- package/src/resources/extensions/gsd/tests/knowledge-cold-start.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/memory-consolidation-scanner.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/orchestrator-logs.test.ts +43 -1
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/parsers-legacy-importers.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +54 -1
- package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +50 -14
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +195 -1
- package/src/resources/extensions/gsd/tests/read-uat-gate-verdict.test.ts +185 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/stalled-tool-recovery.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +191 -0
- package/src/resources/extensions/gsd/tests/tool-call-loop-guard.test.ts +151 -0
- package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +193 -14
- package/src/resources/extensions/gsd/tests/unmerged-milestone-guard.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/validation-block-guard.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/verify-artifact-tightened.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/workspace-git-preflight.test.ts +151 -2
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +39 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/complete-task.ts +53 -15
- package/src/resources/extensions/gsd/tools/exec-tool.ts +7 -3
- package/src/resources/extensions/gsd/unit-context-composer.ts +33 -7
- package/src/resources/extensions/gsd/unit-registry.ts +32 -4
- package/src/resources/extensions/gsd/unmerged-milestone-guard.ts +41 -5
- package/src/resources/extensions/gsd/validation-block-guard.ts +13 -7
- package/src/resources/extensions/gsd/workflow-projections.ts +20 -14
- package/src/resources/extensions/gsd/workspace-git-preflight.ts +31 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +41 -1
- package/dist/web/standalone/.next/static/chunks/2772.bfa657f49f955239.js +0 -1
- package/dist/web/standalone/.next/static/chunks/796.e0bdc932325d7e03.js +0 -10
- package/dist/web/standalone/.next/static/chunks/webpack-f46ea08200a0227e.js +0 -1
- /package/dist/web/standalone/.next/static/{BTKtGFF1Y-hvVJEGhBRo9 → O7xDYXO0r4zFhIzY1hrWV}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{BTKtGFF1Y-hvVJEGhBRo9 → O7xDYXO0r4zFhIzY1hrWV}/_ssgManifest.js +0 -0
|
@@ -20,7 +20,13 @@ const ZERO_USAGE = {
|
|
|
20
20
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
type GoogleCliProviderId = "google-gemini-cli" | "google-antigravity";
|
|
23
|
+
export type GoogleCliProviderId = "google-gemini-cli" | "google-antigravity";
|
|
24
|
+
|
|
25
|
+
export interface GoogleCliRunPlan {
|
|
26
|
+
command: string;
|
|
27
|
+
args: string[];
|
|
28
|
+
stdin?: string;
|
|
29
|
+
}
|
|
24
30
|
|
|
25
31
|
interface CliRunResult {
|
|
26
32
|
stdout: string;
|
|
@@ -29,6 +35,71 @@ interface CliRunResult {
|
|
|
29
35
|
signal: NodeJS.Signals | null;
|
|
30
36
|
}
|
|
31
37
|
|
|
38
|
+
const WINDOWS_CHILD_ENV_KEYS = new Set([
|
|
39
|
+
"ALLUSERSPROFILE",
|
|
40
|
+
"APPDATA",
|
|
41
|
+
"COMSPEC",
|
|
42
|
+
"COMMONPROGRAMFILES",
|
|
43
|
+
"COMMONPROGRAMFILES(X86)",
|
|
44
|
+
"FORCE_COLOR",
|
|
45
|
+
"HOME",
|
|
46
|
+
"HOMEDRIVE",
|
|
47
|
+
"HOMEPATH",
|
|
48
|
+
"LANG",
|
|
49
|
+
"LC_ALL",
|
|
50
|
+
"LOCALAPPDATA",
|
|
51
|
+
"NODE_EXTRA_CA_CERTS",
|
|
52
|
+
"NO_COLOR",
|
|
53
|
+
"NO_PROXY",
|
|
54
|
+
"PATHEXT",
|
|
55
|
+
"PATH",
|
|
56
|
+
"PROGRAMDATA",
|
|
57
|
+
"PROGRAMFILES",
|
|
58
|
+
"PROGRAMFILES(X86)",
|
|
59
|
+
"SSL_CERT_FILE",
|
|
60
|
+
"SYSTEMROOT",
|
|
61
|
+
"TEMP",
|
|
62
|
+
"TERM",
|
|
63
|
+
"TMP",
|
|
64
|
+
"TMPDIR",
|
|
65
|
+
"USER",
|
|
66
|
+
"USERNAME",
|
|
67
|
+
"USERPROFILE",
|
|
68
|
+
"WINDIR",
|
|
69
|
+
"XDG_CACHE_HOME",
|
|
70
|
+
"XDG_CONFIG_HOME",
|
|
71
|
+
"HTTP_PROXY",
|
|
72
|
+
"HTTPS_PROXY",
|
|
73
|
+
]);
|
|
74
|
+
|
|
75
|
+
const WINDOWS_CHILD_ENV_PREFIXES = [
|
|
76
|
+
"AGY_",
|
|
77
|
+
"ANTIGRAVITY_",
|
|
78
|
+
"CLOUDSDK_",
|
|
79
|
+
"GEMINI_",
|
|
80
|
+
"GOOGLE_",
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
export function buildGoogleCliChildEnv(
|
|
84
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
85
|
+
platform: NodeJS.Platform = process.platform,
|
|
86
|
+
): NodeJS.ProcessEnv {
|
|
87
|
+
if (platform !== "win32") return env;
|
|
88
|
+
|
|
89
|
+
const childEnv: NodeJS.ProcessEnv = {};
|
|
90
|
+
for (const [key, value] of Object.entries(env)) {
|
|
91
|
+
if (typeof value !== "string") continue;
|
|
92
|
+
const upperKey = key.toUpperCase();
|
|
93
|
+
if (
|
|
94
|
+
WINDOWS_CHILD_ENV_KEYS.has(upperKey) ||
|
|
95
|
+
WINDOWS_CHILD_ENV_PREFIXES.some((prefix) => upperKey.startsWith(prefix))
|
|
96
|
+
) {
|
|
97
|
+
childEnv[key] = value;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return childEnv;
|
|
101
|
+
}
|
|
102
|
+
|
|
32
103
|
function textBlocks(content: (TextContent | { type: string })[]): string {
|
|
33
104
|
return content
|
|
34
105
|
.map((block) => block.type === "text" ? (block as TextContent).text : `[${block.type} omitted]`)
|
|
@@ -120,15 +191,15 @@ function commandForProvider(provider: GoogleCliProviderId): string {
|
|
|
120
191
|
return provider === "google-gemini-cli" ? "gemini" : "agy";
|
|
121
192
|
}
|
|
122
193
|
|
|
123
|
-
function argsForProvider(provider: GoogleCliProviderId,
|
|
194
|
+
function argsForProvider(provider: GoogleCliProviderId, modelId: string, prompt?: string): string[] {
|
|
124
195
|
if (provider === "google-gemini-cli") {
|
|
125
|
-
const args = ["-p", prompt, "--output-format", "json"];
|
|
126
|
-
if (
|
|
196
|
+
const args = prompt === undefined ? ["--output-format", "json"] : ["-p", prompt, "--output-format", "json"];
|
|
197
|
+
if (modelId !== "default") args.unshift("-m", modelId);
|
|
127
198
|
return args;
|
|
128
199
|
}
|
|
129
200
|
|
|
130
|
-
const args = ["-p", prompt];
|
|
131
|
-
if (
|
|
201
|
+
const args = prompt === undefined ? [] : ["-p", prompt];
|
|
202
|
+
if (modelId !== "default") args.unshift("-m", modelId);
|
|
132
203
|
return args;
|
|
133
204
|
}
|
|
134
205
|
|
|
@@ -136,20 +207,33 @@ export function buildGoogleCliSpawnInvocation(
|
|
|
136
207
|
command: string,
|
|
137
208
|
args: string[],
|
|
138
209
|
platform: NodeJS.Platform = process.platform,
|
|
139
|
-
):
|
|
210
|
+
): Omit<GoogleCliRunPlan, "stdin"> {
|
|
140
211
|
if (platform === "win32") {
|
|
141
212
|
return { command: "cmd", args: ["/c", command, ...args] };
|
|
142
213
|
}
|
|
143
214
|
return { command, args };
|
|
144
215
|
}
|
|
145
216
|
|
|
146
|
-
function
|
|
217
|
+
export function buildGoogleCliRunPlan(
|
|
218
|
+
provider: GoogleCliProviderId,
|
|
219
|
+
modelId: string,
|
|
220
|
+
prompt: string,
|
|
221
|
+
platform: NodeJS.Platform = process.platform,
|
|
222
|
+
): GoogleCliRunPlan {
|
|
223
|
+
const pipePrompt = platform === "win32";
|
|
224
|
+
const args = argsForProvider(provider, modelId, pipePrompt ? undefined : prompt);
|
|
225
|
+
return {
|
|
226
|
+
...buildGoogleCliSpawnInvocation(commandForProvider(provider), args, platform),
|
|
227
|
+
...(pipePrompt ? { stdin: prompt } : {}),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function runCli(plan: GoogleCliRunPlan, options?: SimpleStreamOptions): Promise<CliRunResult> {
|
|
147
232
|
return new Promise((resolve, reject) => {
|
|
148
|
-
const
|
|
149
|
-
const child = spawn(invocation.command, invocation.args, {
|
|
233
|
+
const child = spawn(plan.command, plan.args, {
|
|
150
234
|
cwd: options?.cwd || process.cwd(),
|
|
151
|
-
env:
|
|
152
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
235
|
+
env: buildGoogleCliChildEnv(),
|
|
236
|
+
stdio: [plan.stdin === undefined ? "ignore" : "pipe", "pipe", "pipe"],
|
|
153
237
|
});
|
|
154
238
|
|
|
155
239
|
let stdout = "";
|
|
@@ -174,12 +258,17 @@ function runCli(command: string, args: string[], options?: SimpleStreamOptions):
|
|
|
174
258
|
}
|
|
175
259
|
options?.signal?.addEventListener("abort", onAbort);
|
|
176
260
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
261
|
+
if (plan.stdin !== undefined) {
|
|
262
|
+
child.stdin?.on("error", () => {});
|
|
263
|
+
child.stdin?.end(plan.stdin);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
child.stdout!.setEncoding("utf8");
|
|
267
|
+
child.stderr!.setEncoding("utf8");
|
|
268
|
+
child.stdout!.on("data", (chunk) => {
|
|
180
269
|
stdout += chunk;
|
|
181
270
|
});
|
|
182
|
-
child.stderr
|
|
271
|
+
child.stderr!.on("data", (chunk) => {
|
|
183
272
|
stderr += chunk;
|
|
184
273
|
});
|
|
185
274
|
|
|
@@ -243,9 +332,7 @@ export function streamViaGoogleCli(
|
|
|
243
332
|
queueMicrotask(async () => {
|
|
244
333
|
try {
|
|
245
334
|
const prompt = buildGoogleCliPrompt(context);
|
|
246
|
-
const
|
|
247
|
-
const args = argsForProvider(provider, model, prompt);
|
|
248
|
-
const result = await runCli(command, args, options);
|
|
335
|
+
const result = await runCli(buildGoogleCliRunPlan(provider, model.id, prompt), options);
|
|
249
336
|
|
|
250
337
|
if (result.code !== 0) {
|
|
251
338
|
const detail = (result.stderr || result.stdout || `CLI exited with code ${result.code}`).trim();
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
// Project/App: gsd-pi
|
|
2
|
+
// File Purpose: Auto-mode artifact verification and worktree path fallbacks.
|
|
3
|
+
|
|
4
|
+
import { parseUnitId } from "./unit-id.js";
|
|
5
|
+
import { MILESTONE_ID_RE } from "./milestone-ids.js";
|
|
6
|
+
import { clearParseCache } from "./files.js";
|
|
7
|
+
import { parseRoadmap as parseLegacyRoadmap, parsePlan as parseLegacyPlan } from "./parsers-legacy.js";
|
|
8
|
+
import {
|
|
9
|
+
isDbAvailable,
|
|
10
|
+
getTask,
|
|
11
|
+
getSlice,
|
|
12
|
+
getSliceTasks,
|
|
13
|
+
getPendingGatesForTurn,
|
|
14
|
+
} from "./gsd-db.js";
|
|
15
|
+
import { refreshWorkflowDatabaseFromDisk } from "./db-workspace.js";
|
|
16
|
+
import { isValidationTerminal } from "./state.js";
|
|
17
|
+
import { getErrorMessage } from "./error-utils.js";
|
|
18
|
+
import { logWarning, logError } from "./workflow-logger.js";
|
|
19
|
+
import { isClosedStatus } from "./status-guards.js";
|
|
20
|
+
import {
|
|
21
|
+
resolveSlicePath,
|
|
22
|
+
resolveSliceFile,
|
|
23
|
+
resolveTasksDir,
|
|
24
|
+
resolveTaskFiles,
|
|
25
|
+
relSliceFile,
|
|
26
|
+
resolveMilestoneFile,
|
|
27
|
+
clearPathCache,
|
|
28
|
+
resolveGsdRootFile,
|
|
29
|
+
} from "./paths.js";
|
|
30
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
31
|
+
import { execFileSync } from "node:child_process";
|
|
32
|
+
import { LAYOUT_SEGMENTS } from "./layout-policy.js";
|
|
33
|
+
import { dirname, join, resolve } from "node:path";
|
|
34
|
+
import {
|
|
35
|
+
resolveExpectedArtifactPath,
|
|
36
|
+
resolveExistingSliceResearchPath,
|
|
37
|
+
} from "./auto-artifact-paths.js";
|
|
38
|
+
import { classifyMilestoneSummaryContent } from "./milestone-summary-classifier.js";
|
|
39
|
+
import { hasVerdict } from "./verdict-parser.js";
|
|
40
|
+
import { validateArtifact } from "./schemas/validate.js";
|
|
41
|
+
import { getProjectResearchStatus } from "./project-research-policy.js";
|
|
42
|
+
import { isGsdWorktreePath } from "./worktree-root.js";
|
|
43
|
+
import { resolveCanonicalMilestoneRoot } from "./worktree-manager.js";
|
|
44
|
+
import { resolveWorktreeProjectRoot } from "./worktree-root.js";
|
|
45
|
+
import { hasImplementationArtifacts } from "./milestone-implementation-evidence.js";
|
|
46
|
+
import { loadAllCaptures, loadPendingCaptures } from "./captures.js";
|
|
47
|
+
import { proveMilestoneCloseout } from "./milestone-closeout-proof.js";
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Optional override for the legacy roadmap parser used by verifyExpectedArtifact.
|
|
51
|
+
* Production leaves this null so the real parseLegacyRoadmap runs; tests inject
|
|
52
|
+
* a throwing function to deterministically exercise the parse-failure catches.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
let _roadmapParserFn: ((content: string) => { slices: Array<{ id: string; done: boolean; depends?: string[] }> }) | null = null;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Inject an override for the legacy roadmap parser, returning a function that
|
|
59
|
+
* restores the default (real parser) behavior. No production caller.
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export function _setRoadmapParserFnForTests(
|
|
63
|
+
fn: ((content: string) => { slices: Array<{ id: string; done: boolean; depends?: string[] }> }) | null,
|
|
64
|
+
): () => void {
|
|
65
|
+
const previous = _roadmapParserFn;
|
|
66
|
+
_roadmapParserFn = fn;
|
|
67
|
+
return () => { _roadmapParserFn = previous; };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function parseRoadmapForRecovery(content: string): ReturnType<NonNullable<typeof _roadmapParserFn>> {
|
|
71
|
+
if (_roadmapParserFn) return _roadmapParserFn(content);
|
|
72
|
+
return parseLegacyRoadmap(content) as unknown as ReturnType<NonNullable<typeof _roadmapParserFn>>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function diagnoseWorktreeIntegrityFailure(basePath: string): string | null {
|
|
76
|
+
if (!isGsdWorktreePath(basePath)) return null;
|
|
77
|
+
if (!existsSync(basePath)) {
|
|
78
|
+
return `Worktree integrity failure: ${basePath} does not exist. Repair or recreate the worktree before retrying.`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const gitPath = join(basePath, ".git");
|
|
82
|
+
if (!existsSync(gitPath)) {
|
|
83
|
+
return `Worktree integrity failure: ${basePath} is not a valid git worktree (.git missing). Repair or recreate the worktree before retrying.`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
execFileSync("git", ["rev-parse", "--git-dir"], {
|
|
88
|
+
cwd: basePath,
|
|
89
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
90
|
+
encoding: "utf-8",
|
|
91
|
+
});
|
|
92
|
+
return null;
|
|
93
|
+
} catch (err) {
|
|
94
|
+
return `Worktree integrity failure: ${basePath} is not a valid git worktree (git rev-parse failed: ${getErrorMessage(err).split("\n")[0]}). Repair or recreate the worktree before retrying.`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function resolveArtifactVerificationBase(unitId: string, base: string): string {
|
|
99
|
+
const { milestone } = parseUnitId(unitId);
|
|
100
|
+
if (!MILESTONE_ID_RE.test(milestone)) return base;
|
|
101
|
+
return resolveCanonicalMilestoneRoot(base, milestone);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function hasCapturedWorkflowPrefs(base: string): boolean {
|
|
105
|
+
const prefsPath = resolveExpectedArtifactPath("workflow-preferences", "WORKFLOW-PREFS", base);
|
|
106
|
+
if (!prefsPath || !existsSync(prefsPath)) return false;
|
|
107
|
+
const content = readFileSync(prefsPath, "utf-8");
|
|
108
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
109
|
+
return !!match && /^workflow_prefs_captured:\s*true\s*$/m.test(match[1]);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function hasValidResearchDecision(base: string): boolean {
|
|
113
|
+
const decisionPath = resolveExpectedArtifactPath("research-decision", "RESEARCH-DECISION", base);
|
|
114
|
+
if (!decisionPath || !existsSync(decisionPath)) return false;
|
|
115
|
+
try {
|
|
116
|
+
const cfg = JSON.parse(readFileSync(decisionPath, "utf-8")) as Record<string, unknown>;
|
|
117
|
+
return cfg.decision === "research" || cfg.decision === "skip";
|
|
118
|
+
} catch {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function hasCompleteProjectResearch(base: string): boolean {
|
|
124
|
+
return getProjectResearchStatus(base).complete;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function escapeRegExp(value: string): string {
|
|
128
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function hasCheckedTaskCompletionOnDisk(base: string, mid: string, sid: string, tid: string): boolean {
|
|
132
|
+
const slicePath = resolveSlicePath(base, mid, sid);
|
|
133
|
+
if (!slicePath) return false;
|
|
134
|
+
|
|
135
|
+
const planAbs = resolveSliceFile(base, mid, sid, "PLAN");
|
|
136
|
+
if (!planAbs || !existsSync(planAbs)) return false;
|
|
137
|
+
|
|
138
|
+
const planContent = readFileSync(planAbs, "utf-8");
|
|
139
|
+
const cbRe = new RegExp(`^\\s*-\\s+\\[[xX]\\]\\s+\\*\\*${escapeRegExp(tid)}(?:\\*\\*)?:`, "m");
|
|
140
|
+
return cbRe.test(planContent);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Check whether the expected artifact(s) for a unit exist on disk.
|
|
145
|
+
* Returns true if all required artifacts exist, or if the unit type has no
|
|
146
|
+
* single verifiable artifact (e.g., replan-slice).
|
|
147
|
+
*/
|
|
148
|
+
export function verifyExpectedArtifact(
|
|
149
|
+
unitType: string,
|
|
150
|
+
unitId: string,
|
|
151
|
+
base: string,
|
|
152
|
+
): boolean {
|
|
153
|
+
if (unitType.startsWith("hook/")) return true;
|
|
154
|
+
|
|
155
|
+
clearPathCache();
|
|
156
|
+
clearParseCache();
|
|
157
|
+
|
|
158
|
+
if (unitType === "rewrite-docs") {
|
|
159
|
+
const overridesPath = resolveGsdRootFile(base, "OVERRIDES");
|
|
160
|
+
if (!existsSync(overridesPath)) return true;
|
|
161
|
+
const content = readFileSync(overridesPath, "utf-8");
|
|
162
|
+
return !content.includes("**Scope:** active");
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (unitType === "workflow-preferences") {
|
|
166
|
+
return hasCapturedWorkflowPrefs(base);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (unitType === "triage-captures") {
|
|
170
|
+
const pending = loadPendingCaptures(base);
|
|
171
|
+
if (pending.length === 0) return true;
|
|
172
|
+
logWarning("recovery", `verify-fail triage-captures ${unitId}: ${pending.length} pending capture(s) remain in CAPTURES.md`);
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (unitType === "quick-task") {
|
|
177
|
+
const { slice: captureId } = parseUnitId(unitId);
|
|
178
|
+
const capture = captureId ? loadAllCaptures(base).find((entry) => entry.id === captureId) : undefined;
|
|
179
|
+
if (capture?.executed === true) return true;
|
|
180
|
+
logWarning("recovery", `verify-fail quick-task ${unitId}: capture ${captureId ?? "(missing capture id)"} not found or not marked executed`);
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (unitType === "discuss-project") {
|
|
185
|
+
const projectPath = resolveExpectedArtifactPath(unitType, unitId, base);
|
|
186
|
+
return !!projectPath && existsSync(projectPath) && validateArtifact(projectPath, "project").ok;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (unitType === "discuss-requirements") {
|
|
190
|
+
const requirementsPath = resolveExpectedArtifactPath(unitType, unitId, base);
|
|
191
|
+
return !!requirementsPath && existsSync(requirementsPath) && validateArtifact(requirementsPath, "requirements").ok;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (unitType === "research-decision") {
|
|
195
|
+
return hasValidResearchDecision(base);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (unitType === "research-project") {
|
|
199
|
+
return hasCompleteProjectResearch(base);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (unitType === "reactive-execute") {
|
|
203
|
+
const { milestone: mid, slice: sid, task: batchPart } = parseUnitId(unitId);
|
|
204
|
+
if (!mid || !sid || !batchPart) return false;
|
|
205
|
+
const blockerPath = resolveExpectedArtifactPath(unitType, unitId, base);
|
|
206
|
+
if (blockerPath && existsSync(blockerPath)) {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
const slicePath = resolveSlicePath(base, mid, sid);
|
|
210
|
+
if (!slicePath) return false;
|
|
211
|
+
|
|
212
|
+
const plusIdx = batchPart.indexOf("+");
|
|
213
|
+
if (plusIdx === -1) {
|
|
214
|
+
const tDir = resolveTasksDir(base, mid, sid) ?? slicePath;
|
|
215
|
+
const summaryFiles = resolveTaskFiles(tDir, "SUMMARY");
|
|
216
|
+
return summaryFiles.length > 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const batchIds = batchPart.slice(plusIdx + 1).split(",").filter(Boolean);
|
|
220
|
+
if (batchIds.length === 0) return false;
|
|
221
|
+
|
|
222
|
+
const tDir = resolveTasksDir(base, mid, sid) ?? slicePath;
|
|
223
|
+
const existingSummaries = new Set(
|
|
224
|
+
resolveTaskFiles(tDir, "SUMMARY").map((f) =>
|
|
225
|
+
f.replace(/-SUMMARY\.md$/i, "").toUpperCase(),
|
|
226
|
+
),
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
for (const tid of batchIds) {
|
|
230
|
+
if (!existingSummaries.has(tid.toUpperCase())) return false;
|
|
231
|
+
}
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (unitType === "gate-evaluate") {
|
|
236
|
+
const { milestone: mid, slice: sid, task: batchPart } = parseUnitId(unitId);
|
|
237
|
+
if (!mid || !sid || !batchPart) return false;
|
|
238
|
+
|
|
239
|
+
const plusIdx = batchPart.indexOf("+");
|
|
240
|
+
if (plusIdx === -1) return true;
|
|
241
|
+
|
|
242
|
+
const gateIds = batchPart.slice(plusIdx + 1).split(",").filter(Boolean);
|
|
243
|
+
if (gateIds.length === 0) return true;
|
|
244
|
+
|
|
245
|
+
try {
|
|
246
|
+
if (!isDbAvailable()) return false;
|
|
247
|
+
const pending = getPendingGatesForTurn(mid, sid, "gate-evaluate");
|
|
248
|
+
const pendingIds = new Set<string>(pending.map((g) => g.gate_id));
|
|
249
|
+
for (const gid of gateIds) {
|
|
250
|
+
if (pendingIds.has(gid)) return false;
|
|
251
|
+
}
|
|
252
|
+
} catch (err) {
|
|
253
|
+
logWarning("recovery", `gate-evaluate DB check failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
254
|
+
}
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (unitType === "research-slice" && unitId.endsWith("/parallel-research")) {
|
|
259
|
+
const { milestone: mid } = parseUnitId(unitId);
|
|
260
|
+
if (!mid) return false;
|
|
261
|
+
|
|
262
|
+
const blockerPath = resolveExpectedArtifactPath(unitType, unitId, base);
|
|
263
|
+
if (blockerPath && existsSync(blockerPath)) {
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const roadmapFile = resolveExpectedArtifactPath("plan-milestone", mid, base);
|
|
268
|
+
if (!roadmapFile || !existsSync(roadmapFile)) {
|
|
269
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: roadmap missing`);
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
const roadmap = parseRoadmapForRecovery(readFileSync(roadmapFile, "utf-8"));
|
|
274
|
+
const milestoneResearchFile = resolveExpectedArtifactPath("research-milestone", mid, base);
|
|
275
|
+
const hasMilestoneResearch = !!milestoneResearchFile && existsSync(milestoneResearchFile);
|
|
276
|
+
for (const slice of roadmap.slices) {
|
|
277
|
+
if (slice.done) continue;
|
|
278
|
+
if (hasMilestoneResearch && slice.id === "S01") continue;
|
|
279
|
+
const depsComplete = (slice.depends ?? []).every((depId) => {
|
|
280
|
+
const summaryPath = resolveExpectedArtifactPath("complete-slice", `${mid}/${depId}`, base);
|
|
281
|
+
return !!summaryPath && existsSync(summaryPath);
|
|
282
|
+
});
|
|
283
|
+
if (!depsComplete) continue;
|
|
284
|
+
if (!resolveExistingSliceResearchPath(base, mid, slice.id)) {
|
|
285
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: slice ${slice.id} missing RESEARCH`);
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return true;
|
|
290
|
+
} catch (err) {
|
|
291
|
+
logWarning("recovery", `parallel-research verification failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const artifactBase = resolveArtifactVerificationBase(unitId, base);
|
|
297
|
+
let absPath = resolveExpectedArtifactPath(unitType, unitId, artifactBase);
|
|
298
|
+
if (!absPath || !existsSync(absPath)) {
|
|
299
|
+
const projectRoot = resolve(resolveWorktreeProjectRoot(artifactBase));
|
|
300
|
+
if (projectRoot && projectRoot !== artifactBase) {
|
|
301
|
+
const projectPath = resolveExpectedArtifactPath(unitType, unitId, projectRoot);
|
|
302
|
+
if (projectPath && existsSync(projectPath)) {
|
|
303
|
+
absPath = projectPath;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (!absPath) {
|
|
308
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: resolveExpectedArtifactPath returned null (no artifact contract registered for this unit type)`);
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
if (!existsSync(absPath)) {
|
|
312
|
+
const worktreeFailure = diagnoseWorktreeIntegrityFailure(artifactBase);
|
|
313
|
+
if (worktreeFailure) {
|
|
314
|
+
logError("recovery", `${worktreeFailure} Unit: ${unitType} ${unitId}.`);
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: existsSync false for ${absPath}`);
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (unitType === "validate-milestone") {
|
|
322
|
+
const validationContent = readFileSync(absPath, "utf-8");
|
|
323
|
+
if (!isValidationTerminal(validationContent)) {
|
|
324
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: validation not terminal (len=${validationContent.length}) at ${absPath}`);
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (unitType === "run-uat") {
|
|
330
|
+
const assessmentContent = readFileSync(absPath, "utf-8");
|
|
331
|
+
if (!hasVerdict(assessmentContent)) {
|
|
332
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: assessment missing verdict at ${absPath}`);
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (unitType === "plan-milestone") {
|
|
338
|
+
try {
|
|
339
|
+
const roadmap = parseRoadmapForRecovery(readFileSync(absPath, "utf-8"));
|
|
340
|
+
if (roadmap.slices.length === 0) {
|
|
341
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: roadmap has zero slices at ${absPath}`);
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
} catch (err) {
|
|
345
|
+
logWarning("recovery", `plan-milestone roadmap verification failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (unitType === "plan-slice") {
|
|
351
|
+
const { milestone: mid, slice: sid } = parseUnitId(unitId);
|
|
352
|
+
if (mid && sid) {
|
|
353
|
+
try {
|
|
354
|
+
let taskIds: string[] | null = null;
|
|
355
|
+
let dbPrimary = false;
|
|
356
|
+
if (isDbAvailable()) {
|
|
357
|
+
const refreshed = refreshWorkflowDatabaseFromDisk();
|
|
358
|
+
if (refreshed) {
|
|
359
|
+
const tasks = getSliceTasks(mid, sid);
|
|
360
|
+
if (tasks.length > 0) {
|
|
361
|
+
taskIds = tasks.map(t => t.id);
|
|
362
|
+
dbPrimary = true;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (!taskIds) {
|
|
368
|
+
const planContent = readFileSync(absPath, "utf-8");
|
|
369
|
+
const hasCheckboxTask = /^\s*- \[[xX ]\] \*\*T\d+/m.test(planContent);
|
|
370
|
+
const hasHeadingTask = /^\s*#{2,4}\s+T\d+\s*(?:--|—|:)/m.test(planContent);
|
|
371
|
+
if (!hasCheckboxTask && !hasHeadingTask) {
|
|
372
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: plan has no task checkbox/heading (len=${planContent.length}) at ${absPath}`);
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
const plan = parseLegacyPlan(planContent);
|
|
376
|
+
if (plan.tasks.length > 0) taskIds = plan.tasks.map((t: { id: string }) => t.id);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (taskIds && taskIds.length > 0) {
|
|
380
|
+
const tasksDir = join(dirname(absPath), "tasks");
|
|
381
|
+
if (existsSync(tasksDir)) {
|
|
382
|
+
for (const tid of taskIds) {
|
|
383
|
+
const taskPlanFile = join(tasksDir, `${tid}-PLAN.md`);
|
|
384
|
+
if (!existsSync(taskPlanFile)) {
|
|
385
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: task plan missing ${taskPlanFile}`);
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
} else if (!dbPrimary && !absPath.replace(/\\/g, "/").includes(`.gsd/${LAYOUT_SEGMENTS.level1}`)) {
|
|
390
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: tasks dir missing at ${tasksDir}`);
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
} catch (err) {
|
|
395
|
+
logWarning("recovery", `plan-slice task plan verification failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if (unitType === "execute-task") {
|
|
401
|
+
const { milestone: mid, slice: sid, task: tid } = parseUnitId(unitId);
|
|
402
|
+
if (mid && sid && tid) {
|
|
403
|
+
const dbTask = getTask(mid, sid, tid);
|
|
404
|
+
if (dbTask) {
|
|
405
|
+
if (dbTask.status !== "complete" && dbTask.status !== "done" && !hasCheckedTaskCompletionOnDisk(base, mid, sid, tid)) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
} else if (!isDbAvailable()) {
|
|
409
|
+
if (!hasCheckedTaskCompletionOnDisk(base, mid, sid, tid)) return false;
|
|
410
|
+
} else {
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (unitType === "complete-slice") {
|
|
417
|
+
const { milestone: mid, slice: sid } = parseUnitId(unitId);
|
|
418
|
+
if (mid && sid) {
|
|
419
|
+
const uatPath = resolveSliceFile(base, mid, sid, "UAT")
|
|
420
|
+
?? join(base, relSliceFile(base, mid, sid, "UAT"));
|
|
421
|
+
if (!existsSync(uatPath)) return false;
|
|
422
|
+
|
|
423
|
+
const dbSlice = getSlice(mid, sid);
|
|
424
|
+
if (dbSlice) {
|
|
425
|
+
if (dbSlice.status !== "complete") return false;
|
|
426
|
+
} else if (!isDbAvailable()) {
|
|
427
|
+
const roadmapFile = resolveMilestoneFile(base, mid, "ROADMAP");
|
|
428
|
+
if (roadmapFile && existsSync(roadmapFile)) {
|
|
429
|
+
try {
|
|
430
|
+
const roadmapContent = readFileSync(roadmapFile, "utf-8");
|
|
431
|
+
const roadmap = parseRoadmapForRecovery(roadmapContent);
|
|
432
|
+
const slice = roadmap.slices.find((s) => s.id === sid);
|
|
433
|
+
if (slice && !slice.done) return false;
|
|
434
|
+
} catch (e) {
|
|
435
|
+
logWarning("recovery", `roadmap parse failed: ${(e as Error).message}`);
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (unitType === "complete-milestone") {
|
|
444
|
+
const { milestone: mid } = parseUnitId(unitId);
|
|
445
|
+
if (!mid) return false;
|
|
446
|
+
const closeoutProof = proveMilestoneCloseout(mid, {
|
|
447
|
+
refreshFromDisk: true,
|
|
448
|
+
summaryArtifactBasePath: artifactBase,
|
|
449
|
+
implementationEvidence: {
|
|
450
|
+
basePath: base,
|
|
451
|
+
requirement: "not-absent",
|
|
452
|
+
},
|
|
453
|
+
});
|
|
454
|
+
if (!closeoutProof.ok) {
|
|
455
|
+
if (!isDbAvailable() && closeoutProof.reason === "db-unavailable") {
|
|
456
|
+
const summaryOutcome = classifyMilestoneSummaryContent(readFileSync(absPath, "utf-8"));
|
|
457
|
+
return summaryOutcome !== "failure" && hasImplementationArtifacts(base, mid) !== "absent";
|
|
458
|
+
}
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return true;
|
|
464
|
+
}
|