@opengsd/gsd-pi 1.3.0-dev.65546769 → 1.3.0-dev.738160b9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +17 -4
- package/dist/headless-answers.js +1 -1
- package/dist/headless-ui.d.ts +1 -1
- package/dist/headless-ui.js +1 -1
- package/dist/headless.js +1 -1
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/claude-code-cli/models.js +9 -0
- 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 +11 -0
- package/dist/resources/extensions/gsd/auto/verification-retry-policy.js +1 -1
- package/dist/resources/extensions/gsd/auto-artifact-paths.js +28 -1
- package/dist/resources/extensions/gsd/auto-budget.js +5 -1
- package/dist/resources/extensions/gsd/auto-dispatch.js +34 -20
- package/dist/resources/extensions/gsd/auto-post-unit.js +1 -1
- package/dist/resources/extensions/gsd/auto-prompts.js +29 -14
- package/dist/resources/extensions/gsd/auto-recovery.js +9 -510
- 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/auto-verification.js +5 -2
- package/dist/resources/extensions/gsd/auto.js +19 -10
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +103 -13
- package/dist/resources/extensions/gsd/bootstrap/core-session-tools.js +39 -0
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +11 -5
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +41 -21
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +46 -19
- package/dist/resources/extensions/gsd/bootstrap/tool-call-loop-guard.js +96 -10
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +1 -1
- package/dist/resources/extensions/gsd/closeout-consistency-gate.js +3 -1
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +1 -1
- package/dist/resources/extensions/gsd/commands-context.js +19 -1
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +17 -11
- package/dist/resources/extensions/gsd/commands-usage.js +1 -1
- 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/engine.js +4 -1
- package/dist/resources/extensions/gsd/db/queries.js +60 -0
- package/dist/resources/extensions/gsd/db-memory-fts-schema.js +34 -0
- package/dist/resources/extensions/gsd/db-workspace.js +55 -3
- package/dist/resources/extensions/gsd/delegation-policy.js +1 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +2 -2
- package/dist/resources/extensions/gsd/doctor-engine-checks.js +192 -4
- package/dist/resources/extensions/gsd/doctor-providers.js +92 -8
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +3 -0
- package/dist/resources/extensions/gsd/exec-sandbox.js +53 -11
- package/dist/resources/extensions/gsd/flat-phase-migration.js +45 -0
- package/dist/resources/extensions/gsd/forensics.js +2 -32
- package/dist/resources/extensions/gsd/git-service.js +61 -4
- package/dist/resources/extensions/gsd/gitignore.js +4 -1
- 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/json-persistence.js +20 -0
- package/dist/resources/extensions/gsd/knowledge-backfill.js +18 -11
- 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-backfill.js +28 -21
- package/dist/resources/extensions/gsd/memory-consolidation-scanner.js +44 -21
- package/dist/resources/extensions/gsd/metrics.js +4 -4
- package/dist/resources/extensions/gsd/migrate-external.js +11 -2
- 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/orphan-stash-audit.js +92 -16
- package/dist/resources/extensions/gsd/prompts/code-review.md +6 -4
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +2 -2
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +3 -3
- package/dist/resources/extensions/gsd/quick.js +45 -2
- package/dist/resources/extensions/gsd/root-write-leak-guard.js +7 -1
- package/dist/resources/extensions/gsd/safety/destructive-guard.js +8 -1
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +16 -1
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +5 -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-milestone.js +4 -2
- 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/tools/plan-slice.js +59 -44
- package/dist/resources/extensions/gsd/tools/plan-task.js +28 -5
- package/dist/resources/extensions/gsd/undo.js +43 -6
- package/dist/resources/extensions/gsd/unit-context-composer.js +23 -7
- package/dist/resources/extensions/gsd/unit-registry.js +36 -6
- 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/verification-gate.js +7 -0
- package/dist/resources/extensions/gsd/workflow-manifest.js +126 -13
- 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/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 → 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-client.d.ts +2 -0
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.js +23 -5
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-client.js.map +1 -1
- 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 +35 -21
- 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/dist/agent-loop.js +3 -2
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +46 -0
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +38 -0
- package/packages/pi-ai/dist/models.generated.js.map +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/models.ts +9 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +20 -2
- package/src/resources/extensions/claude-code-cli/tests/index.test.ts +14 -0
- 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/loop-deps.ts +1 -0
- package/src/resources/extensions/gsd/auto/orchestrator.ts +25 -11
- package/src/resources/extensions/gsd/auto/session.ts +14 -0
- package/src/resources/extensions/gsd/auto/verification-retry-policy.ts +3 -1
- package/src/resources/extensions/gsd/auto-artifact-paths.ts +47 -1
- package/src/resources/extensions/gsd/auto-budget.ts +12 -1
- package/src/resources/extensions/gsd/auto-dispatch.ts +35 -24
- package/src/resources/extensions/gsd/auto-post-unit.ts +1 -1
- package/src/resources/extensions/gsd/auto-prompts.ts +41 -15
- package/src/resources/extensions/gsd/auto-recovery.ts +13 -511
- 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/auto-verification.ts +5 -1
- package/src/resources/extensions/gsd/auto.ts +23 -8
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +125 -12
- package/src/resources/extensions/gsd/bootstrap/core-session-tools.ts +44 -0
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +11 -5
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +52 -21
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +52 -18
- package/src/resources/extensions/gsd/bootstrap/tool-call-loop-guard.ts +104 -10
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +1 -1
- package/src/resources/extensions/gsd/closeout-consistency-gate.ts +2 -1
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +1 -1
- package/src/resources/extensions/gsd/commands-context.ts +18 -1
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +15 -10
- package/src/resources/extensions/gsd/commands-usage.ts +1 -1
- 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/engine.ts +8 -1
- package/src/resources/extensions/gsd/db/queries.ts +79 -0
- package/src/resources/extensions/gsd/db-memory-fts-schema.ts +45 -0
- package/src/resources/extensions/gsd/db-workspace.ts +61 -3
- package/src/resources/extensions/gsd/delegation-policy.ts +1 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +2 -2
- package/src/resources/extensions/gsd/doctor-engine-checks.ts +233 -5
- package/src/resources/extensions/gsd/doctor-providers.ts +103 -9
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +3 -0
- package/src/resources/extensions/gsd/doctor-types.ts +3 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +56 -11
- package/src/resources/extensions/gsd/flat-phase-migration.ts +44 -0
- package/src/resources/extensions/gsd/forensics.ts +2 -33
- package/src/resources/extensions/gsd/git-service.ts +69 -5
- package/src/resources/extensions/gsd/gitignore.ts +4 -1
- 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/json-persistence.ts +20 -0
- package/src/resources/extensions/gsd/knowledge-backfill.ts +16 -10
- 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-backfill.ts +26 -20
- package/src/resources/extensions/gsd/memory-consolidation-scanner.ts +51 -19
- package/src/resources/extensions/gsd/metrics.ts +4 -4
- package/src/resources/extensions/gsd/migrate-external.ts +8 -2
- 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/orphan-stash-audit.ts +108 -20
- package/src/resources/extensions/gsd/prompts/code-review.md +6 -4
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +2 -2
- package/src/resources/extensions/gsd/prompts/plan-slice.md +3 -3
- package/src/resources/extensions/gsd/quick.ts +43 -2
- package/src/resources/extensions/gsd/root-write-leak-guard.ts +13 -1
- package/src/resources/extensions/gsd/safety/destructive-guard.ts +9 -1
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +16 -1
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +8 -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/artifact-retry-cap.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/auto-artifact-paths.test.ts +98 -1
- package/src/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +14 -5
- package/src/resources/extensions/gsd/tests/auto-pause-double-entry-guard.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +182 -4
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +146 -1
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +30 -0
- 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-milestone.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/complete-slice-reopen-handoff.test.ts +69 -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/db-memory-fts-schema.test.ts +58 -3
- package/src/resources/extensions/gsd/tests/decisions-projection-from-memories.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/destructive-guard.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +143 -0
- 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/doctor-scope-db-unavailable.test.ts +239 -2
- package/src/resources/extensions/gsd/tests/exec-graceful-kill.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/exec-tool.test.ts +45 -1
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/flat-phase-migration.test.ts +37 -2
- package/src/resources/extensions/gsd/tests/forensics-error-filter.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell-runtime.test.ts +4 -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 +130 -3
- 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/json-persistence-atomic.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/knowledge-backfill-projection.test.ts +35 -0
- 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/memory-store.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/merge-closeout-consistency-gate.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/metrics-prune-cache-invalidation.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/metrics.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/migrate-external-worktree.test.ts +57 -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/orphan-stash-audit.test.ts +91 -7
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/parsers-legacy-importers.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +103 -4
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +44 -1
- package/src/resources/extensions/gsd/tests/post-mutation-hook.test.ts +4 -2
- 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/prompt-budget-enforcement.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +8 -6
- 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/register-hooks-loop-guard-auto.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/root-write-leak-guard.test.ts +20 -1
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +15 -3
- 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 +208 -0
- package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +32 -3
- package/src/resources/extensions/gsd/tests/undo.test.ts +74 -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/uok-gitops-turn-action.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/validation-block-guard.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/verification-retry-policy.test.ts +69 -4
- package/src/resources/extensions/gsd/tests/verify-artifact-tightened.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/workflow-manifest.test.ts +96 -15
- package/src/resources/extensions/gsd/tests/workflow-mcp-preflight.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +8 -4
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +6 -5
- 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-milestone.ts +3 -2
- 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/tools/plan-slice.ts +60 -47
- package/src/resources/extensions/gsd/tools/plan-task.ts +30 -5
- package/src/resources/extensions/gsd/undo.ts +47 -6
- package/src/resources/extensions/gsd/unit-context-composer.ts +33 -7
- package/src/resources/extensions/gsd/unit-registry.ts +36 -6
- 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/verification-gate.ts +8 -0
- package/src/resources/extensions/gsd/workflow-manifest.ts +141 -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 → 2A_WqqCS-EoYZxN9_v3d2}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{BTKtGFF1Y-hvVJEGhBRo9 → 2A_WqqCS-EoYZxN9_v3d2}/_ssgManifest.js +0 -0
|
@@ -13,7 +13,7 @@ import { existsSync } from "node:fs";
|
|
|
13
13
|
import { transaction, getMilestone, getMilestoneSlices, getSliceTasks, getLatestAssessmentByScope, updateMilestoneStatus, } from "../gsd-db.js";
|
|
14
14
|
import { clearPathCache, relMilestoneFile } from "../paths.js";
|
|
15
15
|
import { resolveCanonicalMilestoneRoot } from "../worktree-manager.js";
|
|
16
|
-
import { isClosedStatus } from "../status-guards.js";
|
|
16
|
+
import { isClosedStatus, isDeferredStatus } from "../status-guards.js";
|
|
17
17
|
import { saveFile, clearParseCache } from "../files.js";
|
|
18
18
|
import { invalidateStateCache } from "../state.js";
|
|
19
19
|
import { stripIdPrefix } from "../workflow-projections.js";
|
|
@@ -118,7 +118,7 @@ export async function handleCompleteMilestone(params, basePath) {
|
|
|
118
118
|
guardError = `no slices found for milestone ${params.milestoneId}`;
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
const incompleteSlices = slices.filter(s => !isClosedStatus(s.status));
|
|
121
|
+
const incompleteSlices = slices.filter(s => !isClosedStatus(s.status) && !isDeferredStatus(s.status));
|
|
122
122
|
if (incompleteSlices.length > 0) {
|
|
123
123
|
const incompleteIds = incompleteSlices.map(s => `${s.id} (status: ${s.status})`).join(", ");
|
|
124
124
|
guardError = `incomplete slices: ${incompleteIds}`;
|
|
@@ -126,6 +126,8 @@ export async function handleCompleteMilestone(params, basePath) {
|
|
|
126
126
|
}
|
|
127
127
|
// Deep check: verify all tasks in all slices are complete
|
|
128
128
|
for (const slice of slices) {
|
|
129
|
+
if (isDeferredStatus(slice.status))
|
|
130
|
+
continue;
|
|
129
131
|
const tasks = getSliceTasks(params.milestoneId, slice.id);
|
|
130
132
|
const incompleteTasks = tasks.filter(t => !isClosedStatus(t.status));
|
|
131
133
|
if (incompleteTasks.length > 0) {
|
|
@@ -21,7 +21,7 @@ import { classifyUatContent, escalatesArtifactUatToBrowser } from "../uat-policy
|
|
|
21
21
|
import { invalidateStateCache } from "../state.js";
|
|
22
22
|
import { renderRoadmapFromDb, roadmapRenderMarksSliceDone } from "../markdown-renderer.js";
|
|
23
23
|
import { isStaleWrite } from "../auto/turn-epoch.js";
|
|
24
|
-
import {
|
|
24
|
+
import { renderMilestoneShellProjections } from "../workflow-projections.js";
|
|
25
25
|
import { writeManifest } from "../workflow-manifest.js";
|
|
26
26
|
import { appendEvent } from "../workflow-events.js";
|
|
27
27
|
import { logWarning, logError } from "../workflow-logger.js";
|
|
@@ -458,7 +458,7 @@ export async function handleCompleteSlice(params, basePath) {
|
|
|
458
458
|
// Separate try/catch per step so a projection failure doesn't prevent
|
|
459
459
|
// the event log entry (critical for worktree reconciliation).
|
|
460
460
|
try {
|
|
461
|
-
await
|
|
461
|
+
await renderMilestoneShellProjections(artifactBasePath, params.milestoneId);
|
|
462
462
|
}
|
|
463
463
|
catch (projErr) {
|
|
464
464
|
logWarning("tool", `complete-slice projection warning for ${params.milestoneId}/${params.sliceId}: ${projErr.message}`);
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Validates inputs, writes task row and rendered SUMMARY.md to DB in a
|
|
7
7
|
* transaction, then renders projections to disk and invalidates caches.
|
|
8
|
-
*
|
|
9
|
-
* back
|
|
8
|
+
* If the critical task summary / plan projection write fails, the DB
|
|
9
|
+
* completion is compensated back to pending so DB state does not drift ahead
|
|
10
|
+
* of PLAN.md.
|
|
10
11
|
*/
|
|
11
|
-
import { existsSync } from "node:fs";
|
|
12
|
+
import { existsSync, unlinkSync } from "node:fs";
|
|
12
13
|
import { join } from "node:path";
|
|
13
14
|
import { isClosedStatus } from "../status-guards.js";
|
|
14
15
|
import { transaction, insertMilestone, insertSlice, insertTask, insertVerificationEvidence, getMilestone, getSlice, getTask, updateTaskStatus, deleteVerificationEvidence, saveGateResult, getPendingGatesForTurn, } from "../gsd-db.js";
|
|
16
|
+
import { getWorkflowDatabasePath, ensureWorkflowDbAtPath } from "../db-workspace.js";
|
|
15
17
|
import { getGatesForTurn } from "../gate-registry.js";
|
|
16
18
|
import { gsdProjectionRoot, clearPathCache, resolveMilestonePath, resolveSlicePath } from "../paths.js";
|
|
17
19
|
import { resolveCanonicalMilestoneRoot } from "../worktree-manager.js";
|
|
@@ -19,8 +21,7 @@ import { checkOwnership, taskUnitKey } from "../unit-ownership.js";
|
|
|
19
21
|
import { saveFile, clearParseCache } from "../files.js";
|
|
20
22
|
import { invalidateStateCache } from "../state.js";
|
|
21
23
|
import { renderPlanCheckboxes } from "../markdown-renderer.js";
|
|
22
|
-
import { renderSummaryContent } from "../workflow-projections.js";
|
|
23
|
-
import { flushWorkflowProjections } from "../projection-flush.js";
|
|
24
|
+
import { renderMilestoneShellProjections, renderSummaryContent, } from "../workflow-projections.js";
|
|
24
25
|
import { writeManifest } from "../workflow-manifest.js";
|
|
25
26
|
import { appendEvent } from "../workflow-events.js";
|
|
26
27
|
import { logWarning, logError } from "../workflow-logger.js";
|
|
@@ -60,7 +61,7 @@ async function repairMissingTaskSummaryProjection(artifactBasePath, taskRow) {
|
|
|
60
61
|
clearPathCache();
|
|
61
62
|
clearParseCache();
|
|
62
63
|
try {
|
|
63
|
-
await
|
|
64
|
+
await renderMilestoneShellProjections(artifactBasePath, taskRow.milestone_id);
|
|
64
65
|
}
|
|
65
66
|
catch (projErr) {
|
|
66
67
|
logWarning("tool", `complete-task repair projection warning: ${projErr.message}`);
|
|
@@ -181,6 +182,7 @@ export async function handleCompleteTask(params, basePath) {
|
|
|
181
182
|
let guardError = null;
|
|
182
183
|
let summaryMd = "";
|
|
183
184
|
let repairTaskSummaryRow = null;
|
|
185
|
+
const rollbackDbPath = getWorkflowDatabasePath();
|
|
184
186
|
// ── ADR-011 Phase 2: validate escalation payload BEFORE any side effects ─
|
|
185
187
|
// Building the artifact runs the full shape validation (2-4 options, unique
|
|
186
188
|
// ids, recommendation references a real id). If the payload is malformed
|
|
@@ -317,20 +319,48 @@ export async function handleCompleteTask(params, basePath) {
|
|
|
317
319
|
if (guardError) {
|
|
318
320
|
return { error: guardError };
|
|
319
321
|
}
|
|
320
|
-
let projectionStale = false;
|
|
321
322
|
// Resolve and write summary to disk
|
|
322
323
|
const summaryPath = taskSummaryPath(artifactBasePath, params.milestoneId, params.sliceId, params.taskId);
|
|
323
324
|
try {
|
|
324
325
|
await saveFile(summaryPath, summaryMd);
|
|
325
326
|
// Toggle or regenerate the plan projection from DB. Missing projection
|
|
326
327
|
// files are rebuilt by the renderer instead of being skipped.
|
|
327
|
-
|
|
328
|
+
if (!ensureWorkflowDbAtPath(rollbackDbPath)) {
|
|
329
|
+
throw new Error(`database unavailable before plan projection render for ${params.milestoneId}/${params.sliceId}`);
|
|
330
|
+
}
|
|
331
|
+
const wrotePlan = await renderPlanCheckboxes(artifactBasePath, params.milestoneId, params.sliceId);
|
|
332
|
+
if (!wrotePlan) {
|
|
333
|
+
throw new Error(`plan projection write returned false for ${params.milestoneId}/${params.sliceId}`);
|
|
334
|
+
}
|
|
328
335
|
}
|
|
329
336
|
catch (renderErr) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
337
|
+
logWarning("projection", `complete_task projection write failed for ${params.milestoneId}/${params.sliceId}/${params.taskId}`, { error: renderErr.message });
|
|
338
|
+
let rollbackSucceeded = false;
|
|
339
|
+
try {
|
|
340
|
+
ensureWorkflowDbAtPath(rollbackDbPath);
|
|
341
|
+
deleteVerificationEvidence(params.milestoneId, params.sliceId, params.taskId);
|
|
342
|
+
updateTaskStatus(params.milestoneId, params.sliceId, params.taskId, "pending");
|
|
343
|
+
invalidateStateCache();
|
|
344
|
+
rollbackSucceeded = true;
|
|
345
|
+
}
|
|
346
|
+
catch (rollbackErr) {
|
|
347
|
+
logWarning("projection", `complete_task rollback failed after projection write failure for ${params.milestoneId}/${params.sliceId}/${params.taskId}: ${rollbackErr.message}`);
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
if (existsSync(summaryPath))
|
|
351
|
+
unlinkSync(summaryPath);
|
|
352
|
+
}
|
|
353
|
+
catch (summaryErr) {
|
|
354
|
+
logWarning("projection", `complete_task could not remove SUMMARY.md after projection write failure for ${params.milestoneId}/${params.sliceId}/${params.taskId}: ${summaryErr.message}`);
|
|
355
|
+
}
|
|
356
|
+
// Clear path/parse caches regardless of rollback outcome so stale
|
|
357
|
+
// entries from the failed write attempt don't leak into subsequent calls.
|
|
358
|
+
clearPathCache();
|
|
359
|
+
clearParseCache();
|
|
360
|
+
const returnMsg = rollbackSucceeded
|
|
361
|
+
? `complete_task projection write failed for ${params.milestoneId}/${params.sliceId}/${params.taskId}; rolled completion back to pending`
|
|
362
|
+
: `complete_task projection write failed for ${params.milestoneId}/${params.sliceId}/${params.taskId}; rollback also failed — task may remain complete with stale plan`;
|
|
363
|
+
return { error: returnMsg };
|
|
334
364
|
}
|
|
335
365
|
// ── Close gates owned by execute-task (Q5/Q6/Q7) for this task ────────
|
|
336
366
|
// Each gate id maps to a specific params field via taskGateFieldForId.
|
|
@@ -435,7 +465,7 @@ export async function handleCompleteTask(params, basePath) {
|
|
|
435
465
|
// Separate try/catch per step so a projection failure doesn't prevent
|
|
436
466
|
// the event log entry (critical for worktree reconciliation).
|
|
437
467
|
try {
|
|
438
|
-
await
|
|
468
|
+
await renderMilestoneShellProjections(artifactBasePath, params.milestoneId);
|
|
439
469
|
}
|
|
440
470
|
catch (projErr) {
|
|
441
471
|
logWarning("tool", `complete-task projection warning: ${projErr.message}`);
|
|
@@ -465,6 +495,5 @@ export async function handleCompleteTask(params, basePath) {
|
|
|
465
495
|
milestoneId: params.milestoneId,
|
|
466
496
|
summaryPath,
|
|
467
497
|
...(escalationMetadata ? { escalation: escalationMetadata } : {}),
|
|
468
|
-
...(projectionStale ? { stale: true } : {}),
|
|
469
498
|
};
|
|
470
499
|
}
|
|
@@ -144,7 +144,7 @@ export async function executeGsdExec(params, deps) {
|
|
|
144
144
|
if (bashReferencesProjectRootOutsideWorktree(script, deps.baseDir)) {
|
|
145
145
|
return paramError("script references the original project root while running inside a milestone worktree; use the active worktree path or relative paths");
|
|
146
146
|
}
|
|
147
|
-
const opts = buildExecOptions(deps.baseDir, deps.preferences?.context_mode, { env: deps.env, now: deps.now, generateId: deps.generateId });
|
|
147
|
+
const opts = buildExecOptions(deps.baseDir, deps.preferences?.context_mode, { env: deps.env, now: deps.now, generateId: deps.generateId, signal: deps.signal });
|
|
148
148
|
const run = deps.run ?? runExecSandbox;
|
|
149
149
|
try {
|
|
150
150
|
const result = await run({
|
|
@@ -235,6 +235,7 @@ function formatResult(result) {
|
|
|
235
235
|
exit_code: result.exit_code,
|
|
236
236
|
signal: result.signal,
|
|
237
237
|
timed_out: result.timed_out,
|
|
238
|
+
aborted: result.aborted === true,
|
|
238
239
|
force_resolved: result.force_resolved,
|
|
239
240
|
duration_ms: result.duration_ms,
|
|
240
241
|
stdout_bytes: result.stdout_bytes,
|
|
@@ -245,12 +246,16 @@ function formatResult(result) {
|
|
|
245
246
|
stderr_path: result.stderr_path,
|
|
246
247
|
meta_path: result.meta_path,
|
|
247
248
|
},
|
|
248
|
-
isError: result.timed_out || result.signal !== null || result.exit_code !== 0,
|
|
249
|
+
isError: result.aborted === true || result.timed_out || result.signal !== null || result.exit_code !== 0,
|
|
249
250
|
};
|
|
250
251
|
}
|
|
251
252
|
function formatExit(result) {
|
|
252
253
|
// force_resolved means a non-closing (D-state) child was force-resolved past its
|
|
253
254
|
// hard deadline rather than observed exiting; distinguish it from a clean timeout.
|
|
255
|
+
if (result.aborted && result.force_resolved)
|
|
256
|
+
return "aborted(force-killed)";
|
|
257
|
+
if (result.aborted)
|
|
258
|
+
return "aborted";
|
|
254
259
|
if (result.force_resolved)
|
|
255
260
|
return "timeout(force-killed)";
|
|
256
261
|
if (result.timed_out)
|
|
@@ -28,9 +28,13 @@ function validateRepositoryTargetIds(field, value) {
|
|
|
28
28
|
return deduped;
|
|
29
29
|
}
|
|
30
30
|
function validateTasks(value) {
|
|
31
|
-
if (
|
|
32
|
-
|
|
31
|
+
if (value === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
if (!Array.isArray(value)) {
|
|
34
|
+
throw new Error("tasks must be an array");
|
|
33
35
|
}
|
|
36
|
+
if (value.length === 0)
|
|
37
|
+
return undefined;
|
|
34
38
|
const seen = new Set();
|
|
35
39
|
return value.map((entry, index) => {
|
|
36
40
|
if (!entry || typeof entry !== "object") {
|
|
@@ -129,7 +133,7 @@ function validateReferencedRepositories(params, registry, defaultTargets) {
|
|
|
129
133
|
};
|
|
130
134
|
for (const id of params.targetRepositories ?? defaultTargets)
|
|
131
135
|
noteMissing(id);
|
|
132
|
-
for (const task of params.tasks) {
|
|
136
|
+
for (const task of params.tasks ?? []) {
|
|
133
137
|
for (const id of task.targetRepositories ?? params.targetRepositories ?? defaultTargets)
|
|
134
138
|
noteMissing(id);
|
|
135
139
|
}
|
|
@@ -141,7 +145,7 @@ function resolveAllowedRootsForPathScope(params, registry, defaultTargets) {
|
|
|
141
145
|
const requested = new Set();
|
|
142
146
|
for (const id of params.targetRepositories ?? defaultTargets)
|
|
143
147
|
requested.add(id);
|
|
144
|
-
for (const task of params.tasks) {
|
|
148
|
+
for (const task of params.tasks ?? []) {
|
|
145
149
|
for (const id of task.targetRepositories ?? params.targetRepositories ?? defaultTargets)
|
|
146
150
|
requested.add(id);
|
|
147
151
|
}
|
|
@@ -153,7 +157,7 @@ function resolveAllowedRootsForPathScope(params, registry, defaultTargets) {
|
|
|
153
157
|
return roots.length > 0 ? roots : [registry.projectRoot];
|
|
154
158
|
}
|
|
155
159
|
function toTaskRows(params, defaultTargets) {
|
|
156
|
-
return params.tasks.map((task, index) => ({
|
|
160
|
+
return (params.tasks ?? []).map((task, index) => ({
|
|
157
161
|
milestone_id: params.milestoneId,
|
|
158
162
|
slice_id: params.sliceId,
|
|
159
163
|
id: task.taskId,
|
|
@@ -230,19 +234,21 @@ export async function handlePlanSlice(rawParams, basePath) {
|
|
|
230
234
|
return { error: `validation failed: ${message}` };
|
|
231
235
|
}
|
|
232
236
|
const defaultTargets = defaultRepositoryTargets(repositoryRegistry);
|
|
237
|
+
const taskPayload = params.tasks ?? [];
|
|
238
|
+
const hasTaskPayload = taskPayload.length > 0;
|
|
233
239
|
const repoValidationError = validateReferencedRepositories(params, repositoryRegistry, defaultTargets);
|
|
234
240
|
if (repoValidationError) {
|
|
235
241
|
return { error: `validation failed: ${repoValidationError}` };
|
|
236
242
|
}
|
|
237
243
|
const allowedAbsoluteRoots = resolveAllowedRootsForPathScope(params, repositoryRegistry, defaultTargets);
|
|
238
|
-
const pathOnlyError = validatePathOnlyPlanningFields(
|
|
244
|
+
const pathOnlyError = validatePathOnlyPlanningFields(taskPayload.map((task, index) => ({
|
|
239
245
|
field: `tasks[${index}].expectedOutput`,
|
|
240
246
|
values: task.expectedOutput,
|
|
241
247
|
})));
|
|
242
248
|
if (pathOnlyError) {
|
|
243
249
|
return { error: `validation failed: ${pathOnlyError}` };
|
|
244
250
|
}
|
|
245
|
-
const pathScopeError = validatePlanningPathScope(basePath,
|
|
251
|
+
const pathScopeError = validatePlanningPathScope(basePath, taskPayload.flatMap((task, index) => [
|
|
246
252
|
{ field: `tasks[${index}].files`, values: task.files },
|
|
247
253
|
{ field: `tasks[${index}].inputs`, values: task.inputs },
|
|
248
254
|
{ field: `tasks[${index}].expectedOutput`, values: task.expectedOutput },
|
|
@@ -279,15 +285,17 @@ export async function handlePlanSlice(rawParams, basePath) {
|
|
|
279
285
|
guardError = `cannot re-plan slice ${params.sliceId}: it is already complete — use gsd_slice_reopen first`;
|
|
280
286
|
return;
|
|
281
287
|
}
|
|
282
|
-
const newTaskIds = new Set(
|
|
288
|
+
const newTaskIds = new Set(taskPayload.map((task) => task.taskId));
|
|
283
289
|
const existingTasks = getSliceTasks(params.milestoneId, params.sliceId);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
290
|
+
if (hasTaskPayload) {
|
|
291
|
+
omittedTaskIds = existingTasks
|
|
292
|
+
.filter((task) => !newTaskIds.has(task.id))
|
|
293
|
+
.map((task) => task.id);
|
|
294
|
+
for (const task of existingTasks) {
|
|
295
|
+
if (!newTaskIds.has(task.id) && isClosedStatus(task.status)) {
|
|
296
|
+
guardError = `cannot remove completed task ${task.id}`;
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
291
299
|
}
|
|
292
300
|
}
|
|
293
301
|
if (isDeferredStatus(parentSlice.status)) {
|
|
@@ -301,34 +309,36 @@ export async function handlePlanSlice(rawParams, basePath) {
|
|
|
301
309
|
observabilityImpact: params.observabilityImpact,
|
|
302
310
|
targetRepositories: params.targetRepositories ?? defaultTargets,
|
|
303
311
|
});
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
description: task.description,
|
|
312
|
-
estimate: task.estimate,
|
|
313
|
-
files: task.files,
|
|
314
|
-
verify: task.verify,
|
|
315
|
-
inputs: task.inputs,
|
|
316
|
-
expectedOutput: task.expectedOutput,
|
|
317
|
-
observabilityImpact: task.observabilityImpact ?? "",
|
|
318
|
-
fullPlanMd: task.fullPlanMd,
|
|
319
|
-
targetRepositories: task.targetRepositories ?? params.targetRepositories ?? defaultTargets,
|
|
320
|
-
};
|
|
321
|
-
const existingTask = existingTaskById.get(task.taskId);
|
|
322
|
-
if (!existingTask || !isClosedStatus(existingTask.status)) {
|
|
323
|
-
insertTask({
|
|
324
|
-
id: task.taskId,
|
|
325
|
-
sliceId: params.sliceId,
|
|
326
|
-
milestoneId: params.milestoneId,
|
|
312
|
+
if (hasTaskPayload) {
|
|
313
|
+
for (const taskId of omittedTaskIds) {
|
|
314
|
+
deleteTask(params.milestoneId, params.sliceId, taskId);
|
|
315
|
+
}
|
|
316
|
+
const existingTaskById = new Map(existingTasks.map((task) => [task.id, task]));
|
|
317
|
+
for (const task of taskPayload) {
|
|
318
|
+
const planning = {
|
|
327
319
|
title: task.title,
|
|
328
|
-
|
|
329
|
-
|
|
320
|
+
description: task.description,
|
|
321
|
+
estimate: task.estimate,
|
|
322
|
+
files: task.files,
|
|
323
|
+
verify: task.verify,
|
|
324
|
+
inputs: task.inputs,
|
|
325
|
+
expectedOutput: task.expectedOutput,
|
|
326
|
+
observabilityImpact: task.observabilityImpact ?? "",
|
|
327
|
+
fullPlanMd: task.fullPlanMd,
|
|
328
|
+
targetRepositories: task.targetRepositories ?? params.targetRepositories ?? defaultTargets,
|
|
329
|
+
};
|
|
330
|
+
const existingTask = existingTaskById.get(task.taskId);
|
|
331
|
+
if (!existingTask || !isClosedStatus(existingTask.status)) {
|
|
332
|
+
insertTask({
|
|
333
|
+
id: task.taskId,
|
|
334
|
+
sliceId: params.sliceId,
|
|
335
|
+
milestoneId: params.milestoneId,
|
|
336
|
+
title: task.title,
|
|
337
|
+
status: "pending",
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
upsertTaskPlanning(params.milestoneId, params.sliceId, task.taskId, planning);
|
|
330
341
|
}
|
|
331
|
-
upsertTaskPlanning(params.milestoneId, params.sliceId, task.taskId, planning);
|
|
332
342
|
}
|
|
333
343
|
// Seed quality gate rows inside the transaction — all-or-nothing with
|
|
334
344
|
// the plan data so a crash can't leave orphaned gates without tasks.
|
|
@@ -337,7 +347,7 @@ export async function handlePlanSlice(rawParams, basePath) {
|
|
|
337
347
|
insertGateRow({ milestoneId: params.milestoneId, sliceId: params.sliceId, gateId: gid, scope: "slice" });
|
|
338
348
|
}
|
|
339
349
|
const taskGates = resolveTaskGates(gateEvaluation);
|
|
340
|
-
for (const task of
|
|
350
|
+
for (const task of taskPayload) {
|
|
341
351
|
for (const gid of taskGates) {
|
|
342
352
|
insertGateRow({ milestoneId: params.milestoneId, sliceId: params.sliceId, gateId: gid, scope: "task", taskId: task.taskId });
|
|
343
353
|
}
|
|
@@ -360,8 +370,13 @@ export async function handlePlanSlice(rawParams, basePath) {
|
|
|
360
370
|
const artifactPath = relative(gsdProjectionRoot(basePath), taskPlanPath).replace(/\\/g, "/");
|
|
361
371
|
deleteArtifactByPath(artifactPath);
|
|
362
372
|
}
|
|
363
|
-
const
|
|
364
|
-
|
|
373
|
+
const sliceTasks = getSliceTasks(params.milestoneId, params.sliceId);
|
|
374
|
+
const renderResult = sliceTasks.length === 0
|
|
375
|
+
? { planPath: "", taskPlanPaths: [] }
|
|
376
|
+
: await renderPlanFromDb(basePath, params.milestoneId, params.sliceId);
|
|
377
|
+
if (sliceTasks.length > 0) {
|
|
378
|
+
setSliceSketchFlag(params.milestoneId, params.sliceId, false);
|
|
379
|
+
}
|
|
365
380
|
invalidateStateCache();
|
|
366
381
|
clearParseCache();
|
|
367
382
|
// ── Post-mutation hook: manifest, event log ─────────────────────────
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { clearParseCache } from "../files.js";
|
|
2
2
|
import { isClosedStatus } from "../status-guards.js";
|
|
3
3
|
import { isNonEmptyString, validateStringArray } from "../validation.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getGateIdsForTurn } from "../gate-registry.js";
|
|
5
|
+
import { transaction, getSlice, getTask, insertTask, upsertTaskPlanning, insertGateRow, setSliceSketchFlag } from "../gsd-db.js";
|
|
5
6
|
import { invalidateStateCache } from "../state.js";
|
|
6
7
|
import { renderTaskPlanFromDb, renderPlanFromDb } from "../markdown-renderer.js";
|
|
7
|
-
import {
|
|
8
|
+
import { resolveTasksDir } from "../paths.js";
|
|
8
9
|
import { flushWorkflowProjections } from "../projection-flush.js";
|
|
9
10
|
import { writeManifest } from "../workflow-manifest.js";
|
|
10
11
|
import { appendEvent } from "../workflow-events.js";
|
|
11
12
|
import { logWarning } from "../workflow-logger.js";
|
|
13
|
+
import { loadEffectiveGSDPreferences } from "../preferences.js";
|
|
12
14
|
import { validatePathOnlyPlanningFields, validatePlanningPathScope } from "../planning-path-scope.js";
|
|
13
15
|
function validateParams(params) {
|
|
14
16
|
if (!isNonEmptyString(params?.milestoneId))
|
|
@@ -35,6 +37,12 @@ function validateParams(params) {
|
|
|
35
37
|
expectedOutput: validateStringArray(params.expectedOutput, "expectedOutput"),
|
|
36
38
|
};
|
|
37
39
|
}
|
|
40
|
+
function resolveTaskGates(basePath) {
|
|
41
|
+
const loaded = loadEffectiveGSDPreferences(basePath);
|
|
42
|
+
if (loaded?.preferences?.gate_evaluation?.task_gates === false)
|
|
43
|
+
return [];
|
|
44
|
+
return [...getGateIdsForTurn("execute-task")];
|
|
45
|
+
}
|
|
38
46
|
export async function handlePlanTask(rawParams, basePath) {
|
|
39
47
|
let params;
|
|
40
48
|
try {
|
|
@@ -57,6 +65,14 @@ export async function handlePlanTask(rawParams, basePath) {
|
|
|
57
65
|
if (pathScopeError) {
|
|
58
66
|
return { error: `validation failed: ${pathScopeError}` };
|
|
59
67
|
}
|
|
68
|
+
let taskGates;
|
|
69
|
+
try {
|
|
70
|
+
taskGates = resolveTaskGates(basePath);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
74
|
+
return { error: `validation failed: ${message}` };
|
|
75
|
+
}
|
|
60
76
|
// ── Guards + DB writes inside a single transaction (prevents TOCTOU) ───
|
|
61
77
|
// Guards must be inside the transaction so the state they check cannot
|
|
62
78
|
// change between the read and the write (#2723).
|
|
@@ -97,6 +113,9 @@ export async function handlePlanTask(rawParams, basePath) {
|
|
|
97
113
|
observabilityImpact: params.observabilityImpact ?? "",
|
|
98
114
|
fullPlanMd: params.fullPlanMd,
|
|
99
115
|
});
|
|
116
|
+
for (const gid of taskGates) {
|
|
117
|
+
insertGateRow({ milestoneId: params.milestoneId, sliceId: params.sliceId, gateId: gid, scope: "task", taskId: params.taskId });
|
|
118
|
+
}
|
|
100
119
|
});
|
|
101
120
|
}
|
|
102
121
|
catch (err) {
|
|
@@ -110,17 +129,21 @@ export async function handlePlanTask(rawParams, basePath) {
|
|
|
110
129
|
// Flat-phase: tasks live as checkboxes in the slice plan's <tasks> block,
|
|
111
130
|
// not as standalone TID-PLAN.md files. Re-render the slice plan so the
|
|
112
131
|
// new/updated task appears in the plan file that gsd-core reads.
|
|
113
|
-
// Guard: resolveTasksDir is null in flat-phase (no tasks/ subdir exists)
|
|
114
|
-
|
|
132
|
+
// Guard: resolveTasksDir is null in flat-phase (no tasks/ subdir exists).
|
|
133
|
+
let slicePlanSynced = false;
|
|
115
134
|
try {
|
|
116
135
|
const tDir = resolveTasksDir(basePath, params.milestoneId, params.sliceId);
|
|
117
|
-
if (!tDir
|
|
136
|
+
if (!tDir) {
|
|
118
137
|
await renderPlanFromDb(basePath, params.milestoneId, params.sliceId);
|
|
138
|
+
slicePlanSynced = true;
|
|
119
139
|
}
|
|
120
140
|
}
|
|
121
141
|
catch (syncErr) {
|
|
122
142
|
logWarning("tool", `plan-task: slice-plan sync failed: ${syncErr.message}`);
|
|
123
143
|
}
|
|
144
|
+
if (slicePlanSynced) {
|
|
145
|
+
setSliceSketchFlag(params.milestoneId, params.sliceId, false);
|
|
146
|
+
}
|
|
124
147
|
invalidateStateCache();
|
|
125
148
|
clearParseCache();
|
|
126
149
|
// ── Post-mutation hook: projections, manifest, event log ─────────────
|
|
@@ -13,6 +13,7 @@ import { gsdRoot, resolveTasksDir, resolveSlicePath, resolveSliceFile, resolveTa
|
|
|
13
13
|
import { sendDesktopNotification } from "./notifications.js";
|
|
14
14
|
import { getTask, getSlice, getSliceTasks, updateTaskStatus, resetSliceCascade } from "./gsd-db.js";
|
|
15
15
|
import { renderPlanCheckboxes, renderRoadmapCheckboxes } from "./markdown-renderer.js";
|
|
16
|
+
import { UNIT_REGISTRY } from "./unit-registry.js";
|
|
16
17
|
/**
|
|
17
18
|
* Undo the last completed unit: revert git commits,
|
|
18
19
|
* delete summary artifacts, and uncheck the task in PLAN.
|
|
@@ -35,15 +36,19 @@ export async function handleUndo(args, ctx, _pi, basePath) {
|
|
|
35
36
|
ctx.ui.notify("Nothing to undo — no activity logs found.", "info");
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
// Extract unit type and ID from the most recent activity log filename
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
// Extract unit type and ID from the most recent activity log filename.
|
|
40
|
+
// Both the unit type and the unit ID may contain hyphens, so anchor on the
|
|
41
|
+
// known unit-type vocabulary instead of guessing the unit-ID shape: a regex
|
|
42
|
+
// tuned to milestone-shaped IDs rejects project-level units whose IDs are
|
|
43
|
+
// symbolic (e.g. discuss-project uses PROJECT, workflow-preferences uses
|
|
44
|
+
// WORKFLOW-PREFS).
|
|
45
|
+
const parsed = parseActivityLogFilename(files[0]);
|
|
46
|
+
if (!parsed) {
|
|
42
47
|
ctx.ui.notify("Nothing to undo — could not parse latest activity log.", "warning");
|
|
43
48
|
return;
|
|
44
49
|
}
|
|
45
|
-
const unitType =
|
|
46
|
-
const unitId =
|
|
50
|
+
const unitType = parsed.unitType;
|
|
51
|
+
const unitId = parsed.unitId.replace(/-/g, "/");
|
|
47
52
|
if (!force) {
|
|
48
53
|
ctx.ui.notify(`Will undo: ${unitType} (${unitId})\n` +
|
|
49
54
|
`This will:\n` +
|
|
@@ -87,6 +92,11 @@ export async function handleUndo(args, ctx, _pi, basePath) {
|
|
|
87
92
|
if (unitType === "execute-task" && task !== undefined && slice !== undefined) {
|
|
88
93
|
const [mid, sid, tid] = [milestone, slice, task];
|
|
89
94
|
planUpdated = uncheckTaskInPlan(basePath, mid, sid, tid);
|
|
95
|
+
if (getTask(mid, sid, tid)) {
|
|
96
|
+
updateTaskStatus(mid, sid, tid, "pending");
|
|
97
|
+
await renderPlanCheckboxes(basePath, mid, sid);
|
|
98
|
+
planUpdated = true;
|
|
99
|
+
}
|
|
90
100
|
}
|
|
91
101
|
// 3. Try to revert git commits from activity log
|
|
92
102
|
let commitsReverted = 0;
|
|
@@ -318,6 +328,33 @@ export async function handleResetSlice(args, ctx, _pi, basePath) {
|
|
|
318
328
|
ctx.ui.notify(results.join("\n"), "success");
|
|
319
329
|
}
|
|
320
330
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
331
|
+
// Known unit types sorted longest-first so a more specific type (e.g.
|
|
332
|
+
// "execute-task-simple") matches before a prefix of it ("execute-task") when
|
|
333
|
+
// splitting "<seq>-<unitType>-<unitId>.jsonl".
|
|
334
|
+
const UNIT_TYPES_BY_LENGTH_DESC = Object.keys(UNIT_REGISTRY).sort((a, b) => b.length - a.length);
|
|
335
|
+
/**
|
|
336
|
+
* Parse an activity-log filename of the form `<seq>-<unitType>-<unitId>.jsonl`
|
|
337
|
+
* (the format written by activity-log.ts). Both the unit type and the unit ID
|
|
338
|
+
* may contain hyphens, so we anchor on the known unit-type vocabulary rather
|
|
339
|
+
* than guessing the ID shape. This keeps non-milestone IDs (e.g. PROJECT,
|
|
340
|
+
* WORKFLOW-PREFS) parseable. Returns null when the name has no sequence prefix
|
|
341
|
+
* or does not start with a recognised unit type.
|
|
342
|
+
*/
|
|
343
|
+
export function parseActivityLogFilename(filename) {
|
|
344
|
+
const seqMatch = filename.match(/^\d+-(.+)\.jsonl$/);
|
|
345
|
+
if (!seqMatch)
|
|
346
|
+
return null;
|
|
347
|
+
const rest = seqMatch[1];
|
|
348
|
+
for (const unitType of UNIT_TYPES_BY_LENGTH_DESC) {
|
|
349
|
+
const prefix = `${unitType}-`;
|
|
350
|
+
if (rest.startsWith(prefix)) {
|
|
351
|
+
const unitId = rest.slice(prefix.length);
|
|
352
|
+
if (unitId.length > 0)
|
|
353
|
+
return { unitType, unitId };
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
321
358
|
export function uncheckTaskInPlan(basePath, mid, sid, tid) {
|
|
322
359
|
const slicePath = resolveSlicePath(basePath, mid, sid);
|
|
323
360
|
if (!slicePath)
|
|
@@ -92,13 +92,27 @@ const CONTEXT_MODE_GUIDANCE_BY_LANE = {
|
|
|
92
92
|
orchestration: "Use `gsd_resume` before resuming orchestration, `gsd_exec_search` to reuse prior runs, and `gsd_exec` for noisy coordination checks.",
|
|
93
93
|
docs: "Use `gsd_resume` for prior context, `gsd_exec_search` for saved evidence, and `gsd_exec` for noisy doc validation commands.",
|
|
94
94
|
};
|
|
95
|
-
// Per-unit overrides win over the lane default.
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
// Per-unit overrides win over the lane default. Some units intentionally run
|
|
96
|
+
// with narrower tool contracts than their shared Context Mode lane, so their
|
|
97
|
+
// guidance must name only tools the unit can actually call.
|
|
98
|
+
export const CONTEXT_MODE_GUIDANCE_BY_UNIT = {
|
|
99
|
+
"discuss-milestone": "Use `ask_user_questions` to continue the milestone interview, then persist outcomes with `gsd_summary_save`, `gsd_decision_save`, `gsd_requirement_save`, `gsd_requirement_update`, `gsd_plan_milestone`, or `gsd_milestone_generate_id` as appropriate.",
|
|
100
|
+
"discuss-slice": "Use `ask_user_questions` to continue the slice interview, then persist outcomes with `gsd_summary_save` or `gsd_decision_save` as appropriate.",
|
|
101
|
+
"discuss-project": "Use `ask_user_questions` to continue the project interview, then persist outcomes with `gsd_summary_save`, `gsd_decision_save`, or `gsd_requirement_save` as appropriate.",
|
|
102
|
+
"discuss-requirements": "Use `ask_user_questions` to continue the requirements interview, then persist outcomes with `gsd_requirement_save` or `gsd_summary_save` as appropriate.",
|
|
103
|
+
"replan-slice": "Use `gsd_replan_slice` to persist the revised slice plan, and `gsd_decision_save` for planning decisions that need durable rationale.",
|
|
104
|
+
"reassess-roadmap": "Use `gsd_milestone_status` to inspect current milestone state, then `gsd_reassess_roadmap` to persist the roadmap reassessment.",
|
|
101
105
|
"run-uat": "Use `gsd_uat_exec` for acceptance checks so evidence is typed as UAT-owned, and `gsd_resume` after compaction or resume.",
|
|
106
|
+
"research-project": "Dispatch parallel scout subagents for stack, features, architecture, and pitfalls research; each writes one file under `.gsd/research/` (`STACK.md`, `FEATURES.md`, `ARCHITECTURE.md`, `PITFALLS.md`).",
|
|
107
|
+
"gate-evaluate": "Use `subagent` to dispatch tester agents, then persist each gate with `gsd_save_gate_result`; rely on testers for verification evidence.",
|
|
108
|
+
};
|
|
109
|
+
// Per-unit guidance for the nested render mode (renderMode: "nested"), used when this
|
|
110
|
+
// unit's Context Mode line is embedded into a subagent prompt — e.g. the tester prompts
|
|
111
|
+
// dispatched by gate-evaluate. Must instruct the subagent on what IT should do, not
|
|
112
|
+
// re-state the parent coordinator's dispatch instructions. Falls back to
|
|
113
|
+
// CONTEXT_MODE_GUIDANCE_BY_UNIT then the lane default when no nested entry exists.
|
|
114
|
+
export const CONTEXT_MODE_NESTED_GUIDANCE_BY_UNIT = {
|
|
115
|
+
"gate-evaluate": "Run verification checks to answer the gate question, then persist the verdict with `gsd_save_gate_result`.",
|
|
102
116
|
};
|
|
103
117
|
/**
|
|
104
118
|
* Render the Context Mode instruction lane for a unit type. Unknown unit
|
|
@@ -112,7 +126,9 @@ export function composeContextModeInstructions(unitType, opts) {
|
|
|
112
126
|
if (!manifest || manifest.contextMode === "none")
|
|
113
127
|
return "";
|
|
114
128
|
const lane = CONTEXT_MODE_LANE_LABELS[manifest.contextMode];
|
|
115
|
-
const guidance =
|
|
129
|
+
const guidance = (opts.renderMode === "nested" ? CONTEXT_MODE_NESTED_GUIDANCE_BY_UNIT[unitType] : undefined)
|
|
130
|
+
?? CONTEXT_MODE_GUIDANCE_BY_UNIT[unitType]
|
|
131
|
+
?? CONTEXT_MODE_GUIDANCE_BY_LANE[manifest.contextMode];
|
|
116
132
|
if (opts.renderMode === "nested") {
|
|
117
133
|
return `Context Mode (${lane} lane): ${guidance}`;
|
|
118
134
|
}
|