gsd-pi 2.63.0-dev.026d309 → 2.63.0-dev.351157b
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 +46 -134
- package/dist/cli.js +44 -6
- package/dist/help-text.js +4 -1
- package/dist/onboarding.js +15 -8
- package/dist/resource-loader.js +18 -3
- package/dist/resources/extensions/cmux/index.js +21 -12
- package/dist/resources/extensions/gsd/auto/finalize-timeout.js +40 -0
- package/dist/resources/extensions/gsd/auto/loop.js +4 -0
- package/dist/resources/extensions/gsd/auto/phases.js +123 -22
- package/dist/resources/extensions/gsd/auto/session.js +8 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +9 -3
- package/dist/resources/extensions/gsd/auto-post-unit.js +45 -10
- package/dist/resources/extensions/gsd/auto-prompts.js +25 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +15 -7
- package/dist/resources/extensions/gsd/auto-start.js +10 -21
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +17 -0
- package/dist/resources/extensions/gsd/auto-worktree.js +13 -7
- package/dist/resources/extensions/gsd/auto.js +19 -2
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +73 -60
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +13 -0
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +85 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +3 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +9 -1
- package/dist/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.js +54 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +9 -4
- package/dist/resources/extensions/gsd/constants.js +42 -0
- package/dist/resources/extensions/gsd/db-writer.js +72 -4
- package/dist/resources/extensions/gsd/forensics.js +20 -4
- package/dist/resources/extensions/gsd/gsd-db.js +64 -17
- package/dist/resources/extensions/gsd/guided-flow.js +19 -0
- package/dist/resources/extensions/gsd/metrics.js +27 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +5 -3
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences.js +7 -2
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +2 -0
- package/dist/resources/extensions/gsd/prompts/doctor-heal.md +1 -0
- package/dist/resources/extensions/gsd/prompts/forensics.md +2 -0
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +2 -0
- package/dist/resources/extensions/gsd/prompts/system.md +1 -0
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/dist/resources/extensions/gsd/roadmap-mutations.js +1 -1
- package/dist/resources/extensions/gsd/roadmap-slices.js +9 -5
- package/dist/resources/extensions/gsd/slice-parallel-conflict.js +67 -0
- package/dist/resources/extensions/gsd/slice-parallel-eligibility.js +51 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +378 -0
- package/dist/resources/extensions/gsd/state.js +74 -14
- package/dist/resources/extensions/gsd/status-guards.js +11 -0
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +17 -12
- package/dist/resources/extensions/gsd/tools/complete-slice.js +40 -26
- package/dist/resources/extensions/gsd/tools/complete-task.js +12 -12
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +33 -25
- package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -8
- package/dist/resources/extensions/gsd/workflow-projections.js +21 -5
- package/dist/resources/extensions/gsd/worktree-manager.js +82 -29
- package/dist/resources/extensions/gsd/worktree-resolver.js +4 -3
- package/dist/resources/extensions/mcp-client/auth.js +101 -0
- package/dist/resources/extensions/mcp-client/index.js +10 -1
- package/dist/resources/extensions/ollama/index.js +6 -12
- package/dist/resources/extensions/ollama/model-capabilities.js +37 -34
- package/dist/resources/extensions/ollama/ndjson-stream.js +54 -0
- package/dist/resources/extensions/ollama/ollama-chat-provider.js +380 -0
- package/dist/resources/extensions/ollama/ollama-client.js +23 -32
- package/dist/resources/extensions/ollama/ollama-discovery.js +2 -7
- package/dist/resources/extensions/ollama/ollama-tool.js +62 -0
- package/dist/resources/extensions/ollama/thinking-parser.js +104 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +14 -14
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +14 -14
- package/dist/web/standalone/.next/server/chunks/6897.js +12 -0
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.d.ts +8 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +50 -0
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +221 -5
- package/packages/pi-agent-core/src/agent-loop.ts +53 -0
- package/packages/pi-ai/dist/types.d.ts +16 -1
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/src/types.ts +18 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +50 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js +41 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +31 -4
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.test.js +28 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -3
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +23 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +80 -56
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +10 -0
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/src/core/auth-storage.test.ts +53 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +66 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.test.ts +39 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +34 -4
- package/packages/pi-coding-agent/src/core/extensions/types.ts +2 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +2 -0
- package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -3
- package/packages/pi-coding-agent/src/core/resource-loader.ts +89 -56
- package/packages/pi-coding-agent/src/core/sdk.ts +11 -0
- package/src/resources/extensions/cmux/index.ts +18 -12
- package/src/resources/extensions/gsd/auto/finalize-timeout.ts +46 -0
- package/src/resources/extensions/gsd/auto/loop.ts +5 -0
- package/src/resources/extensions/gsd/auto/phases.ts +156 -34
- package/src/resources/extensions/gsd/auto/session.ts +9 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +11 -3
- package/src/resources/extensions/gsd/auto-post-unit.ts +53 -12
- package/src/resources/extensions/gsd/auto-prompts.ts +21 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +9 -8
- package/src/resources/extensions/gsd/auto-start.ts +11 -20
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +19 -0
- package/src/resources/extensions/gsd/auto-worktree.ts +14 -6
- package/src/resources/extensions/gsd/auto.ts +22 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +74 -60
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +15 -0
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +98 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +4 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +9 -1
- package/src/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.ts +57 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +10 -4
- package/src/resources/extensions/gsd/constants.ts +44 -0
- package/src/resources/extensions/gsd/db-writer.ts +78 -4
- package/src/resources/extensions/gsd/forensics.ts +21 -5
- package/src/resources/extensions/gsd/gsd-db.ts +64 -17
- package/src/resources/extensions/gsd/guided-flow.ts +22 -0
- package/src/resources/extensions/gsd/metrics.ts +28 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +5 -3
- package/src/resources/extensions/gsd/preferences-types.ts +3 -0
- package/src/resources/extensions/gsd/preferences.ts +9 -2
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +2 -0
- package/src/resources/extensions/gsd/prompts/doctor-heal.md +1 -0
- package/src/resources/extensions/gsd/prompts/forensics.md +2 -0
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +2 -0
- package/src/resources/extensions/gsd/prompts/system.md +1 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/src/resources/extensions/gsd/roadmap-mutations.ts +1 -1
- package/src/resources/extensions/gsd/roadmap-slices.ts +10 -5
- package/src/resources/extensions/gsd/slice-parallel-conflict.ts +86 -0
- package/src/resources/extensions/gsd/slice-parallel-eligibility.ts +73 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +477 -0
- package/src/resources/extensions/gsd/state.ts +67 -12
- package/src/resources/extensions/gsd/status-guards.ts +13 -0
- package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +288 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +34 -13
- package/src/resources/extensions/gsd/tests/cmux.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/dashboard-model-label-ordering.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/db-access-guardrails.test.ts +109 -0
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +13 -9
- package/src/resources/extensions/gsd/tests/db-writer.test.ts +134 -0
- package/src/resources/extensions/gsd/tests/deferred-slice-dispatch.test.ts +203 -0
- package/src/resources/extensions/gsd/tests/discuss-tool-scoping.test.ts +130 -0
- package/src/resources/extensions/gsd/tests/doctor-fix-flag.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/insert-slice-no-wipe.test.ts +88 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +27 -7
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/metrics.test.ts +116 -1
- package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +201 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-title.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +82 -18
- package/src/resources/extensions/gsd/tests/preferences.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/shared-wal.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-conflict.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-eligibility.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +83 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +349 -0
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +35 -2
- package/src/resources/extensions/gsd/tests/worktree-health-monorepo.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +148 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +34 -20
- package/src/resources/extensions/gsd/tools/complete-slice.ts +41 -26
- package/src/resources/extensions/gsd/tools/complete-task.ts +12 -12
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +55 -30
- package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -8
- package/src/resources/extensions/gsd/types.ts +44 -22
- package/src/resources/extensions/gsd/workflow-projections.ts +23 -5
- package/src/resources/extensions/gsd/worktree-manager.ts +76 -28
- package/src/resources/extensions/gsd/worktree-resolver.ts +4 -3
- package/src/resources/extensions/mcp-client/auth.ts +149 -0
- package/src/resources/extensions/mcp-client/index.ts +16 -1
- package/src/resources/extensions/ollama/index.ts +6 -14
- package/src/resources/extensions/ollama/model-capabilities.ts +41 -34
- package/src/resources/extensions/ollama/ndjson-stream.ts +63 -0
- package/src/resources/extensions/ollama/ollama-chat-provider.ts +459 -0
- package/src/resources/extensions/ollama/ollama-client.ts +30 -30
- package/src/resources/extensions/ollama/ollama-discovery.ts +5 -8
- package/src/resources/extensions/ollama/ollama-tool.ts +69 -0
- package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +0 -27
- package/src/resources/extensions/ollama/thinking-parser.ts +116 -0
- package/src/resources/extensions/ollama/types.ts +23 -0
- package/dist/web/standalone/.next/server/chunks/2229.js +0 -12
- /package/dist/web/standalone/.next/static/{TTlAguZQ5vR9EOv6G8cel → QmuF-eAbuU_2MQ03t38qr}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{TTlAguZQ5vR9EOv6G8cel → QmuF-eAbuU_2MQ03t38qr}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Slice Parallel Orchestrator — Engine for parallel slice execution
|
|
3
|
+
* within a single milestone.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the existing parallel-orchestrator.ts pattern at slice scope
|
|
6
|
+
* instead of milestone scope. Workers are separate processes spawned via
|
|
7
|
+
* child_process, each running in its own git worktree with GSD_SLICE_LOCK
|
|
8
|
+
* + GSD_MILESTONE_LOCK env vars set.
|
|
9
|
+
*
|
|
10
|
+
* Key differences from milestone-level parallelism:
|
|
11
|
+
* - Scope: slices within one milestone, not milestones within a project
|
|
12
|
+
* - Lock env: GSD_SLICE_LOCK (in addition to GSD_MILESTONE_LOCK)
|
|
13
|
+
* - Conflict check: file overlap between slice plans (slice-parallel-conflict.ts)
|
|
14
|
+
*/
|
|
15
|
+
import { spawn } from "node:child_process";
|
|
16
|
+
import { appendFileSync, existsSync, mkdirSync, } from "node:fs";
|
|
17
|
+
import { join, dirname } from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
import { gsdRoot } from "./paths.js";
|
|
20
|
+
import { createWorktree, worktreePath, removeWorktree } from "./worktree-manager.js";
|
|
21
|
+
import { writeSessionStatus, } from "./session-status-io.js";
|
|
22
|
+
import { hasFileConflict } from "./slice-parallel-conflict.js";
|
|
23
|
+
import { getErrorMessage } from "./error-utils.js";
|
|
24
|
+
// ─── Module State ──────────────────────────────────────────────────────────
|
|
25
|
+
let sliceState = null;
|
|
26
|
+
// ─── Public API ────────────────────────────────────────────────────────────
|
|
27
|
+
/**
|
|
28
|
+
* Check whether slice-level parallel is currently active.
|
|
29
|
+
*/
|
|
30
|
+
export function isSliceParallelActive() {
|
|
31
|
+
return sliceState?.active === true;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get current slice orchestrator state (read-only snapshot).
|
|
35
|
+
*/
|
|
36
|
+
export function getSliceOrchestratorState() {
|
|
37
|
+
return sliceState;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Start parallel execution for eligible slices within a milestone.
|
|
41
|
+
*
|
|
42
|
+
* For each eligible slice: create a worktree, spawn `gsd --mode json --print "/gsd auto"`
|
|
43
|
+
* with env GSD_SLICE_LOCK=<SID> + GSD_MILESTONE_LOCK=<MID> + GSD_PARALLEL_WORKER=1.
|
|
44
|
+
*/
|
|
45
|
+
export async function startSliceParallel(basePath, milestoneId, eligibleSlices, opts = {}) {
|
|
46
|
+
// Prevent nesting: if already a parallel worker, refuse
|
|
47
|
+
if (process.env.GSD_PARALLEL_WORKER) {
|
|
48
|
+
return { started: [], errors: [{ sid: "all", error: "Cannot start slice-parallel from within a parallel worker" }] };
|
|
49
|
+
}
|
|
50
|
+
const maxWorkers = opts.maxWorkers ?? 2;
|
|
51
|
+
const budgetCeiling = opts.budgetCeiling;
|
|
52
|
+
// Initialize orchestrator state
|
|
53
|
+
sliceState = {
|
|
54
|
+
active: true,
|
|
55
|
+
workers: new Map(),
|
|
56
|
+
totalCost: 0,
|
|
57
|
+
budgetCeiling,
|
|
58
|
+
maxWorkers,
|
|
59
|
+
startedAt: Date.now(),
|
|
60
|
+
basePath,
|
|
61
|
+
};
|
|
62
|
+
const started = [];
|
|
63
|
+
const errors = [];
|
|
64
|
+
// Filter out conflicting slices (conservative: check all pairs)
|
|
65
|
+
const safeSlices = filterConflictingSlices(basePath, milestoneId, eligibleSlices);
|
|
66
|
+
// Limit to maxWorkers
|
|
67
|
+
const toSpawn = safeSlices.slice(0, maxWorkers);
|
|
68
|
+
for (const slice of toSpawn) {
|
|
69
|
+
try {
|
|
70
|
+
// Create worktree for this slice
|
|
71
|
+
const wtBranch = `slice/${milestoneId}/${slice.id}`;
|
|
72
|
+
const wtName = `${milestoneId}-${slice.id}`;
|
|
73
|
+
const wtPath = worktreePath(basePath, wtName);
|
|
74
|
+
if (!existsSync(wtPath)) {
|
|
75
|
+
createWorktree(basePath, wtName, { branch: wtBranch });
|
|
76
|
+
}
|
|
77
|
+
// Create worker info
|
|
78
|
+
const worker = {
|
|
79
|
+
milestoneId,
|
|
80
|
+
sliceId: slice.id,
|
|
81
|
+
pid: 0,
|
|
82
|
+
process: null,
|
|
83
|
+
worktreePath: wtPath,
|
|
84
|
+
startedAt: Date.now(),
|
|
85
|
+
state: "running",
|
|
86
|
+
completedUnits: 0,
|
|
87
|
+
cost: 0,
|
|
88
|
+
};
|
|
89
|
+
sliceState.workers.set(slice.id, worker);
|
|
90
|
+
// Spawn worker
|
|
91
|
+
const spawned = spawnSliceWorker(basePath, milestoneId, slice.id);
|
|
92
|
+
if (spawned) {
|
|
93
|
+
started.push(slice.id);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
errors.push({ sid: slice.id, error: "Failed to spawn worker process" });
|
|
97
|
+
worker.state = "error";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
errors.push({ sid: slice.id, error: getErrorMessage(err) });
|
|
102
|
+
// Best-effort cleanup of partially created worktree
|
|
103
|
+
const wtName = `${milestoneId}-${slice.id}`;
|
|
104
|
+
try {
|
|
105
|
+
removeWorktree(basePath, wtName, { deleteBranch: true, force: true });
|
|
106
|
+
}
|
|
107
|
+
catch { /* ignore cleanup failures */ }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// If nothing started, deactivate
|
|
111
|
+
if (started.length === 0) {
|
|
112
|
+
sliceState.active = false;
|
|
113
|
+
}
|
|
114
|
+
return { started, errors };
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Stop all slice-parallel workers and deactivate.
|
|
118
|
+
*/
|
|
119
|
+
export function stopSliceParallel() {
|
|
120
|
+
if (!sliceState)
|
|
121
|
+
return;
|
|
122
|
+
for (const worker of sliceState.workers.values()) {
|
|
123
|
+
if (worker.process) {
|
|
124
|
+
try {
|
|
125
|
+
worker.process.kill("SIGTERM");
|
|
126
|
+
}
|
|
127
|
+
catch { /* already dead */ }
|
|
128
|
+
}
|
|
129
|
+
worker.cleanup?.();
|
|
130
|
+
worker.cleanup = undefined;
|
|
131
|
+
worker.process = null;
|
|
132
|
+
worker.state = "stopped";
|
|
133
|
+
// Clean up worktree created for this worker
|
|
134
|
+
const wtName = `${worker.milestoneId}-${worker.sliceId}`;
|
|
135
|
+
try {
|
|
136
|
+
removeWorktree(sliceState.basePath, wtName, { deleteBranch: true, force: true });
|
|
137
|
+
}
|
|
138
|
+
catch { /* best-effort cleanup */ }
|
|
139
|
+
}
|
|
140
|
+
sliceState.active = false;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get aggregate cost across all slice workers.
|
|
144
|
+
*/
|
|
145
|
+
export function getSliceAggregateCost() {
|
|
146
|
+
if (!sliceState)
|
|
147
|
+
return 0;
|
|
148
|
+
let total = 0;
|
|
149
|
+
for (const w of sliceState.workers.values()) {
|
|
150
|
+
total += w.cost;
|
|
151
|
+
}
|
|
152
|
+
return total;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Check if budget ceiling has been exceeded.
|
|
156
|
+
*/
|
|
157
|
+
export function isSliceBudgetExceeded() {
|
|
158
|
+
if (!sliceState?.budgetCeiling)
|
|
159
|
+
return false;
|
|
160
|
+
return getSliceAggregateCost() >= sliceState.budgetCeiling;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Reset module state (for testing).
|
|
164
|
+
*/
|
|
165
|
+
export function resetSliceOrchestrator() {
|
|
166
|
+
if (sliceState) {
|
|
167
|
+
for (const w of sliceState.workers.values()) {
|
|
168
|
+
w.cleanup?.();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
sliceState = null;
|
|
172
|
+
}
|
|
173
|
+
// ─── Internal: Conflict Filtering ──────────────────────────────────────────
|
|
174
|
+
/**
|
|
175
|
+
* Remove slices that have file conflicts with each other.
|
|
176
|
+
* Greedy: add slices to the safe set in order; skip any that conflict
|
|
177
|
+
* with an already-included slice.
|
|
178
|
+
*/
|
|
179
|
+
function filterConflictingSlices(basePath, milestoneId, slices) {
|
|
180
|
+
const safe = [];
|
|
181
|
+
for (const candidate of slices) {
|
|
182
|
+
let conflictsWithSafe = false;
|
|
183
|
+
for (const existing of safe) {
|
|
184
|
+
if (hasFileConflict(basePath, milestoneId, candidate.id, existing.id)) {
|
|
185
|
+
conflictsWithSafe = true;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (!conflictsWithSafe) {
|
|
190
|
+
safe.push(candidate);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return safe;
|
|
194
|
+
}
|
|
195
|
+
// ─── Internal: Worker Spawning ─────────────────────────────────────────────
|
|
196
|
+
/**
|
|
197
|
+
* Resolve the GSD CLI binary path.
|
|
198
|
+
* Same logic as parallel-orchestrator.ts resolveGsdBin().
|
|
199
|
+
*/
|
|
200
|
+
function resolveGsdBin() {
|
|
201
|
+
if (process.env.GSD_BIN_PATH && existsSync(process.env.GSD_BIN_PATH)) {
|
|
202
|
+
return process.env.GSD_BIN_PATH;
|
|
203
|
+
}
|
|
204
|
+
let thisDir;
|
|
205
|
+
try {
|
|
206
|
+
thisDir = dirname(fileURLToPath(import.meta.url));
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
thisDir = process.cwd();
|
|
210
|
+
}
|
|
211
|
+
const candidates = [
|
|
212
|
+
join(thisDir, "..", "..", "..", "loader.js"),
|
|
213
|
+
join(thisDir, "..", "..", "..", "..", "dist", "loader.js"),
|
|
214
|
+
];
|
|
215
|
+
for (const candidate of candidates) {
|
|
216
|
+
if (existsSync(candidate))
|
|
217
|
+
return candidate;
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Spawn a worker process for a slice.
|
|
223
|
+
* The worker runs `gsd --mode json --print "/gsd auto"` in the slice's worktree
|
|
224
|
+
* with GSD_SLICE_LOCK, GSD_MILESTONE_LOCK, and GSD_PARALLEL_WORKER set.
|
|
225
|
+
*/
|
|
226
|
+
function spawnSliceWorker(basePath, milestoneId, sliceId) {
|
|
227
|
+
if (!sliceState)
|
|
228
|
+
return false;
|
|
229
|
+
const worker = sliceState.workers.get(sliceId);
|
|
230
|
+
if (!worker)
|
|
231
|
+
return false;
|
|
232
|
+
if (worker.process)
|
|
233
|
+
return true;
|
|
234
|
+
const binPath = resolveGsdBin();
|
|
235
|
+
if (!binPath)
|
|
236
|
+
return false;
|
|
237
|
+
let child;
|
|
238
|
+
try {
|
|
239
|
+
child = spawn(process.execPath, [binPath, "--mode", "json", "--print", "/gsd auto"], {
|
|
240
|
+
cwd: worker.worktreePath,
|
|
241
|
+
env: {
|
|
242
|
+
...process.env,
|
|
243
|
+
GSD_SLICE_LOCK: sliceId,
|
|
244
|
+
GSD_MILESTONE_LOCK: milestoneId,
|
|
245
|
+
GSD_PROJECT_ROOT: basePath,
|
|
246
|
+
GSD_PARALLEL_WORKER: "1",
|
|
247
|
+
},
|
|
248
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
249
|
+
detached: false,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
child.on("error", () => {
|
|
256
|
+
if (!sliceState)
|
|
257
|
+
return;
|
|
258
|
+
const w = sliceState.workers.get(sliceId);
|
|
259
|
+
if (w) {
|
|
260
|
+
w.process = null;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
worker.process = child;
|
|
264
|
+
worker.pid = child.pid ?? 0;
|
|
265
|
+
if (!child.pid) {
|
|
266
|
+
worker.process = null;
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
// ── NDJSON stdout monitoring ────────────────────────────────────────
|
|
270
|
+
if (child.stdout) {
|
|
271
|
+
let stdoutBuffer = "";
|
|
272
|
+
child.stdout.on("data", (data) => {
|
|
273
|
+
stdoutBuffer += data.toString();
|
|
274
|
+
const lines = stdoutBuffer.split("\n");
|
|
275
|
+
stdoutBuffer = lines.pop() || "";
|
|
276
|
+
for (const line of lines) {
|
|
277
|
+
processSliceWorkerLine(basePath, milestoneId, sliceId, line);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
child.stdout.on("close", () => {
|
|
281
|
+
if (stdoutBuffer.trim()) {
|
|
282
|
+
processSliceWorkerLine(basePath, milestoneId, sliceId, stdoutBuffer);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
if (child.stderr) {
|
|
287
|
+
child.stderr.on("data", (data) => {
|
|
288
|
+
appendSliceWorkerLog(basePath, milestoneId, sliceId, data.toString());
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
// Update session status
|
|
292
|
+
writeSessionStatus(basePath, {
|
|
293
|
+
milestoneId: `${milestoneId}/${sliceId}`,
|
|
294
|
+
pid: worker.pid,
|
|
295
|
+
state: "running",
|
|
296
|
+
currentUnit: null,
|
|
297
|
+
completedUnits: worker.completedUnits,
|
|
298
|
+
cost: worker.cost,
|
|
299
|
+
lastHeartbeat: Date.now(),
|
|
300
|
+
startedAt: worker.startedAt,
|
|
301
|
+
worktreePath: worker.worktreePath,
|
|
302
|
+
});
|
|
303
|
+
// Store cleanup function
|
|
304
|
+
worker.cleanup = () => {
|
|
305
|
+
child.stdout?.removeAllListeners();
|
|
306
|
+
child.stderr?.removeAllListeners();
|
|
307
|
+
child.removeAllListeners();
|
|
308
|
+
};
|
|
309
|
+
// Handle worker exit
|
|
310
|
+
child.on("exit", (code) => {
|
|
311
|
+
if (!sliceState)
|
|
312
|
+
return;
|
|
313
|
+
const w = sliceState.workers.get(sliceId);
|
|
314
|
+
if (!w)
|
|
315
|
+
return;
|
|
316
|
+
w.cleanup?.();
|
|
317
|
+
w.cleanup = undefined;
|
|
318
|
+
w.process = null;
|
|
319
|
+
if (w.state === "stopped")
|
|
320
|
+
return;
|
|
321
|
+
if (code === 0) {
|
|
322
|
+
w.state = "stopped";
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
w.state = "error";
|
|
326
|
+
appendSliceWorkerLog(basePath, milestoneId, sliceId, `\n[slice-orchestrator] worker exited with code ${code ?? "null"}\n`);
|
|
327
|
+
}
|
|
328
|
+
writeSessionStatus(basePath, {
|
|
329
|
+
milestoneId: `${milestoneId}/${sliceId}`,
|
|
330
|
+
pid: w.pid,
|
|
331
|
+
state: w.state,
|
|
332
|
+
currentUnit: null,
|
|
333
|
+
completedUnits: w.completedUnits,
|
|
334
|
+
cost: w.cost,
|
|
335
|
+
lastHeartbeat: Date.now(),
|
|
336
|
+
startedAt: w.startedAt,
|
|
337
|
+
worktreePath: w.worktreePath,
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
// ─── NDJSON Processing ──────────────────────────────────────────────────────
|
|
343
|
+
/**
|
|
344
|
+
* Process a single NDJSON line from a slice worker's stdout.
|
|
345
|
+
* Extracts cost from message_end events.
|
|
346
|
+
*/
|
|
347
|
+
function processSliceWorkerLine(_basePath, _milestoneId, sliceId, line) {
|
|
348
|
+
if (!line.trim() || !sliceState)
|
|
349
|
+
return;
|
|
350
|
+
let event;
|
|
351
|
+
try {
|
|
352
|
+
event = JSON.parse(line);
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
const type = String(event.type ?? "");
|
|
358
|
+
if (type === "message_end") {
|
|
359
|
+
const worker = sliceState.workers.get(sliceId);
|
|
360
|
+
if (worker) {
|
|
361
|
+
const usage = event.usage;
|
|
362
|
+
if (usage?.cost && typeof usage.cost === "number") {
|
|
363
|
+
worker.cost += usage.cost;
|
|
364
|
+
sliceState.totalCost += usage.cost;
|
|
365
|
+
}
|
|
366
|
+
worker.completedUnits++;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// ─── Logging ────────────────────────────────────────────────────────────────
|
|
371
|
+
function sliceLogDir(basePath) {
|
|
372
|
+
return join(gsdRoot(basePath), "parallel", "slice-logs");
|
|
373
|
+
}
|
|
374
|
+
function appendSliceWorkerLog(basePath, milestoneId, sliceId, text) {
|
|
375
|
+
const dir = sliceLogDir(basePath);
|
|
376
|
+
mkdirSync(dir, { recursive: true });
|
|
377
|
+
appendFileSync(join(dir, `${milestoneId}-${sliceId}.log`), text);
|
|
378
|
+
}
|
|
@@ -6,12 +6,13 @@ import { parseSummary, loadFile, parseRequirementCounts, parseContextDependsOn,
|
|
|
6
6
|
import { resolveMilestoneFile, resolveSlicePath, resolveSliceFile, resolveTaskFile, resolveTasksDir, resolveGsdRootFile, gsdRoot, } from './paths.js';
|
|
7
7
|
import { findMilestoneIds } from './milestone-ids.js';
|
|
8
8
|
import { loadQueueOrder, sortByQueueOrder } from './queue-order.js';
|
|
9
|
+
import { isDeferredStatus } from './status-guards.js';
|
|
9
10
|
import { nativeBatchParseGsdFiles } from './native-parser-bridge.js';
|
|
10
11
|
import { join, resolve } from 'path';
|
|
11
12
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
12
13
|
import { debugCount, debugTime } from './debug-logger.js';
|
|
13
|
-
import { extractVerdict } from './verdict-parser.js';
|
|
14
14
|
import { logWarning, logError } from './workflow-logger.js';
|
|
15
|
+
import { extractVerdict } from './verdict-parser.js';
|
|
15
16
|
import { isDbAvailable, getAllMilestones, getMilestone, getMilestoneSlices, getSliceTasks, getReplanHistory, getSlice, insertMilestone, insertSlice, updateTaskStatus, getPendingSliceGateCount, } from './gsd-db.js';
|
|
16
17
|
/**
|
|
17
18
|
* A "ghost" milestone directory contains only META.json (and no substantive
|
|
@@ -568,13 +569,43 @@ export async function deriveStateFromDb(basePath) {
|
|
|
568
569
|
const doneSliceIds = new Set(activeMilestoneSlices.filter(s => isStatusDone(s.status)).map(s => s.id));
|
|
569
570
|
let activeSlice = null;
|
|
570
571
|
let activeSliceRow = null;
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
572
|
+
// ── Slice-level parallel worker isolation ─────────────────────────────
|
|
573
|
+
// When GSD_SLICE_LOCK is set, this process is a parallel worker scoped
|
|
574
|
+
// to a single slice. Override activeSlice to only the locked slice ID.
|
|
575
|
+
const sliceLock = process.env.GSD_SLICE_LOCK;
|
|
576
|
+
if (sliceLock) {
|
|
577
|
+
const lockedSlice = activeMilestoneSlices.find(s => s.id === sliceLock);
|
|
578
|
+
if (lockedSlice) {
|
|
579
|
+
activeSlice = { id: lockedSlice.id, title: lockedSlice.title };
|
|
580
|
+
activeSliceRow = lockedSlice;
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
logWarning("state", `GSD_SLICE_LOCK=${sliceLock} not found in active slices — worker has no assigned work`);
|
|
584
|
+
// Don't silently continue — this is a dispatch error
|
|
585
|
+
return {
|
|
586
|
+
activeMilestone, activeSlice: null, activeTask: null,
|
|
587
|
+
phase: 'blocked',
|
|
588
|
+
recentDecisions: [], blockers: [`GSD_SLICE_LOCK=${sliceLock} not found in active milestone slices`],
|
|
589
|
+
nextAction: 'Slice lock references a non-existent slice — check orchestrator dispatch.',
|
|
590
|
+
registry, requirements,
|
|
591
|
+
progress: { milestones: milestoneProgress, slices: sliceProgress },
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
for (const s of activeMilestoneSlices) {
|
|
597
|
+
if (isStatusDone(s.status))
|
|
598
|
+
continue;
|
|
599
|
+
// #2661: Skip deferred slices — a decision explicitly deferred this work.
|
|
600
|
+
// Without this guard the dispatcher would keep dispatching deferred slices
|
|
601
|
+
// because DECISIONS.md is only contextual, not authoritative for dispatch.
|
|
602
|
+
if (isDeferredStatus(s.status))
|
|
603
|
+
continue;
|
|
604
|
+
if (s.depends.every(dep => doneSliceIds.has(dep))) {
|
|
605
|
+
activeSlice = { id: s.id, title: s.title };
|
|
606
|
+
activeSliceRow = s;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
578
609
|
}
|
|
579
610
|
}
|
|
580
611
|
if (!activeSlice) {
|
|
@@ -1188,12 +1219,41 @@ export async function _deriveStateImpl(basePath) {
|
|
|
1188
1219
|
// Find the active slice (first incomplete with deps satisfied)
|
|
1189
1220
|
const doneSliceIds = new Set(activeRoadmap.slices.filter(s => s.done).map(s => s.id));
|
|
1190
1221
|
let activeSlice = null;
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1222
|
+
// ── Slice-level parallel worker isolation ─────────────────────────────
|
|
1223
|
+
// When GSD_SLICE_LOCK is set, override activeSlice to only the locked slice.
|
|
1224
|
+
const sliceLockLegacy = process.env.GSD_SLICE_LOCK;
|
|
1225
|
+
if (sliceLockLegacy) {
|
|
1226
|
+
const lockedSlice = activeRoadmap.slices.find(s => s.id === sliceLockLegacy);
|
|
1227
|
+
if (lockedSlice) {
|
|
1228
|
+
activeSlice = { id: lockedSlice.id, title: lockedSlice.title };
|
|
1229
|
+
}
|
|
1230
|
+
else {
|
|
1231
|
+
logWarning("state", `GSD_SLICE_LOCK=${sliceLockLegacy} not found in active slices — worker has no assigned work`);
|
|
1232
|
+
return {
|
|
1233
|
+
activeMilestone,
|
|
1234
|
+
activeSlice: null,
|
|
1235
|
+
activeTask: null,
|
|
1236
|
+
phase: 'blocked',
|
|
1237
|
+
recentDecisions: [],
|
|
1238
|
+
blockers: [`GSD_SLICE_LOCK=${sliceLockLegacy} not found in active milestone slices`],
|
|
1239
|
+
nextAction: 'Slice lock references a non-existent slice — check orchestrator dispatch.',
|
|
1240
|
+
registry,
|
|
1241
|
+
requirements,
|
|
1242
|
+
progress: {
|
|
1243
|
+
milestones: milestoneProgress,
|
|
1244
|
+
slices: sliceProgress,
|
|
1245
|
+
},
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
else {
|
|
1250
|
+
for (const s of activeRoadmap.slices) {
|
|
1251
|
+
if (s.done)
|
|
1252
|
+
continue;
|
|
1253
|
+
if (s.depends.every(dep => doneSliceIds.has(dep))) {
|
|
1254
|
+
activeSlice = { id: s.id, title: s.title };
|
|
1255
|
+
break;
|
|
1256
|
+
}
|
|
1197
1257
|
}
|
|
1198
1258
|
}
|
|
1199
1259
|
if (!activeSlice) {
|
|
@@ -11,3 +11,14 @@
|
|
|
11
11
|
export function isClosedStatus(status) {
|
|
12
12
|
return status === "complete" || status === "done" || status === "skipped";
|
|
13
13
|
}
|
|
14
|
+
/** Returns true when a slice status indicates it was deferred by a decision. */
|
|
15
|
+
export function isDeferredStatus(status) {
|
|
16
|
+
return status === "deferred";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns true when a slice should be skipped during active-slice selection.
|
|
20
|
+
* This includes both closed (complete/done) and deferred slices.
|
|
21
|
+
*/
|
|
22
|
+
export function isInactiveStatus(status) {
|
|
23
|
+
return isClosedStatus(status) || isDeferredStatus(status);
|
|
24
|
+
}
|
|
@@ -12,24 +12,29 @@ import { resolveMilestonePath, clearPathCache } from "../paths.js";
|
|
|
12
12
|
import { isClosedStatus } from "../status-guards.js";
|
|
13
13
|
import { saveFile, clearParseCache } from "../files.js";
|
|
14
14
|
import { invalidateStateCache } from "../state.js";
|
|
15
|
-
import { renderAllProjections } from "../workflow-projections.js";
|
|
15
|
+
import { renderAllProjections, stripIdPrefix } from "../workflow-projections.js";
|
|
16
16
|
import { writeManifest } from "../workflow-manifest.js";
|
|
17
17
|
import { appendEvent } from "../workflow-events.js";
|
|
18
18
|
import { logWarning } from "../workflow-logger.js";
|
|
19
19
|
function renderMilestoneSummaryMarkdown(params) {
|
|
20
20
|
const now = new Date().toISOString();
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const displayTitle = stripIdPrefix(params.title, params.milestoneId);
|
|
22
|
+
// Apply defaults for optional enrichment fields (#2771)
|
|
23
|
+
const keyDecisions = params.keyDecisions ?? [];
|
|
24
|
+
const keyFiles = params.keyFiles ?? [];
|
|
25
|
+
const lessonsLearned = params.lessonsLearned ?? [];
|
|
26
|
+
const keyDecisionsYaml = keyDecisions.length > 0
|
|
27
|
+
? keyDecisions.map(d => ` - ${d}`).join("\n")
|
|
23
28
|
: " - (none)";
|
|
24
|
-
const keyFilesYaml =
|
|
25
|
-
?
|
|
29
|
+
const keyFilesYaml = keyFiles.length > 0
|
|
30
|
+
? keyFiles.map(f => ` - ${f}`).join("\n")
|
|
26
31
|
: " - (none)";
|
|
27
|
-
const lessonsYaml =
|
|
28
|
-
?
|
|
32
|
+
const lessonsYaml = lessonsLearned.length > 0
|
|
33
|
+
? lessonsLearned.map(l => ` - ${l}`).join("\n")
|
|
29
34
|
: " - (none)";
|
|
30
35
|
return `---
|
|
31
36
|
id: ${params.milestoneId}
|
|
32
|
-
title: "${
|
|
37
|
+
title: "${displayTitle}"
|
|
33
38
|
status: complete
|
|
34
39
|
completed_at: ${now}
|
|
35
40
|
key_decisions:
|
|
@@ -40,7 +45,7 @@ lessons_learned:
|
|
|
40
45
|
${lessonsYaml}
|
|
41
46
|
---
|
|
42
47
|
|
|
43
|
-
# ${params.milestoneId}: ${
|
|
48
|
+
# ${params.milestoneId}: ${displayTitle}
|
|
44
49
|
|
|
45
50
|
**${params.oneLiner}**
|
|
46
51
|
|
|
@@ -50,15 +55,15 @@ ${params.narrative}
|
|
|
50
55
|
|
|
51
56
|
## Success Criteria Results
|
|
52
57
|
|
|
53
|
-
${params.successCriteriaResults}
|
|
58
|
+
${params.successCriteriaResults ?? "Not provided."}
|
|
54
59
|
|
|
55
60
|
## Definition of Done Results
|
|
56
61
|
|
|
57
|
-
${params.definitionOfDoneResults}
|
|
62
|
+
${params.definitionOfDoneResults ?? "Not provided."}
|
|
58
63
|
|
|
59
64
|
## Requirement Outcomes
|
|
60
65
|
|
|
61
|
-
${params.requirementOutcomes}
|
|
66
|
+
${params.requirementOutcomes ?? "Not provided."}
|
|
62
67
|
|
|
63
68
|
## Deviations
|
|
64
69
|
|
|
@@ -25,46 +25,60 @@ import { logWarning } from "../workflow-logger.js";
|
|
|
25
25
|
*/
|
|
26
26
|
function renderSliceSummaryMarkdown(params) {
|
|
27
27
|
const now = new Date().toISOString();
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// Apply defaults for optional enrichment arrays (#2771)
|
|
29
|
+
const provides = params.provides ?? [];
|
|
30
|
+
const requires = params.requires ?? [];
|
|
31
|
+
const affects = params.affects ?? [];
|
|
32
|
+
const keyFiles = params.keyFiles ?? [];
|
|
33
|
+
const keyDecisions = params.keyDecisions ?? [];
|
|
34
|
+
const patternsEstablished = params.patternsEstablished ?? [];
|
|
35
|
+
const observabilitySurfaces = params.observabilitySurfaces ?? [];
|
|
36
|
+
const drillDownPaths = params.drillDownPaths ?? [];
|
|
37
|
+
const requirementsAdvanced = params.requirementsAdvanced ?? [];
|
|
38
|
+
const requirementsValidated = params.requirementsValidated ?? [];
|
|
39
|
+
const requirementsSurfaced = params.requirementsSurfaced ?? [];
|
|
40
|
+
const requirementsInvalidated = params.requirementsInvalidated ?? [];
|
|
41
|
+
const filesModified = params.filesModified ?? [];
|
|
42
|
+
const providesYaml = provides.length > 0
|
|
43
|
+
? provides.map(p => ` - ${p}`).join("\n")
|
|
30
44
|
: " - (none)";
|
|
31
|
-
const requiresYaml =
|
|
32
|
-
?
|
|
45
|
+
const requiresYaml = requires.length > 0
|
|
46
|
+
? requires.map(r => ` - slice: ${r.slice}\n provides: ${r.provides}`).join("\n")
|
|
33
47
|
: " []";
|
|
34
|
-
const affectsYaml =
|
|
35
|
-
?
|
|
48
|
+
const affectsYaml = affects.length > 0
|
|
49
|
+
? affects.map(a => ` - ${a}`).join("\n")
|
|
36
50
|
: " []";
|
|
37
|
-
const keyFilesYaml =
|
|
38
|
-
?
|
|
51
|
+
const keyFilesYaml = keyFiles.length > 0
|
|
52
|
+
? keyFiles.map(f => ` - ${f}`).join("\n")
|
|
39
53
|
: " - (none)";
|
|
40
|
-
const keyDecisionsYaml =
|
|
41
|
-
?
|
|
54
|
+
const keyDecisionsYaml = keyDecisions.length > 0
|
|
55
|
+
? keyDecisions.map(d => ` - ${d}`).join("\n")
|
|
42
56
|
: " - (none)";
|
|
43
|
-
const patternsYaml =
|
|
44
|
-
?
|
|
57
|
+
const patternsYaml = patternsEstablished.length > 0
|
|
58
|
+
? patternsEstablished.map(p => ` - ${p}`).join("\n")
|
|
45
59
|
: " - (none)";
|
|
46
|
-
const observabilityYaml =
|
|
47
|
-
?
|
|
60
|
+
const observabilityYaml = observabilitySurfaces.length > 0
|
|
61
|
+
? observabilitySurfaces.map(o => ` - ${o}`).join("\n")
|
|
48
62
|
: " - none";
|
|
49
|
-
const drillDownYaml =
|
|
50
|
-
?
|
|
63
|
+
const drillDownYaml = drillDownPaths.length > 0
|
|
64
|
+
? drillDownPaths.map(d => ` - ${d}`).join("\n")
|
|
51
65
|
: " []";
|
|
52
66
|
// Requirements sections
|
|
53
|
-
const reqAdvanced =
|
|
54
|
-
?
|
|
67
|
+
const reqAdvanced = requirementsAdvanced.length > 0
|
|
68
|
+
? requirementsAdvanced.map(r => `- ${r.id} — ${r.how}`).join("\n")
|
|
55
69
|
: "None.";
|
|
56
|
-
const reqValidated =
|
|
57
|
-
?
|
|
70
|
+
const reqValidated = requirementsValidated.length > 0
|
|
71
|
+
? requirementsValidated.map(r => `- ${r.id} — ${r.proof}`).join("\n")
|
|
58
72
|
: "None.";
|
|
59
|
-
const reqSurfaced =
|
|
60
|
-
?
|
|
73
|
+
const reqSurfaced = requirementsSurfaced.length > 0
|
|
74
|
+
? requirementsSurfaced.map(r => `- ${r}`).join("\n")
|
|
61
75
|
: "None.";
|
|
62
|
-
const reqInvalidated =
|
|
63
|
-
?
|
|
76
|
+
const reqInvalidated = requirementsInvalidated.length > 0
|
|
77
|
+
? requirementsInvalidated.map(r => `- ${r.id} — ${r.what}`).join("\n")
|
|
64
78
|
: "None.";
|
|
65
79
|
// Files modified
|
|
66
|
-
const filesMod =
|
|
67
|
-
?
|
|
80
|
+
const filesMod = filesModified.length > 0
|
|
81
|
+
? filesModified.map(f => `- \`${f.path}\` — ${f.description}`).join("\n")
|
|
68
82
|
: "None.";
|
|
69
83
|
return `---
|
|
70
84
|
id: ${params.sliceId}
|