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,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Registers GSD extension runtime hooks and token-saving tool policies.
|
|
3
|
+
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
2
7
|
|
|
3
8
|
import type { ExtensionAPI, ExtensionContext } from "@gsd/pi-coding-agent";
|
|
4
9
|
import { isToolCallEventType } from "@gsd/pi-coding-agent";
|
|
@@ -7,7 +12,7 @@ import type { GSDEcosystemBeforeAgentStartHandler } from "../ecosystem/gsd-exten
|
|
|
7
12
|
import { updateSnapshot } from "../ecosystem/gsd-extension-api.js";
|
|
8
13
|
|
|
9
14
|
import { buildMilestoneFileName, resolveMilestonePath, resolveSliceFile, resolveSlicePath } from "../paths.js";
|
|
10
|
-
import { canonicalToolName, clearDiscussionFlowState, isDepthConfirmationAnswer, isQueuePhaseActive, markApprovalGateVerified, markDepthVerified, resetWriteGateState, shouldBlockContextWrite, shouldBlockPlanningUnit, shouldBlockQueueExecution, isGateQuestionId, setPendingGate, clearPendingGate, getPendingGate, shouldBlockPendingGate, shouldBlockPendingGateBash, extractDepthVerificationMilestoneId } from "./write-gate.js";
|
|
15
|
+
import { canonicalToolName, clearDiscussionFlowState, isDepthConfirmationAnswer, isQueuePhaseActive, markApprovalGateVerified, markDepthVerified, resetWriteGateState, shouldBlockContextWrite, shouldBlockPlanningUnit, shouldBlockQueueExecution, shouldBlockWorktreeWrite, isGateQuestionId, setPendingGate, clearPendingGate, getPendingGate, shouldBlockPendingGate, shouldBlockPendingGateBash, extractDepthVerificationMilestoneId } from "./write-gate.js";
|
|
11
16
|
import { resolveManifest } from "../unit-context-manifest.js";
|
|
12
17
|
import { isBlockedStateFile, isBashWriteToStateFile, BLOCKED_WRITE_ERROR } from "../write-intercept.js";
|
|
13
18
|
import { loadFile, saveFile, formatContinue } from "../files.js";
|
|
@@ -25,12 +30,245 @@ import { initNotificationWidget } from "../notification-widget.js";
|
|
|
25
30
|
import { resolveWorktreeProjectRoot } from "../worktree-root.js";
|
|
26
31
|
import { extractSubagentAgentClasses } from "./subagent-input.js";
|
|
27
32
|
import { approvalGateIdForUnit, isExplicitApprovalResponse, shouldPauseForUserApprovalQuestion } from "../user-input-boundary.js";
|
|
33
|
+
import { resolveSkillManifest } from "../skill-manifest.js";
|
|
28
34
|
|
|
29
|
-
// Skip the welcome screen on the very first session_start — cli.ts already
|
|
30
|
-
// printed it before the TUI launched. Only re-print on /clear (subsequent sessions).
|
|
31
|
-
let isFirstSession = true;
|
|
32
35
|
let approvalQuestionAbortInFlight = false;
|
|
33
36
|
|
|
37
|
+
interface DeferredApprovalGate {
|
|
38
|
+
gateId: string;
|
|
39
|
+
basePath: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type WelcomeScreenModule = {
|
|
43
|
+
buildWelcomeScreenLines(opts: { version: string; remoteChannel?: string; width?: number }): string[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
async function loadWelcomeScreenModule(): Promise<WelcomeScreenModule | undefined> {
|
|
47
|
+
const candidates: string[] = [];
|
|
48
|
+
const gsdBinPath = process.env.GSD_BIN_PATH;
|
|
49
|
+
if (gsdBinPath) {
|
|
50
|
+
candidates.push(join(dirname(gsdBinPath), "welcome-screen.js"));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const packageRoot = process.env.GSD_PKG_ROOT;
|
|
54
|
+
if (packageRoot) {
|
|
55
|
+
candidates.push(join(packageRoot, "dist", "welcome-screen.js"));
|
|
56
|
+
candidates.push(join(packageRoot, "src", "welcome-screen.ts"));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
for (const candidate of candidates) {
|
|
60
|
+
try {
|
|
61
|
+
if (!existsSync(candidate)) continue;
|
|
62
|
+
const mod = await import(pathToFileURL(candidate).href) as Partial<WelcomeScreenModule>;
|
|
63
|
+
if (typeof mod.buildWelcomeScreenLines === "function") {
|
|
64
|
+
return mod as WelcomeScreenModule;
|
|
65
|
+
}
|
|
66
|
+
} catch {
|
|
67
|
+
// Try the next package layout.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function installWelcomeHeader(ctx: ExtensionContext): Promise<void> {
|
|
74
|
+
if (!ctx.hasUI || typeof ctx.ui?.setHeader !== "function") return;
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const welcome = await loadWelcomeScreenModule();
|
|
78
|
+
if (!welcome) return;
|
|
79
|
+
|
|
80
|
+
let remoteChannel: string | undefined;
|
|
81
|
+
try {
|
|
82
|
+
const { resolveRemoteConfig } = await import("../../remote-questions/config.js");
|
|
83
|
+
const rc = resolveRemoteConfig();
|
|
84
|
+
if (rc) remoteChannel = rc.channel;
|
|
85
|
+
} catch { /* non-fatal */ }
|
|
86
|
+
|
|
87
|
+
ctx.ui.setHeader(() => ({
|
|
88
|
+
render(width: number): string[] {
|
|
89
|
+
return welcome.buildWelcomeScreenLines({
|
|
90
|
+
version: process.env.GSD_VERSION || "0.0.0",
|
|
91
|
+
remoteChannel,
|
|
92
|
+
width,
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
invalidate(): void {},
|
|
96
|
+
}));
|
|
97
|
+
} catch {
|
|
98
|
+
/* non-fatal */
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let deferredApprovalGate: DeferredApprovalGate | null = null;
|
|
103
|
+
|
|
104
|
+
export const MINIMAL_GSD_TOOL_NAMES = [
|
|
105
|
+
"gsd_exec",
|
|
106
|
+
"gsd_exec_search",
|
|
107
|
+
"gsd_resume",
|
|
108
|
+
"gsd_milestone_status",
|
|
109
|
+
"gsd_checkpoint_db",
|
|
110
|
+
"memory_query",
|
|
111
|
+
"capture_thought",
|
|
112
|
+
] as const;
|
|
113
|
+
|
|
114
|
+
export const MINIMAL_AUTO_BASE_TOOL_NAMES = [
|
|
115
|
+
"ask_user_questions",
|
|
116
|
+
"bash",
|
|
117
|
+
"bg_shell",
|
|
118
|
+
"edit",
|
|
119
|
+
"glob",
|
|
120
|
+
"grep",
|
|
121
|
+
"ls",
|
|
122
|
+
"read",
|
|
123
|
+
"write",
|
|
124
|
+
] as const;
|
|
125
|
+
|
|
126
|
+
const AUTO_UNIT_SCOPED_TOOLS: Record<string, readonly string[]> = {
|
|
127
|
+
"research-milestone": ["gsd_summary_save", "gsd_decision_save"],
|
|
128
|
+
"plan-milestone": ["gsd_plan_milestone", "gsd_decision_save", "gsd_requirement_update"],
|
|
129
|
+
"discuss-milestone": ["gsd_summary_save", "gsd_decision_save", "gsd_requirement_save"],
|
|
130
|
+
"validate-milestone": ["gsd_validate_milestone", "gsd_reassess_roadmap", "subagent"],
|
|
131
|
+
"complete-milestone": ["gsd_complete_milestone", "subagent"],
|
|
132
|
+
"research-slice": ["gsd_summary_save", "gsd_decision_save"],
|
|
133
|
+
"plan-slice": ["gsd_plan_slice", "gsd_plan_task", "gsd_decision_save"],
|
|
134
|
+
"refine-slice": ["gsd_plan_slice", "gsd_plan_task", "gsd_decision_save"],
|
|
135
|
+
"replan-slice": ["gsd_replan_slice", "gsd_plan_task", "gsd_decision_save"],
|
|
136
|
+
"complete-slice": ["gsd_slice_complete", "gsd_decision_save", "gsd_requirement_update", "subagent"],
|
|
137
|
+
"reassess-roadmap": ["gsd_reassess_roadmap"],
|
|
138
|
+
"execute-task": ["gsd_task_complete", "gsd_decision_save"],
|
|
139
|
+
"execute-task-simple": ["gsd_task_complete", "gsd_decision_save"],
|
|
140
|
+
"reactive-execute": ["gsd_task_complete", "gsd_decision_save"],
|
|
141
|
+
"run-uat": ["gsd_summary_save"],
|
|
142
|
+
"gate-evaluate": ["gsd_save_gate_result"],
|
|
143
|
+
"rewrite-docs": ["gsd_summary_save", "gsd_decision_save"],
|
|
144
|
+
"workflow-preferences": ["gsd_summary_save"],
|
|
145
|
+
"discuss-project": ["gsd_summary_save", "gsd_decision_save", "gsd_requirement_save"],
|
|
146
|
+
"discuss-requirements": ["gsd_requirement_save", "gsd_summary_save"],
|
|
147
|
+
"research-decision": ["gsd_summary_save"],
|
|
148
|
+
"research-project": ["gsd_summary_save", "gsd_decision_save"],
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const WORKFLOW_GSD_TOOL_NAMES = [
|
|
152
|
+
...MINIMAL_GSD_TOOL_NAMES,
|
|
153
|
+
...Object.values(AUTO_UNIT_SCOPED_TOOLS).flat(),
|
|
154
|
+
].filter(isGsdManagedTool);
|
|
155
|
+
|
|
156
|
+
function isGsdManagedTool(name: string): boolean {
|
|
157
|
+
return name.startsWith("gsd_") || name === "memory_query" || name === "capture_thought" || name === "gsd_graph";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function buildMinimalGsdToolSet(activeToolNames: readonly string[]): string[] {
|
|
161
|
+
const active = new Set(activeToolNames);
|
|
162
|
+
const preserved = activeToolNames.filter((name) => !isGsdManagedTool(name));
|
|
163
|
+
const minimal = MINIMAL_GSD_TOOL_NAMES.filter((name) => active.has(name));
|
|
164
|
+
return [...new Set([...preserved, ...minimal])];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function buildMinimalAutoGsdToolSet(
|
|
168
|
+
activeToolNames: readonly string[],
|
|
169
|
+
unitType: string | undefined,
|
|
170
|
+
): string[] {
|
|
171
|
+
const active = new Set(activeToolNames);
|
|
172
|
+
const unitTools = unitType ? AUTO_UNIT_SCOPED_TOOLS[unitType] ?? [] : [];
|
|
173
|
+
const autoBaseTools = new Set<string>(MINIMAL_AUTO_BASE_TOOL_NAMES);
|
|
174
|
+
const preserved = activeToolNames.filter((name) => autoBaseTools.has(name));
|
|
175
|
+
const scoped = [...MINIMAL_GSD_TOOL_NAMES, ...unitTools].filter((name) => active.has(name));
|
|
176
|
+
return [...new Set([...preserved, ...scoped])];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function buildMinimalGsdWorkflowToolSet(activeToolNames: readonly string[]): string[] {
|
|
180
|
+
const active = new Set(activeToolNames);
|
|
181
|
+
const autoBaseTools = new Set<string>(MINIMAL_AUTO_BASE_TOOL_NAMES);
|
|
182
|
+
const preserved = activeToolNames.filter((name) => autoBaseTools.has(name));
|
|
183
|
+
const scoped = WORKFLOW_GSD_TOOL_NAMES.filter((name) => active.has(name));
|
|
184
|
+
return [...new Set([...preserved, ...scoped])];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function buildRequestScopedGsdToolSet(
|
|
188
|
+
activeToolNames: readonly string[],
|
|
189
|
+
requestCustomMessages: readonly { customType?: string }[] | undefined,
|
|
190
|
+
): string[] | undefined {
|
|
191
|
+
for (let index = (requestCustomMessages?.length ?? 0) - 1; index >= 0; index--) {
|
|
192
|
+
const currentCustomType = requestCustomMessages?.[index]?.customType;
|
|
193
|
+
if (
|
|
194
|
+
currentCustomType === "gsd-run" ||
|
|
195
|
+
currentCustomType === "gsd-discuss" ||
|
|
196
|
+
currentCustomType === "gsd-doctor-heal" ||
|
|
197
|
+
currentCustomType === "gsd-triage"
|
|
198
|
+
) {
|
|
199
|
+
return buildMinimalGsdWorkflowToolSet(activeToolNames);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function isFullGsdToolSurfaceRequested(): boolean {
|
|
206
|
+
return process.env.PI_GSD_FULL_TOOLS === "1";
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function isGeneralGsdToolScopingRequested(): boolean {
|
|
210
|
+
return process.env.PI_GSD_MINIMAL_TOOLS === "1";
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface ScopedGsdWorkflowState {
|
|
214
|
+
tools: string[] | null;
|
|
215
|
+
visibleSkills: string[] | undefined;
|
|
216
|
+
restoreVisibleSkills: boolean;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
type GsdWorkflowScopeApi = Pick<ExtensionAPI, "getActiveTools" | "setActiveTools"> & Partial<Pick<ExtensionAPI, "getVisibleSkills" | "setVisibleSkills">>;
|
|
220
|
+
|
|
221
|
+
function applyMinimalGsdToolSurface(pi: ExtensionAPI): void {
|
|
222
|
+
if (isFullGsdToolSurfaceRequested()) return;
|
|
223
|
+
const dash = getAutoRuntimeSnapshot();
|
|
224
|
+
if (dash.active && dash.currentUnit) {
|
|
225
|
+
pi.setActiveTools(buildMinimalAutoGsdToolSet(pi.getActiveTools(), dash.currentUnit.type));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (!isGeneralGsdToolScopingRequested()) return;
|
|
229
|
+
pi.setActiveTools(buildMinimalGsdToolSet(pi.getActiveTools()));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function scopeGsdWorkflowToolsForDispatch(
|
|
233
|
+
pi: GsdWorkflowScopeApi,
|
|
234
|
+
unitType?: string,
|
|
235
|
+
): ScopedGsdWorkflowState | null {
|
|
236
|
+
if (isFullGsdToolSurfaceRequested()) return null;
|
|
237
|
+
const current = pi.getActiveTools();
|
|
238
|
+
const scoped = unitType
|
|
239
|
+
? buildMinimalAutoGsdToolSet(current, unitType)
|
|
240
|
+
: buildMinimalGsdWorkflowToolSet(current);
|
|
241
|
+
const toolsChanged = !(scoped.length === current.length && scoped.every((name, index) => name === current[index]));
|
|
242
|
+
const skillManifest = resolveSkillManifest(unitType);
|
|
243
|
+
const canScopeSkills = skillManifest !== null && pi.getVisibleSkills && pi.setVisibleSkills;
|
|
244
|
+
if (!toolsChanged && !canScopeSkills) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
if (toolsChanged) {
|
|
248
|
+
pi.setActiveTools(scoped);
|
|
249
|
+
}
|
|
250
|
+
const visibleSkills = canScopeSkills ? pi.getVisibleSkills!() : undefined;
|
|
251
|
+
if (canScopeSkills) {
|
|
252
|
+
pi.setVisibleSkills!(skillManifest);
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
tools: toolsChanged ? current : null,
|
|
256
|
+
visibleSkills,
|
|
257
|
+
restoreVisibleSkills: Boolean(canScopeSkills),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export function restoreGsdWorkflowTools(
|
|
262
|
+
pi: Pick<ExtensionAPI, "setActiveTools"> & Partial<Pick<ExtensionAPI, "setVisibleSkills">>,
|
|
263
|
+
savedState: ScopedGsdWorkflowState | null,
|
|
264
|
+
): void {
|
|
265
|
+
if (!savedState) return;
|
|
266
|
+
if (savedState.tools) pi.setActiveTools(savedState.tools);
|
|
267
|
+
if (savedState.restoreVisibleSkills && pi.setVisibleSkills) {
|
|
268
|
+
pi.setVisibleSkills(savedState.visibleSkills);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
34
272
|
async function deriveGsdState(basePath: string) {
|
|
35
273
|
const { deriveState } = await import("../state.js");
|
|
36
274
|
return deriveState(basePath);
|
|
@@ -65,12 +303,76 @@ async function applyDisabledModelProviderPolicy(ctx: ExtensionContext): Promise<
|
|
|
65
303
|
}
|
|
66
304
|
}
|
|
67
305
|
|
|
68
|
-
|
|
69
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Bridge `context_management.compaction_threshold_percent` from GSD preferences
|
|
308
|
+
* into the agent's runtime compaction settings (#5475). The preference is
|
|
309
|
+
* validated to (0.5, 0.95) at load time, but defense-in-depth normalization
|
|
310
|
+
* here protects against a stale or hand-edited prefs file. Calling with
|
|
311
|
+
* `undefined` clears any prior override so a removed preference does not leak.
|
|
312
|
+
*/
|
|
313
|
+
async function applyCompactionThresholdOverride(ctx: ExtensionContext): Promise<void> {
|
|
314
|
+
try {
|
|
315
|
+
const { loadEffectiveGSDPreferences } = await import("../preferences.js");
|
|
316
|
+
const prefs = loadEffectiveGSDPreferences();
|
|
317
|
+
const raw = prefs?.preferences.context_management?.compaction_threshold_percent;
|
|
318
|
+
const value =
|
|
319
|
+
typeof raw === "number" && Number.isFinite(raw) && raw > 0 && raw < 1 ? raw : undefined;
|
|
320
|
+
ctx.setCompactionThresholdOverride(value);
|
|
321
|
+
} catch {
|
|
322
|
+
// Non-fatal: leave any existing override in place.
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function clearDeferredApprovalGate(basePath?: string): void {
|
|
327
|
+
if (!basePath || deferredApprovalGate?.basePath === basePath) {
|
|
328
|
+
deferredApprovalGate = null;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function deferApprovalGate(gateId: string, basePath: string): void {
|
|
333
|
+
deferredApprovalGate = { gateId, basePath };
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function contextBasePath(ctx?: { cwd?: string }): string {
|
|
337
|
+
return typeof ctx?.cwd === "string" ? ctx.cwd : process.cwd();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function activateDeferredApprovalGate(basePath: string): void {
|
|
341
|
+
if (deferredApprovalGate?.basePath !== basePath) return;
|
|
342
|
+
setPendingGate(deferredApprovalGate.gateId, basePath);
|
|
343
|
+
deferredApprovalGate = null;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function isContextDraftSummarySave(toolName: string, input: unknown): boolean {
|
|
347
|
+
if (toolName !== "gsd_summary_save" && toolName !== "summary_save") return false;
|
|
348
|
+
if (!input || typeof input !== "object") return false;
|
|
349
|
+
return (input as { artifact_type?: unknown }).artifact_type === "CONTEXT-DRAFT";
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function shouldBlockDeferredApprovalTool(
|
|
353
|
+
toolName: string,
|
|
354
|
+
input: unknown,
|
|
355
|
+
basePath: string,
|
|
356
|
+
): { block: boolean; reason?: string } {
|
|
357
|
+
if (deferredApprovalGate?.basePath !== basePath) return { block: false };
|
|
358
|
+
if (toolName === "ask_user_questions") return { block: false };
|
|
359
|
+
if (isContextDraftSummarySave(toolName, input)) return { block: false };
|
|
360
|
+
return {
|
|
361
|
+
block: true,
|
|
362
|
+
reason: [
|
|
363
|
+
`HARD BLOCK: Approval question "${deferredApprovalGate.gateId}" has been shown to the user.`,
|
|
364
|
+
`Only CONTEXT-DRAFT persistence may finish in this same assistant turn.`,
|
|
365
|
+
`Wait for the user's answer before calling additional tools.`,
|
|
366
|
+
].join(" "),
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export function resolveNotificationStoreBasePath(basePath: string): string {
|
|
371
|
+
return resolveWorktreeProjectRoot(basePath);
|
|
70
372
|
}
|
|
71
373
|
|
|
72
374
|
function initSessionNotifications(ctx: ExtensionContext): void {
|
|
73
|
-
initNotificationStore(resolveNotificationStoreBasePath());
|
|
375
|
+
initNotificationStore(resolveNotificationStoreBasePath(contextBasePath(ctx)));
|
|
74
376
|
installNotifyInterceptor(ctx);
|
|
75
377
|
initNotificationWidget(ctx);
|
|
76
378
|
}
|
|
@@ -112,52 +414,34 @@ export function registerHooks(
|
|
|
112
414
|
ecosystemHandlers: GSDEcosystemBeforeAgentStartHandler[],
|
|
113
415
|
): void {
|
|
114
416
|
pi.on("session_start", async (_event, ctx) => {
|
|
417
|
+
const basePath = contextBasePath(ctx);
|
|
115
418
|
initSessionNotifications(ctx);
|
|
116
419
|
if (!isAutoActive()) {
|
|
117
420
|
const { initHealthWidget } = await import("../health-widget.js");
|
|
118
421
|
initHealthWidget(ctx);
|
|
119
422
|
}
|
|
120
|
-
resetWriteGateState(
|
|
423
|
+
resetWriteGateState(basePath);
|
|
121
424
|
resetToolCallLoopGuard();
|
|
122
425
|
approvalQuestionAbortInFlight = false;
|
|
426
|
+
clearDeferredApprovalGate();
|
|
123
427
|
await resetAskUserQuestionsTurnCache();
|
|
124
428
|
await syncServiceTierStatus(ctx);
|
|
125
429
|
await applyDisabledModelProviderPolicy(ctx);
|
|
430
|
+
await applyCompactionThresholdOverride(ctx);
|
|
126
431
|
// Skip MCP auto-prep when running inside an auto-worktree (see session_switch below).
|
|
127
432
|
const { isInAutoWorktree } = await import("../auto-worktree.js");
|
|
128
|
-
if (!isInAutoWorktree(
|
|
433
|
+
if (!isInAutoWorktree(basePath)) {
|
|
129
434
|
const { prepareWorkflowMcpForProject } = await import("../workflow-mcp-auto-prep.js");
|
|
130
|
-
prepareWorkflowMcpForProject(ctx,
|
|
435
|
+
prepareWorkflowMcpForProject(ctx, basePath);
|
|
131
436
|
}
|
|
132
437
|
|
|
133
438
|
// Apply show_token_cost preference (#1515)
|
|
134
439
|
try {
|
|
135
440
|
const { loadEffectiveGSDPreferences } = await import("../preferences.js");
|
|
136
|
-
const prefs = loadEffectiveGSDPreferences();
|
|
441
|
+
const prefs = loadEffectiveGSDPreferences(basePath);
|
|
137
442
|
process.env.GSD_SHOW_TOKEN_COST = prefs?.preferences.show_token_cost ? "1" : "";
|
|
138
443
|
} catch { /* non-fatal */ }
|
|
139
|
-
|
|
140
|
-
isFirstSession = false;
|
|
141
|
-
} else {
|
|
142
|
-
try {
|
|
143
|
-
const gsdBinPath = process.env.GSD_BIN_PATH;
|
|
144
|
-
if (gsdBinPath) {
|
|
145
|
-
const { dirname } = await import("node:path");
|
|
146
|
-
const { printWelcomeScreen } = await import(
|
|
147
|
-
join(dirname(gsdBinPath), "welcome-screen.js")
|
|
148
|
-
) as { printWelcomeScreen: (opts: { version: string; modelName?: string; provider?: string; remoteChannel?: string }) => void };
|
|
149
|
-
|
|
150
|
-
let remoteChannel: string | undefined;
|
|
151
|
-
try {
|
|
152
|
-
const { resolveRemoteConfig } = await import("../../remote-questions/config.js");
|
|
153
|
-
const rc = resolveRemoteConfig();
|
|
154
|
-
if (rc) remoteChannel = rc.channel;
|
|
155
|
-
} catch { /* non-fatal */ }
|
|
156
|
-
|
|
157
|
-
printWelcomeScreen({ version: process.env.GSD_VERSION || "0.0.0", remoteChannel });
|
|
158
|
-
}
|
|
159
|
-
} catch { /* non-fatal */ }
|
|
160
|
-
}
|
|
444
|
+
await installWelcomeHeader(ctx);
|
|
161
445
|
await loadToolApiKeysForSession();
|
|
162
446
|
if (isAutoActive()) {
|
|
163
447
|
ctx.ui.setWidget("gsd-health", undefined);
|
|
@@ -165,21 +449,24 @@ export function registerHooks(
|
|
|
165
449
|
});
|
|
166
450
|
|
|
167
451
|
pi.on("session_switch", async (_event, ctx) => {
|
|
452
|
+
const basePath = contextBasePath(ctx);
|
|
168
453
|
initSessionNotifications(ctx);
|
|
169
|
-
resetWriteGateState(
|
|
454
|
+
resetWriteGateState(basePath);
|
|
170
455
|
resetToolCallLoopGuard();
|
|
456
|
+
clearDeferredApprovalGate();
|
|
171
457
|
await resetAskUserQuestionsTurnCache();
|
|
172
|
-
clearDiscussionFlowState(
|
|
458
|
+
clearDiscussionFlowState(basePath);
|
|
173
459
|
await syncServiceTierStatus(ctx);
|
|
174
460
|
await applyDisabledModelProviderPolicy(ctx);
|
|
461
|
+
await applyCompactionThresholdOverride(ctx);
|
|
175
462
|
// Skip MCP auto-prep when running inside an auto-worktree. The worktree
|
|
176
463
|
// already has .mcp.json from createAutoWorktree, and re-running the writer
|
|
177
464
|
// post-chdir rewrites the file mid-run (non-idempotent due to cwd-relative
|
|
178
465
|
// CLI path resolution), dirtying the tree and breaking the milestone merge.
|
|
179
466
|
const { isInAutoWorktree } = await import("../auto-worktree.js");
|
|
180
|
-
if (!isInAutoWorktree(
|
|
467
|
+
if (!isInAutoWorktree(basePath)) {
|
|
181
468
|
const { prepareWorkflowMcpForProject } = await import("../workflow-mcp-auto-prep.js");
|
|
182
|
-
prepareWorkflowMcpForProject(ctx,
|
|
469
|
+
prepareWorkflowMcpForProject(ctx, basePath);
|
|
183
470
|
}
|
|
184
471
|
await loadToolApiKeysForSession();
|
|
185
472
|
if (!isAutoActive()) {
|
|
@@ -191,11 +478,13 @@ export function registerHooks(
|
|
|
191
478
|
});
|
|
192
479
|
|
|
193
480
|
pi.on("before_agent_start", async (event, ctx: ExtensionContext) => {
|
|
481
|
+
applyMinimalGsdToolSurface(pi);
|
|
482
|
+
|
|
194
483
|
// Wait for ecosystem loader to finish (no-op after first turn).
|
|
195
484
|
const { getEcosystemReadyPromise } = await import("../ecosystem/loader.js");
|
|
196
485
|
await getEcosystemReadyPromise();
|
|
197
486
|
|
|
198
|
-
const beforeAgentBasePath =
|
|
487
|
+
const beforeAgentBasePath = contextBasePath(ctx);
|
|
199
488
|
const pendingApprovalGate = getPendingGate(beforeAgentBasePath);
|
|
200
489
|
if (pendingApprovalGate && isExplicitApprovalResponse(event.prompt, pendingApprovalGate)) {
|
|
201
490
|
markApprovalGateVerified(pendingApprovalGate, beforeAgentBasePath);
|
|
@@ -203,6 +492,7 @@ export function registerHooks(
|
|
|
203
492
|
if (milestoneId) markDepthVerified(milestoneId, beforeAgentBasePath);
|
|
204
493
|
clearPendingGate(beforeAgentBasePath);
|
|
205
494
|
}
|
|
495
|
+
clearDeferredApprovalGate(beforeAgentBasePath);
|
|
206
496
|
|
|
207
497
|
// GSD's own context injection (existing behavior — unchanged).
|
|
208
498
|
const { buildBeforeAgentStartResult } = await import("./system-context.js");
|
|
@@ -211,7 +501,7 @@ export function registerHooks(
|
|
|
211
501
|
// Refresh the snapshot used by ecosystem getPhase()/getActiveUnit().
|
|
212
502
|
// deriveState has its own ~100ms cache so this is cheap on repeat calls.
|
|
213
503
|
try {
|
|
214
|
-
const state = await deriveGsdState(
|
|
504
|
+
const state = await deriveGsdState(beforeAgentBasePath);
|
|
215
505
|
updateSnapshot(state);
|
|
216
506
|
} catch {
|
|
217
507
|
updateSnapshot(null);
|
|
@@ -253,7 +543,11 @@ export function registerHooks(
|
|
|
253
543
|
resetToolCallLoopGuard();
|
|
254
544
|
await resetAskUserQuestionsTurnCache();
|
|
255
545
|
const { handleAgentEnd } = await import("./agent-end-recovery.js");
|
|
256
|
-
|
|
546
|
+
try {
|
|
547
|
+
await handleAgentEnd(pi, event, ctx);
|
|
548
|
+
} finally {
|
|
549
|
+
activateDeferredApprovalGate(contextBasePath(ctx));
|
|
550
|
+
}
|
|
257
551
|
});
|
|
258
552
|
|
|
259
553
|
// Squash-merge quick-task branch back to the original branch after the
|
|
@@ -268,8 +562,8 @@ export function registerHooks(
|
|
|
268
562
|
}
|
|
269
563
|
});
|
|
270
564
|
|
|
271
|
-
pi.on("session_before_compact", async () => {
|
|
272
|
-
const basePath =
|
|
565
|
+
pi.on("session_before_compact", async (_event, ctx) => {
|
|
566
|
+
const basePath = contextBasePath(ctx);
|
|
273
567
|
// Context Mode is default-on. Write the resumable snapshot before any
|
|
274
568
|
// active-auto cancel return so auto sessions still leave re-entry context.
|
|
275
569
|
await writeContextModeCompactionSnapshot(basePath);
|
|
@@ -336,7 +630,7 @@ export function registerHooks(
|
|
|
336
630
|
if (!unitType) {
|
|
337
631
|
try {
|
|
338
632
|
const { getPendingDeepProjectSetupUnitForContext } = await import("../guided-flow.js");
|
|
339
|
-
const pending = getPendingDeepProjectSetupUnitForContext(ctx,
|
|
633
|
+
const pending = getPendingDeepProjectSetupUnitForContext(ctx, contextBasePath(ctx));
|
|
340
634
|
unitType = pending?.unitType;
|
|
341
635
|
unitId = pending?.unitId;
|
|
342
636
|
} catch {
|
|
@@ -345,7 +639,7 @@ export function registerHooks(
|
|
|
345
639
|
}
|
|
346
640
|
|
|
347
641
|
if (!unitType) {
|
|
348
|
-
const milestoneId = await getDiscussionMilestoneIdFor(
|
|
642
|
+
const milestoneId = await getDiscussionMilestoneIdFor(contextBasePath(ctx));
|
|
349
643
|
if (milestoneId) {
|
|
350
644
|
unitType = "discuss-milestone";
|
|
351
645
|
unitId = milestoneId;
|
|
@@ -355,15 +649,16 @@ export function registerHooks(
|
|
|
355
649
|
if (!shouldPauseForUserApprovalQuestion(unitType, [event.message])) return;
|
|
356
650
|
|
|
357
651
|
const gateId = approvalGateIdForUnit(unitType, unitId);
|
|
358
|
-
if (gateId)
|
|
652
|
+
if (gateId) deferApprovalGate(gateId, contextBasePath(ctx));
|
|
359
653
|
|
|
360
654
|
approvalQuestionAbortInFlight = true;
|
|
361
655
|
ctx.ui.notify(
|
|
362
656
|
`${unitType}${unitId ? ` ${unitId}` : ""} is waiting for your approval - pausing before more tool calls run.`,
|
|
363
657
|
"info",
|
|
364
658
|
);
|
|
365
|
-
// The pending gate
|
|
366
|
-
//
|
|
659
|
+
// The durable pending gate is activated at agent_end so same-turn
|
|
660
|
+
// CONTEXT-DRAFT persistence can finish after the text boundary streams.
|
|
661
|
+
// The tool_call hook below still blocks non-draft tools in this turn.
|
|
367
662
|
// Aborting mid-stream eats the model's question text on external CLI
|
|
368
663
|
// providers (Claude Code SDK) because lastTextContent isn't populated
|
|
369
664
|
// from in-flight builder state — the user only ever sees "Claude Code
|
|
@@ -374,7 +669,7 @@ export function registerHooks(
|
|
|
374
669
|
const { isParallelActive, shutdownParallel } = await import("../parallel-orchestrator.js");
|
|
375
670
|
if (isParallelActive()) {
|
|
376
671
|
try {
|
|
377
|
-
await shutdownParallel(
|
|
672
|
+
await shutdownParallel(contextBasePath(ctx));
|
|
378
673
|
} catch {
|
|
379
674
|
// best-effort
|
|
380
675
|
}
|
|
@@ -386,8 +681,8 @@ export function registerHooks(
|
|
|
386
681
|
}
|
|
387
682
|
});
|
|
388
683
|
|
|
389
|
-
pi.on("tool_call", async (event) => {
|
|
390
|
-
const discussionBasePath =
|
|
684
|
+
pi.on("tool_call", async (event, ctx) => {
|
|
685
|
+
const discussionBasePath = contextBasePath(ctx);
|
|
391
686
|
const toolName = canonicalToolName(event.toolName);
|
|
392
687
|
// ── Loop guard: block repeated identical tool calls ──
|
|
393
688
|
const loopCheck = checkToolCallLoop(toolName, event.input as Record<string, unknown>);
|
|
@@ -395,6 +690,13 @@ export function registerHooks(
|
|
|
395
690
|
return { block: true, reason: loopCheck.reason };
|
|
396
691
|
}
|
|
397
692
|
|
|
693
|
+
const deferredGateGuard = shouldBlockDeferredApprovalTool(
|
|
694
|
+
toolName,
|
|
695
|
+
event.input,
|
|
696
|
+
discussionBasePath,
|
|
697
|
+
);
|
|
698
|
+
if (deferredGateGuard.block) return deferredGateGuard;
|
|
699
|
+
|
|
398
700
|
// ── Discussion gate enforcement: track pending gate questions ─────────
|
|
399
701
|
// Only gate-shaped ask_user_questions calls should block execution.
|
|
400
702
|
// The gate stays pending until the user selects the approval option.
|
|
@@ -482,6 +784,22 @@ export function registerHooks(
|
|
|
482
784
|
}
|
|
483
785
|
}
|
|
484
786
|
|
|
787
|
+
// ── Worktree-isolation write gate (#5199) ────────────────────────────
|
|
788
|
+
// Block planning-write tools from landing code at the project root when
|
|
789
|
+
// git.isolation=worktree but auto-mode hasn't created the milestone
|
|
790
|
+
// worktree yet. Without this, writes silently orphan outside git history.
|
|
791
|
+
if (isToolCallEventType("write", event) || isToolCallEventType("edit", event)) {
|
|
792
|
+
const wtBasePath = resolveWorktreeProjectRoot(dash.basePath ?? discussionBasePath);
|
|
793
|
+
const wtGuard = shouldBlockWorktreeWrite(
|
|
794
|
+
event.toolName,
|
|
795
|
+
event.input.path,
|
|
796
|
+
wtBasePath,
|
|
797
|
+
isAutoActive(),
|
|
798
|
+
dash.currentUnit?.type,
|
|
799
|
+
);
|
|
800
|
+
if (wtGuard.block) return wtGuard;
|
|
801
|
+
}
|
|
802
|
+
|
|
485
803
|
// ── Single-writer engine: block direct writes to STATE.md ──────────
|
|
486
804
|
// Covers write, edit, and bash tools to prevent bypass vectors.
|
|
487
805
|
if (isToolCallEventType("write", event)) {
|
|
@@ -548,7 +866,7 @@ export function registerHooks(
|
|
|
548
866
|
}
|
|
549
867
|
});
|
|
550
868
|
|
|
551
|
-
pi.on("tool_result", async (event) => {
|
|
869
|
+
pi.on("tool_result", async (event, ctx) => {
|
|
552
870
|
if (isAutoActive() && typeof event.toolCallId === "string") {
|
|
553
871
|
markToolEnd(event.toolCallId);
|
|
554
872
|
}
|
|
@@ -567,7 +885,7 @@ export function registerHooks(
|
|
|
567
885
|
}
|
|
568
886
|
const toolName = canonicalToolName(event.toolName);
|
|
569
887
|
if (toolName !== "ask_user_questions") return;
|
|
570
|
-
const basePath =
|
|
888
|
+
const basePath = contextBasePath(ctx);
|
|
571
889
|
const milestoneId = await getDiscussionMilestoneIdFor(basePath);
|
|
572
890
|
const queueActive = isQueuePhaseActive(basePath);
|
|
573
891
|
|
|
@@ -773,8 +1091,21 @@ export function registerHooks(
|
|
|
773
1091
|
// Tool set adaptation hook (ADR-005 Phase 4)
|
|
774
1092
|
// Extensions can override tool set after model selection by returning { toolNames: [...] }
|
|
775
1093
|
// Return undefined to let the built-in provider compatibility filtering proceed.
|
|
776
|
-
pi.on("adjust_tool_set", async (
|
|
777
|
-
|
|
1094
|
+
pi.on("adjust_tool_set", async (event) => {
|
|
1095
|
+
if (isFullGsdToolSurfaceRequested()) return undefined;
|
|
1096
|
+
const removed = new Set(event.filteredTools);
|
|
1097
|
+
const providerCompatible = event.activeToolNames.filter((name) => !removed.has(name));
|
|
1098
|
+
const requestScoped = buildRequestScopedGsdToolSet(providerCompatible, event.requestCustomMessages);
|
|
1099
|
+
if (requestScoped) {
|
|
1100
|
+
return { toolNames: requestScoped };
|
|
1101
|
+
}
|
|
1102
|
+
const dash = getAutoRuntimeSnapshot();
|
|
1103
|
+
if (dash.active && dash.currentUnit) {
|
|
1104
|
+
return { toolNames: buildMinimalAutoGsdToolSet(providerCompatible, dash.currentUnit.type) };
|
|
1105
|
+
}
|
|
1106
|
+
if (isGeneralGsdToolScopingRequested()) {
|
|
1107
|
+
return { toolNames: buildMinimalGsdToolSet(providerCompatible) };
|
|
1108
|
+
}
|
|
778
1109
|
return undefined;
|
|
779
1110
|
});
|
|
780
1111
|
}
|