gsd-pi 2.74.0-dev.b741afb → 2.74.0-dev.ffbcc03
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/activity-log.js +16 -0
- package/dist/resources/extensions/gsd/auto/loop.js +147 -10
- package/dist/resources/extensions/gsd/auto/phases.js +113 -3
- package/dist/resources/extensions/gsd/auto/session.js +10 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +11 -1
- package/dist/resources/extensions/gsd/auto-model-selection.js +51 -5
- package/dist/resources/extensions/gsd/auto-post-unit.js +215 -8
- package/dist/resources/extensions/gsd/auto-recovery.js +24 -10
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +18 -0
- package/dist/resources/extensions/gsd/auto-verification.js +100 -2
- package/dist/resources/extensions/gsd/auto.js +28 -2
- 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/handlers/ops.js +5 -0
- package/dist/resources/extensions/gsd/commands-extract-learnings.js +225 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +14 -1
- 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/git-service.js +49 -1
- package/dist/resources/extensions/gsd/graph-context.js +98 -7
- package/dist/resources/extensions/gsd/gsd-db.js +260 -2
- package/dist/resources/extensions/gsd/guided-flow.js +24 -1
- package/dist/resources/extensions/gsd/init-wizard.js +1 -0
- package/dist/resources/extensions/gsd/journal.js +27 -0
- package/dist/resources/extensions/gsd/metrics.js +19 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +33 -1
- package/dist/resources/extensions/gsd/preferences-models.js +20 -3
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +108 -2
- package/dist/resources/extensions/gsd/preferences.js +26 -0
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +15 -30
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +12 -2
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +18 -0
- package/dist/resources/extensions/gsd/tools/complete-slice.js +5 -0
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +39 -4
- package/dist/resources/extensions/gsd/unit-ownership.js +1 -1
- package/dist/resources/extensions/gsd/uok/audit-toggle.js +7 -0
- package/dist/resources/extensions/gsd/uok/audit.js +40 -0
- package/dist/resources/extensions/gsd/uok/contracts.js +1 -0
- package/dist/resources/extensions/gsd/uok/execution-graph.js +179 -0
- package/dist/resources/extensions/gsd/uok/flags.js +29 -0
- package/dist/resources/extensions/gsd/uok/gate-runner.js +109 -0
- package/dist/resources/extensions/gsd/uok/gitops.js +53 -0
- package/dist/resources/extensions/gsd/uok/kernel.js +80 -0
- package/dist/resources/extensions/gsd/uok/loop-adapter.js +133 -0
- package/dist/resources/extensions/gsd/uok/model-policy.js +66 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +132 -0
- package/dist/resources/extensions/gsd/workflow-logger.js +22 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.js +3 -1
- 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 +9 -9
- 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 +9 -9
- 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/readers/graph.d.ts +1 -1
- package/packages/mcp-server/dist/readers/graph.d.ts.map +1 -1
- package/packages/mcp-server/dist/readers/graph.js +107 -0
- package/packages/mcp-server/dist/readers/graph.js.map +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/readers/graph.test.ts +178 -0
- package/packages/mcp-server/src/readers/graph.ts +148 -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 +472 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.js +52 -0
- package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +2 -2
- package/packages/pi-coding-agent/dist/core/model-registry.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 +23 -9
- 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 +232 -18
- 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 +612 -0
- package/packages/pi-coding-agent/src/core/model-registry-env-fallback.test.ts +59 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +2 -1
- 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 +25 -10
- 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 +298 -41
- 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/src/types/ambient-modules.d.ts +69 -0
- package/packages/pi-coding-agent/tsconfig.json +2 -2
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/gsd/activity-log.ts +21 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +4 -0
- package/src/resources/extensions/gsd/auto/loop.ts +159 -10
- package/src/resources/extensions/gsd/auto/phases.ts +123 -3
- package/src/resources/extensions/gsd/auto/session.ts +10 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +16 -6
- package/src/resources/extensions/gsd/auto-model-selection.ts +66 -5
- package/src/resources/extensions/gsd/auto-post-unit.ts +226 -9
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -9
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +25 -1
- package/src/resources/extensions/gsd/auto-verification.ts +129 -2
- package/src/resources/extensions/gsd/auto.ts +34 -2
- 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/handlers/ops.ts +5 -0
- package/src/resources/extensions/gsd/commands-extract-learnings.ts +304 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +14 -1
- 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/git-service.ts +68 -0
- package/src/resources/extensions/gsd/graph-context.ts +139 -12
- package/src/resources/extensions/gsd/gsd-db.ts +321 -3
- package/src/resources/extensions/gsd/guided-flow.ts +33 -1
- package/src/resources/extensions/gsd/init-wizard.ts +3 -2
- package/src/resources/extensions/gsd/journal.ts +30 -0
- package/src/resources/extensions/gsd/metrics.ts +26 -0
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +40 -1
- package/src/resources/extensions/gsd/preferences-models.ts +20 -3
- package/src/resources/extensions/gsd/preferences-types.ts +32 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +107 -2
- package/src/resources/extensions/gsd/preferences.ts +28 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +15 -31
- package/src/resources/extensions/gsd/session-lock.ts +14 -2
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +20 -1
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +18 -0
- package/src/resources/extensions/gsd/tests/artifacts-table-preserved-on-cache-invalidate.test.ts +177 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +272 -0
- package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +6 -2
- package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +340 -0
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +10 -7
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -2
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -3
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +40 -1
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +8 -5
- package/src/resources/extensions/gsd/tests/uok-audit-unified.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/uok-execution-graph.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/uok-flags.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/uok-gate-runner.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-wiring.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/uok-model-policy.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +167 -0
- package/src/resources/extensions/gsd/tests/uok-preferences.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +39 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +9 -2
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +48 -3
- package/src/resources/extensions/gsd/types.ts +14 -1
- package/src/resources/extensions/gsd/unit-ownership.ts +2 -2
- package/src/resources/extensions/gsd/uok/audit-toggle.ts +9 -0
- package/src/resources/extensions/gsd/uok/audit.ts +51 -0
- package/src/resources/extensions/gsd/uok/contracts.ts +135 -0
- package/src/resources/extensions/gsd/uok/execution-graph.ts +241 -0
- package/src/resources/extensions/gsd/uok/flags.ts +45 -0
- package/src/resources/extensions/gsd/uok/gate-runner.ts +146 -0
- package/src/resources/extensions/gsd/uok/gitops.ts +75 -0
- package/src/resources/extensions/gsd/uok/kernel.ts +105 -0
- package/src/resources/extensions/gsd/uok/loop-adapter.ts +162 -0
- package/src/resources/extensions/gsd/uok/model-policy.ts +112 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +156 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +27 -1
- package/src/resources/extensions/ttsr/ttsr-manager.ts +10 -5
- 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/{XnHY5eXUsTCFmNodWHetD → kn6xzWKYnogsxp2b6RpDD}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{XnHY5eXUsTCFmNodWHetD → kn6xzWKYnogsxp2b6RpDD}/_ssgManifest.js +0 -0
|
@@ -13,6 +13,8 @@ import { join } from "node:path";
|
|
|
13
13
|
import { GSDError, GSD_IO_ERROR } from "./errors.js";
|
|
14
14
|
const SEQ_PREFIX_RE = /^(\d+)-/;
|
|
15
15
|
import { gsdRoot } from "./paths.js";
|
|
16
|
+
import { buildAuditEnvelope, emitUokAuditEvent } from "./uok/audit.js";
|
|
17
|
+
import { isUnifiedAuditEnabled } from "./uok/audit-toggle.js";
|
|
16
18
|
const activityLogState = new Map();
|
|
17
19
|
/**
|
|
18
20
|
* Clear accumulated activity log state (#611).
|
|
@@ -110,6 +112,20 @@ export function saveActivityLog(ctx, basePath, unitType, unitId) {
|
|
|
110
112
|
}
|
|
111
113
|
state.nextSeq += 1;
|
|
112
114
|
state.lastSnapshotKeyByUnit.set(unitKey, key);
|
|
115
|
+
if (isUnifiedAuditEnabled()) {
|
|
116
|
+
emitUokAuditEvent(basePath, buildAuditEnvelope({
|
|
117
|
+
traceId: `activity:${unitType}:${unitId}`,
|
|
118
|
+
turnId: unitId,
|
|
119
|
+
category: "execution",
|
|
120
|
+
type: "activity-log-saved",
|
|
121
|
+
payload: {
|
|
122
|
+
unitType,
|
|
123
|
+
unitId,
|
|
124
|
+
filePath,
|
|
125
|
+
entryCount: entries.length,
|
|
126
|
+
},
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
113
129
|
return filePath;
|
|
114
130
|
}
|
|
115
131
|
catch (e) {
|
|
@@ -15,6 +15,8 @@ import { isInfrastructureError, isTransientCooldownError, getCooldownRetryAfterM
|
|
|
15
15
|
import { resolveEngine } from "../engine-resolver.js";
|
|
16
16
|
import { logWarning } from "../workflow-logger.js";
|
|
17
17
|
import { gsdRoot } from "../paths.js";
|
|
18
|
+
import { resolveUokFlags } from "../uok/flags.js";
|
|
19
|
+
import { scheduleSidecarQueue } from "../uok/execution-graph.js";
|
|
18
20
|
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
19
21
|
import { join } from "node:path";
|
|
20
22
|
// ── Stuck detection persistence (#3704) ──────────────────────────────────
|
|
@@ -104,6 +106,40 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
104
106
|
const flowId = randomUUID();
|
|
105
107
|
let seqCounter = 0;
|
|
106
108
|
const nextSeq = () => ++seqCounter;
|
|
109
|
+
const turnId = randomUUID();
|
|
110
|
+
s.currentTraceId = flowId;
|
|
111
|
+
s.currentTurnId = turnId;
|
|
112
|
+
const turnStartedAt = new Date().toISOString();
|
|
113
|
+
let observedUnitType;
|
|
114
|
+
let observedUnitId;
|
|
115
|
+
let turnFinished = false;
|
|
116
|
+
const finishTurn = (status, failureClass = "none", error) => {
|
|
117
|
+
if (turnFinished)
|
|
118
|
+
return;
|
|
119
|
+
turnFinished = true;
|
|
120
|
+
deps.uokObserver?.onTurnResult({
|
|
121
|
+
traceId: flowId,
|
|
122
|
+
turnId,
|
|
123
|
+
iteration,
|
|
124
|
+
unitType: observedUnitType,
|
|
125
|
+
unitId: observedUnitId,
|
|
126
|
+
status,
|
|
127
|
+
failureClass,
|
|
128
|
+
phaseResults: [],
|
|
129
|
+
error,
|
|
130
|
+
startedAt: turnStartedAt,
|
|
131
|
+
finishedAt: new Date().toISOString(),
|
|
132
|
+
});
|
|
133
|
+
s.currentTraceId = null;
|
|
134
|
+
s.currentTurnId = null;
|
|
135
|
+
};
|
|
136
|
+
deps.uokObserver?.onTurnStart({
|
|
137
|
+
traceId: flowId,
|
|
138
|
+
turnId,
|
|
139
|
+
iteration,
|
|
140
|
+
basePath: s.basePath,
|
|
141
|
+
startedAt: turnStartedAt,
|
|
142
|
+
});
|
|
107
143
|
if (iteration > MAX_LOOP_ITERATIONS) {
|
|
108
144
|
debugLog("autoLoop", {
|
|
109
145
|
phase: "exit",
|
|
@@ -111,6 +147,7 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
111
147
|
iteration,
|
|
112
148
|
});
|
|
113
149
|
await deps.stopAuto(ctx, pi, `Safety: loop exceeded ${MAX_LOOP_ITERATIONS} iterations — possible runaway`);
|
|
150
|
+
finishTurn("stopped", "manual-attention", "max-iterations");
|
|
114
151
|
break;
|
|
115
152
|
}
|
|
116
153
|
// ── Memory pressure check (#3331) ──
|
|
@@ -123,19 +160,30 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
123
160
|
await deps.stopAuto(ctx, pi, `Memory pressure: heap at ${mem.heapMB}MB / ${mem.limitMB}MB (${Math.round(mem.pct * 100)}%). ` +
|
|
124
161
|
`Stopping gracefully to prevent OOM kill after ${iteration} iterations. ` +
|
|
125
162
|
`Resume with /gsd auto to continue from where you left off.`);
|
|
163
|
+
finishTurn("stopped", "timeout", "memory-pressure");
|
|
126
164
|
break;
|
|
127
165
|
}
|
|
128
166
|
}
|
|
129
167
|
if (!s.cmdCtx) {
|
|
130
168
|
debugLog("autoLoop", { phase: "exit", reason: "no-cmdCtx" });
|
|
169
|
+
finishTurn("stopped", "manual-attention", "missing-command-context");
|
|
131
170
|
break;
|
|
132
171
|
}
|
|
133
172
|
try {
|
|
134
173
|
// ── Blanket try/catch: one bad iteration must not kill the session
|
|
135
174
|
const prefs = deps.loadEffectiveGSDPreferences()?.preferences;
|
|
175
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
136
176
|
// ── Check sidecar queue before deriveState ──
|
|
137
177
|
let sidecarItem;
|
|
138
178
|
if (s.sidecarQueue.length > 0) {
|
|
179
|
+
if (uokFlags.executionGraph && s.sidecarQueue.length > 1) {
|
|
180
|
+
try {
|
|
181
|
+
s.sidecarQueue = await scheduleSidecarQueue(s.sidecarQueue);
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
logWarning("dispatch", `sidecar queue scheduling failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
139
187
|
sidecarItem = s.sidecarQueue.shift();
|
|
140
188
|
debugLog("autoLoop", {
|
|
141
189
|
phase: "sidecar-dequeue",
|
|
@@ -210,25 +258,49 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
210
258
|
isRetry: false,
|
|
211
259
|
previousTier: undefined,
|
|
212
260
|
};
|
|
261
|
+
observedUnitType = iterData.unitType;
|
|
262
|
+
observedUnitId = iterData.unitId;
|
|
213
263
|
// ── Progress widget (mirrors dev path in runDispatch) ──
|
|
214
264
|
deps.updateProgressWidget(ctx, iterData.unitType, iterData.unitId, iterData.state);
|
|
215
265
|
// ── Guards (shared with dev path) ──
|
|
216
266
|
const guardsResult = await runGuards(ic, s.currentMilestoneId ?? "workflow");
|
|
217
|
-
|
|
267
|
+
deps.uokObserver?.onPhaseResult("guard", guardsResult.action, {
|
|
268
|
+
unitType: iterData.unitType,
|
|
269
|
+
unitId: iterData.unitId,
|
|
270
|
+
});
|
|
271
|
+
if (guardsResult.action === "break") {
|
|
272
|
+
finishTurn("stopped", "manual-attention", "guard-break");
|
|
218
273
|
break;
|
|
274
|
+
}
|
|
219
275
|
// ── Unit execution (shared with dev path) ──
|
|
220
276
|
const unitPhaseResult = await runUnitPhase(ic, iterData, loopState);
|
|
221
|
-
|
|
277
|
+
deps.uokObserver?.onPhaseResult("unit", unitPhaseResult.action, {
|
|
278
|
+
unitType: iterData.unitType,
|
|
279
|
+
unitId: iterData.unitId,
|
|
280
|
+
});
|
|
281
|
+
if (unitPhaseResult.action === "break") {
|
|
282
|
+
finishTurn("stopped", "execution", "unit-break");
|
|
222
283
|
break;
|
|
284
|
+
}
|
|
223
285
|
// ── Verify first, then reconcile (only mark complete on pass) ──
|
|
224
286
|
debugLog("autoLoop", { phase: "custom-engine-verify", iteration, unitId: iterData.unitId });
|
|
225
287
|
const verifyResult = await policy.verify(iterData.unitType, iterData.unitId, { basePath: s.basePath });
|
|
226
288
|
if (verifyResult === "pause") {
|
|
227
289
|
await deps.pauseAuto(ctx, pi);
|
|
290
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "pause", {
|
|
291
|
+
unitType: iterData.unitType,
|
|
292
|
+
unitId: iterData.unitId,
|
|
293
|
+
});
|
|
294
|
+
finishTurn("paused", "manual-attention", "custom-engine-verify-pause");
|
|
228
295
|
break;
|
|
229
296
|
}
|
|
230
297
|
if (verifyResult === "retry") {
|
|
231
298
|
debugLog("autoLoop", { phase: "custom-engine-verify-retry", iteration, unitId: iterData.unitId });
|
|
299
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "retry", {
|
|
300
|
+
unitType: iterData.unitType,
|
|
301
|
+
unitId: iterData.unitId,
|
|
302
|
+
});
|
|
303
|
+
finishTurn("retry");
|
|
232
304
|
continue;
|
|
233
305
|
}
|
|
234
306
|
// Verification passed — mark step complete
|
|
@@ -248,37 +320,73 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
248
320
|
debugLog("autoLoop", { phase: "iteration-complete", iteration });
|
|
249
321
|
if (reconcileResult.outcome === "milestone-complete") {
|
|
250
322
|
await deps.stopAuto(ctx, pi, "Workflow complete");
|
|
323
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "milestone-complete", {
|
|
324
|
+
unitType: iterData.unitType,
|
|
325
|
+
unitId: iterData.unitId,
|
|
326
|
+
});
|
|
327
|
+
finishTurn("completed");
|
|
251
328
|
break;
|
|
252
329
|
}
|
|
253
330
|
if (reconcileResult.outcome === "pause") {
|
|
254
331
|
await deps.pauseAuto(ctx, pi);
|
|
332
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "pause", {
|
|
333
|
+
unitType: iterData.unitType,
|
|
334
|
+
unitId: iterData.unitId,
|
|
335
|
+
});
|
|
336
|
+
finishTurn("paused", "manual-attention");
|
|
255
337
|
break;
|
|
256
338
|
}
|
|
257
339
|
if (reconcileResult.outcome === "stop") {
|
|
258
340
|
await deps.stopAuto(ctx, pi, reconcileResult.reason ?? "Engine stopped");
|
|
341
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "stop", {
|
|
342
|
+
unitType: iterData.unitType,
|
|
343
|
+
unitId: iterData.unitId,
|
|
344
|
+
reason: reconcileResult.reason,
|
|
345
|
+
});
|
|
346
|
+
finishTurn("stopped", "manual-attention", reconcileResult.reason);
|
|
259
347
|
break;
|
|
260
348
|
}
|
|
349
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "continue", {
|
|
350
|
+
unitType: iterData.unitType,
|
|
351
|
+
unitId: iterData.unitId,
|
|
352
|
+
});
|
|
353
|
+
finishTurn("completed");
|
|
261
354
|
continue;
|
|
262
355
|
}
|
|
263
356
|
if (!sidecarItem) {
|
|
264
357
|
// ── Phase 1: Pre-dispatch ─────────────────────────────────────────
|
|
265
358
|
const preDispatchResult = await runPreDispatch(ic, loopState);
|
|
266
|
-
|
|
359
|
+
deps.uokObserver?.onPhaseResult("pre-dispatch", preDispatchResult.action);
|
|
360
|
+
if (preDispatchResult.action === "break") {
|
|
361
|
+
finishTurn("stopped", "manual-attention", "pre-dispatch-break");
|
|
267
362
|
break;
|
|
268
|
-
|
|
363
|
+
}
|
|
364
|
+
if (preDispatchResult.action === "continue") {
|
|
365
|
+
finishTurn("skipped");
|
|
269
366
|
continue;
|
|
367
|
+
}
|
|
270
368
|
const preData = preDispatchResult.data;
|
|
271
369
|
// ── Phase 2: Guards ───────────────────────────────────────────────
|
|
272
370
|
const guardsResult = await runGuards(ic, preData.mid);
|
|
273
|
-
|
|
371
|
+
deps.uokObserver?.onPhaseResult("guard", guardsResult.action);
|
|
372
|
+
if (guardsResult.action === "break") {
|
|
373
|
+
finishTurn("stopped", "manual-attention", "guard-break");
|
|
274
374
|
break;
|
|
375
|
+
}
|
|
275
376
|
// ── Phase 3: Dispatch ─────────────────────────────────────────────
|
|
276
377
|
const dispatchResult = await runDispatch(ic, preData, loopState);
|
|
277
|
-
|
|
378
|
+
deps.uokObserver?.onPhaseResult("dispatch", dispatchResult.action);
|
|
379
|
+
if (dispatchResult.action === "break") {
|
|
380
|
+
finishTurn("stopped", "manual-attention", "dispatch-break");
|
|
278
381
|
break;
|
|
279
|
-
|
|
382
|
+
}
|
|
383
|
+
if (dispatchResult.action === "continue") {
|
|
384
|
+
finishTurn("skipped");
|
|
280
385
|
continue;
|
|
386
|
+
}
|
|
281
387
|
iterData = dispatchResult.data;
|
|
388
|
+
observedUnitType = iterData.unitType;
|
|
389
|
+
observedUnitId = iterData.unitId;
|
|
282
390
|
}
|
|
283
391
|
else {
|
|
284
392
|
// ── Sidecar path: use values from the sidecar item directly ──
|
|
@@ -294,21 +402,46 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
294
402
|
midTitle: sidecarState.activeMilestone?.title,
|
|
295
403
|
isRetry: false, previousTier: undefined,
|
|
296
404
|
};
|
|
405
|
+
observedUnitType = iterData.unitType;
|
|
406
|
+
observedUnitId = iterData.unitId;
|
|
407
|
+
deps.uokObserver?.onPhaseResult("dispatch", "sidecar", {
|
|
408
|
+
unitType: iterData.unitType,
|
|
409
|
+
unitId: iterData.unitId,
|
|
410
|
+
sidecarKind: sidecarItem.kind,
|
|
411
|
+
});
|
|
297
412
|
}
|
|
298
413
|
const unitPhaseResult = await runUnitPhase(ic, iterData, loopState, sidecarItem);
|
|
299
|
-
|
|
414
|
+
deps.uokObserver?.onPhaseResult("unit", unitPhaseResult.action, {
|
|
415
|
+
unitType: iterData.unitType,
|
|
416
|
+
unitId: iterData.unitId,
|
|
417
|
+
});
|
|
418
|
+
if (unitPhaseResult.action === "break") {
|
|
419
|
+
finishTurn("stopped", "execution", "unit-break");
|
|
300
420
|
break;
|
|
421
|
+
}
|
|
301
422
|
// ── Phase 5: Finalize ───────────────────────────────────────────────
|
|
302
423
|
const finalizeResult = await runFinalize(ic, iterData, loopState, sidecarItem);
|
|
303
|
-
|
|
424
|
+
deps.uokObserver?.onPhaseResult("finalize", finalizeResult.action, {
|
|
425
|
+
unitType: iterData.unitType,
|
|
426
|
+
unitId: iterData.unitId,
|
|
427
|
+
});
|
|
428
|
+
if (finalizeResult.action === "break") {
|
|
429
|
+
const finalizeFailureClass = finalizeResult.reason === "git-closeout-failure"
|
|
430
|
+
? "git"
|
|
431
|
+
: "closeout";
|
|
432
|
+
finishTurn("stopped", finalizeFailureClass, "finalize-break");
|
|
304
433
|
break;
|
|
305
|
-
|
|
434
|
+
}
|
|
435
|
+
if (finalizeResult.action === "continue") {
|
|
436
|
+
finishTurn("retry");
|
|
306
437
|
continue;
|
|
438
|
+
}
|
|
307
439
|
consecutiveErrors = 0; // Iteration completed successfully
|
|
308
440
|
consecutiveCooldowns = 0;
|
|
309
441
|
recentErrorMessages.length = 0;
|
|
310
442
|
deps.emitJournalEvent({ ts: new Date().toISOString(), flowId, seq: nextSeq(), eventType: "iteration-end", data: { iteration } });
|
|
311
443
|
debugLog("autoLoop", { phase: "iteration-complete", iteration });
|
|
444
|
+
finishTurn("completed");
|
|
312
445
|
}
|
|
313
446
|
catch (loopErr) {
|
|
314
447
|
// ── Blanket catch: absorb unexpected exceptions, apply graduated recovery ──
|
|
@@ -330,6 +463,7 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
330
463
|
});
|
|
331
464
|
ctx.ui.notify(`Auto-mode stopped: infrastructure error ${infraCode} — ${msg}`, "error");
|
|
332
465
|
await deps.stopAuto(ctx, pi, `Infrastructure error (${infraCode}): not recoverable by retry`);
|
|
466
|
+
finishTurn("failed", "execution", msg);
|
|
333
467
|
break;
|
|
334
468
|
}
|
|
335
469
|
// ── Credential cooldown: wait and retry with bounded budget ──
|
|
@@ -358,6 +492,7 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
358
492
|
: COOLDOWN_FALLBACK_WAIT_MS;
|
|
359
493
|
ctx.ui.notify(`Credentials in cooldown (${consecutiveCooldowns}/${MAX_COOLDOWN_RETRIES}) — waiting ${Math.round(waitMs / 1000)}s before retrying.`, "warning");
|
|
360
494
|
await new Promise(resolve => setTimeout(resolve, waitMs));
|
|
495
|
+
finishTurn("retry", "timeout", msg);
|
|
361
496
|
continue; // Retry iteration without incrementing consecutiveErrors
|
|
362
497
|
}
|
|
363
498
|
consecutiveErrors++;
|
|
@@ -375,6 +510,7 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
375
510
|
.join("\n");
|
|
376
511
|
ctx.ui.notify(`Auto-mode stopped: ${consecutiveErrors} consecutive iteration failures:\n${errorHistory}`, "error");
|
|
377
512
|
await deps.stopAuto(ctx, pi, `${consecutiveErrors} consecutive iteration failures`);
|
|
513
|
+
finishTurn("failed", "execution", msg);
|
|
378
514
|
break;
|
|
379
515
|
}
|
|
380
516
|
else if (consecutiveErrors === 2) {
|
|
@@ -386,6 +522,7 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
386
522
|
// 1st error: log and retry — transient failures happen
|
|
387
523
|
ctx.ui.notify(`Iteration error: ${msg}. Retrying.`, "warning");
|
|
388
524
|
}
|
|
525
|
+
finishTurn("retry", "execution", msg);
|
|
389
526
|
}
|
|
390
527
|
}
|
|
391
528
|
_clearCurrentResolve();
|
|
@@ -25,6 +25,9 @@ import { withTimeout, FINALIZE_PRE_TIMEOUT_MS, FINALIZE_POST_TIMEOUT_MS } from "
|
|
|
25
25
|
import { getEligibleSlices } from "../slice-parallel-eligibility.js";
|
|
26
26
|
import { startSliceParallel } from "../slice-parallel-orchestrator.js";
|
|
27
27
|
import { isDbAvailable, getMilestoneSlices } from "../gsd-db.js";
|
|
28
|
+
import { ensurePlanV2Graph } from "../uok/plan-v2.js";
|
|
29
|
+
import { resolveUokFlags } from "../uok/flags.js";
|
|
30
|
+
import { UokGateRunner } from "../uok/gate-runner.js";
|
|
28
31
|
import { resetEvidence } from "../safety/evidence-collector.js";
|
|
29
32
|
import { createCheckpoint, cleanupCheckpoint, rollbackToCheckpoint } from "../safety/git-checkpoint.js";
|
|
30
33
|
import { resolveSafetyHarnessConfig } from "../safety/safety-harness.js";
|
|
@@ -46,6 +49,15 @@ export function _resolveReportBasePath(s) {
|
|
|
46
49
|
export function _resolveDispatchGuardBasePath(s) {
|
|
47
50
|
return s.originalBasePath || s.basePath;
|
|
48
51
|
}
|
|
52
|
+
const PLAN_V2_GATE_PHASES = new Set([
|
|
53
|
+
"executing",
|
|
54
|
+
"summarizing",
|
|
55
|
+
"validating-milestone",
|
|
56
|
+
"completing-milestone",
|
|
57
|
+
]);
|
|
58
|
+
function shouldRunPlanV2Gate(phase) {
|
|
59
|
+
return PLAN_V2_GATE_PHASES.has(phase);
|
|
60
|
+
}
|
|
49
61
|
/**
|
|
50
62
|
* Generate and write an HTML milestone report snapshot.
|
|
51
63
|
* Extracted from the milestone-transition block in autoLoop.
|
|
@@ -124,13 +136,52 @@ async function emitCancelledUnitEnd(ic, unitType, unitId, unitStartSeq, errorCon
|
|
|
124
136
|
*/
|
|
125
137
|
export async function runPreDispatch(ic, loopState) {
|
|
126
138
|
const { ctx, pi, s, deps, prefs } = ic;
|
|
139
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
140
|
+
const runPreDispatchGate = async (input) => {
|
|
141
|
+
if (!uokFlags.gates)
|
|
142
|
+
return;
|
|
143
|
+
const gateRunner = new UokGateRunner();
|
|
144
|
+
gateRunner.register({
|
|
145
|
+
id: input.gateId,
|
|
146
|
+
type: input.gateType,
|
|
147
|
+
execute: async () => ({
|
|
148
|
+
outcome: input.outcome,
|
|
149
|
+
failureClass: input.failureClass,
|
|
150
|
+
rationale: input.rationale,
|
|
151
|
+
findings: input.findings ?? "",
|
|
152
|
+
}),
|
|
153
|
+
});
|
|
154
|
+
await gateRunner.run(input.gateId, {
|
|
155
|
+
basePath: s.basePath,
|
|
156
|
+
traceId: `pre-dispatch:${ic.flowId}`,
|
|
157
|
+
turnId: `iter-${ic.iteration}`,
|
|
158
|
+
milestoneId: input.milestoneId ?? s.currentMilestoneId ?? undefined,
|
|
159
|
+
unitType: "pre-dispatch",
|
|
160
|
+
unitId: `iter-${ic.iteration}`,
|
|
161
|
+
});
|
|
162
|
+
};
|
|
127
163
|
// Resource version guard
|
|
128
164
|
const staleMsg = deps.checkResourcesStale(s.resourceVersionOnStart);
|
|
129
165
|
if (staleMsg) {
|
|
166
|
+
await runPreDispatchGate({
|
|
167
|
+
gateId: "resource-version-guard",
|
|
168
|
+
gateType: "policy",
|
|
169
|
+
outcome: "fail",
|
|
170
|
+
failureClass: "policy",
|
|
171
|
+
rationale: "resource version guard blocked dispatch",
|
|
172
|
+
findings: staleMsg,
|
|
173
|
+
});
|
|
130
174
|
await deps.stopAuto(ctx, pi, staleMsg);
|
|
131
175
|
debugLog("autoLoop", { phase: "exit", reason: "resources-stale" });
|
|
132
176
|
return { action: "break", reason: "resources-stale" };
|
|
133
177
|
}
|
|
178
|
+
await runPreDispatchGate({
|
|
179
|
+
gateId: "resource-version-guard",
|
|
180
|
+
gateType: "policy",
|
|
181
|
+
outcome: "pass",
|
|
182
|
+
failureClass: "none",
|
|
183
|
+
rationale: "resource version guard passed",
|
|
184
|
+
});
|
|
134
185
|
deps.invalidateAllCaches();
|
|
135
186
|
s.lastPromptCharCount = undefined;
|
|
136
187
|
s.lastBaselineCharCount = undefined;
|
|
@@ -141,13 +192,37 @@ export async function runPreDispatch(ic, loopState) {
|
|
|
141
192
|
ctx.ui.notify(`Pre-dispatch: ${healthGate.fixesApplied.join(", ")}`, "info");
|
|
142
193
|
}
|
|
143
194
|
if (!healthGate.proceed) {
|
|
195
|
+
await runPreDispatchGate({
|
|
196
|
+
gateId: "pre-dispatch-health-gate",
|
|
197
|
+
gateType: "execution",
|
|
198
|
+
outcome: "manual-attention",
|
|
199
|
+
failureClass: "manual-attention",
|
|
200
|
+
rationale: "pre-dispatch health gate blocked dispatch",
|
|
201
|
+
findings: healthGate.reason,
|
|
202
|
+
});
|
|
144
203
|
ctx.ui.notify(healthGate.reason || "Pre-dispatch health check failed — run /gsd doctor for details.", "error");
|
|
145
204
|
await deps.pauseAuto(ctx, pi);
|
|
146
205
|
debugLog("autoLoop", { phase: "exit", reason: "health-gate-failed" });
|
|
147
206
|
return { action: "break", reason: "health-gate-failed" };
|
|
148
207
|
}
|
|
208
|
+
await runPreDispatchGate({
|
|
209
|
+
gateId: "pre-dispatch-health-gate",
|
|
210
|
+
gateType: "execution",
|
|
211
|
+
outcome: "pass",
|
|
212
|
+
failureClass: "none",
|
|
213
|
+
rationale: "pre-dispatch health gate passed",
|
|
214
|
+
findings: healthGate.fixesApplied.length > 0 ? healthGate.fixesApplied.join(", ") : "",
|
|
215
|
+
});
|
|
149
216
|
}
|
|
150
217
|
catch (e) {
|
|
218
|
+
await runPreDispatchGate({
|
|
219
|
+
gateId: "pre-dispatch-health-gate",
|
|
220
|
+
gateType: "execution",
|
|
221
|
+
outcome: "manual-attention",
|
|
222
|
+
failureClass: "manual-attention",
|
|
223
|
+
rationale: "pre-dispatch health gate threw unexpectedly",
|
|
224
|
+
findings: String(e),
|
|
225
|
+
});
|
|
151
226
|
logWarning("engine", "Pre-dispatch health gate threw unexpectedly", { error: String(e) });
|
|
152
227
|
}
|
|
153
228
|
// Sync project root artifacts into worktree
|
|
@@ -158,6 +233,32 @@ export async function runPreDispatch(ic, loopState) {
|
|
|
158
233
|
}
|
|
159
234
|
// Derive state
|
|
160
235
|
let state = await deps.deriveState(s.basePath);
|
|
236
|
+
if (prefs?.uok?.plan_v2?.enabled && shouldRunPlanV2Gate(state.phase)) {
|
|
237
|
+
const compiled = ensurePlanV2Graph(s.basePath, state);
|
|
238
|
+
if (!compiled.ok) {
|
|
239
|
+
const reason = compiled.reason ?? "Plan v2 compilation failed";
|
|
240
|
+
await runPreDispatchGate({
|
|
241
|
+
gateId: "plan-v2-gate",
|
|
242
|
+
gateType: "policy",
|
|
243
|
+
outcome: "manual-attention",
|
|
244
|
+
failureClass: "manual-attention",
|
|
245
|
+
rationale: "plan v2 compile gate failed",
|
|
246
|
+
findings: reason,
|
|
247
|
+
milestoneId: state.activeMilestone?.id ?? undefined,
|
|
248
|
+
});
|
|
249
|
+
ctx.ui.notify(`Plan gate failed-closed: ${reason}`, "error");
|
|
250
|
+
await deps.pauseAuto(ctx, pi);
|
|
251
|
+
return { action: "break", reason: "plan-v2-gate-failed" };
|
|
252
|
+
}
|
|
253
|
+
await runPreDispatchGate({
|
|
254
|
+
gateId: "plan-v2-gate",
|
|
255
|
+
gateType: "policy",
|
|
256
|
+
outcome: "pass",
|
|
257
|
+
failureClass: "none",
|
|
258
|
+
rationale: "plan v2 compile gate passed",
|
|
259
|
+
milestoneId: state.activeMilestone?.id ?? undefined,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
161
262
|
deps.syncCmuxSidebar(prefs, state);
|
|
162
263
|
let mid = state.activeMilestone?.id;
|
|
163
264
|
let midTitle = state.activeMilestone?.title;
|
|
@@ -193,7 +294,10 @@ export async function runPreDispatch(ic, loopState) {
|
|
|
193
294
|
eligibleSlices: eligible.map(e => e.id),
|
|
194
295
|
});
|
|
195
296
|
ctx.ui.notify(`Slice-parallel: dispatching ${eligible.length} eligible slices for ${mid}.`, "info");
|
|
196
|
-
const result = await startSliceParallel(s.basePath, mid, eligible, {
|
|
297
|
+
const result = await startSliceParallel(s.basePath, mid, eligible, {
|
|
298
|
+
maxWorkers: prefs.slice_parallel.max_workers ?? 2,
|
|
299
|
+
useExecutionGraph: uokFlags.executionGraph,
|
|
300
|
+
});
|
|
197
301
|
if (result.started.length > 0) {
|
|
198
302
|
ctx.ui.notify(`Slice-parallel: started ${result.started.length} worker(s): ${result.started.join(", ")}.`, "info");
|
|
199
303
|
await deps.stopAuto(ctx, pi, `Slice-parallel dispatched for ${mid}`);
|
|
@@ -797,6 +901,8 @@ export async function runUnitPhase(ic, iterData, loopState, sidecarItem) {
|
|
|
797
901
|
// unit in the same Node process (see workflow-logger.ts module header).
|
|
798
902
|
_resetLogs();
|
|
799
903
|
s.currentUnit = { type: unitType, id: unitId, startedAt: Date.now() };
|
|
904
|
+
s.lastGitActionFailure = null;
|
|
905
|
+
s.lastGitActionStatus = null;
|
|
800
906
|
setCurrentPhase(unitType);
|
|
801
907
|
s.lastToolInvocationError = null; // #2883: clear stale error from previous unit
|
|
802
908
|
const unitStartSeq = ic.nextSeq();
|
|
@@ -1173,11 +1279,15 @@ export async function runFinalize(ic, iterData, loopState, sidecarItem) {
|
|
|
1173
1279
|
}
|
|
1174
1280
|
const preResult = preResultGuard.value;
|
|
1175
1281
|
if (preResult === "dispatched") {
|
|
1282
|
+
const dispatchedReason = s.lastGitActionFailure
|
|
1283
|
+
? "git-closeout-failure"
|
|
1284
|
+
: "pre-verification-dispatched";
|
|
1176
1285
|
debugLog("autoLoop", {
|
|
1177
1286
|
phase: "exit",
|
|
1178
|
-
reason:
|
|
1287
|
+
reason: dispatchedReason,
|
|
1288
|
+
gitError: s.lastGitActionFailure ?? undefined,
|
|
1179
1289
|
});
|
|
1180
|
-
return { action: "break", reason:
|
|
1290
|
+
return { action: "break", reason: dispatchedReason };
|
|
1181
1291
|
}
|
|
1182
1292
|
if (preResult === "retry") {
|
|
1183
1293
|
if (sidecarItem) {
|
|
@@ -52,6 +52,8 @@ export class AutoSession {
|
|
|
52
52
|
continueHereHandle = null;
|
|
53
53
|
// ── Current unit ─────────────────────────────────────────────────────────
|
|
54
54
|
currentUnit = null;
|
|
55
|
+
currentTraceId = null;
|
|
56
|
+
currentTurnId = null;
|
|
55
57
|
currentUnitRouting = null;
|
|
56
58
|
currentMilestoneId = null;
|
|
57
59
|
// ── Model state ──────────────────────────────────────────────────────────
|
|
@@ -79,6 +81,10 @@ export class AutoSession {
|
|
|
79
81
|
/** Set when a GSD tool execution ends with isError due to malformed/truncated
|
|
80
82
|
* JSON arguments. Checked by postUnitPreVerification to break retry loops. */
|
|
81
83
|
lastToolInvocationError = null;
|
|
84
|
+
/** Set when turn-level git action fails during closeout. */
|
|
85
|
+
lastGitActionFailure = null;
|
|
86
|
+
/** Last turn-level git action status captured during finalize. */
|
|
87
|
+
lastGitActionStatus = null;
|
|
82
88
|
// ── Isolation degradation ────────────────────────────────────────────
|
|
83
89
|
/** Set to true when worktree creation fails; prevents merge of nonexistent branch. */
|
|
84
90
|
isolationDegraded = false;
|
|
@@ -157,6 +163,8 @@ export class AutoSession {
|
|
|
157
163
|
this.unitRecoveryCount.clear();
|
|
158
164
|
// Unit
|
|
159
165
|
this.currentUnit = null;
|
|
166
|
+
this.currentTraceId = null;
|
|
167
|
+
this.currentTurnId = null;
|
|
160
168
|
this.currentUnitRouting = null;
|
|
161
169
|
this.currentMilestoneId = null;
|
|
162
170
|
// Model
|
|
@@ -185,6 +193,8 @@ export class AutoSession {
|
|
|
185
193
|
this.rewriteAttemptCount = 0;
|
|
186
194
|
this.consecutiveCompleteBootstraps = 0;
|
|
187
195
|
this.lastToolInvocationError = null;
|
|
196
|
+
this.lastGitActionFailure = null;
|
|
197
|
+
this.lastGitActionStatus = null;
|
|
188
198
|
this.isolationDegraded = false;
|
|
189
199
|
this.milestoneMergedInPhases = false;
|
|
190
200
|
this.checkpointSha = null;
|
|
@@ -19,6 +19,8 @@ import { join } from "node:path";
|
|
|
19
19
|
import { hasImplementationArtifacts } from "./auto-recovery.js";
|
|
20
20
|
import { buildDiscussMilestonePrompt, buildResearchMilestonePrompt, buildPlanMilestonePrompt, buildResearchSlicePrompt, buildPlanSlicePrompt, buildExecuteTaskPrompt, buildCompleteSlicePrompt, buildCompleteMilestonePrompt, buildValidateMilestonePrompt, buildReplanSlicePrompt, buildRunUatPrompt, buildReassessRoadmapPrompt, buildRewriteDocsPrompt, buildReactiveExecutePrompt, buildGateEvaluatePrompt, buildParallelResearchSlicesPrompt, checkNeedsReassessment, checkNeedsRunUat, } from "./auto-prompts.js";
|
|
21
21
|
import { resolveModelWithFallbacksForUnit } from "./preferences-models.js";
|
|
22
|
+
import { resolveUokFlags } from "./uok/flags.js";
|
|
23
|
+
import { selectReactiveDispatchBatch } from "./uok/execution-graph.js";
|
|
22
24
|
function missingSliceStop(mid, phase) {
|
|
23
25
|
return {
|
|
24
26
|
action: "stop",
|
|
@@ -461,7 +463,15 @@ export const DISPATCH_RULES = [
|
|
|
461
463
|
// Only activate reactive dispatch when >1 task is ready
|
|
462
464
|
if (readyIds.length <= 1)
|
|
463
465
|
return null;
|
|
464
|
-
const
|
|
466
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
467
|
+
const selected = uokFlags.executionGraph
|
|
468
|
+
? selectReactiveDispatchBatch({
|
|
469
|
+
graph,
|
|
470
|
+
readyIds,
|
|
471
|
+
maxParallel,
|
|
472
|
+
inFlightOutputs: new Set(),
|
|
473
|
+
}).selected
|
|
474
|
+
: chooseNonConflictingSubset(readyIds, graph, maxParallel, new Set());
|
|
465
475
|
if (selected.length <= 1)
|
|
466
476
|
return null;
|
|
467
477
|
// Log graph metrics for observability
|