gsd-pi 2.80.0-dev.c5f2443b3 → 2.80.0-dev.d4fc28e6b
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/cli.js +0 -19
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +2 -2
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +29 -0
- package/dist/resources/extensions/github-sync/templates.js +39 -8
- package/dist/resources/extensions/gsd/auto/loop.js +119 -18
- package/dist/resources/extensions/gsd/auto/phases.js +212 -135
- package/dist/resources/extensions/gsd/auto/resolve.js +29 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +41 -45
- 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-dashboard.js +51 -15
- 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 +27 -14
- 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 +199 -9
- 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 +111 -1
- package/dist/resources/extensions/gsd/auto.js +95 -27
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +103 -3
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +49 -36
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +15 -5
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +33 -20
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +7 -1
- package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +9 -3
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +8 -2
- 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-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/custom-workflow-engine.js +22 -2
- 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 +36 -4
- package/dist/resources/extensions/gsd/graph.js +9 -3
- package/dist/resources/extensions/gsd/gsd-db.js +146 -13
- package/dist/resources/extensions/gsd/guided-flow.js +129 -44
- 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/pr-evidence.js +57 -16
- 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/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/working-output-messages.js +64 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +16 -14
- package/dist/resources/extensions/gsd/worktree-resolver.js +68 -21
- 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 +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.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +11 -11
- package/dist/web/standalone/.next/server/chunks/6897.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- 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/{8336.6f6f30e410419aff.js → 8336.631939fb583761fa.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{webpack-d82dbee6356c1733.js → webpack-0481f1221120a7c6.js} +1 -1
- package/dist/welcome-screen.d.ts +2 -0
- package/dist/welcome-screen.js +9 -7
- package/package.json +12 -8
- package/packages/contracts/package.json +1 -1
- 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/models/fake-model.d.ts +12 -0
- package/packages/pi-ai/dist/models/fake-model.d.ts.map +1 -0
- package/packages/pi-ai/dist/models/fake-model.js +27 -0
- package/packages/pi-ai/dist/models/fake-model.js.map +1 -0
- package/packages/pi-ai/dist/models/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/index.js +8 -0
- package/packages/pi-ai/dist/models/index.js.map +1 -1
- package/packages/pi-ai/dist/providers/fake.d.ts +42 -0
- package/packages/pi-ai/dist/providers/fake.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/fake.js +319 -0
- package/packages/pi-ai/dist/providers/fake.js.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js +24 -0
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
- package/packages/pi-ai/src/models/fake-model.ts +30 -0
- package/packages/pi-ai/src/models/index.ts +9 -0
- package/packages/pi-ai/src/providers/fake.ts +376 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +23 -0
- 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 +76 -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 +39 -1
- 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/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +5 -0
- package/packages/pi-coding-agent/dist/core/model-registry.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 +24 -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 +33 -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/slash-commands.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/slash-commands.js +1 -0
- package/packages/pi-coding-agent/dist/core/slash-commands.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/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 +54 -15
- 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.d.ts +26 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js +112 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js +51 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.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 +10 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +3 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.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 +17 -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 +109 -17
- 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 +69 -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 +93 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +3 -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 +26 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +20 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.js +79 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +13 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +18 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.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.d.ts +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.js +18 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js +48 -0
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js.map +1 -0
- 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 +10 -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 +89 -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 +42 -1
- package/packages/pi-coding-agent/src/core/hooks-runner.test.ts +2 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +4 -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 +51 -1
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +28 -0
- package/packages/pi-coding-agent/src/core/slash-commands.ts +1 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +8 -10
- 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 +78 -15
- package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.test.ts +59 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +160 -0
- 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 +10 -9
- package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +15 -0
- 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 +122 -17
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.test.ts +99 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +92 -3
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +1 -1
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +28 -0
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.test.ts +95 -0
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +24 -1
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +13 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +32 -2
- 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 +65 -0
- package/packages/pi-coding-agent/src/modes/interactive/tui-mode.ts +29 -0
- package/packages/pi-coding-agent/src/resources/extensions/memory/storage-safety-guard.test.ts +14 -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/__tests__/style.test.d.ts +2 -0
- package/packages/pi-tui/dist/__tests__/style.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/__tests__/style.test.js +63 -0
- package/packages/pi-tui/dist/__tests__/style.test.js.map +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +24 -3
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/index.d.ts +1 -0
- package/packages/pi-tui/dist/index.d.ts.map +1 -1
- package/packages/pi-tui/dist/index.js +2 -0
- package/packages/pi-tui/dist/index.js.map +1 -1
- package/packages/pi-tui/dist/style.d.ts +41 -0
- package/packages/pi-tui/dist/style.d.ts.map +1 -0
- package/packages/pi-tui/dist/style.js +158 -0
- package/packages/pi-tui/dist/style.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +0 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +21 -16
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/__tests__/style.test.ts +76 -0
- package/packages/pi-tui/src/__tests__/tui.test.ts +29 -3
- package/packages/pi-tui/src/index.ts +9 -0
- package/packages/pi-tui/src/style.ts +225 -0
- package/packages/pi-tui/src/tui.ts +23 -16
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +12 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme-schema.js +13 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +18 -1
- package/pkg/dist/modes/interactive/theme/theme.js.map +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/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/templates.ts +38 -8
- package/src/resources/extensions/github-sync/tests/inline-code.test.ts +66 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +3 -2
- package/src/resources/extensions/gsd/auto/loop.ts +151 -26
- package/src/resources/extensions/gsd/auto/phases.ts +289 -196
- package/src/resources/extensions/gsd/auto/resolve.ts +42 -1
- package/src/resources/extensions/gsd/auto/run-unit.ts +52 -44
- 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-dashboard.ts +57 -8
- 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 +28 -14
- 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 +237 -15
- 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 +123 -0
- package/src/resources/extensions/gsd/auto.ts +110 -22
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +119 -2
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +50 -36
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +16 -5
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +34 -19
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +8 -1
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +10 -3
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +9 -2
- 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-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/custom-workflow-engine.ts +24 -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 +46 -8
- package/src/resources/extensions/gsd/graph.ts +12 -5
- package/src/resources/extensions/gsd/gsd-db.ts +168 -13
- package/src/resources/extensions/gsd/guided-flow.ts +150 -51
- 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/pr-evidence.ts +63 -5
- 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/tests/artifact-retry-cap.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +516 -15
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +56 -13
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +184 -2
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +168 -6
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +97 -2
- 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/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 +55 -0
- 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 +117 -7
- package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +40 -2
- package/src/resources/extensions/gsd/tests/db-migration-steps.integration.test.ts +428 -0
- package/src/resources/extensions/gsd/tests/db-schema-metadata.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/detection.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/dispatch-rule-coverage.test.ts +313 -0
- 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/fixtures/pr-body/commands-ship-basic.md +52 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/commands-ship-empty-optionals.md +42 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-no-blockers.md +55 -0
- package/src/resources/extensions/gsd/tests/fixtures/pr-body/swarm-lane-with-blockers.md +60 -0
- package/src/resources/extensions/gsd/tests/graph-operations.test.ts +10 -0
- 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/integration/git-service.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +6 -3
- 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/memory-decay-factor.test.ts +90 -0
- 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/native-git-bridge-exec-fallback.test.ts +34 -2
- 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/plan-slice.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/pr-evidence-equivalence.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/pr-evidence-hardening.test.ts +165 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +45 -5
- 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 +19 -0
- package/src/resources/extensions/gsd/tests/query-tools-db-open.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/quick-external-gsd.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +38 -17
- package/src/resources/extensions/gsd/tests/right-sized-workflow-prompts.test.ts +192 -0
- 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-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/signal-handlers.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +38 -0
- 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 +9 -0
- 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-tool-gating.test.ts +291 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +136 -4
- 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 -4
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/workflow-dispatch-claim.test.ts +142 -0
- 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/working-output-messages.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +37 -6
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +1 -0
- 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 +167 -4
- package/src/resources/extensions/gsd/tests/worktree-write-gate.test.ts +179 -0
- 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/working-output-messages.ts +120 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +15 -4
- package/src/resources/extensions/gsd/worktree-resolver.ts +85 -19
- package/packages/contracts/tsconfig.tsbuildinfo +0 -1
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +0 -97
- /package/dist/web/standalone/.next/static/{bQDK5_LtkGVS64AirQgQG → cWaxzf-sdbSSbbwYu8q7a}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{bQDK5_LtkGVS64AirQgQG → cWaxzf-sdbSSbbwYu8q7a}/_ssgManifest.js +0 -0
|
@@ -22,6 +22,10 @@ import { bumpTurnGeneration } from "./turn-epoch.js";
|
|
|
22
22
|
|
|
23
23
|
let _currentResolve: ((result: UnitResult) => void) | null = null;
|
|
24
24
|
let _sessionSwitchInFlight = false;
|
|
25
|
+
let _pendingSwitchCancellation: { errorContext?: ErrorContext } | null = null;
|
|
26
|
+
let _sessionSwitchAbortGraceUntil = 0;
|
|
27
|
+
|
|
28
|
+
const DEFAULT_SESSION_SWITCH_ABORT_GRACE_MS = 2_000;
|
|
25
29
|
|
|
26
30
|
// ─── Setters (needed for cross-module mutation) ─────────────────────────────
|
|
27
31
|
|
|
@@ -33,10 +37,31 @@ export function _setSessionSwitchInFlight(v: boolean): void {
|
|
|
33
37
|
_sessionSwitchInFlight = v;
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
export function _markSessionSwitchAbortGraceWindow(durationMs = DEFAULT_SESSION_SWITCH_ABORT_GRACE_MS): void {
|
|
41
|
+
_sessionSwitchAbortGraceUntil = Math.max(
|
|
42
|
+
_sessionSwitchAbortGraceUntil,
|
|
43
|
+
Date.now() + durationMs,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function _clearSessionSwitchAbortGraceWindow(): void {
|
|
48
|
+
_sessionSwitchAbortGraceUntil = 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function isSessionSwitchAbortGraceActive(now = Date.now()): boolean {
|
|
52
|
+
return now < _sessionSwitchAbortGraceUntil;
|
|
53
|
+
}
|
|
54
|
+
|
|
36
55
|
export function _clearCurrentResolve(): void {
|
|
37
56
|
_currentResolve = null;
|
|
38
57
|
}
|
|
39
58
|
|
|
59
|
+
export function _consumePendingSwitchCancellation(): { errorContext?: ErrorContext } | null {
|
|
60
|
+
const pending = _pendingSwitchCancellation;
|
|
61
|
+
_pendingSwitchCancellation = null;
|
|
62
|
+
return pending;
|
|
63
|
+
}
|
|
64
|
+
|
|
40
65
|
// ─── resolveAgentEnd ─────────────────────────────────────────────────────────
|
|
41
66
|
|
|
42
67
|
/**
|
|
@@ -96,7 +121,7 @@ export function bumpAndResolveSynthetic(reason: string): void {
|
|
|
96
121
|
* blocks to ensure the autoLoop is never stuck awaiting a promise that
|
|
97
122
|
* will never resolve. Safe to call when no resolver is pending (no-op).
|
|
98
123
|
*/
|
|
99
|
-
export function resolveAgentEndCancelled(errorContext?: ErrorContext):
|
|
124
|
+
export function resolveAgentEndCancelled(errorContext?: ErrorContext): boolean {
|
|
100
125
|
if (_currentResolve) {
|
|
101
126
|
// Cancellation supersedes the in-flight turn the same way timeout
|
|
102
127
|
// recovery does — bump the turn epoch so any lingering writes from the
|
|
@@ -107,8 +132,22 @@ export function resolveAgentEndCancelled(errorContext?: ErrorContext): void {
|
|
|
107
132
|
debugLog("resolveAgentEndCancelled", { status: "resolving-cancelled" });
|
|
108
133
|
const r = _currentResolve;
|
|
109
134
|
_currentResolve = null;
|
|
135
|
+
_pendingSwitchCancellation = null;
|
|
110
136
|
r({ status: "cancelled", ...(errorContext ? { errorContext } : {}) });
|
|
137
|
+
return true;
|
|
111
138
|
}
|
|
139
|
+
|
|
140
|
+
if (_sessionSwitchInFlight) {
|
|
141
|
+
bumpTurnGeneration(
|
|
142
|
+
`cancelled-during-switch:${errorContext?.category ?? "unknown"}`,
|
|
143
|
+
);
|
|
144
|
+
_pendingSwitchCancellation = errorContext ? { errorContext } : {};
|
|
145
|
+
debugLog("resolveAgentEndCancelled", { status: "queued-during-switch" });
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
debugLog("resolveAgentEndCancelled", { status: "no-pending-resolve" });
|
|
150
|
+
return false;
|
|
112
151
|
}
|
|
113
152
|
|
|
114
153
|
// ─── resetPendingResolve (test helper) ───────────────────────────────────────
|
|
@@ -120,6 +159,8 @@ export function resolveAgentEndCancelled(errorContext?: ErrorContext): void {
|
|
|
120
159
|
export function _resetPendingResolve(): void {
|
|
121
160
|
_currentResolve = null;
|
|
122
161
|
_sessionSwitchInFlight = false;
|
|
162
|
+
_pendingSwitchCancellation = null;
|
|
163
|
+
_sessionSwitchAbortGraceUntil = 0;
|
|
123
164
|
}
|
|
124
165
|
|
|
125
166
|
export function _hasPendingResolveForTest(): boolean {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// GSD-2 + src/resources/extensions/gsd/auto/run-unit.ts - Runs one GSD auto-mode unit from session creation through agent completion.
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* auto/run-unit.ts — Single unit execution: session create → prompt → await agent_end.
|
|
3
5
|
*
|
|
@@ -9,7 +11,13 @@ import type { ExtensionAPI, ExtensionContext } from "@gsd/pi-coding-agent";
|
|
|
9
11
|
import type { AutoSession } from "./session.js";
|
|
10
12
|
import { NEW_SESSION_TIMEOUT_MS } from "./session.js";
|
|
11
13
|
import type { UnitResult } from "./types.js";
|
|
12
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
_clearCurrentResolve,
|
|
16
|
+
_consumePendingSwitchCancellation,
|
|
17
|
+
_markSessionSwitchAbortGraceWindow,
|
|
18
|
+
_setCurrentResolve,
|
|
19
|
+
_setSessionSwitchInFlight,
|
|
20
|
+
} from "./resolve.js";
|
|
13
21
|
import {
|
|
14
22
|
getCurrentTurnGeneration,
|
|
15
23
|
runWithTurnGeneration,
|
|
@@ -17,6 +25,7 @@ import {
|
|
|
17
25
|
import { debugLog } from "../debug-logger.js";
|
|
18
26
|
import { logWarning, logError } from "../workflow-logger.js";
|
|
19
27
|
import { resolveAutoSupervisorConfig } from "../preferences.js";
|
|
28
|
+
import { formatAutoUnitWorkingMessage } from "../working-output-messages.js";
|
|
20
29
|
|
|
21
30
|
// Tracks the latest session-switch attempt so a late timeout settlement from an
|
|
22
31
|
// older runUnit() call cannot clear the guard for a newer one.
|
|
@@ -40,45 +49,24 @@ export async function runUnit(
|
|
|
40
49
|
): Promise<UnitResult> {
|
|
41
50
|
debugLog("runUnit", { phase: "start", unitType, unitId });
|
|
42
51
|
|
|
43
|
-
// Ensure cwd matches basePath BEFORE newSession() captures it. The new
|
|
44
|
-
// session reads process.cwd() during construction to anchor its tool
|
|
45
|
-
// runtime and system prompt; if cwd has drifted (async_bash, background
|
|
46
|
-
// jobs, prior unit cleanup), the session would otherwise be rooted to
|
|
47
|
-
// the wrong directory. Must be synchronous — no awaits between chdir
|
|
48
|
-
// and newSession (#1389, #4762 follow-up).
|
|
49
|
-
try {
|
|
50
|
-
if (process.cwd() !== s.basePath) {
|
|
51
|
-
process.chdir(s.basePath);
|
|
52
|
-
}
|
|
53
|
-
} catch (e) {
|
|
54
|
-
const msg = `Failed to chdir to basePath before newSession (basePath: ${s.basePath}): ${String(e)}`;
|
|
55
|
-
logWarning("engine", msg, { basePath: s.basePath, error: String(e) });
|
|
56
|
-
return {
|
|
57
|
-
status: "cancelled",
|
|
58
|
-
errorContext: {
|
|
59
|
-
message: msg,
|
|
60
|
-
category: "session-failed",
|
|
61
|
-
isTransient: true,
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
52
|
// ── Session creation with timeout ──
|
|
67
53
|
debugLog("runUnit", { phase: "session-create", unitType, unitId });
|
|
68
54
|
|
|
69
55
|
let sessionResult: { cancelled: boolean };
|
|
70
56
|
let sessionTimeoutHandle: ReturnType<typeof setTimeout> | undefined;
|
|
71
57
|
const mySessionSwitchGeneration = ++sessionSwitchGeneration;
|
|
72
|
-
// #3731: Cancellation controller for newSession(). When
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
// it from capturing the (now-root) process.cwd() and rebuilding the tool
|
|
76
|
-
// runtime with the wrong cwd.
|
|
58
|
+
// #3731: Cancellation controller for newSession(). When session creation
|
|
59
|
+
// times out, abort before a late session switch can rebuild the tool runtime
|
|
60
|
+
// against a stale workspace root.
|
|
77
61
|
const sessionAbortController = new AbortController();
|
|
78
62
|
_setSessionSwitchInFlight(true);
|
|
79
63
|
try {
|
|
80
|
-
const sessionPromise = s.cmdCtx!.newSession({
|
|
64
|
+
const sessionPromise = s.cmdCtx!.newSession({
|
|
65
|
+
abortSignal: sessionAbortController.signal,
|
|
66
|
+
workspaceRoot: s.basePath,
|
|
67
|
+
}).finally(() => {
|
|
81
68
|
if (sessionSwitchGeneration === mySessionSwitchGeneration) {
|
|
69
|
+
_markSessionSwitchAbortGraceWindow();
|
|
82
70
|
_setSessionSwitchInFlight(false);
|
|
83
71
|
}
|
|
84
72
|
});
|
|
@@ -94,6 +82,7 @@ export async function runUnit(
|
|
|
94
82
|
sessionResult = await Promise.race([sessionPromise, timeoutPromise]);
|
|
95
83
|
} catch (sessionErr) {
|
|
96
84
|
if (sessionTimeoutHandle) clearTimeout(sessionTimeoutHandle);
|
|
85
|
+
_consumePendingSwitchCancellation();
|
|
97
86
|
const msg =
|
|
98
87
|
sessionErr instanceof Error ? sessionErr.message : String(sessionErr);
|
|
99
88
|
debugLog("runUnit", {
|
|
@@ -107,17 +96,20 @@ export async function runUnit(
|
|
|
107
96
|
if (sessionTimeoutHandle) clearTimeout(sessionTimeoutHandle);
|
|
108
97
|
|
|
109
98
|
if (sessionResult.cancelled) {
|
|
99
|
+
_consumePendingSwitchCancellation();
|
|
110
100
|
debugLog("runUnit-session-timeout", { unitType, unitId });
|
|
111
101
|
return { status: "cancelled", errorContext: { message: "Session creation timed out", category: "timeout", isTransient: true } };
|
|
112
102
|
}
|
|
113
103
|
|
|
114
104
|
if (!s.active) {
|
|
105
|
+
_consumePendingSwitchCancellation();
|
|
115
106
|
return { status: "cancelled" };
|
|
116
107
|
}
|
|
117
108
|
|
|
118
109
|
if (s.currentUnitModel && typeof pi.setModel === "function") {
|
|
119
110
|
const restored = await pi.setModel(s.currentUnitModel, { persist: false });
|
|
120
111
|
if (!restored) {
|
|
112
|
+
_consumePendingSwitchCancellation();
|
|
121
113
|
const message =
|
|
122
114
|
`Failed to restore configured model ${s.currentUnitModel.provider}/${s.currentUnitModel.id} after session creation`;
|
|
123
115
|
ctx.ui.notify(
|
|
@@ -138,10 +130,19 @@ export async function runUnit(
|
|
|
138
130
|
// ── Create the agent_end promise (per-unit one-shot) ──
|
|
139
131
|
// This happens after newSession completes so session-switch agent_end events
|
|
140
132
|
// from the previous session cannot resolve the new unit.
|
|
133
|
+
_markSessionSwitchAbortGraceWindow();
|
|
141
134
|
_setSessionSwitchInFlight(false);
|
|
142
135
|
const unitPromise = new Promise<UnitResult>((resolve) => {
|
|
143
136
|
_setCurrentResolve(resolve);
|
|
144
137
|
});
|
|
138
|
+
const pendingSwitchCancellation = _consumePendingSwitchCancellation();
|
|
139
|
+
if (pendingSwitchCancellation) {
|
|
140
|
+
_clearCurrentResolve();
|
|
141
|
+
return {
|
|
142
|
+
status: "cancelled",
|
|
143
|
+
...(pendingSwitchCancellation.errorContext ? { errorContext: pendingSwitchCancellation.errorContext } : {}),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
145
146
|
|
|
146
147
|
// ── Provider request-readiness pre-check (#4555) ──
|
|
147
148
|
// Verify the provider can accept requests before dispatching. If the token
|
|
@@ -184,30 +185,37 @@ export async function runUnit(
|
|
|
184
185
|
debugLog("runUnit", { phase: "send-message", unitType, unitId });
|
|
185
186
|
|
|
186
187
|
const requestDispatchedAt = Date.now();
|
|
187
|
-
|
|
188
|
-
{ customType: "gsd-auto", content: prompt, display: s.verbose },
|
|
189
|
-
{ triggerTurn: true },
|
|
190
|
-
);
|
|
188
|
+
ctx.ui.setWorkingMessage?.(formatAutoUnitWorkingMessage(unitType, unitId));
|
|
191
189
|
|
|
192
190
|
// ── Await agent_end with absolute timeout (H4 fix) ──
|
|
193
191
|
// If supervision fails to resolve unitPromise within 30s, treat as cancelled.
|
|
194
192
|
// Without this, a crashed agent that never emits agent_end hangs the loop (#3161).
|
|
195
|
-
debugLog("runUnit", { phase: "awaiting-agent-end", unitType, unitId });
|
|
196
193
|
const supervisor = resolveAutoSupervisorConfig();
|
|
197
194
|
const UNIT_HARD_TIMEOUT_MS = Math.max(
|
|
198
195
|
30_000,
|
|
199
196
|
((supervisor.hard_timeout_minutes ?? 30) * 60 * 1000) + 30_000,
|
|
200
197
|
);
|
|
201
198
|
let unitTimeoutHandle: ReturnType<typeof setTimeout> | undefined;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
199
|
+
let result: UnitResult;
|
|
200
|
+
try {
|
|
201
|
+
pi.sendMessage(
|
|
202
|
+
{ customType: "gsd-auto", content: prompt, display: s.verbose },
|
|
203
|
+
{ triggerTurn: true },
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
debugLog("runUnit", { phase: "awaiting-agent-end", unitType, unitId });
|
|
207
|
+
const timeoutResult = new Promise<UnitResult>((resolve) => {
|
|
208
|
+
unitTimeoutHandle = setTimeout(() => {
|
|
209
|
+
resolve({ status: "cancelled", errorContext: { message: "Unit hard timeout — supervision may have failed", category: "timeout", isTransient: true } });
|
|
210
|
+
}, UNIT_HARD_TIMEOUT_MS);
|
|
211
|
+
});
|
|
212
|
+
result = await runWithTurnGeneration(capturedTurnGen, () =>
|
|
213
|
+
Promise.race([unitPromise, timeoutResult]),
|
|
214
|
+
);
|
|
215
|
+
} finally {
|
|
216
|
+
if (unitTimeoutHandle) clearTimeout(unitTimeoutHandle);
|
|
217
|
+
ctx.ui.setWorkingMessage?.(undefined);
|
|
218
|
+
}
|
|
211
219
|
debugLog("runUnit", {
|
|
212
220
|
phase: "agent-end-received",
|
|
213
221
|
unitType,
|
|
@@ -178,6 +178,13 @@ export class AutoSession {
|
|
|
178
178
|
* stale context bleeding into unrelated slices.
|
|
179
179
|
*/
|
|
180
180
|
lastPreExecFailure: PreExecFailure | null = null;
|
|
181
|
+
/**
|
|
182
|
+
* Tracks how many consecutive times each slice unit has failed pre-execution
|
|
183
|
+
* checks. Keyed by unitId (e.g. "M001/S01"). Used to break the infinite
|
|
184
|
+
* plan-slice → pre-exec fail → re-dispatch loop when the planner cannot fix
|
|
185
|
+
* the issues after MAX_PRE_EXEC_RETRIES re-attempts.
|
|
186
|
+
*/
|
|
187
|
+
readonly preExecRetryCount: Map<string, number> = new Map();
|
|
181
188
|
|
|
182
189
|
// ── Tool invocation errors (#2883) ──────────────────────────────────
|
|
183
190
|
/** Set when a GSD tool execution ends with isError due to malformed/truncated
|
|
@@ -343,6 +350,7 @@ export class AutoSession {
|
|
|
343
350
|
this.rewriteAttemptCount = 0;
|
|
344
351
|
this.consecutiveCompleteBootstraps = 0;
|
|
345
352
|
this.lastPreExecFailure = null;
|
|
353
|
+
this.preExecRetryCount.clear();
|
|
346
354
|
this.lastToolInvocationError = null;
|
|
347
355
|
this.lastUnitAgentEndMessages = null;
|
|
348
356
|
this.lastGitActionFailure = null;
|
|
@@ -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);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// GSD-2 + src/resources/extensions/gsd/auto-dashboard.ts - Auto-mode progress widget rendering and dashboard helpers.
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Auto-mode Dashboard — progress widget rendering, elapsed time formatting,
|
|
3
5
|
* unit description helpers, and slice progress caching.
|
|
@@ -46,6 +48,7 @@ import {
|
|
|
46
48
|
import { logWarning } from "./workflow-logger.js";
|
|
47
49
|
import { formattedShortcutPair } from "./shortcut-defs.js";
|
|
48
50
|
import { homedir } from "node:os";
|
|
51
|
+
import { readUnitRuntimeRecord, type AutoUnitRuntimeRecord } from "./unit-runtime.js";
|
|
49
52
|
|
|
50
53
|
// ─── UAT Slice Extraction ─────────────────────────────────────────────────────
|
|
51
54
|
|
|
@@ -215,6 +218,36 @@ export function formatWidgetTokens(count: number): string {
|
|
|
215
218
|
return `${Math.round(count / 1000000)}M`;
|
|
216
219
|
}
|
|
217
220
|
|
|
221
|
+
export function formatRuntimeHealthSignal(
|
|
222
|
+
record: AutoUnitRuntimeRecord | null,
|
|
223
|
+
now = Date.now(),
|
|
224
|
+
): { level: "green" | "yellow"; summary: string; detail?: string } | null {
|
|
225
|
+
if (!record) return null;
|
|
226
|
+
const idleMs = Math.max(0, now - record.lastProgressAt);
|
|
227
|
+
const idleMinutes = Math.floor(idleMs / 60_000);
|
|
228
|
+
if ((record.recoveryAttempts ?? 0) > 0 || record.phase === "recovered" || record.lastProgressKind.includes("recovery")) {
|
|
229
|
+
return {
|
|
230
|
+
level: "yellow",
|
|
231
|
+
summary: "Recovering",
|
|
232
|
+
detail: `retry ${record.recoveryAttempts ?? 1} after ${record.lastRecoveryReason ?? "idle"} stall`,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
if (record.progressCount === 0 && idleMs >= 60_000) {
|
|
236
|
+
return {
|
|
237
|
+
level: "yellow",
|
|
238
|
+
summary: "Waiting on provider",
|
|
239
|
+
detail: `no output for ${idleMinutes}m`,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function shouldRenderRoadmapProgress(
|
|
246
|
+
progress: { total: number; activeSliceTasks?: { total: number } | null } | null,
|
|
247
|
+
): progress is { total: number; activeSliceTasks?: { total: number } | null } {
|
|
248
|
+
return !!progress && progress.total > 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
218
251
|
// ─── ETA Estimation ──────────────────────────────────────────────────────────
|
|
219
252
|
|
|
220
253
|
/**
|
|
@@ -622,6 +655,7 @@ export function updateProgressWidget(
|
|
|
622
655
|
let cachedLines: string[] | undefined;
|
|
623
656
|
let cachedWidth: number | undefined;
|
|
624
657
|
let cachedRtkLabel: string | null | undefined;
|
|
658
|
+
let cachedRuntimeRecord: AutoUnitRuntimeRecord | null = null;
|
|
625
659
|
|
|
626
660
|
const refreshRtkLabel = (): void => {
|
|
627
661
|
try {
|
|
@@ -634,7 +668,16 @@ export function updateProgressWidget(
|
|
|
634
668
|
}
|
|
635
669
|
};
|
|
636
670
|
|
|
671
|
+
const refreshRuntimeRecord = (): void => {
|
|
672
|
+
try {
|
|
673
|
+
cachedRuntimeRecord = readUnitRuntimeRecord(accessors.getBasePath(), unitType, unitId);
|
|
674
|
+
} catch {
|
|
675
|
+
cachedRuntimeRecord = null;
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
|
|
637
679
|
refreshRtkLabel();
|
|
680
|
+
refreshRuntimeRecord();
|
|
638
681
|
|
|
639
682
|
const pulseTimer = setInterval(() => {
|
|
640
683
|
pulseBright = !pulseBright;
|
|
@@ -652,6 +695,7 @@ export function updateProgressWidget(
|
|
|
652
695
|
updateSliceProgressCache(accessors.getBasePath(), mid.id, slice?.id);
|
|
653
696
|
}
|
|
654
697
|
refreshRtkLabel();
|
|
698
|
+
refreshRuntimeRecord();
|
|
655
699
|
cachedLines = undefined;
|
|
656
700
|
} catch (err) { /* non-fatal */
|
|
657
701
|
logWarning("dashboard", `DB status update failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -685,13 +729,16 @@ export function updateProgressWidget(
|
|
|
685
729
|
|
|
686
730
|
// Health indicator in header
|
|
687
731
|
const score = computeProgressScore();
|
|
688
|
-
const
|
|
689
|
-
|
|
732
|
+
const runtimeSignal = formatRuntimeHealthSignal(cachedRuntimeRecord);
|
|
733
|
+
const healthLevel = runtimeSignal?.level ?? score.level;
|
|
734
|
+
const healthSummary = runtimeSignal?.summary ?? score.summary;
|
|
735
|
+
const healthColor = healthLevel === "green" ? "success"
|
|
736
|
+
: healthLevel === "yellow" ? "warning"
|
|
690
737
|
: "error";
|
|
691
|
-
const healthIcon =
|
|
692
|
-
:
|
|
738
|
+
const healthIcon = healthLevel === "green" ? GLYPH.statusActive
|
|
739
|
+
: healthLevel === "yellow" ? "!"
|
|
693
740
|
: "x";
|
|
694
|
-
const healthStr = ` ${theme.fg(healthColor, healthIcon)} ${theme.fg(healthColor,
|
|
741
|
+
const healthStr = ` ${theme.fg(healthColor, healthIcon)} ${theme.fg(healthColor, healthSummary)}`;
|
|
695
742
|
|
|
696
743
|
const headerLeft = `${pad}${dot} ${theme.fg("accent", theme.bold("GSD"))} ${theme.fg("success", modeTag)}${healthStr}`;
|
|
697
744
|
|
|
@@ -706,7 +753,9 @@ export function updateProgressWidget(
|
|
|
706
753
|
lines.push(rightAlign(headerLeft, headerRight, width));
|
|
707
754
|
|
|
708
755
|
// Show health signal details when degraded (yellow/red)
|
|
709
|
-
if (
|
|
756
|
+
if (runtimeSignal?.detail && widgetMode !== "min") {
|
|
757
|
+
lines.push(`${pad} ${theme.fg("dim", runtimeSignal.detail)}`);
|
|
758
|
+
} else if (score.level !== "green" && score.signals.length > 0 && widgetMode !== "min") {
|
|
710
759
|
// Show up to 3 most relevant signals in compact form
|
|
711
760
|
const topSignals = score.signals
|
|
712
761
|
.filter(s => s.kind === "negative")
|
|
@@ -785,7 +834,7 @@ export function updateProgressWidget(
|
|
|
785
834
|
|
|
786
835
|
// Progress bar
|
|
787
836
|
const roadmapSlices = mid ? getRoadmapSlicesSync() : null;
|
|
788
|
-
if (roadmapSlices) {
|
|
837
|
+
if (shouldRenderRoadmapProgress(roadmapSlices)) {
|
|
789
838
|
const { done, total, activeSliceTasks } = roadmapSlices;
|
|
790
839
|
const barWidth = Math.max(6, Math.min(18, Math.floor(width * 0.25)));
|
|
791
840
|
const pct = total > 0 ? done / total : 0;
|
|
@@ -853,7 +902,7 @@ export function updateProgressWidget(
|
|
|
853
902
|
|
|
854
903
|
const leftLines: string[] = [];
|
|
855
904
|
|
|
856
|
-
if (roadmapSlices) {
|
|
905
|
+
if (shouldRenderRoadmapProgress(roadmapSlices)) {
|
|
857
906
|
const { done, total, activeSliceTasks } = roadmapSlices;
|
|
858
907
|
const barWidth = Math.max(6, Math.min(18, Math.floor(leftColWidth * 0.4)));
|
|
859
908
|
const pct = total > 0 ? done / total : 0;
|
|
@@ -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
|
}
|
|
@@ -211,6 +211,23 @@ export function hasPendingDeepStage(prefs: GSDPreferences | undefined, basePath:
|
|
|
211
211
|
return gate.status === "pending" || gate.status === "blocked";
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
export function shouldRunDeepProjectSetup(
|
|
215
|
+
state: Pick<GSDState, "phase">,
|
|
216
|
+
prefs: GSDPreferences | undefined,
|
|
217
|
+
basePath: string,
|
|
218
|
+
options: { hasSurvivorBranch?: boolean } = {},
|
|
219
|
+
): boolean {
|
|
220
|
+
if (options.hasSurvivorBranch === true) return false;
|
|
221
|
+
if (
|
|
222
|
+
state.phase !== "pre-planning" &&
|
|
223
|
+
state.phase !== "needs-discussion" &&
|
|
224
|
+
state.phase !== "planning"
|
|
225
|
+
) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return hasPendingDeepStage(prefs, basePath);
|
|
229
|
+
}
|
|
230
|
+
|
|
214
231
|
function missingSliceStop(mid: string, phase: string): DispatchAction {
|
|
215
232
|
return {
|
|
216
233
|
action: "stop",
|
|
@@ -921,6 +938,22 @@ export const DISPATCH_RULES: DispatchRule[] = [
|
|
|
921
938
|
const unitId = `${mid}/${sid}`;
|
|
922
939
|
let priorPreExecFailure: { blockingFindings: string[]; verdictExcerpt: string } | undefined;
|
|
923
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
|
+
}
|
|
924
957
|
priorPreExecFailure = {
|
|
925
958
|
blockingFindings: session.lastPreExecFailure.blockingFindings,
|
|
926
959
|
verdictExcerpt: session.lastPreExecFailure.verdictExcerpt,
|