gsd-pi 2.71.0 → 2.72.0-dev.3118184
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 +69 -19
- package/dist/cli.js +88 -6
- package/dist/headless-events.d.ts +2 -0
- package/dist/headless-events.js +7 -0
- package/dist/headless.js +16 -3
- package/dist/mcp-server.js +40 -17
- package/dist/onboarding.js +10 -0
- package/dist/provider-migrations.d.ts +10 -0
- package/dist/provider-migrations.js +12 -0
- package/dist/resource-loader.js +139 -13
- package/dist/resources/GSD-WORKFLOW.md +1 -1
- package/dist/resources/agents/debugger.md +58 -0
- package/dist/resources/agents/doc-writer.md +43 -0
- package/dist/resources/agents/git-ops.md +56 -0
- package/dist/resources/agents/javascript-pro.md +46 -271
- package/dist/resources/agents/planner.md +55 -0
- package/dist/resources/agents/refactorer.md +47 -0
- package/dist/resources/agents/reviewer.md +48 -0
- package/dist/resources/agents/security.md +59 -0
- package/dist/resources/agents/tester.md +50 -0
- package/dist/resources/agents/typescript-pro.md +41 -235
- package/dist/resources/extensions/async-jobs/await-tool.js +7 -4
- package/dist/resources/extensions/async-jobs/job-manager.js +28 -3
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +40 -12
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +142 -14
- package/dist/resources/extensions/gsd/auto/infra-errors.js +34 -0
- package/dist/resources/extensions/gsd/auto/loop.js +116 -2
- package/dist/resources/extensions/gsd/auto/phases.js +5 -1
- package/dist/resources/extensions/gsd/auto/session.js +11 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +22 -16
- package/dist/resources/extensions/gsd/auto-model-selection.js +10 -2
- package/dist/resources/extensions/gsd/auto-post-unit.js +6 -0
- package/dist/resources/extensions/gsd/auto-prompts.js +88 -33
- package/dist/resources/extensions/gsd/auto-recovery.js +11 -0
- package/dist/resources/extensions/gsd/auto-start.js +34 -7
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +1 -1
- package/dist/resources/extensions/gsd/auto-worktree.js +1 -1
- package/dist/resources/extensions/gsd/auto.js +81 -19
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +3 -3
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +11 -11
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +63 -51
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +6 -0
- package/dist/resources/extensions/gsd/commands/context.js +15 -6
- package/dist/resources/extensions/gsd/commands/dispatcher.js +12 -2
- package/dist/resources/extensions/gsd/commands/handlers/auto.js +10 -33
- package/dist/resources/extensions/gsd/commands/handlers/core.js +56 -11
- package/dist/resources/extensions/gsd/commands/handlers/notifications-handler.js +15 -6
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +4 -10
- package/dist/resources/extensions/gsd/commands-handlers.js +4 -1
- package/dist/resources/extensions/gsd/context-injector.js +1 -1
- package/dist/resources/extensions/gsd/custom-workflow-engine.js +3 -7
- package/dist/resources/extensions/gsd/dashboard-overlay.js +8 -3
- package/dist/resources/extensions/gsd/definition-io.js +15 -0
- package/dist/resources/extensions/gsd/dispatch-guard.js +22 -1
- package/dist/resources/extensions/gsd/doctor-providers.js +23 -0
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +6 -3
- package/dist/resources/extensions/gsd/error-classifier.js +5 -2
- package/dist/resources/extensions/gsd/forensics.js +19 -6
- package/dist/resources/extensions/gsd/gate-registry.js +208 -0
- package/dist/resources/extensions/gsd/git-service.js +11 -8
- package/dist/resources/extensions/gsd/gitignore.js +12 -6
- package/dist/resources/extensions/gsd/gsd-db.js +90 -6
- package/dist/resources/extensions/gsd/guided-flow.js +5 -10
- package/dist/resources/extensions/gsd/key-manager.js +2 -0
- package/dist/resources/extensions/gsd/metrics.js +1 -0
- package/dist/resources/extensions/gsd/milestone-actions.js +10 -4
- package/dist/resources/extensions/gsd/milestone-validation-gates.js +11 -12
- package/dist/resources/extensions/gsd/notification-overlay.js +42 -13
- package/dist/resources/extensions/gsd/notification-store.js +56 -5
- package/dist/resources/extensions/gsd/notification-widget.js +5 -13
- package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +8 -3
- package/dist/resources/extensions/gsd/pre-execution-checks.js +35 -2
- package/dist/resources/extensions/gsd/preferences-skills.js +2 -34
- package/dist/resources/extensions/gsd/preferences-types.js +15 -0
- package/dist/resources/extensions/gsd/preferences.js +16 -3
- package/dist/resources/extensions/gsd/prompt-loader.js +4 -1
- package/dist/resources/extensions/gsd/prompt-validation.js +126 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +5 -3
- package/dist/resources/extensions/gsd/prompts/discuss.md +123 -12
- package/dist/resources/extensions/gsd/prompts/execute-task.md +22 -19
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +2 -0
- package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/queue.md +3 -2
- package/dist/resources/extensions/gsd/prompts/system.md +1 -0
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +4 -1
- package/dist/resources/extensions/gsd/session-model-override.js +25 -0
- package/dist/resources/extensions/gsd/shortcut-defs.js +40 -0
- package/dist/resources/extensions/gsd/state.js +29 -2
- package/dist/resources/extensions/gsd/tools/complete-slice.js +52 -1
- package/dist/resources/extensions/gsd/tools/complete-task.js +51 -1
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +4 -1
- package/dist/resources/extensions/gsd/workflow-projections.js +7 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +30 -3
- package/dist/resources/extensions/gsd/write-intercept.js +10 -1
- package/dist/resources/extensions/ollama/index.js +17 -10
- package/dist/resources/extensions/ollama/ollama-client.js +35 -6
- package/dist/resources/extensions/ollama/ollama-discovery.js +32 -6
- package/dist/resources/extensions/shared/gsd-phase-state.js +35 -0
- package/dist/resources/extensions/subagent/agents.js +8 -0
- package/dist/resources/extensions/subagent/index.js +17 -0
- package/dist/resources/skills/create-skill/SKILL.md +2 -0
- package/dist/startup-model-validation.d.ts +0 -1
- package/dist/startup-model-validation.js +6 -2
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +15 -15
- 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/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page_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 +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- 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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +3 -3
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- 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 +4 -4
- 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 +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +15 -15
- package/dist/web/standalone/.next/server/chunks/2331.js +16 -16
- package/dist/web/standalone/.next/server/chunks/4741.js +12 -12
- package/dist/web/standalone/.next/server/chunks/5822.js +2 -2
- package/dist/web/standalone/.next/server/chunks/63.js +8 -8
- package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
- package/dist/web/standalone/.next/server/edge-runtime-webpack.js +2 -0
- package/dist/web/standalone/.next/server/functions-config-manifest.json +0 -9
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +29 -2
- package/dist/web/standalone/.next/server/middleware.js +4 -12
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/server/webpack-runtime.js +1 -1
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-f1e30ab6bb269149.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/mcp-server/dist/server.d.ts +12 -1
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +90 -42
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +22 -12
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/server.ts +110 -38
- package/packages/mcp-server/src/workflow-tools.test.ts +110 -0
- package/packages/mcp-server/src/workflow-tools.ts +32 -12
- package/packages/pi-ai/dist/env-api-keys.js +1 -0
- package/packages/pi-ai/dist/env-api-keys.js.map +1 -1
- package/packages/pi-ai/dist/models.custom.d.ts +105 -0
- package/packages/pi-ai/dist/models.custom.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.custom.js +97 -0
- package/packages/pi-ai/dist/models.custom.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +648 -140
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +867 -370
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.test.d.ts +2 -0
- package/packages/pi-ai/dist/models.generated.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/models.generated.test.js +334 -0
- package/packages/pi-ai/dist/models.generated.test.js.map +1 -0
- package/packages/pi-ai/dist/models.test.js +105 -0
- package/packages/pi-ai/dist/models.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +11 -2
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/anthropic-auth.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +20 -0
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +4 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +8 -3
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.test.js +44 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +2 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +7 -4
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +11 -0
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +1 -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/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js +5 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +57 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -0
- package/packages/pi-ai/src/env-api-keys.ts +1 -0
- package/packages/pi-ai/src/models.custom.ts +98 -0
- package/packages/pi-ai/src/models.generated.test.ts +373 -0
- package/packages/pi-ai/src/models.generated.ts +867 -370
- package/packages/pi-ai/src/models.test.ts +135 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +13 -1
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +32 -0
- package/packages/pi-ai/src/providers/anthropic-shared.test.ts +55 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +14 -3
- package/packages/pi-ai/src/providers/anthropic.ts +8 -4
- package/packages/pi-ai/src/providers/openai-completions.ts +14 -0
- package/packages/pi-ai/src/types.ts +1 -0
- package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +71 -0
- package/packages/pi-ai/src/utils/oauth/github-copilot.ts +4 -1
- package/packages/pi-coding-agent/dist/core/agent-session-renderable-tools.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-renderable-tools.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-renderable-tools.test.js +61 -0
- package/packages/pi-coding-agent/dist/core/agent-session-renderable-tools.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +2 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +10 -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 +27 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js +85 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver-initial-model-auth.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-resolver-initial-model-auth.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-resolver-initial-model-auth.test.js +64 -0
- package/packages/pi-coding-agent/dist/core/model-resolver-initial-model-auth.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +23 -18
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.test.d.ts +8 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.test.js +75 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +5 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.js +55 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js +57 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.d.ts +11 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +47 -5
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/sdk.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.test.js +71 -0
- package/packages/pi-coding-agent/dist/core/sdk.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/login-dialog.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/login-dialog.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/login-dialog.test.js +13 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/login-dialog.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +36 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +24 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +9 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +130 -12
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +7 -2
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js +6 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/model-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +4 -3
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +4 -2
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-renderable-tools.test.ts +70 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +2 -1
- package/packages/pi-coding-agent/src/core/auth-storage.test.ts +108 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +30 -0
- package/packages/pi-coding-agent/src/core/model-resolver-initial-model-auth.test.ts +78 -0
- package/packages/pi-coding-agent/src/core/model-resolver.test.ts +85 -0
- package/packages/pi-coding-agent/src/core/model-resolver.ts +23 -18
- package/packages/pi-coding-agent/src/core/retry-handler.test.ts +83 -0
- package/packages/pi-coding-agent/src/core/retry-handler.ts +60 -1
- package/packages/pi-coding-agent/src/core/sdk.test.ts +89 -0
- package/packages/pi-coding-agent/src/core/sdk.ts +55 -9
- package/packages/pi-coding-agent/src/index.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/login-dialog.test.ts +24 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +72 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +30 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +15 -6
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +131 -12
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +7 -2
- package/packages/pi-coding-agent/src/modes/interactive/controllers/model-controller.ts +6 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +4 -3
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +4 -2
- package/packages/pi-tui/dist/components/__tests__/editor.test.js +12 -0
- package/packages/pi-tui/dist/components/__tests__/editor.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/input.test.js +12 -0
- package/packages/pi-tui/dist/components/__tests__/input.test.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +27 -0
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/src/components/__tests__/editor.test.ts +18 -0
- package/packages/pi-tui/src/components/__tests__/input.test.ts +18 -0
- package/packages/pi-tui/src/keys.ts +32 -0
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +1 -1
- package/src/resources/agents/debugger.md +58 -0
- package/src/resources/agents/doc-writer.md +43 -0
- package/src/resources/agents/git-ops.md +56 -0
- package/src/resources/agents/javascript-pro.md +46 -271
- package/src/resources/agents/planner.md +55 -0
- package/src/resources/agents/refactorer.md +47 -0
- package/src/resources/agents/reviewer.md +48 -0
- package/src/resources/agents/security.md +59 -0
- package/src/resources/agents/tester.md +50 -0
- package/src/resources/agents/typescript-pro.md +41 -235
- package/src/resources/extensions/async-jobs/await-tool.test.ts +40 -7
- package/src/resources/extensions/async-jobs/await-tool.ts +7 -4
- package/src/resources/extensions/async-jobs/job-manager.ts +33 -3
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +45 -12
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +152 -13
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +91 -2
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +301 -6
- package/src/resources/extensions/gsd/auto/infra-errors.ts +38 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -0
- package/src/resources/extensions/gsd/auto/loop.ts +134 -2
- package/src/resources/extensions/gsd/auto/phases.ts +6 -0
- package/src/resources/extensions/gsd/auto/session.ts +11 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +29 -18
- package/src/resources/extensions/gsd/auto-model-selection.ts +9 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +7 -0
- package/src/resources/extensions/gsd/auto-prompts.ts +111 -33
- package/src/resources/extensions/gsd/auto-recovery.ts +10 -0
- package/src/resources/extensions/gsd/auto-start.ts +41 -7
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +1 -1
- package/src/resources/extensions/gsd/auto-worktree.ts +1 -1
- package/src/resources/extensions/gsd/auto.ts +97 -20
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +3 -3
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +10 -10
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +79 -60
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +7 -0
- package/src/resources/extensions/gsd/commands/context.ts +16 -5
- package/src/resources/extensions/gsd/commands/dispatcher.ts +14 -2
- package/src/resources/extensions/gsd/commands/handlers/auto.ts +10 -36
- package/src/resources/extensions/gsd/commands/handlers/core.ts +58 -11
- package/src/resources/extensions/gsd/commands/handlers/notifications-handler.ts +17 -7
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +4 -10
- package/src/resources/extensions/gsd/commands-handlers.ts +5 -1
- package/src/resources/extensions/gsd/context-injector.ts +1 -1
- package/src/resources/extensions/gsd/custom-workflow-engine.ts +4 -8
- package/src/resources/extensions/gsd/dashboard-overlay.ts +10 -3
- package/src/resources/extensions/gsd/definition-io.ts +18 -0
- package/src/resources/extensions/gsd/dispatch-guard.ts +23 -1
- package/src/resources/extensions/gsd/doctor-providers.ts +24 -0
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +6 -3
- package/src/resources/extensions/gsd/error-classifier.ts +5 -2
- package/src/resources/extensions/gsd/forensics.ts +23 -7
- package/src/resources/extensions/gsd/gate-registry.ts +251 -0
- package/src/resources/extensions/gsd/git-service.ts +11 -8
- package/src/resources/extensions/gsd/gitignore.ts +12 -6
- package/src/resources/extensions/gsd/gsd-db.ts +105 -6
- package/src/resources/extensions/gsd/guided-flow.ts +5 -10
- package/src/resources/extensions/gsd/interrupted-session.ts +1 -0
- package/src/resources/extensions/gsd/key-manager.ts +2 -0
- package/src/resources/extensions/gsd/metrics.ts +12 -1
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -3
- package/src/resources/extensions/gsd/milestone-validation-gates.ts +11 -13
- package/src/resources/extensions/gsd/notification-overlay.ts +47 -14
- package/src/resources/extensions/gsd/notification-store.ts +54 -5
- package/src/resources/extensions/gsd/notification-widget.ts +5 -14
- package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +10 -3
- package/src/resources/extensions/gsd/pre-execution-checks.ts +39 -2
- package/src/resources/extensions/gsd/preferences-skills.ts +2 -36
- package/src/resources/extensions/gsd/preferences-types.ts +16 -0
- package/src/resources/extensions/gsd/preferences.ts +19 -6
- package/src/resources/extensions/gsd/prompt-loader.ts +6 -1
- package/src/resources/extensions/gsd/prompt-validation.ts +157 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +5 -3
- package/src/resources/extensions/gsd/prompts/discuss.md +123 -12
- package/src/resources/extensions/gsd/prompts/execute-task.md +22 -19
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +2 -0
- package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/queue.md +3 -2
- package/src/resources/extensions/gsd/prompts/system.md +1 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +4 -1
- package/src/resources/extensions/gsd/session-model-override.ts +36 -0
- package/src/resources/extensions/gsd/shortcut-defs.ts +56 -0
- package/src/resources/extensions/gsd/state.ts +33 -2
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +25 -9
- package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +28 -0
- package/src/resources/extensions/gsd/tests/block-db-writes.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/complete-slice-gate-closure.test.ts +167 -0
- package/src/resources/extensions/gsd/tests/complete-slice-prompt-task-summary-layout.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/definition-io.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/doctor-heal-fixable-warnings.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/execute-task-prompt-existing-artifact-guard.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +104 -0
- package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/format-shortcut.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/gate-dispatch.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/gate-registry.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +107 -5
- package/src/resources/extensions/gsd/tests/gsd-no-project-error.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/infra-errors-cooldown.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +66 -1
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +8 -6
- package/src/resources/extensions/gsd/tests/key-manager.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/model-isolation.test.ts +36 -51
- package/src/resources/extensions/gsd/tests/notification-store.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/notification-widget.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/notifications-handler.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/parallel-monitor-overlay.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-artifact-verification.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/preferences-formatting.test.ts +87 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/projection-regression.test.ts +96 -1
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/prompt-loader-working-directory.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/prompt-system-gate-coverage.test.ts +208 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +97 -0
- package/src/resources/extensions/gsd/tests/register-shortcuts.test.ts +63 -5
- package/src/resources/extensions/gsd/tests/session-model-override.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/stale-slice-rows.test.ts +41 -0
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +90 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/validate-milestone-prompt-verification-classes.test.ts +18 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +63 -0
- package/src/resources/extensions/gsd/tools/complete-task.ts +63 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +4 -1
- package/src/resources/extensions/gsd/types.ts +26 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +8 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +29 -3
- package/src/resources/extensions/gsd/write-intercept.ts +10 -1
- package/src/resources/extensions/ollama/index.ts +17 -8
- package/src/resources/extensions/ollama/ollama-client.ts +35 -6
- package/src/resources/extensions/ollama/ollama-discovery.ts +37 -6
- package/src/resources/extensions/ollama/ollama-status-indicator.test.ts +28 -0
- package/src/resources/extensions/ollama/tests/ollama-discovery.test.ts +54 -0
- package/src/resources/extensions/shared/gsd-phase-state.ts +42 -0
- package/src/resources/extensions/shared/tests/gsd-phase-state.test.ts +48 -0
- package/src/resources/extensions/subagent/agents.ts +10 -0
- package/src/resources/extensions/subagent/index.ts +18 -0
- package/src/resources/extensions/subagent/tests/agents-conflicts.test.ts +33 -0
- package/src/resources/skills/create-skill/SKILL.md +2 -0
- package/dist/web/standalone/.next/static/chunks/app/page-7115e62689b5fd84.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
- /package/dist/web/standalone/.next/static/{nPky_WQC28aBD77eZsRAB → NzO79SOz9jHX-VY5-0t2O}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{nPky_WQC28aBD77eZsRAB → NzO79SOz9jHX-VY5-0t2O}/_ssgManifest.js +0 -0
|
@@ -15,7 +15,8 @@ import { getLoadedSkills } from "@gsd/pi-coding-agent";
|
|
|
15
15
|
import { join, basename } from "node:path";
|
|
16
16
|
import { existsSync } from "node:fs";
|
|
17
17
|
import { computeBudgets, resolveExecutorContextWindow, truncateAtSectionBoundary } from "./context-budget.js";
|
|
18
|
-
import {
|
|
18
|
+
import { getPendingGatesForTurn } from "./gsd-db.js";
|
|
19
|
+
import { assertGateCoverage, getGatesForTurn, } from "./gate-registry.js";
|
|
19
20
|
import { formatDecisionsCompact, formatRequirementsCompact } from "./structured-data-formatter.js";
|
|
20
21
|
import { readPhaseAnchor, formatAnchorForPrompt } from "./phase-anchor.js";
|
|
21
22
|
import { logWarning } from "./workflow-logger.js";
|
|
@@ -1221,6 +1222,13 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
1221
1222
|
? `### Runtime Context\nSource: \`.gsd/RUNTIME.md\`\n\n${runtimeContent.trim()}`
|
|
1222
1223
|
: "";
|
|
1223
1224
|
const phaseAnchorSection = planAnchor ? formatAnchorForPrompt(planAnchor) : "";
|
|
1225
|
+
// Task-scoped gates owned by execute-task (Q5/Q6/Q7). Pull only the
|
|
1226
|
+
// gates that plan-slice actually seeded for this task — tasks with no
|
|
1227
|
+
// external dependencies legitimately skip Q5, tasks with no runtime
|
|
1228
|
+
// load dimension skip Q6, etc.
|
|
1229
|
+
const etPending = getPendingGatesForTurn(mid, sid, "execute-task", tid);
|
|
1230
|
+
assertGateCoverage(etPending, "execute-task", { requireAll: false });
|
|
1231
|
+
const gatesToClose = renderGatesToCloseBlock(getGatesForTurn("execute-task"), { pending: new Set(etPending.map((g) => g.gate_id)), allowOmit: true });
|
|
1224
1232
|
return loadPrompt("execute-task", {
|
|
1225
1233
|
overridesSection,
|
|
1226
1234
|
runtimeContext,
|
|
@@ -1238,6 +1246,7 @@ export async function buildExecuteTaskPrompt(mid, sid, sTitle, tid, tTitle, base
|
|
|
1238
1246
|
taskSummaryPath,
|
|
1239
1247
|
inlinedTemplates,
|
|
1240
1248
|
verificationBudget,
|
|
1249
|
+
gatesToClose,
|
|
1241
1250
|
skillActivation: buildSkillActivationBlock({
|
|
1242
1251
|
base,
|
|
1243
1252
|
milestoneId: mid,
|
|
@@ -1298,6 +1307,15 @@ export async function buildCompleteSlicePrompt(mid, _midTitle, sid, sTitle, base
|
|
|
1298
1307
|
const sliceRel = relSlicePath(base, mid, sid);
|
|
1299
1308
|
const sliceSummaryPath = join(base, `${sliceRel}/${sid}-SUMMARY.md`);
|
|
1300
1309
|
const sliceUatPath = join(base, `${sliceRel}/${sid}-UAT.md`);
|
|
1310
|
+
// Gates owned by complete-slice (e.g. Q8). Pull from the DB so the
|
|
1311
|
+
// prompt only prompts for gates the plan actually seeded. The tool
|
|
1312
|
+
// handler closes each gate based on the SUMMARY.md section content
|
|
1313
|
+
// after the assistant calls gsd_complete_slice.
|
|
1314
|
+
const csPending = getPendingGatesForTurn(mid, sid, "complete-slice");
|
|
1315
|
+
// coverage check: every pending row must be owned by complete-slice.
|
|
1316
|
+
// requireAll:false because a slice may have already closed some gates.
|
|
1317
|
+
assertGateCoverage(csPending, "complete-slice", { requireAll: false });
|
|
1318
|
+
const gatesToClose = renderGatesToCloseBlock(getGatesForTurn("complete-slice"), { pending: new Set(csPending.map((g) => g.gate_id)), allowOmit: true });
|
|
1301
1319
|
return loadPrompt("complete-slice", {
|
|
1302
1320
|
workingDirectory: base,
|
|
1303
1321
|
milestoneId: mid, sliceId: sid, sliceTitle: sTitle,
|
|
@@ -1306,6 +1324,7 @@ export async function buildCompleteSlicePrompt(mid, _midTitle, sid, sTitle, base
|
|
|
1306
1324
|
inlinedContext,
|
|
1307
1325
|
sliceSummaryPath,
|
|
1308
1326
|
sliceUatPath,
|
|
1327
|
+
gatesToClose,
|
|
1309
1328
|
});
|
|
1310
1329
|
}
|
|
1311
1330
|
export async function buildCompleteMilestonePrompt(mid, midTitle, base, level) {
|
|
@@ -1498,6 +1517,15 @@ export async function buildValidateMilestonePrompt(mid, midTitle, base, level) {
|
|
|
1498
1517
|
const inlinedContext = capPreamble(`## Inlined Context (preloaded — do not re-read these files)\n\n${inlined.join("\n\n---\n\n")}`);
|
|
1499
1518
|
const validationOutputPath = join(base, `${relMilestonePath(base, mid)}/${mid}-VALIDATION.md`);
|
|
1500
1519
|
const roadmapOutputPath = `${relMilestonePath(base, mid)}/${mid}-ROADMAP.md`;
|
|
1520
|
+
// Every milestone validation turn owns MV01–MV04 unconditionally: the
|
|
1521
|
+
// registry is the source of truth for which gates the validator must
|
|
1522
|
+
// address, and the block below is what the template renders so the
|
|
1523
|
+
// assistant can never accidentally skip one.
|
|
1524
|
+
const mvGates = getGatesForTurn("validate-milestone");
|
|
1525
|
+
const gatesToEvaluate = renderGatesToCloseBlock(mvGates, {
|
|
1526
|
+
pending: new Set(mvGates.map((g) => g.id)),
|
|
1527
|
+
allowOmit: false,
|
|
1528
|
+
});
|
|
1501
1529
|
return loadPrompt("validate-milestone", {
|
|
1502
1530
|
workingDirectory: base,
|
|
1503
1531
|
milestoneId: mid,
|
|
@@ -1506,6 +1534,7 @@ export async function buildValidateMilestonePrompt(mid, midTitle, base, level) {
|
|
|
1506
1534
|
inlinedContext,
|
|
1507
1535
|
validationPath: validationOutputPath,
|
|
1508
1536
|
remediationRound: String(remediationRound),
|
|
1537
|
+
gatesToEvaluate,
|
|
1509
1538
|
skillActivation: buildSkillActivationBlock({
|
|
1510
1539
|
base,
|
|
1511
1540
|
milestoneId: mid,
|
|
@@ -1740,26 +1769,43 @@ export async function buildReactiveExecutePrompt(mid, midTitle, sid, sTitle, rea
|
|
|
1740
1769
|
});
|
|
1741
1770
|
}
|
|
1742
1771
|
// ─── Gate Evaluation ──────────────────────────────────────────────────────
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1772
|
+
//
|
|
1773
|
+
// Gate definitions (question, guidance, owner turn) now live in
|
|
1774
|
+
// gate-registry.ts so that prompt builders, dispatch rules, state
|
|
1775
|
+
// derivation, and tool handlers all consult the same source of truth.
|
|
1776
|
+
// See gate-registry.ts for the full ownership map.
|
|
1777
|
+
/**
|
|
1778
|
+
* Render a "Gates to Close" block for turns like `complete-slice` and
|
|
1779
|
+
* `validate-milestone` that own gates which are closed as a side-effect
|
|
1780
|
+
* of writing artifact sections (not via a dedicated gate-evaluate
|
|
1781
|
+
* subagent loop).
|
|
1782
|
+
*
|
|
1783
|
+
* Returns a plain-text block or an empty string if there are no gates to
|
|
1784
|
+
* close, so callers can drop it straight into a template variable.
|
|
1785
|
+
*/
|
|
1786
|
+
function renderGatesToCloseBlock(gates, opts) {
|
|
1787
|
+
const applicable = gates.filter((g) => opts.pending.has(g.id));
|
|
1788
|
+
if (applicable.length === 0)
|
|
1789
|
+
return "";
|
|
1790
|
+
const lines = [];
|
|
1791
|
+
lines.push("## Gates to Close");
|
|
1792
|
+
lines.push("");
|
|
1793
|
+
lines.push("These quality gates are still pending for this unit. You MUST address every one before calling the closing tool — the handler closes the DB row based on whether the corresponding artifact section is present.");
|
|
1794
|
+
lines.push("");
|
|
1795
|
+
for (const def of applicable) {
|
|
1796
|
+
lines.push(`### ${def.id} — ${def.promptSection}`);
|
|
1797
|
+
lines.push("");
|
|
1798
|
+
lines.push(`**Question:** ${def.question}`);
|
|
1799
|
+
lines.push("");
|
|
1800
|
+
lines.push(def.guidance);
|
|
1801
|
+
if (opts.allowOmit) {
|
|
1802
|
+
lines.push("");
|
|
1803
|
+
lines.push(`If this gate genuinely does not apply to this unit, leave the **${def.promptSection}** section empty and the handler will record it as \`omitted\`. Otherwise, fill the section with concrete evidence.`);
|
|
1804
|
+
}
|
|
1805
|
+
lines.push("");
|
|
1806
|
+
}
|
|
1807
|
+
return lines.join("\n").trimEnd();
|
|
1808
|
+
}
|
|
1763
1809
|
export async function buildParallelResearchSlicesPrompt(mid, midTitle, slices, basePath) {
|
|
1764
1810
|
// Build individual research-slice prompts for each slice
|
|
1765
1811
|
const subagentSections = [];
|
|
@@ -1784,24 +1830,33 @@ export async function buildParallelResearchSlicesPrompt(mid, midTitle, slices, b
|
|
|
1784
1830
|
});
|
|
1785
1831
|
}
|
|
1786
1832
|
export async function buildGateEvaluatePrompt(mid, midTitle, sid, sTitle, base) {
|
|
1787
|
-
|
|
1833
|
+
// Pull only the gates this turn actually owns (Q3/Q4). Filter via the
|
|
1834
|
+
// registry so that scope:"slice" gates owned by other turns (Q8) can't
|
|
1835
|
+
// leak into this prompt and can't block dispatch via silent skip.
|
|
1836
|
+
const pending = getPendingGatesForTurn(mid, sid, "gate-evaluate");
|
|
1837
|
+
// Fails loudly if the pending list contains a gate id the registry
|
|
1838
|
+
// doesn't own for this turn. Missing owned gates is allowed here —
|
|
1839
|
+
// `gate-evaluate` is dispatched whenever *any* of its owned gates are
|
|
1840
|
+
// pending, not only when all of them are.
|
|
1841
|
+
assertGateCoverage(pending, "gate-evaluate", { requireAll: false });
|
|
1788
1842
|
// Load the slice plan for context
|
|
1789
1843
|
const planFile = resolveSliceFile(base, mid, sid, "PLAN");
|
|
1790
1844
|
const planContent = planFile ? (await loadFile(planFile)) ?? "(plan file empty)" : "(plan file not found)";
|
|
1791
|
-
// Build per-gate subagent prompts
|
|
1845
|
+
// Build per-gate subagent prompts from the pending rows. Because the
|
|
1846
|
+
// registry has already validated every row, `getGateDefinition` cannot
|
|
1847
|
+
// return undefined here.
|
|
1848
|
+
const pendingIds = new Set(pending.map((g) => g.gate_id));
|
|
1849
|
+
const gateDefs = getGatesForTurn("gate-evaluate").filter((def) => pendingIds.has(def.id));
|
|
1792
1850
|
const subagentSections = [];
|
|
1793
1851
|
const gateListLines = [];
|
|
1794
|
-
for (const
|
|
1795
|
-
|
|
1796
|
-
if (!meta)
|
|
1797
|
-
continue;
|
|
1798
|
-
gateListLines.push(`- **${gate.gate_id}**: ${meta.question}`);
|
|
1852
|
+
for (const def of gateDefs) {
|
|
1853
|
+
gateListLines.push(`- **${def.id}**: ${def.question}`);
|
|
1799
1854
|
const subPrompt = [
|
|
1800
|
-
`You are evaluating quality gate **${
|
|
1855
|
+
`You are evaluating quality gate **${def.id}** for slice ${sid} (${sTitle}).`,
|
|
1801
1856
|
"",
|
|
1802
|
-
`## Question: ${
|
|
1857
|
+
`## Question: ${def.question}`,
|
|
1803
1858
|
"",
|
|
1804
|
-
|
|
1859
|
+
def.guidance,
|
|
1805
1860
|
"",
|
|
1806
1861
|
"## Slice Plan",
|
|
1807
1862
|
"",
|
|
@@ -1813,13 +1868,13 @@ export async function buildGateEvaluatePrompt(mid, midTitle, sid, sTitle, base)
|
|
|
1813
1868
|
`Call the \`gsd_save_gate_result\` tool with:`,
|
|
1814
1869
|
`- \`milestoneId\`: "${mid}"`,
|
|
1815
1870
|
`- \`sliceId\`: "${sid}"`,
|
|
1816
|
-
`- \`gateId\`: "${
|
|
1871
|
+
`- \`gateId\`: "${def.id}"`,
|
|
1817
1872
|
"- `verdict`: \"pass\" (no concerns), \"flag\" (concerns found), or \"omitted\" (not applicable)",
|
|
1818
1873
|
"- `rationale`: one-sentence justification",
|
|
1819
1874
|
"- `findings`: detailed markdown findings (or empty if omitted)",
|
|
1820
1875
|
].join("\n");
|
|
1821
1876
|
subagentSections.push([
|
|
1822
|
-
`### ${
|
|
1877
|
+
`### ${def.id}: ${def.question}`,
|
|
1823
1878
|
"",
|
|
1824
1879
|
"Use this as the prompt for a `subagent` call:",
|
|
1825
1880
|
"",
|
|
@@ -224,6 +224,17 @@ export function verifyExpectedArtifact(unitType, unitId, base) {
|
|
|
224
224
|
if (!isValidationTerminal(validationContent))
|
|
225
225
|
return false;
|
|
226
226
|
}
|
|
227
|
+
if (unitType === "plan-milestone") {
|
|
228
|
+
try {
|
|
229
|
+
const roadmap = parseLegacyRoadmap(readFileSync(absPath, "utf-8"));
|
|
230
|
+
if (roadmap.slices.length === 0)
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
logWarning("recovery", `plan-milestone roadmap verification failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
227
238
|
// plan-slice must produce a plan with actual task entries, not just a scaffold.
|
|
228
239
|
// The plan file may exist from a prior discussion/context step with only headings
|
|
229
240
|
// but no tasks. Without this check the artifact is considered "complete" and the
|
|
@@ -39,6 +39,7 @@ import { join } from "node:path";
|
|
|
39
39
|
import { sep as pathSep } from "node:path";
|
|
40
40
|
import { resolveProjectRootDbPath } from "./bootstrap/dynamic-tools.js";
|
|
41
41
|
import { resolveDefaultSessionModel, resolveDynamicRoutingConfig } from "./preferences-models.js";
|
|
42
|
+
import { getSessionModelOverride } from "./session-model-override.js";
|
|
42
43
|
/**
|
|
43
44
|
* Bootstrap a fresh auto-mode session. Handles everything from git init
|
|
44
45
|
* through secrets collection, returning when ready for the first
|
|
@@ -187,13 +188,35 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
187
188
|
// Capture the user's session model before guided-flow dispatch can apply a
|
|
188
189
|
// phase-specific planning model for a discuss turn (#2829).
|
|
189
190
|
//
|
|
190
|
-
//
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
//
|
|
191
|
+
// Precedence:
|
|
192
|
+
// 1) Explicit session override via /gsd model (this session)
|
|
193
|
+
// 2) GSD model preferences from PREFERENCES.md (validated against live auth)
|
|
194
|
+
// 3) Current session model from settings/session restore (if provider ready)
|
|
195
|
+
//
|
|
196
|
+
// This preserves #3517 defaults while honoring explicit runtime model
|
|
197
|
+
// selection for subsequent /gsd runs in the same session.
|
|
198
|
+
const manualSessionOverride = getSessionModelOverride(ctx.sessionManager.getSessionId());
|
|
194
199
|
const preferredModel = resolveDefaultSessionModel(ctx.model?.provider);
|
|
195
|
-
|
|
196
|
-
|
|
200
|
+
// Validate the preferred model against the live registry + provider auth so
|
|
201
|
+
// an unconfigured PREFERENCES.md entry (no API key / OAuth) can't become the
|
|
202
|
+
// start-model snapshot. Without this, every subsequent unit would try to
|
|
203
|
+
// fall back to an unusable model.
|
|
204
|
+
let validatedPreferredModel;
|
|
205
|
+
if (preferredModel) {
|
|
206
|
+
const { resolveModelId } = await import("./auto-model-selection.js");
|
|
207
|
+
const available = ctx.modelRegistry.getAvailable();
|
|
208
|
+
const match = resolveModelId(`${preferredModel.provider}/${preferredModel.id}`, available, ctx.model?.provider);
|
|
209
|
+
if (match) {
|
|
210
|
+
validatedPreferredModel = { provider: match.provider, id: match.id };
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
ctx.ui.notify(`Preferred model ${preferredModel.provider}/${preferredModel.id} from PREFERENCES.md is not configured; falling back to session default.`, "warning");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const sessionModelReady = ctx.model && ctx.modelRegistry.isProviderRequestReady(ctx.model.provider);
|
|
217
|
+
const startModelSnapshot = manualSessionOverride
|
|
218
|
+
?? validatedPreferredModel
|
|
219
|
+
?? (sessionModelReady && ctx.model
|
|
197
220
|
? { provider: ctx.model.provider, id: ctx.model.id }
|
|
198
221
|
: null);
|
|
199
222
|
try {
|
|
@@ -447,6 +470,9 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
447
470
|
// Successfully resolved an active milestone — reset the re-entry guard
|
|
448
471
|
s.consecutiveCompleteBootstraps = 0;
|
|
449
472
|
// ── Initialize session state ──
|
|
473
|
+
// Notify shared phase state so subagent conflict checks can fire
|
|
474
|
+
const { activateGSD: activateGSDPhaseState } = await import("../shared/gsd-phase-state.js");
|
|
475
|
+
activateGSDPhaseState();
|
|
450
476
|
s.active = true;
|
|
451
477
|
s.stepMode = requestedStepMode;
|
|
452
478
|
s.verbose = verboseMode;
|
|
@@ -523,7 +549,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
523
549
|
}
|
|
524
550
|
}
|
|
525
551
|
// ── DB lifecycle ──
|
|
526
|
-
const gsdDbPath =
|
|
552
|
+
const gsdDbPath = resolveProjectRootDbPath(s.basePath);
|
|
527
553
|
const gsdDirPath = join(s.basePath, ".gsd");
|
|
528
554
|
if (existsSync(gsdDirPath) && !existsSync(gsdDbPath)) {
|
|
529
555
|
const hasDecisions = existsSync(join(gsdDirPath, "DECISIONS.md"));
|
|
@@ -571,6 +597,7 @@ export async function bootstrapAutoSession(s, ctx, pi, base, verboseMode, reques
|
|
|
571
597
|
id: startModelSnapshot.id,
|
|
572
598
|
};
|
|
573
599
|
}
|
|
600
|
+
s.manualSessionModelOverride = manualSessionOverride ?? null;
|
|
574
601
|
// Apply worker model override from parallel orchestrator (#worker-model).
|
|
575
602
|
// GSD_WORKER_MODEL is injected by the coordinator when parallel.worker_model
|
|
576
603
|
// is configured, so parallel milestone workers use a cheaper model than the
|
|
@@ -82,7 +82,7 @@ export function clearInFlightTools() {
|
|
|
82
82
|
* handler. When these errors occur, retrying the same unit will produce the same
|
|
83
83
|
* failure, so the retry loop must be broken.
|
|
84
84
|
*/
|
|
85
|
-
const TOOL_INVOCATION_ERROR_RE = /Validation failed for tool|Expected ',' or '\}' in JSON
|
|
85
|
+
const TOOL_INVOCATION_ERROR_RE = /Validation failed for tool|Expected ',' or '\}'(?: after property value)?(?: in JSON)?|Unexpected end of JSON|Unexpected token.*in JSON/i;
|
|
86
86
|
/**
|
|
87
87
|
* Returns true if the error message indicates a tool invocation failure due to
|
|
88
88
|
* malformed/truncated arguments (as opposed to a normal tool execution error).
|
|
@@ -1795,7 +1795,7 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1795
1795
|
// 12. Remove worktree directory first (must happen before branch deletion)
|
|
1796
1796
|
try {
|
|
1797
1797
|
removeWorktree(originalBasePath_, milestoneId, {
|
|
1798
|
-
branch:
|
|
1798
|
+
branch: milestoneBranch,
|
|
1799
1799
|
deleteBranch: false,
|
|
1800
1800
|
});
|
|
1801
1801
|
}
|
|
@@ -34,6 +34,7 @@ import { preDispatchHealthGate, resetProactiveHealing, setLevelChangeCallback, }
|
|
|
34
34
|
import { clearSkillSnapshot } from "./skill-discovery.js";
|
|
35
35
|
import { captureAvailableSkills, resetSkillTelemetry, } from "./skill-telemetry.js";
|
|
36
36
|
import { getRtkSessionSavings } from "../shared/rtk-session-stats.js";
|
|
37
|
+
import { deactivateGSD } from "../shared/gsd-phase-state.js";
|
|
37
38
|
import { initMetrics, resetMetrics, getLedger, getProjectTotals, formatCost, formatTokenCount, } from "./metrics.js";
|
|
38
39
|
import { logWarning } from "./workflow-logger.js";
|
|
39
40
|
import { homedir } from "node:os";
|
|
@@ -49,6 +50,7 @@ import { pruneQueueOrder } from "./queue-order.js";
|
|
|
49
50
|
import { debugLog, isDebugEnabled, writeDebugSummary } from "./debug-logger.js";
|
|
50
51
|
import { reconcileMergeState, } from "./auto-recovery.js";
|
|
51
52
|
import { resolveDispatch, DISPATCH_RULES } from "./auto-dispatch.js";
|
|
53
|
+
import { getErrorMessage } from "./error-utils.js";
|
|
52
54
|
import { initRegistry, convertDispatchRules } from "./rule-registry.js";
|
|
53
55
|
import { emitJournalEvent as _emitJournalEvent } from "./journal.js";
|
|
54
56
|
import { updateProgressWidget as _updateProgressWidget, updateSliceProgressCache, clearSliceProgressCache, hideFooter, } from "./auto-dashboard.js";
|
|
@@ -103,6 +105,40 @@ function restoreProjectRootEnv() {
|
|
|
103
105
|
s.hadProjectRootEnv = false;
|
|
104
106
|
s.projectRootEnvCaptured = false;
|
|
105
107
|
}
|
|
108
|
+
function captureMilestoneLockEnv(milestoneId) {
|
|
109
|
+
if (!s.milestoneLockEnvCaptured) {
|
|
110
|
+
s.hadMilestoneLockEnv = Object.prototype.hasOwnProperty.call(process.env, "GSD_MILESTONE_LOCK");
|
|
111
|
+
s.previousMilestoneLockEnv = process.env.GSD_MILESTONE_LOCK ?? null;
|
|
112
|
+
s.milestoneLockEnvCaptured = true;
|
|
113
|
+
}
|
|
114
|
+
if (milestoneId) {
|
|
115
|
+
process.env.GSD_MILESTONE_LOCK = milestoneId;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
delete process.env.GSD_MILESTONE_LOCK;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function restoreMilestoneLockEnv() {
|
|
122
|
+
if (!s.milestoneLockEnvCaptured)
|
|
123
|
+
return;
|
|
124
|
+
if (s.hadMilestoneLockEnv && s.previousMilestoneLockEnv !== null) {
|
|
125
|
+
process.env.GSD_MILESTONE_LOCK = s.previousMilestoneLockEnv;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
delete process.env.GSD_MILESTONE_LOCK;
|
|
129
|
+
}
|
|
130
|
+
s.previousMilestoneLockEnv = null;
|
|
131
|
+
s.hadMilestoneLockEnv = false;
|
|
132
|
+
s.milestoneLockEnvCaptured = false;
|
|
133
|
+
}
|
|
134
|
+
export function startAutoDetached(ctx, pi, base, verboseMode, options) {
|
|
135
|
+
void startAuto(ctx, pi, base, verboseMode, options).catch((err) => {
|
|
136
|
+
const message = getErrorMessage(err);
|
|
137
|
+
ctx.ui.notify(`Auto-start failed: ${message}`, "error");
|
|
138
|
+
logWarning("engine", `auto start error: ${message}`, { file: "auto.ts" });
|
|
139
|
+
debugLog("auto-start-failed", { error: message });
|
|
140
|
+
});
|
|
141
|
+
}
|
|
106
142
|
export function shouldUseWorktreeIsolation() {
|
|
107
143
|
const prefs = loadEffectiveGSDPreferences()?.preferences?.git;
|
|
108
144
|
if (prefs?.isolation === "worktree")
|
|
@@ -324,6 +360,7 @@ function clearUnitTimeout() {
|
|
|
324
360
|
/** Build snapshot metric opts. */
|
|
325
361
|
function buildSnapshotOpts(_unitType, _unitId) {
|
|
326
362
|
return {
|
|
363
|
+
...(s.autoStartTime > 0 ? { autoSessionKey: String(s.autoStartTime) } : {}),
|
|
327
364
|
promptCharCount: s.lastPromptCharCount,
|
|
328
365
|
baselineCharCount: s.lastBaselineCharCount,
|
|
329
366
|
...(s.currentUnitRouting ?? {}),
|
|
@@ -338,8 +375,10 @@ function handleLostSessionLock(ctx, lockStatus) {
|
|
|
338
375
|
});
|
|
339
376
|
s.active = false;
|
|
340
377
|
s.paused = false;
|
|
378
|
+
deactivateGSD();
|
|
341
379
|
clearUnitTimeout();
|
|
342
380
|
restoreProjectRootEnv();
|
|
381
|
+
restoreMilestoneLockEnv();
|
|
343
382
|
deregisterSigtermHandler();
|
|
344
383
|
clearCmuxSidebar(loadEffectiveGSDPreferences()?.preferences);
|
|
345
384
|
const base = lockBase();
|
|
@@ -369,8 +408,10 @@ function handleLostSessionLock(ctx, lockStatus) {
|
|
|
369
408
|
function cleanupAfterLoopExit(ctx) {
|
|
370
409
|
s.currentUnit = null;
|
|
371
410
|
s.active = false;
|
|
411
|
+
deactivateGSD();
|
|
372
412
|
clearUnitTimeout();
|
|
373
413
|
restoreProjectRootEnv();
|
|
414
|
+
restoreMilestoneLockEnv();
|
|
374
415
|
// Clear crash lock and release session lock so the next `/gsd next` does
|
|
375
416
|
// not see a stale lock with the current PID and treat it as a "remote"
|
|
376
417
|
// session (which would cause it to SIGTERM itself). (#2730)
|
|
@@ -384,9 +425,13 @@ function cleanupAfterLoopExit(ctx) {
|
|
|
384
425
|
/* best-effort — mirror stopAuto cleanup */
|
|
385
426
|
logWarning("session", `lock cleanup failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
386
427
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
428
|
+
// A transient provider-error pause intentionally leaves the paused badge
|
|
429
|
+
// visible so the user still has a resumable auto-mode signal on screen.
|
|
430
|
+
if (!s.paused) {
|
|
431
|
+
ctx.ui.setStatus("gsd-auto", undefined);
|
|
432
|
+
ctx.ui.setWidget("gsd-progress", undefined);
|
|
433
|
+
ctx.ui.setFooter(undefined);
|
|
434
|
+
}
|
|
390
435
|
// Restore CWD out of worktree back to original project root
|
|
391
436
|
if (s.originalBasePath) {
|
|
392
437
|
s.basePath = s.originalBasePath;
|
|
@@ -488,7 +533,22 @@ export async function stopAuto(ctx, pi, reason) {
|
|
|
488
533
|
catch (e) {
|
|
489
534
|
debugLog("stop-cleanup-worktree", { error: e instanceof Error ? e.message : String(e) });
|
|
490
535
|
}
|
|
491
|
-
// ── Step 5: DB
|
|
536
|
+
// ── Step 5: Rebuild state while DB is still open (#3599) ──
|
|
537
|
+
// rebuildState() calls deriveState() which needs the DB for authoritative
|
|
538
|
+
// state. Previously this ran after closeDatabase(), forcing a filesystem
|
|
539
|
+
// fallback that could disagree with the DB-backed dispatch decisions —
|
|
540
|
+
// a split-brain where dispatch says "blocked" but STATE.md shows work.
|
|
541
|
+
if (s.basePath) {
|
|
542
|
+
try {
|
|
543
|
+
await rebuildState(s.basePath);
|
|
544
|
+
}
|
|
545
|
+
catch (e) {
|
|
546
|
+
debugLog("stop-rebuild-state-failed", {
|
|
547
|
+
error: e instanceof Error ? e.message : String(e),
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
// ── Step 6: DB cleanup ──
|
|
492
552
|
if (isDbAvailable()) {
|
|
493
553
|
try {
|
|
494
554
|
const { closeDatabase } = await import("./gsd-db.js");
|
|
@@ -500,7 +560,7 @@ export async function stopAuto(ctx, pi, reason) {
|
|
|
500
560
|
});
|
|
501
561
|
}
|
|
502
562
|
}
|
|
503
|
-
// ── Step
|
|
563
|
+
// ── Step 7: Restore basePath and chdir ──
|
|
504
564
|
try {
|
|
505
565
|
if (s.originalBasePath) {
|
|
506
566
|
s.basePath = s.originalBasePath;
|
|
@@ -516,7 +576,7 @@ export async function stopAuto(ctx, pi, reason) {
|
|
|
516
576
|
catch (e) {
|
|
517
577
|
debugLog("stop-cleanup-basepath", { error: e instanceof Error ? e.message : String(e) });
|
|
518
578
|
}
|
|
519
|
-
// ── Step
|
|
579
|
+
// ── Step 8: Ledger notification ──
|
|
520
580
|
try {
|
|
521
581
|
const ledger = getLedger();
|
|
522
582
|
if (ledger && ledger.units.length > 0) {
|
|
@@ -530,17 +590,6 @@ export async function stopAuto(ctx, pi, reason) {
|
|
|
530
590
|
catch (e) {
|
|
531
591
|
debugLog("stop-cleanup-ledger", { error: e instanceof Error ? e.message : String(e) });
|
|
532
592
|
}
|
|
533
|
-
// ── Step 8: Rebuild state ──
|
|
534
|
-
if (s.basePath) {
|
|
535
|
-
try {
|
|
536
|
-
await rebuildState(s.basePath);
|
|
537
|
-
}
|
|
538
|
-
catch (e) {
|
|
539
|
-
debugLog("stop-rebuild-state-failed", {
|
|
540
|
-
error: e instanceof Error ? e.message : String(e),
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
593
|
// ── Step 9: Cmux sidebar / event log ──
|
|
545
594
|
try {
|
|
546
595
|
clearCmuxSidebar(loadedPreferences);
|
|
@@ -628,6 +677,7 @@ export async function stopAuto(ctx, pi, reason) {
|
|
|
628
677
|
ctx?.ui.setWidget("gsd-progress", undefined);
|
|
629
678
|
ctx?.ui.setFooter(undefined);
|
|
630
679
|
restoreProjectRootEnv();
|
|
680
|
+
restoreMilestoneLockEnv();
|
|
631
681
|
// Reset all session state in one call
|
|
632
682
|
s.reset();
|
|
633
683
|
}
|
|
@@ -673,6 +723,7 @@ export async function pauseAuto(ctx, _pi, _errorContext) {
|
|
|
673
723
|
activeEngineId: s.activeEngineId,
|
|
674
724
|
activeRunDir: s.activeRunDir,
|
|
675
725
|
autoStartTime: s.autoStartTime,
|
|
726
|
+
milestoneLock: s.sessionMilestoneLock ?? undefined,
|
|
676
727
|
};
|
|
677
728
|
const runtimeDir = join(gsdRoot(s.originalBasePath || s.basePath), "runtime");
|
|
678
729
|
mkdirSync(runtimeDir, { recursive: true });
|
|
@@ -703,7 +754,9 @@ export async function pauseAuto(ctx, _pi, _errorContext) {
|
|
|
703
754
|
_resetPendingResolve();
|
|
704
755
|
s.active = false;
|
|
705
756
|
s.paused = true;
|
|
757
|
+
deactivateGSD();
|
|
706
758
|
restoreProjectRootEnv();
|
|
759
|
+
restoreMilestoneLockEnv();
|
|
707
760
|
s.pendingVerificationRetry = null;
|
|
708
761
|
s.verificationRetryCount.clear();
|
|
709
762
|
ctx?.ui.setStatus("gsd-auto", "paused");
|
|
@@ -859,6 +912,12 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
859
912
|
}
|
|
860
913
|
const requestedStepMode = options?.step ?? false;
|
|
861
914
|
const interruptedAssessment = options?.interrupted ?? null;
|
|
915
|
+
if (options?.milestoneLock !== undefined) {
|
|
916
|
+
s.sessionMilestoneLock = options.milestoneLock ?? null;
|
|
917
|
+
}
|
|
918
|
+
if (s.sessionMilestoneLock) {
|
|
919
|
+
captureMilestoneLockEnv(s.sessionMilestoneLock);
|
|
920
|
+
}
|
|
862
921
|
// Escape stale worktree cwd from a previous milestone (#608).
|
|
863
922
|
base = escapeStaleWorktree(base);
|
|
864
923
|
const freshStartAssessment = interruptedAssessment
|
|
@@ -883,6 +942,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
883
942
|
s.originalBasePath = meta.originalBasePath || base;
|
|
884
943
|
s.stepMode = meta.stepMode ?? requestedStepMode;
|
|
885
944
|
s.autoStartTime = meta.autoStartTime || Date.now();
|
|
945
|
+
s.sessionMilestoneLock = meta.milestoneLock ?? null;
|
|
886
946
|
s.paused = true;
|
|
887
947
|
try {
|
|
888
948
|
unlinkSync(pausedPath);
|
|
@@ -918,6 +978,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
918
978
|
s.pausedUnitType = meta.unitType ?? null;
|
|
919
979
|
s.pausedUnitId = meta.unitId ?? null;
|
|
920
980
|
s.autoStartTime = meta.autoStartTime || Date.now();
|
|
981
|
+
s.sessionMilestoneLock = meta.milestoneLock ?? null;
|
|
921
982
|
s.paused = true;
|
|
922
983
|
try {
|
|
923
984
|
unlinkSync(pausedPath);
|
|
@@ -946,6 +1007,9 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
946
1007
|
if (!s.autoStartTime || s.autoStartTime <= 0)
|
|
947
1008
|
s.autoStartTime = Date.now();
|
|
948
1009
|
}
|
|
1010
|
+
if (s.sessionMilestoneLock) {
|
|
1011
|
+
captureMilestoneLockEnv(s.sessionMilestoneLock);
|
|
1012
|
+
}
|
|
949
1013
|
if (!s.paused) {
|
|
950
1014
|
s.stepMode = requestedStepMode;
|
|
951
1015
|
}
|
|
@@ -1238,8 +1302,6 @@ export async function dispatchHookUnit(ctx, pi, hookName, triggerUnitType, trigg
|
|
|
1238
1302
|
pi.sendMessage({ customType: "gsd-auto", content: hookPrompt, display: true }, { triggerTurn: true });
|
|
1239
1303
|
return true;
|
|
1240
1304
|
}
|
|
1241
|
-
// Direct phase dispatch → auto-direct-dispatch.ts
|
|
1242
|
-
export { dispatchDirectPhase } from "./auto-direct-dispatch.js";
|
|
1243
1305
|
// Re-export recovery functions for external consumers
|
|
1244
1306
|
export { buildLoopRemediationSteps, } from "./auto-recovery.js";
|
|
1245
1307
|
export { resolveExpectedArtifactPath } from "./auto-artifact-paths.js";
|
|
@@ -919,12 +919,12 @@ export function registerDbTools(pi) {
|
|
|
919
919
|
const saveGateResultTool = {
|
|
920
920
|
name: "gsd_save_gate_result",
|
|
921
921
|
label: "Save Gate Result",
|
|
922
|
-
description: "Save the result of a quality gate evaluation (Q3-Q8) to the GSD database. " +
|
|
922
|
+
description: "Save the result of a quality gate evaluation (Q3-Q8 or MV01-MV04) to the GSD database. " +
|
|
923
923
|
"Called by gate evaluation sub-agents after analyzing a specific quality question.",
|
|
924
924
|
promptSnippet: "Save quality gate evaluation result (verdict, rationale, findings)",
|
|
925
925
|
promptGuidelines: [
|
|
926
926
|
"Use gsd_save_gate_result after evaluating a quality gate question.",
|
|
927
|
-
"gateId must be one of: Q3, Q4, Q5, Q6, Q7, Q8.",
|
|
927
|
+
"gateId must be one of: Q3, Q4, Q5, Q6, Q7, Q8, MV01, MV02, MV03, MV04.",
|
|
928
928
|
"verdict must be: pass (no concerns), flag (concerns found), or omitted (not applicable).",
|
|
929
929
|
"rationale should be a one-sentence justification for the verdict.",
|
|
930
930
|
"findings should contain detailed markdown analysis (or empty string if omitted).",
|
|
@@ -932,7 +932,7 @@ export function registerDbTools(pi) {
|
|
|
932
932
|
parameters: Type.Object({
|
|
933
933
|
milestoneId: Type.String({ description: "Milestone ID (e.g. M001)" }),
|
|
934
934
|
sliceId: Type.String({ description: "Slice ID (e.g. S01)" }),
|
|
935
|
-
gateId: Type.String({ description: "Gate ID: Q3, Q4, Q5, Q6, Q7, or
|
|
935
|
+
gateId: Type.String({ description: "Gate ID: Q3, Q4, Q5, Q6, Q7, Q8, MV01, MV02, MV03, or MV04" }),
|
|
936
936
|
taskId: Type.Optional(Type.String({ description: "Task ID for task-scoped gates (Q5/Q6/Q7)" })),
|
|
937
937
|
verdict: Type.String({ description: "pass, flag, or omitted" }),
|
|
938
938
|
rationale: Type.String({ description: "One-sentence justification" }),
|
|
@@ -111,6 +111,8 @@ export function registerHooks(pi) {
|
|
|
111
111
|
return { cancel: true };
|
|
112
112
|
}
|
|
113
113
|
const basePath = process.cwd();
|
|
114
|
+
const { ensureDbOpen } = await import("./dynamic-tools.js");
|
|
115
|
+
await ensureDbOpen();
|
|
114
116
|
const state = await deriveState(basePath);
|
|
115
117
|
if (!state.activeMilestone || !state.activeSlice || !state.activeTask)
|
|
116
118
|
return;
|
|
@@ -170,14 +172,10 @@ export function registerHooks(pi) {
|
|
|
170
172
|
// Only gate-shaped ask_user_questions calls should block execution.
|
|
171
173
|
// The gate stays pending until the user selects the approval option.
|
|
172
174
|
if (event.toolName === "ask_user_questions") {
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
const questionId = questions.find((question) => typeof question?.id === "string" && isGateQuestionId(question.id))?.id;
|
|
178
|
-
if (typeof questionId === "string") {
|
|
179
|
-
setPendingGate(questionId);
|
|
180
|
-
}
|
|
175
|
+
const questions = event.input?.questions ?? [];
|
|
176
|
+
const questionId = questions.find((question) => typeof question?.id === "string" && isGateQuestionId(question.id))?.id;
|
|
177
|
+
if (typeof questionId === "string") {
|
|
178
|
+
setPendingGate(questionId);
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
181
|
// ── Discussion gate enforcement: block tool calls while gate is pending ──
|
|
@@ -259,8 +257,6 @@ export function registerHooks(pi) {
|
|
|
259
257
|
return;
|
|
260
258
|
const milestoneId = getDiscussionMilestoneId(process.cwd());
|
|
261
259
|
const queueActive = isQueuePhaseActive();
|
|
262
|
-
if (!milestoneId && !queueActive)
|
|
263
|
-
return;
|
|
264
260
|
const details = event.details;
|
|
265
261
|
// ── Discussion gate enforcement: handle gate question responses ──
|
|
266
262
|
// If the result is cancelled or has no response, the pending gate stays active
|
|
@@ -291,12 +287,16 @@ export function registerHooks(pi) {
|
|
|
291
287
|
// Only unlock the gate if the user selected the first option (confirmation).
|
|
292
288
|
// Cross-references against the question's defined options to reject free-form "Other" text.
|
|
293
289
|
const answer = details.response?.answers?.[question.id];
|
|
290
|
+
const inferredMilestoneId = extractDepthVerificationMilestoneId(question.id) ?? milestoneId;
|
|
294
291
|
if (isDepthConfirmationAnswer(answer?.selected, question.options)) {
|
|
295
|
-
markDepthVerified(
|
|
292
|
+
markDepthVerified(inferredMilestoneId);
|
|
293
|
+
clearPendingGate();
|
|
296
294
|
}
|
|
297
295
|
break;
|
|
298
296
|
}
|
|
299
297
|
}
|
|
298
|
+
if (!milestoneId && !queueActive)
|
|
299
|
+
return;
|
|
300
300
|
if (!milestoneId)
|
|
301
301
|
return;
|
|
302
302
|
const basePath = process.cwd();
|