gsd-pi 2.80.0-dev.42bd34838 → 2.80.0-dev.488219eb6
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/claude-cli-check.d.ts +30 -0
- package/dist/claude-cli-check.js +18 -7
- package/dist/cli.js +0 -19
- package/dist/headless-query.d.ts +10 -0
- package/dist/headless-query.js +6 -4
- package/dist/loader-entrypoint.d.ts +8 -0
- package/dist/loader-entrypoint.js +27 -0
- package/dist/loader.js +2 -11
- package/dist/mcp-server.d.ts +1 -0
- package/dist/mcp-server.js +6 -3
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/claude-code-cli/readiness.js +18 -7
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +29 -0
- package/dist/resources/extensions/github-sync/sync.js +4 -1
- package/dist/resources/extensions/gsd/auto/loop.js +71 -8
- package/dist/resources/extensions/gsd/auto/phases.js +179 -99
- package/dist/resources/extensions/gsd/auto/resolve.js +12 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +10 -30
- package/dist/resources/extensions/gsd/auto/session.js +8 -0
- package/dist/resources/extensions/gsd/auto/workflow-dispatch-claim.js +33 -1
- package/dist/resources/extensions/gsd/auto/workflow-worker-heartbeat.js +9 -1
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +5 -32
- package/dist/resources/extensions/gsd/auto-dispatch.js +16 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +94 -76
- package/dist/resources/extensions/gsd/auto-prompts.js +90 -15
- package/dist/resources/extensions/gsd/auto-start.js +238 -12
- package/dist/resources/extensions/gsd/auto-worktree.js +209 -81
- package/dist/resources/extensions/gsd/auto.js +95 -44
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +96 -26
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +44 -37
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +37 -10
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +6 -3
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +4 -1
- package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +6 -4
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +5 -3
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +1 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +298 -54
- package/dist/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.js +4 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +82 -23
- package/dist/resources/extensions/gsd/clean-root-preflight.js +24 -6
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +2 -2
- package/dist/resources/extensions/gsd/commands-config.js +1 -1
- package/dist/resources/extensions/gsd/commands-eval-review.js +2 -2
- package/dist/resources/extensions/gsd/commands-handlers.js +23 -9
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +53 -0
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +2 -0
- package/dist/resources/extensions/gsd/git-service.js +37 -1
- package/dist/resources/extensions/gsd/guided-flow.js +61 -32
- package/dist/resources/extensions/gsd/init-wizard.js +4 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +32 -8
- package/dist/resources/extensions/gsd/orphan-stash-audit.js +101 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +13 -3
- package/dist/resources/extensions/gsd/pre-execution-checks.js +22 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +8 -4
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/execute-task.md +4 -2
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/dist/resources/extensions/gsd/slice-cadence.js +45 -2
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +15 -9
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +6 -7
- package/dist/resources/extensions/gsd/tools/complete-task.js +1 -1
- package/dist/resources/extensions/gsd/workflow-protocol.js +131 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +57 -5
- package/dist/resources/skills/web-quality-audit/scripts/analyze.sh +0 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +2 -2
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +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/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
- 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/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +11 -11
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +3 -3
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/8359.e059d86b255fce1c.js +10 -0
- package/dist/web/standalone/.next/static/chunks/app/{page-fab3ebb85b006001.js → page-752f1e2ebdaa3e45.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{webpack-0481f1221120a7c6.js → webpack-de742b64187e13fe.js} +1 -1
- package/dist/web/standalone/server.js +1 -1
- package/dist/welcome-screen.d.ts +2 -0
- package/dist/welcome-screen.js +9 -7
- package/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +4 -1
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +5 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +2 -0
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/index.d.ts +1 -0
- package/packages/pi-agent-core/dist/index.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/index.js +2 -0
- package/packages/pi-agent-core/dist/index.js.map +1 -1
- package/packages/pi-agent-core/dist/token-audit.d.ts +47 -0
- package/packages/pi-agent-core/dist/token-audit.d.ts.map +1 -0
- package/packages/pi-agent-core/dist/token-audit.js +221 -0
- package/packages/pi-agent-core/dist/token-audit.js.map +1 -0
- package/packages/pi-agent-core/dist/types.d.ts +9 -0
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/types.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +128 -0
- package/packages/pi-agent-core/src/agent-loop.ts +4 -1
- package/packages/pi-agent-core/src/agent.ts +8 -0
- package/packages/pi-agent-core/src/index.ts +2 -0
- package/packages/pi-agent-core/src/token-audit.test.ts +189 -0
- package/packages/pi-agent-core/src/token-audit.ts +287 -0
- package/packages/pi-agent-core/src/types.ts +14 -0
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +35 -13
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js +21 -11
- package/packages/pi-ai/dist/providers/anthropic-bearer-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +7 -0
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +9 -7
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js +23 -14
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js +48 -21
- package/packages/pi-ai/dist/utils/oauth/github-copilot.test.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js +22 -21
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.test.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js +22 -21
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.test.js.map +1 -1
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +39 -25
- package/packages/pi-ai/src/providers/anthropic-bearer-auth.test.ts +26 -22
- package/packages/pi-ai/src/providers/anthropic.ts +22 -9
- package/packages/pi-ai/src/providers/minimax-tool-name.test.ts +34 -21
- package/packages/pi-ai/src/utils/oauth/github-copilot.test.ts +56 -22
- package/packages/pi-ai/src/utils/oauth/google-antigravity.test.ts +24 -28
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.test.ts +24 -28
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +18 -0
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +12 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +36 -7
- 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 +3 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +8 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +3 -6
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +3 -3
- package/packages/pi-coding-agent/dist/core/extensions/runner.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +34 -3
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.js +2 -0
- package/packages/pi-coding-agent/dist/core/hooks-runner.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk-tool-filter.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/sdk-tool-filter.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk-tool-filter.test.js +46 -0
- package/packages/pi-coding-agent/dist/core/sdk-tool-filter.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts +10 -2
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +74 -2
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js +22 -0
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +6 -7
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +2 -3
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash-spawn-windows.test.js +22 -56
- package/packages/pi-coding-agent/dist/core/tools/bash-spawn-windows.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.js +12 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/find.js +14 -6
- package/packages/pi-coding-agent/dist/core/tools/find.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/grep.js +12 -3
- package/packages/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/hashline-read.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts +2 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.js +1 -0
- package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/ls.js +10 -3
- package/packages/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/read.js +3 -1
- package/packages/pi-coding-agent/dist/core/tools/read.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.js +7 -62
- package/packages/pi-coding-agent/dist/core/tools/spawn-shell-windows.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.js +115 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target-metadata.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.d.ts +19 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.js +20 -0
- package/packages/pi-coding-agent/dist/core/tools/tool-target.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts +4 -0
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/write.js +9 -1
- package/packages/pi-coding-agent/dist/core/tools/write.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +89 -2
- 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/tool-card-cleanup-and-success-runtime.test.js +25 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +5 -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 +153 -8
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +18 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js +23 -5
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +2 -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 +19 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js +23 -5
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +25 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +40 -7
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +3 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +10 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +3 -3
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +5 -5
- package/packages/pi-coding-agent/src/core/extensions/types.ts +37 -2
- package/packages/pi-coding-agent/src/core/hooks-runner.test.ts +2 -0
- package/packages/pi-coding-agent/src/core/sdk-tool-filter.test.ts +60 -0
- package/packages/pi-coding-agent/src/core/sdk.ts +85 -3
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +28 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +8 -10
- package/packages/pi-coding-agent/src/core/tools/bash-spawn-windows.test.ts +22 -66
- package/packages/pi-coding-agent/src/core/tools/bash.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/edit.ts +13 -1
- package/packages/pi-coding-agent/src/core/tools/find.ts +15 -6
- package/packages/pi-coding-agent/src/core/tools/grep.ts +13 -3
- package/packages/pi-coding-agent/src/core/tools/hashline-read.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/index.ts +8 -0
- package/packages/pi-coding-agent/src/core/tools/ls.ts +11 -3
- package/packages/pi-coding-agent/src/core/tools/read.ts +4 -1
- package/packages/pi-coding-agent/src/core/tools/spawn-shell-windows.test.ts +11 -72
- package/packages/pi-coding-agent/src/core/tools/tool-target-metadata.test.ts +127 -0
- package/packages/pi-coding-agent/src/core/tools/tool-target.ts +48 -0
- package/packages/pi-coding-agent/src/core/tools/write.ts +14 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +119 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +31 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +177 -8
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +24 -5
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +17 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +21 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +25 -8
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +25 -7
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +30 -0
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +26 -0
- package/src/resources/extensions/github-sync/sync.ts +8 -1
- package/src/resources/extensions/github-sync/tests/sync-source.test.ts +6 -18
- package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -2
- package/src/resources/extensions/gsd/auto/loop.ts +84 -8
- package/src/resources/extensions/gsd/auto/phases.ts +258 -159
- package/src/resources/extensions/gsd/auto/resolve.ts +19 -0
- package/src/resources/extensions/gsd/auto/run-unit.ts +10 -29
- package/src/resources/extensions/gsd/auto/session.ts +8 -0
- package/src/resources/extensions/gsd/auto/workflow-dispatch-claim.ts +63 -1
- package/src/resources/extensions/gsd/auto/workflow-worker-heartbeat.ts +14 -1
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +8 -34
- package/src/resources/extensions/gsd/auto-dispatch.ts +16 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +107 -78
- package/src/resources/extensions/gsd/auto-prompts.ts +95 -14
- package/src/resources/extensions/gsd/auto-start.ts +286 -15
- package/src/resources/extensions/gsd/auto-worktree.ts +241 -72
- package/src/resources/extensions/gsd/auto.ts +132 -40
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +116 -24
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +45 -37
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +36 -10
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +8 -3
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +5 -1
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +7 -4
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +6 -3
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +1 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +347 -54
- package/src/resources/extensions/gsd/bootstrap/sanitize-complete-milestone.ts +4 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +90 -22
- package/src/resources/extensions/gsd/clean-root-preflight.ts +32 -7
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +4 -2
- package/src/resources/extensions/gsd/commands-config.ts +1 -1
- package/src/resources/extensions/gsd/commands-eval-review.ts +2 -2
- package/src/resources/extensions/gsd/commands-handlers.ts +34 -15
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +66 -0
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +3 -0
- package/src/resources/extensions/gsd/git-service.ts +41 -2
- package/src/resources/extensions/gsd/guided-flow.ts +71 -39
- package/src/resources/extensions/gsd/init-wizard.ts +5 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +39 -6
- package/src/resources/extensions/gsd/orphan-stash-audit.ts +117 -0
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +13 -3
- package/src/resources/extensions/gsd/pre-execution-checks.ts +23 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +8 -4
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/execute-task.md +4 -2
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/src/resources/extensions/gsd/slice-cadence.ts +49 -2
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +23 -9
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +59 -89
- package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +47 -172
- package/src/resources/extensions/gsd/tests/artifacts-table-preserved-on-cache-invalidate.test.ts +0 -35
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +35 -9
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +361 -10
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +80 -59
- package/src/resources/extensions/gsd/tests/auto-paused-session-validation.test.ts +3 -47
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +76 -18
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/auto-pr-bugs.test.ts +54 -95
- package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +67 -26
- package/src/resources/extensions/gsd/tests/auto-remediate-slice-status.test.ts +32 -30
- package/src/resources/extensions/gsd/tests/auto-start-bootstrap-await-3420.test.ts +32 -128
- package/src/resources/extensions/gsd/tests/auto-start-clean-runtime-db-gated.test.ts +20 -54
- package/src/resources/extensions/gsd/tests/auto-start-cold-db-bootstrap.test.ts +20 -30
- package/src/resources/extensions/gsd/tests/auto-start-index-lock.test.ts +17 -29
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +138 -0
- package/src/resources/extensions/gsd/tests/auto-start-time-persistence.test.ts +21 -39
- package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +15 -24
- package/src/resources/extensions/gsd/tests/auto-thinking-restore.test.ts +44 -29
- package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +39 -51
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +159 -213
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +15 -32
- package/src/resources/extensions/gsd/tests/browser-teardown.test.ts +0 -41
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +15 -6
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +34 -27
- package/src/resources/extensions/gsd/tests/cmux.test.ts +51 -53
- package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +39 -61
- package/src/resources/extensions/gsd/tests/commands-config.test.ts +26 -19
- package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/complete-slice-composer.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/complete-task-normalize-lists.test.ts +29 -33
- package/src/resources/extensions/gsd/tests/completed-units-metrics-sync.test.ts +45 -108
- package/src/resources/extensions/gsd/tests/context-store.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +35 -31
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/cwd-fallback-hardening.test.ts +138 -0
- package/src/resources/extensions/gsd/tests/dashboard-custom-engine.test.ts +4 -68
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +4 -9
- package/src/resources/extensions/gsd/tests/deferred-milestone-dir-4996.test.ts +14 -65
- package/src/resources/extensions/gsd/tests/discuss-tool-scoping.test.ts +44 -37
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +58 -40
- package/src/resources/extensions/gsd/tests/dispatch-guard-closed-status.test.ts +25 -15
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +35 -17
- package/src/resources/extensions/gsd/tests/error-success-mask.test.ts +16 -21
- package/src/resources/extensions/gsd/tests/est-annotation-timeout.test.ts +15 -82
- package/src/resources/extensions/gsd/tests/execute-task-rendering.test.ts +5 -2
- package/src/resources/extensions/gsd/tests/fast-forward-reused-milestone-branch.test.ts +219 -0
- package/src/resources/extensions/gsd/tests/finalize-survivor-branch.test.ts +132 -0
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +2 -20
- package/src/resources/extensions/gsd/tests/frontmatter-parse-noise.test.ts +18 -26
- package/src/resources/extensions/gsd/tests/init-skip-git.test.ts +9 -12
- package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/integration/commands-eval-review.integration.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/integration/git-locale.test.ts +31 -20
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/integration/milestone-transition-worktree.test.ts +0 -47
- package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +60 -202
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +13 -56
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/journal-query-tool.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/lazy-pi-tui-import.test.ts +44 -6
- package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +21 -35
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/milestone-merge-stash-restore.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +79 -98
- package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +70 -278
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +34 -2
- package/src/resources/extensions/gsd/tests/needs-remediation-revalidation.test.ts +37 -30
- package/src/resources/extensions/gsd/tests/note-captures-executed.test.ts +32 -28
- package/src/resources/extensions/gsd/tests/originalbase-path-comparison.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/orphan-merge-bootstrap.test.ts +133 -0
- package/src/resources/extensions/gsd/tests/orphan-stash-audit.test.ts +201 -0
- package/src/resources/extensions/gsd/tests/parallel-orchestrator-fast-forward.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/phantom-ghost-detection.test.ts +24 -37
- package/src/resources/extensions/gsd/tests/phantom-milestone-default-queued.test.ts +9 -24
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +91 -75
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +36 -22
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +36 -30
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +45 -5
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +74 -4
- package/src/resources/extensions/gsd/tests/preferences-worktree-sync.test.ts +20 -22
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +130 -32
- package/src/resources/extensions/gsd/tests/project-root-cwd-crash.test.ts +18 -36
- package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +35 -73
- package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +76 -138
- package/src/resources/extensions/gsd/tests/prompt-duplication-cuts.test.ts +230 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +70 -125
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +59 -161
- package/src/resources/extensions/gsd/tests/query-tools-db-open.test.ts +33 -29
- package/src/resources/extensions/gsd/tests/queue-auto-guard.test.ts +22 -196
- package/src/resources/extensions/gsd/tests/quick-auto-guard.test.ts +23 -93
- package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +50 -79
- package/src/resources/extensions/gsd/tests/reassess-default-optin.test.ts +27 -13
- package/src/resources/extensions/gsd/tests/remote-questions.test.ts +151 -251
- package/src/resources/extensions/gsd/tests/resource-loader-import-path.test.ts +41 -29
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +58 -69
- package/src/resources/extensions/gsd/tests/resume-dispatch-worktree.test.ts +32 -164
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +57 -41
- package/src/resources/extensions/gsd/tests/select-resumable-milestone.test.ts +96 -0
- package/src/resources/extensions/gsd/tests/session-model-override.test.ts +14 -9
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +166 -0
- package/src/resources/extensions/gsd/tests/show-config-command.test.ts +44 -42
- package/src/resources/extensions/gsd/tests/skip-slice-state-rebuild.test.ts +56 -24
- package/src/resources/extensions/gsd/tests/skipped-validation-db-atomicity.test.ts +51 -11
- package/src/resources/extensions/gsd/tests/slice-cadence.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +66 -50
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +68 -107
- package/src/resources/extensions/gsd/tests/slice-sequence-insert.test.ts +115 -42
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +21 -97
- package/src/resources/extensions/gsd/tests/smart-entry-draft.test.ts +25 -116
- package/src/resources/extensions/gsd/tests/sqlite-unavailable-gate.test.ts +21 -57
- package/src/resources/extensions/gsd/tests/stale-dirlistcache-4648.test.ts +29 -76
- package/src/resources/extensions/gsd/tests/stale-lockfile-recovery.test.ts +33 -24
- package/src/resources/extensions/gsd/tests/stale-slice-rows.test.ts +39 -30
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/status-db-open.test.ts +33 -47
- package/src/resources/extensions/gsd/tests/stop-auto-merge-back.test.ts +48 -46
- package/src/resources/extensions/gsd/tests/stop-auto-race-null-unit.test.ts +14 -102
- package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +78 -232
- package/src/resources/extensions/gsd/tests/sync-worktree-skip-current.test.ts +32 -35
- package/src/resources/extensions/gsd/tests/system-context-memory.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/system-context-message-routing.test.ts +7 -9
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +84 -309
- package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +291 -0
- package/src/resources/extensions/gsd/tests/triage-dispatch.test.ts +134 -341
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +8 -25
- package/src/resources/extensions/gsd/tests/unit-dispatches.test.ts +50 -1
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +5 -99
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +43 -36
- package/src/resources/extensions/gsd/tests/visualizer-data.test.ts +84 -444
- package/src/resources/extensions/gsd/tests/workflow-dispatch-claim.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +44 -189
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -57
- package/src/resources/extensions/gsd/tests/workflow-protocol-excerpt.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/workflow-worker-heartbeat.test.ts +32 -1
- package/src/resources/extensions/gsd/tests/worktree-db-same-file.test.ts +21 -44
- package/src/resources/extensions/gsd/tests/worktree-expected-warnings.test.ts +27 -26
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +14 -13
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/worktree-main-branch.test.ts +20 -18
- package/src/resources/extensions/gsd/tests/worktree-path-injection.test.ts +22 -19
- package/src/resources/extensions/gsd/tests/worktree-project-root-degrade.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +140 -3
- package/src/resources/extensions/gsd/tests/zero-slice-roadmap-guided.test.ts +19 -13
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +14 -15
- package/src/resources/extensions/gsd/tools/complete-task.ts +1 -1
- package/src/resources/extensions/gsd/workflow-protocol.ts +160 -0
- package/src/resources/extensions/gsd/worktree-resolver.ts +83 -5
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +86 -40
- package/src/resources/skills/web-quality-audit/scripts/analyze.sh +0 -0
- package/dist/web/standalone/.next/static/chunks/8336.631939fb583761fa.js +0 -10
- /package/dist/web/standalone/.next/static/{tht0ltP8EIjsohPOA_WZf → G68KoLv5claox_Dyd4pZn}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{tht0ltP8EIjsohPOA_WZf → G68KoLv5claox_Dyd4pZn}/_ssgManifest.js +0 -0
|
@@ -9,6 +9,16 @@ export type DispatchClaimOutcome =
|
|
|
9
9
|
| { kind: "skip"; reason: "already-active" | "stale-lease"; existingId?: number; existingWorker?: string }
|
|
10
10
|
| { kind: "degraded" };
|
|
11
11
|
|
|
12
|
+
export type DispatchLeaseOutcome =
|
|
13
|
+
| { kind: "ready"; token: number; recovered: boolean }
|
|
14
|
+
| { kind: "degraded"; reason: "missing-worker" | "missing-milestone" }
|
|
15
|
+
| { kind: "blocked"; reason: string }
|
|
16
|
+
| { kind: "failed"; reason: string };
|
|
17
|
+
|
|
18
|
+
type ClaimMilestoneLeaseResult =
|
|
19
|
+
| { ok: true; token: number; expiresAt: string }
|
|
20
|
+
| { ok: false; error: "held_by"; byWorker: string; expiresAt: string };
|
|
21
|
+
|
|
12
22
|
interface RecentDispatch {
|
|
13
23
|
attempt_n?: number | null;
|
|
14
24
|
}
|
|
@@ -44,6 +54,58 @@ export interface OpenDispatchClaimDeps {
|
|
|
44
54
|
logClaimFailed: (err: unknown) => void;
|
|
45
55
|
}
|
|
46
56
|
|
|
57
|
+
export interface EnsureDispatchLeaseDeps {
|
|
58
|
+
claimMilestoneLease: (workerId: string, milestoneId: string) => ClaimMilestoneLeaseResult;
|
|
59
|
+
logLeaseRecovered: (details: {
|
|
60
|
+
milestoneId: string;
|
|
61
|
+
workerId: string;
|
|
62
|
+
token: number;
|
|
63
|
+
recovered: boolean;
|
|
64
|
+
}) => void;
|
|
65
|
+
logLeaseRecoveryFailed: (details: {
|
|
66
|
+
milestoneId?: string;
|
|
67
|
+
workerId?: string;
|
|
68
|
+
reason: string;
|
|
69
|
+
}) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function ensureDispatchLease(
|
|
73
|
+
s: AutoSession,
|
|
74
|
+
milestoneId: string | undefined,
|
|
75
|
+
deps: EnsureDispatchLeaseDeps,
|
|
76
|
+
opts: { forceReclaim?: boolean } = {},
|
|
77
|
+
): DispatchLeaseOutcome {
|
|
78
|
+
if (!s.workerId) return { kind: "degraded", reason: "missing-worker" };
|
|
79
|
+
if (!milestoneId) return { kind: "degraded", reason: "missing-milestone" };
|
|
80
|
+
if (!opts.forceReclaim && typeof s.milestoneLeaseToken === "number") {
|
|
81
|
+
return { kind: "ready", token: s.milestoneLeaseToken, recovered: false };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
s.milestoneLeaseToken = null;
|
|
85
|
+
try {
|
|
86
|
+
const claim = deps.claimMilestoneLease(s.workerId, milestoneId);
|
|
87
|
+
if (!claim.ok) {
|
|
88
|
+
const reason = `Milestone ${milestoneId} is held by worker ${claim.byWorker} until ${claim.expiresAt}.`;
|
|
89
|
+
deps.logLeaseRecoveryFailed({ milestoneId, workerId: s.workerId, reason });
|
|
90
|
+
return { kind: "blocked", reason };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
s.currentMilestoneId = milestoneId;
|
|
94
|
+
s.milestoneLeaseToken = claim.token;
|
|
95
|
+
deps.logLeaseRecovered({
|
|
96
|
+
milestoneId,
|
|
97
|
+
workerId: s.workerId,
|
|
98
|
+
token: claim.token,
|
|
99
|
+
recovered: opts.forceReclaim === true,
|
|
100
|
+
});
|
|
101
|
+
return { kind: "ready", token: claim.token, recovered: opts.forceReclaim === true };
|
|
102
|
+
} catch (err) {
|
|
103
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
104
|
+
deps.logLeaseRecoveryFailed({ milestoneId, workerId: s.workerId, reason });
|
|
105
|
+
return { kind: "failed", reason };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
47
109
|
export function openDispatchClaim(
|
|
48
110
|
s: AutoSession,
|
|
49
111
|
flowId: string,
|
|
@@ -51,7 +113,7 @@ export function openDispatchClaim(
|
|
|
51
113
|
iterData: IterationData,
|
|
52
114
|
deps: OpenDispatchClaimDeps,
|
|
53
115
|
): DispatchClaimOutcome {
|
|
54
|
-
if (!s.workerId || s.milestoneLeaseToken
|
|
116
|
+
if (!s.workerId || typeof s.milestoneLeaseToken !== "number") return { kind: "degraded" };
|
|
55
117
|
const mid = iterData.mid;
|
|
56
118
|
if (!mid) return { kind: "degraded" };
|
|
57
119
|
|
|
@@ -15,6 +15,11 @@ export interface MaintainWorkerHeartbeatDeps {
|
|
|
15
15
|
fencingToken: number,
|
|
16
16
|
) => boolean;
|
|
17
17
|
logHeartbeatFailure: (err: unknown) => void;
|
|
18
|
+
logLeaseRefreshMiss?: (details: {
|
|
19
|
+
workerId: string;
|
|
20
|
+
milestoneId: string;
|
|
21
|
+
fencingToken: number;
|
|
22
|
+
}) => void;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
export function maintainWorkerHeartbeat(
|
|
@@ -26,11 +31,19 @@ export function maintainWorkerHeartbeat(
|
|
|
26
31
|
try {
|
|
27
32
|
deps.heartbeatAutoWorker(session.workerId);
|
|
28
33
|
if (session.currentMilestoneId && session.milestoneLeaseToken) {
|
|
29
|
-
deps.refreshMilestoneLease(
|
|
34
|
+
const refreshed = deps.refreshMilestoneLease(
|
|
30
35
|
session.workerId,
|
|
31
36
|
session.currentMilestoneId,
|
|
32
37
|
session.milestoneLeaseToken,
|
|
33
38
|
);
|
|
39
|
+
if (!refreshed) {
|
|
40
|
+
deps.logLeaseRefreshMiss?.({
|
|
41
|
+
workerId: session.workerId,
|
|
42
|
+
milestoneId: session.currentMilestoneId,
|
|
43
|
+
fencingToken: session.milestoneLeaseToken,
|
|
44
|
+
});
|
|
45
|
+
session.milestoneLeaseToken = null;
|
|
46
|
+
}
|
|
34
47
|
}
|
|
35
48
|
} catch (err) {
|
|
36
49
|
deps.logHeartbeatFailure(err);
|
|
@@ -31,7 +31,6 @@ import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
|
31
31
|
import type { MinimalModelRegistry } from "./context-budget.js";
|
|
32
32
|
import { pauseAuto } from "./auto.js";
|
|
33
33
|
import { resolveCanonicalMilestoneRoot } from "./worktree-manager.js";
|
|
34
|
-
import { logWarning } from "./workflow-logger.js";
|
|
35
34
|
import {
|
|
36
35
|
getWorkflowTransportSupportError,
|
|
37
36
|
getRequiredWorkflowToolsForAutoUnit,
|
|
@@ -290,38 +289,13 @@ export async function dispatchDirectPhase(
|
|
|
290
289
|
|
|
291
290
|
ctx.ui.notify(`Dispatching ${unitType} for ${unitId}...`, "info");
|
|
292
291
|
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
// no awaits between chdir and newSession.
|
|
298
|
-
try {
|
|
299
|
-
if (process.cwd() !== dispatchBase) {
|
|
300
|
-
process.chdir(dispatchBase);
|
|
301
|
-
}
|
|
302
|
-
} catch (err) {
|
|
303
|
-
const msg = `Failed to chdir before direct-dispatch newSession (basePath: ${dispatchBase}): ${err instanceof Error ? err.message : String(err)}`;
|
|
304
|
-
logWarning("engine", msg, { file: "auto-direct-dispatch.ts", basePath: dispatchBase, error: err instanceof Error ? err.message : String(err) });
|
|
305
|
-
ctx.ui.notify(`${msg}. Cancelling dispatch to avoid running in the wrong directory.`, "error");
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const result = await ctx.newSession();
|
|
310
|
-
if (result.cancelled) {
|
|
311
|
-
ctx.ui.notify("Session creation cancelled.", "warning");
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
pi.sendMessage(
|
|
315
|
-
{ customType: "gsd-dispatch", content: prompt, display: false },
|
|
316
|
-
{ triggerTurn: true },
|
|
317
|
-
);
|
|
318
|
-
} finally {
|
|
319
|
-
try {
|
|
320
|
-
if (process.cwd() !== originalCwd) {
|
|
321
|
-
process.chdir(originalCwd);
|
|
322
|
-
}
|
|
323
|
-
} catch (err) {
|
|
324
|
-
logWarning("engine", `Failed to restore cwd after direct dispatch: ${err instanceof Error ? err.message : String(err)}`, { file: "auto-direct-dispatch.ts", basePath: originalCwd });
|
|
325
|
-
}
|
|
292
|
+
const result = await ctx.newSession({ workspaceRoot: dispatchBase });
|
|
293
|
+
if (result.cancelled) {
|
|
294
|
+
ctx.ui.notify("Session creation cancelled.", "warning");
|
|
295
|
+
return;
|
|
326
296
|
}
|
|
297
|
+
pi.sendMessage(
|
|
298
|
+
{ customType: "gsd-dispatch", content: prompt, display: false },
|
|
299
|
+
{ triggerTurn: true },
|
|
300
|
+
);
|
|
327
301
|
}
|
|
@@ -938,6 +938,22 @@ export const DISPATCH_RULES: DispatchRule[] = [
|
|
|
938
938
|
const unitId = `${mid}/${sid}`;
|
|
939
939
|
let priorPreExecFailure: { blockingFindings: string[]; verdictExcerpt: string } | undefined;
|
|
940
940
|
if (session?.lastPreExecFailure?.unitId === unitId) {
|
|
941
|
+
// Circuit breaker: stop re-dispatching after 2 failed retries. The
|
|
942
|
+
// planner has had multiple attempts with injected failure context and
|
|
943
|
+
// still cannot produce a valid plan — human review is required.
|
|
944
|
+
const MAX_PRE_EXEC_RETRIES = 2;
|
|
945
|
+
const retryCount = session.preExecRetryCount?.get(unitId) ?? 0;
|
|
946
|
+
if (retryCount >= MAX_PRE_EXEC_RETRIES) {
|
|
947
|
+
const findings = session.lastPreExecFailure.blockingFindings.join("; ");
|
|
948
|
+
session.lastPreExecFailure = null;
|
|
949
|
+
session.preExecRetryCount?.delete(unitId);
|
|
950
|
+
return {
|
|
951
|
+
action: "stop",
|
|
952
|
+
reason: `Pre-execution checks failed ${retryCount} times for ${unitId} — manual intervention required. Blocking findings: ${findings}. Fix the plan manually, then run /gsd auto to resume.`,
|
|
953
|
+
level: "error",
|
|
954
|
+
matchedRule: "planning → plan-slice",
|
|
955
|
+
};
|
|
956
|
+
}
|
|
941
957
|
priorPreExecFailure = {
|
|
942
958
|
blockingFindings: session.lastPreExecFailure.blockingFindings,
|
|
943
959
|
verdictExcerpt: session.lastPreExecFailure.verdictExcerpt,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Auto-mode post-unit git, verification, projection, and hook processing.
|
|
1
3
|
/**
|
|
2
4
|
* Post-unit processing for auto-loop — auto-commit, doctor run,
|
|
3
5
|
* state rebuild, projection checks, DB tool closeout, hooks, triage, and
|
|
@@ -103,6 +105,67 @@ function formatPreExecutionCheckDetail(check: PreExecutionCheckJSON): string {
|
|
|
103
105
|
const COMPLETE_MILESTONE_DB_SETTLE_MS = 1500;
|
|
104
106
|
const COMPLETE_MILESTONE_DB_SETTLE_POLL_MS = 100;
|
|
105
107
|
|
|
108
|
+
function stripKnownIdPrefix(value: string | undefined | null, id: string): string | undefined {
|
|
109
|
+
const raw = String(value ?? "").trim();
|
|
110
|
+
if (!raw) return undefined;
|
|
111
|
+
const lower = raw.toLowerCase();
|
|
112
|
+
const idLower = id.toLowerCase();
|
|
113
|
+
if (lower.startsWith(`${idLower}:`)) return raw.slice(id.length + 1).trim() || undefined;
|
|
114
|
+
return raw;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function buildTaskCommitContextForUnit(
|
|
118
|
+
basePath: string,
|
|
119
|
+
unitId: string,
|
|
120
|
+
): Promise<TaskCommitContext | undefined> {
|
|
121
|
+
const { milestone: mid, slice: sid, task: tid } = parseUnitId(unitId);
|
|
122
|
+
if (!mid || !sid || !tid) return undefined;
|
|
123
|
+
|
|
124
|
+
const milestone = isDbAvailable() ? getMilestone(mid) : null;
|
|
125
|
+
const slice = isDbAvailable() ? getSlice(mid, sid) : null;
|
|
126
|
+
const task = isDbAvailable() ? getTask(mid, sid, tid) : null;
|
|
127
|
+
let summary: ReturnType<typeof parseSummary> | null = null;
|
|
128
|
+
|
|
129
|
+
const summaryPath = resolveTaskFile(basePath, mid, sid, tid, "SUMMARY");
|
|
130
|
+
if (summaryPath) {
|
|
131
|
+
try {
|
|
132
|
+
const summaryContent = await loadFile(summaryPath);
|
|
133
|
+
if (summaryContent) summary = parseSummary(summaryContent);
|
|
134
|
+
} catch (e) {
|
|
135
|
+
debugLog("postUnit", { phase: "task-summary-parse", error: String(e) });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!summary && !task) return undefined;
|
|
140
|
+
|
|
141
|
+
let ghIssueNumber: number | undefined;
|
|
142
|
+
try {
|
|
143
|
+
const { getTaskIssueNumberForCommit } = await import("../github-sync/sync.js");
|
|
144
|
+
ghIssueNumber = getTaskIssueNumberForCommit(basePath, mid, sid, tid) ?? undefined;
|
|
145
|
+
} catch (err) {
|
|
146
|
+
logWarning("engine", `GitHub issue lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
taskId: `${sid}/${tid}`,
|
|
151
|
+
taskDisplayId: tid,
|
|
152
|
+
taskTitle:
|
|
153
|
+
stripKnownIdPrefix(summary?.title, tid) ??
|
|
154
|
+
stripKnownIdPrefix(task?.title, tid) ??
|
|
155
|
+
tid,
|
|
156
|
+
milestoneId: mid,
|
|
157
|
+
milestoneTitle: stripKnownIdPrefix(milestone?.title, mid),
|
|
158
|
+
sliceId: sid,
|
|
159
|
+
sliceTitle: stripKnownIdPrefix(slice?.title, sid),
|
|
160
|
+
oneLiner: summary?.oneLiner || task?.one_liner || undefined,
|
|
161
|
+
keyFiles:
|
|
162
|
+
summary?.frontmatter.key_files?.filter(f => !f.includes("{{")) ??
|
|
163
|
+
task?.key_files ??
|
|
164
|
+
undefined,
|
|
165
|
+
issueNumber: ghIssueNumber,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
106
169
|
async function waitForMilestoneDbClose(mid: string): Promise<boolean> {
|
|
107
170
|
const deadline = Date.now() + COMPLETE_MILESTONE_DB_SETTLE_MS;
|
|
108
171
|
while (Date.now() < deadline) {
|
|
@@ -134,6 +197,26 @@ function enqueueSidecar(
|
|
|
134
197
|
if (notification) ctx.ui.notify(notification, "info");
|
|
135
198
|
return "continue";
|
|
136
199
|
}
|
|
200
|
+
|
|
201
|
+
export function _shouldDispatchTriageForTest(
|
|
202
|
+
state: Pick<AutoSession, "stepMode" | "currentUnit">,
|
|
203
|
+
): boolean {
|
|
204
|
+
return !state.stepMode &&
|
|
205
|
+
!!state.currentUnit &&
|
|
206
|
+
!state.currentUnit.type.startsWith("hook/") &&
|
|
207
|
+
state.currentUnit.type !== "triage-captures" &&
|
|
208
|
+
state.currentUnit.type !== "quick-task";
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function _shouldDispatchQuickTaskForTest(
|
|
212
|
+
state: Pick<AutoSession, "stepMode" | "currentUnit" | "pendingQuickTasks">,
|
|
213
|
+
): boolean {
|
|
214
|
+
return !state.stepMode &&
|
|
215
|
+
state.pendingQuickTasks.length > 0 &&
|
|
216
|
+
!!state.currentUnit &&
|
|
217
|
+
state.currentUnit.type !== "quick-task";
|
|
218
|
+
}
|
|
219
|
+
|
|
137
220
|
/** Unit types that only touch `.gsd/` internal state files (no code changes).
|
|
138
221
|
* Auto-commit is skipped for these — their state files are picked up by the
|
|
139
222
|
* next actual task commit via `smartStage()`. */
|
|
@@ -276,7 +359,7 @@ export function detectRogueFileWrites(
|
|
|
276
359
|
* in auto-verification.ts. Exceeding this limit pauses auto-mode instead of
|
|
277
360
|
* looping indefinitely (#2007).
|
|
278
361
|
*/
|
|
279
|
-
const MAX_ARTIFACT_VERIFICATION_RETRIES = 3;
|
|
362
|
+
export const MAX_ARTIFACT_VERIFICATION_RETRIES = 3;
|
|
280
363
|
|
|
281
364
|
export const STEP_COMPLETE_FALLBACK_MESSAGE =
|
|
282
365
|
"Step complete. Run /clear, then /gsd to continue (or /gsd auto to run continuously).";
|
|
@@ -357,35 +440,7 @@ export async function autoCommitUnit(
|
|
|
357
440
|
let taskContext: TaskCommitContext | undefined;
|
|
358
441
|
|
|
359
442
|
if (unitType === "execute-task") {
|
|
360
|
-
|
|
361
|
-
if (mid && sid && tid) {
|
|
362
|
-
const summaryPath = resolveTaskFile(basePath, mid, sid, tid, "SUMMARY");
|
|
363
|
-
if (summaryPath) {
|
|
364
|
-
try {
|
|
365
|
-
const summaryContent = await loadFile(summaryPath);
|
|
366
|
-
if (summaryContent) {
|
|
367
|
-
const summary = parseSummary(summaryContent);
|
|
368
|
-
let ghIssueNumber: number | undefined;
|
|
369
|
-
try {
|
|
370
|
-
const { getTaskIssueNumberForCommit } = await import("../github-sync/sync.js");
|
|
371
|
-
ghIssueNumber = getTaskIssueNumberForCommit(basePath, mid, sid, tid) ?? undefined;
|
|
372
|
-
} catch (err) {
|
|
373
|
-
logWarning("engine", `GitHub issue lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
taskContext = {
|
|
377
|
-
taskId: `${sid}/${tid}`,
|
|
378
|
-
taskTitle: summary.title?.replace(/^T\d+:\s*/, "") || tid,
|
|
379
|
-
oneLiner: summary.oneLiner || undefined,
|
|
380
|
-
keyFiles: summary.frontmatter.key_files?.filter(f => !f.includes("{{")) || undefined,
|
|
381
|
-
issueNumber: ghIssueNumber,
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
} catch (e) {
|
|
385
|
-
debugLog("postUnit", { phase: "task-summary-parse", error: String(e) });
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
443
|
+
taskContext = await buildTaskCommitContextForUnit(basePath, unitId);
|
|
389
444
|
}
|
|
390
445
|
|
|
391
446
|
_resetHasChangesCache();
|
|
@@ -457,37 +512,7 @@ export async function postUnitPreVerification(pctx: PostUnitContext, opts?: PreV
|
|
|
457
512
|
let taskContext: TaskCommitContext | undefined;
|
|
458
513
|
|
|
459
514
|
if (turnAction === "commit" && s.currentUnit.type === "execute-task") {
|
|
460
|
-
|
|
461
|
-
if (mid && sid && tid) {
|
|
462
|
-
const summaryPath = resolveTaskFile(s.basePath, mid, sid, tid, "SUMMARY");
|
|
463
|
-
if (summaryPath) {
|
|
464
|
-
try {
|
|
465
|
-
const summaryContent = await loadFile(summaryPath);
|
|
466
|
-
if (summaryContent) {
|
|
467
|
-
const summary = parseSummary(summaryContent);
|
|
468
|
-
// Look up GitHub issue number for commit linking
|
|
469
|
-
let ghIssueNumber: number | undefined;
|
|
470
|
-
try {
|
|
471
|
-
const { getTaskIssueNumberForCommit } = await import("../github-sync/sync.js");
|
|
472
|
-
ghIssueNumber = getTaskIssueNumberForCommit(s.basePath, mid, sid, tid) ?? undefined;
|
|
473
|
-
} catch (err) {
|
|
474
|
-
// GitHub sync not available — skip
|
|
475
|
-
logWarning("engine", `GitHub issue lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
taskContext = {
|
|
479
|
-
taskId: `${sid}/${tid}`,
|
|
480
|
-
taskTitle: summary.title?.replace(/^T\d+:\s*/, "") || tid,
|
|
481
|
-
oneLiner: summary.oneLiner || undefined,
|
|
482
|
-
keyFiles: summary.frontmatter.key_files?.filter(f => !f.includes("{{")) || undefined,
|
|
483
|
-
issueNumber: ghIssueNumber,
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
} catch (e) {
|
|
487
|
-
debugLog("postUnit", { phase: "task-summary-parse", error: String(e) });
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
515
|
+
taskContext = await buildTaskCommitContextForUnit(s.basePath, s.currentUnit.id);
|
|
491
516
|
}
|
|
492
517
|
|
|
493
518
|
// Invalidate the nativeHasChanges cache before auto-commit (#1853).
|
|
@@ -1320,8 +1345,12 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1320
1345
|
|
|
1321
1346
|
const strictMode = prefs?.enhanced_verification_strict === true;
|
|
1322
1347
|
|
|
1323
|
-
// Run pre-execution checks
|
|
1324
|
-
|
|
1348
|
+
// Run pre-execution checks against s.basePath — the actual checkout
|
|
1349
|
+
// where prior-slice files were created. In worktree isolation,
|
|
1350
|
+
// s.canonicalProjectRoot is the project root and lacks files that a
|
|
1351
|
+
// prior slice wrote to the worktree but hasn't merged to main yet.
|
|
1352
|
+
const preExecutionBasePath = s.basePath;
|
|
1353
|
+
const result: PreExecutionResult = await runPreExecutionChecks(tasks, preExecutionBasePath);
|
|
1325
1354
|
|
|
1326
1355
|
// Log summary to stderr in existing verification output format
|
|
1327
1356
|
const emoji = result.status === "pass" ? "✅" : result.status === "warn" ? "⚠️" : "❌";
|
|
@@ -1338,12 +1367,12 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1338
1367
|
}
|
|
1339
1368
|
|
|
1340
1369
|
// Write evidence JSON to slice artifacts directory
|
|
1341
|
-
const slicePath = resolveSlicePath(
|
|
1370
|
+
const slicePath = resolveSlicePath(preExecutionBasePath, mid, sid);
|
|
1342
1371
|
const evidenceFileName = `${sid}-PRE-EXEC-VERIFY.json`;
|
|
1343
1372
|
let evidencePath = join(".gsd", "milestones", mid, "slices", sid, evidenceFileName);
|
|
1344
1373
|
if (slicePath) {
|
|
1345
1374
|
writePreExecutionEvidence(result, slicePath, mid, sid);
|
|
1346
|
-
evidencePath = relative(
|
|
1375
|
+
evidencePath = relative(preExecutionBasePath, join(slicePath, evidenceFileName)) || evidenceFileName;
|
|
1347
1376
|
}
|
|
1348
1377
|
|
|
1349
1378
|
if (uokFlags.gates) {
|
|
@@ -1398,6 +1427,9 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1398
1427
|
),
|
|
1399
1428
|
verdictExcerpt: `status=${result.status}; ${blockingCount} blocking issue${blockingCount === 1 ? "" : "s"} detected`,
|
|
1400
1429
|
};
|
|
1430
|
+
// Track consecutive pre-exec failures per slice for loop detection.
|
|
1431
|
+
const retryKey = currentUnit.id;
|
|
1432
|
+
s.preExecRetryCount.set(retryKey, (s.preExecRetryCount.get(retryKey) ?? 0) + 1);
|
|
1401
1433
|
preExecPauseNeeded = true;
|
|
1402
1434
|
} else if (result.status === "warn") {
|
|
1403
1435
|
ctx.ui.notify(
|
|
@@ -1414,10 +1446,18 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1414
1446
|
),
|
|
1415
1447
|
verdictExcerpt: `status=${result.status} (strict mode); ${warnChecks.length} warning${warnChecks.length === 1 ? "" : "s"} treated as blocking`,
|
|
1416
1448
|
};
|
|
1449
|
+
const retryKey = currentUnit.id;
|
|
1450
|
+
s.preExecRetryCount.set(retryKey, (s.preExecRetryCount.get(retryKey) ?? 0) + 1);
|
|
1417
1451
|
preExecPauseNeeded = true;
|
|
1418
1452
|
}
|
|
1419
1453
|
}
|
|
1420
1454
|
|
|
1455
|
+
// Reset the retry counter when checks pass — a successful re-plan
|
|
1456
|
+
// should not carry over a stale failure count into future slices.
|
|
1457
|
+
if (result.status === "pass") {
|
|
1458
|
+
s.preExecRetryCount.delete(currentUnit.id);
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1421
1461
|
debugLog("postUnitPostVerification", {
|
|
1422
1462
|
phase: "pre-execution-checks",
|
|
1423
1463
|
status: result.status,
|
|
@@ -1473,13 +1513,7 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1473
1513
|
}
|
|
1474
1514
|
|
|
1475
1515
|
// ── Triage check ──
|
|
1476
|
-
if (
|
|
1477
|
-
!s.stepMode &&
|
|
1478
|
-
s.currentUnit &&
|
|
1479
|
-
!s.currentUnit.type.startsWith("hook/") &&
|
|
1480
|
-
s.currentUnit.type !== "triage-captures" &&
|
|
1481
|
-
s.currentUnit.type !== "quick-task"
|
|
1482
|
-
) {
|
|
1516
|
+
if (_shouldDispatchTriageForTest(s)) {
|
|
1483
1517
|
try {
|
|
1484
1518
|
if (hasPendingCaptures(s.basePath)) {
|
|
1485
1519
|
const pending = loadPendingCaptures(s.basePath);
|
|
@@ -1527,12 +1561,7 @@ export async function postUnitPostVerification(pctx: PostUnitContext): Promise<"
|
|
|
1527
1561
|
}
|
|
1528
1562
|
|
|
1529
1563
|
// ── Quick-task dispatch ──
|
|
1530
|
-
if (
|
|
1531
|
-
!s.stepMode &&
|
|
1532
|
-
s.pendingQuickTasks.length > 0 &&
|
|
1533
|
-
s.currentUnit &&
|
|
1534
|
-
s.currentUnit.type !== "quick-task"
|
|
1535
|
-
) {
|
|
1564
|
+
if (_shouldDispatchQuickTaskForTest(s)) {
|
|
1536
1565
|
try {
|
|
1537
1566
|
const capture = s.pendingQuickTasks.shift()!;
|
|
1538
1567
|
const { buildQuickTaskPrompt } = await import("./triage-resolution.js");
|
|
@@ -45,12 +45,12 @@ import { classifyProject, type ProjectClassification } from "./detection.js";
|
|
|
45
45
|
// ─── Preamble Cap ─────────────────────────────────────────────────────────────
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Static ceiling for the preamble cap. Kept as an upper bound even
|
|
49
49
|
* after context-window-aware sizing so large-window users don't suddenly see
|
|
50
|
-
* 10× looser caps than
|
|
50
|
+
* 10× looser caps than needed. Small-window users get a tighter cap derived
|
|
51
51
|
* from their configured executor window.
|
|
52
52
|
*/
|
|
53
|
-
const MAX_PREAMBLE_CHARS =
|
|
53
|
+
const MAX_PREAMBLE_CHARS = 20_000;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Resolve prompt budgets from the configured executor context window.
|
|
@@ -185,8 +185,8 @@ function formatCloseoutReviewInstructions(validationContent: string | null, vali
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
function capPreamble(preamble: string): string {
|
|
188
|
-
// Cap inlined context at min(
|
|
189
|
-
// The ceiling
|
|
188
|
+
// Cap inlined context at min(static ceiling, scaled inline budget).
|
|
189
|
+
// The ceiling bounds repeated auto prompt payloads; the scaled
|
|
190
190
|
// budget tightens the cap for small-window users whose true safe limit is
|
|
191
191
|
// below 30K. `computeBudgets` allocates 40% of total chars to inline context.
|
|
192
192
|
const budget = Math.min(MAX_PREAMBLE_CHARS, resolvePromptBudgets().inlineContextBudgetChars);
|
|
@@ -636,10 +636,83 @@ export async function buildSliceSummaryExcerpt(
|
|
|
636
636
|
return lines.join("\n");
|
|
637
637
|
} catch {
|
|
638
638
|
// Defensive — any parse failure falls back to full inline.
|
|
639
|
-
return `### ${sid} Summary\nSource: \`${relPath}\`\n\n${content
|
|
639
|
+
return `### ${sid} Summary\nSource: \`${relPath}\`\n\n${capMalformedSummary(content, relPath)}`;
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
|
|
643
|
+
export async function buildTaskSummaryExcerpt(
|
|
644
|
+
absPath: string | null, relPath: string, tid: string, options?: { blocker?: boolean },
|
|
645
|
+
): Promise<string> {
|
|
646
|
+
const label = options?.blocker ? "Blocker Task Summary" : "Task Summary";
|
|
647
|
+
const header = `### ${label}: ${tid} (excerpt)\nSource: \`${relPath}\``;
|
|
648
|
+
const content = absPath ? await loadFile(absPath) : null;
|
|
649
|
+
if (!content) {
|
|
650
|
+
return `${header}\n\n_(not found — file does not exist yet)_`;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
try {
|
|
654
|
+
const s = parseSummary(content);
|
|
655
|
+
if (!s.frontmatter.id) {
|
|
656
|
+
return `### ${label}: ${tid}\nSource: \`${relPath}\`\n\n${capMalformedSummary(content, relPath)}`;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const lines: string[] = [header, ""];
|
|
660
|
+
if (s.title) lines.push(`**Title:** ${s.title}`);
|
|
661
|
+
if (s.oneLiner) lines.push(`**One-liner:** ${s.oneLiner}`);
|
|
662
|
+
if (s.frontmatter.verification_result) {
|
|
663
|
+
lines.push(`**Verification:** \`${s.frontmatter.verification_result}\``);
|
|
664
|
+
}
|
|
665
|
+
lines.push(`**Blocker discovered:** ${s.frontmatter.blocker_discovered ? "yes — read full summary if blocker details are insufficient" : "no"}`);
|
|
666
|
+
if (s.frontmatter.provides.length > 0) lines.push(`**Provides:** ${s.frontmatter.provides.slice(0, 4).join("; ")}`);
|
|
667
|
+
if (s.frontmatter.key_decisions.length > 0) lines.push(`**Key decisions:** ${s.frontmatter.key_decisions.slice(0, 4).join("; ")}`);
|
|
668
|
+
if (s.frontmatter.patterns_established.length > 0) lines.push(`**Patterns established:** ${s.frontmatter.patterns_established.slice(0, 4).join("; ")}`);
|
|
669
|
+
if (s.frontmatter.key_files.length > 0) {
|
|
670
|
+
const files = s.frontmatter.key_files.slice(0, 6);
|
|
671
|
+
const more = s.frontmatter.key_files.length > files.length ? ` (+${s.frontmatter.key_files.length - files.length} more)` : "";
|
|
672
|
+
lines.push(`**Key files:** ${files.join(", ")}${more}`);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
const SECTION_CAP_CHARS = 500;
|
|
676
|
+
const capSection = (body: string): string => {
|
|
677
|
+
const trimmed = body.trim();
|
|
678
|
+
if (trimmed.length <= SECTION_CAP_CHARS) return trimmed;
|
|
679
|
+
return `${trimmed.slice(0, SECTION_CAP_CHARS)}\n… (truncated — see full \`${relPath}\`)`;
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
const verification = extractMarkdownSection(content, "Verification");
|
|
683
|
+
const diagnostics = extractMarkdownSection(content, "Diagnostics");
|
|
684
|
+
const knownIssues = extractMarkdownSection(content, "Known Issues");
|
|
685
|
+
|
|
686
|
+
if (verification && verification.trim()) {
|
|
687
|
+
lines.push("", "#### Verification", capSection(verification));
|
|
688
|
+
}
|
|
689
|
+
if (diagnostics && diagnostics.trim()) {
|
|
690
|
+
lines.push("", "#### Diagnostics", capSection(diagnostics));
|
|
691
|
+
}
|
|
692
|
+
if (s.deviations && s.deviations.trim()) {
|
|
693
|
+
lines.push("", "#### Deviations", capSection(s.deviations));
|
|
694
|
+
}
|
|
695
|
+
if (knownIssues && knownIssues.trim()) {
|
|
696
|
+
lines.push("", "#### Known issues", capSection(knownIssues));
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
lines.push(
|
|
700
|
+
"",
|
|
701
|
+
`> **On-demand:** read \`${relPath}\` only when this excerpt is absent/truncated or you need fuller blocker, implementation, or file-change evidence.`,
|
|
702
|
+
);
|
|
703
|
+
return lines.join("\n");
|
|
704
|
+
} catch {
|
|
705
|
+
return `### ${label}: ${tid}\nSource: \`${relPath}\`\n\n${capMalformedSummary(content, relPath)}`;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
function capMalformedSummary(content: string, relPath: string): string {
|
|
710
|
+
const trimmed = content.trim();
|
|
711
|
+
const limit = 1_500;
|
|
712
|
+
if (trimmed.length <= limit) return trimmed;
|
|
713
|
+
return `${trimmed.slice(0, limit).trimEnd()}\n\n[Truncated malformed summary — read \`${relPath}\` for full details.]`;
|
|
714
|
+
}
|
|
715
|
+
|
|
643
716
|
/**
|
|
644
717
|
* Load and inline dependency slice summaries (full content, not just paths).
|
|
645
718
|
*/
|
|
@@ -914,7 +987,7 @@ export async function inlineKnowledgeScoped(
|
|
|
914
987
|
* plan-milestone, complete-slice, complete-milestone, validate-milestone,
|
|
915
988
|
* reassess-roadmap) previously injected the full KNOWLEDGE.md (~226KB for a
|
|
916
989
|
* real project) on every invocation. This helper scopes by caller-supplied
|
|
917
|
-
* keywords and caps the payload at `maxChars` (default
|
|
990
|
+
* keywords and caps the payload at `maxChars` (default 12,000 chars).
|
|
918
991
|
*
|
|
919
992
|
* Returns null when no KNOWLEDGE.md exists or no entries match any keyword.
|
|
920
993
|
*/
|
|
@@ -923,7 +996,7 @@ export async function inlineKnowledgeBudgeted(
|
|
|
923
996
|
keywords: string[],
|
|
924
997
|
options?: { maxChars?: number },
|
|
925
998
|
): Promise<string | null> {
|
|
926
|
-
const DEFAULT_MAX_CHARS =
|
|
999
|
+
const DEFAULT_MAX_CHARS = 12_000;
|
|
927
1000
|
const HARD_MAX_CHARS = 100_000;
|
|
928
1001
|
const raw = Number(options?.maxChars ?? DEFAULT_MAX_CHARS);
|
|
929
1002
|
const maxChars = Number.isFinite(raw)
|
|
@@ -2085,8 +2158,17 @@ export async function buildPlanSlicePrompt(
|
|
|
2085
2158
|
`The previous plan-slice attempt was blocked by pre-execution validation.\n` +
|
|
2086
2159
|
`Gate verdict: ${verdictExcerpt}\n\n` +
|
|
2087
2160
|
`Blocked references that must be resolved in this plan:\n${findingsList}\n\n` +
|
|
2088
|
-
|
|
2089
|
-
|
|
2161
|
+
`**How to fix each type of issue:**\n` +
|
|
2162
|
+
`- **"[file] X doesn't exist and isn't created by prior or same-task outputs"**: ` +
|
|
2163
|
+
`Either (a) add an earlier task that creates X on disk before the task that needs it, ` +
|
|
2164
|
+
`or (b) if this task IS the one that creates X, move X from inputs to expected_output. ` +
|
|
2165
|
+
`Do NOT put X in a task's expected_output if that task only reads or verifies X — only tasks that actually write X to disk should list it in expected_output.\n` +
|
|
2166
|
+
`- **"[file] X: Task T_early reads X but it's created by task T_late (sequence violation)"**: ` +
|
|
2167
|
+
`Either (a) reorder tasks so T_late (the creator) runs before T_early (the reader), ` +
|
|
2168
|
+
`or (b) if T_late doesn't actually create X (it only reads/tests it), remove X from T_late's expected_output entirely.\n` +
|
|
2169
|
+
`- **"[package] P not found on npm"**: Either remove the npm install for P, or use the correct package name.\n\n` +
|
|
2170
|
+
`Every file listed in a task's inputs must either exist on disk already or appear in an earlier task's expected_output. ` +
|
|
2171
|
+
`A task's expected_output must only list files it actually writes to disk.`,
|
|
2090
2172
|
);
|
|
2091
2173
|
}
|
|
2092
2174
|
return renderSlicePrompt({
|
|
@@ -2369,10 +2451,9 @@ export async function buildCompleteSlicePrompt(
|
|
|
2369
2451
|
const blocks: string[] = [];
|
|
2370
2452
|
for (const file of summaryFiles) {
|
|
2371
2453
|
const absPath = join(tDir, file);
|
|
2372
|
-
const content = await loadFile(absPath);
|
|
2373
|
-
if (!content) continue;
|
|
2374
2454
|
const relPath = `${sRel}/tasks/${file}`;
|
|
2375
|
-
|
|
2455
|
+
const taskId = file.replace(/-SUMMARY\.md$/i, "");
|
|
2456
|
+
blocks.push(await buildTaskSummaryExcerpt(absPath, relPath, taskId));
|
|
2376
2457
|
}
|
|
2377
2458
|
return blocks.length > 0 ? blocks.join("\n\n---\n\n") : null;
|
|
2378
2459
|
}
|
|
@@ -2749,7 +2830,7 @@ export async function buildReplanSlicePrompt(
|
|
|
2749
2830
|
const relPath = `${sRel}/tasks/${file}`;
|
|
2750
2831
|
if (summary.frontmatter.blocker_discovered) {
|
|
2751
2832
|
blockerTaskId = summary.frontmatter.id || file.replace(/-SUMMARY\.md$/i, "");
|
|
2752
|
-
inlined.push(
|
|
2833
|
+
inlined.push(await buildTaskSummaryExcerpt(absPath, relPath, blockerTaskId, { blocker: true }));
|
|
2753
2834
|
}
|
|
2754
2835
|
}
|
|
2755
2836
|
}
|