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
|
@@ -112,8 +112,22 @@ const CONTEXT_MODE_LANE_LABELS: Record<Exclude<ContextModePolicy, "none">, strin
|
|
|
112
112
|
docs: "documentation",
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
const
|
|
116
|
-
|
|
115
|
+
const CONTEXT_MODE_GUIDANCE_BY_LANE: Record<Exclude<ContextModePolicy, "none">, string> = {
|
|
116
|
+
interview:
|
|
117
|
+
"Use `gsd_resume` to restore prior discussion, `gsd_exec` for noisy discovery, and `gsd_exec_search` before repeating scans.",
|
|
118
|
+
research:
|
|
119
|
+
"Use `gsd_exec` for noisy research scans, `gsd_exec_search` before reruns, and `gsd_resume` to restore prior findings.",
|
|
120
|
+
planning:
|
|
121
|
+
"Use `gsd_resume` for planning continuity, `gsd_exec` for noisy checks, and `gsd_exec_search` before rerunning diagnostics.",
|
|
122
|
+
execution:
|
|
123
|
+
"Use `gsd_exec` for builds, tests, and diagnostics, `gsd_exec_search` before reruns, and `gsd_resume` after compaction or resume.",
|
|
124
|
+
verification:
|
|
125
|
+
"Use `gsd_exec` for verification commands, `gsd_exec_search` to reuse prior evidence, and `gsd_resume` after compaction or resume.",
|
|
126
|
+
orchestration:
|
|
127
|
+
"Use `gsd_resume` before resuming orchestration, `gsd_exec_search` to reuse prior runs, and `gsd_exec` for noisy coordination checks.",
|
|
128
|
+
docs:
|
|
129
|
+
"Use `gsd_resume` for prior context, `gsd_exec_search` for saved evidence, and `gsd_exec` for noisy doc validation commands.",
|
|
130
|
+
};
|
|
117
131
|
|
|
118
132
|
/**
|
|
119
133
|
* Render the Context Mode instruction lane for a unit type. Unknown unit
|
|
@@ -129,15 +143,16 @@ export function composeContextModeInstructions(
|
|
|
129
143
|
if (!manifest || manifest.contextMode === "none") return "";
|
|
130
144
|
|
|
131
145
|
const lane = CONTEXT_MODE_LANE_LABELS[manifest.contextMode];
|
|
146
|
+
const guidance = CONTEXT_MODE_GUIDANCE_BY_LANE[manifest.contextMode];
|
|
132
147
|
if (opts.renderMode === "nested") {
|
|
133
|
-
return `Context Mode (${lane} lane): ${
|
|
148
|
+
return `Context Mode (${lane} lane): ${guidance}`;
|
|
134
149
|
}
|
|
135
150
|
|
|
136
151
|
return [
|
|
137
152
|
"## Context Mode",
|
|
138
153
|
"",
|
|
139
154
|
`Lane: **${lane} lane**.`,
|
|
140
|
-
|
|
155
|
+
guidance,
|
|
141
156
|
].join("\n");
|
|
142
157
|
}
|
|
143
158
|
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
} from "./paths.js";
|
|
11
11
|
import { loadFile, parseTaskPlanMustHaves, countMustHavesMentionedInSummary } from "./files.js";
|
|
12
12
|
import { parseUnitId } from "./unit-id.js";
|
|
13
|
+
import { getTask, isDbAvailable, refreshOpenDatabaseFromDisk } from "./gsd-db.js";
|
|
14
|
+
import { isClosedStatus } from "./status-guards.js";
|
|
13
15
|
|
|
14
16
|
// Per-record advisory lock — prevents read-modify-write races between
|
|
15
17
|
// concurrent writers updating disjoint fields of the same runtime record.
|
|
@@ -67,17 +69,32 @@ export type UnitRuntimePhase =
|
|
|
67
69
|
| "wrapup-warning-sent"
|
|
68
70
|
| "timeout"
|
|
69
71
|
| "finalize-timeout"
|
|
72
|
+
| "crashed"
|
|
70
73
|
| "recovered"
|
|
71
74
|
| "finalized"
|
|
72
75
|
| "paused"
|
|
73
76
|
| "skipped";
|
|
74
77
|
|
|
78
|
+
export const IN_FLIGHT_RUNTIME_PHASES: ReadonlySet<UnitRuntimePhase> = new Set([
|
|
79
|
+
"dispatched",
|
|
80
|
+
"wrapup-warning-sent",
|
|
81
|
+
"timeout",
|
|
82
|
+
"finalize-timeout",
|
|
83
|
+
"crashed",
|
|
84
|
+
"paused",
|
|
85
|
+
]);
|
|
86
|
+
|
|
87
|
+
export function isInFlightRuntimePhase(phase: UnitRuntimePhase): boolean {
|
|
88
|
+
return IN_FLIGHT_RUNTIME_PHASES.has(phase);
|
|
89
|
+
}
|
|
90
|
+
|
|
75
91
|
export interface ExecuteTaskRecoveryStatus {
|
|
76
92
|
planPath: string;
|
|
77
93
|
summaryPath: string;
|
|
78
94
|
summaryExists: boolean;
|
|
79
95
|
taskChecked: boolean;
|
|
80
96
|
nextActionAdvanced: boolean;
|
|
97
|
+
dbComplete: boolean;
|
|
81
98
|
mustHaveCount: number;
|
|
82
99
|
mustHavesMentionedInSummary: number;
|
|
83
100
|
}
|
|
@@ -199,6 +216,12 @@ export async function inspectExecuteTaskDurability(
|
|
|
199
216
|
const escapedTid = tid.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
200
217
|
const taskChecked = !!planContent && new RegExp(`^- \\[[xX]\\] \\*\\*${escapedTid}:`, "m").test(planContent);
|
|
201
218
|
const nextActionAdvanced = !new RegExp(`Execute ${tid}\\b`).test(stateContent);
|
|
219
|
+
let dbComplete = false;
|
|
220
|
+
if (isDbAvailable()) {
|
|
221
|
+
refreshOpenDatabaseFromDisk();
|
|
222
|
+
const task = getTask(mid, sid, tid);
|
|
223
|
+
dbComplete = !!task && isClosedStatus(task.status);
|
|
224
|
+
}
|
|
202
225
|
|
|
203
226
|
// Must-have coverage: load task plan and count mentions in summary
|
|
204
227
|
let mustHaveCount = 0;
|
|
@@ -225,12 +248,14 @@ export async function inspectExecuteTaskDurability(
|
|
|
225
248
|
summaryExists,
|
|
226
249
|
taskChecked,
|
|
227
250
|
nextActionAdvanced,
|
|
251
|
+
dbComplete,
|
|
228
252
|
mustHaveCount,
|
|
229
253
|
mustHavesMentionedInSummary,
|
|
230
254
|
};
|
|
231
255
|
}
|
|
232
256
|
|
|
233
257
|
export function formatExecuteTaskRecoveryStatus(status: ExecuteTaskRecoveryStatus): string {
|
|
258
|
+
if (status.dbComplete) return "DB task status is closed";
|
|
234
259
|
const missing = [] as string[];
|
|
235
260
|
if (!status.summaryExists) missing.push(`summary missing (${status.summaryPath})`);
|
|
236
261
|
if (!status.taskChecked) missing.push(`task checkbox unchecked in ${status.planPath}`);
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Shared capped workflow protocol and doctor-heal prompt payload helpers.
|
|
3
|
+
|
|
4
|
+
const DEFAULT_WORKFLOW_PROTOCOL_EXCERPT_CHARS = 4_000;
|
|
5
|
+
const MIN_WORKFLOW_PROTOCOL_EXCERPT_CHARS = 1_000;
|
|
6
|
+
const DEFAULT_DOCTOR_SUMMARY_CHARS = 2_400;
|
|
7
|
+
const DEFAULT_DOCTOR_ISSUE_CHARS = 300;
|
|
8
|
+
const DEFAULT_DOCTOR_MAX_ISSUES = 12;
|
|
9
|
+
const DEFAULT_DOCTOR_ISSUES_CHARS = 4_000;
|
|
10
|
+
|
|
11
|
+
export function buildWorkflowProtocolExcerpt(
|
|
12
|
+
workflow: string,
|
|
13
|
+
workflowPath: string,
|
|
14
|
+
opts: { maxChars?: number } = {},
|
|
15
|
+
): string {
|
|
16
|
+
const limit = opts.maxChars ?? getWorkflowProtocolExcerptLimit();
|
|
17
|
+
const trimmed = workflow.trim();
|
|
18
|
+
const excerpt = buildPrioritizedWorkflowExcerpt(trimmed, limit);
|
|
19
|
+
const truncated = trimmed.length > limit;
|
|
20
|
+
const lines = [
|
|
21
|
+
"## GSD Workflow Protocol Excerpt",
|
|
22
|
+
`Source: \`${workflowPath}\``,
|
|
23
|
+
"",
|
|
24
|
+
excerpt,
|
|
25
|
+
];
|
|
26
|
+
if (truncated) {
|
|
27
|
+
lines.push(
|
|
28
|
+
"",
|
|
29
|
+
"[Workflow Protocol Truncated]",
|
|
30
|
+
"The full workflow protocol remains available at the source path above. Read it only if this excerpt lacks a rule required for the dispatched task.",
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return lines.join("\n");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function buildWorkflowDispatchContent(opts: {
|
|
37
|
+
workflow: string;
|
|
38
|
+
workflowPath: string;
|
|
39
|
+
task: string;
|
|
40
|
+
maxProtocolChars?: number;
|
|
41
|
+
}): string {
|
|
42
|
+
return [
|
|
43
|
+
"Read the following GSD workflow protocol excerpt and execute exactly. Use the source path for a full protocol read only if the excerpt lacks a required rule.",
|
|
44
|
+
"",
|
|
45
|
+
buildWorkflowProtocolExcerpt(opts.workflow, opts.workflowPath, { maxChars: opts.maxProtocolChars }),
|
|
46
|
+
"",
|
|
47
|
+
"## Your Task",
|
|
48
|
+
"",
|
|
49
|
+
opts.task.trim(),
|
|
50
|
+
].join("\n");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function buildDoctorHealSummary(reportText: string, opts: { maxChars?: number } = {}): string {
|
|
54
|
+
const limit = opts.maxChars ?? DEFAULT_DOCTOR_SUMMARY_CHARS;
|
|
55
|
+
const lines = reportText.split(/\r?\n/).map((line) => line.trimEnd());
|
|
56
|
+
const summaryLines = lines.filter((line) =>
|
|
57
|
+
line.length > 0 && (
|
|
58
|
+
/^#/.test(line) ||
|
|
59
|
+
/^(scope|status|summary|checks?|errors?|warnings?|fixes?|issues?)\b/i.test(line) ||
|
|
60
|
+
/doctor/i.test(line)
|
|
61
|
+
),
|
|
62
|
+
);
|
|
63
|
+
const selected = summaryLines.length > 0 ? summaryLines : lines.filter((line) => line.trim()).slice(0, 24);
|
|
64
|
+
return capText(selected.join("\n"), limit, "Full doctor report is available in the command output; use the structured issue list below for repairs.");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function buildDoctorHealIssuePayload(
|
|
68
|
+
structuredIssues: string,
|
|
69
|
+
opts: { maxIssues?: number; maxIssueChars?: number; maxChars?: number } = {},
|
|
70
|
+
): string {
|
|
71
|
+
const maxIssues = opts.maxIssues ?? DEFAULT_DOCTOR_MAX_ISSUES;
|
|
72
|
+
const maxIssueChars = opts.maxIssueChars ?? DEFAULT_DOCTOR_ISSUE_CHARS;
|
|
73
|
+
const maxChars = opts.maxChars ?? DEFAULT_DOCTOR_ISSUES_CHARS;
|
|
74
|
+
const blocks = splitIssueBlocks(structuredIssues);
|
|
75
|
+
const topBlocks = blocks.slice(0, maxIssues).map((block) =>
|
|
76
|
+
capText(block, maxIssueChars, "Issue details truncated; inspect the relevant artifact before editing."),
|
|
77
|
+
);
|
|
78
|
+
if (blocks.length > maxIssues) {
|
|
79
|
+
topBlocks.push(`[${blocks.length - maxIssues} additional actionable issue(s) omitted from prompt. Re-run /gsd doctor heal after this repair pass.]`);
|
|
80
|
+
}
|
|
81
|
+
return capText(topBlocks.join("\n\n"), maxChars, "Structured issue list truncated; repair top actionable issues first and re-run doctor heal.");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function getWorkflowProtocolExcerptLimit(): number {
|
|
85
|
+
const raw = process.env.PI_GSD_WORKFLOW_PROTOCOL_MAX_CHARS;
|
|
86
|
+
if (!raw) return DEFAULT_WORKFLOW_PROTOCOL_EXCERPT_CHARS;
|
|
87
|
+
const parsed = Number(raw);
|
|
88
|
+
if (!Number.isFinite(parsed) || parsed < MIN_WORKFLOW_PROTOCOL_EXCERPT_CHARS) {
|
|
89
|
+
return DEFAULT_WORKFLOW_PROTOCOL_EXCERPT_CHARS;
|
|
90
|
+
}
|
|
91
|
+
return Math.floor(parsed);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function buildPrioritizedWorkflowExcerpt(workflow: string, limit: number): string {
|
|
95
|
+
if (workflow.length <= limit) return workflow;
|
|
96
|
+
const sections = splitMarkdownSections(workflow);
|
|
97
|
+
const wanted = [
|
|
98
|
+
/^# /,
|
|
99
|
+
/^## Quick Start\b/i,
|
|
100
|
+
/^## The Hierarchy\b/i,
|
|
101
|
+
/^## The Phases\b/i,
|
|
102
|
+
/^### Phase 4: Execute\b/i,
|
|
103
|
+
/^### Phase 5: Verify\b/i,
|
|
104
|
+
/^### Observable Truths\b/i,
|
|
105
|
+
/^### Artifacts\b/i,
|
|
106
|
+
/^### Key Links\b/i,
|
|
107
|
+
/^### Phase 6: Summarize\b/i,
|
|
108
|
+
/^### Phase 7: Advance\b/i,
|
|
109
|
+
];
|
|
110
|
+
const selected: string[] = [];
|
|
111
|
+
const used = new Set<number>();
|
|
112
|
+
for (const pattern of wanted) {
|
|
113
|
+
const index = sections.findIndex((section, sectionIndex) =>
|
|
114
|
+
!used.has(sectionIndex) && pattern.test(section.heading),
|
|
115
|
+
);
|
|
116
|
+
if (index >= 0) {
|
|
117
|
+
used.add(index);
|
|
118
|
+
selected.push(sections[index].text);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const body = selected.length > 0 ? selected.join("\n\n") : workflow;
|
|
122
|
+
return capText(body, limit, "Workflow protocol excerpt capped; read the source path for omitted details.");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function splitMarkdownSections(markdown: string): Array<{ heading: string; text: string }> {
|
|
126
|
+
const lines = markdown.split(/\r?\n/);
|
|
127
|
+
const sections: Array<{ heading: string; text: string }> = [];
|
|
128
|
+
let currentHeading = lines[0]?.startsWith("#") ? lines[0] : "# Preamble";
|
|
129
|
+
let current: string[] = [];
|
|
130
|
+
for (const line of lines) {
|
|
131
|
+
if (/^#{1,3}\s+/.test(line) && current.length > 0) {
|
|
132
|
+
sections.push({ heading: currentHeading, text: current.join("\n").trim() });
|
|
133
|
+
currentHeading = line;
|
|
134
|
+
current = [line];
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (/^#{1,3}\s+/.test(line)) currentHeading = line;
|
|
138
|
+
current.push(line);
|
|
139
|
+
}
|
|
140
|
+
if (current.length > 0) {
|
|
141
|
+
sections.push({ heading: currentHeading, text: current.join("\n").trim() });
|
|
142
|
+
}
|
|
143
|
+
return sections.filter((section) => section.text.length > 0);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function splitIssueBlocks(structuredIssues: string): string[] {
|
|
147
|
+
const trimmed = structuredIssues.trim();
|
|
148
|
+
if (!trimmed) return ["No structured issue details were provided."];
|
|
149
|
+
const split = trimmed.split(/\n(?=(?:#{2,6}\s+|\d+\.\s+|- \*\*|- \[[ x]\]))/i)
|
|
150
|
+
.map((block) => block.trim())
|
|
151
|
+
.filter(Boolean);
|
|
152
|
+
return split.length > 0 ? split : [trimmed];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function capText(text: string, limit: number, notice: string): string {
|
|
156
|
+
if (text.length <= limit) return text;
|
|
157
|
+
const suffix = `\n\n[Truncated]\n${notice}`;
|
|
158
|
+
const headBudget = Math.max(0, limit - suffix.length);
|
|
159
|
+
return `${text.slice(0, headBudget).trimEnd()}${suffix}`;
|
|
160
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// GSD-2 + src/resources/extensions/gsd/working-output-messages.ts - Formats and audits user-facing working-state messages.
|
|
2
|
+
|
|
3
|
+
export type WorkingOutputSurface =
|
|
4
|
+
| "loader"
|
|
5
|
+
| "dashboard"
|
|
6
|
+
| "status"
|
|
7
|
+
| "notification"
|
|
8
|
+
| "assistant"
|
|
9
|
+
| "tool";
|
|
10
|
+
|
|
11
|
+
export type WorkingHealthState =
|
|
12
|
+
| "healthy"
|
|
13
|
+
| "waiting"
|
|
14
|
+
| "recovering"
|
|
15
|
+
| "stalled"
|
|
16
|
+
| "provider-error"
|
|
17
|
+
| "timeout"
|
|
18
|
+
| "stopped";
|
|
19
|
+
|
|
20
|
+
export interface WorkingOutputContext {
|
|
21
|
+
unitType?: string;
|
|
22
|
+
unitId?: string;
|
|
23
|
+
health?: WorkingHealthState;
|
|
24
|
+
elapsedMs?: number;
|
|
25
|
+
recoveryAttempts?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface WorkingOutputMessage {
|
|
29
|
+
surface: WorkingOutputSurface;
|
|
30
|
+
message: string;
|
|
31
|
+
context?: WorkingOutputContext;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface WorkingOutputFinding {
|
|
35
|
+
code:
|
|
36
|
+
| "empty-message"
|
|
37
|
+
| "generic-working-message"
|
|
38
|
+
| "misleading-healthy-message"
|
|
39
|
+
| "fake-zero-progress"
|
|
40
|
+
| "missing-action";
|
|
41
|
+
severity: "error" | "warning";
|
|
42
|
+
detail: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const ACTION_RE = /\b(?:wait|pause|paused|retry|retrying|recover|recovering|resume|stop|stopped|run|press|type|configure|restart)\b/i;
|
|
46
|
+
|
|
47
|
+
export function formatAutoUnitWorkingMessage(unitType: string, unitId: string): string {
|
|
48
|
+
switch (unitType) {
|
|
49
|
+
case "research-milestone":
|
|
50
|
+
case "research-slice":
|
|
51
|
+
return `Researching ${unitId}: waiting for provider response`;
|
|
52
|
+
case "plan-milestone":
|
|
53
|
+
case "plan-slice":
|
|
54
|
+
return `Planning ${unitId}: waiting for provider response`;
|
|
55
|
+
case "execute-task":
|
|
56
|
+
return `Executing ${unitId}: waiting for provider response`;
|
|
57
|
+
case "complete-slice":
|
|
58
|
+
case "complete-milestone":
|
|
59
|
+
return `Completing ${unitId}: waiting for provider response`;
|
|
60
|
+
default:
|
|
61
|
+
return `${unitType} ${unitId}: waiting for provider response`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function evaluateWorkingOutputMessage(
|
|
66
|
+
item: WorkingOutputMessage,
|
|
67
|
+
): WorkingOutputFinding[] {
|
|
68
|
+
const findings: WorkingOutputFinding[] = [];
|
|
69
|
+
const message = item.message.trim();
|
|
70
|
+
const health = item.context?.health;
|
|
71
|
+
|
|
72
|
+
if (!message) {
|
|
73
|
+
findings.push({
|
|
74
|
+
code: "empty-message",
|
|
75
|
+
severity: "error",
|
|
76
|
+
detail: `${item.surface} message is empty`,
|
|
77
|
+
});
|
|
78
|
+
return findings;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (/^Working(?:\.\.\.)?(?:\s|\(|$)/i.test(message)) {
|
|
82
|
+
findings.push({
|
|
83
|
+
code: "generic-working-message",
|
|
84
|
+
severity: "warning",
|
|
85
|
+
detail: `${item.surface} message should say what work is running`,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (/Progressing well/i.test(message) && health && health !== "healthy") {
|
|
90
|
+
findings.push({
|
|
91
|
+
code: "misleading-healthy-message",
|
|
92
|
+
severity: "error",
|
|
93
|
+
detail: `${item.surface} says progress is healthy while runtime health is ${health}`,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (/\b0\s*\/\s*0\s+slices\b/i.test(message)) {
|
|
98
|
+
findings.push({
|
|
99
|
+
code: "fake-zero-progress",
|
|
100
|
+
severity: "warning",
|
|
101
|
+
detail: `${item.surface} should hide roadmap progress before roadmap slices exist`,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if ((health === "stalled" || health === "provider-error" || health === "timeout") && !ACTION_RE.test(message)) {
|
|
106
|
+
findings.push({
|
|
107
|
+
code: "missing-action",
|
|
108
|
+
severity: "warning",
|
|
109
|
+
detail: `${item.surface} should give the user a next action for ${health}`,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return findings;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function evaluateWorkingOutputMessages(
|
|
117
|
+
items: WorkingOutputMessage[],
|
|
118
|
+
): WorkingOutputFinding[] {
|
|
119
|
+
return items.flatMap(evaluateWorkingOutputMessage);
|
|
120
|
+
}
|
|
@@ -70,6 +70,15 @@ export interface WorktreeDiffSummary {
|
|
|
70
70
|
removed: string[];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
function deleteBranchIfPresent(basePath: string, branch: string, warningPrefix: string): void {
|
|
74
|
+
try {
|
|
75
|
+
if (!nativeBranchExists(basePath, branch)) return;
|
|
76
|
+
nativeBranchDelete(basePath, branch, true);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
logWarning("worktree", `${warningPrefix}: ${(e as Error).message}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
73
82
|
// ─── Path Helpers ──────────────────────────────────────────────────────────
|
|
74
83
|
|
|
75
84
|
function normalizePathForComparison(path: string): string {
|
|
@@ -408,7 +417,7 @@ export function listWorktrees(basePath: string): WorktreeInfo[] {
|
|
|
408
417
|
|
|
409
418
|
/** Directories to skip when scanning for nested .git dirs. */
|
|
410
419
|
const NESTED_GIT_SKIP_DIRS = new Set([
|
|
411
|
-
".git", ".gsd", "node_modules", ".next", ".nuxt", "dist", "build",
|
|
420
|
+
".git", ".gsd", ".bg-shell", "node_modules", ".next", ".nuxt", "dist", "build",
|
|
412
421
|
"__pycache__", ".tox", ".venv", "venv", "target", "vendor",
|
|
413
422
|
]);
|
|
414
423
|
|
|
@@ -462,7 +471,9 @@ export function findNestedGitDirs(rootPath: string): string[] {
|
|
|
462
471
|
continue;
|
|
463
472
|
}
|
|
464
473
|
} catch (e) {
|
|
465
|
-
|
|
474
|
+
if ((e as NodeJS.ErrnoException).code !== "ENOENT") {
|
|
475
|
+
logWarning("worktree", `existsSync/.git check failed for ${fullPath}: ${(e as Error).message}`);
|
|
476
|
+
}
|
|
466
477
|
}
|
|
467
478
|
|
|
468
479
|
walk(fullPath, depth + 1);
|
|
@@ -535,7 +546,7 @@ export function removeWorktree(
|
|
|
535
546
|
if (!existsSync(wtPath)) {
|
|
536
547
|
nativeWorktreePrune(basePath);
|
|
537
548
|
if (deleteBranch) {
|
|
538
|
-
|
|
549
|
+
deleteBranchIfPresent(basePath, branch, "nativeBranchDelete failed");
|
|
539
550
|
}
|
|
540
551
|
return;
|
|
541
552
|
}
|
|
@@ -670,7 +681,7 @@ export function removeWorktree(
|
|
|
670
681
|
nativeWorktreePrune(basePath);
|
|
671
682
|
|
|
672
683
|
if (deleteBranch) {
|
|
673
|
-
|
|
684
|
+
deleteBranchIfPresent(basePath, branch, "final branch delete failed");
|
|
674
685
|
}
|
|
675
686
|
}
|
|
676
687
|
|
|
@@ -25,7 +25,7 @@ import { emitWorktreeCreated, emitWorktreeMerged } from "./worktree-telemetry.js
|
|
|
25
25
|
import { getCollapseCadence, getMilestoneResquash, resquashMilestoneOnMain } from "./slice-cadence.js";
|
|
26
26
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
27
27
|
import { resolveWorktreeProjectRoot, normalizeWorktreePathForCompare } from "./worktree-root.js";
|
|
28
|
-
import { claimMilestoneLease, releaseMilestoneLease } from "./db/milestone-leases.js";
|
|
28
|
+
import { claimMilestoneLease, refreshMilestoneLease, releaseMilestoneLease } from "./db/milestone-leases.js";
|
|
29
29
|
|
|
30
30
|
// ─── Path Comparison Helper ────────────────────────────────────────────────
|
|
31
31
|
/**
|
|
@@ -40,6 +40,16 @@ function isSamePath(a: string, b: string): boolean {
|
|
|
40
40
|
return normalizeWorktreePathForCompare(a) === normalizeWorktreePathForCompare(b);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
class UserNotifiedError extends Error {
|
|
44
|
+
readonly cause?: unknown;
|
|
45
|
+
|
|
46
|
+
constructor(message: string, cause?: unknown) {
|
|
47
|
+
super(message);
|
|
48
|
+
this.name = "UserNotifiedError";
|
|
49
|
+
this.cause = cause;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
// ─── Dependency Interface ──────────────────────────────────────────────────
|
|
44
54
|
|
|
45
55
|
export interface WorktreeResolverDeps {
|
|
@@ -71,6 +81,13 @@ export interface WorktreeResolverDeps {
|
|
|
71
81
|
milestoneId: string,
|
|
72
82
|
) => void;
|
|
73
83
|
getCurrentBranch: (basePath: string) => string;
|
|
84
|
+
/**
|
|
85
|
+
* Force-checkout the named branch in `basePath`. Required by `_mergeBranchMode`
|
|
86
|
+
* when it discovers the working tree is not on the milestone branch — preflight
|
|
87
|
+
* stash + later operations may have switched HEAD to main, and silently skipping
|
|
88
|
+
* the merge would strand the milestone's commits.
|
|
89
|
+
*/
|
|
90
|
+
checkoutBranch: (basePath: string, branch: string) => void;
|
|
74
91
|
autoWorktreeBranch: (milestoneId: string) => string;
|
|
75
92
|
resolveMilestoneFile: (
|
|
76
93
|
basePath: string,
|
|
@@ -207,23 +224,44 @@ export class WorktreeResolver {
|
|
|
207
224
|
// milestone (re-entry within the same session).
|
|
208
225
|
if (this.s.workerId) {
|
|
209
226
|
if (this.s.currentMilestoneId === milestoneId && this.s.milestoneLeaseToken !== null) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
227
|
+
const refreshed = refreshMilestoneLease(
|
|
228
|
+
this.s.workerId,
|
|
229
|
+
milestoneId,
|
|
230
|
+
this.s.milestoneLeaseToken,
|
|
231
|
+
);
|
|
232
|
+
if (refreshed) {
|
|
233
|
+
debugLog("WorktreeResolver", {
|
|
234
|
+
action: "enterMilestone",
|
|
235
|
+
milestoneId,
|
|
236
|
+
leaseRefreshed: true,
|
|
237
|
+
fencingToken: this.s.milestoneLeaseToken,
|
|
238
|
+
});
|
|
239
|
+
} else {
|
|
240
|
+
debugLog("WorktreeResolver", {
|
|
241
|
+
action: "enterMilestone",
|
|
242
|
+
milestoneId,
|
|
243
|
+
staleLeaseToken: this.s.milestoneLeaseToken,
|
|
244
|
+
});
|
|
224
245
|
this.s.milestoneLeaseToken = null;
|
|
225
246
|
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// If we held a different milestone, release it first so other
|
|
250
|
+
// workers don't have to wait for TTL.
|
|
251
|
+
if (this.s.currentMilestoneId && this.s.currentMilestoneId !== milestoneId && this.s.milestoneLeaseToken !== null) {
|
|
252
|
+
try {
|
|
253
|
+
releaseMilestoneLease(this.s.workerId, this.s.currentMilestoneId, this.s.milestoneLeaseToken);
|
|
254
|
+
} catch (err) {
|
|
255
|
+
debugLog("WorktreeResolver", {
|
|
256
|
+
action: "enterMilestone",
|
|
257
|
+
milestoneId,
|
|
258
|
+
releasePriorLeaseError: err instanceof Error ? err.message : String(err),
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
this.s.milestoneLeaseToken = null;
|
|
262
|
+
}
|
|
226
263
|
|
|
264
|
+
if (this.s.milestoneLeaseToken === null) {
|
|
227
265
|
try {
|
|
228
266
|
const claim = claimMilestoneLease(this.s.workerId, milestoneId);
|
|
229
267
|
if (claim.ok) {
|
|
@@ -803,16 +841,41 @@ export class WorktreeResolver {
|
|
|
803
841
|
const milestoneBranch = this.deps.autoWorktreeBranch(milestoneId);
|
|
804
842
|
|
|
805
843
|
if (currentBranch !== milestoneBranch) {
|
|
844
|
+
// #5538-followup: previous behavior was to silently `return false`
|
|
845
|
+
// when HEAD wasn't on the milestone branch — that let the loop
|
|
846
|
+
// advance with the milestone's commits stranded on the branch (the
|
|
847
|
+
// exact failure mode reported in the test12345 repro). Attempt
|
|
848
|
+
// recovery by force-checking-out the milestone branch; if the
|
|
849
|
+
// checkout fails, throw so the caller pauses auto-mode and the user
|
|
850
|
+
// sees the failure instead of a silent merge skip.
|
|
806
851
|
debugLog("WorktreeResolver", {
|
|
807
852
|
action: "mergeAndExit",
|
|
808
853
|
milestoneId,
|
|
809
854
|
mode: "branch",
|
|
810
|
-
|
|
811
|
-
reason: "not-on-milestone-branch",
|
|
855
|
+
recovery: "checkout-milestone-branch",
|
|
812
856
|
currentBranch,
|
|
813
857
|
milestoneBranch,
|
|
814
858
|
});
|
|
815
|
-
|
|
859
|
+
try {
|
|
860
|
+
this.deps.checkoutBranch(this.s.basePath, milestoneBranch);
|
|
861
|
+
} catch (checkoutErr) {
|
|
862
|
+
const checkoutMsg = checkoutErr instanceof Error ? checkoutErr.message : String(checkoutErr);
|
|
863
|
+
ctx.notify(
|
|
864
|
+
`Cannot merge milestone ${milestoneId}: working tree is on ${currentBranch} and checkout to ${milestoneBranch} failed (${checkoutMsg}). Resolve manually and run /gsd auto to resume.`,
|
|
865
|
+
"error",
|
|
866
|
+
);
|
|
867
|
+
throw new UserNotifiedError(checkoutMsg, checkoutErr);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
const reverify = this.deps.getCurrentBranch(this.s.basePath);
|
|
871
|
+
if (reverify !== milestoneBranch) {
|
|
872
|
+
const reverifyMsg = `branch checkout to ${milestoneBranch} reported success but current branch is ${reverify}`;
|
|
873
|
+
ctx.notify(
|
|
874
|
+
`Cannot merge milestone ${milestoneId}: ${reverifyMsg}. Resolve manually and run /gsd auto to resume.`,
|
|
875
|
+
"error",
|
|
876
|
+
);
|
|
877
|
+
throw new UserNotifiedError(reverifyMsg);
|
|
878
|
+
}
|
|
816
879
|
}
|
|
817
880
|
|
|
818
881
|
const roadmapPath = this.deps.resolveMilestoneFile(
|
|
@@ -869,7 +932,9 @@ export class WorktreeResolver {
|
|
|
869
932
|
result: "error",
|
|
870
933
|
error: msg,
|
|
871
934
|
});
|
|
872
|
-
|
|
935
|
+
if (!(err instanceof UserNotifiedError)) {
|
|
936
|
+
ctx.notify(`Milestone merge failed (branch mode): ${msg}`, "warning");
|
|
937
|
+
}
|
|
873
938
|
// Re-throw all errors so callers can apply their own recovery logic (#4380).
|
|
874
939
|
throw err;
|
|
875
940
|
}
|
|
@@ -897,6 +962,7 @@ export class WorktreeResolver {
|
|
|
897
962
|
try {
|
|
898
963
|
this.mergeAndExit(currentMilestoneId, ctx);
|
|
899
964
|
} catch (err) {
|
|
965
|
+
if (err instanceof UserNotifiedError) throw err;
|
|
900
966
|
// mergeAndExit emits a warning and restores state when it fails during
|
|
901
967
|
// merge/cleanup. But if it throws before recovery runs (e.g., in
|
|
902
968
|
// validateMilestoneId or emitJournalEvent), basePath won't be restored
|