gsd-pi 2.74.0-dev.28a6415 → 2.74.0-dev.658744a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/resources/extensions/gsd/auto/phases.js +51 -6
- package/dist/resources/extensions/gsd/auto-model-selection.js +3 -3
- package/dist/resources/extensions/gsd/auto-post-unit.js +7 -3
- package/dist/resources/extensions/gsd/auto-recovery.js +24 -10
- package/dist/resources/extensions/gsd/auto-worktree.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/provider-error-resume.js +5 -3
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +10 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +61 -9
- package/dist/resources/extensions/gsd/cache.js +16 -5
- package/dist/resources/extensions/gsd/commands/catalog.js +6 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +5 -1
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +50 -3
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +2 -0
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +144 -0
- package/dist/resources/extensions/gsd/ecosystem/loader.js +145 -0
- package/dist/resources/extensions/gsd/guided-flow.js +8 -6
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +10 -0
- package/dist/resources/extensions/gsd/preferences.js +5 -0
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +15 -30
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +13 -13
- 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 +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +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 +13 -13
- package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- 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/package.json +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +88 -6
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.ts +95 -10
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/index.d.ts +1 -9
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +1 -9
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/models/capability-patches.d.ts +19 -0
- package/packages/pi-ai/dist/models/capability-patches.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/capability-patches.js +36 -0
- package/packages/pi-ai/dist/models/capability-patches.js.map +1 -0
- package/packages/pi-ai/dist/{models.custom.d.ts → models/custom.d.ts} +1 -1
- package/packages/pi-ai/dist/models/custom.d.ts.map +1 -0
- package/packages/pi-ai/dist/{models.custom.js → models/custom.js} +4 -4
- package/packages/pi-ai/dist/models/custom.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts +1482 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.js +1484 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/anthropic.d.ts +377 -0
- package/packages/pi-ai/dist/models/generated/anthropic.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/anthropic.js +379 -0
- package/packages/pi-ai/dist/models/generated/anthropic.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/azure-openai-responses.d.ts +700 -0
- package/packages/pi-ai/dist/models/generated/azure-openai-responses.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/azure-openai-responses.js +702 -0
- package/packages/pi-ai/dist/models/generated/azure-openai-responses.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/cerebras.d.ts +71 -0
- package/packages/pi-ai/dist/models/generated/cerebras.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/cerebras.js +73 -0
- package/packages/pi-ai/dist/models/generated/cerebras.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/github-copilot.d.ts +590 -0
- package/packages/pi-ai/dist/models/generated/github-copilot.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/github-copilot.js +444 -0
- package/packages/pi-ai/dist/models/generated/github-copilot.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts +156 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.js +158 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-gemini-cli.d.ts +105 -0
- package/packages/pi-ai/dist/models/generated/google-gemini-cli.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-gemini-cli.js +107 -0
- package/packages/pi-ai/dist/models/generated/google-gemini-cli.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-vertex.d.ts +207 -0
- package/packages/pi-ai/dist/models/generated/google-vertex.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/google-vertex.js +209 -0
- package/packages/pi-ai/dist/models/generated/google-vertex.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/google.d.ts +462 -0
- package/packages/pi-ai/dist/models/generated/google.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/google.js +464 -0
- package/packages/pi-ai/dist/models/generated/google.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/groq.d.ts +309 -0
- package/packages/pi-ai/dist/models/generated/groq.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/groq.js +311 -0
- package/packages/pi-ai/dist/models/generated/groq.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/huggingface.d.ts +383 -0
- package/packages/pi-ai/dist/models/generated/huggingface.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/huggingface.js +347 -0
- package/packages/pi-ai/dist/models/generated/huggingface.js.map +1 -0
- package/packages/pi-ai/dist/{models.generated.d.ts → models/generated/index.d.ts} +1 -1
- package/packages/pi-ai/dist/{models.generated.d.ts.map → models/generated/index.d.ts.map} +1 -1
- package/packages/pi-ai/dist/models/generated/index.js +51 -0
- package/packages/pi-ai/dist/models/generated/index.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/kimi-coding.d.ts +37 -0
- package/packages/pi-ai/dist/models/generated/kimi-coding.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/kimi-coding.js +39 -0
- package/packages/pi-ai/dist/models/generated/kimi-coding.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/minimax-cn.d.ts +105 -0
- package/packages/pi-ai/dist/models/generated/minimax-cn.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/minimax-cn.js +107 -0
- package/packages/pi-ai/dist/models/generated/minimax-cn.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/minimax.d.ts +105 -0
- package/packages/pi-ai/dist/models/generated/minimax.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/minimax.js +107 -0
- package/packages/pi-ai/dist/models/generated/minimax.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/mistral.d.ts +445 -0
- package/packages/pi-ai/dist/models/generated/mistral.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/mistral.js +447 -0
- package/packages/pi-ai/dist/models/generated/mistral.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +139 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.js +141 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/openai.d.ts +700 -0
- package/packages/pi-ai/dist/models/generated/openai.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/openai.js +702 -0
- package/packages/pi-ai/dist/models/generated/openai.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/opencode-go.d.ts +122 -0
- package/packages/pi-ai/dist/models/generated/opencode-go.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/opencode-go.js +124 -0
- package/packages/pi-ai/dist/models/generated/opencode-go.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/opencode.d.ts +530 -0
- package/packages/pi-ai/dist/models/generated/opencode.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/opencode.js +532 -0
- package/packages/pi-ai/dist/models/generated/opencode.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/openrouter.d.ts +4270 -0
- package/packages/pi-ai/dist/models/generated/openrouter.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/openrouter.js +4272 -0
- package/packages/pi-ai/dist/models/generated/openrouter.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.d.ts +2604 -0
- package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.js +2606 -0
- package/packages/pi-ai/dist/models/generated/vercel-ai-gateway.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/xai.d.ts +411 -0
- package/packages/pi-ai/dist/models/generated/xai.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/xai.js +413 -0
- package/packages/pi-ai/dist/models/generated/xai.js.map +1 -0
- package/packages/pi-ai/dist/models/generated/zai.d.ts +276 -0
- package/packages/pi-ai/dist/models/generated/zai.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/generated/zai.js +239 -0
- package/packages/pi-ai/dist/models/generated/zai.js.map +1 -0
- package/packages/pi-ai/dist/models/index.d.ts +27 -0
- package/packages/pi-ai/dist/models/index.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/index.js +80 -0
- package/packages/pi-ai/dist/models/index.js.map +1 -0
- package/packages/pi-ai/dist/models.d.ts +1 -36
- package/packages/pi-ai/dist/models.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.test.js +1 -2
- package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
- package/packages/pi-ai/dist/models.js +3 -112
- package/packages/pi-ai/dist/models.js.map +1 -1
- package/packages/pi-ai/dist/models.test.js +6 -5
- package/packages/pi-ai/dist/models.test.js.map +1 -1
- package/packages/pi-ai/scripts/generate-models.ts +74 -40
- package/packages/pi-ai/src/index.ts +1 -9
- package/packages/pi-ai/src/models/capability-patches.ts +40 -0
- package/packages/pi-ai/src/{models.custom.ts → models/custom.ts} +4 -4
- package/packages/pi-ai/src/models/generated/amazon-bedrock.ts +1486 -0
- package/packages/pi-ai/src/models/generated/anthropic.ts +381 -0
- package/packages/pi-ai/src/models/generated/azure-openai-responses.ts +704 -0
- package/packages/pi-ai/src/models/generated/cerebras.ts +75 -0
- package/packages/pi-ai/src/models/generated/github-copilot.ts +446 -0
- package/packages/pi-ai/src/models/generated/google-antigravity.ts +160 -0
- package/packages/pi-ai/src/models/generated/google-gemini-cli.ts +109 -0
- package/packages/pi-ai/src/models/generated/google-vertex.ts +211 -0
- package/packages/pi-ai/src/models/generated/google.ts +466 -0
- package/packages/pi-ai/src/models/generated/groq.ts +313 -0
- package/packages/pi-ai/src/models/generated/huggingface.ts +349 -0
- package/packages/pi-ai/src/models/generated/index.ts +52 -0
- package/packages/pi-ai/src/models/generated/kimi-coding.ts +41 -0
- package/packages/pi-ai/src/models/generated/minimax-cn.ts +109 -0
- package/packages/pi-ai/src/models/generated/minimax.ts +109 -0
- package/packages/pi-ai/src/models/generated/mistral.ts +449 -0
- package/packages/pi-ai/src/models/generated/openai-codex.ts +143 -0
- package/packages/pi-ai/src/models/generated/openai.ts +704 -0
- package/packages/pi-ai/src/models/generated/opencode-go.ts +126 -0
- package/packages/pi-ai/src/models/generated/opencode.ts +534 -0
- package/packages/pi-ai/src/models/generated/openrouter.ts +4274 -0
- package/packages/pi-ai/src/models/generated/vercel-ai-gateway.ts +2608 -0
- package/packages/pi-ai/src/models/generated/xai.ts +415 -0
- package/packages/pi-ai/src/models/generated/zai.ts +241 -0
- package/packages/pi-ai/src/models/index.ts +106 -0
- package/packages/pi-ai/src/models.generated.test.ts +1 -2
- package/packages/pi-ai/src/models.test.ts +6 -5
- package/packages/pi-ai/src/models.ts +3 -153
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +8 -2
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +214 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +11 -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/assistant-message.d.ts +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +18 -8
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +47 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +8 -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 +68 -8
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +22 -22
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.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 +115 -4
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js +38 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-ordering.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +14 -0
- 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 +70 -6
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +12 -6
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +273 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +19 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +20 -9
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +67 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +83 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +23 -26
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +176 -40
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-ordering.test.ts +44 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +92 -6
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/gsd/auto/phases.ts +70 -6
- package/src/resources/extensions/gsd/auto-model-selection.ts +3 -3
- package/src/resources/extensions/gsd/auto-post-unit.ts +7 -3
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -9
- package/src/resources/extensions/gsd/auto-worktree.ts +1 -0
- package/src/resources/extensions/gsd/bootstrap/provider-error-resume.ts +5 -3
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +15 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +72 -8
- package/src/resources/extensions/gsd/cache.ts +16 -5
- package/src/resources/extensions/gsd/commands/catalog.ts +6 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +5 -1
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +57 -3
- package/src/resources/extensions/gsd/docs/preferences-reference.md +2 -0
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +228 -0
- package/src/resources/extensions/gsd/ecosystem/loader.ts +201 -0
- package/src/resources/extensions/gsd/guided-flow.ts +4 -2
- package/src/resources/extensions/gsd/preferences-types.ts +6 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +10 -0
- package/src/resources/extensions/gsd/preferences.ts +6 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +15 -31
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/src/resources/extensions/gsd/tests/artifacts-table-preserved-on-cache-invalidate.test.ts +177 -0
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +272 -0
- package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +117 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/preferences.test.ts +145 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +57 -2
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +1 -1
- package/src/resources/extensions/gsd/types.ts +13 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +2 -1
- package/packages/pi-ai/dist/models.custom.d.ts.map +0 -1
- package/packages/pi-ai/dist/models.custom.js.map +0 -1
- package/packages/pi-ai/dist/models.generated.js +0 -14343
- package/packages/pi-ai/dist/models.generated.js.map +0 -1
- package/packages/pi-ai/src/models.generated.ts +0 -14345
- /package/dist/web/standalone/.next/static/{fMaWScj7m6EsI3DbaNv2_ → Es_JWCfFZjIvYZShmjyye}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{fMaWScj7m6EsI3DbaNv2_ → Es_JWCfFZjIvYZShmjyye}/_ssgManifest.js +0 -0
|
@@ -29,6 +29,8 @@ import { debugLog } from "../debug-logger.js";
|
|
|
29
29
|
import { PROJECT_FILES } from "../detection.js";
|
|
30
30
|
import { MergeConflictError } from "../git-service.js";
|
|
31
31
|
import { setCurrentPhase, clearCurrentPhase } from "../../shared/gsd-phase-state.js";
|
|
32
|
+
import { pauseAutoForProviderError } from "../provider-error-pause.js";
|
|
33
|
+
import { resumeAutoAfterProviderDelay } from "../bootstrap/provider-error-resume.js";
|
|
32
34
|
import { join, basename, dirname, parse as parsePath } from "node:path";
|
|
33
35
|
import { existsSync, cpSync, readdirSync } from "node:fs";
|
|
34
36
|
import {
|
|
@@ -59,6 +61,15 @@ import {
|
|
|
59
61
|
getRequiredWorkflowToolsForAutoUnit,
|
|
60
62
|
} from "../workflow-mcp.js";
|
|
61
63
|
|
|
64
|
+
// ─── Session timeout auto-resume state ────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
let consecutiveSessionTimeouts = 0;
|
|
67
|
+
const MAX_SESSION_TIMEOUT_AUTO_RESUMES = 3;
|
|
68
|
+
|
|
69
|
+
export function resetSessionTimeoutState(): void {
|
|
70
|
+
consecutiveSessionTimeouts = 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
// ─── generateMilestoneReport ──────────────────────────────────────────────────
|
|
63
74
|
|
|
64
75
|
/**
|
|
@@ -1502,24 +1513,75 @@ export async function runUnitPhase(
|
|
|
1502
1513
|
debugLog("autoLoop", { phase: "exit", reason: "provider-pause", isTransient: unitResult.errorContext.isTransient });
|
|
1503
1514
|
return { action: "break", reason: "provider-pause" };
|
|
1504
1515
|
}
|
|
1505
|
-
//
|
|
1506
|
-
//
|
|
1507
|
-
//
|
|
1516
|
+
// Timeout category covers two distinct scenarios:
|
|
1517
|
+
// 1. Session creation timeout (120s) — transient, auto-resume with backoff
|
|
1518
|
+
// 2. Unit hard timeout (30min+) — stuck agent, pause for manual review
|
|
1508
1519
|
// Structural errors (TypeError, is not a function) are NOT transient
|
|
1509
1520
|
// and must hard-stop to avoid infinite retry loops.
|
|
1510
1521
|
if (
|
|
1511
1522
|
unitResult.errorContext?.isTransient &&
|
|
1512
1523
|
unitResult.errorContext?.category === "timeout"
|
|
1513
1524
|
) {
|
|
1525
|
+
const isSessionCreationTimeout = unitResult.errorContext.message?.includes("Session creation timed out");
|
|
1526
|
+
|
|
1527
|
+
if (isSessionCreationTimeout) {
|
|
1528
|
+
consecutiveSessionTimeouts += 1;
|
|
1529
|
+
const baseRetryAfterMs = 30_000;
|
|
1530
|
+
const retryAfterMs = baseRetryAfterMs * 2 ** Math.max(0, consecutiveSessionTimeouts - 1);
|
|
1531
|
+
const allowAutoResume = consecutiveSessionTimeouts <= MAX_SESSION_TIMEOUT_AUTO_RESUMES;
|
|
1532
|
+
|
|
1533
|
+
if (!allowAutoResume) {
|
|
1534
|
+
ctx.ui.notify(
|
|
1535
|
+
`Session creation timed out ${consecutiveSessionTimeouts} consecutive times for ${unitType} ${unitId}. Pausing for manual review.`,
|
|
1536
|
+
"warning",
|
|
1537
|
+
);
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
debugLog("autoLoop", {
|
|
1541
|
+
phase: "session-timeout-pause",
|
|
1542
|
+
unitType, unitId,
|
|
1543
|
+
consecutiveSessionTimeouts,
|
|
1544
|
+
retryAfterMs,
|
|
1545
|
+
allowAutoResume,
|
|
1546
|
+
});
|
|
1547
|
+
|
|
1548
|
+
const errorDetail = ` for ${unitType} ${unitId}`;
|
|
1549
|
+
await pauseAutoForProviderError(
|
|
1550
|
+
ctx.ui,
|
|
1551
|
+
errorDetail,
|
|
1552
|
+
() => deps.pauseAuto(ctx, pi),
|
|
1553
|
+
{
|
|
1554
|
+
isRateLimit: false,
|
|
1555
|
+
isTransient: allowAutoResume,
|
|
1556
|
+
retryAfterMs,
|
|
1557
|
+
resume: allowAutoResume
|
|
1558
|
+
? () => {
|
|
1559
|
+
void resumeAutoAfterProviderDelay(pi, ctx).catch((err) => {
|
|
1560
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1561
|
+
ctx.ui.notify(
|
|
1562
|
+
`Session timeout recovery failed: ${message}`,
|
|
1563
|
+
"error",
|
|
1564
|
+
);
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
: undefined,
|
|
1568
|
+
},
|
|
1569
|
+
);
|
|
1570
|
+
await deps.autoCommitUnit?.(s.basePath, unitType, unitId, ctx);
|
|
1571
|
+
await emitCancelledUnitEnd(ic, unitType, unitId, unitStartSeq, unitResult.errorContext);
|
|
1572
|
+
return { action: "break", reason: "session-timeout" };
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// Unit hard timeout (30min+): pause without auto-resume — stuck agent
|
|
1514
1576
|
ctx.ui.notify(
|
|
1515
|
-
`
|
|
1577
|
+
`Unit timed out for ${unitType} ${unitId} (supervision may have failed). Pausing auto-mode.`,
|
|
1516
1578
|
"warning",
|
|
1517
1579
|
);
|
|
1518
|
-
debugLog("autoLoop", { phase: "
|
|
1580
|
+
debugLog("autoLoop", { phase: "unit-hard-timeout-pause", unitType, unitId });
|
|
1519
1581
|
await deps.pauseAuto(ctx, pi);
|
|
1520
1582
|
await deps.autoCommitUnit?.(s.basePath, unitType, unitId, ctx);
|
|
1521
1583
|
await emitCancelledUnitEnd(ic, unitType, unitId, unitStartSeq, unitResult.errorContext);
|
|
1522
|
-
return { action: "break", reason: "
|
|
1584
|
+
return { action: "break", reason: "unit-hard-timeout" };
|
|
1523
1585
|
}
|
|
1524
1586
|
// All other cancelled states (structural errors, non-transient failures): hard stop
|
|
1525
1587
|
if (s.currentUnit) {
|
|
@@ -1549,6 +1611,8 @@ export async function runUnitPhase(
|
|
|
1549
1611
|
// Guard: stopAuto() may have nulled s.currentUnit via s.reset() while
|
|
1550
1612
|
// this coroutine was suspended at `await runUnit(...)` (#2939).
|
|
1551
1613
|
if (s.currentUnit) {
|
|
1614
|
+
// Reset session timeout counter — any successful unit clears the slate
|
|
1615
|
+
consecutiveSessionTimeouts = 0;
|
|
1552
1616
|
await deps.closeoutUnit(
|
|
1553
1617
|
ctx,
|
|
1554
1618
|
s.basePath,
|
|
@@ -535,10 +535,10 @@ export function buildFlatRateContext(
|
|
|
535
535
|
prefs?: { flat_rate_providers?: readonly string[] },
|
|
536
536
|
): FlatRateContext {
|
|
537
537
|
let authMode: FlatRateContext["authMode"];
|
|
538
|
-
const
|
|
539
|
-
if (typeof
|
|
538
|
+
const registry = ctx?.modelRegistry;
|
|
539
|
+
if (registry && typeof registry.getProviderAuthMode === "function") {
|
|
540
540
|
try {
|
|
541
|
-
const mode =
|
|
541
|
+
const mode = registry.getProviderAuthMode(provider);
|
|
542
542
|
if (mode === "apiKey" || mode === "oauth" || mode === "externalCli" || mode === "none") {
|
|
543
543
|
authMode = mode;
|
|
544
544
|
}
|
|
@@ -1121,11 +1121,15 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1121
1121
|
});
|
|
1122
1122
|
}
|
|
1123
1123
|
|
|
1124
|
-
// Notify UI
|
|
1124
|
+
// Notify UI — surface actionable details (#4259)
|
|
1125
1125
|
if (result.status === "fail") {
|
|
1126
|
-
const
|
|
1126
|
+
const blockingChecks = result.checks.filter(c => !c.passed && c.blocking);
|
|
1127
|
+
const blockingCount = blockingChecks.length;
|
|
1128
|
+
const details = blockingChecks.slice(0, 3).map(c => ` \u2022 ${c.message}`).join("\n");
|
|
1129
|
+
const suffix = blockingChecks.length > 3 ? `\n \u2022 ...and ${blockingChecks.length - 3} more` : "";
|
|
1130
|
+
const evidenceNote = `\nSee ${sid}-PRE-EXEC-VERIFY.json for full details.`;
|
|
1127
1131
|
ctx.ui.notify(
|
|
1128
|
-
`Pre-execution checks failed: ${blockingCount} blocking issue${blockingCount === 1 ? "" : "s"} found`,
|
|
1132
|
+
`Pre-execution checks failed: ${blockingCount} blocking issue${blockingCount === 1 ? "" : "s"} found\n${details}${suffix}${evidenceNote}`,
|
|
1129
1133
|
"error",
|
|
1130
1134
|
);
|
|
1131
1135
|
preExecPauseNeeded = true;
|
|
@@ -264,18 +264,30 @@ export function verifyExpectedArtifact(
|
|
|
264
264
|
const absPath = resolveExpectedArtifactPath(unitType, unitId, base);
|
|
265
265
|
// For unit types with no verifiable artifact (null path), the parent directory
|
|
266
266
|
// is missing on disk — treat as stale completion state so the key gets evicted (#313).
|
|
267
|
-
if (!absPath)
|
|
268
|
-
|
|
267
|
+
if (!absPath) {
|
|
268
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: resolveExpectedArtifactPath returned null (parent dir missing)`);
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
if (!existsSync(absPath)) {
|
|
272
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: existsSync false for ${absPath}`);
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
269
275
|
|
|
270
276
|
if (unitType === "validate-milestone") {
|
|
271
277
|
const validationContent = readFileSync(absPath, "utf-8");
|
|
272
|
-
if (!isValidationTerminal(validationContent))
|
|
278
|
+
if (!isValidationTerminal(validationContent)) {
|
|
279
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: validation not terminal (len=${validationContent.length}) at ${absPath}`);
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
273
282
|
}
|
|
274
283
|
|
|
275
284
|
if (unitType === "plan-milestone") {
|
|
276
285
|
try {
|
|
277
286
|
const roadmap = parseLegacyRoadmap(readFileSync(absPath, "utf-8"));
|
|
278
|
-
if (roadmap.slices.length === 0)
|
|
287
|
+
if (roadmap.slices.length === 0) {
|
|
288
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: roadmap has zero slices at ${absPath}`);
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
279
291
|
} catch (err) {
|
|
280
292
|
logWarning("recovery", `plan-milestone roadmap verification failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
281
293
|
return false;
|
|
@@ -292,7 +304,10 @@ export function verifyExpectedArtifact(
|
|
|
292
304
|
// Accept checkbox-style (- [x] **T01: ...) or heading-style (### T01 -- / ### T01: / ### T01 —)
|
|
293
305
|
const hasCheckboxTask = /^- \[[xX ]\] \*\*T\d+:/m.test(planContent);
|
|
294
306
|
const hasHeadingTask = /^#{2,4}\s+T\d+\s*(?:--|—|:)/m.test(planContent);
|
|
295
|
-
if (!hasCheckboxTask && !hasHeadingTask)
|
|
307
|
+
if (!hasCheckboxTask && !hasHeadingTask) {
|
|
308
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: plan has no task checkbox/heading (len=${planContent.length}) at ${absPath}`);
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
296
311
|
}
|
|
297
312
|
|
|
298
313
|
// execute-task: DB status is authoritative. Fall back to checked-checkbox
|
|
@@ -349,10 +364,15 @@ export function verifyExpectedArtifact(
|
|
|
349
364
|
|
|
350
365
|
if (taskIds && taskIds.length > 0) {
|
|
351
366
|
const tasksDir = resolveTasksDir(base, mid, sid);
|
|
352
|
-
if (tasksDir) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
367
|
+
if (!tasksDir) {
|
|
368
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: resolveTasksDir returned null for ${mid}/${sid}`);
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
for (const tid of taskIds) {
|
|
372
|
+
const taskPlanFile = join(tasksDir, `${tid}-PLAN.md`);
|
|
373
|
+
if (!existsSync(taskPlanFile)) {
|
|
374
|
+
logWarning("recovery", `verify-fail ${unitType} ${unitId}: task plan missing ${taskPlanFile}`);
|
|
375
|
+
return false;
|
|
356
376
|
}
|
|
357
377
|
}
|
|
358
378
|
}
|
|
@@ -102,6 +102,7 @@ function isSamePath(a: string, b: string): boolean {
|
|
|
102
102
|
try {
|
|
103
103
|
return realpathSync(a) === realpathSync(b);
|
|
104
104
|
} catch (e) {
|
|
105
|
+
if ((e as NodeJS.ErrnoException).code === "ENOENT") return false;
|
|
105
106
|
logWarning("worktree", `isSamePath failed: ${(e as Error).message}`);
|
|
106
107
|
return false;
|
|
107
108
|
}
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
|
|
7
7
|
import { getAutoDashboardData, startAuto, type AutoDashboardData } from "../auto.js";
|
|
8
8
|
import { resetTransientRetryState } from "./agent-end-recovery.js";
|
|
9
|
+
import { resetSessionTimeoutState } from "../auto/phases.js";
|
|
9
10
|
|
|
10
11
|
type AutoResumeSnapshot = Pick<AutoDashboardData, "active" | "paused" | "stepMode" | "basePath">;
|
|
11
12
|
|
|
@@ -43,10 +44,11 @@ export async function resumeAutoAfterProviderDelay(
|
|
|
43
44
|
return "missing-base";
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
// Reset
|
|
47
|
-
//
|
|
48
|
-
//
|
|
47
|
+
// Reset retry counters before restarting — without this, counters
|
|
48
|
+
// accumulate across pause/resume cycles and permanently lock out
|
|
49
|
+
// auto-resume after their respective MAX thresholds.
|
|
49
50
|
resetTransientRetryState();
|
|
51
|
+
resetSessionTimeoutState();
|
|
50
52
|
|
|
51
53
|
await deps.startAuto(
|
|
52
54
|
ctx as ExtensionCommandContext,
|
|
@@ -4,6 +4,8 @@ import type { ExtensionAPI, ExtensionCommandContext } from "@gsd/pi-coding-agent
|
|
|
4
4
|
|
|
5
5
|
import { registerExitCommand } from "../exit-command.js";
|
|
6
6
|
import { registerWorktreeCommand } from "../worktree-command.js";
|
|
7
|
+
import type { GSDEcosystemBeforeAgentStartHandler } from "../ecosystem/gsd-extension-api.js";
|
|
8
|
+
import { loadEcosystemExtensions } from "../ecosystem/loader.js";
|
|
7
9
|
import { registerDbTools } from "./db-tools.js";
|
|
8
10
|
import { registerDynamicTools } from "./dynamic-tools.js";
|
|
9
11
|
import { registerJournalTools } from "./journal-tools.js";
|
|
@@ -65,6 +67,10 @@ export function registerGsdExtension(pi: ExtensionAPI): void {
|
|
|
65
67
|
|
|
66
68
|
installEpipeGuard();
|
|
67
69
|
|
|
70
|
+
// Ecosystem handlers captured by the GSDExtensionAPI wrapper for the
|
|
71
|
+
// GSD-owned `before_agent_start` dispatch step (#3338).
|
|
72
|
+
const ecosystemHandlers: GSDEcosystemBeforeAgentStartHandler[] = [];
|
|
73
|
+
|
|
68
74
|
pi.registerCommand("kill", {
|
|
69
75
|
description: "Exit GSD immediately (no cleanup)",
|
|
70
76
|
handler: async (_args: string, _ctx: ExtensionCommandContext) => {
|
|
@@ -80,7 +86,15 @@ export function registerGsdExtension(pi: ExtensionAPI): void {
|
|
|
80
86
|
["journal-tools", () => registerJournalTools(pi)],
|
|
81
87
|
["query-tools", () => registerQueryTools(pi)],
|
|
82
88
|
["shortcuts", () => registerShortcuts(pi)],
|
|
83
|
-
["hooks", () => registerHooks(pi)],
|
|
89
|
+
["hooks", () => registerHooks(pi, ecosystemHandlers)],
|
|
90
|
+
["ecosystem", () => {
|
|
91
|
+
void loadEcosystemExtensions(pi, ecosystemHandlers).catch((err) => {
|
|
92
|
+
logWarning(
|
|
93
|
+
"ecosystem",
|
|
94
|
+
`loader failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
}],
|
|
84
98
|
];
|
|
85
99
|
|
|
86
100
|
for (const [name, register] of nonCriticalRegistrations) {
|
|
@@ -3,6 +3,10 @@ import { join } from "node:path";
|
|
|
3
3
|
import type { ExtensionAPI, ExtensionContext } from "@gsd/pi-coding-agent";
|
|
4
4
|
import { isToolCallEventType } from "@gsd/pi-coding-agent";
|
|
5
5
|
|
|
6
|
+
import type { GSDEcosystemBeforeAgentStartHandler } from "../ecosystem/gsd-extension-api.js";
|
|
7
|
+
import { updateSnapshot } from "../ecosystem/gsd-extension-api.js";
|
|
8
|
+
import { getEcosystemReadyPromise } from "../ecosystem/loader.js";
|
|
9
|
+
|
|
6
10
|
import { buildMilestoneFileName, resolveMilestonePath, resolveSliceFile, resolveSlicePath } from "../paths.js";
|
|
7
11
|
import { buildBeforeAgentStartResult } from "./system-context.js";
|
|
8
12
|
import { handleAgentEnd } from "./agent-end-recovery.js";
|
|
@@ -35,7 +39,10 @@ async function syncServiceTierStatus(ctx: ExtensionContext): Promise<void> {
|
|
|
35
39
|
ctx.ui.setStatus("gsd-fast", formatServiceTierFooterStatus(getEffectiveServiceTier(), ctx.model?.id));
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
export function registerHooks(
|
|
42
|
+
export function registerHooks(
|
|
43
|
+
pi: ExtensionAPI,
|
|
44
|
+
ecosystemHandlers: GSDEcosystemBeforeAgentStartHandler[],
|
|
45
|
+
): void {
|
|
39
46
|
pi.on("session_start", async (_event, ctx) => {
|
|
40
47
|
initNotificationStore(process.cwd());
|
|
41
48
|
installNotifyInterceptor(ctx);
|
|
@@ -45,8 +52,12 @@ export function registerHooks(pi: ExtensionAPI): void {
|
|
|
45
52
|
resetToolCallLoopGuard();
|
|
46
53
|
resetAskUserQuestionsCache();
|
|
47
54
|
await syncServiceTierStatus(ctx);
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
// Skip MCP auto-prep when running inside an auto-worktree (see session_switch below).
|
|
56
|
+
const { isInAutoWorktree } = await import("../auto-worktree.js");
|
|
57
|
+
if (!isInAutoWorktree(process.cwd())) {
|
|
58
|
+
const { prepareWorkflowMcpForProject } = await import("../workflow-mcp-auto-prep.js");
|
|
59
|
+
prepareWorkflowMcpForProject(ctx, process.cwd());
|
|
60
|
+
}
|
|
50
61
|
|
|
51
62
|
// Apply show_token_cost preference (#1515)
|
|
52
63
|
try {
|
|
@@ -87,13 +98,63 @@ export function registerHooks(pi: ExtensionAPI): void {
|
|
|
87
98
|
resetAskUserQuestionsCache();
|
|
88
99
|
clearDiscussionFlowState();
|
|
89
100
|
await syncServiceTierStatus(ctx);
|
|
90
|
-
|
|
91
|
-
|
|
101
|
+
// Skip MCP auto-prep when running inside an auto-worktree. The worktree
|
|
102
|
+
// already has .mcp.json from createAutoWorktree, and re-running the writer
|
|
103
|
+
// post-chdir rewrites the file mid-run (non-idempotent due to cwd-relative
|
|
104
|
+
// CLI path resolution), dirtying the tree and breaking the milestone merge.
|
|
105
|
+
const { isInAutoWorktree } = await import("../auto-worktree.js");
|
|
106
|
+
if (!isInAutoWorktree(process.cwd())) {
|
|
107
|
+
const { prepareWorkflowMcpForProject } = await import("../workflow-mcp-auto-prep.js");
|
|
108
|
+
prepareWorkflowMcpForProject(ctx, process.cwd());
|
|
109
|
+
}
|
|
92
110
|
loadToolApiKeys();
|
|
93
111
|
});
|
|
94
112
|
|
|
95
113
|
pi.on("before_agent_start", async (event, ctx: ExtensionContext) => {
|
|
96
|
-
|
|
114
|
+
// Wait for ecosystem loader to finish (no-op after first turn).
|
|
115
|
+
await getEcosystemReadyPromise();
|
|
116
|
+
|
|
117
|
+
// GSD's own context injection (existing behavior — unchanged).
|
|
118
|
+
const gsdResult = await buildBeforeAgentStartResult(event, ctx);
|
|
119
|
+
|
|
120
|
+
// Refresh the snapshot used by ecosystem getPhase()/getActiveUnit().
|
|
121
|
+
// deriveState has its own ~100ms cache so this is cheap on repeat calls.
|
|
122
|
+
try {
|
|
123
|
+
const state = await deriveState(process.cwd());
|
|
124
|
+
updateSnapshot(state);
|
|
125
|
+
} catch {
|
|
126
|
+
updateSnapshot(null);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Chain ecosystem handlers using pi's runner.ts chaining protocol:
|
|
130
|
+
// each handler sees the systemPrompt mutated by prior handlers.
|
|
131
|
+
let currentSystemPrompt = gsdResult?.systemPrompt ?? event.systemPrompt;
|
|
132
|
+
// `any` because pi's BeforeAgentStartEventResult.message uses an internal
|
|
133
|
+
// CustomMessage type that's not re-exported (see ecosystem/gsd-extension-api.ts).
|
|
134
|
+
let lastMessage: any = gsdResult?.message;
|
|
135
|
+
|
|
136
|
+
for (const handler of ecosystemHandlers) {
|
|
137
|
+
try {
|
|
138
|
+
const r = await handler(
|
|
139
|
+
{ ...event, systemPrompt: currentSystemPrompt },
|
|
140
|
+
ctx,
|
|
141
|
+
);
|
|
142
|
+
if (r?.systemPrompt !== undefined) currentSystemPrompt = r.systemPrompt;
|
|
143
|
+
if (r?.message) lastMessage = r.message;
|
|
144
|
+
} catch (err) {
|
|
145
|
+
safetyLogWarning(
|
|
146
|
+
"ecosystem",
|
|
147
|
+
`before_agent_start handler failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Compose result. Return undefined if nothing changed (preserves runner contract).
|
|
153
|
+
if (currentSystemPrompt === event.systemPrompt && !lastMessage) return undefined;
|
|
154
|
+
return {
|
|
155
|
+
systemPrompt: currentSystemPrompt !== event.systemPrompt ? currentSystemPrompt : undefined,
|
|
156
|
+
message: lastMessage,
|
|
157
|
+
};
|
|
97
158
|
});
|
|
98
159
|
|
|
99
160
|
pi.on("agent_end", async (event, ctx: ExtensionContext) => {
|
|
@@ -125,7 +186,10 @@ export function registerHooks(pi: ExtensionAPI): void {
|
|
|
125
186
|
await ensureDbOpen();
|
|
126
187
|
const state = await deriveState(basePath);
|
|
127
188
|
if (!state.activeMilestone || !state.activeSlice || !state.activeTask) return;
|
|
128
|
-
|
|
189
|
+
// Write checkpoint for ALL phases, not just "executing" — discuss, research,
|
|
190
|
+
// and planning also carry in-memory state (user answers, gate verification)
|
|
191
|
+
// that would be lost on compaction (#4258).
|
|
192
|
+
// if (state.phase !== "executing") return;
|
|
129
193
|
|
|
130
194
|
const sliceDir = resolveSlicePath(basePath, state.activeMilestone.id, state.activeSlice.id);
|
|
131
195
|
if (!sliceDir) return;
|
|
@@ -261,7 +325,7 @@ export function registerHooks(pi: ExtensionAPI): void {
|
|
|
261
325
|
// ── Safety harness: evidence collection + destructive command warnings ──
|
|
262
326
|
pi.on("tool_call", async (event, ctx) => {
|
|
263
327
|
if (!isAutoActive()) return;
|
|
264
|
-
safetyRecordToolCall(event.toolName, event.input as Record<string, unknown>);
|
|
328
|
+
safetyRecordToolCall(event.toolCallId, event.toolName, event.input as Record<string, unknown>);
|
|
265
329
|
|
|
266
330
|
// Destructive command classification (warn only, never block)
|
|
267
331
|
if (isToolCallEventType("bash", event)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// GSD Extension — Unified Cache Invalidation
|
|
2
2
|
//
|
|
3
|
-
// Three module-scoped caches exist across the GSD extension:
|
|
3
|
+
// Three module-scoped read caches exist across the GSD extension:
|
|
4
4
|
// 1. State cache (state.ts) — memoized deriveState() result
|
|
5
5
|
// 2. Path cache (paths.ts) — directory listing results (readdirSync)
|
|
6
6
|
// 3. Parse cache (files.ts) — parsed markdown file results
|
|
@@ -8,22 +8,33 @@
|
|
|
8
8
|
// After any file write that changes .gsd/ contents, all three must be
|
|
9
9
|
// invalidated together to prevent stale reads. This module provides a
|
|
10
10
|
// single function that clears all three atomically.
|
|
11
|
+
//
|
|
12
|
+
// NOTE: The DB `artifacts` table is NOT included here. Earlier versions
|
|
13
|
+
// called clearArtifacts() as part of this bundle (#793), intending to
|
|
14
|
+
// force deriveState() to re-parse from disk when files were edited
|
|
15
|
+
// out-of-band. But invalidateAllCaches() fires on every post-unit pass,
|
|
16
|
+
// so bundling a DESTRUCTIVE `DELETE FROM artifacts` with routine cache
|
|
17
|
+
// invalidation meant every row written by saveArtifactToDb / writeAndStore
|
|
18
|
+
// was wiped within seconds — leaving the milestone completed on disk but
|
|
19
|
+
// the `artifacts` table empty and the agent looping on "file exists but
|
|
20
|
+
// DB record missing" recovery calls. If a call site genuinely needs the
|
|
21
|
+
// artifact table cleared after an out-of-band file mutation, it should
|
|
22
|
+
// invoke clearArtifacts() from gsd-db.js explicitly — do not add it back
|
|
23
|
+
// here.
|
|
11
24
|
|
|
12
25
|
import { invalidateStateCache } from './state.js';
|
|
13
26
|
import { clearPathCache } from './paths.js';
|
|
14
27
|
import { clearParseCache } from './files.js';
|
|
15
|
-
import { clearArtifacts } from './gsd-db.js';
|
|
16
28
|
|
|
17
29
|
/**
|
|
18
|
-
* Invalidate all GSD runtime caches in one call.
|
|
30
|
+
* Invalidate all GSD runtime read caches in one call.
|
|
19
31
|
*
|
|
20
32
|
* Call this after file writes, milestone transitions, merge reconciliation,
|
|
21
33
|
* or any operation that changes .gsd/ contents on disk. Forgetting to clear
|
|
22
|
-
* any single cache causes stale reads (see #431
|
|
34
|
+
* any single cache causes stale reads (see #431).
|
|
23
35
|
*/
|
|
24
36
|
export function invalidateAllCaches(): void {
|
|
25
37
|
invalidateStateCache();
|
|
26
38
|
clearPathCache();
|
|
27
39
|
clearParseCache();
|
|
28
|
-
clearArtifacts();
|
|
29
40
|
}
|
|
@@ -15,7 +15,7 @@ export interface GsdCommandDefinition {
|
|
|
15
15
|
type CompletionMap = Record<string, readonly GsdCommandDefinition[]>;
|
|
16
16
|
|
|
17
17
|
export const GSD_COMMAND_DESCRIPTION =
|
|
18
|
-
"GSD — Get Shit Done: /gsd help|start|templates|next|auto|stop|pause|status|widget|visualize|queue|quick|discuss|capture|triage|dispatch|history|undo|undo-task|reset-slice|rate|skip|export|cleanup|model|mode|prefs|config|keys|hooks|run-hook|skill-health|doctor|logs|forensics|changelog|migrate|remote|steer|knowledge|new-milestone|parallel|cmux|park|unpark|init|setup|inspect|extensions|update|fast|mcp|rethink|codebase|notifications|ship|do|session-report|backlog|pr-branch|add-tests";
|
|
18
|
+
"GSD — Get Shit Done: /gsd help|start|templates|next|auto|stop|pause|status|widget|visualize|queue|quick|discuss|capture|triage|dispatch|history|undo|undo-task|reset-slice|rate|skip|export|cleanup|model|mode|prefs|config|keys|hooks|run-hook|skill-health|doctor|logs|forensics|changelog|migrate|remote|steer|knowledge|new-milestone|parallel|cmux|park|unpark|init|setup|inspect|extensions|update|fast|mcp|rethink|codebase|notifications|ship|do|session-report|backlog|pr-branch|add-tests|language";
|
|
19
19
|
|
|
20
20
|
export const TOP_LEVEL_SUBCOMMANDS: readonly GsdCommandDefinition[] = [
|
|
21
21
|
{ cmd: "help", desc: "Categorized command reference with descriptions" },
|
|
@@ -80,6 +80,7 @@ export const TOP_LEVEL_SUBCOMMANDS: readonly GsdCommandDefinition[] = [
|
|
|
80
80
|
{ cmd: "backlog", desc: "Manage backlog items (add, promote, remove, list)" },
|
|
81
81
|
{ cmd: "pr-branch", desc: "Create clean PR branch filtering .gsd/ commits" },
|
|
82
82
|
{ cmd: "add-tests", desc: "Generate tests for completed slices" },
|
|
83
|
+
{ cmd: "language", desc: "Set or clear the global response language (e.g. /gsd language Chinese)" },
|
|
83
84
|
];
|
|
84
85
|
|
|
85
86
|
const NESTED_COMPLETIONS: CompletionMap = {
|
|
@@ -269,6 +270,10 @@ const NESTED_COMPLETIONS: CompletionMap = {
|
|
|
269
270
|
{ cmd: "--dry-run", desc: "Preview what would be filtered" },
|
|
270
271
|
{ cmd: "--name", desc: "Custom branch name" },
|
|
271
272
|
],
|
|
273
|
+
language: [
|
|
274
|
+
{ cmd: "off", desc: "Clear the language preference (revert to default)" },
|
|
275
|
+
{ cmd: "clear", desc: "Alias for off — clear the language preference" },
|
|
276
|
+
],
|
|
272
277
|
};
|
|
273
278
|
|
|
274
279
|
function filterOptions(
|
|
@@ -4,7 +4,7 @@ import type { GSDState } from "../../types.js";
|
|
|
4
4
|
|
|
5
5
|
import { computeProgressScore, formatProgressLine } from "../../progress-score.js";
|
|
6
6
|
import { loadEffectiveGSDPreferences, getGlobalGSDPreferencesPath, getProjectGSDPreferencesPath } from "../../preferences.js";
|
|
7
|
-
import { ensurePreferencesFile, handlePrefs, handlePrefsMode, handlePrefsWizard } from "../../commands-prefs-wizard.js";
|
|
7
|
+
import { ensurePreferencesFile, handlePrefs, handlePrefsMode, handlePrefsWizard, handleLanguage } from "../../commands-prefs-wizard.js";
|
|
8
8
|
import { runEnvironmentChecks } from "../../doctor-environment.js";
|
|
9
9
|
import { deriveState } from "../../state.js";
|
|
10
10
|
import { handleCmux } from "../../commands-cmux.js";
|
|
@@ -395,6 +395,10 @@ export async function handleCoreCommand(
|
|
|
395
395
|
await handlePrefs(trimmed.replace(/^prefs\s*/, "").trim(), ctx);
|
|
396
396
|
return true;
|
|
397
397
|
}
|
|
398
|
+
if (trimmed === "language" || trimmed.startsWith("language ")) {
|
|
399
|
+
await handleLanguage(trimmed.replace(/^language\s*/, "").trim(), ctx);
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
398
402
|
if (trimmed === "cmux" || trimmed.startsWith("cmux ")) {
|
|
399
403
|
await handleCmux(trimmed.replace(/^cmux\s*/, "").trim(), ctx);
|
|
400
404
|
return true;
|
|
@@ -756,8 +756,8 @@ export async function handlePrefsWizard(
|
|
|
756
756
|
/** Wrap a YAML value in double quotes if it contains special characters. */
|
|
757
757
|
export function yamlSafeString(val: unknown): string {
|
|
758
758
|
if (typeof val !== "string") return String(val);
|
|
759
|
-
if (/[:#{\[\]'"
|
|
760
|
-
return `"${val.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
759
|
+
if (/[:#{\[\]'"`,|>&*!?@%\r\n]/.test(val) || val.trim() !== val || val === "") {
|
|
760
|
+
return `"${val.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\r/g, "\\r").replace(/\n/g, "\\n")}"`;
|
|
761
761
|
}
|
|
762
762
|
return val;
|
|
763
763
|
}
|
|
@@ -825,7 +825,7 @@ export function serializePreferencesToFrontmatter(prefs: Record<string, unknown>
|
|
|
825
825
|
"dynamic_routing", "uok", "token_profile", "phases", "parallel",
|
|
826
826
|
"auto_visualize", "auto_report",
|
|
827
827
|
"verification_commands", "verification_auto_fix", "verification_max_retries",
|
|
828
|
-
"search_provider", "context_selection",
|
|
828
|
+
"search_provider", "context_selection", "language",
|
|
829
829
|
];
|
|
830
830
|
|
|
831
831
|
const seen = new Set<string>();
|
|
@@ -862,3 +862,57 @@ export async function ensurePreferencesFile(
|
|
|
862
862
|
ctx.ui.notify(`Using existing ${scope} GSD skill preferences at ${path}`, "info");
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Handle `/gsd language [code]` — set or clear the global language preference.
|
|
868
|
+
* Without an argument, shows the current setting.
|
|
869
|
+
* Project-level override can be set by editing `.gsd/preferences.md` directly
|
|
870
|
+
* (project language overrides global when both are set).
|
|
871
|
+
*/
|
|
872
|
+
export async function handleLanguage(args: string, ctx: ExtensionCommandContext): Promise<void> {
|
|
873
|
+
const path = getGlobalGSDPreferencesPath();
|
|
874
|
+
const lang = args.trim();
|
|
875
|
+
|
|
876
|
+
// Show current setting when called without argument
|
|
877
|
+
if (!lang) {
|
|
878
|
+
const loaded = loadGlobalGSDPreferences();
|
|
879
|
+
const current = loaded?.preferences.language;
|
|
880
|
+
if (current) {
|
|
881
|
+
ctx.ui.notify(`Current language preference: ${current}\nUse /gsd language <name> to change, or /gsd language off to clear.`, "info");
|
|
882
|
+
} else {
|
|
883
|
+
ctx.ui.notify("No language preference set. Use /gsd language <name> to set one (e.g. /gsd language Chinese).", "info");
|
|
884
|
+
}
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// Ensure preferences file exists with the canonical template
|
|
889
|
+
await ensurePreferencesFile(path, ctx, "global");
|
|
890
|
+
|
|
891
|
+
// Read via the same validated path as other handlers
|
|
892
|
+
const existing = loadGlobalGSDPreferences();
|
|
893
|
+
const prefs: Record<string, unknown> = existing?.preferences ? { ...existing.preferences } : { version: 1 };
|
|
894
|
+
|
|
895
|
+
if (lang === "off" || lang === "none" || lang === "clear") {
|
|
896
|
+
delete prefs.language;
|
|
897
|
+
ctx.ui.notify("Language preference cleared. GSD will use the default language.", "info");
|
|
898
|
+
} else {
|
|
899
|
+
// Validate before writing — reject values that would fail on next load
|
|
900
|
+
if (lang.length > 50 || /[\r\n]/.test(lang)) {
|
|
901
|
+
ctx.ui.notify(
|
|
902
|
+
"Language value must be 50 characters or fewer with no newlines (e.g. /gsd language Chinese).",
|
|
903
|
+
"warning",
|
|
904
|
+
);
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
prefs.language = lang;
|
|
908
|
+
ctx.ui.notify(`Language preference set to: ${lang}\nGSD will now respond in ${lang} across all sessions.`, "info");
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
const rawContent = existsSync(path) ? readFileSync(path, "utf-8") : `---\nversion: 1\n---\n`;
|
|
912
|
+
const frontmatter = serializePreferencesToFrontmatter(prefs);
|
|
913
|
+
const body = extractBodyAfterFrontmatter(rawContent)
|
|
914
|
+
?? "\n# GSD Skill Preferences\n\nSee `~/.gsd/agent/extensions/gsd/docs/preferences-reference.md` for full field documentation and examples.\n";
|
|
915
|
+
await saveFile(path, `---\n${frontmatter}---${body}`);
|
|
916
|
+
await ctx.waitForIdle();
|
|
917
|
+
await ctx.reload();
|
|
918
|
+
}
|
|
@@ -102,6 +102,8 @@ Setting `prefer_skills: []` does **not** disable skill discovery — it just mea
|
|
|
102
102
|
|
|
103
103
|
- `custom_instructions`: extra durable instructions related to skill use. For operational project knowledge (recurring rules, gotchas, patterns), use `.gsd/KNOWLEDGE.md` instead — it's injected into every agent prompt automatically and agents can append to it during execution.
|
|
104
104
|
|
|
105
|
+
- `language`: preferred response language for all GSD interactions. Accepts any language name or code — `"Chinese"`, `"zh"`, `"German"`, `"de"`, `"日本語"`, etc. When set, GSD injects "Always respond in \<language\>" into every agent's system prompt, including after `/clear`. Quickest way to set it: `/gsd language <name>`. To clear: `/gsd language off`.
|
|
106
|
+
|
|
105
107
|
- `models`: per-stage model selection (applies to both auto-mode and guided-flow dispatches). Keys: `research`, `planning`, `discuss`, `execution`, `execution_simple`, `completion`, `validation`, `subagent`. Values can be:
|
|
106
108
|
- Simple string: `"claude-sonnet-4-6"` — single model, no fallbacks
|
|
107
109
|
- Provider-qualified string: `"bedrock/claude-sonnet-4-6"` — targets a specific provider when the same model ID exists across multiple providers
|