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
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
// GSD-2 + src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts - Handles provider and agent-end recovery for GSD auto-mode.
|
|
1
2
|
import { logWarning } from "../workflow-logger.js";
|
|
2
3
|
import { checkDeepProjectSetupAfterTurn, checkAutoStartAfterDiscuss, maybeHandleReadyPhraseWithoutFiles, maybeHandleEmptyIntentTurn, resetEmptyTurnCounter, } from "../guided-flow.js";
|
|
3
4
|
import { clearPathCache } from "../paths.js";
|
|
4
5
|
import { getAutoDashboardData, getAutoModeStartModel, isAutoActive, pauseAuto, setCurrentDispatchedModelId } from "../auto.js";
|
|
5
6
|
import { getNextFallbackModel, resolveModelWithFallbacksForUnit } from "../preferences.js";
|
|
6
7
|
import { pauseAutoForProviderError } from "../provider-error-pause.js";
|
|
7
|
-
import { isSessionSwitchInFlight, resolveAgentEnd } from "../auto/resolve.js";
|
|
8
|
+
import { isSessionSwitchAbortGraceActive, isSessionSwitchInFlight, resolveAgentEnd, resolveAgentEndCancelled, } from "../auto/resolve.js";
|
|
8
9
|
import { resolveModelId } from "../auto-model-selection.js";
|
|
9
10
|
import { resolveProjectRoot } from "../worktree.js";
|
|
10
11
|
import { clearDiscussionFlowState } from "./write-gate.js";
|
|
@@ -47,6 +48,89 @@ export function _buildAbortedPauseContext(lastMsg) {
|
|
|
47
48
|
isTransient: true,
|
|
48
49
|
};
|
|
49
50
|
}
|
|
51
|
+
export function isUserInitiatedAbortMessage(message) {
|
|
52
|
+
if (!message)
|
|
53
|
+
return false;
|
|
54
|
+
return /\b(?:claude code process aborted by user|request aborted by user|process aborted by user)\b/i.test(message);
|
|
55
|
+
}
|
|
56
|
+
function isBareClaudeCodeSessionSwitchAbortMarker(message) {
|
|
57
|
+
if (!message)
|
|
58
|
+
return false;
|
|
59
|
+
const normalized = message.trim().replace(/\s+/g, " ").toLowerCase();
|
|
60
|
+
return normalized === "claude code process aborted by user"
|
|
61
|
+
|| normalized === "request aborted by user"
|
|
62
|
+
|| normalized === "process aborted by user"
|
|
63
|
+
|| normalized === "claude code stream aborted by caller";
|
|
64
|
+
}
|
|
65
|
+
function readAssistantTextContent(content) {
|
|
66
|
+
if (!Array.isArray(content))
|
|
67
|
+
return "";
|
|
68
|
+
return content
|
|
69
|
+
.map((block) => {
|
|
70
|
+
if (!block || typeof block !== "object")
|
|
71
|
+
return "";
|
|
72
|
+
const text = block.text;
|
|
73
|
+
return typeof text === "string" ? text : "";
|
|
74
|
+
})
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.join("\n");
|
|
77
|
+
}
|
|
78
|
+
export function isClaudeCodeSessionSwitchAbortMessage(lastMsg) {
|
|
79
|
+
if (!lastMsg || typeof lastMsg !== "object")
|
|
80
|
+
return false;
|
|
81
|
+
const m = lastMsg;
|
|
82
|
+
const carriers = [
|
|
83
|
+
m.errorMessage ? String(m.errorMessage) : "",
|
|
84
|
+
readAssistantTextContent(m.content),
|
|
85
|
+
].filter((value) => value.trim().length > 0);
|
|
86
|
+
if ((m.stopReason === "error" || m.stopReason === "aborted") && carriers.length > 0) {
|
|
87
|
+
return carriers.every(isBareClaudeCodeSessionSwitchAbortMarker);
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Resolve an agent_end event observed while a session switch is in flight.
|
|
93
|
+
*
|
|
94
|
+
* #5538-followup: When `newSession()` aborts an in-flight stream as part of a
|
|
95
|
+
* session transition (run-unit.ts:63 → _settleCurrentTurnForSessionTransition
|
|
96
|
+
* → agent.abort()), the SDK emits "Claude Code process aborted by user" or
|
|
97
|
+
* "Request aborted by user" against the previous unit's turn. The previous
|
|
98
|
+
* code path treated that as a user cancellation and propagated it to the next
|
|
99
|
+
* unit via the pending-switch-cancellation queue, killing auto-mode with
|
|
100
|
+
* "Auto-mode stopped — Unit aborted: Claude Code process aborted by user"
|
|
101
|
+
* even though no user input occurred.
|
|
102
|
+
*
|
|
103
|
+
* Claude Code abort markers are intentionally ignored when the abort fires
|
|
104
|
+
* while the session-switch is in flight: the abort is the expected side-effect
|
|
105
|
+
* of the transition, not a user signal. Other branches (genuine `stopReason
|
|
106
|
+
* === "aborted"` with diagnostic content/errorMessage) preserve the prior
|
|
107
|
+
* behavior.
|
|
108
|
+
*/
|
|
109
|
+
export function _handleSessionSwitchAgentEnd(lastMsg, resolveCancelled) {
|
|
110
|
+
if (!lastMsg || typeof lastMsg !== "object")
|
|
111
|
+
return;
|
|
112
|
+
const m = lastMsg;
|
|
113
|
+
if (isClaudeCodeSessionSwitchAbortMessage(m)) {
|
|
114
|
+
// Internal abort from in-flight session transition — drop on the floor.
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (m.stopReason === "error") {
|
|
118
|
+
const rawErrorMsg = m.errorMessage ? String(m.errorMessage) : "";
|
|
119
|
+
if (isBareClaudeCodeSessionSwitchAbortMarker(rawErrorMsg)) {
|
|
120
|
+
// Internal abort from in-flight session transition — drop on the floor.
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (m.stopReason === "aborted") {
|
|
126
|
+
const content = m.content;
|
|
127
|
+
const hasEmptyContent = Array.isArray(content) && content.length === 0;
|
|
128
|
+
const hasErrorMessage = !!m.errorMessage;
|
|
129
|
+
if (!hasEmptyContent || hasErrorMessage) {
|
|
130
|
+
resolveCancelled(_buildAbortedPauseContext(m));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
50
134
|
async function pauseTransientWithBackoff(cls, pi, ctx, errorDetail, isRateLimit) {
|
|
51
135
|
retryState.consecutiveTransientCount += 1;
|
|
52
136
|
const baseRetryAfterMs = "retryAfterMs" in cls ? cls.retryAfterMs : 15_000;
|
|
@@ -112,9 +196,17 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
112
196
|
return;
|
|
113
197
|
if (!isAutoActive())
|
|
114
198
|
return;
|
|
115
|
-
if (isSessionSwitchInFlight())
|
|
116
|
-
return;
|
|
117
199
|
const lastMsg = event.messages[event.messages.length - 1];
|
|
200
|
+
if (isSessionSwitchInFlight()) {
|
|
201
|
+
_handleSessionSwitchAgentEnd(lastMsg, resolveAgentEndCancelled);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (isSessionSwitchAbortGraceActive() && isClaudeCodeSessionSwitchAbortMessage(lastMsg)) {
|
|
205
|
+
// Claude Code can report the abort from `newSession()` a few hundred ms
|
|
206
|
+
// after the guard drops. That event belongs to the old turn; do not let it
|
|
207
|
+
// cancel the freshly-dispatched unit.
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
118
210
|
if (lastMsg && "stopReason" in lastMsg && lastMsg.stopReason === "aborted") {
|
|
119
211
|
// Empty content with aborted stopReason is a non-fatal agent stop (the LLM
|
|
120
212
|
// chose to end without producing output). Only pause on genuine fatal aborts
|
|
@@ -150,6 +242,14 @@ export async function handleAgentEnd(pi, event, ctx) {
|
|
|
150
242
|
// is in the assistant message text content. Fall back to content when
|
|
151
243
|
// errorMessage looks uninformative.
|
|
152
244
|
const rawErrorMsg = ("errorMessage" in lastMsg && lastMsg.errorMessage) ? String(lastMsg.errorMessage) : "";
|
|
245
|
+
if (isUserInitiatedAbortMessage(rawErrorMsg)) {
|
|
246
|
+
resolveAgentEndCancelled({
|
|
247
|
+
message: rawErrorMsg,
|
|
248
|
+
category: "aborted",
|
|
249
|
+
isTransient: false,
|
|
250
|
+
});
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
153
253
|
const isUseless = !rawErrorMsg || /^(success|ok|true|error|unknown)$/i.test(rawErrorMsg.trim());
|
|
154
254
|
// #3588: When errorMessage is uninformative, extract the real error from
|
|
155
255
|
// the assistant message text content for display purposes only.
|
|
@@ -11,6 +11,12 @@ import { incrementLegacyTelemetry } from "../legacy-telemetry.js";
|
|
|
11
11
|
async function loadWorkflowExecutors() {
|
|
12
12
|
return import("../tools/workflow-tool-executors.js");
|
|
13
13
|
}
|
|
14
|
+
function toolWorkspaceRoot(ctx) {
|
|
15
|
+
if (ctx && typeof ctx === "object" && typeof ctx.cwd === "string") {
|
|
16
|
+
return ctx.cwd;
|
|
17
|
+
}
|
|
18
|
+
return process.cwd();
|
|
19
|
+
}
|
|
14
20
|
/**
|
|
15
21
|
* Register an alias tool that shares the same execute function as its canonical counterpart.
|
|
16
22
|
* The alias description and promptGuidelines direct the LLM to prefer the canonical name.
|
|
@@ -31,8 +37,8 @@ function registerAlias(pi, toolDef, aliasName, canonicalName) {
|
|
|
31
37
|
execute,
|
|
32
38
|
});
|
|
33
39
|
}
|
|
34
|
-
function requirementRootWriteGuard(operation) {
|
|
35
|
-
const guard = shouldBlockRootArtifactSaveInSnapshot(loadWriteGateSnapshot(
|
|
40
|
+
function requirementRootWriteGuard(operation, basePath) {
|
|
41
|
+
const guard = shouldBlockRootArtifactSaveInSnapshot(loadWriteGateSnapshot(basePath), "REQUIREMENTS");
|
|
36
42
|
if (!guard.block)
|
|
37
43
|
return null;
|
|
38
44
|
return {
|
|
@@ -56,7 +62,8 @@ function readDetails(result) {
|
|
|
56
62
|
export function registerDbTools(pi) {
|
|
57
63
|
// ─── gsd_decision_save (formerly gsd_save_decision) ─────────────────────
|
|
58
64
|
const decisionSaveExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
59
|
-
const
|
|
65
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
66
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
60
67
|
if (!dbAvailable) {
|
|
61
68
|
return {
|
|
62
69
|
content: [{ type: "text", text: "Error: GSD database is not available. Cannot save decision." }],
|
|
@@ -73,7 +80,7 @@ export function registerDbTools(pi) {
|
|
|
73
80
|
revisable: params.revisable,
|
|
74
81
|
when_context: params.when_context,
|
|
75
82
|
made_by: params.made_by,
|
|
76
|
-
},
|
|
83
|
+
}, basePath);
|
|
77
84
|
return {
|
|
78
85
|
content: [{ type: "text", text: `Saved decision ${id}` }],
|
|
79
86
|
details: { operation: "save_decision", id },
|
|
@@ -140,10 +147,11 @@ export function registerDbTools(pi) {
|
|
|
140
147
|
registerAlias(pi, decisionSaveTool, "gsd_save_decision", "gsd_decision_save");
|
|
141
148
|
// ─── gsd_requirement_update (formerly gsd_update_requirement) ───────────
|
|
142
149
|
const requirementUpdateExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
143
|
-
const
|
|
150
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
151
|
+
const gateBlock = requirementRootWriteGuard("update_requirement", basePath);
|
|
144
152
|
if (gateBlock)
|
|
145
153
|
return gateBlock;
|
|
146
|
-
const dbAvailable = await ensureDbOpen();
|
|
154
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
147
155
|
if (!dbAvailable) {
|
|
148
156
|
return {
|
|
149
157
|
content: [{ type: "text", text: "Error: GSD database is not available. Cannot update requirement." }],
|
|
@@ -165,7 +173,7 @@ export function registerDbTools(pi) {
|
|
|
165
173
|
updates.primary_owner = params.primary_owner;
|
|
166
174
|
if (params.supporting_slices !== undefined)
|
|
167
175
|
updates.supporting_slices = params.supporting_slices;
|
|
168
|
-
await updateRequirementInDb(params.id, updates,
|
|
176
|
+
await updateRequirementInDb(params.id, updates, basePath);
|
|
169
177
|
return {
|
|
170
178
|
content: [{ type: "text", text: `Updated requirement ${params.id}` }],
|
|
171
179
|
details: { operation: "update_requirement", id: params.id },
|
|
@@ -225,10 +233,11 @@ export function registerDbTools(pi) {
|
|
|
225
233
|
registerAlias(pi, requirementUpdateTool, "gsd_update_requirement", "gsd_requirement_update");
|
|
226
234
|
// ─── gsd_requirement_save ─────────────────────────────────────────────
|
|
227
235
|
const requirementSaveExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
228
|
-
const
|
|
236
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
237
|
+
const gateBlock = requirementRootWriteGuard("save_requirement", basePath);
|
|
229
238
|
if (gateBlock)
|
|
230
239
|
return gateBlock;
|
|
231
|
-
const dbAvailable = await ensureDbOpen();
|
|
240
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
232
241
|
if (!dbAvailable) {
|
|
233
242
|
return {
|
|
234
243
|
content: [{ type: "text", text: "Error: GSD database is not available. Cannot save requirement." }],
|
|
@@ -247,7 +256,7 @@ export function registerDbTools(pi) {
|
|
|
247
256
|
supporting_slices: params.supporting_slices,
|
|
248
257
|
validation: params.validation,
|
|
249
258
|
notes: params.notes,
|
|
250
|
-
},
|
|
259
|
+
}, basePath);
|
|
251
260
|
return {
|
|
252
261
|
content: [{ type: "text", text: `Saved requirement ${result.id}` }],
|
|
253
262
|
details: { operation: "save_requirement", id: result.id },
|
|
@@ -324,7 +333,7 @@ export function registerDbTools(pi) {
|
|
|
324
333
|
// ─── gsd_summary_save (formerly gsd_save_summary) ──────────────────────
|
|
325
334
|
const summarySaveExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
326
335
|
const { executeSummarySave } = await loadWorkflowExecutors();
|
|
327
|
-
return executeSummarySave(params,
|
|
336
|
+
return executeSummarySave(params, toolWorkspaceRoot(_ctx));
|
|
328
337
|
};
|
|
329
338
|
const summarySaveTool = {
|
|
330
339
|
name: "gsd_summary_save",
|
|
@@ -373,23 +382,23 @@ export function registerDbTools(pi) {
|
|
|
373
382
|
// ─── gsd_milestone_generate_id (formerly gsd_generate_milestone_id) ────
|
|
374
383
|
const milestoneGenerateIdExecute = async (_toolCallId, _params, _signal, _onUpdate, _ctx) => {
|
|
375
384
|
try {
|
|
385
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
376
386
|
// Claim a reserved ID if the guided-flow already previewed one to the user.
|
|
377
387
|
// This guarantees the ID shown in the UI matches the one materialised on disk.
|
|
378
388
|
const { claimReservedId, findMilestoneIds, getReservedMilestoneIds, nextMilestoneId } = await import("../guided-flow.js");
|
|
379
389
|
const reserved = claimReservedId();
|
|
380
390
|
if (reserved) {
|
|
381
|
-
await ensureMilestoneDbRow(reserved);
|
|
391
|
+
await ensureMilestoneDbRow(reserved, basePath);
|
|
382
392
|
return {
|
|
383
393
|
content: [{ type: "text", text: reserved }],
|
|
384
394
|
details: { operation: "generate_milestone_id", id: reserved, source: "reserved" },
|
|
385
395
|
};
|
|
386
396
|
}
|
|
387
|
-
const basePath = process.cwd();
|
|
388
397
|
const existingIds = findMilestoneIds(basePath);
|
|
389
|
-
const uniqueEnabled = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
398
|
+
const uniqueEnabled = !!loadEffectiveGSDPreferences(basePath)?.preferences?.unique_milestone_ids;
|
|
390
399
|
const allIds = [...new Set([...existingIds, ...getReservedMilestoneIds()])];
|
|
391
400
|
const newId = nextMilestoneId(allIds, uniqueEnabled);
|
|
392
|
-
await ensureMilestoneDbRow(newId);
|
|
401
|
+
await ensureMilestoneDbRow(newId, basePath);
|
|
393
402
|
return {
|
|
394
403
|
content: [{ type: "text", text: newId }],
|
|
395
404
|
details: { operation: "generate_milestone_id", id: newId, existingCount: existingIds.length, uniqueEnabled },
|
|
@@ -409,8 +418,8 @@ export function registerDbTools(pi) {
|
|
|
409
418
|
* later writes the full row. Silently skips if the DB isn't available yet
|
|
410
419
|
* (pre-migration).
|
|
411
420
|
*/
|
|
412
|
-
async function ensureMilestoneDbRow(milestoneId) {
|
|
413
|
-
const dbAvailable = await ensureDbOpen();
|
|
421
|
+
async function ensureMilestoneDbRow(milestoneId, basePath) {
|
|
422
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
414
423
|
if (!dbAvailable)
|
|
415
424
|
return;
|
|
416
425
|
try {
|
|
@@ -455,7 +464,7 @@ export function registerDbTools(pi) {
|
|
|
455
464
|
// ─── gsd_plan_milestone (gsd_milestone_plan alias) ─────────────────────
|
|
456
465
|
const planMilestoneExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
457
466
|
const { executePlanMilestone } = await loadWorkflowExecutors();
|
|
458
|
-
return executePlanMilestone(params,
|
|
467
|
+
return executePlanMilestone(params, toolWorkspaceRoot(_ctx));
|
|
459
468
|
};
|
|
460
469
|
const planMilestoneTool = {
|
|
461
470
|
name: "gsd_plan_milestone",
|
|
@@ -520,7 +529,7 @@ export function registerDbTools(pi) {
|
|
|
520
529
|
// ─── gsd_plan_slice (gsd_slice_plan alias) ─────────────────────────────
|
|
521
530
|
const planSliceExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
522
531
|
const { executePlanSlice } = await loadWorkflowExecutors();
|
|
523
|
-
return executePlanSlice(params,
|
|
532
|
+
return executePlanSlice(params, toolWorkspaceRoot(_ctx));
|
|
524
533
|
};
|
|
525
534
|
const planSliceTool = {
|
|
526
535
|
name: "gsd_plan_slice",
|
|
@@ -564,7 +573,8 @@ export function registerDbTools(pi) {
|
|
|
564
573
|
registerAlias(pi, planSliceTool, "gsd_slice_plan", "gsd_plan_slice");
|
|
565
574
|
// ─── gsd_plan_task (gsd_task_plan alias) ───────────────────────────────
|
|
566
575
|
const planTaskExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
567
|
-
const
|
|
576
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
577
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
568
578
|
if (!dbAvailable) {
|
|
569
579
|
return {
|
|
570
580
|
content: [{ type: "text", text: "Error: GSD database is not available. Cannot plan task." }],
|
|
@@ -573,7 +583,7 @@ export function registerDbTools(pi) {
|
|
|
573
583
|
}
|
|
574
584
|
try {
|
|
575
585
|
const { handlePlanTask } = await import("../tools/plan-task.js");
|
|
576
|
-
const result = await handlePlanTask(params,
|
|
586
|
+
const result = await handlePlanTask(params, basePath);
|
|
577
587
|
if ("error" in result) {
|
|
578
588
|
return {
|
|
579
589
|
content: [{ type: "text", text: `Error planning task: ${result.error}` }],
|
|
@@ -634,7 +644,7 @@ export function registerDbTools(pi) {
|
|
|
634
644
|
// ─── gsd_task_complete (gsd_complete_task alias) ────────────────────────
|
|
635
645
|
const taskCompleteExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
636
646
|
const { executeTaskComplete } = await loadWorkflowExecutors();
|
|
637
|
-
return executeTaskComplete(params,
|
|
647
|
+
return executeTaskComplete(params, toolWorkspaceRoot(_ctx));
|
|
638
648
|
};
|
|
639
649
|
const taskCompleteTool = {
|
|
640
650
|
name: "gsd_task_complete",
|
|
@@ -697,7 +707,7 @@ export function registerDbTools(pi) {
|
|
|
697
707
|
// ─── gsd_slice_complete (gsd_complete_slice alias) ─────────────────────
|
|
698
708
|
const sliceCompleteExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
699
709
|
const { executeSliceComplete } = await loadWorkflowExecutors();
|
|
700
|
-
return executeSliceComplete(params,
|
|
710
|
+
return executeSliceComplete(params, toolWorkspaceRoot(_ctx));
|
|
701
711
|
};
|
|
702
712
|
const sliceCompleteTool = {
|
|
703
713
|
name: "gsd_slice_complete",
|
|
@@ -777,7 +787,8 @@ export function registerDbTools(pi) {
|
|
|
777
787
|
registerAlias(pi, sliceCompleteTool, "gsd_complete_slice", "gsd_slice_complete");
|
|
778
788
|
// ─── gsd_skip_slice (#3477 / #3487) ───────────────────────────────────
|
|
779
789
|
const skipSliceExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
780
|
-
const
|
|
790
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
791
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
781
792
|
if (!dbAvailable) {
|
|
782
793
|
return {
|
|
783
794
|
content: [{ type: "text", text: "Error: GSD database is not available. Cannot skip slice." }],
|
|
@@ -806,7 +817,6 @@ export function registerDbTools(pi) {
|
|
|
806
817
|
// Rebuild STATE.md so it reflects the skip immediately (#3477).
|
|
807
818
|
// Without this, /gsd auto reads stale STATE.md and resumes the skipped slice.
|
|
808
819
|
try {
|
|
809
|
-
const basePath = process.cwd();
|
|
810
820
|
const { rebuildState } = await import("../doctor.js");
|
|
811
821
|
await rebuildState(basePath);
|
|
812
822
|
}
|
|
@@ -862,7 +872,7 @@ export function registerDbTools(pi) {
|
|
|
862
872
|
// ─── gsd_complete_milestone ────────────────────────────────────────────
|
|
863
873
|
const milestoneCompleteExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
864
874
|
const { executeCompleteMilestone } = await loadWorkflowExecutors();
|
|
865
|
-
return executeCompleteMilestone(params,
|
|
875
|
+
return executeCompleteMilestone(params, toolWorkspaceRoot(_ctx));
|
|
866
876
|
};
|
|
867
877
|
const milestoneCompleteTool = {
|
|
868
878
|
name: "gsd_complete_milestone",
|
|
@@ -903,7 +913,7 @@ export function registerDbTools(pi) {
|
|
|
903
913
|
// ─── gsd_validate_milestone (gsd_milestone_validate alias) ─────────────
|
|
904
914
|
const milestoneValidateExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
905
915
|
const { executeValidateMilestone } = await loadWorkflowExecutors();
|
|
906
|
-
return executeValidateMilestone(params,
|
|
916
|
+
return executeValidateMilestone(params, toolWorkspaceRoot(_ctx));
|
|
907
917
|
};
|
|
908
918
|
const milestoneValidateTool = {
|
|
909
919
|
name: "gsd_validate_milestone",
|
|
@@ -936,7 +946,7 @@ export function registerDbTools(pi) {
|
|
|
936
946
|
// ─── gsd_replan_slice (gsd_slice_replan alias) ─────────────────────────
|
|
937
947
|
const replanSliceExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
938
948
|
const { executeReplanSlice } = await loadWorkflowExecutors();
|
|
939
|
-
return executeReplanSlice(params,
|
|
949
|
+
return executeReplanSlice(params, toolWorkspaceRoot(_ctx));
|
|
940
950
|
};
|
|
941
951
|
const replanSliceTool = {
|
|
942
952
|
name: "gsd_replan_slice",
|
|
@@ -979,7 +989,7 @@ export function registerDbTools(pi) {
|
|
|
979
989
|
// ─── gsd_reassess_roadmap (gsd_roadmap_reassess alias) ─────────────────
|
|
980
990
|
const reassessRoadmapExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
981
991
|
const { executeReassessRoadmap } = await loadWorkflowExecutors();
|
|
982
|
-
return executeReassessRoadmap(params,
|
|
992
|
+
return executeReassessRoadmap(params, toolWorkspaceRoot(_ctx));
|
|
983
993
|
};
|
|
984
994
|
const reassessRoadmapTool = {
|
|
985
995
|
name: "gsd_reassess_roadmap",
|
|
@@ -1027,7 +1037,8 @@ export function registerDbTools(pi) {
|
|
|
1027
1037
|
// ─── gsd_task_reopen (gsd_reopen_task alias) ───────────────────────────
|
|
1028
1038
|
// Single-writer v3, Stream 3: reversibility tools for closed units.
|
|
1029
1039
|
const reopenTaskExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
1030
|
-
const
|
|
1040
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
1041
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
1031
1042
|
if (!dbAvailable) {
|
|
1032
1043
|
return {
|
|
1033
1044
|
content: [{ type: "text", text: "Error: GSD database is not available. Cannot reopen task." }],
|
|
@@ -1036,7 +1047,7 @@ export function registerDbTools(pi) {
|
|
|
1036
1047
|
}
|
|
1037
1048
|
try {
|
|
1038
1049
|
const { handleReopenTask } = await import("../tools/reopen-task.js");
|
|
1039
|
-
const result = await handleReopenTask(params,
|
|
1050
|
+
const result = await handleReopenTask(params, basePath);
|
|
1040
1051
|
if ("error" in result) {
|
|
1041
1052
|
return {
|
|
1042
1053
|
content: [{ type: "text", text: `Error reopening task: ${result.error}` }],
|
|
@@ -1089,7 +1100,8 @@ export function registerDbTools(pi) {
|
|
|
1089
1100
|
registerAlias(pi, reopenTaskTool, "gsd_reopen_task", "gsd_task_reopen");
|
|
1090
1101
|
// ─── gsd_slice_reopen (gsd_reopen_slice alias) ─────────────────────────
|
|
1091
1102
|
const reopenSliceExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
1092
|
-
const
|
|
1103
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
1104
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
1093
1105
|
if (!dbAvailable) {
|
|
1094
1106
|
return {
|
|
1095
1107
|
content: [{ type: "text", text: "Error: GSD database is not available. Cannot reopen slice." }],
|
|
@@ -1098,7 +1110,7 @@ export function registerDbTools(pi) {
|
|
|
1098
1110
|
}
|
|
1099
1111
|
try {
|
|
1100
1112
|
const { handleReopenSlice } = await import("../tools/reopen-slice.js");
|
|
1101
|
-
const result = await handleReopenSlice(params,
|
|
1113
|
+
const result = await handleReopenSlice(params, basePath);
|
|
1102
1114
|
if ("error" in result) {
|
|
1103
1115
|
return {
|
|
1104
1116
|
content: [{ type: "text", text: `Error reopening slice: ${result.error}` }],
|
|
@@ -1151,7 +1163,8 @@ export function registerDbTools(pi) {
|
|
|
1151
1163
|
registerAlias(pi, reopenSliceTool, "gsd_reopen_slice", "gsd_slice_reopen");
|
|
1152
1164
|
// ─── gsd_milestone_reopen (gsd_reopen_milestone alias) ─────────────────
|
|
1153
1165
|
const reopenMilestoneExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
1154
|
-
const
|
|
1166
|
+
const basePath = toolWorkspaceRoot(_ctx);
|
|
1167
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
1155
1168
|
if (!dbAvailable) {
|
|
1156
1169
|
return {
|
|
1157
1170
|
content: [{ type: "text", text: "Error: GSD database is not available. Cannot reopen milestone." }],
|
|
@@ -1160,7 +1173,7 @@ export function registerDbTools(pi) {
|
|
|
1160
1173
|
}
|
|
1161
1174
|
try {
|
|
1162
1175
|
const { handleReopenMilestone } = await import("../tools/reopen-milestone.js");
|
|
1163
|
-
const result = await handleReopenMilestone(params,
|
|
1176
|
+
const result = await handleReopenMilestone(params, basePath);
|
|
1164
1177
|
if ("error" in result) {
|
|
1165
1178
|
return {
|
|
1166
1179
|
content: [{ type: "text", text: `Error reopening milestone: ${result.error}` }],
|
|
@@ -1212,7 +1225,7 @@ export function registerDbTools(pi) {
|
|
|
1212
1225
|
// ─── gsd_save_gate_result ──────────────────────────────────────────────
|
|
1213
1226
|
const saveGateResultExecute = async (_toolCallId, params, _signal, _onUpdate, _ctx) => {
|
|
1214
1227
|
const { executeSaveGateResult } = await loadWorkflowExecutors();
|
|
1215
|
-
return executeSaveGateResult(params,
|
|
1228
|
+
return executeSaveGateResult(params, toolWorkspaceRoot(_ctx));
|
|
1216
1229
|
};
|
|
1217
1230
|
const saveGateResultTool = {
|
|
1218
1231
|
name: "gsd_save_gate_result",
|
|
@@ -4,6 +4,12 @@ import { createBashTool, createEditTool, createReadTool, createWriteTool } from
|
|
|
4
4
|
import { DEFAULT_BASH_TIMEOUT_SECS } from "../constants.js";
|
|
5
5
|
import { setLogBasePath, logWarning } from "../workflow-logger.js";
|
|
6
6
|
import { resolveGsdPathContract } from "../paths.js";
|
|
7
|
+
function resolveToolWorkspaceRoot(ctx) {
|
|
8
|
+
if (ctx && typeof ctx === "object" && typeof ctx.cwd === "string") {
|
|
9
|
+
return ctx.cwd;
|
|
10
|
+
}
|
|
11
|
+
return process.cwd();
|
|
12
|
+
}
|
|
7
13
|
/**
|
|
8
14
|
* Resolve the correct DB path for the current working directory.
|
|
9
15
|
* If `basePath` is inside a `.gsd/worktrees/<MID>/` directory, returns
|
|
@@ -45,16 +51,20 @@ export async function ensureDbOpen(basePath = process.cwd()) {
|
|
|
45
51
|
}
|
|
46
52
|
export function registerDynamicTools(pi) {
|
|
47
53
|
const baseBash = createBashTool(process.cwd(), {
|
|
48
|
-
spawnHook: (ctx) =>
|
|
54
|
+
spawnHook: (ctx) => ctx,
|
|
49
55
|
});
|
|
50
56
|
const dynamicBash = {
|
|
51
57
|
...baseBash,
|
|
52
58
|
execute: async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
59
|
+
const basePath = resolveToolWorkspaceRoot(ctx);
|
|
60
|
+
const fresh = createBashTool(basePath, {
|
|
61
|
+
spawnHook: (spawnCtx) => ({ ...spawnCtx, cwd: basePath }),
|
|
62
|
+
});
|
|
53
63
|
const paramsWithTimeout = {
|
|
54
64
|
...params,
|
|
55
65
|
timeout: params.timeout ?? DEFAULT_BASH_TIMEOUT_SECS,
|
|
56
66
|
};
|
|
57
|
-
return
|
|
67
|
+
return fresh.execute(toolCallId, paramsWithTimeout, signal, onUpdate, ctx);
|
|
58
68
|
},
|
|
59
69
|
};
|
|
60
70
|
pi.registerTool(dynamicBash);
|
|
@@ -62,7 +72,7 @@ export function registerDynamicTools(pi) {
|
|
|
62
72
|
pi.registerTool({
|
|
63
73
|
...baseWrite,
|
|
64
74
|
execute: async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
65
|
-
const fresh = createWriteTool(
|
|
75
|
+
const fresh = createWriteTool(resolveToolWorkspaceRoot(ctx));
|
|
66
76
|
return fresh.execute(toolCallId, params, signal, onUpdate, ctx);
|
|
67
77
|
},
|
|
68
78
|
});
|
|
@@ -70,7 +80,7 @@ export function registerDynamicTools(pi) {
|
|
|
70
80
|
pi.registerTool({
|
|
71
81
|
...baseRead,
|
|
72
82
|
execute: async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
73
|
-
const fresh = createReadTool(
|
|
83
|
+
const fresh = createReadTool(resolveToolWorkspaceRoot(ctx));
|
|
74
84
|
return fresh.execute(toolCallId, params, signal, onUpdate, ctx);
|
|
75
85
|
},
|
|
76
86
|
});
|
|
@@ -78,7 +88,7 @@ export function registerDynamicTools(pi) {
|
|
|
78
88
|
pi.registerTool({
|
|
79
89
|
...baseEdit,
|
|
80
90
|
execute: async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
81
|
-
const fresh = createEditTool(
|
|
91
|
+
const fresh = createEditTool(resolveToolWorkspaceRoot(ctx));
|
|
82
92
|
return fresh.execute(toolCallId, params, signal, onUpdate, ctx);
|
|
83
93
|
},
|
|
84
94
|
});
|
|
@@ -3,21 +3,40 @@
|
|
|
3
3
|
// Exposes the Context Mode runtime tools in-process. Default-on; opt out with
|
|
4
4
|
// `context_mode.enabled: false` in preferences.
|
|
5
5
|
import { Type } from "@sinclair/typebox";
|
|
6
|
+
function toolWorkspaceRoot(ctx) {
|
|
7
|
+
if (ctx && typeof ctx === "object" && typeof ctx.cwd === "string") {
|
|
8
|
+
return ctx.cwd;
|
|
9
|
+
}
|
|
10
|
+
return process.cwd();
|
|
11
|
+
}
|
|
12
|
+
async function loadContextModePreferences(baseDir) {
|
|
13
|
+
const [{ loadEffectiveGSDPreferences }, { logWarning }] = await Promise.all([
|
|
14
|
+
import("../preferences.js"),
|
|
15
|
+
import("../workflow-logger.js"),
|
|
16
|
+
]);
|
|
17
|
+
try {
|
|
18
|
+
return loadEffectiveGSDPreferences(baseDir)?.preferences ?? null;
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
logWarning("tool", `Context Mode tool could not load preferences: ${err instanceof Error ? err.message : String(err)}`);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
6
25
|
export function registerExecTools(pi) {
|
|
7
26
|
pi.registerTool({
|
|
8
27
|
name: "gsd_exec",
|
|
9
28
|
label: "Exec (Sandboxed)",
|
|
10
|
-
description: "Run a short script (bash/node/python) in a subprocess.
|
|
29
|
+
description: "Run a short script (bash/node/python) in a subprocess. Capped stdout/stderr and metadata persist to " +
|
|
11
30
|
".gsd/exec/<id>.{stdout,stderr,meta.json}; only a short digest returns in context. Use " +
|
|
12
31
|
"this instead of reading many files or emitting large tool outputs — e.g. have the script " +
|
|
13
32
|
"count/grep/summarize and log the finding. Enabled by default; opt out via " +
|
|
14
33
|
"preferences.context_mode.enabled=false.",
|
|
15
|
-
promptSnippet: "Run a bash/node/python script in a sandbox;
|
|
34
|
+
promptSnippet: "Run a bash/node/python script in a sandbox; capped output is saved to disk and only a digest returns",
|
|
16
35
|
promptGuidelines: [
|
|
17
36
|
"Prefer gsd_exec for analyses that would otherwise read >3 files or produce large tool output.",
|
|
18
37
|
"Write scripts that log the finding (counts, matches, summaries) rather than raw dumps.",
|
|
19
38
|
"The digest is the last ~300 chars of stdout — size your log output accordingly.",
|
|
20
|
-
"Need
|
|
39
|
+
"Need persisted output? Read the stdout_path returned in details (file on local disk).",
|
|
21
40
|
],
|
|
22
41
|
parameters: Type.Object({
|
|
23
42
|
runtime: Type.Union([Type.Literal("bash"), Type.Literal("node"), Type.Literal("python")], { description: "Interpreter: bash (-c), node (-e), or python3 (-c)." }),
|
|
@@ -30,21 +49,11 @@ export function registerExecTools(pi) {
|
|
|
30
49
|
})),
|
|
31
50
|
}),
|
|
32
51
|
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
import("../preferences.js"),
|
|
36
|
-
import("../workflow-logger.js"),
|
|
37
|
-
]);
|
|
38
|
-
let prefs = null;
|
|
39
|
-
try {
|
|
40
|
-
prefs = loadEffectiveGSDPreferences();
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
logWarning("tool", `gsd_exec could not load preferences: ${err instanceof Error ? err.message : String(err)}`);
|
|
44
|
-
}
|
|
52
|
+
const { executeGsdExec } = await import("../tools/exec-tool.js");
|
|
53
|
+
const baseDir = toolWorkspaceRoot(_ctx);
|
|
45
54
|
return executeGsdExec(params, {
|
|
46
|
-
baseDir
|
|
47
|
-
preferences:
|
|
55
|
+
baseDir,
|
|
56
|
+
preferences: await loadContextModePreferences(baseDir),
|
|
48
57
|
});
|
|
49
58
|
},
|
|
50
59
|
});
|
|
@@ -56,7 +65,7 @@ export function registerExecTools(pi) {
|
|
|
56
65
|
promptSnippet: "Search prior gsd_exec runs by substring, runtime, or failing-only filter",
|
|
57
66
|
promptGuidelines: [
|
|
58
67
|
"Use this before re-running an expensive analysis — the prior run's stdout file may still answer.",
|
|
59
|
-
"The preview shows the trailing ~300 chars of stdout; read stdout_path for
|
|
68
|
+
"The preview shows the trailing ~300 chars of stdout; read stdout_path for persisted output.",
|
|
60
69
|
],
|
|
61
70
|
parameters: Type.Object({
|
|
62
71
|
query: Type.Optional(Type.String({ description: "Substring matched against id and purpose (case-insensitive)." })),
|
|
@@ -68,8 +77,10 @@ export function registerExecTools(pi) {
|
|
|
68
77
|
}),
|
|
69
78
|
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
70
79
|
const { executeExecSearch } = await import("../tools/exec-search-tool.js");
|
|
80
|
+
const baseDir = toolWorkspaceRoot(_ctx);
|
|
71
81
|
return executeExecSearch(params, {
|
|
72
|
-
baseDir
|
|
82
|
+
baseDir,
|
|
83
|
+
preferences: await loadContextModePreferences(baseDir),
|
|
73
84
|
});
|
|
74
85
|
},
|
|
75
86
|
});
|
|
@@ -87,8 +98,10 @@ export function registerExecTools(pi) {
|
|
|
87
98
|
parameters: Type.Object({}),
|
|
88
99
|
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
89
100
|
const { executeResume } = await import("../tools/resume-tool.js");
|
|
101
|
+
const baseDir = toolWorkspaceRoot(_ctx);
|
|
90
102
|
return executeResume(params, {
|
|
91
|
-
baseDir
|
|
103
|
+
baseDir,
|
|
104
|
+
preferences: await loadContextModePreferences(baseDir),
|
|
92
105
|
});
|
|
93
106
|
},
|
|
94
107
|
});
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
2
|
import { queryJournal } from "../journal.js";
|
|
3
3
|
import { logWarning } from "../workflow-logger.js";
|
|
4
|
+
function toolWorkspaceRoot(ctx) {
|
|
5
|
+
if (ctx && typeof ctx === "object" && typeof ctx.cwd === "string") {
|
|
6
|
+
return ctx.cwd;
|
|
7
|
+
}
|
|
8
|
+
return process.cwd();
|
|
9
|
+
}
|
|
4
10
|
export function registerJournalTools(pi) {
|
|
5
11
|
pi.registerTool({
|
|
6
12
|
name: "gsd_journal_query",
|
|
@@ -37,7 +43,7 @@ export function registerJournalTools(pi) {
|
|
|
37
43
|
filters.after = params.after;
|
|
38
44
|
if (params.before !== undefined)
|
|
39
45
|
filters.before = params.before;
|
|
40
|
-
const entries = queryJournal(
|
|
46
|
+
const entries = queryJournal(toolWorkspaceRoot(_ctx), filters);
|
|
41
47
|
const limited = entries.slice(0, params.limit ?? 100);
|
|
42
48
|
if (limited.length === 0) {
|
|
43
49
|
return {
|