gsd-pi 2.80.0-dev.96f4d89d5 → 2.80.0-dev.b0acf17e9
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/README.md +4 -2
- 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/GSD-WORKFLOW.md +2 -2
- 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 +103 -9
- package/dist/resources/extensions/gsd/auto/phases.js +240 -139
- package/dist/resources/extensions/gsd/auto/resolve.js +29 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +22 -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 +26 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +103 -86
- package/dist/resources/extensions/gsd/auto-prompts.js +214 -17
- package/dist/resources/extensions/gsd/auto-recovery.js +197 -9
- package/dist/resources/extensions/gsd/auto-start.js +240 -15
- package/dist/resources/extensions/gsd/auto-supervisor.js +8 -1
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +2 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +165 -28
- package/dist/resources/extensions/gsd/auto.js +165 -45
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +99 -10
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +50 -37
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +35 -10
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +36 -20
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +10 -1
- package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +12 -4
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +11 -3
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +1 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +330 -55
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +82 -23
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +129 -1
- package/dist/resources/extensions/gsd/clean-root-preflight.js +65 -9
- package/dist/resources/extensions/gsd/commands/dispatcher.js +5 -0
- 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-extract-learnings.js +17 -12
- package/dist/resources/extensions/gsd/commands-handlers.js +23 -9
- package/dist/resources/extensions/gsd/context-budget.js +37 -2
- package/dist/resources/extensions/gsd/crash-recovery.js +56 -10
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +92 -0
- package/dist/resources/extensions/gsd/db-base-schema.js +18 -2
- package/dist/resources/extensions/gsd/db-migration-steps.js +22 -0
- package/dist/resources/extensions/gsd/detection.js +106 -0
- package/dist/resources/extensions/gsd/ecosystem/gsd-extension-api.js +2 -0
- package/dist/resources/extensions/gsd/git-service.js +73 -5
- package/dist/resources/extensions/gsd/gsd-db.js +146 -13
- package/dist/resources/extensions/gsd/guided-flow.js +143 -48
- package/dist/resources/extensions/gsd/init-wizard.js +4 -1
- package/dist/resources/extensions/gsd/memory-store.js +69 -12
- package/dist/resources/extensions/gsd/migrate/command.js +40 -1
- package/dist/resources/extensions/gsd/migration-auto-check.js +87 -0
- 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/planning-path-scope.js +26 -0
- package/dist/resources/extensions/gsd/pre-execution-checks.js +22 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +28 -2
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +21 -19
- 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/parallel-research-slices.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -5
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
- package/dist/resources/extensions/gsd/quick.js +34 -2
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +10 -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-task.js +1 -1
- package/dist/resources/extensions/gsd/tools/context-mode-tool-result.js +15 -0
- package/dist/resources/extensions/gsd/tools/exec-search-tool.js +5 -0
- package/dist/resources/extensions/gsd/tools/exec-tool.js +3 -15
- package/dist/resources/extensions/gsd/tools/memory-tools.js +1 -0
- package/dist/resources/extensions/gsd/tools/plan-slice.js +9 -0
- package/dist/resources/extensions/gsd/tools/plan-task.js +9 -0
- package/dist/resources/extensions/gsd/tools/resume-tool.js +5 -0
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +1 -1
- package/dist/resources/extensions/gsd/unit-context-composer.js +12 -3
- package/dist/resources/extensions/gsd/unit-runtime.js +22 -0
- package/dist/resources/extensions/gsd/workflow-protocol.js +131 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +16 -14
- package/dist/resources/extensions/gsd/worktree-resolver.js +90 -22
- 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 +12 -12
- 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/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 +12 -12
- 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/welcome-screen.d.ts +2 -0
- package/dist/welcome-screen.js +9 -7
- package/package.json +6 -4
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +22 -17
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +75 -2
- package/packages/mcp-server/src/workflow-tools.ts +30 -16
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/tsconfig.tsbuildinfo +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-abort-order.test.js +32 -0
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +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 +44 -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 +78 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +11 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +9 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js +103 -0
- package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts +15 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.js +66 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.js +24 -0
- package/packages/pi-coding-agent/dist/core/db-snapshot.test.js.map +1 -0
- 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 +5 -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 +20 -7
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +102 -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 +41 -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/settings-manager.d.ts +20 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +25 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.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__/chat-frame-compaction-tone.test.js +6 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/chat-frame-compaction-tone.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +137 -19
- 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/adaptive-layout.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js.map +1 -1
- 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.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +7 -6
- 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 +18 -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 +225 -16
- 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 +85 -2
- 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 +71 -0
- 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.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +3 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +36 -27
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js +21 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js +28 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage-safety-guard.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js +3 -2
- package/packages/pi-coding-agent/dist/resources/extensions/memory/storage.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +36 -0
- 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 +48 -7
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +91 -0
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +18 -0
- package/packages/pi-coding-agent/src/core/compaction-threshold.test.ts +121 -0
- package/packages/pi-coding-agent/src/core/db-snapshot.test.ts +32 -0
- package/packages/pi-coding-agent/src/core/db-snapshot.ts +66 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +10 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +113 -3
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +24 -6
- package/packages/pi-coding-agent/src/core/extensions/types.ts +44 -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/settings-manager.ts +39 -1
- 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__/chat-frame-compaction-tone.test.ts +7 -5
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +185 -19
- package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +10 -9
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +260 -16
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +75 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +107 -3
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +3 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +36 -27
- package/packages/pi-coding-agent/src/modes/interactive/tui-mode.test.ts +25 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +31 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage.ts +3 -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 +18 -8
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/tui.ts +20 -8
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.js +36 -27
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
- package/src/resources/GSD-WORKFLOW.md +2 -2
- 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 +3 -2
- package/src/resources/extensions/gsd/auto/loop.ts +134 -16
- package/src/resources/extensions/gsd/auto/phases.ts +328 -200
- package/src/resources/extensions/gsd/auto/resolve.ts +42 -1
- package/src/resources/extensions/gsd/auto/run-unit.ts +28 -30
- 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 +33 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +116 -88
- package/src/resources/extensions/gsd/auto-prompts.ts +228 -16
- package/src/resources/extensions/gsd/auto-recovery.ts +207 -7
- package/src/resources/extensions/gsd/auto-start.ts +293 -21
- package/src/resources/extensions/gsd/auto-supervisor.ts +7 -0
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +2 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +199 -30
- package/src/resources/extensions/gsd/auto.ts +216 -40
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +120 -8
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +51 -37
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +35 -10
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +38 -19
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +11 -1
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +13 -4
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +12 -3
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +1 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +386 -55
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +90 -22
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +135 -1
- package/src/resources/extensions/gsd/clean-root-preflight.ts +72 -9
- package/src/resources/extensions/gsd/commands/dispatcher.ts +6 -0
- 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-extract-learnings.ts +17 -12
- package/src/resources/extensions/gsd/commands-handlers.ts +34 -15
- package/src/resources/extensions/gsd/context-budget.ts +44 -2
- package/src/resources/extensions/gsd/crash-recovery.ts +67 -10
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +107 -0
- package/src/resources/extensions/gsd/db-base-schema.ts +19 -2
- package/src/resources/extensions/gsd/db-migration-steps.ts +25 -0
- package/src/resources/extensions/gsd/detection.ts +128 -0
- package/src/resources/extensions/gsd/ecosystem/gsd-extension-api.ts +3 -0
- package/src/resources/extensions/gsd/git-service.ts +87 -10
- package/src/resources/extensions/gsd/gsd-db.ts +168 -13
- package/src/resources/extensions/gsd/guided-flow.ts +169 -55
- package/src/resources/extensions/gsd/init-wizard.ts +5 -1
- package/src/resources/extensions/gsd/memory-store.ts +77 -12
- package/src/resources/extensions/gsd/migrate/command.ts +47 -1
- package/src/resources/extensions/gsd/migration-auto-check.ts +129 -0
- 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/planning-path-scope.ts +35 -0
- package/src/resources/extensions/gsd/pre-execution-checks.ts +23 -0
- package/src/resources/extensions/gsd/preferences-types.ts +1 -1
- package/src/resources/extensions/gsd/prompt-loader.ts +27 -2
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +21 -19
- 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/parallel-research-slices.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +3 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/quick-task.md +1 -5
- package/src/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
- package/src/resources/extensions/gsd/quick.ts +37 -2
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +11 -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 +433 -11
- 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 +160 -11
- 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-recovery.test.ts +184 -2
- 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 +97 -2
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +34 -27
- package/src/resources/extensions/gsd/tests/cmux.test.ts +42 -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/commands-extract-learnings.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +14 -1
- package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +31 -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-budget.test.ts +10 -1
- package/src/resources/extensions/gsd/tests/context-store.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/crash-handler-secondary.test.ts +90 -31
- package/src/resources/extensions/gsd/tests/crash-recovery-via-db.test.ts +22 -0
- 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/db-schema-metadata.test.ts +2 -2
- 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/detection.test.ts +140 -0
- 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/dispatch-rule-coverage.test.ts +313 -0
- 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/exec-history.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +65 -0
- 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/gsd-db.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/has-pending-deep-stage.test.ts +33 -1
- 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 +35 -0
- package/src/resources/extensions/gsd/tests/integration/git-locale.test.ts +31 -20
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +66 -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 +239 -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-decay-factor.test.ts +90 -0
- 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/migrate-writer-integration.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +127 -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/plan-slice.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +21 -0
- 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/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-path-audit.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +70 -106
- 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-external-gsd.test.ts +40 -0
- 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/right-sized-workflow-prompts.test.ts +192 -0
- package/src/resources/extensions/gsd/tests/run-uat-replay-cap.test.ts +57 -41
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/schema-v27-v28-sequence.test.ts +156 -0
- 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/signal-handlers.test.ts +27 -0
- 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 -59
- 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/stalled-tool-recovery.test.ts +49 -1
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +101 -2
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/status-db-open.test.ts +35 -40
- package/src/resources/extensions/gsd/tests/stop-auto-merge-back.test.ts +36 -45
- 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-composer.test.ts +136 -4
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +8 -25
- package/src/resources/extensions/gsd/tests/unit-dispatches.test.ts +80 -1
- package/src/resources/extensions/gsd/tests/unit-runtime.test.ts +37 -0
- 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-tool-executors.test.ts +3 -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 +38 -6
- 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-manager.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +9 -2
- 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 +203 -4
- package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/zero-slice-roadmap-guided.test.ts +19 -13
- package/src/resources/extensions/gsd/tools/complete-task.ts +1 -1
- package/src/resources/extensions/gsd/tools/context-mode-tool-result.ts +25 -0
- package/src/resources/extensions/gsd/tools/exec-search-tool.ts +7 -7
- package/src/resources/extensions/gsd/tools/exec-tool.ts +4 -23
- package/src/resources/extensions/gsd/tools/memory-tools.ts +1 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +13 -0
- package/src/resources/extensions/gsd/tools/plan-task.ts +10 -0
- package/src/resources/extensions/gsd/tools/resume-tool.ts +7 -7
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +1 -1
- package/src/resources/extensions/gsd/unit-context-composer.ts +19 -4
- package/src/resources/extensions/gsd/unit-runtime.ts +25 -0
- package/src/resources/extensions/gsd/workflow-protocol.ts +160 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +15 -4
- package/src/resources/extensions/gsd/worktree-resolver.ts +119 -20
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +86 -40
- package/dist/web/standalone/.next/static/chunks/8336.631939fb583761fa.js +0 -10
- /package/dist/web/standalone/.next/static/{y7d--cnc6Cibuva-Lzzw_ → naNyn5ToUBzCQtuLbEYXC}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{y7d--cnc6Cibuva-Lzzw_ → naNyn5ToUBzCQtuLbEYXC}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// GSD-2 + src/resources/extensions/gsd/auto/run-unit.ts - Runs one GSD auto-mode unit from session creation through agent completion.
|
|
2
2
|
import { NEW_SESSION_TIMEOUT_MS } from "./session.js";
|
|
3
|
-
import { _clearCurrentResolve, _setCurrentResolve, _setSessionSwitchInFlight } from "./resolve.js";
|
|
3
|
+
import { _clearCurrentResolve, _consumePendingSwitchCancellation, _markSessionSwitchAbortGraceWindow, _setCurrentResolve, _setSessionSwitchInFlight, } from "./resolve.js";
|
|
4
4
|
import { getCurrentTurnGeneration, runWithTurnGeneration, } from "./turn-epoch.js";
|
|
5
5
|
import { debugLog } from "../debug-logger.js";
|
|
6
6
|
import { logWarning } from "../workflow-logger.js";
|
|
@@ -19,44 +19,23 @@ let sessionSwitchGeneration = 0;
|
|
|
19
19
|
*/
|
|
20
20
|
export async function runUnit(ctx, pi, s, unitType, unitId, prompt) {
|
|
21
21
|
debugLog("runUnit", { phase: "start", unitType, unitId });
|
|
22
|
-
// Ensure cwd matches basePath BEFORE newSession() captures it. The new
|
|
23
|
-
// session reads process.cwd() during construction to anchor its tool
|
|
24
|
-
// runtime and system prompt; if cwd has drifted (async_bash, background
|
|
25
|
-
// jobs, prior unit cleanup), the session would otherwise be rooted to
|
|
26
|
-
// the wrong directory. Must be synchronous — no awaits between chdir
|
|
27
|
-
// and newSession (#1389, #4762 follow-up).
|
|
28
|
-
try {
|
|
29
|
-
if (process.cwd() !== s.basePath) {
|
|
30
|
-
process.chdir(s.basePath);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
const msg = `Failed to chdir to basePath before newSession (basePath: ${s.basePath}): ${String(e)}`;
|
|
35
|
-
logWarning("engine", msg, { basePath: s.basePath, error: String(e) });
|
|
36
|
-
return {
|
|
37
|
-
status: "cancelled",
|
|
38
|
-
errorContext: {
|
|
39
|
-
message: msg,
|
|
40
|
-
category: "session-failed",
|
|
41
|
-
isTransient: true,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
22
|
// ── Session creation with timeout ──
|
|
46
23
|
debugLog("runUnit", { phase: "session-create", unitType, unitId });
|
|
47
24
|
let sessionResult;
|
|
48
25
|
let sessionTimeoutHandle;
|
|
49
26
|
const mySessionSwitchGeneration = ++sessionSwitchGeneration;
|
|
50
|
-
// #3731: Cancellation controller for newSession(). When
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
// it from capturing the (now-root) process.cwd() and rebuilding the tool
|
|
54
|
-
// runtime with the wrong cwd.
|
|
27
|
+
// #3731: Cancellation controller for newSession(). When session creation
|
|
28
|
+
// times out, abort before a late session switch can rebuild the tool runtime
|
|
29
|
+
// against a stale workspace root.
|
|
55
30
|
const sessionAbortController = new AbortController();
|
|
56
31
|
_setSessionSwitchInFlight(true);
|
|
57
32
|
try {
|
|
58
|
-
const sessionPromise = s.cmdCtx.newSession({
|
|
33
|
+
const sessionPromise = s.cmdCtx.newSession({
|
|
34
|
+
abortSignal: sessionAbortController.signal,
|
|
35
|
+
workspaceRoot: s.basePath,
|
|
36
|
+
}).finally(() => {
|
|
59
37
|
if (sessionSwitchGeneration === mySessionSwitchGeneration) {
|
|
38
|
+
_markSessionSwitchAbortGraceWindow();
|
|
60
39
|
_setSessionSwitchInFlight(false);
|
|
61
40
|
}
|
|
62
41
|
});
|
|
@@ -71,6 +50,7 @@ export async function runUnit(ctx, pi, s, unitType, unitId, prompt) {
|
|
|
71
50
|
catch (sessionErr) {
|
|
72
51
|
if (sessionTimeoutHandle)
|
|
73
52
|
clearTimeout(sessionTimeoutHandle);
|
|
53
|
+
_consumePendingSwitchCancellation();
|
|
74
54
|
const msg = sessionErr instanceof Error ? sessionErr.message : String(sessionErr);
|
|
75
55
|
debugLog("runUnit", {
|
|
76
56
|
phase: "session-error",
|
|
@@ -83,15 +63,18 @@ export async function runUnit(ctx, pi, s, unitType, unitId, prompt) {
|
|
|
83
63
|
if (sessionTimeoutHandle)
|
|
84
64
|
clearTimeout(sessionTimeoutHandle);
|
|
85
65
|
if (sessionResult.cancelled) {
|
|
66
|
+
_consumePendingSwitchCancellation();
|
|
86
67
|
debugLog("runUnit-session-timeout", { unitType, unitId });
|
|
87
68
|
return { status: "cancelled", errorContext: { message: "Session creation timed out", category: "timeout", isTransient: true } };
|
|
88
69
|
}
|
|
89
70
|
if (!s.active) {
|
|
71
|
+
_consumePendingSwitchCancellation();
|
|
90
72
|
return { status: "cancelled" };
|
|
91
73
|
}
|
|
92
74
|
if (s.currentUnitModel && typeof pi.setModel === "function") {
|
|
93
75
|
const restored = await pi.setModel(s.currentUnitModel, { persist: false });
|
|
94
76
|
if (!restored) {
|
|
77
|
+
_consumePendingSwitchCancellation();
|
|
95
78
|
const message = `Failed to restore configured model ${s.currentUnitModel.provider}/${s.currentUnitModel.id} after session creation`;
|
|
96
79
|
ctx.ui.notify(`${message}. Cancelling unit before dispatch.`, "warning");
|
|
97
80
|
return {
|
|
@@ -107,10 +90,19 @@ export async function runUnit(ctx, pi, s, unitType, unitId, prompt) {
|
|
|
107
90
|
// ── Create the agent_end promise (per-unit one-shot) ──
|
|
108
91
|
// This happens after newSession completes so session-switch agent_end events
|
|
109
92
|
// from the previous session cannot resolve the new unit.
|
|
93
|
+
_markSessionSwitchAbortGraceWindow();
|
|
110
94
|
_setSessionSwitchInFlight(false);
|
|
111
95
|
const unitPromise = new Promise((resolve) => {
|
|
112
96
|
_setCurrentResolve(resolve);
|
|
113
97
|
});
|
|
98
|
+
const pendingSwitchCancellation = _consumePendingSwitchCancellation();
|
|
99
|
+
if (pendingSwitchCancellation) {
|
|
100
|
+
_clearCurrentResolve();
|
|
101
|
+
return {
|
|
102
|
+
status: "cancelled",
|
|
103
|
+
...(pendingSwitchCancellation.errorContext ? { errorContext: pendingSwitchCancellation.errorContext } : {}),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
114
106
|
// ── Provider request-readiness pre-check (#4555) ──
|
|
115
107
|
// Verify the provider can accept requests before dispatching. If the token
|
|
116
108
|
// has expired since bootstrap, return cancelled immediately so the unit is
|
|
@@ -106,6 +106,13 @@ export class AutoSession {
|
|
|
106
106
|
* stale context bleeding into unrelated slices.
|
|
107
107
|
*/
|
|
108
108
|
lastPreExecFailure = null;
|
|
109
|
+
/**
|
|
110
|
+
* Tracks how many consecutive times each slice unit has failed pre-execution
|
|
111
|
+
* checks. Keyed by unitId (e.g. "M001/S01"). Used to break the infinite
|
|
112
|
+
* plan-slice → pre-exec fail → re-dispatch loop when the planner cannot fix
|
|
113
|
+
* the issues after MAX_PRE_EXEC_RETRIES re-attempts.
|
|
114
|
+
*/
|
|
115
|
+
preExecRetryCount = new Map();
|
|
109
116
|
// ── Tool invocation errors (#2883) ──────────────────────────────────
|
|
110
117
|
/** Set when a GSD tool execution ends with isError due to malformed/truncated
|
|
111
118
|
* JSON arguments. Checked by postUnitPreVerification to break retry loops. */
|
|
@@ -258,6 +265,7 @@ export class AutoSession {
|
|
|
258
265
|
this.rewriteAttemptCount = 0;
|
|
259
266
|
this.consecutiveCompleteBootstraps = 0;
|
|
260
267
|
this.lastPreExecFailure = null;
|
|
268
|
+
this.preExecRetryCount.clear();
|
|
261
269
|
this.lastToolInvocationError = null;
|
|
262
270
|
this.lastUnitAgentEndMessages = null;
|
|
263
271
|
this.lastGitActionFailure = null;
|
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
// Project/App: GSD-2
|
|
2
2
|
// File Purpose: Best-effort unit dispatch claim adapter for auto-mode loop.
|
|
3
|
+
export function ensureDispatchLease(s, milestoneId, deps, opts = {}) {
|
|
4
|
+
if (!s.workerId)
|
|
5
|
+
return { kind: "degraded", reason: "missing-worker" };
|
|
6
|
+
if (!milestoneId)
|
|
7
|
+
return { kind: "degraded", reason: "missing-milestone" };
|
|
8
|
+
if (!opts.forceReclaim && typeof s.milestoneLeaseToken === "number") {
|
|
9
|
+
return { kind: "ready", token: s.milestoneLeaseToken, recovered: false };
|
|
10
|
+
}
|
|
11
|
+
s.milestoneLeaseToken = null;
|
|
12
|
+
try {
|
|
13
|
+
const claim = deps.claimMilestoneLease(s.workerId, milestoneId);
|
|
14
|
+
if (!claim.ok) {
|
|
15
|
+
const reason = `Milestone ${milestoneId} is held by worker ${claim.byWorker} until ${claim.expiresAt}.`;
|
|
16
|
+
deps.logLeaseRecoveryFailed({ milestoneId, workerId: s.workerId, reason });
|
|
17
|
+
return { kind: "blocked", reason };
|
|
18
|
+
}
|
|
19
|
+
s.currentMilestoneId = milestoneId;
|
|
20
|
+
s.milestoneLeaseToken = claim.token;
|
|
21
|
+
deps.logLeaseRecovered({
|
|
22
|
+
milestoneId,
|
|
23
|
+
workerId: s.workerId,
|
|
24
|
+
token: claim.token,
|
|
25
|
+
recovered: opts.forceReclaim === true,
|
|
26
|
+
});
|
|
27
|
+
return { kind: "ready", token: claim.token, recovered: opts.forceReclaim === true };
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
31
|
+
deps.logLeaseRecoveryFailed({ milestoneId, workerId: s.workerId, reason });
|
|
32
|
+
return { kind: "failed", reason };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
3
35
|
export function openDispatchClaim(s, flowId, turnId, iterData, deps) {
|
|
4
|
-
if (!s.workerId || s.milestoneLeaseToken
|
|
36
|
+
if (!s.workerId || typeof s.milestoneLeaseToken !== "number")
|
|
5
37
|
return { kind: "degraded" };
|
|
6
38
|
const mid = iterData.mid;
|
|
7
39
|
if (!mid)
|
|
@@ -6,7 +6,15 @@ export function maintainWorkerHeartbeat(session, deps) {
|
|
|
6
6
|
try {
|
|
7
7
|
deps.heartbeatAutoWorker(session.workerId);
|
|
8
8
|
if (session.currentMilestoneId && session.milestoneLeaseToken) {
|
|
9
|
-
deps.refreshMilestoneLease(session.workerId, session.currentMilestoneId, session.milestoneLeaseToken);
|
|
9
|
+
const refreshed = deps.refreshMilestoneLease(session.workerId, session.currentMilestoneId, session.milestoneLeaseToken);
|
|
10
|
+
if (!refreshed) {
|
|
11
|
+
deps.logLeaseRefreshMiss?.({
|
|
12
|
+
workerId: session.workerId,
|
|
13
|
+
milestoneId: session.currentMilestoneId,
|
|
14
|
+
fencingToken: session.milestoneLeaseToken,
|
|
15
|
+
});
|
|
16
|
+
session.milestoneLeaseToken = null;
|
|
17
|
+
}
|
|
10
18
|
}
|
|
11
19
|
}
|
|
12
20
|
catch (err) {
|
|
@@ -11,7 +11,6 @@ import { buildResearchSlicePrompt, buildResearchMilestonePrompt, buildPlanSliceP
|
|
|
11
11
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
12
12
|
import { pauseAuto } from "./auto.js";
|
|
13
13
|
import { resolveCanonicalMilestoneRoot } from "./worktree-manager.js";
|
|
14
|
-
import { logWarning } from "./workflow-logger.js";
|
|
15
14
|
import { getWorkflowTransportSupportError, getRequiredWorkflowToolsForAutoUnit, } from "./workflow-mcp.js";
|
|
16
15
|
export async function dispatchDirectPhase(ctx, pi, phase, base) {
|
|
17
16
|
const state = await deriveState(base);
|
|
@@ -231,36 +230,10 @@ export async function dispatchDirectPhase(ctx, pi, phase, base) {
|
|
|
231
230
|
return;
|
|
232
231
|
}
|
|
233
232
|
ctx.ui.notify(`Dispatching ${unitType} for ${unitId}...`, "info");
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
try {
|
|
239
|
-
if (process.cwd() !== dispatchBase) {
|
|
240
|
-
process.chdir(dispatchBase);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
catch (err) {
|
|
244
|
-
const msg = `Failed to chdir before direct-dispatch newSession (basePath: ${dispatchBase}): ${err instanceof Error ? err.message : String(err)}`;
|
|
245
|
-
logWarning("engine", msg, { file: "auto-direct-dispatch.ts", basePath: dispatchBase, error: err instanceof Error ? err.message : String(err) });
|
|
246
|
-
ctx.ui.notify(`${msg}. Cancelling dispatch to avoid running in the wrong directory.`, "error");
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
const result = await ctx.newSession();
|
|
250
|
-
if (result.cancelled) {
|
|
251
|
-
ctx.ui.notify("Session creation cancelled.", "warning");
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
pi.sendMessage({ customType: "gsd-dispatch", content: prompt, display: false }, { triggerTurn: true });
|
|
255
|
-
}
|
|
256
|
-
finally {
|
|
257
|
-
try {
|
|
258
|
-
if (process.cwd() !== originalCwd) {
|
|
259
|
-
process.chdir(originalCwd);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
catch (err) {
|
|
263
|
-
logWarning("engine", `Failed to restore cwd after direct dispatch: ${err instanceof Error ? err.message : String(err)}`, { file: "auto-direct-dispatch.ts", basePath: originalCwd });
|
|
264
|
-
}
|
|
233
|
+
const result = await ctx.newSession({ workspaceRoot: dispatchBase });
|
|
234
|
+
if (result.cancelled) {
|
|
235
|
+
ctx.ui.notify("Session creation cancelled.", "warning");
|
|
236
|
+
return;
|
|
265
237
|
}
|
|
238
|
+
pi.sendMessage({ customType: "gsd-dispatch", content: prompt, display: false }, { triggerTurn: true });
|
|
266
239
|
}
|
|
@@ -93,6 +93,16 @@ export function hasPendingDeepStage(prefs, basePath) {
|
|
|
93
93
|
const gate = getDeepStageGate(prefs, basePath);
|
|
94
94
|
return gate.status === "pending" || gate.status === "blocked";
|
|
95
95
|
}
|
|
96
|
+
export function shouldRunDeepProjectSetup(state, prefs, basePath, options = {}) {
|
|
97
|
+
if (options.hasSurvivorBranch === true)
|
|
98
|
+
return false;
|
|
99
|
+
if (state.phase !== "pre-planning" &&
|
|
100
|
+
state.phase !== "needs-discussion" &&
|
|
101
|
+
state.phase !== "planning") {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return hasPendingDeepStage(prefs, basePath);
|
|
105
|
+
}
|
|
96
106
|
function missingSliceStop(mid, phase) {
|
|
97
107
|
return {
|
|
98
108
|
action: "stop",
|
|
@@ -781,6 +791,22 @@ export const DISPATCH_RULES = [
|
|
|
781
791
|
const unitId = `${mid}/${sid}`;
|
|
782
792
|
let priorPreExecFailure;
|
|
783
793
|
if (session?.lastPreExecFailure?.unitId === unitId) {
|
|
794
|
+
// Circuit breaker: stop re-dispatching after 2 failed retries. The
|
|
795
|
+
// planner has had multiple attempts with injected failure context and
|
|
796
|
+
// still cannot produce a valid plan — human review is required.
|
|
797
|
+
const MAX_PRE_EXEC_RETRIES = 2;
|
|
798
|
+
const retryCount = session.preExecRetryCount?.get(unitId) ?? 0;
|
|
799
|
+
if (retryCount >= MAX_PRE_EXEC_RETRIES) {
|
|
800
|
+
const findings = session.lastPreExecFailure.blockingFindings.join("; ");
|
|
801
|
+
session.lastPreExecFailure = null;
|
|
802
|
+
session.preExecRetryCount?.delete(unitId);
|
|
803
|
+
return {
|
|
804
|
+
action: "stop",
|
|
805
|
+
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.`,
|
|
806
|
+
level: "error",
|
|
807
|
+
matchedRule: "planning → plan-slice",
|
|
808
|
+
};
|
|
809
|
+
}
|
|
784
810
|
priorPreExecFailure = {
|
|
785
811
|
blockingFindings: session.lastPreExecFailure.blockingFindings,
|
|
786
812
|
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
|
|
@@ -25,7 +27,7 @@ import { verifyExpectedArtifact, resolveExpectedArtifactPath, writeBlockerPlaceh
|
|
|
25
27
|
import { regenerateIfMissing } from "./workflow-projections.js";
|
|
26
28
|
import { syncStateToProjectRoot } from "./auto-worktree.js";
|
|
27
29
|
import { normalizeWorktreePathForCompare } from "./worktree-root.js";
|
|
28
|
-
import { isDbAvailable, getTask, getSlice, getMilestone, updateTaskStatus, _getAdapter } from "./gsd-db.js";
|
|
30
|
+
import { isDbAvailable, getTask, getSlice, getMilestone, updateTaskStatus, _getAdapter, getVerificationEvidence } from "./gsd-db.js";
|
|
29
31
|
import { renderPlanCheckboxes } from "./markdown-renderer.js";
|
|
30
32
|
import { consumeSignal } from "./session-status-io.js";
|
|
31
33
|
import { checkPostUnitHooks, isRetryPending, consumeRetryTrigger, persistHookState, resolveHookArtifactPath, } from "./post-unit-hooks.js";
|
|
@@ -70,6 +72,62 @@ function formatPreExecutionCheckDetail(check) {
|
|
|
70
72
|
}
|
|
71
73
|
const COMPLETE_MILESTONE_DB_SETTLE_MS = 1500;
|
|
72
74
|
const COMPLETE_MILESTONE_DB_SETTLE_POLL_MS = 100;
|
|
75
|
+
function stripKnownIdPrefix(value, id) {
|
|
76
|
+
const raw = String(value ?? "").trim();
|
|
77
|
+
if (!raw)
|
|
78
|
+
return undefined;
|
|
79
|
+
const lower = raw.toLowerCase();
|
|
80
|
+
const idLower = id.toLowerCase();
|
|
81
|
+
if (lower.startsWith(`${idLower}:`))
|
|
82
|
+
return raw.slice(id.length + 1).trim() || undefined;
|
|
83
|
+
return raw;
|
|
84
|
+
}
|
|
85
|
+
async function buildTaskCommitContextForUnit(basePath, unitId) {
|
|
86
|
+
const { milestone: mid, slice: sid, task: tid } = parseUnitId(unitId);
|
|
87
|
+
if (!mid || !sid || !tid)
|
|
88
|
+
return undefined;
|
|
89
|
+
const milestone = isDbAvailable() ? getMilestone(mid) : null;
|
|
90
|
+
const slice = isDbAvailable() ? getSlice(mid, sid) : null;
|
|
91
|
+
const task = isDbAvailable() ? getTask(mid, sid, tid) : null;
|
|
92
|
+
let summary = null;
|
|
93
|
+
const summaryPath = resolveTaskFile(basePath, mid, sid, tid, "SUMMARY");
|
|
94
|
+
if (summaryPath) {
|
|
95
|
+
try {
|
|
96
|
+
const summaryContent = await loadFile(summaryPath);
|
|
97
|
+
if (summaryContent)
|
|
98
|
+
summary = parseSummary(summaryContent);
|
|
99
|
+
}
|
|
100
|
+
catch (e) {
|
|
101
|
+
debugLog("postUnit", { phase: "task-summary-parse", error: String(e) });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (!summary && !task)
|
|
105
|
+
return undefined;
|
|
106
|
+
let ghIssueNumber;
|
|
107
|
+
try {
|
|
108
|
+
const { getTaskIssueNumberForCommit } = await import("../github-sync/sync.js");
|
|
109
|
+
ghIssueNumber = getTaskIssueNumberForCommit(basePath, mid, sid, tid) ?? undefined;
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
logWarning("engine", `GitHub issue lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
taskId: `${sid}/${tid}`,
|
|
116
|
+
taskDisplayId: tid,
|
|
117
|
+
taskTitle: stripKnownIdPrefix(summary?.title, tid) ??
|
|
118
|
+
stripKnownIdPrefix(task?.title, tid) ??
|
|
119
|
+
tid,
|
|
120
|
+
milestoneId: mid,
|
|
121
|
+
milestoneTitle: stripKnownIdPrefix(milestone?.title, mid),
|
|
122
|
+
sliceId: sid,
|
|
123
|
+
sliceTitle: stripKnownIdPrefix(slice?.title, sid),
|
|
124
|
+
oneLiner: summary?.oneLiner || task?.one_liner || undefined,
|
|
125
|
+
keyFiles: summary?.frontmatter.key_files?.filter(f => !f.includes("{{")) ??
|
|
126
|
+
task?.key_files ??
|
|
127
|
+
undefined,
|
|
128
|
+
issueNumber: ghIssueNumber,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
73
131
|
async function waitForMilestoneDbClose(mid) {
|
|
74
132
|
const deadline = Date.now() + COMPLETE_MILESTONE_DB_SETTLE_MS;
|
|
75
133
|
while (Date.now() < deadline) {
|
|
@@ -96,6 +154,19 @@ function enqueueSidecar(s, ctx, entry, debugExtra, notification) {
|
|
|
96
154
|
ctx.ui.notify(notification, "info");
|
|
97
155
|
return "continue";
|
|
98
156
|
}
|
|
157
|
+
export function _shouldDispatchTriageForTest(state) {
|
|
158
|
+
return !state.stepMode &&
|
|
159
|
+
!!state.currentUnit &&
|
|
160
|
+
!state.currentUnit.type.startsWith("hook/") &&
|
|
161
|
+
state.currentUnit.type !== "triage-captures" &&
|
|
162
|
+
state.currentUnit.type !== "quick-task";
|
|
163
|
+
}
|
|
164
|
+
export function _shouldDispatchQuickTaskForTest(state) {
|
|
165
|
+
return !state.stepMode &&
|
|
166
|
+
state.pendingQuickTasks.length > 0 &&
|
|
167
|
+
!!state.currentUnit &&
|
|
168
|
+
state.currentUnit.type !== "quick-task";
|
|
169
|
+
}
|
|
99
170
|
/** Unit types that only touch `.gsd/` internal state files (no code changes).
|
|
100
171
|
* Auto-commit is skipped for these — their state files are picked up by the
|
|
101
172
|
* next actual task commit via `smartStage()`. */
|
|
@@ -216,7 +287,7 @@ export function detectRogueFileWrites(unitType, unitId, basePath) {
|
|
|
216
287
|
* in auto-verification.ts. Exceeding this limit pauses auto-mode instead of
|
|
217
288
|
* looping indefinitely (#2007).
|
|
218
289
|
*/
|
|
219
|
-
const MAX_ARTIFACT_VERIFICATION_RETRIES = 3;
|
|
290
|
+
export const MAX_ARTIFACT_VERIFICATION_RETRIES = 3;
|
|
220
291
|
export const STEP_COMPLETE_FALLBACK_MESSAGE = "Step complete. Run /clear, then /gsd to continue (or /gsd auto to run continuously).";
|
|
221
292
|
export function buildStepCompleteMessage(nextState) {
|
|
222
293
|
if (nextState.phase === "complete") {
|
|
@@ -267,36 +338,7 @@ export async function autoCommitUnit(basePath, unitType, unitId, ctx) {
|
|
|
267
338
|
try {
|
|
268
339
|
let taskContext;
|
|
269
340
|
if (unitType === "execute-task") {
|
|
270
|
-
|
|
271
|
-
if (mid && sid && tid) {
|
|
272
|
-
const summaryPath = resolveTaskFile(basePath, mid, sid, tid, "SUMMARY");
|
|
273
|
-
if (summaryPath) {
|
|
274
|
-
try {
|
|
275
|
-
const summaryContent = await loadFile(summaryPath);
|
|
276
|
-
if (summaryContent) {
|
|
277
|
-
const summary = parseSummary(summaryContent);
|
|
278
|
-
let ghIssueNumber;
|
|
279
|
-
try {
|
|
280
|
-
const { getTaskIssueNumberForCommit } = await import("../github-sync/sync.js");
|
|
281
|
-
ghIssueNumber = getTaskIssueNumberForCommit(basePath, mid, sid, tid) ?? undefined;
|
|
282
|
-
}
|
|
283
|
-
catch (err) {
|
|
284
|
-
logWarning("engine", `GitHub issue lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
285
|
-
}
|
|
286
|
-
taskContext = {
|
|
287
|
-
taskId: `${sid}/${tid}`,
|
|
288
|
-
taskTitle: summary.title?.replace(/^T\d+:\s*/, "") || tid,
|
|
289
|
-
oneLiner: summary.oneLiner || undefined,
|
|
290
|
-
keyFiles: summary.frontmatter.key_files?.filter(f => !f.includes("{{")) || undefined,
|
|
291
|
-
issueNumber: ghIssueNumber,
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
catch (e) {
|
|
296
|
-
debugLog("postUnit", { phase: "task-summary-parse", error: String(e) });
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
341
|
+
taskContext = await buildTaskCommitContextForUnit(basePath, unitId);
|
|
300
342
|
}
|
|
301
343
|
_resetHasChangesCache();
|
|
302
344
|
if (LIFECYCLE_ONLY_UNITS.has(unitType)) {
|
|
@@ -359,38 +401,7 @@ export async function postUnitPreVerification(pctx, opts) {
|
|
|
359
401
|
try {
|
|
360
402
|
let taskContext;
|
|
361
403
|
if (turnAction === "commit" && s.currentUnit.type === "execute-task") {
|
|
362
|
-
|
|
363
|
-
if (mid && sid && tid) {
|
|
364
|
-
const summaryPath = resolveTaskFile(s.basePath, mid, sid, tid, "SUMMARY");
|
|
365
|
-
if (summaryPath) {
|
|
366
|
-
try {
|
|
367
|
-
const summaryContent = await loadFile(summaryPath);
|
|
368
|
-
if (summaryContent) {
|
|
369
|
-
const summary = parseSummary(summaryContent);
|
|
370
|
-
// Look up GitHub issue number for commit linking
|
|
371
|
-
let ghIssueNumber;
|
|
372
|
-
try {
|
|
373
|
-
const { getTaskIssueNumberForCommit } = await import("../github-sync/sync.js");
|
|
374
|
-
ghIssueNumber = getTaskIssueNumberForCommit(s.basePath, mid, sid, tid) ?? undefined;
|
|
375
|
-
}
|
|
376
|
-
catch (err) {
|
|
377
|
-
// GitHub sync not available — skip
|
|
378
|
-
logWarning("engine", `GitHub issue lookup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
379
|
-
}
|
|
380
|
-
taskContext = {
|
|
381
|
-
taskId: `${sid}/${tid}`,
|
|
382
|
-
taskTitle: summary.title?.replace(/^T\d+:\s*/, "") || tid,
|
|
383
|
-
oneLiner: summary.oneLiner || undefined,
|
|
384
|
-
keyFiles: summary.frontmatter.key_files?.filter(f => !f.includes("{{")) || undefined,
|
|
385
|
-
issueNumber: ghIssueNumber,
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
catch (e) {
|
|
390
|
-
debugLog("postUnit", { phase: "task-summary-parse", error: String(e) });
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
404
|
+
taskContext = await buildTaskCommitContextForUnit(s.basePath, s.currentUnit.id);
|
|
394
405
|
}
|
|
395
406
|
// Invalidate the nativeHasChanges cache before auto-commit (#1853).
|
|
396
407
|
// The cache has a 10-second TTL and is keyed by basePath. A stale
|
|
@@ -719,21 +730,21 @@ export async function postUnitPreVerification(pctx, opts) {
|
|
|
719
730
|
}
|
|
720
731
|
}
|
|
721
732
|
// Evidence cross-reference (execute-task only)
|
|
722
|
-
//
|
|
723
|
-
//
|
|
724
|
-
//
|
|
725
|
-
// we can still detect units that claimed success but ran no commands.
|
|
733
|
+
// Only compare against concrete command evidence persisted by the task
|
|
734
|
+
// completion tool. A prose Verify field can be satisfied later by the
|
|
735
|
+
// host verification gate, so it is not enough to accuse the unit.
|
|
726
736
|
if (safetyConfig.evidence_cross_reference && s.currentUnit.type === "execute-task") {
|
|
727
737
|
try {
|
|
728
738
|
const actual = getEvidence();
|
|
729
739
|
const bashCalls = actual.filter(e => e.kind === "bash");
|
|
730
|
-
// If the task is marked complete but zero bash commands were run,
|
|
731
|
-
// it's suspicious — the LLM may have fabricated results.
|
|
732
740
|
if (sMid && sSid && sTid && isDbAvailable()) {
|
|
733
741
|
const taskRow = getTask(sMid, sSid, sTid);
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
742
|
+
const claimedCommands = getVerificationEvidence(sMid, sSid, sTid)
|
|
743
|
+
.map((row) => row.command)
|
|
744
|
+
.filter((command) => typeof command === "string" && command.trim().length > 0);
|
|
745
|
+
if (taskRow?.status === "complete" && claimedCommands.length > 0 && bashCalls.length === 0) {
|
|
746
|
+
logWarning("safety", "task claimed verification command evidence but no execution tool calls were recorded");
|
|
747
|
+
ctx.ui.notify(`Safety: task ${sTid} claimed command evidence but no execution tool calls were recorded`, "warning");
|
|
737
748
|
}
|
|
738
749
|
}
|
|
739
750
|
}
|
|
@@ -1123,8 +1134,11 @@ export async function postUnitPostVerification(pctx) {
|
|
|
1123
1134
|
return;
|
|
1124
1135
|
}
|
|
1125
1136
|
const strictMode = prefs?.enhanced_verification_strict === true;
|
|
1126
|
-
// Run pre-execution checks
|
|
1127
|
-
|
|
1137
|
+
// Run pre-execution checks against the canonical project root. In
|
|
1138
|
+
// worktree isolation, s.basePath can point at a metadata-only worktree,
|
|
1139
|
+
// while source files remain under the project root.
|
|
1140
|
+
const preExecutionBasePath = s.canonicalProjectRoot;
|
|
1141
|
+
const result = await runPreExecutionChecks(tasks, preExecutionBasePath);
|
|
1128
1142
|
// Log summary to stderr in existing verification output format
|
|
1129
1143
|
const emoji = result.status === "pass" ? "✅" : result.status === "warn" ? "⚠️" : "❌";
|
|
1130
1144
|
process.stderr.write(`gsd-pre-exec: ${emoji} Pre-execution checks ${result.status} for ${mid}/${sid} (${result.durationMs}ms)\n`);
|
|
@@ -1134,12 +1148,12 @@ export async function postUnitPostVerification(pctx) {
|
|
|
1134
1148
|
process.stderr.write(`gsd-pre-exec: ${checkEmoji} [${check.category}] ${check.target}: ${check.message}\n`);
|
|
1135
1149
|
}
|
|
1136
1150
|
// Write evidence JSON to slice artifacts directory
|
|
1137
|
-
const slicePath = resolveSlicePath(
|
|
1151
|
+
const slicePath = resolveSlicePath(preExecutionBasePath, mid, sid);
|
|
1138
1152
|
const evidenceFileName = `${sid}-PRE-EXEC-VERIFY.json`;
|
|
1139
1153
|
let evidencePath = join(".gsd", "milestones", mid, "slices", sid, evidenceFileName);
|
|
1140
1154
|
if (slicePath) {
|
|
1141
1155
|
writePreExecutionEvidence(result, slicePath, mid, sid);
|
|
1142
|
-
evidencePath = relative(
|
|
1156
|
+
evidencePath = relative(preExecutionBasePath, join(slicePath, evidenceFileName)) || evidenceFileName;
|
|
1143
1157
|
}
|
|
1144
1158
|
if (uokFlags.gates) {
|
|
1145
1159
|
const failedChecks = result.checks
|
|
@@ -1187,6 +1201,9 @@ export async function postUnitPostVerification(pctx) {
|
|
|
1187
1201
|
blockingFindings: blockingChecks.map(c => `[${c.category}] ${c.target}: ${c.message}`),
|
|
1188
1202
|
verdictExcerpt: `status=${result.status}; ${blockingCount} blocking issue${blockingCount === 1 ? "" : "s"} detected`,
|
|
1189
1203
|
};
|
|
1204
|
+
// Track consecutive pre-exec failures per slice for loop detection.
|
|
1205
|
+
const retryKey = currentUnit.id;
|
|
1206
|
+
s.preExecRetryCount.set(retryKey, (s.preExecRetryCount.get(retryKey) ?? 0) + 1);
|
|
1190
1207
|
preExecPauseNeeded = true;
|
|
1191
1208
|
}
|
|
1192
1209
|
else if (result.status === "warn") {
|
|
@@ -1199,9 +1216,16 @@ export async function postUnitPostVerification(pctx) {
|
|
|
1199
1216
|
blockingFindings: warnChecks.map(c => `[${c.category}] ${c.target}: ${c.message}`),
|
|
1200
1217
|
verdictExcerpt: `status=${result.status} (strict mode); ${warnChecks.length} warning${warnChecks.length === 1 ? "" : "s"} treated as blocking`,
|
|
1201
1218
|
};
|
|
1219
|
+
const retryKey = currentUnit.id;
|
|
1220
|
+
s.preExecRetryCount.set(retryKey, (s.preExecRetryCount.get(retryKey) ?? 0) + 1);
|
|
1202
1221
|
preExecPauseNeeded = true;
|
|
1203
1222
|
}
|
|
1204
1223
|
}
|
|
1224
|
+
// Reset the retry counter when checks pass — a successful re-plan
|
|
1225
|
+
// should not carry over a stale failure count into future slices.
|
|
1226
|
+
if (result.status === "pass") {
|
|
1227
|
+
s.preExecRetryCount.delete(currentUnit.id);
|
|
1228
|
+
}
|
|
1205
1229
|
debugLog("postUnitPostVerification", {
|
|
1206
1230
|
phase: "pre-execution-checks",
|
|
1207
1231
|
status: result.status,
|
|
@@ -1253,11 +1277,7 @@ export async function postUnitPostVerification(pctx) {
|
|
|
1253
1277
|
}
|
|
1254
1278
|
}
|
|
1255
1279
|
// ── Triage check ──
|
|
1256
|
-
if (
|
|
1257
|
-
s.currentUnit &&
|
|
1258
|
-
!s.currentUnit.type.startsWith("hook/") &&
|
|
1259
|
-
s.currentUnit.type !== "triage-captures" &&
|
|
1260
|
-
s.currentUnit.type !== "quick-task") {
|
|
1280
|
+
if (_shouldDispatchTriageForTest(s)) {
|
|
1261
1281
|
try {
|
|
1262
1282
|
if (hasPendingCaptures(s.basePath)) {
|
|
1263
1283
|
const pending = loadPendingCaptures(s.basePath);
|
|
@@ -1295,10 +1315,7 @@ export async function postUnitPostVerification(pctx) {
|
|
|
1295
1315
|
}
|
|
1296
1316
|
}
|
|
1297
1317
|
// ── Quick-task dispatch ──
|
|
1298
|
-
if (
|
|
1299
|
-
s.pendingQuickTasks.length > 0 &&
|
|
1300
|
-
s.currentUnit &&
|
|
1301
|
-
s.currentUnit.type !== "quick-task") {
|
|
1318
|
+
if (_shouldDispatchQuickTaskForTest(s)) {
|
|
1302
1319
|
try {
|
|
1303
1320
|
const capture = s.pendingQuickTasks.shift();
|
|
1304
1321
|
const { buildQuickTaskPrompt } = await import("./triage-resolution.js");
|