gsd-pi 2.74.0-dev.b741afb → 2.74.0-dev.b7c5f96
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 +164 -9
- 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 +54 -8
- 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-worktree.js +2 -0
- package/dist/resources/extensions/gsd/auto.js +28 -2
- 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/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 +51 -4
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +16 -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 +31 -6
- 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 +2 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +118 -2
- package/dist/resources/extensions/gsd/preferences.js +31 -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 +19 -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 +8 -8
- 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 +8 -8
- 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__/chat-frame-compaction-tone.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js +61 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js.map +1 -0
- 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 +53 -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/compaction-summary-message.d.ts +8 -5
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +27 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- 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__/chat-frame-compaction-tone.test.ts +92 -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 +25 -10
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +75 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/compaction-summary-message.ts +36 -15
- 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/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +9 -2
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/tui.ts +9 -1
- package/packages/pi-tui/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 +193 -9
- 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 +69 -8
- 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-worktree.ts +1 -0
- package/src/resources/extensions/gsd/auto.ts +34 -2
- 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/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 +58 -4
- package/src/resources/extensions/gsd/docs/preferences-reference.md +16 -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 +36 -2
- 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 +38 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +117 -2
- package/src/resources/extensions/gsd/preferences.ts +34 -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 +19 -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/auto-warning-noise-regression.test.ts +117 -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/journal-integration.test.ts +3 -3
- 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/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/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 → k1VZ0h-SB6uWSZgPhgNwi}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{XnHY5eXUsTCFmNodWHetD → k1VZ0h-SB6uWSZgPhgNwi}/_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();
|
|
@@ -14,6 +14,8 @@ import { debugLog } from "../debug-logger.js";
|
|
|
14
14
|
import { PROJECT_FILES } from "../detection.js";
|
|
15
15
|
import { MergeConflictError } from "../git-service.js";
|
|
16
16
|
import { setCurrentPhase, clearCurrentPhase } from "../../shared/gsd-phase-state.js";
|
|
17
|
+
import { pauseAutoForProviderError } from "../provider-error-pause.js";
|
|
18
|
+
import { resumeAutoAfterProviderDelay } from "../bootstrap/provider-error-resume.js";
|
|
17
19
|
import { join, basename, dirname, parse as parsePath } from "node:path";
|
|
18
20
|
import { existsSync, cpSync, readdirSync } from "node:fs";
|
|
19
21
|
import { logWarning, logError, _resetLogs, drainLogs, drainAndSummarize, formatForNotification, hasAnyIssues, } from "../workflow-logger.js";
|
|
@@ -25,10 +27,19 @@ import { withTimeout, FINALIZE_PRE_TIMEOUT_MS, FINALIZE_POST_TIMEOUT_MS } from "
|
|
|
25
27
|
import { getEligibleSlices } from "../slice-parallel-eligibility.js";
|
|
26
28
|
import { startSliceParallel } from "../slice-parallel-orchestrator.js";
|
|
27
29
|
import { isDbAvailable, getMilestoneSlices } from "../gsd-db.js";
|
|
30
|
+
import { ensurePlanV2Graph } from "../uok/plan-v2.js";
|
|
31
|
+
import { resolveUokFlags } from "../uok/flags.js";
|
|
32
|
+
import { UokGateRunner } from "../uok/gate-runner.js";
|
|
28
33
|
import { resetEvidence } from "../safety/evidence-collector.js";
|
|
29
34
|
import { createCheckpoint, cleanupCheckpoint, rollbackToCheckpoint } from "../safety/git-checkpoint.js";
|
|
30
35
|
import { resolveSafetyHarnessConfig } from "../safety/safety-harness.js";
|
|
31
36
|
import { getWorkflowTransportSupportError, getRequiredWorkflowToolsForAutoUnit, } from "../workflow-mcp.js";
|
|
37
|
+
// ─── Session timeout auto-resume state ────────────────────────────────────────
|
|
38
|
+
let consecutiveSessionTimeouts = 0;
|
|
39
|
+
const MAX_SESSION_TIMEOUT_AUTO_RESUMES = 3;
|
|
40
|
+
export function resetSessionTimeoutState() {
|
|
41
|
+
consecutiveSessionTimeouts = 0;
|
|
42
|
+
}
|
|
32
43
|
// ─── generateMilestoneReport ──────────────────────────────────────────────────
|
|
33
44
|
/**
|
|
34
45
|
* Resolve the base path for milestone reports.
|
|
@@ -46,6 +57,15 @@ export function _resolveReportBasePath(s) {
|
|
|
46
57
|
export function _resolveDispatchGuardBasePath(s) {
|
|
47
58
|
return s.originalBasePath || s.basePath;
|
|
48
59
|
}
|
|
60
|
+
const PLAN_V2_GATE_PHASES = new Set([
|
|
61
|
+
"executing",
|
|
62
|
+
"summarizing",
|
|
63
|
+
"validating-milestone",
|
|
64
|
+
"completing-milestone",
|
|
65
|
+
]);
|
|
66
|
+
function shouldRunPlanV2Gate(phase) {
|
|
67
|
+
return PLAN_V2_GATE_PHASES.has(phase);
|
|
68
|
+
}
|
|
49
69
|
/**
|
|
50
70
|
* Generate and write an HTML milestone report snapshot.
|
|
51
71
|
* Extracted from the milestone-transition block in autoLoop.
|
|
@@ -124,13 +144,52 @@ async function emitCancelledUnitEnd(ic, unitType, unitId, unitStartSeq, errorCon
|
|
|
124
144
|
*/
|
|
125
145
|
export async function runPreDispatch(ic, loopState) {
|
|
126
146
|
const { ctx, pi, s, deps, prefs } = ic;
|
|
147
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
148
|
+
const runPreDispatchGate = async (input) => {
|
|
149
|
+
if (!uokFlags.gates)
|
|
150
|
+
return;
|
|
151
|
+
const gateRunner = new UokGateRunner();
|
|
152
|
+
gateRunner.register({
|
|
153
|
+
id: input.gateId,
|
|
154
|
+
type: input.gateType,
|
|
155
|
+
execute: async () => ({
|
|
156
|
+
outcome: input.outcome,
|
|
157
|
+
failureClass: input.failureClass,
|
|
158
|
+
rationale: input.rationale,
|
|
159
|
+
findings: input.findings ?? "",
|
|
160
|
+
}),
|
|
161
|
+
});
|
|
162
|
+
await gateRunner.run(input.gateId, {
|
|
163
|
+
basePath: s.basePath,
|
|
164
|
+
traceId: `pre-dispatch:${ic.flowId}`,
|
|
165
|
+
turnId: `iter-${ic.iteration}`,
|
|
166
|
+
milestoneId: input.milestoneId ?? s.currentMilestoneId ?? undefined,
|
|
167
|
+
unitType: "pre-dispatch",
|
|
168
|
+
unitId: `iter-${ic.iteration}`,
|
|
169
|
+
});
|
|
170
|
+
};
|
|
127
171
|
// Resource version guard
|
|
128
172
|
const staleMsg = deps.checkResourcesStale(s.resourceVersionOnStart);
|
|
129
173
|
if (staleMsg) {
|
|
174
|
+
await runPreDispatchGate({
|
|
175
|
+
gateId: "resource-version-guard",
|
|
176
|
+
gateType: "policy",
|
|
177
|
+
outcome: "fail",
|
|
178
|
+
failureClass: "policy",
|
|
179
|
+
rationale: "resource version guard blocked dispatch",
|
|
180
|
+
findings: staleMsg,
|
|
181
|
+
});
|
|
130
182
|
await deps.stopAuto(ctx, pi, staleMsg);
|
|
131
183
|
debugLog("autoLoop", { phase: "exit", reason: "resources-stale" });
|
|
132
184
|
return { action: "break", reason: "resources-stale" };
|
|
133
185
|
}
|
|
186
|
+
await runPreDispatchGate({
|
|
187
|
+
gateId: "resource-version-guard",
|
|
188
|
+
gateType: "policy",
|
|
189
|
+
outcome: "pass",
|
|
190
|
+
failureClass: "none",
|
|
191
|
+
rationale: "resource version guard passed",
|
|
192
|
+
});
|
|
134
193
|
deps.invalidateAllCaches();
|
|
135
194
|
s.lastPromptCharCount = undefined;
|
|
136
195
|
s.lastBaselineCharCount = undefined;
|
|
@@ -141,13 +200,37 @@ export async function runPreDispatch(ic, loopState) {
|
|
|
141
200
|
ctx.ui.notify(`Pre-dispatch: ${healthGate.fixesApplied.join(", ")}`, "info");
|
|
142
201
|
}
|
|
143
202
|
if (!healthGate.proceed) {
|
|
203
|
+
await runPreDispatchGate({
|
|
204
|
+
gateId: "pre-dispatch-health-gate",
|
|
205
|
+
gateType: "execution",
|
|
206
|
+
outcome: "manual-attention",
|
|
207
|
+
failureClass: "manual-attention",
|
|
208
|
+
rationale: "pre-dispatch health gate blocked dispatch",
|
|
209
|
+
findings: healthGate.reason,
|
|
210
|
+
});
|
|
144
211
|
ctx.ui.notify(healthGate.reason || "Pre-dispatch health check failed — run /gsd doctor for details.", "error");
|
|
145
212
|
await deps.pauseAuto(ctx, pi);
|
|
146
213
|
debugLog("autoLoop", { phase: "exit", reason: "health-gate-failed" });
|
|
147
214
|
return { action: "break", reason: "health-gate-failed" };
|
|
148
215
|
}
|
|
216
|
+
await runPreDispatchGate({
|
|
217
|
+
gateId: "pre-dispatch-health-gate",
|
|
218
|
+
gateType: "execution",
|
|
219
|
+
outcome: "pass",
|
|
220
|
+
failureClass: "none",
|
|
221
|
+
rationale: "pre-dispatch health gate passed",
|
|
222
|
+
findings: healthGate.fixesApplied.length > 0 ? healthGate.fixesApplied.join(", ") : "",
|
|
223
|
+
});
|
|
149
224
|
}
|
|
150
225
|
catch (e) {
|
|
226
|
+
await runPreDispatchGate({
|
|
227
|
+
gateId: "pre-dispatch-health-gate",
|
|
228
|
+
gateType: "execution",
|
|
229
|
+
outcome: "manual-attention",
|
|
230
|
+
failureClass: "manual-attention",
|
|
231
|
+
rationale: "pre-dispatch health gate threw unexpectedly",
|
|
232
|
+
findings: String(e),
|
|
233
|
+
});
|
|
151
234
|
logWarning("engine", "Pre-dispatch health gate threw unexpectedly", { error: String(e) });
|
|
152
235
|
}
|
|
153
236
|
// Sync project root artifacts into worktree
|
|
@@ -158,6 +241,32 @@ export async function runPreDispatch(ic, loopState) {
|
|
|
158
241
|
}
|
|
159
242
|
// Derive state
|
|
160
243
|
let state = await deps.deriveState(s.basePath);
|
|
244
|
+
if (prefs?.uok?.plan_v2?.enabled && shouldRunPlanV2Gate(state.phase)) {
|
|
245
|
+
const compiled = ensurePlanV2Graph(s.basePath, state);
|
|
246
|
+
if (!compiled.ok) {
|
|
247
|
+
const reason = compiled.reason ?? "Plan v2 compilation failed";
|
|
248
|
+
await runPreDispatchGate({
|
|
249
|
+
gateId: "plan-v2-gate",
|
|
250
|
+
gateType: "policy",
|
|
251
|
+
outcome: "manual-attention",
|
|
252
|
+
failureClass: "manual-attention",
|
|
253
|
+
rationale: "plan v2 compile gate failed",
|
|
254
|
+
findings: reason,
|
|
255
|
+
milestoneId: state.activeMilestone?.id ?? undefined,
|
|
256
|
+
});
|
|
257
|
+
ctx.ui.notify(`Plan gate failed-closed: ${reason}`, "error");
|
|
258
|
+
await deps.pauseAuto(ctx, pi);
|
|
259
|
+
return { action: "break", reason: "plan-v2-gate-failed" };
|
|
260
|
+
}
|
|
261
|
+
await runPreDispatchGate({
|
|
262
|
+
gateId: "plan-v2-gate",
|
|
263
|
+
gateType: "policy",
|
|
264
|
+
outcome: "pass",
|
|
265
|
+
failureClass: "none",
|
|
266
|
+
rationale: "plan v2 compile gate passed",
|
|
267
|
+
milestoneId: state.activeMilestone?.id ?? undefined,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
161
270
|
deps.syncCmuxSidebar(prefs, state);
|
|
162
271
|
let mid = state.activeMilestone?.id;
|
|
163
272
|
let midTitle = state.activeMilestone?.title;
|
|
@@ -193,7 +302,10 @@ export async function runPreDispatch(ic, loopState) {
|
|
|
193
302
|
eligibleSlices: eligible.map(e => e.id),
|
|
194
303
|
});
|
|
195
304
|
ctx.ui.notify(`Slice-parallel: dispatching ${eligible.length} eligible slices for ${mid}.`, "info");
|
|
196
|
-
const result = await startSliceParallel(s.basePath, mid, eligible, {
|
|
305
|
+
const result = await startSliceParallel(s.basePath, mid, eligible, {
|
|
306
|
+
maxWorkers: prefs.slice_parallel.max_workers ?? 2,
|
|
307
|
+
useExecutionGraph: uokFlags.executionGraph,
|
|
308
|
+
});
|
|
197
309
|
if (result.started.length > 0) {
|
|
198
310
|
ctx.ui.notify(`Slice-parallel: started ${result.started.length} worker(s): ${result.started.join(", ")}.`, "info");
|
|
199
311
|
await deps.stopAuto(ctx, pi, `Slice-parallel dispatched for ${mid}`);
|
|
@@ -797,6 +909,8 @@ export async function runUnitPhase(ic, iterData, loopState, sidecarItem) {
|
|
|
797
909
|
// unit in the same Node process (see workflow-logger.ts module header).
|
|
798
910
|
_resetLogs();
|
|
799
911
|
s.currentUnit = { type: unitType, id: unitId, startedAt: Date.now() };
|
|
912
|
+
s.lastGitActionFailure = null;
|
|
913
|
+
s.lastGitActionStatus = null;
|
|
800
914
|
setCurrentPhase(unitType);
|
|
801
915
|
s.lastToolInvocationError = null; // #2883: clear stale error from previous unit
|
|
802
916
|
const unitStartSeq = ic.nextSeq();
|
|
@@ -999,19 +1113,54 @@ export async function runUnitPhase(ic, iterData, loopState, sidecarItem) {
|
|
|
999
1113
|
debugLog("autoLoop", { phase: "exit", reason: "provider-pause", isTransient: unitResult.errorContext.isTransient });
|
|
1000
1114
|
return { action: "break", reason: "provider-pause" };
|
|
1001
1115
|
}
|
|
1002
|
-
//
|
|
1003
|
-
//
|
|
1004
|
-
//
|
|
1116
|
+
// Timeout category covers two distinct scenarios:
|
|
1117
|
+
// 1. Session creation timeout (120s) — transient, auto-resume with backoff
|
|
1118
|
+
// 2. Unit hard timeout (30min+) — stuck agent, pause for manual review
|
|
1005
1119
|
// Structural errors (TypeError, is not a function) are NOT transient
|
|
1006
1120
|
// and must hard-stop to avoid infinite retry loops.
|
|
1007
1121
|
if (unitResult.errorContext?.isTransient &&
|
|
1008
1122
|
unitResult.errorContext?.category === "timeout") {
|
|
1009
|
-
|
|
1010
|
-
|
|
1123
|
+
const isSessionCreationTimeout = unitResult.errorContext.message?.includes("Session creation timed out");
|
|
1124
|
+
if (isSessionCreationTimeout) {
|
|
1125
|
+
consecutiveSessionTimeouts += 1;
|
|
1126
|
+
const baseRetryAfterMs = 30_000;
|
|
1127
|
+
const retryAfterMs = baseRetryAfterMs * 2 ** Math.max(0, consecutiveSessionTimeouts - 1);
|
|
1128
|
+
const allowAutoResume = consecutiveSessionTimeouts <= MAX_SESSION_TIMEOUT_AUTO_RESUMES;
|
|
1129
|
+
if (!allowAutoResume) {
|
|
1130
|
+
ctx.ui.notify(`Session creation timed out ${consecutiveSessionTimeouts} consecutive times for ${unitType} ${unitId}. Pausing for manual review.`, "warning");
|
|
1131
|
+
}
|
|
1132
|
+
debugLog("autoLoop", {
|
|
1133
|
+
phase: "session-timeout-pause",
|
|
1134
|
+
unitType, unitId,
|
|
1135
|
+
consecutiveSessionTimeouts,
|
|
1136
|
+
retryAfterMs,
|
|
1137
|
+
allowAutoResume,
|
|
1138
|
+
});
|
|
1139
|
+
const errorDetail = ` for ${unitType} ${unitId}`;
|
|
1140
|
+
await pauseAutoForProviderError(ctx.ui, errorDetail, () => deps.pauseAuto(ctx, pi), {
|
|
1141
|
+
isRateLimit: false,
|
|
1142
|
+
isTransient: allowAutoResume,
|
|
1143
|
+
retryAfterMs,
|
|
1144
|
+
resume: allowAutoResume
|
|
1145
|
+
? () => {
|
|
1146
|
+
void resumeAutoAfterProviderDelay(pi, ctx).catch((err) => {
|
|
1147
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1148
|
+
ctx.ui.notify(`Session timeout recovery failed: ${message}`, "error");
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
: undefined,
|
|
1152
|
+
});
|
|
1153
|
+
await deps.autoCommitUnit?.(s.basePath, unitType, unitId, ctx);
|
|
1154
|
+
await emitCancelledUnitEnd(ic, unitType, unitId, unitStartSeq, unitResult.errorContext);
|
|
1155
|
+
return { action: "break", reason: "session-timeout" };
|
|
1156
|
+
}
|
|
1157
|
+
// Unit hard timeout (30min+): pause without auto-resume — stuck agent
|
|
1158
|
+
ctx.ui.notify(`Unit timed out for ${unitType} ${unitId} (supervision may have failed). Pausing auto-mode.`, "warning");
|
|
1159
|
+
debugLog("autoLoop", { phase: "unit-hard-timeout-pause", unitType, unitId });
|
|
1011
1160
|
await deps.pauseAuto(ctx, pi);
|
|
1012
1161
|
await deps.autoCommitUnit?.(s.basePath, unitType, unitId, ctx);
|
|
1013
1162
|
await emitCancelledUnitEnd(ic, unitType, unitId, unitStartSeq, unitResult.errorContext);
|
|
1014
|
-
return { action: "break", reason: "
|
|
1163
|
+
return { action: "break", reason: "unit-hard-timeout" };
|
|
1015
1164
|
}
|
|
1016
1165
|
// All other cancelled states (structural errors, non-transient failures): hard stop
|
|
1017
1166
|
if (s.currentUnit) {
|
|
@@ -1030,6 +1179,8 @@ export async function runUnitPhase(ic, iterData, loopState, sidecarItem) {
|
|
|
1030
1179
|
// Guard: stopAuto() may have nulled s.currentUnit via s.reset() while
|
|
1031
1180
|
// this coroutine was suspended at `await runUnit(...)` (#2939).
|
|
1032
1181
|
if (s.currentUnit) {
|
|
1182
|
+
// Reset session timeout counter — any successful unit clears the slate
|
|
1183
|
+
consecutiveSessionTimeouts = 0;
|
|
1033
1184
|
await deps.closeoutUnit(ctx, s.basePath, unitType, unitId, s.currentUnit.startedAt, deps.buildSnapshotOpts(unitType, unitId));
|
|
1034
1185
|
}
|
|
1035
1186
|
// ── Zero tool-call guard (#1833, #2653) ──────────────────────────
|
|
@@ -1173,11 +1324,15 @@ export async function runFinalize(ic, iterData, loopState, sidecarItem) {
|
|
|
1173
1324
|
}
|
|
1174
1325
|
const preResult = preResultGuard.value;
|
|
1175
1326
|
if (preResult === "dispatched") {
|
|
1327
|
+
const dispatchedReason = s.lastGitActionFailure
|
|
1328
|
+
? "git-closeout-failure"
|
|
1329
|
+
: "pre-verification-dispatched";
|
|
1176
1330
|
debugLog("autoLoop", {
|
|
1177
1331
|
phase: "exit",
|
|
1178
|
-
reason:
|
|
1332
|
+
reason: dispatchedReason,
|
|
1333
|
+
gitError: s.lastGitActionFailure ?? undefined,
|
|
1179
1334
|
});
|
|
1180
|
-
return { action: "break", reason:
|
|
1335
|
+
return { action: "break", reason: dispatchedReason };
|
|
1181
1336
|
}
|
|
1182
1337
|
if (preResult === "retry") {
|
|
1183
1338
|
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;
|