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
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// GSD2 — Ecosystem Extension API wrapper
|
|
2
|
+
// Wraps pi's ExtensionAPI to expose typed GSD context (phase + active unit)
|
|
3
|
+
// to extensions loaded from `./.gsd/extensions/`. The wrapper intercepts only
|
|
4
|
+
// `on("before_agent_start", ...)` so GSD can dispatch ecosystem handlers AFTER
|
|
5
|
+
// refreshing state — fixing the load-order race where third-party
|
|
6
|
+
// `.pi/extensions/` handlers see a stale module-level snapshot (#3338).
|
|
7
|
+
//
|
|
8
|
+
// SINGLE-SESSION INVARIANT: the module-level `_snapshot` is per-process.
|
|
9
|
+
// Worktree or project switches do NOT reload extensions, matching pi's
|
|
10
|
+
// `.pi/extensions/` behavior. Only re-launching the CLI rebinds the snapshot.
|
|
11
|
+
|
|
12
|
+
import type {
|
|
13
|
+
BeforeAgentStartEvent,
|
|
14
|
+
ExtensionAPI,
|
|
15
|
+
ExtensionHandler,
|
|
16
|
+
} from "@gsd/pi-coding-agent";
|
|
17
|
+
|
|
18
|
+
// Structural mirror of pi's internal BeforeAgentStartEventResult. The internal
|
|
19
|
+
// type is not re-exported from the package root, and constraint #3 forbids
|
|
20
|
+
// changes to packages/pi-coding-agent/, so we mirror the public shape here.
|
|
21
|
+
// `any` on inner fields keeps assignability bidirectional with pi's stricter
|
|
22
|
+
// `Pick<CustomMessage, ...>` shape (CustomMessage is also not re-exported).
|
|
23
|
+
// Source of truth: packages/pi-coding-agent/src/core/extensions/types.ts
|
|
24
|
+
export interface BeforeAgentStartEventResult {
|
|
25
|
+
message?: {
|
|
26
|
+
customType: string;
|
|
27
|
+
content?: any;
|
|
28
|
+
display?: any;
|
|
29
|
+
details?: any;
|
|
30
|
+
};
|
|
31
|
+
systemPrompt?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
import type { GSDActiveUnit, GSDState, Phase } from "../types.js";
|
|
35
|
+
import { isGSDActive, getCurrentPhase } from "../../shared/gsd-phase-state.js";
|
|
36
|
+
import { logWarning } from "../workflow-logger.js";
|
|
37
|
+
|
|
38
|
+
// ─── Public Interface ───────────────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
export interface GSDExtensionAPI extends ExtensionAPI {
|
|
41
|
+
/** Current GSD workflow phase, or null if no project state. */
|
|
42
|
+
getPhase(): Phase | null;
|
|
43
|
+
/** Currently active milestone/slice/task triple, or null if none. */
|
|
44
|
+
getActiveUnit(): GSDActiveUnit | null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type GSDEcosystemBeforeAgentStartHandler = ExtensionHandler<
|
|
48
|
+
BeforeAgentStartEvent,
|
|
49
|
+
BeforeAgentStartEventResult
|
|
50
|
+
>;
|
|
51
|
+
|
|
52
|
+
// ─── Auto-loop phase mapping ────────────────────────────────────────────
|
|
53
|
+
|
|
54
|
+
const AUTO_LOOP_PHASE_MAP: Record<string, Phase> = {
|
|
55
|
+
"plan-milestone": "planning",
|
|
56
|
+
"plan-slice": "planning",
|
|
57
|
+
"research": "researching",
|
|
58
|
+
"discuss": "discussing",
|
|
59
|
+
"execute-task": "executing",
|
|
60
|
+
"verify": "verifying",
|
|
61
|
+
"summarize-task": "summarizing",
|
|
62
|
+
"summarize-slice": "summarizing",
|
|
63
|
+
"advance": "advancing",
|
|
64
|
+
"validate-milestone": "validating-milestone",
|
|
65
|
+
"complete-milestone": "completing-milestone",
|
|
66
|
+
"replan-slice": "replanning-slice",
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** Exposed for unit tests. Returns null for unknown keys (does NOT default). */
|
|
70
|
+
export function mapAutoLoopPhase(raw: string): Phase | null {
|
|
71
|
+
return AUTO_LOOP_PHASE_MAP[raw] ?? null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function resolvePhase(state: GSDState | null): Phase | null {
|
|
75
|
+
if (!state) return null;
|
|
76
|
+
if (isGSDActive()) {
|
|
77
|
+
const raw = getCurrentPhase();
|
|
78
|
+
if (raw != null) {
|
|
79
|
+
const mapped = AUTO_LOOP_PHASE_MAP[raw];
|
|
80
|
+
if (mapped) return mapped;
|
|
81
|
+
logWarning("ecosystem", `unknown auto-loop phase: ${raw}`);
|
|
82
|
+
// FALL THROUGH to state.phase rather than defaulting to "executing".
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return state.phase;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function resolveActiveUnit(state: GSDState | null): GSDActiveUnit | null {
|
|
89
|
+
if (!state) return null;
|
|
90
|
+
const m = state.activeMilestone;
|
|
91
|
+
const s = state.activeSlice;
|
|
92
|
+
const t = state.activeTask;
|
|
93
|
+
if (!m || !s || !t) return null;
|
|
94
|
+
return {
|
|
95
|
+
milestoneId: m.id,
|
|
96
|
+
milestoneTitle: m.title,
|
|
97
|
+
sliceId: s.id,
|
|
98
|
+
sliceTitle: s.title,
|
|
99
|
+
taskId: t.id,
|
|
100
|
+
taskTitle: t.title,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ─── Module-level snapshot ──────────────────────────────────────────────
|
|
105
|
+
|
|
106
|
+
interface Snapshot {
|
|
107
|
+
phase: Phase | null;
|
|
108
|
+
activeUnit: GSDActiveUnit | null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let _snapshot: Snapshot = { phase: null, activeUnit: null };
|
|
112
|
+
|
|
113
|
+
/** Refresh the snapshot from a freshly derived GSDState (or null on failure). */
|
|
114
|
+
export function updateSnapshot(state: GSDState | null): void {
|
|
115
|
+
_snapshot = {
|
|
116
|
+
phase: resolvePhase(state),
|
|
117
|
+
activeUnit: resolveActiveUnit(state),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function getSnapshotPhase(): Phase | null {
|
|
122
|
+
return _snapshot.phase;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function getSnapshotActiveUnit(): GSDActiveUnit | null {
|
|
126
|
+
return _snapshot.activeUnit;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Test-only: reset the snapshot to its initial empty state. */
|
|
130
|
+
export function _resetSnapshot(): void {
|
|
131
|
+
_snapshot = { phase: null, activeUnit: null };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ─── Wrapper factory ────────────────────────────────────────────────────
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Build a GSDExtensionAPI by manually delegating every ExtensionAPI method
|
|
138
|
+
* to the underlying pi instance, except `on("before_agent_start", ...)`
|
|
139
|
+
* which is captured into `sharedHandlers` for GSD-owned dispatch.
|
|
140
|
+
*
|
|
141
|
+
* Uses `satisfies GSDExtensionAPI` (NOT `as`) so TypeScript catches drift
|
|
142
|
+
* when pi adds new ExtensionAPI methods.
|
|
143
|
+
*/
|
|
144
|
+
export function createGSDExtensionAPI(
|
|
145
|
+
pi: ExtensionAPI,
|
|
146
|
+
sharedHandlers: GSDEcosystemBeforeAgentStartHandler[],
|
|
147
|
+
): GSDExtensionAPI {
|
|
148
|
+
const wrapper = {
|
|
149
|
+
// ── Event subscription (single intercept point) ────────────────────
|
|
150
|
+
on(event: any, handler: any): void {
|
|
151
|
+
if (event === "before_agent_start") {
|
|
152
|
+
sharedHandlers.push(handler as GSDEcosystemBeforeAgentStartHandler);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
(pi.on as (e: any, h: any) => void)(event, handler);
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
// ── Event emission ─────────────────────────────────────────────────
|
|
159
|
+
emitBeforeModelSelect: (...args: Parameters<ExtensionAPI["emitBeforeModelSelect"]>) =>
|
|
160
|
+
pi.emitBeforeModelSelect(...args),
|
|
161
|
+
emitAdjustToolSet: (...args: Parameters<ExtensionAPI["emitAdjustToolSet"]>) =>
|
|
162
|
+
pi.emitAdjustToolSet(...args),
|
|
163
|
+
|
|
164
|
+
// ── Tool / command / shortcut / flag registration ──────────────────
|
|
165
|
+
registerTool: ((tool: any) => pi.registerTool(tool)) as ExtensionAPI["registerTool"],
|
|
166
|
+
registerCommand: (...args: Parameters<ExtensionAPI["registerCommand"]>) =>
|
|
167
|
+
pi.registerCommand(...args),
|
|
168
|
+
registerBeforeInstall: (...args: Parameters<ExtensionAPI["registerBeforeInstall"]>) =>
|
|
169
|
+
pi.registerBeforeInstall(...args),
|
|
170
|
+
registerAfterInstall: (...args: Parameters<ExtensionAPI["registerAfterInstall"]>) =>
|
|
171
|
+
pi.registerAfterInstall(...args),
|
|
172
|
+
registerBeforeRemove: (...args: Parameters<ExtensionAPI["registerBeforeRemove"]>) =>
|
|
173
|
+
pi.registerBeforeRemove(...args),
|
|
174
|
+
registerAfterRemove: (...args: Parameters<ExtensionAPI["registerAfterRemove"]>) =>
|
|
175
|
+
pi.registerAfterRemove(...args),
|
|
176
|
+
registerShortcut: (...args: Parameters<ExtensionAPI["registerShortcut"]>) =>
|
|
177
|
+
pi.registerShortcut(...args),
|
|
178
|
+
registerFlag: (...args: Parameters<ExtensionAPI["registerFlag"]>) =>
|
|
179
|
+
pi.registerFlag(...args),
|
|
180
|
+
getFlag: (...args: Parameters<ExtensionAPI["getFlag"]>) => pi.getFlag(...args),
|
|
181
|
+
|
|
182
|
+
// ── Message rendering ──────────────────────────────────────────────
|
|
183
|
+
registerMessageRenderer: ((customType: string, renderer: any) =>
|
|
184
|
+
pi.registerMessageRenderer(customType, renderer)) as ExtensionAPI["registerMessageRenderer"],
|
|
185
|
+
|
|
186
|
+
// ── Actions ────────────────────────────────────────────────────────
|
|
187
|
+
sendMessage: ((message: any, options?: any) =>
|
|
188
|
+
pi.sendMessage(message, options)) as ExtensionAPI["sendMessage"],
|
|
189
|
+
sendUserMessage: (...args: Parameters<ExtensionAPI["sendUserMessage"]>) =>
|
|
190
|
+
pi.sendUserMessage(...args),
|
|
191
|
+
retryLastTurn: () => pi.retryLastTurn(),
|
|
192
|
+
appendEntry: ((customType: string, data?: any) =>
|
|
193
|
+
pi.appendEntry(customType, data)) as ExtensionAPI["appendEntry"],
|
|
194
|
+
|
|
195
|
+
// ── Session metadata ───────────────────────────────────────────────
|
|
196
|
+
setSessionName: (...args: Parameters<ExtensionAPI["setSessionName"]>) =>
|
|
197
|
+
pi.setSessionName(...args),
|
|
198
|
+
getSessionName: () => pi.getSessionName(),
|
|
199
|
+
setLabel: (...args: Parameters<ExtensionAPI["setLabel"]>) => pi.setLabel(...args),
|
|
200
|
+
exec: (...args: Parameters<ExtensionAPI["exec"]>) => pi.exec(...args),
|
|
201
|
+
getActiveTools: () => pi.getActiveTools(),
|
|
202
|
+
getAllTools: () => pi.getAllTools(),
|
|
203
|
+
setActiveTools: (...args: Parameters<ExtensionAPI["setActiveTools"]>) =>
|
|
204
|
+
pi.setActiveTools(...args),
|
|
205
|
+
getCommands: () => pi.getCommands(),
|
|
206
|
+
|
|
207
|
+
// ── Model & thinking ───────────────────────────────────────────────
|
|
208
|
+
setModel: (...args: Parameters<ExtensionAPI["setModel"]>) => pi.setModel(...args),
|
|
209
|
+
getThinkingLevel: () => pi.getThinkingLevel(),
|
|
210
|
+
setThinkingLevel: (...args: Parameters<ExtensionAPI["setThinkingLevel"]>) =>
|
|
211
|
+
pi.setThinkingLevel(...args),
|
|
212
|
+
|
|
213
|
+
// ── Provider registration ──────────────────────────────────────────
|
|
214
|
+
registerProvider: (...args: Parameters<ExtensionAPI["registerProvider"]>) =>
|
|
215
|
+
pi.registerProvider(...args),
|
|
216
|
+
unregisterProvider: (...args: Parameters<ExtensionAPI["unregisterProvider"]>) =>
|
|
217
|
+
pi.unregisterProvider(...args),
|
|
218
|
+
|
|
219
|
+
// ── Shared event bus (passthrough property) ────────────────────────
|
|
220
|
+
events: pi.events,
|
|
221
|
+
|
|
222
|
+
// ── GSD-specific additions ─────────────────────────────────────────
|
|
223
|
+
getPhase: (): Phase | null => _snapshot.phase,
|
|
224
|
+
getActiveUnit: (): GSDActiveUnit | null => _snapshot.activeUnit,
|
|
225
|
+
} satisfies GSDExtensionAPI;
|
|
226
|
+
|
|
227
|
+
return wrapper;
|
|
228
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// GSD2 — Ecosystem extension loader for ./.gsd/extensions/
|
|
2
|
+
// Discovers and registers single-file extensions that consume GSDExtensionAPI.
|
|
3
|
+
// Trust-gated (mirrors pi's `.pi/extensions/` model) and isolated from pi's
|
|
4
|
+
// own loader chain — handlers run in GSD's own dispatch step, not pi's.
|
|
5
|
+
|
|
6
|
+
import * as fs from "node:fs";
|
|
7
|
+
import * as path from "node:path";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
9
|
+
|
|
10
|
+
import type { ExtensionAPI } from "@gsd/pi-coding-agent";
|
|
11
|
+
import { getAgentDir } from "@gsd/pi-coding-agent";
|
|
12
|
+
|
|
13
|
+
import { logWarning } from "../workflow-logger.js";
|
|
14
|
+
import {
|
|
15
|
+
createGSDExtensionAPI,
|
|
16
|
+
type GSDEcosystemBeforeAgentStartHandler,
|
|
17
|
+
type GSDExtensionAPI,
|
|
18
|
+
} from "./gsd-extension-api.js";
|
|
19
|
+
|
|
20
|
+
// ─── Trust check (inlined; pi does not export isProjectTrusted from its
|
|
21
|
+
// package root, and constraint forbids modifying packages/pi-coding-agent/) ─
|
|
22
|
+
|
|
23
|
+
const TRUSTED_PROJECTS_FILE = "trusted-projects.json";
|
|
24
|
+
|
|
25
|
+
function isProjectTrusted(projectPath: string, agentDir: string): boolean {
|
|
26
|
+
const canonical = path.resolve(projectPath);
|
|
27
|
+
const trustedPath = path.join(agentDir, TRUSTED_PROJECTS_FILE);
|
|
28
|
+
try {
|
|
29
|
+
const content = fs.readFileSync(trustedPath, "utf-8");
|
|
30
|
+
const parsed = JSON.parse(content);
|
|
31
|
+
if (Array.isArray(parsed)) {
|
|
32
|
+
return parsed.includes(canonical);
|
|
33
|
+
}
|
|
34
|
+
} catch {
|
|
35
|
+
// missing or malformed — treat as untrusted
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ─── Ready-promise singleton ────────────────────────────────────────────
|
|
41
|
+
|
|
42
|
+
let _readyPromise: Promise<void> | null = null;
|
|
43
|
+
let _untrustedWarned = false;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Discover and register ecosystem extensions from `./.gsd/extensions/`.
|
|
47
|
+
* Idempotent: subsequent calls with the same arguments return the same
|
|
48
|
+
* pending promise (no double-load).
|
|
49
|
+
*/
|
|
50
|
+
export function loadEcosystemExtensions(
|
|
51
|
+
pi: ExtensionAPI,
|
|
52
|
+
sharedHandlers: GSDEcosystemBeforeAgentStartHandler[],
|
|
53
|
+
cwd: string = process.cwd(),
|
|
54
|
+
): Promise<void> {
|
|
55
|
+
if (_readyPromise) return _readyPromise;
|
|
56
|
+
_readyPromise = _loadEcosystemExtensionsImpl(pi, sharedHandlers, cwd);
|
|
57
|
+
return _readyPromise;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns a promise that resolves when ecosystem loading has completed.
|
|
62
|
+
* If loading was never kicked off this returns a resolved promise so the
|
|
63
|
+
* `before_agent_start` handler can `await` unconditionally.
|
|
64
|
+
*/
|
|
65
|
+
export function getEcosystemReadyPromise(): Promise<void> {
|
|
66
|
+
return _readyPromise ?? Promise.resolve();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Test-only: clear the singleton so tests can re-run loading. */
|
|
70
|
+
export function _resetEcosystemLoader(): void {
|
|
71
|
+
_readyPromise = null;
|
|
72
|
+
_untrustedWarned = false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ─── Implementation ─────────────────────────────────────────────────────
|
|
76
|
+
|
|
77
|
+
async function _loadEcosystemExtensionsImpl(
|
|
78
|
+
pi: ExtensionAPI,
|
|
79
|
+
sharedHandlers: GSDEcosystemBeforeAgentStartHandler[],
|
|
80
|
+
cwd: string,
|
|
81
|
+
): Promise<void> {
|
|
82
|
+
const extDir = path.join(cwd, ".gsd", "extensions");
|
|
83
|
+
if (!fs.existsSync(extDir)) return;
|
|
84
|
+
|
|
85
|
+
// Trust gate: refuse to load arbitrary code from untrusted project dirs.
|
|
86
|
+
if (!isProjectTrusted(cwd, getAgentDir())) {
|
|
87
|
+
if (!_untrustedWarned) {
|
|
88
|
+
_untrustedWarned = true;
|
|
89
|
+
logWarning(
|
|
90
|
+
"ecosystem",
|
|
91
|
+
".gsd/extensions present but project is not trusted — skipping ecosystem extensions. Run `pi trust` to opt in.",
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Resolve realpath ONCE so symlink-escape detection has a stable anchor.
|
|
98
|
+
let realExtDir: string;
|
|
99
|
+
try {
|
|
100
|
+
realExtDir = fs.realpathSync(extDir);
|
|
101
|
+
} catch (err) {
|
|
102
|
+
logWarning(
|
|
103
|
+
"ecosystem",
|
|
104
|
+
`failed to resolve extensions dir: ${err instanceof Error ? err.message : String(err)}`,
|
|
105
|
+
);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let entries: string[];
|
|
110
|
+
try {
|
|
111
|
+
entries = fs
|
|
112
|
+
.readdirSync(extDir)
|
|
113
|
+
.filter((f) => f.endsWith(".js") || f.endsWith(".ts"))
|
|
114
|
+
.sort(); // deterministic load order
|
|
115
|
+
} catch (err) {
|
|
116
|
+
logWarning(
|
|
117
|
+
"ecosystem",
|
|
118
|
+
`failed to read extensions dir: ${err instanceof Error ? err.message : String(err)}`,
|
|
119
|
+
);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// The wrapper api is built once per loader run and shared by all extensions
|
|
124
|
+
// so they all read from the same module-level snapshot.
|
|
125
|
+
const api: GSDExtensionAPI = createGSDExtensionAPI(pi, sharedHandlers);
|
|
126
|
+
|
|
127
|
+
for (const entry of entries) {
|
|
128
|
+
await _loadOne(extDir, realExtDir, entry, api);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function _loadOne(
|
|
133
|
+
extDir: string,
|
|
134
|
+
realExtDir: string,
|
|
135
|
+
entry: string,
|
|
136
|
+
api: GSDExtensionAPI,
|
|
137
|
+
): Promise<void> {
|
|
138
|
+
const fullPath = path.join(extDir, entry);
|
|
139
|
+
|
|
140
|
+
// Symlink-escape guard: reject entries whose realpath is not under realExtDir.
|
|
141
|
+
let realFullPath: string;
|
|
142
|
+
try {
|
|
143
|
+
realFullPath = fs.realpathSync(fullPath);
|
|
144
|
+
} catch (err) {
|
|
145
|
+
logWarning(
|
|
146
|
+
"ecosystem",
|
|
147
|
+
`failed to resolve ${entry}: ${err instanceof Error ? err.message : String(err)}`,
|
|
148
|
+
);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const realExtDirWithSep = realExtDir.endsWith(path.sep) ? realExtDir : realExtDir + path.sep;
|
|
152
|
+
if (
|
|
153
|
+
realFullPath !== realExtDir &&
|
|
154
|
+
!realFullPath.startsWith(realExtDirWithSep)
|
|
155
|
+
) {
|
|
156
|
+
logWarning("ecosystem", `rejecting ${entry}: realpath escapes extensions dir`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// For .ts files, require a sibling compiled .js — we do not run a TS loader
|
|
161
|
+
// in production. Drop mtime heuristics: if .js exists, prefer it; otherwise warn.
|
|
162
|
+
let importPath = realFullPath;
|
|
163
|
+
if (entry.endsWith(".ts")) {
|
|
164
|
+
const jsSibling = realFullPath.slice(0, -3) + ".js";
|
|
165
|
+
if (fs.existsSync(jsSibling)) {
|
|
166
|
+
importPath = jsSibling;
|
|
167
|
+
} else {
|
|
168
|
+
logWarning(
|
|
169
|
+
"ecosystem",
|
|
170
|
+
`${entry}: TypeScript source has no compiled .js sibling — compile it first`,
|
|
171
|
+
);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
let mod: any;
|
|
177
|
+
try {
|
|
178
|
+
mod = await import(pathToFileURL(importPath).href);
|
|
179
|
+
} catch (err) {
|
|
180
|
+
logWarning(
|
|
181
|
+
"ecosystem",
|
|
182
|
+
`failed to import ${entry}: ${err instanceof Error ? err.message : String(err)}`,
|
|
183
|
+
);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const factory = mod?.default;
|
|
188
|
+
if (typeof factory !== "function") {
|
|
189
|
+
logWarning("ecosystem", `${entry}: default export is not a function`);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
await factory(api);
|
|
195
|
+
} catch (err) {
|
|
196
|
+
logWarning(
|
|
197
|
+
"ecosystem",
|
|
198
|
+
`factory threw for ${entry}: ${err instanceof Error ? err.message : String(err)}`,
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -269,10 +269,12 @@ export function checkAutoStartAfterDiscuss(): boolean {
|
|
|
269
269
|
} catch (e) { logWarning("guided", `CONTEXT-DRAFT.md unlink failed: ${(e as Error).message}`); }
|
|
270
270
|
|
|
271
271
|
// Cleanup: remove discussion manifest after auto-start (only needed during discussion)
|
|
272
|
-
|
|
272
|
+
if (existsSync(manifestPath)) {
|
|
273
|
+
try { unlinkSync(manifestPath); } catch (e) { logWarning("guided", `manifest unlink failed: ${(e as Error).message}`); }
|
|
274
|
+
}
|
|
273
275
|
|
|
274
276
|
pendingAutoStartMap.delete(basePath);
|
|
275
|
-
ctx.ui.notify(`Milestone ${milestoneId} ready.`, "
|
|
277
|
+
ctx.ui.notify(`Milestone ${milestoneId} ready.`, "success");
|
|
276
278
|
startAutoDetached(ctx, pi, basePath, false, { step });
|
|
277
279
|
return true;
|
|
278
280
|
}
|
|
@@ -115,6 +115,7 @@ export const KNOWN_PREFERENCE_KEYS = new Set<string>([
|
|
|
115
115
|
"discuss_web_research",
|
|
116
116
|
"discuss_depth",
|
|
117
117
|
"flat_rate_providers",
|
|
118
|
+
"language",
|
|
118
119
|
]);
|
|
119
120
|
|
|
120
121
|
/** Canonical list of all dispatch unit types. */
|
|
@@ -403,6 +404,11 @@ export interface GSDPreferences {
|
|
|
403
404
|
* same regardless of model. Case-insensitive.
|
|
404
405
|
*/
|
|
405
406
|
flat_rate_providers?: string[];
|
|
407
|
+
/**
|
|
408
|
+
* Language preference for GSD responses. Accepts any language name or code
|
|
409
|
+
* (e.g. "Chinese", "zh", "German", "de", "日本語"). Persists across /clear.
|
|
410
|
+
*/
|
|
411
|
+
language?: string;
|
|
406
412
|
}
|
|
407
413
|
|
|
408
414
|
export interface LoadedGSDPreferences {
|
|
@@ -1107,5 +1107,15 @@ export function validatePreferences(preferences: GSDPreferences): {
|
|
|
1107
1107
|
}
|
|
1108
1108
|
}
|
|
1109
1109
|
|
|
1110
|
+
// ─── Language ────────────────────────────────────────────────────────
|
|
1111
|
+
if (preferences.language !== undefined) {
|
|
1112
|
+
const trimmed = typeof preferences.language === "string" ? preferences.language.trim() : undefined;
|
|
1113
|
+
if (trimmed && trimmed.length <= 50 && !/[\r\n]/.test(trimmed)) {
|
|
1114
|
+
validated.language = trimmed;
|
|
1115
|
+
} else {
|
|
1116
|
+
errors.push(`language must be a non-empty string up to 50 characters with no newlines (e.g. "Chinese", "de", "日本語")`);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1110
1120
|
return { preferences: validated, errors, warnings };
|
|
1111
1121
|
}
|
|
@@ -447,6 +447,7 @@ function mergePreferences(base: GSDPreferences, override: GSDPreferences): GSDPr
|
|
|
447
447
|
slice_parallel: (base.slice_parallel || override.slice_parallel)
|
|
448
448
|
? { ...(base.slice_parallel ?? {}), ...(override.slice_parallel ?? {}) }
|
|
449
449
|
: undefined,
|
|
450
|
+
language: override.language ?? base.language,
|
|
450
451
|
};
|
|
451
452
|
}
|
|
452
453
|
|
|
@@ -562,6 +563,11 @@ export function renderPreferencesForSystemPrompt(preferences: GSDPreferences, re
|
|
|
562
563
|
}
|
|
563
564
|
}
|
|
564
565
|
|
|
566
|
+
if (preferences.language) {
|
|
567
|
+
const safeLang = preferences.language.replace(/[\r\n]/g, " ").slice(0, 50);
|
|
568
|
+
lines.push(`- Language: Always respond in ${safeLang}.`);
|
|
569
|
+
}
|
|
570
|
+
|
|
565
571
|
return lines.join("\n");
|
|
566
572
|
}
|
|
567
573
|
|
|
@@ -68,11 +68,11 @@ export function getFilePaths(): string[] {
|
|
|
68
68
|
* Record a tool call at dispatch time (before execution).
|
|
69
69
|
* Exit codes and output are filled in by recordToolResult after execution.
|
|
70
70
|
*/
|
|
71
|
-
export function recordToolCall(toolName: string, input: Record<string, unknown>): void {
|
|
71
|
+
export function recordToolCall(toolCallId: string, toolName: string, input: Record<string, unknown>): void {
|
|
72
72
|
if (toolName === "bash" || toolName === "Bash") {
|
|
73
73
|
unitEvidence.push({
|
|
74
74
|
kind: "bash",
|
|
75
|
-
toolCallId
|
|
75
|
+
toolCallId,
|
|
76
76
|
command: String(input.command ?? ""),
|
|
77
77
|
exitCode: -1,
|
|
78
78
|
outputSnippet: "",
|
|
@@ -81,14 +81,14 @@ export function recordToolCall(toolName: string, input: Record<string, unknown>)
|
|
|
81
81
|
} else if (toolName === "write" || toolName === "Write") {
|
|
82
82
|
unitEvidence.push({
|
|
83
83
|
kind: "write",
|
|
84
|
-
toolCallId
|
|
84
|
+
toolCallId,
|
|
85
85
|
path: String(input.file_path ?? input.path ?? ""),
|
|
86
86
|
timestamp: Date.now(),
|
|
87
87
|
});
|
|
88
88
|
} else if (toolName === "edit" || toolName === "Edit") {
|
|
89
89
|
unitEvidence.push({
|
|
90
90
|
kind: "edit",
|
|
91
|
-
toolCallId
|
|
91
|
+
toolCallId,
|
|
92
92
|
path: String(input.file_path ?? input.path ?? ""),
|
|
93
93
|
timestamp: Date.now(),
|
|
94
94
|
});
|
|
@@ -96,8 +96,9 @@ export function recordToolCall(toolName: string, input: Record<string, unknown>)
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Record a tool execution result. Matches the
|
|
100
|
-
*
|
|
99
|
+
* Record a tool execution result. Matches the entry by toolCallId (assigned
|
|
100
|
+
* at dispatch time) and fills in exit code + output. Prior versions matched
|
|
101
|
+
* by `kind + empty-string` which corrupted parallel tool calls.
|
|
101
102
|
*/
|
|
102
103
|
export function recordToolResult(
|
|
103
104
|
toolCallId: string,
|
|
@@ -105,36 +106,19 @@ export function recordToolResult(
|
|
|
105
106
|
result: unknown,
|
|
106
107
|
isError: boolean,
|
|
107
108
|
): void {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const exitMatch = text.match(/Command exited with code (\d+)/);
|
|
117
|
-
entry.exitCode = exitMatch ? Number(exitMatch[1]) : (isError ? 1 : 0);
|
|
118
|
-
}
|
|
119
|
-
} else if (normalizedName === "write" || normalizedName === "edit") {
|
|
120
|
-
const entry = findLastUnresolved(normalizedName as "write" | "edit");
|
|
121
|
-
if (entry) {
|
|
122
|
-
entry.toolCallId = toolCallId;
|
|
123
|
-
}
|
|
109
|
+
const entry = unitEvidence.find(e => e.toolCallId === toolCallId);
|
|
110
|
+
if (!entry) return;
|
|
111
|
+
|
|
112
|
+
if (entry.kind === "bash") {
|
|
113
|
+
const text = extractResultText(result);
|
|
114
|
+
entry.outputSnippet = text.slice(0, 500);
|
|
115
|
+
const exitMatch = text.match(/Command exited with code (\d+)/);
|
|
116
|
+
entry.exitCode = exitMatch ? Number(exitMatch[1]) : (isError ? 1 : 0);
|
|
124
117
|
}
|
|
125
118
|
}
|
|
126
119
|
|
|
127
120
|
// ─── Internals ──────────────────────────────────────────────────────────────
|
|
128
121
|
|
|
129
|
-
function findLastUnresolved(kind: string): EvidenceEntry | undefined {
|
|
130
|
-
for (let i = unitEvidence.length - 1; i >= 0; i--) {
|
|
131
|
-
if (unitEvidence[i].kind === kind && unitEvidence[i].toolCallId === "") {
|
|
132
|
-
return unitEvidence[i];
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
122
|
function extractResultText(result: unknown): string {
|
|
139
123
|
if (typeof result === "string") return result;
|
|
140
124
|
if (result && typeof result === "object") {
|