gsd-pi 2.33.1 → 2.34.0-dev.6769913
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/dist/bundled-resource-path.d.ts +8 -0
- package/dist/bundled-resource-path.js +14 -0
- package/dist/cli.js +16 -0
- package/dist/headless-query.js +6 -6
- package/dist/resource-loader.d.ts +2 -0
- package/dist/resource-loader.js +39 -4
- package/dist/resources/extensions/ask-user-questions.js +217 -0
- package/dist/resources/extensions/async-jobs/async-bash-tool.js +180 -0
- package/dist/resources/extensions/async-jobs/await-tool.js +90 -0
- package/dist/resources/extensions/async-jobs/cancel-job-tool.js +28 -0
- package/dist/resources/extensions/async-jobs/index.js +119 -0
- package/dist/resources/extensions/async-jobs/job-manager.js +159 -0
- package/dist/resources/extensions/aws-auth/index.js +138 -0
- package/dist/resources/extensions/bg-shell/bg-shell-command.js +182 -0
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.js +343 -0
- package/dist/resources/extensions/bg-shell/bg-shell-tool.js +831 -0
- package/dist/resources/extensions/bg-shell/index.js +41 -0
- package/dist/resources/extensions/bg-shell/interaction.js +160 -0
- package/dist/resources/extensions/bg-shell/output-formatter.js +245 -0
- package/dist/resources/extensions/bg-shell/overlay.js +378 -0
- package/dist/resources/extensions/bg-shell/process-manager.js +413 -0
- package/dist/resources/extensions/bg-shell/readiness-detector.js +109 -0
- package/dist/resources/extensions/bg-shell/types.js +96 -0
- package/dist/resources/extensions/bg-shell/utilities.js +50 -0
- package/dist/resources/extensions/browser-tools/capture.js +179 -0
- package/dist/resources/extensions/browser-tools/core.js +899 -0
- package/dist/resources/extensions/browser-tools/{evaluate-helpers.ts → evaluate-helpers.js} +0 -1
- package/dist/resources/extensions/browser-tools/index.js +123 -0
- package/dist/resources/extensions/browser-tools/lifecycle.js +222 -0
- package/dist/resources/extensions/browser-tools/refs.js +254 -0
- package/dist/resources/extensions/browser-tools/settle.js +173 -0
- package/dist/resources/extensions/browser-tools/state.js +126 -0
- package/dist/resources/extensions/browser-tools/tools/action-cache.js +179 -0
- package/dist/resources/extensions/browser-tools/tools/assertions.js +320 -0
- package/dist/resources/extensions/browser-tools/tools/codegen.js +242 -0
- package/dist/resources/extensions/browser-tools/tools/device.js +162 -0
- package/dist/resources/extensions/browser-tools/tools/extract.js +191 -0
- package/dist/resources/extensions/browser-tools/tools/forms.js +710 -0
- package/dist/resources/extensions/browser-tools/tools/injection-detect.js +178 -0
- package/dist/resources/extensions/browser-tools/tools/inspection.js +426 -0
- package/dist/resources/extensions/browser-tools/tools/intent.js +556 -0
- package/dist/resources/extensions/browser-tools/tools/interaction.js +776 -0
- package/dist/resources/extensions/browser-tools/tools/navigation.js +208 -0
- package/dist/resources/extensions/browser-tools/tools/network-mock.js +194 -0
- package/dist/resources/extensions/browser-tools/tools/pages.js +280 -0
- package/dist/resources/extensions/browser-tools/tools/pdf.js +74 -0
- package/dist/resources/extensions/browser-tools/tools/refs.js +485 -0
- package/dist/resources/extensions/browser-tools/tools/screenshot.js +87 -0
- package/dist/resources/extensions/browser-tools/tools/session.js +375 -0
- package/dist/resources/extensions/browser-tools/tools/state-persistence.js +180 -0
- package/dist/resources/extensions/browser-tools/tools/visual-diff.js +174 -0
- package/dist/resources/extensions/browser-tools/tools/wait.js +201 -0
- package/dist/resources/extensions/browser-tools/tools/zoom.js +90 -0
- package/dist/resources/extensions/browser-tools/utils.js +490 -0
- package/dist/resources/extensions/context7/index.js +337 -0
- package/dist/resources/extensions/get-secrets-from-user.js +492 -0
- package/dist/resources/extensions/google-search/index.js +373 -0
- package/dist/resources/extensions/gsd/activity-log.js +146 -0
- package/dist/resources/extensions/gsd/atomic-write.js +38 -0
- package/dist/resources/extensions/gsd/auto/session.js +182 -0
- package/dist/resources/extensions/gsd/auto-budget.js +30 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +429 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +185 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +353 -0
- package/dist/resources/extensions/gsd/auto-loop.js +956 -0
- package/dist/resources/extensions/gsd/auto-model-selection.js +133 -0
- package/dist/resources/extensions/gsd/auto-observability.js +56 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +385 -0
- package/dist/resources/extensions/gsd/auto-prompts.js +1153 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +512 -0
- package/dist/resources/extensions/gsd/auto-start.js +414 -0
- package/dist/resources/extensions/gsd/auto-supervisor.js +47 -0
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +183 -0
- package/dist/resources/extensions/gsd/auto-timers.js +180 -0
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +50 -0
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +30 -0
- package/dist/resources/extensions/gsd/auto-verification.js +171 -0
- package/dist/resources/extensions/gsd/auto-worktree-sync.js +167 -0
- package/dist/resources/extensions/gsd/auto-worktree.js +830 -0
- package/dist/resources/extensions/gsd/auto.js +765 -0
- package/dist/resources/extensions/gsd/{cache.ts → cache.js} +5 -7
- package/dist/resources/extensions/gsd/captures.js +354 -0
- package/dist/resources/extensions/gsd/changelog.js +162 -0
- package/dist/resources/extensions/gsd/claude-import.js +540 -0
- package/dist/resources/extensions/gsd/collision-diagnostics.js +226 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +224 -0
- package/dist/resources/extensions/gsd/commands-config.js +89 -0
- package/dist/resources/extensions/gsd/commands-extensions.js +259 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +310 -0
- package/dist/resources/extensions/gsd/commands-inspect.js +70 -0
- package/dist/resources/extensions/gsd/commands-logs.js +468 -0
- package/dist/resources/extensions/gsd/commands-maintenance.js +185 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +660 -0
- package/dist/resources/extensions/gsd/commands-workflow-templates.js +408 -0
- package/dist/resources/extensions/gsd/commands.js +1031 -0
- package/dist/resources/extensions/gsd/complexity-classifier.js +257 -0
- package/dist/resources/extensions/gsd/{constants.ts → constants.js} +0 -6
- package/dist/resources/extensions/gsd/context-budget.js +187 -0
- package/dist/resources/extensions/gsd/context-store.js +165 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +110 -0
- package/dist/resources/extensions/gsd/dashboard-overlay.js +562 -0
- package/dist/resources/extensions/gsd/db-writer.js +298 -0
- package/dist/resources/extensions/gsd/debug-logger.js +161 -0
- package/dist/resources/extensions/gsd/detection.js +373 -0
- package/dist/resources/extensions/gsd/diff-context.js +168 -0
- package/dist/resources/extensions/gsd/dispatch-guard.js +75 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +25 -18
- package/dist/resources/extensions/gsd/doctor-checks.js +562 -0
- package/dist/resources/extensions/gsd/doctor-environment.js +429 -0
- package/dist/resources/extensions/gsd/doctor-format.js +71 -0
- package/dist/resources/extensions/gsd/doctor-proactive.js +239 -0
- package/dist/resources/extensions/gsd/doctor-providers.js +292 -0
- package/dist/resources/extensions/gsd/doctor-types.js +12 -0
- package/dist/resources/extensions/gsd/doctor.js +672 -0
- package/dist/resources/extensions/gsd/error-utils.js +6 -0
- package/dist/resources/extensions/gsd/{errors.ts → errors.js} +6 -11
- package/dist/resources/extensions/gsd/exit-command.js +11 -0
- package/dist/resources/extensions/gsd/{export-html.ts → export-html.js} +482 -614
- package/dist/resources/extensions/gsd/export.js +268 -0
- package/dist/resources/extensions/gsd/file-watcher.js +76 -0
- package/dist/resources/extensions/gsd/files.js +937 -0
- package/dist/resources/extensions/gsd/forensics.js +511 -0
- package/dist/resources/extensions/gsd/{git-constants.ts → git-constants.js} +4 -5
- package/dist/resources/extensions/gsd/git-self-heal.js +113 -0
- package/dist/resources/extensions/gsd/git-service.js +460 -0
- package/dist/resources/extensions/gsd/{gitignore.ts → gitignore.js} +98 -125
- package/dist/resources/extensions/gsd/gsd-db.js +735 -0
- package/dist/resources/extensions/gsd/guided-flow-queue.js +366 -0
- package/dist/resources/extensions/gsd/guided-flow.js +1158 -0
- package/dist/resources/extensions/gsd/health-widget.js +141 -0
- package/dist/resources/extensions/gsd/history.js +118 -0
- package/dist/resources/extensions/gsd/index.js +1114 -0
- package/dist/resources/extensions/gsd/init-wizard.js +479 -0
- package/dist/resources/extensions/gsd/json-persistence.js +62 -0
- package/dist/resources/extensions/gsd/{jsonl-utils.ts → jsonl-utils.js} +10 -7
- package/dist/resources/extensions/gsd/key-manager.js +829 -0
- package/dist/resources/extensions/gsd/marketplace-discovery.js +356 -0
- package/dist/resources/extensions/gsd/md-importer.js +440 -0
- package/dist/resources/extensions/gsd/memory-extractor.js +295 -0
- package/dist/resources/extensions/gsd/memory-store.js +351 -0
- package/dist/resources/extensions/gsd/metrics.js +377 -0
- package/dist/resources/extensions/gsd/migrate/command.js +157 -0
- package/dist/resources/extensions/gsd/migrate/index.js +7 -0
- package/dist/resources/extensions/gsd/migrate/parser.js +268 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +477 -0
- package/dist/resources/extensions/gsd/migrate/preview.js +47 -0
- package/dist/resources/extensions/gsd/migrate/transformer.js +278 -0
- package/dist/resources/extensions/gsd/migrate/types.js +4 -0
- package/dist/resources/extensions/gsd/migrate/validator.js +41 -0
- package/dist/resources/extensions/gsd/migrate/writer.js +477 -0
- package/dist/resources/extensions/gsd/migrate-external.js +130 -0
- package/dist/resources/extensions/gsd/milestone-actions.js +111 -0
- package/dist/resources/extensions/gsd/{milestone-ids.ts → milestone-ids.js} +50 -63
- package/dist/resources/extensions/gsd/model-cost-table.js +48 -0
- package/dist/resources/extensions/gsd/model-router.js +187 -0
- package/dist/resources/extensions/gsd/namespaced-registry.js +322 -0
- package/dist/resources/extensions/gsd/namespaced-resolver.js +176 -0
- package/dist/resources/extensions/gsd/native-git-bridge.js +842 -0
- package/dist/resources/extensions/gsd/native-parser-bridge.js +156 -0
- package/dist/resources/extensions/gsd/notifications.js +58 -0
- package/dist/resources/extensions/gsd/observability-validator.js +398 -0
- package/dist/resources/extensions/gsd/parallel-eligibility.js +182 -0
- package/dist/resources/extensions/gsd/parallel-merge.js +121 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +687 -0
- package/dist/resources/extensions/gsd/paths.js +414 -0
- package/dist/resources/extensions/gsd/plugin-importer.js +254 -0
- package/dist/resources/extensions/gsd/post-unit-hooks.js +433 -0
- package/dist/resources/extensions/gsd/preferences-models.js +294 -0
- package/dist/resources/extensions/gsd/preferences-skills.js +154 -0
- package/dist/resources/extensions/gsd/preferences-types.js +73 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +607 -0
- package/dist/resources/extensions/gsd/preferences.js +325 -0
- package/dist/resources/extensions/gsd/progress-score.js +102 -0
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.js +150 -0
- package/dist/resources/extensions/gsd/prompt-compressor.js +393 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +119 -0
- package/dist/resources/extensions/gsd/prompt-ordering.js +170 -0
- package/dist/resources/extensions/gsd/provider-error-pause.js +60 -0
- package/dist/resources/extensions/gsd/queue-order.js +178 -0
- package/dist/resources/extensions/gsd/queue-reorder-ui.js +234 -0
- package/dist/resources/extensions/gsd/quick.js +206 -0
- package/dist/resources/extensions/gsd/repo-identity.js +187 -0
- package/dist/resources/extensions/gsd/{reports.ts → reports.js} +146 -241
- package/dist/resources/extensions/gsd/{resource-version.ts → resource-version.js} +50 -53
- package/dist/resources/extensions/gsd/roadmap-slices.js +130 -0
- package/dist/resources/extensions/gsd/routing-history.js +210 -0
- package/dist/resources/extensions/gsd/safe-fs.js +52 -0
- package/dist/resources/extensions/gsd/semantic-chunker.js +254 -0
- package/dist/resources/extensions/gsd/session-forensics.js +427 -0
- package/dist/resources/extensions/gsd/session-lock.js +397 -0
- package/dist/resources/extensions/gsd/session-status-io.js +134 -0
- package/dist/resources/extensions/gsd/skill-discovery.js +121 -0
- package/dist/resources/extensions/gsd/skill-health.js +324 -0
- package/dist/resources/extensions/gsd/{skill-telemetry.ts → skill-telemetry.js} +58 -74
- package/dist/resources/extensions/gsd/state.js +653 -0
- package/dist/resources/extensions/gsd/structured-data-formatter.js +97 -0
- package/dist/resources/extensions/gsd/summary-distiller.js +212 -0
- package/dist/resources/extensions/gsd/templates/preferences.md +1 -0
- package/dist/resources/extensions/gsd/token-counter.js +54 -0
- package/dist/resources/extensions/gsd/triage-resolution.js +217 -0
- package/dist/resources/extensions/gsd/triage-ui.js +125 -0
- package/dist/resources/extensions/gsd/types.js +4 -0
- package/dist/resources/extensions/gsd/undo.js +205 -0
- package/dist/resources/extensions/gsd/unit-id.js +7 -0
- package/dist/resources/extensions/gsd/unit-runtime.js +131 -0
- package/dist/resources/extensions/gsd/validate-directory.js +143 -0
- package/dist/resources/extensions/gsd/verification-evidence.js +122 -0
- package/dist/resources/extensions/gsd/verification-gate.js +514 -0
- package/dist/resources/extensions/gsd/visualizer-data.js +612 -0
- package/dist/resources/extensions/gsd/visualizer-overlay.js +501 -0
- package/dist/resources/extensions/gsd/visualizer-views.js +893 -0
- package/dist/resources/extensions/gsd/workflow-templates.js +188 -0
- package/dist/resources/extensions/gsd/workspace-index.js +139 -0
- package/dist/resources/extensions/gsd/worktree-command-bootstrap.js +40 -0
- package/dist/resources/extensions/gsd/worktree-command.js +682 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +358 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +344 -0
- package/dist/resources/extensions/gsd/worktree.js +199 -0
- package/dist/resources/extensions/mac-tools/index.js +768 -0
- package/dist/resources/extensions/mcp-client/index.js +364 -0
- package/dist/resources/extensions/package.json +3 -0
- package/dist/resources/extensions/remote-questions/config.js +70 -0
- package/dist/resources/extensions/remote-questions/discord-adapter.js +134 -0
- package/dist/resources/extensions/remote-questions/format.js +234 -0
- package/dist/resources/extensions/remote-questions/http-client.js +43 -0
- package/dist/resources/extensions/remote-questions/manager.js +156 -0
- package/dist/resources/extensions/remote-questions/{mod.ts → mod.js} +1 -10
- package/dist/resources/extensions/remote-questions/notify.js +89 -0
- package/dist/resources/extensions/remote-questions/remote-command.js +453 -0
- package/dist/resources/extensions/remote-questions/slack-adapter.js +123 -0
- package/dist/resources/extensions/remote-questions/status.js +25 -0
- package/dist/resources/extensions/remote-questions/store.js +70 -0
- package/dist/resources/extensions/remote-questions/telegram-adapter.js +123 -0
- package/dist/resources/extensions/remote-questions/types.js +5 -0
- package/dist/resources/extensions/search-the-web/cache.js +74 -0
- package/dist/resources/extensions/search-the-web/command-search-provider.js +79 -0
- package/dist/resources/extensions/search-the-web/format.js +161 -0
- package/dist/resources/extensions/search-the-web/http.js +178 -0
- package/dist/resources/extensions/search-the-web/index.js +41 -0
- package/dist/resources/extensions/search-the-web/native-search.js +166 -0
- package/dist/resources/extensions/search-the-web/provider.js +143 -0
- package/dist/resources/extensions/search-the-web/tavily.js +82 -0
- package/dist/resources/extensions/search-the-web/tool-fetch-page.js +452 -0
- package/dist/resources/extensions/search-the-web/tool-llm-context.js +455 -0
- package/dist/resources/extensions/search-the-web/tool-search.js +482 -0
- package/dist/resources/extensions/search-the-web/url-utils.js +121 -0
- package/dist/resources/extensions/shared/confirm-ui.js +96 -0
- package/dist/resources/extensions/shared/{format-utils.ts → format-utils.js} +85 -91
- package/dist/resources/extensions/shared/frontmatter.js +109 -0
- package/dist/resources/extensions/shared/interview-ui.js +569 -0
- package/dist/resources/extensions/shared/{mod.ts → mod.js} +2 -24
- package/dist/resources/extensions/shared/next-action-ui.js +168 -0
- package/dist/resources/extensions/shared/{path-display.ts → path-display.js} +2 -3
- package/dist/resources/extensions/shared/sanitize.js +17 -0
- package/dist/resources/extensions/shared/terminal.js +21 -0
- package/dist/resources/extensions/shared/ui.js +245 -0
- package/dist/resources/extensions/shared/wizard-ui.js +478 -0
- package/dist/resources/extensions/slash-commands/audit.js +72 -0
- package/dist/resources/extensions/slash-commands/clear.js +8 -0
- package/dist/resources/extensions/slash-commands/create-extension.js +264 -0
- package/dist/resources/extensions/slash-commands/create-slash-command.js +208 -0
- package/dist/resources/extensions/slash-commands/index.js +10 -0
- package/dist/resources/extensions/subagent/agents.js +103 -0
- package/dist/resources/extensions/subagent/index.js +905 -0
- package/dist/resources/extensions/subagent/isolation.js +384 -0
- package/dist/resources/extensions/subagent/worker-registry.js +73 -0
- package/dist/resources/extensions/ttsr/index.js +144 -0
- package/dist/resources/extensions/ttsr/rule-loader.js +70 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.js +380 -0
- package/dist/resources/extensions/universal-config/discovery.js +94 -0
- package/dist/resources/extensions/universal-config/format.js +178 -0
- package/dist/resources/extensions/universal-config/index.js +99 -0
- package/dist/resources/extensions/universal-config/scanners.js +574 -0
- package/dist/resources/extensions/universal-config/tools.js +57 -0
- package/dist/resources/extensions/universal-config/types.js +8 -0
- package/dist/resources/extensions/voice/index.js +247 -0
- package/dist/startup-timings.d.ts +2 -0
- package/dist/startup-timings.js +22 -0
- package/dist/tool-bootstrap.js +59 -11
- package/dist/worktree-cli.js +7 -7
- package/package.json +1 -1
- package/packages/native/dist/native.d.ts +0 -2
- package/packages/native/dist/native.js +0 -2
- package/packages/native/src/native.ts +0 -3
- package/packages/pi-agent-core/dist/agent-loop.d.ts +14 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +24 -27
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +1 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +11 -22
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/proxy.d.ts +1 -25
- package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/proxy.js +1 -1
- package/packages/pi-agent-core/dist/proxy.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +30 -27
- package/packages/pi-agent-core/src/agent.ts +12 -23
- package/packages/pi-agent-core/src/proxy.ts +1 -1
- package/packages/pi-ai/dist/api-registry.d.ts +0 -2
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
- package/packages/pi-ai/dist/api-registry.js +0 -10
- package/packages/pi-ai/dist/api-registry.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +0 -8
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +0 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +1 -43
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +2 -2
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +0 -4
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.d.ts +0 -1
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.d.ts +0 -2
- package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.js +0 -4
- package/packages/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.d.ts +0 -4
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.js +0 -6
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
- package/packages/pi-ai/dist/utils/validation.d.ts +0 -8
- package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/validation.js +0 -14
- package/packages/pi-ai/dist/utils/validation.js.map +1 -1
- package/packages/pi-ai/src/api-registry.ts +0 -12
- package/packages/pi-ai/src/providers/anthropic.ts +1 -1
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +2 -2
- package/packages/pi-ai/src/providers/google-shared.ts +1 -1
- package/packages/pi-ai/src/providers/register-builtins.ts +1 -1
- package/packages/pi-ai/src/utils/event-stream.ts +0 -5
- package/packages/pi-ai/src/utils/overflow.ts +1 -8
- package/packages/pi-ai/src/utils/validation.ts +0 -15
- package/packages/pi-coding-agent/dist/config.d.ts +0 -9
- package/packages/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/config.js +4 -8
- package/packages/pi-coding-agent/dist/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +4 -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 +24 -5
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +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 +31 -4
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +0 -13
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.js +2 -2
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -62
- package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +0 -2
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +0 -7
- package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts +1 -6
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.js +1 -28
- package/packages/pi-coding-agent/dist/core/lsp/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +5 -5
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +0 -3
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -3
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +1 -26
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -59
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.js +2 -2
- package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +0 -4
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +2 -4
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +8 -12
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +78 -168
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.d.ts +0 -16
- package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.js +2 -2
- package/packages/pi-coding-agent/dist/migrations.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -24
- 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 +50 -512
- 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 +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +514 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +65 -4
- 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 +6 -23
- 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 +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +175 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts +0 -4
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/photon.d.ts +0 -19
- package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/photon.js +1 -120
- package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/config.ts +5 -10
- package/packages/pi-coding-agent/src/core/agent-session.ts +26 -5
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
- package/packages/pi-coding-agent/src/core/extensions/index.ts +1 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +35 -4
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +0 -13
- package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
- package/packages/pi-coding-agent/src/core/lsp/config.ts +0 -11
- package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +1 -1
- package/packages/pi-coding-agent/src/core/lsp/utils.ts +1 -33
- package/packages/pi-coding-agent/src/core/messages.ts +5 -5
- package/packages/pi-coding-agent/src/core/model-registry.ts +0 -2
- package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -77
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +2 -2
- package/packages/pi-coding-agent/src/core/session-manager.ts +2 -4
- package/packages/pi-coding-agent/src/core/settings-manager.ts +87 -166
- package/packages/pi-coding-agent/src/index.ts +1 -0
- package/packages/pi-coding-agent/src/migrations.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +50 -561
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +653 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +7 -26
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +196 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +1 -1
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +1 -1
- package/packages/pi-coding-agent/src/utils/photon.ts +0 -137
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +0 -10
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +1 -1
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
- package/packages/pi-tui/dist/overlay-layout.js +288 -0
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +0 -22
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +6 -272
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/dist/utils.d.ts +0 -7
- package/packages/pi-tui/dist/utils.d.ts.map +1 -1
- package/packages/pi-tui/dist/utils.js +0 -44
- package/packages/pi-tui/dist/utils.js.map +1 -1
- package/packages/pi-tui/src/components/editor.ts +1 -1
- package/packages/pi-tui/src/overlay-layout.ts +372 -0
- package/packages/pi-tui/src/tui.ts +11 -312
- package/packages/pi-tui/src/utils.ts +0 -43
- package/pkg/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +6 -23
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/themes.js +175 -0
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/bg-shell/index.ts +41 -46
- package/src/resources/extensions/browser-tools/index.ts +156 -67
- package/src/resources/extensions/gsd/auto/session.ts +47 -30
- package/src/resources/extensions/gsd/auto-dashboard.ts +28 -131
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +6 -1
- package/src/resources/extensions/gsd/auto-dispatch.ts +135 -91
- package/src/resources/extensions/gsd/auto-loop.ts +1665 -0
- package/src/resources/extensions/gsd/auto-observability.ts +4 -2
- package/src/resources/extensions/gsd/auto-post-unit.ts +85 -228
- package/src/resources/extensions/gsd/auto-prompts.ts +138 -109
- package/src/resources/extensions/gsd/auto-recovery.ts +124 -118
- package/src/resources/extensions/gsd/auto-start.ts +440 -354
- package/src/resources/extensions/gsd/auto-supervisor.ts +5 -12
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +8 -8
- package/src/resources/extensions/gsd/auto-timers.ts +3 -4
- package/src/resources/extensions/gsd/auto-verification.ts +76 -72
- package/src/resources/extensions/gsd/auto-worktree-sync.ts +204 -0
- package/src/resources/extensions/gsd/auto-worktree.ts +453 -133
- package/src/resources/extensions/gsd/auto.ts +516 -1189
- package/src/resources/extensions/gsd/captures.ts +10 -4
- package/src/resources/extensions/gsd/changelog.ts +213 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +253 -0
- package/src/resources/extensions/gsd/commands.ts +48 -32
- package/src/resources/extensions/gsd/dispatch-guard.ts +13 -9
- package/src/resources/extensions/gsd/docs/preferences-reference.md +25 -18
- package/src/resources/extensions/gsd/doctor-checks.ts +3 -4
- package/src/resources/extensions/gsd/git-service.ts +32 -12
- package/src/resources/extensions/gsd/gitignore.ts +4 -2
- package/src/resources/extensions/gsd/gsd-db.ts +375 -180
- package/src/resources/extensions/gsd/guided-flow.ts +22 -11
- package/src/resources/extensions/gsd/index.ts +76 -163
- package/src/resources/extensions/gsd/post-unit-hooks.ts +13 -13
- package/src/resources/extensions/gsd/progress-score.ts +65 -200
- package/src/resources/extensions/gsd/quick.ts +121 -76
- package/src/resources/extensions/gsd/repo-identity.ts +56 -22
- package/src/resources/extensions/gsd/session-lock.ts +17 -0
- package/src/resources/extensions/gsd/templates/preferences.md +1 -0
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +32 -59
- package/src/resources/extensions/gsd/tests/all-milestones-complete-merge.test.ts +75 -27
- package/src/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-lock-creation.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +1458 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +8 -162
- package/src/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +2 -108
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +1 -3
- package/src/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +0 -3
- package/src/resources/extensions/gsd/tests/auto-worktree.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +0 -55
- package/src/resources/extensions/gsd/tests/git-service.test.ts +16 -7
- package/src/resources/extensions/gsd/tests/headless-query.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/milestone-transition-worktree.test.ts +8 -11
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +4 -6
- package/src/resources/extensions/gsd/tests/quick-branch-lifecycle.test.ts +281 -0
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/run-uat.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/sidecar-queue.test.ts +181 -0
- package/src/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +0 -3
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/triage-dispatch.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/undo.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/verification-evidence.test.ts +24 -26
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +7 -136
- package/src/resources/extensions/gsd/tests/worktree-db-integration.test.ts +205 -0
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +442 -0
- package/src/resources/extensions/gsd/tests/worktree-e2e.test.ts +0 -3
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +705 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +57 -106
- package/src/resources/extensions/gsd/tests/worktree.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +43 -132
- package/src/resources/extensions/gsd/types.ts +90 -77
- package/src/resources/extensions/gsd/undo.ts +42 -46
- package/src/resources/extensions/gsd/unit-runtime.ts +14 -18
- package/src/resources/extensions/gsd/verification-evidence.ts +0 -2
- package/src/resources/extensions/gsd/verification-gate.ts +4 -16
- package/src/resources/extensions/gsd/worktree-command-bootstrap.ts +46 -0
- package/src/resources/extensions/gsd/worktree-command.ts +29 -11
- package/src/resources/extensions/gsd/worktree-manager.ts +2 -3
- package/src/resources/extensions/gsd/worktree-resolver.ts +485 -0
- package/src/resources/extensions/gsd/worktree.ts +7 -44
- package/src/resources/extensions/mcp-client/index.ts +2 -1
- package/src/resources/extensions/package.json +3 -0
- package/src/resources/extensions/search-the-web/command-search-provider.ts +1 -1
- package/src/resources/extensions/search-the-web/index.ts +35 -52
- package/src/resources/extensions/search-the-web/tavily.ts +1 -1
- package/dist/resources/extensions/ask-user-questions.ts +0 -290
- package/dist/resources/extensions/async-jobs/async-bash-tool.ts +0 -212
- package/dist/resources/extensions/async-jobs/await-tool.ts +0 -103
- package/dist/resources/extensions/async-jobs/cancel-job-tool.ts +0 -35
- package/dist/resources/extensions/async-jobs/index.ts +0 -141
- package/dist/resources/extensions/async-jobs/job-manager.ts +0 -211
- package/dist/resources/extensions/aws-auth/index.ts +0 -144
- package/dist/resources/extensions/bg-shell/bg-shell-command.ts +0 -219
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.ts +0 -400
- package/dist/resources/extensions/bg-shell/bg-shell-tool.ts +0 -985
- package/dist/resources/extensions/bg-shell/index.ts +0 -59
- package/dist/resources/extensions/bg-shell/interaction.ts +0 -198
- package/dist/resources/extensions/bg-shell/output-formatter.ts +0 -279
- package/dist/resources/extensions/bg-shell/overlay.ts +0 -437
- package/dist/resources/extensions/bg-shell/process-manager.ts +0 -464
- package/dist/resources/extensions/bg-shell/readiness-detector.ts +0 -126
- package/dist/resources/extensions/bg-shell/types.ts +0 -303
- package/dist/resources/extensions/bg-shell/utilities.ts +0 -57
- package/dist/resources/extensions/browser-tools/capture.ts +0 -199
- package/dist/resources/extensions/browser-tools/core.ts +0 -1196
- package/dist/resources/extensions/browser-tools/index.ts +0 -71
- package/dist/resources/extensions/browser-tools/lifecycle.ts +0 -270
- package/dist/resources/extensions/browser-tools/refs.ts +0 -264
- package/dist/resources/extensions/browser-tools/settle.ts +0 -197
- package/dist/resources/extensions/browser-tools/state.ts +0 -408
- package/dist/resources/extensions/browser-tools/tools/action-cache.ts +0 -216
- package/dist/resources/extensions/browser-tools/tools/assertions.ts +0 -342
- package/dist/resources/extensions/browser-tools/tools/codegen.ts +0 -274
- package/dist/resources/extensions/browser-tools/tools/device.ts +0 -183
- package/dist/resources/extensions/browser-tools/tools/extract.ts +0 -229
- package/dist/resources/extensions/browser-tools/tools/forms.ts +0 -801
- package/dist/resources/extensions/browser-tools/tools/injection-detect.ts +0 -221
- package/dist/resources/extensions/browser-tools/tools/inspection.ts +0 -492
- package/dist/resources/extensions/browser-tools/tools/intent.ts +0 -614
- package/dist/resources/extensions/browser-tools/tools/interaction.ts +0 -865
- package/dist/resources/extensions/browser-tools/tools/navigation.ts +0 -232
- package/dist/resources/extensions/browser-tools/tools/network-mock.ts +0 -244
- package/dist/resources/extensions/browser-tools/tools/pages.ts +0 -303
- package/dist/resources/extensions/browser-tools/tools/pdf.ts +0 -92
- package/dist/resources/extensions/browser-tools/tools/refs.ts +0 -541
- package/dist/resources/extensions/browser-tools/tools/screenshot.ts +0 -101
- package/dist/resources/extensions/browser-tools/tools/session.ts +0 -400
- package/dist/resources/extensions/browser-tools/tools/state-persistence.ts +0 -202
- package/dist/resources/extensions/browser-tools/tools/visual-diff.ts +0 -209
- package/dist/resources/extensions/browser-tools/tools/wait.ts +0 -247
- package/dist/resources/extensions/browser-tools/tools/zoom.ts +0 -104
- package/dist/resources/extensions/browser-tools/utils.ts +0 -660
- package/dist/resources/extensions/context7/index.ts +0 -428
- package/dist/resources/extensions/get-secrets-from-user.ts +0 -607
- package/dist/resources/extensions/google-search/index.ts +0 -466
- package/dist/resources/extensions/gsd/activity-log.ts +0 -162
- package/dist/resources/extensions/gsd/atomic-write.ts +0 -35
- package/dist/resources/extensions/gsd/auto/session.ts +0 -236
- package/dist/resources/extensions/gsd/auto-budget.ts +0 -32
- package/dist/resources/extensions/gsd/auto-constants.ts +0 -6
- package/dist/resources/extensions/gsd/auto-dashboard.ts +0 -626
- package/dist/resources/extensions/gsd/auto-direct-dispatch.ts +0 -224
- package/dist/resources/extensions/gsd/auto-dispatch.ts +0 -409
- package/dist/resources/extensions/gsd/auto-idempotency.ts +0 -151
- package/dist/resources/extensions/gsd/auto-model-selection.ts +0 -179
- package/dist/resources/extensions/gsd/auto-observability.ts +0 -72
- package/dist/resources/extensions/gsd/auto-post-unit.ts +0 -618
- package/dist/resources/extensions/gsd/auto-prompts.ts +0 -1273
- package/dist/resources/extensions/gsd/auto-recovery.ts +0 -578
- package/dist/resources/extensions/gsd/auto-start.ts +0 -483
- package/dist/resources/extensions/gsd/auto-stuck-detection.ts +0 -221
- package/dist/resources/extensions/gsd/auto-supervisor.ts +0 -61
- package/dist/resources/extensions/gsd/auto-timeout-recovery.ts +0 -263
- package/dist/resources/extensions/gsd/auto-timers.ts +0 -224
- package/dist/resources/extensions/gsd/auto-tool-tracking.ts +0 -54
- package/dist/resources/extensions/gsd/auto-unit-closeout.ts +0 -48
- package/dist/resources/extensions/gsd/auto-verification.ts +0 -229
- package/dist/resources/extensions/gsd/auto-worktree.ts +0 -658
- package/dist/resources/extensions/gsd/auto.ts +0 -1834
- package/dist/resources/extensions/gsd/captures.ts +0 -427
- package/dist/resources/extensions/gsd/claude-import.ts +0 -656
- package/dist/resources/extensions/gsd/collision-diagnostics.ts +0 -332
- package/dist/resources/extensions/gsd/commands-config.ts +0 -102
- package/dist/resources/extensions/gsd/commands-extensions.ts +0 -328
- package/dist/resources/extensions/gsd/commands-handlers.ts +0 -395
- package/dist/resources/extensions/gsd/commands-inspect.ts +0 -91
- package/dist/resources/extensions/gsd/commands-logs.ts +0 -536
- package/dist/resources/extensions/gsd/commands-maintenance.ts +0 -206
- package/dist/resources/extensions/gsd/commands-prefs-wizard.ts +0 -780
- package/dist/resources/extensions/gsd/commands-workflow-templates.ts +0 -543
- package/dist/resources/extensions/gsd/commands.ts +0 -1149
- package/dist/resources/extensions/gsd/complexity-classifier.ts +0 -320
- package/dist/resources/extensions/gsd/context-budget.ts +0 -266
- package/dist/resources/extensions/gsd/context-store.ts +0 -195
- package/dist/resources/extensions/gsd/crash-recovery.ts +0 -121
- package/dist/resources/extensions/gsd/dashboard-overlay.ts +0 -681
- package/dist/resources/extensions/gsd/db-writer.ts +0 -360
- package/dist/resources/extensions/gsd/debug-logger.ts +0 -178
- package/dist/resources/extensions/gsd/detection.ts +0 -470
- package/dist/resources/extensions/gsd/diff-context.ts +0 -214
- package/dist/resources/extensions/gsd/dispatch-guard.ts +0 -81
- package/dist/resources/extensions/gsd/doctor-checks.ts +0 -612
- package/dist/resources/extensions/gsd/doctor-environment.ts +0 -497
- package/dist/resources/extensions/gsd/doctor-format.ts +0 -78
- package/dist/resources/extensions/gsd/doctor-proactive.ts +0 -292
- package/dist/resources/extensions/gsd/doctor-providers.ts +0 -343
- package/dist/resources/extensions/gsd/doctor-types.ts +0 -87
- package/dist/resources/extensions/gsd/doctor.ts +0 -722
- package/dist/resources/extensions/gsd/error-utils.ts +0 -6
- package/dist/resources/extensions/gsd/exit-command.ts +0 -18
- package/dist/resources/extensions/gsd/export.ts +0 -317
- package/dist/resources/extensions/gsd/file-watcher.ts +0 -97
- package/dist/resources/extensions/gsd/files.ts +0 -1058
- package/dist/resources/extensions/gsd/forensics.ts +0 -629
- package/dist/resources/extensions/gsd/git-self-heal.ts +0 -127
- package/dist/resources/extensions/gsd/git-service.ts +0 -580
- package/dist/resources/extensions/gsd/gsd-db.ts +0 -685
- package/dist/resources/extensions/gsd/guided-flow-queue.ts +0 -440
- package/dist/resources/extensions/gsd/guided-flow.ts +0 -1303
- package/dist/resources/extensions/gsd/health-widget.ts +0 -167
- package/dist/resources/extensions/gsd/history.ts +0 -143
- package/dist/resources/extensions/gsd/index.ts +0 -1390
- package/dist/resources/extensions/gsd/init-wizard.ts +0 -587
- package/dist/resources/extensions/gsd/json-persistence.ts +0 -67
- package/dist/resources/extensions/gsd/key-manager.ts +0 -996
- package/dist/resources/extensions/gsd/marketplace-discovery.ts +0 -508
- package/dist/resources/extensions/gsd/md-importer.ts +0 -527
- package/dist/resources/extensions/gsd/mechanical-completion.ts +0 -430
- package/dist/resources/extensions/gsd/memory-extractor.ts +0 -352
- package/dist/resources/extensions/gsd/memory-store.ts +0 -441
- package/dist/resources/extensions/gsd/metrics.ts +0 -532
- package/dist/resources/extensions/gsd/migrate/command.ts +0 -219
- package/dist/resources/extensions/gsd/migrate/index.ts +0 -42
- package/dist/resources/extensions/gsd/migrate/parser.ts +0 -323
- package/dist/resources/extensions/gsd/migrate/parsers.ts +0 -539
- package/dist/resources/extensions/gsd/migrate/preview.ts +0 -48
- package/dist/resources/extensions/gsd/migrate/transformer.ts +0 -346
- package/dist/resources/extensions/gsd/migrate/types.ts +0 -370
- package/dist/resources/extensions/gsd/migrate/validator.ts +0 -55
- package/dist/resources/extensions/gsd/migrate/writer.ts +0 -579
- package/dist/resources/extensions/gsd/migrate-external.ts +0 -140
- package/dist/resources/extensions/gsd/milestone-actions.ts +0 -126
- package/dist/resources/extensions/gsd/model-cost-table.ts +0 -65
- package/dist/resources/extensions/gsd/model-router.ts +0 -256
- package/dist/resources/extensions/gsd/namespaced-registry.ts +0 -467
- package/dist/resources/extensions/gsd/namespaced-resolver.ts +0 -307
- package/dist/resources/extensions/gsd/native-git-bridge.ts +0 -1041
- package/dist/resources/extensions/gsd/native-parser-bridge.ts +0 -267
- package/dist/resources/extensions/gsd/notifications.ts +0 -87
- package/dist/resources/extensions/gsd/observability-validator.ts +0 -429
- package/dist/resources/extensions/gsd/parallel-eligibility.ts +0 -233
- package/dist/resources/extensions/gsd/parallel-merge.ts +0 -157
- package/dist/resources/extensions/gsd/parallel-orchestrator.ts +0 -826
- package/dist/resources/extensions/gsd/paths.ts +0 -449
- package/dist/resources/extensions/gsd/plugin-importer.ts +0 -411
- package/dist/resources/extensions/gsd/post-unit-hooks.ts +0 -520
- package/dist/resources/extensions/gsd/preferences-models.ts +0 -329
- package/dist/resources/extensions/gsd/preferences-skills.ts +0 -169
- package/dist/resources/extensions/gsd/preferences-types.ts +0 -229
- package/dist/resources/extensions/gsd/preferences-validation.ts +0 -590
- package/dist/resources/extensions/gsd/preferences.ts +0 -416
- package/dist/resources/extensions/gsd/progress-score.ts +0 -273
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.ts +0 -213
- package/dist/resources/extensions/gsd/prompt-compressor.ts +0 -508
- package/dist/resources/extensions/gsd/prompt-loader.ts +0 -130
- package/dist/resources/extensions/gsd/prompt-ordering.ts +0 -200
- package/dist/resources/extensions/gsd/provider-error-pause.ts +0 -88
- package/dist/resources/extensions/gsd/queue-order.ts +0 -230
- package/dist/resources/extensions/gsd/queue-reorder-ui.ts +0 -276
- package/dist/resources/extensions/gsd/quick.ts +0 -212
- package/dist/resources/extensions/gsd/repo-identity.ts +0 -169
- package/dist/resources/extensions/gsd/roadmap-slices.ts +0 -149
- package/dist/resources/extensions/gsd/routing-history.ts +0 -286
- package/dist/resources/extensions/gsd/safe-fs.ts +0 -47
- package/dist/resources/extensions/gsd/semantic-chunker.ts +0 -336
- package/dist/resources/extensions/gsd/session-forensics.ts +0 -537
- package/dist/resources/extensions/gsd/session-lock.ts +0 -426
- package/dist/resources/extensions/gsd/session-status-io.ts +0 -179
- package/dist/resources/extensions/gsd/skill-discovery.ts +0 -139
- package/dist/resources/extensions/gsd/skill-health.ts +0 -417
- package/dist/resources/extensions/gsd/state.ts +0 -727
- package/dist/resources/extensions/gsd/structured-data-formatter.ts +0 -144
- package/dist/resources/extensions/gsd/summary-distiller.ts +0 -258
- package/dist/resources/extensions/gsd/tests/activity-log.test.ts +0 -213
- package/dist/resources/extensions/gsd/tests/agent-end-retry.test.ts +0 -107
- package/dist/resources/extensions/gsd/tests/all-milestones-complete-merge.test.ts +0 -200
- package/dist/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +0 -50
- package/dist/resources/extensions/gsd/tests/auto-dashboard.test.ts +0 -166
- package/dist/resources/extensions/gsd/tests/auto-dispatch-loop.test.ts +0 -691
- package/dist/resources/extensions/gsd/tests/auto-lock-creation.test.ts +0 -186
- package/dist/resources/extensions/gsd/tests/auto-preflight.test.ts +0 -40
- package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +0 -640
- package/dist/resources/extensions/gsd/tests/auto-reentrancy-guard.test.ts +0 -127
- package/dist/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +0 -302
- package/dist/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +0 -257
- package/dist/resources/extensions/gsd/tests/auto-skip-loop.test.ts +0 -123
- package/dist/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +0 -340
- package/dist/resources/extensions/gsd/tests/auto-worktree.test.ts +0 -167
- package/dist/resources/extensions/gsd/tests/budget-prediction.test.ts +0 -220
- package/dist/resources/extensions/gsd/tests/cache-staleness-regression.test.ts +0 -317
- package/dist/resources/extensions/gsd/tests/captures.test.ts +0 -438
- package/dist/resources/extensions/gsd/tests/claude-import-tui.test.ts +0 -351
- package/dist/resources/extensions/gsd/tests/collect-from-manifest.test.ts +0 -469
- package/dist/resources/extensions/gsd/tests/collision-diagnostics.test.ts +0 -705
- package/dist/resources/extensions/gsd/tests/commands-logs.test.ts +0 -241
- package/dist/resources/extensions/gsd/tests/complete-milestone.test.ts +0 -209
- package/dist/resources/extensions/gsd/tests/complexity-classifier.test.ts +0 -181
- package/dist/resources/extensions/gsd/tests/context-budget.test.ts +0 -352
- package/dist/resources/extensions/gsd/tests/context-compression.test.ts +0 -193
- package/dist/resources/extensions/gsd/tests/context-store.test.ts +0 -462
- package/dist/resources/extensions/gsd/tests/continue-here.test.ts +0 -285
- package/dist/resources/extensions/gsd/tests/cost-projection.test.ts +0 -134
- package/dist/resources/extensions/gsd/tests/crash-recovery.test.ts +0 -134
- package/dist/resources/extensions/gsd/tests/dashboard-budget.test.ts +0 -346
- package/dist/resources/extensions/gsd/tests/db-writer.test.ts +0 -602
- package/dist/resources/extensions/gsd/tests/debug-logger.test.ts +0 -185
- package/dist/resources/extensions/gsd/tests/derive-state-db.test.ts +0 -405
- package/dist/resources/extensions/gsd/tests/derive-state-deps.test.ts +0 -421
- package/dist/resources/extensions/gsd/tests/derive-state-draft.test.ts +0 -308
- package/dist/resources/extensions/gsd/tests/derive-state.test.ts +0 -788
- package/dist/resources/extensions/gsd/tests/detection.test.ts +0 -398
- package/dist/resources/extensions/gsd/tests/diff-context.test.ts +0 -136
- package/dist/resources/extensions/gsd/tests/discuss-prompt.test.ts +0 -15
- package/dist/resources/extensions/gsd/tests/dispatch-guard.test.ts +0 -128
- package/dist/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +0 -132
- package/dist/resources/extensions/gsd/tests/dispatch-stall-guard.test.ts +0 -126
- package/dist/resources/extensions/gsd/tests/doctor-environment.test.ts +0 -314
- package/dist/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +0 -245
- package/dist/resources/extensions/gsd/tests/doctor-git.test.ts +0 -344
- package/dist/resources/extensions/gsd/tests/doctor-proactive.test.ts +0 -278
- package/dist/resources/extensions/gsd/tests/doctor-providers.test.ts +0 -298
- package/dist/resources/extensions/gsd/tests/doctor-runtime.test.ts +0 -302
- package/dist/resources/extensions/gsd/tests/doctor.test.ts +0 -652
- package/dist/resources/extensions/gsd/tests/draft-promotion.test.ts +0 -169
- package/dist/resources/extensions/gsd/tests/exit-command.test.ts +0 -50
- package/dist/resources/extensions/gsd/tests/export-html-all.test.ts +0 -105
- package/dist/resources/extensions/gsd/tests/export-html-enhancements.test.ts +0 -378
- package/dist/resources/extensions/gsd/tests/extension-selector-separator.test.ts +0 -144
- package/dist/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +0 -424
- package/dist/resources/extensions/gsd/tests/git-self-heal.test.ts +0 -131
- package/dist/resources/extensions/gsd/tests/git-service.test.ts +0 -1172
- package/dist/resources/extensions/gsd/tests/gsd-db.test.ts +0 -353
- package/dist/resources/extensions/gsd/tests/gsd-inspect.test.ts +0 -125
- package/dist/resources/extensions/gsd/tests/gsd-tools.test.ts +0 -326
- package/dist/resources/extensions/gsd/tests/headless-answers.test.ts +0 -340
- package/dist/resources/extensions/gsd/tests/headless-query.test.ts +0 -162
- package/dist/resources/extensions/gsd/tests/idle-recovery.test.ts +0 -485
- package/dist/resources/extensions/gsd/tests/in-flight-tool-tracking.test.ts +0 -32
- package/dist/resources/extensions/gsd/tests/init-wizard.test.ts +0 -197
- package/dist/resources/extensions/gsd/tests/integration/headless-command.ts +0 -534
- package/dist/resources/extensions/gsd/tests/integration-edge.test.ts +0 -228
- package/dist/resources/extensions/gsd/tests/integration-lifecycle.test.ts +0 -277
- package/dist/resources/extensions/gsd/tests/integration-mixed-milestones.test.ts +0 -523
- package/dist/resources/extensions/gsd/tests/key-manager.test.ts +0 -414
- package/dist/resources/extensions/gsd/tests/knowledge.test.ts +0 -161
- package/dist/resources/extensions/gsd/tests/loop-regression.test.ts +0 -877
- package/dist/resources/extensions/gsd/tests/manifest-status.test.ts +0 -283
- package/dist/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +0 -91
- package/dist/resources/extensions/gsd/tests/md-importer.test.ts +0 -410
- package/dist/resources/extensions/gsd/tests/mechanical-completion.test.ts +0 -356
- package/dist/resources/extensions/gsd/tests/memory-extractor.test.ts +0 -180
- package/dist/resources/extensions/gsd/tests/memory-leak-guards.test.ts +0 -91
- package/dist/resources/extensions/gsd/tests/memory-store.test.ts +0 -345
- package/dist/resources/extensions/gsd/tests/metrics.test.ts +0 -253
- package/dist/resources/extensions/gsd/tests/migrate-command.test.ts +0 -369
- package/dist/resources/extensions/gsd/tests/migrate-parser.test.ts +0 -757
- package/dist/resources/extensions/gsd/tests/migrate-transformer.test.ts +0 -635
- package/dist/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +0 -414
- package/dist/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +0 -303
- package/dist/resources/extensions/gsd/tests/migrate-writer.test.ts +0 -398
- package/dist/resources/extensions/gsd/tests/milestone-transition-worktree.test.ts +0 -147
- package/dist/resources/extensions/gsd/tests/model-cost-table.test.ts +0 -69
- package/dist/resources/extensions/gsd/tests/model-isolation.test.ts +0 -157
- package/dist/resources/extensions/gsd/tests/model-router.test.ts +0 -167
- package/dist/resources/extensions/gsd/tests/must-have-parser.test.ts +0 -291
- package/dist/resources/extensions/gsd/tests/namespaced-registry.test.ts +0 -1027
- package/dist/resources/extensions/gsd/tests/namespaced-resolver.test.ts +0 -671
- package/dist/resources/extensions/gsd/tests/native-has-changes-cache.test.ts +0 -61
- package/dist/resources/extensions/gsd/tests/next-milestone-id.test.ts +0 -23
- package/dist/resources/extensions/gsd/tests/none-mode-gates.test.ts +0 -114
- package/dist/resources/extensions/gsd/tests/notifications.test.ts +0 -67
- package/dist/resources/extensions/gsd/tests/overrides.test.ts +0 -131
- package/dist/resources/extensions/gsd/tests/parallel-budget-atomicity.test.ts +0 -331
- package/dist/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +0 -298
- package/dist/resources/extensions/gsd/tests/parallel-merge.test.ts +0 -468
- package/dist/resources/extensions/gsd/tests/parallel-orchestration.test.ts +0 -685
- package/dist/resources/extensions/gsd/tests/parallel-worker-monitoring.test.ts +0 -171
- package/dist/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +0 -354
- package/dist/resources/extensions/gsd/tests/park-edge-cases.test.ts +0 -276
- package/dist/resources/extensions/gsd/tests/park-milestone.test.ts +0 -401
- package/dist/resources/extensions/gsd/tests/parsers.test.ts +0 -1704
- package/dist/resources/extensions/gsd/tests/plan-milestone.test.ts +0 -133
- package/dist/resources/extensions/gsd/tests/plan-quality-validator.test.ts +0 -363
- package/dist/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +0 -42
- package/dist/resources/extensions/gsd/tests/plugin-importer-live.test.ts +0 -481
- package/dist/resources/extensions/gsd/tests/plugin-importer.test.ts +0 -1383
- package/dist/resources/extensions/gsd/tests/post-unit-hooks.test.ts +0 -337
- package/dist/resources/extensions/gsd/tests/preferences.test.ts +0 -276
- package/dist/resources/extensions/gsd/tests/progress-score.test.ts +0 -206
- package/dist/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +0 -464
- package/dist/resources/extensions/gsd/tests/prompt-cache-optimizer.test.ts +0 -314
- package/dist/resources/extensions/gsd/tests/prompt-compressor.test.ts +0 -529
- package/dist/resources/extensions/gsd/tests/prompt-db.test.ts +0 -385
- package/dist/resources/extensions/gsd/tests/prompt-ordering.test.ts +0 -296
- package/dist/resources/extensions/gsd/tests/provider-errors.test.ts +0 -338
- package/dist/resources/extensions/gsd/tests/queue-draft-detection.test.ts +0 -126
- package/dist/resources/extensions/gsd/tests/queue-order.test.ts +0 -204
- package/dist/resources/extensions/gsd/tests/queue-reorder-e2e.test.ts +0 -282
- package/dist/resources/extensions/gsd/tests/reassess-detection.test.ts +0 -154
- package/dist/resources/extensions/gsd/tests/reassess-prompt.test.ts +0 -145
- package/dist/resources/extensions/gsd/tests/regex-hardening.test.ts +0 -281
- package/dist/resources/extensions/gsd/tests/remote-questions.test.ts +0 -642
- package/dist/resources/extensions/gsd/tests/remote-status.test.ts +0 -99
- package/dist/resources/extensions/gsd/tests/replan-slice.test.ts +0 -538
- package/dist/resources/extensions/gsd/tests/requirements.test.ts +0 -106
- package/dist/resources/extensions/gsd/tests/roadmap-parse-regression.test.ts +0 -358
- package/dist/resources/extensions/gsd/tests/roadmap-slices.test.ts +0 -66
- package/dist/resources/extensions/gsd/tests/routing-history.test.ts +0 -240
- package/dist/resources/extensions/gsd/tests/run-uat.test.ts +0 -416
- package/dist/resources/extensions/gsd/tests/secure-env-collect.test.ts +0 -185
- package/dist/resources/extensions/gsd/tests/semantic-chunker.test.ts +0 -426
- package/dist/resources/extensions/gsd/tests/session-lock-regression.test.ts +0 -216
- package/dist/resources/extensions/gsd/tests/session-lock.test.ts +0 -434
- package/dist/resources/extensions/gsd/tests/skill-lifecycle.test.ts +0 -126
- package/dist/resources/extensions/gsd/tests/smart-entry-draft.test.ts +0 -123
- package/dist/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +0 -142
- package/dist/resources/extensions/gsd/tests/stop-auto-remote.test.ts +0 -156
- package/dist/resources/extensions/gsd/tests/structured-data-formatter.test.ts +0 -365
- package/dist/resources/extensions/gsd/tests/summary-distiller.test.ts +0 -323
- package/dist/resources/extensions/gsd/tests/test-helpers.ts +0 -61
- package/dist/resources/extensions/gsd/tests/token-counter.test.ts +0 -129
- package/dist/resources/extensions/gsd/tests/token-optimization-benchmark.test.ts +0 -1272
- package/dist/resources/extensions/gsd/tests/token-optimization-prefs.test.ts +0 -164
- package/dist/resources/extensions/gsd/tests/token-profile.test.ts +0 -268
- package/dist/resources/extensions/gsd/tests/token-savings.test.ts +0 -366
- package/dist/resources/extensions/gsd/tests/triage-dispatch.test.ts +0 -340
- package/dist/resources/extensions/gsd/tests/triage-resolution.test.ts +0 -416
- package/dist/resources/extensions/gsd/tests/undo.test.ts +0 -136
- package/dist/resources/extensions/gsd/tests/unique-milestone-ids.test.ts +0 -219
- package/dist/resources/extensions/gsd/tests/unit-runtime.test.ts +0 -258
- package/dist/resources/extensions/gsd/tests/update-command.test.ts +0 -67
- package/dist/resources/extensions/gsd/tests/validate-directory.test.ts +0 -222
- package/dist/resources/extensions/gsd/tests/validate-milestone.test.ts +0 -375
- package/dist/resources/extensions/gsd/tests/verification-evidence.test.ts +0 -745
- package/dist/resources/extensions/gsd/tests/verification-gate.test.ts +0 -1208
- package/dist/resources/extensions/gsd/tests/visualizer-critical-path.test.ts +0 -145
- package/dist/resources/extensions/gsd/tests/visualizer-data.test.ts +0 -446
- package/dist/resources/extensions/gsd/tests/visualizer-overlay.test.ts +0 -237
- package/dist/resources/extensions/gsd/tests/visualizer-views.test.ts +0 -718
- package/dist/resources/extensions/gsd/tests/worker-registry.test.ts +0 -148
- package/dist/resources/extensions/gsd/tests/workflow-templates.test.ts +0 -173
- package/dist/resources/extensions/gsd/tests/workspace-index.test.ts +0 -38
- package/dist/resources/extensions/gsd/tests/worktree-bugfix.test.ts +0 -120
- package/dist/resources/extensions/gsd/tests/worktree-e2e.test.ts +0 -244
- package/dist/resources/extensions/gsd/tests/worktree-integration.test.ts +0 -207
- package/dist/resources/extensions/gsd/tests/worktree-manager.test.ts +0 -141
- package/dist/resources/extensions/gsd/tests/worktree-post-create-hook.test.ts +0 -165
- package/dist/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +0 -206
- package/dist/resources/extensions/gsd/tests/worktree.test.ts +0 -171
- package/dist/resources/extensions/gsd/tests/write-gate.test.ts +0 -211
- package/dist/resources/extensions/gsd/token-counter.ts +0 -65
- package/dist/resources/extensions/gsd/triage-resolution.ts +0 -284
- package/dist/resources/extensions/gsd/triage-ui.ts +0 -175
- package/dist/resources/extensions/gsd/types.ts +0 -425
- package/dist/resources/extensions/gsd/undo.ts +0 -223
- package/dist/resources/extensions/gsd/unit-id.ts +0 -14
- package/dist/resources/extensions/gsd/unit-runtime.ts +0 -192
- package/dist/resources/extensions/gsd/validate-directory.ts +0 -164
- package/dist/resources/extensions/gsd/verification-evidence.ts +0 -188
- package/dist/resources/extensions/gsd/verification-gate.ts +0 -643
- package/dist/resources/extensions/gsd/visualizer-data.ts +0 -866
- package/dist/resources/extensions/gsd/visualizer-overlay.ts +0 -566
- package/dist/resources/extensions/gsd/visualizer-views.ts +0 -1171
- package/dist/resources/extensions/gsd/workflow-templates.ts +0 -241
- package/dist/resources/extensions/gsd/workspace-index.ts +0 -217
- package/dist/resources/extensions/gsd/worktree-command.ts +0 -807
- package/dist/resources/extensions/gsd/worktree-manager.ts +0 -449
- package/dist/resources/extensions/gsd/worktree.ts +0 -257
- package/dist/resources/extensions/mac-tools/index.ts +0 -852
- package/dist/resources/extensions/mcp-client/index.ts +0 -459
- package/dist/resources/extensions/remote-questions/config.ts +0 -83
- package/dist/resources/extensions/remote-questions/discord-adapter.ts +0 -148
- package/dist/resources/extensions/remote-questions/format.ts +0 -315
- package/dist/resources/extensions/remote-questions/http-client.ts +0 -76
- package/dist/resources/extensions/remote-questions/manager.ts +0 -184
- package/dist/resources/extensions/remote-questions/notify.ts +0 -90
- package/dist/resources/extensions/remote-questions/remote-command.ts +0 -457
- package/dist/resources/extensions/remote-questions/slack-adapter.ts +0 -141
- package/dist/resources/extensions/remote-questions/status.ts +0 -31
- package/dist/resources/extensions/remote-questions/store.ts +0 -81
- package/dist/resources/extensions/remote-questions/telegram-adapter.ts +0 -149
- package/dist/resources/extensions/remote-questions/types.ts +0 -102
- package/dist/resources/extensions/search-the-web/cache.ts +0 -78
- package/dist/resources/extensions/search-the-web/command-search-provider.ts +0 -101
- package/dist/resources/extensions/search-the-web/format.ts +0 -258
- package/dist/resources/extensions/search-the-web/http.ts +0 -238
- package/dist/resources/extensions/search-the-web/index.ts +0 -65
- package/dist/resources/extensions/search-the-web/native-search.ts +0 -193
- package/dist/resources/extensions/search-the-web/provider.ts +0 -148
- package/dist/resources/extensions/search-the-web/tavily.ts +0 -116
- package/dist/resources/extensions/search-the-web/tool-fetch-page.ts +0 -589
- package/dist/resources/extensions/search-the-web/tool-llm-context.ts +0 -608
- package/dist/resources/extensions/search-the-web/tool-search.ts +0 -649
- package/dist/resources/extensions/search-the-web/url-utils.ts +0 -125
- package/dist/resources/extensions/shared/confirm-ui.ts +0 -126
- package/dist/resources/extensions/shared/frontmatter.ts +0 -117
- package/dist/resources/extensions/shared/interview-ui.ts +0 -613
- package/dist/resources/extensions/shared/next-action-ui.ts +0 -212
- package/dist/resources/extensions/shared/sanitize.ts +0 -19
- package/dist/resources/extensions/shared/terminal.ts +0 -23
- package/dist/resources/extensions/shared/tests/format-utils.test.ts +0 -153
- package/dist/resources/extensions/shared/ui.ts +0 -400
- package/dist/resources/extensions/shared/wizard-ui.ts +0 -551
- package/dist/resources/extensions/slash-commands/audit.ts +0 -88
- package/dist/resources/extensions/slash-commands/clear.ts +0 -10
- package/dist/resources/extensions/slash-commands/create-extension.ts +0 -297
- package/dist/resources/extensions/slash-commands/create-slash-command.ts +0 -234
- package/dist/resources/extensions/slash-commands/index.ts +0 -12
- package/dist/resources/extensions/subagent/agents.ts +0 -126
- package/dist/resources/extensions/subagent/index.ts +0 -1121
- package/dist/resources/extensions/subagent/isolation.ts +0 -501
- package/dist/resources/extensions/subagent/worker-registry.ts +0 -99
- package/dist/resources/extensions/ttsr/index.ts +0 -168
- package/dist/resources/extensions/ttsr/rule-loader.ts +0 -74
- package/dist/resources/extensions/ttsr/ttsr-manager.ts +0 -456
- package/dist/resources/extensions/universal-config/discovery.ts +0 -104
- package/dist/resources/extensions/universal-config/format.ts +0 -191
- package/dist/resources/extensions/universal-config/index.ts +0 -120
- package/dist/resources/extensions/universal-config/scanners.ts +0 -642
- package/dist/resources/extensions/universal-config/tests/discovery.test.ts +0 -119
- package/dist/resources/extensions/universal-config/tests/format.test.ts +0 -127
- package/dist/resources/extensions/universal-config/tests/scanners.test.ts +0 -456
- package/dist/resources/extensions/universal-config/tools.ts +0 -60
- package/dist/resources/extensions/universal-config/types.ts +0 -135
- package/dist/resources/extensions/voice/index.ts +0 -272
- package/dist/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +0 -51
- package/dist/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +0 -143
- package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
- package/pkg/dist/modes/interactive/theme/dark.json +0 -85
- package/pkg/dist/modes/interactive/theme/light.json +0 -84
- package/pkg/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/src/resources/extensions/gsd/auto-constants.ts +0 -6
- package/src/resources/extensions/gsd/auto-idempotency.ts +0 -151
- package/src/resources/extensions/gsd/auto-stuck-detection.ts +0 -221
- package/src/resources/extensions/gsd/mechanical-completion.ts +0 -430
- package/src/resources/extensions/gsd/tests/auto-dispatch-loop.test.ts +0 -691
- package/src/resources/extensions/gsd/tests/auto-reentrancy-guard.test.ts +0 -127
- package/src/resources/extensions/gsd/tests/auto-skip-loop.test.ts +0 -123
- package/src/resources/extensions/gsd/tests/dispatch-stall-guard.test.ts +0 -126
- package/src/resources/extensions/gsd/tests/loop-regression.test.ts +0 -877
- package/src/resources/extensions/gsd/tests/mechanical-completion.test.ts +0 -356
- package/src/resources/extensions/gsd/tests/progress-score.test.ts +0 -206
- package/src/resources/extensions/gsd/tests/session-lock.test.ts +0 -434
|
@@ -0,0 +1,1114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Extension — /gsd
|
|
3
|
+
*
|
|
4
|
+
* One command, one wizard. Reads state from disk, shows contextual options,
|
|
5
|
+
* dispatches through GSD-WORKFLOW.md. The LLM does the rest.
|
|
6
|
+
*
|
|
7
|
+
* Auto-mode: /gsd auto loops fresh sessions until milestone complete.
|
|
8
|
+
*
|
|
9
|
+
* Commands:
|
|
10
|
+
* /gsd — contextual wizard (smart entry point)
|
|
11
|
+
* /gsd auto — start auto-mode (fresh session per unit)
|
|
12
|
+
* /gsd stop — stop auto-mode gracefully
|
|
13
|
+
* /gsd status — progress dashboard
|
|
14
|
+
*
|
|
15
|
+
* Hooks:
|
|
16
|
+
* before_agent_start — inject GSD system context for GSD projects
|
|
17
|
+
* agent_end — auto-mode advancement
|
|
18
|
+
* session_before_compact — save continue.md OR block during auto
|
|
19
|
+
*/
|
|
20
|
+
import { createBashTool, createWriteTool, createReadTool, createEditTool, isToolCallEventType } from "@gsd/pi-coding-agent";
|
|
21
|
+
import { Type } from "@sinclair/typebox";
|
|
22
|
+
import { debugTime } from "./debug-logger.js";
|
|
23
|
+
import { registerGSDCommand } from "./commands.js";
|
|
24
|
+
import { loadToolApiKeys } from "./commands-config.js";
|
|
25
|
+
import { registerExitCommand } from "./exit-command.js";
|
|
26
|
+
import { registerWorktreeCommand, getWorktreeOriginalCwd, getActiveWorktreeName } from "./worktree-command.js";
|
|
27
|
+
import { getActiveAutoWorktreeContext } from "./auto-worktree.js";
|
|
28
|
+
import { saveFile, formatContinue, loadFile, parseContinue, parseSummary, loadActiveOverrides, formatOverridesSection } from "./files.js";
|
|
29
|
+
import { loadPrompt } from "./prompt-loader.js";
|
|
30
|
+
import { deriveState } from "./state.js";
|
|
31
|
+
import { isAutoActive, isAutoPaused, pauseAuto, getAutoDashboardData, getAutoModeStartModel, markToolStart, markToolEnd } from "./auto.js";
|
|
32
|
+
import { isSessionSwitchInFlight, resolveAgentEnd } from "./auto-loop.js";
|
|
33
|
+
import { saveActivityLog } from "./activity-log.js";
|
|
34
|
+
import { checkAutoStartAfterDiscuss, getDiscussionMilestoneId, findMilestoneIds, nextMilestoneId } from "./guided-flow.js";
|
|
35
|
+
import { GSDDashboardOverlay } from "./dashboard-overlay.js";
|
|
36
|
+
import { loadEffectiveGSDPreferences, renderPreferencesForSystemPrompt, resolveAllSkillReferences, resolveModelWithFallbacksForUnit, getNextFallbackModel, isTransientNetworkError, } from "./preferences.js";
|
|
37
|
+
import { hasSkillSnapshot, detectNewSkills, formatSkillsXml } from "./skill-discovery.js";
|
|
38
|
+
import { resolveSlicePath, resolveSliceFile, resolveTaskFile, resolveTaskFiles, resolveTasksDir, relSliceFile, relSlicePath, relTaskFile, buildSliceFileName, buildMilestoneFileName, resolveMilestonePath, resolveGsdRootFile, } from "./paths.js";
|
|
39
|
+
import { Key } from "@gsd/pi-tui";
|
|
40
|
+
import { join } from "node:path";
|
|
41
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
42
|
+
import { homedir } from "node:os";
|
|
43
|
+
import { shortcutDesc } from "../shared/mod.js";
|
|
44
|
+
import { Text } from "@gsd/pi-tui";
|
|
45
|
+
import { pauseAutoForProviderError, classifyProviderError } from "./provider-error-pause.js";
|
|
46
|
+
import { toPosixPath } from "../shared/mod.js";
|
|
47
|
+
import { isParallelActive, shutdownParallel } from "./parallel-orchestrator.js";
|
|
48
|
+
import { DEFAULT_BASH_TIMEOUT_SECS } from "./constants.js";
|
|
49
|
+
// ── Agent Instructions ────────────────────────────────────────────────────
|
|
50
|
+
// Lightweight "always follow" files injected into every GSD agent session.
|
|
51
|
+
// Global: ~/.gsd/agent-instructions.md Project: .gsd/agent-instructions.md
|
|
52
|
+
// Both are loaded and concatenated (global first, project appends).
|
|
53
|
+
function loadAgentInstructions() {
|
|
54
|
+
const parts = [];
|
|
55
|
+
const globalPath = join(homedir(), ".gsd", "agent-instructions.md");
|
|
56
|
+
if (existsSync(globalPath)) {
|
|
57
|
+
try {
|
|
58
|
+
const content = readFileSync(globalPath, "utf-8").trim();
|
|
59
|
+
if (content)
|
|
60
|
+
parts.push(content);
|
|
61
|
+
}
|
|
62
|
+
catch { /* non-fatal — skip unreadable file */ }
|
|
63
|
+
}
|
|
64
|
+
const projectPath = join(process.cwd(), ".gsd", "agent-instructions.md");
|
|
65
|
+
if (existsSync(projectPath)) {
|
|
66
|
+
try {
|
|
67
|
+
const content = readFileSync(projectPath, "utf-8").trim();
|
|
68
|
+
if (content)
|
|
69
|
+
parts.push(content);
|
|
70
|
+
}
|
|
71
|
+
catch { /* non-fatal — skip unreadable file */ }
|
|
72
|
+
}
|
|
73
|
+
if (parts.length === 0)
|
|
74
|
+
return null;
|
|
75
|
+
return parts.join("\n\n");
|
|
76
|
+
}
|
|
77
|
+
// ── Depth verification state ──────────────────────────────────────────────
|
|
78
|
+
let depthVerificationDone = false;
|
|
79
|
+
// ── Queue phase tracking ──────────────────────────────────────────────────
|
|
80
|
+
// When true, the LLM is in a queue flow writing CONTEXT.md files.
|
|
81
|
+
// The write-gate applies during queue flows just like discussion flows.
|
|
82
|
+
let activeQueuePhase = false;
|
|
83
|
+
// ── Network error retry counters ──────────────────────────────────────────
|
|
84
|
+
// Tracks per-model retry attempts for transient network errors.
|
|
85
|
+
// Cleared when a model switch occurs or retries are exhausted.
|
|
86
|
+
const networkRetryCounters = new Map();
|
|
87
|
+
const MAX_TRANSIENT_AUTO_RESUMES = 3;
|
|
88
|
+
let consecutiveTransientErrors = 0;
|
|
89
|
+
export function isDepthVerified() {
|
|
90
|
+
return depthVerificationDone;
|
|
91
|
+
}
|
|
92
|
+
/** Check whether a queue phase is active. */
|
|
93
|
+
export function isQueuePhaseActive() {
|
|
94
|
+
return activeQueuePhase;
|
|
95
|
+
}
|
|
96
|
+
/** Set the queue phase state — called from guided-flow-queue.ts on dispatch. */
|
|
97
|
+
export function setQueuePhaseActive(active) {
|
|
98
|
+
activeQueuePhase = active;
|
|
99
|
+
}
|
|
100
|
+
// ── Write-gate: block CONTEXT.md writes during discussion without depth verification ──
|
|
101
|
+
const MILESTONE_CONTEXT_RE = /M\d+(?:-[a-z0-9]{6})?-CONTEXT\.md$/;
|
|
102
|
+
export function shouldBlockContextWrite(toolName, inputPath, milestoneId, depthVerified, queuePhaseActive) {
|
|
103
|
+
if (toolName !== "write")
|
|
104
|
+
return { block: false };
|
|
105
|
+
// Gate applies during both discussion (milestoneId set) and queue (queuePhaseActive) flows
|
|
106
|
+
const inDiscussion = milestoneId !== null;
|
|
107
|
+
const inQueue = queuePhaseActive ?? false;
|
|
108
|
+
if (!inDiscussion && !inQueue)
|
|
109
|
+
return { block: false };
|
|
110
|
+
if (!MILESTONE_CONTEXT_RE.test(inputPath))
|
|
111
|
+
return { block: false };
|
|
112
|
+
if (depthVerified)
|
|
113
|
+
return { block: false };
|
|
114
|
+
return {
|
|
115
|
+
block: true,
|
|
116
|
+
reason: `Blocked: Cannot write to milestone CONTEXT.md during discussion phase without depth verification. Call ask_user_questions with question id "depth_verification" first to confirm discussion depth before writing context.`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// ── ASCII logo ────────────────────────────────────────────────────────────
|
|
120
|
+
const GSD_LOGO_LINES = [
|
|
121
|
+
" ██████╗ ███████╗██████╗ ",
|
|
122
|
+
" ██╔════╝ ██╔════╝██╔══██╗",
|
|
123
|
+
" ██║ ███╗███████╗██║ ██║",
|
|
124
|
+
" ██║ ██║╚════██║██║ ██║",
|
|
125
|
+
" ╚██████╔╝███████║██████╔╝",
|
|
126
|
+
" ╚═════╝ ╚══════╝╚═════╝ ",
|
|
127
|
+
];
|
|
128
|
+
export default function (pi) {
|
|
129
|
+
registerGSDCommand(pi);
|
|
130
|
+
registerWorktreeCommand(pi);
|
|
131
|
+
registerExitCommand(pi);
|
|
132
|
+
// ── EPIPE guard — prevent crash when stdout/stderr pipe closes unexpectedly ──
|
|
133
|
+
// Node.js throws a fatal `Error: write EPIPE` when the parent process closes
|
|
134
|
+
// its end of the stdio pipe (e.g. during shell/IPC teardown) while auto-mode
|
|
135
|
+
// is still writing diagnostics. Catching this here gives auto-mode a clean
|
|
136
|
+
// chance to persist state and pause instead of crashing (see issue #739).
|
|
137
|
+
if (!process.listeners("uncaughtException").some(l => l.name === "_gsdEpipeGuard")) {
|
|
138
|
+
const _gsdEpipeGuard = (err) => {
|
|
139
|
+
if (err.code === "EPIPE") {
|
|
140
|
+
// Pipe closed — nothing we can write; just exit cleanly
|
|
141
|
+
process.exit(0);
|
|
142
|
+
}
|
|
143
|
+
// Re-throw anything that isn't EPIPE so real crashes still surface
|
|
144
|
+
throw err;
|
|
145
|
+
};
|
|
146
|
+
process.on("uncaughtException", _gsdEpipeGuard);
|
|
147
|
+
}
|
|
148
|
+
// ── /kill — immediate exit (bypass cleanup) ─────────────────────────────
|
|
149
|
+
pi.registerCommand("kill", {
|
|
150
|
+
description: "Exit GSD immediately (no cleanup)",
|
|
151
|
+
handler: async (_args, _ctx) => {
|
|
152
|
+
process.exit(0);
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
// ── Dynamic-cwd bash tool with default timeout ────────────────────────
|
|
156
|
+
// The built-in bash tool captures cwd at startup. This replacement uses
|
|
157
|
+
// a spawnHook to read process.cwd() dynamically so that process.chdir()
|
|
158
|
+
// (used by /worktree switch) propagates to shell commands.
|
|
159
|
+
//
|
|
160
|
+
// The upstream SDK's bash tool has no default timeout — if the LLM omits
|
|
161
|
+
// the timeout parameter, commands run indefinitely, causing hangs on
|
|
162
|
+
// Windows where process killing is unreliable (see #40). We wrap execute
|
|
163
|
+
// to inject a 120-second default when no timeout is provided.
|
|
164
|
+
const baseBash = createBashTool(process.cwd(), {
|
|
165
|
+
spawnHook: (ctx) => ({ ...ctx, cwd: process.cwd() }),
|
|
166
|
+
});
|
|
167
|
+
const dynamicBash = {
|
|
168
|
+
...baseBash,
|
|
169
|
+
execute: async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
170
|
+
const paramsWithTimeout = {
|
|
171
|
+
...params,
|
|
172
|
+
timeout: params.timeout ?? DEFAULT_BASH_TIMEOUT_SECS,
|
|
173
|
+
};
|
|
174
|
+
return baseBash.execute(toolCallId, paramsWithTimeout, signal, onUpdate, ctx);
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
pi.registerTool(dynamicBash);
|
|
178
|
+
// ── Dynamic-cwd file tools (write, read, edit) ────────────────────────
|
|
179
|
+
// The built-in file tools capture cwd at startup. When process.chdir()
|
|
180
|
+
// moves us into a worktree, relative paths still resolve against the
|
|
181
|
+
// original launch directory. These replacements delegate to freshly-
|
|
182
|
+
// created tools on each call so that process.cwd() is read dynamically.
|
|
183
|
+
const baseWrite = createWriteTool(process.cwd());
|
|
184
|
+
const dynamicWrite = {
|
|
185
|
+
...baseWrite,
|
|
186
|
+
execute: async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
187
|
+
const fresh = createWriteTool(process.cwd());
|
|
188
|
+
return fresh.execute(toolCallId, params, signal, onUpdate, ctx);
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
pi.registerTool(dynamicWrite);
|
|
192
|
+
const baseRead = createReadTool(process.cwd());
|
|
193
|
+
const dynamicRead = {
|
|
194
|
+
...baseRead,
|
|
195
|
+
execute: async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
196
|
+
const fresh = createReadTool(process.cwd());
|
|
197
|
+
return fresh.execute(toolCallId, params, signal, onUpdate, ctx);
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
pi.registerTool(dynamicRead);
|
|
201
|
+
const baseEdit = createEditTool(process.cwd());
|
|
202
|
+
const dynamicEdit = {
|
|
203
|
+
...baseEdit,
|
|
204
|
+
execute: async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
205
|
+
const fresh = createEditTool(process.cwd());
|
|
206
|
+
return fresh.execute(toolCallId, params, signal, onUpdate, ctx);
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
pi.registerTool(dynamicEdit);
|
|
210
|
+
// ── Structured LLM tools — DB-first write path (R014) ──────────────────
|
|
211
|
+
pi.registerTool({
|
|
212
|
+
name: "gsd_save_decision",
|
|
213
|
+
label: "Save Decision",
|
|
214
|
+
description: "Record a project decision to the GSD database and regenerate DECISIONS.md. " +
|
|
215
|
+
"Decision IDs are auto-assigned — never provide an ID manually.",
|
|
216
|
+
promptSnippet: "Record a project decision to the GSD database (auto-assigns ID, regenerates DECISIONS.md)",
|
|
217
|
+
promptGuidelines: [
|
|
218
|
+
"Use gsd_save_decision when recording an architectural, pattern, library, or observability decision.",
|
|
219
|
+
"Decision IDs are auto-assigned (D001, D002, ...) — never guess or provide an ID.",
|
|
220
|
+
"All fields except revisable and when_context are required.",
|
|
221
|
+
"The tool writes to the DB and regenerates .gsd/DECISIONS.md automatically.",
|
|
222
|
+
],
|
|
223
|
+
parameters: Type.Object({
|
|
224
|
+
scope: Type.String({ description: "Scope of the decision (e.g. 'architecture', 'library', 'observability')" }),
|
|
225
|
+
decision: Type.String({ description: "What is being decided" }),
|
|
226
|
+
choice: Type.String({ description: "The choice made" }),
|
|
227
|
+
rationale: Type.String({ description: "Why this choice was made" }),
|
|
228
|
+
revisable: Type.Optional(Type.String({ description: "Whether this can be revisited (default: 'Yes')" })),
|
|
229
|
+
when_context: Type.Optional(Type.String({ description: "When/context for the decision (e.g. milestone ID)" })),
|
|
230
|
+
}),
|
|
231
|
+
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
232
|
+
// Check DB availability
|
|
233
|
+
let dbAvailable = false;
|
|
234
|
+
try {
|
|
235
|
+
const db = await import("./gsd-db.js");
|
|
236
|
+
dbAvailable = db.isDbAvailable();
|
|
237
|
+
}
|
|
238
|
+
catch { /* dynamic import failed */ }
|
|
239
|
+
if (!dbAvailable) {
|
|
240
|
+
return {
|
|
241
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot save decision." }],
|
|
242
|
+
isError: true,
|
|
243
|
+
details: { operation: "save_decision", error: "db_unavailable" },
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
const { saveDecisionToDb } = await import("./db-writer.js");
|
|
248
|
+
const { id } = await saveDecisionToDb({
|
|
249
|
+
scope: params.scope,
|
|
250
|
+
decision: params.decision,
|
|
251
|
+
choice: params.choice,
|
|
252
|
+
rationale: params.rationale,
|
|
253
|
+
revisable: params.revisable,
|
|
254
|
+
when_context: params.when_context,
|
|
255
|
+
}, process.cwd());
|
|
256
|
+
return {
|
|
257
|
+
content: [{ type: "text", text: `Saved decision ${id}` }],
|
|
258
|
+
details: { operation: "save_decision", id },
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
catch (err) {
|
|
262
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
263
|
+
process.stderr.write(`gsd-db: gsd_save_decision tool failed: ${msg}\n`);
|
|
264
|
+
return {
|
|
265
|
+
content: [{ type: "text", text: `Error saving decision: ${msg}` }],
|
|
266
|
+
isError: true,
|
|
267
|
+
details: { operation: "save_decision", error: msg },
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
pi.registerTool({
|
|
273
|
+
name: "gsd_update_requirement",
|
|
274
|
+
label: "Update Requirement",
|
|
275
|
+
description: "Update an existing requirement in the GSD database and regenerate REQUIREMENTS.md. " +
|
|
276
|
+
"Provide the requirement ID (e.g. R001) and any fields to update.",
|
|
277
|
+
promptSnippet: "Update an existing GSD requirement by ID (regenerates REQUIREMENTS.md)",
|
|
278
|
+
promptGuidelines: [
|
|
279
|
+
"Use gsd_update_requirement to change status, validation, notes, or other fields on an existing requirement.",
|
|
280
|
+
"The id parameter is required — it must be an existing RXXX identifier.",
|
|
281
|
+
"All other fields are optional — only provided fields are updated.",
|
|
282
|
+
"The tool verifies the requirement exists before updating.",
|
|
283
|
+
],
|
|
284
|
+
parameters: Type.Object({
|
|
285
|
+
id: Type.String({ description: "The requirement ID (e.g. R001, R014)" }),
|
|
286
|
+
status: Type.Optional(Type.String({ description: "New status (e.g. 'active', 'validated', 'deferred')" })),
|
|
287
|
+
validation: Type.Optional(Type.String({ description: "Validation criteria or proof" })),
|
|
288
|
+
notes: Type.Optional(Type.String({ description: "Additional notes" })),
|
|
289
|
+
description: Type.Optional(Type.String({ description: "Updated description" })),
|
|
290
|
+
primary_owner: Type.Optional(Type.String({ description: "Primary owning slice" })),
|
|
291
|
+
supporting_slices: Type.Optional(Type.String({ description: "Supporting slices" })),
|
|
292
|
+
}),
|
|
293
|
+
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
294
|
+
let dbAvailable = false;
|
|
295
|
+
try {
|
|
296
|
+
const db = await import("./gsd-db.js");
|
|
297
|
+
dbAvailable = db.isDbAvailable();
|
|
298
|
+
}
|
|
299
|
+
catch { /* dynamic import failed */ }
|
|
300
|
+
if (!dbAvailable) {
|
|
301
|
+
return {
|
|
302
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot update requirement." }],
|
|
303
|
+
isError: true,
|
|
304
|
+
details: { operation: "update_requirement", id: params.id, error: "db_unavailable" },
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
// Verify requirement exists
|
|
309
|
+
const db = await import("./gsd-db.js");
|
|
310
|
+
const existing = db.getRequirementById(params.id);
|
|
311
|
+
if (!existing) {
|
|
312
|
+
return {
|
|
313
|
+
content: [{ type: "text", text: `Error: Requirement ${params.id} not found.` }],
|
|
314
|
+
isError: true,
|
|
315
|
+
details: { operation: "update_requirement", id: params.id, error: "not_found" },
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
const { updateRequirementInDb } = await import("./db-writer.js");
|
|
319
|
+
const updates = {};
|
|
320
|
+
if (params.status !== undefined)
|
|
321
|
+
updates.status = params.status;
|
|
322
|
+
if (params.validation !== undefined)
|
|
323
|
+
updates.validation = params.validation;
|
|
324
|
+
if (params.notes !== undefined)
|
|
325
|
+
updates.notes = params.notes;
|
|
326
|
+
if (params.description !== undefined)
|
|
327
|
+
updates.description = params.description;
|
|
328
|
+
if (params.primary_owner !== undefined)
|
|
329
|
+
updates.primary_owner = params.primary_owner;
|
|
330
|
+
if (params.supporting_slices !== undefined)
|
|
331
|
+
updates.supporting_slices = params.supporting_slices;
|
|
332
|
+
await updateRequirementInDb(params.id, updates, process.cwd());
|
|
333
|
+
return {
|
|
334
|
+
content: [{ type: "text", text: `Updated requirement ${params.id}` }],
|
|
335
|
+
details: { operation: "update_requirement", id: params.id },
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
catch (err) {
|
|
339
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
340
|
+
process.stderr.write(`gsd-db: gsd_update_requirement tool failed: ${msg}\n`);
|
|
341
|
+
return {
|
|
342
|
+
content: [{ type: "text", text: `Error updating requirement: ${msg}` }],
|
|
343
|
+
isError: true,
|
|
344
|
+
details: { operation: "update_requirement", id: params.id, error: msg },
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
pi.registerTool({
|
|
350
|
+
name: "gsd_save_summary",
|
|
351
|
+
label: "Save Summary",
|
|
352
|
+
description: "Save a summary, research, context, or assessment artifact to the GSD database and write it to disk. " +
|
|
353
|
+
"Computes the file path from milestone/slice/task IDs automatically.",
|
|
354
|
+
promptSnippet: "Save a GSD artifact (summary/research/context/assessment) to DB and disk",
|
|
355
|
+
promptGuidelines: [
|
|
356
|
+
"Use gsd_save_summary to persist structured artifacts (SUMMARY, RESEARCH, CONTEXT, ASSESSMENT).",
|
|
357
|
+
"milestone_id is required. slice_id and task_id are optional — they determine the file path.",
|
|
358
|
+
"The tool computes the relative path automatically: milestones/M001/M001-SUMMARY.md, milestones/M001/slices/S01/S01-SUMMARY.md, etc.",
|
|
359
|
+
"artifact_type must be one of: SUMMARY, RESEARCH, CONTEXT, ASSESSMENT.",
|
|
360
|
+
],
|
|
361
|
+
parameters: Type.Object({
|
|
362
|
+
milestone_id: Type.String({ description: "Milestone ID (e.g. M001)" }),
|
|
363
|
+
slice_id: Type.Optional(Type.String({ description: "Slice ID (e.g. S01)" })),
|
|
364
|
+
task_id: Type.Optional(Type.String({ description: "Task ID (e.g. T01)" })),
|
|
365
|
+
artifact_type: Type.String({ description: "One of: SUMMARY, RESEARCH, CONTEXT, ASSESSMENT" }),
|
|
366
|
+
content: Type.String({ description: "The full markdown content of the artifact" }),
|
|
367
|
+
}),
|
|
368
|
+
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
369
|
+
let dbAvailable = false;
|
|
370
|
+
try {
|
|
371
|
+
const db = await import("./gsd-db.js");
|
|
372
|
+
dbAvailable = db.isDbAvailable();
|
|
373
|
+
}
|
|
374
|
+
catch { /* dynamic import failed */ }
|
|
375
|
+
if (!dbAvailable) {
|
|
376
|
+
return {
|
|
377
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot save artifact." }],
|
|
378
|
+
isError: true,
|
|
379
|
+
details: { operation: "save_summary", error: "db_unavailable" },
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
// Validate artifact_type
|
|
383
|
+
const validTypes = ["SUMMARY", "RESEARCH", "CONTEXT", "ASSESSMENT"];
|
|
384
|
+
if (!validTypes.includes(params.artifact_type)) {
|
|
385
|
+
return {
|
|
386
|
+
content: [{ type: "text", text: `Error: Invalid artifact_type "${params.artifact_type}". Must be one of: ${validTypes.join(", ")}` }],
|
|
387
|
+
isError: true,
|
|
388
|
+
details: { operation: "save_summary", error: "invalid_artifact_type" },
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
try {
|
|
392
|
+
// Compute relative path from IDs
|
|
393
|
+
let relativePath;
|
|
394
|
+
if (params.task_id && params.slice_id) {
|
|
395
|
+
relativePath = `milestones/${params.milestone_id}/slices/${params.slice_id}/tasks/${params.task_id}-${params.artifact_type}.md`;
|
|
396
|
+
}
|
|
397
|
+
else if (params.slice_id) {
|
|
398
|
+
relativePath = `milestones/${params.milestone_id}/slices/${params.slice_id}/${params.slice_id}-${params.artifact_type}.md`;
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
relativePath = `milestones/${params.milestone_id}/${params.milestone_id}-${params.artifact_type}.md`;
|
|
402
|
+
}
|
|
403
|
+
const { saveArtifactToDb } = await import("./db-writer.js");
|
|
404
|
+
await saveArtifactToDb({
|
|
405
|
+
path: relativePath,
|
|
406
|
+
artifact_type: params.artifact_type,
|
|
407
|
+
content: params.content,
|
|
408
|
+
milestone_id: params.milestone_id,
|
|
409
|
+
slice_id: params.slice_id,
|
|
410
|
+
task_id: params.task_id,
|
|
411
|
+
}, process.cwd());
|
|
412
|
+
return {
|
|
413
|
+
content: [{ type: "text", text: `Saved ${params.artifact_type} artifact to ${relativePath}` }],
|
|
414
|
+
details: { operation: "save_summary", path: relativePath, artifact_type: params.artifact_type },
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
catch (err) {
|
|
418
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
419
|
+
process.stderr.write(`gsd-db: gsd_save_summary tool failed: ${msg}\n`);
|
|
420
|
+
return {
|
|
421
|
+
content: [{ type: "text", text: `Error saving artifact: ${msg}` }],
|
|
422
|
+
isError: true,
|
|
423
|
+
details: { operation: "save_summary", error: msg },
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
// ── gsd_generate_milestone_id — canonical milestone ID generation ──────
|
|
429
|
+
// The LLM cannot generate random suffixes for unique_milestone_ids on its
|
|
430
|
+
// own. This tool calls back into the TS code that owns ID generation,
|
|
431
|
+
// ensuring the preference is always respected and IDs are always valid.
|
|
432
|
+
//
|
|
433
|
+
// Reservation set: tracks IDs returned by this tool but not yet persisted
|
|
434
|
+
// to disk, preventing duplicate M001 when called multiple times (#961).
|
|
435
|
+
const reservedMilestoneIds = new Set();
|
|
436
|
+
pi.registerTool({
|
|
437
|
+
name: "gsd_generate_milestone_id",
|
|
438
|
+
label: "Generate Milestone ID",
|
|
439
|
+
description: "Generate the next milestone ID for a new GSD milestone. " +
|
|
440
|
+
"Scans existing milestones on disk and respects the unique_milestone_ids preference. " +
|
|
441
|
+
"Always use this tool when creating a new milestone — never invent milestone IDs manually.",
|
|
442
|
+
promptSnippet: "Generate a valid milestone ID (respects unique_milestone_ids preference)",
|
|
443
|
+
promptGuidelines: [
|
|
444
|
+
"ALWAYS call gsd_generate_milestone_id before creating a new milestone directory or writing milestone files.",
|
|
445
|
+
"Never invent or hardcode milestone IDs like M001, M002 — always use this tool.",
|
|
446
|
+
"Call it once per milestone you need to create. For multi-milestone projects, call it once for each milestone in sequence.",
|
|
447
|
+
"The tool returns the correct format based on project preferences (e.g. M001 or M001-r5jzab).",
|
|
448
|
+
],
|
|
449
|
+
parameters: Type.Object({}),
|
|
450
|
+
async execute(_toolCallId, _params, _signal, _onUpdate, _ctx) {
|
|
451
|
+
try {
|
|
452
|
+
const basePath = process.cwd();
|
|
453
|
+
const existingIds = findMilestoneIds(basePath);
|
|
454
|
+
const uniqueEnabled = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
455
|
+
// Combine on-disk IDs with previously reserved (but not yet persisted) IDs
|
|
456
|
+
const allIds = [...new Set([...existingIds, ...reservedMilestoneIds])];
|
|
457
|
+
const newId = nextMilestoneId(allIds, uniqueEnabled);
|
|
458
|
+
reservedMilestoneIds.add(newId);
|
|
459
|
+
return {
|
|
460
|
+
content: [{ type: "text", text: newId }],
|
|
461
|
+
details: { operation: "generate_milestone_id", id: newId, existingCount: existingIds.length, reservedCount: reservedMilestoneIds.size, uniqueEnabled },
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
catch (err) {
|
|
465
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
466
|
+
return {
|
|
467
|
+
content: [{ type: "text", text: `Error generating milestone ID: ${msg}` }],
|
|
468
|
+
isError: true,
|
|
469
|
+
details: { operation: "generate_milestone_id", error: msg },
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
});
|
|
474
|
+
// ── session_start: render branded GSD header + load tool keys + remote status ──
|
|
475
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
476
|
+
// Clear per-session state that must not leak across sessions (e.g. RPC mode)
|
|
477
|
+
depthVerificationDone = false;
|
|
478
|
+
// Theme access throws in RPC mode (no TUI) — header is decorative, skip it
|
|
479
|
+
try {
|
|
480
|
+
const theme = ctx.ui.theme;
|
|
481
|
+
const version = process.env.GSD_VERSION || "0.0.0";
|
|
482
|
+
const logoText = GSD_LOGO_LINES.map((line) => theme.fg("accent", line)).join("\n");
|
|
483
|
+
const titleLine = ` ${theme.bold("Get Shit Done")} ${theme.fg("dim", `v${version}`)}`;
|
|
484
|
+
const headerContent = `${logoText}\n${titleLine}`;
|
|
485
|
+
ctx.ui.setHeader((_ui, _theme) => new Text(headerContent, 1, 0));
|
|
486
|
+
}
|
|
487
|
+
catch {
|
|
488
|
+
// RPC mode — no TUI, skip header rendering
|
|
489
|
+
}
|
|
490
|
+
// Load tool API keys from auth.json into environment
|
|
491
|
+
loadToolApiKeys();
|
|
492
|
+
// Notify remote questions status if configured
|
|
493
|
+
try {
|
|
494
|
+
const [{ getRemoteConfigStatus }, { getLatestPromptSummary }] = await Promise.all([
|
|
495
|
+
import("../remote-questions/config.js"),
|
|
496
|
+
import("../remote-questions/status.js"),
|
|
497
|
+
]);
|
|
498
|
+
const status = getRemoteConfigStatus();
|
|
499
|
+
const latest = getLatestPromptSummary();
|
|
500
|
+
if (!status.includes("not configured")) {
|
|
501
|
+
const suffix = latest ? `\nLast remote prompt: ${latest.id} (${latest.status})` : "";
|
|
502
|
+
ctx.ui.notify(`${status}${suffix}`, status.includes("disabled") ? "warning" : "info");
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
catch {
|
|
506
|
+
// Remote questions module not available — ignore
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
// ── Ctrl+Alt+G shortcut — GSD dashboard overlay ────────────────────────
|
|
510
|
+
pi.registerShortcut(Key.ctrlAlt("g"), {
|
|
511
|
+
description: shortcutDesc("Open GSD dashboard", "/gsd status"),
|
|
512
|
+
handler: async (ctx) => {
|
|
513
|
+
// Only show if .gsd/ exists
|
|
514
|
+
if (!existsSync(join(process.cwd(), ".gsd"))) {
|
|
515
|
+
ctx.ui.notify("No .gsd/ directory found. Run /gsd to start.", "info");
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
await ctx.ui.custom((tui, theme, _kb, done) => {
|
|
519
|
+
return new GSDDashboardOverlay(tui, theme, () => done());
|
|
520
|
+
}, {
|
|
521
|
+
overlay: true,
|
|
522
|
+
overlayOptions: {
|
|
523
|
+
width: "90%",
|
|
524
|
+
minWidth: 80,
|
|
525
|
+
maxHeight: "92%",
|
|
526
|
+
anchor: "center",
|
|
527
|
+
},
|
|
528
|
+
});
|
|
529
|
+
},
|
|
530
|
+
});
|
|
531
|
+
// ── before_agent_start: inject GSD contract into true system prompt ─────
|
|
532
|
+
pi.on("before_agent_start", async (event, ctx) => {
|
|
533
|
+
if (!existsSync(join(process.cwd(), ".gsd")))
|
|
534
|
+
return;
|
|
535
|
+
const stopContextTimer = debugTime("context-inject");
|
|
536
|
+
const systemContent = loadPrompt("system");
|
|
537
|
+
const loadedPreferences = loadEffectiveGSDPreferences();
|
|
538
|
+
let preferenceBlock = "";
|
|
539
|
+
if (loadedPreferences) {
|
|
540
|
+
const cwd = process.cwd();
|
|
541
|
+
const report = resolveAllSkillReferences(loadedPreferences.preferences, cwd);
|
|
542
|
+
preferenceBlock = `\n\n${renderPreferencesForSystemPrompt(loadedPreferences.preferences, report.resolutions)}`;
|
|
543
|
+
// Emit warnings for unresolved skill references
|
|
544
|
+
if (report.warnings.length > 0) {
|
|
545
|
+
ctx.ui.notify(`GSD skill preferences: ${report.warnings.length} unresolved skill${report.warnings.length === 1 ? "" : "s"}: ${report.warnings.join(", ")}`, "warning");
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
// Load project knowledge if available
|
|
549
|
+
let knowledgeBlock = "";
|
|
550
|
+
const knowledgePath = resolveGsdRootFile(process.cwd(), "KNOWLEDGE");
|
|
551
|
+
if (existsSync(knowledgePath)) {
|
|
552
|
+
try {
|
|
553
|
+
const content = readFileSync(knowledgePath, "utf-8").trim();
|
|
554
|
+
if (content) {
|
|
555
|
+
knowledgeBlock = `\n\n[PROJECT KNOWLEDGE — Rules, patterns, and lessons learned]\n\n${content}`;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
catch {
|
|
559
|
+
// File read error — skip knowledge injection
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
// Inject auto-learned project memories
|
|
563
|
+
let memoryBlock = "";
|
|
564
|
+
try {
|
|
565
|
+
const { getActiveMemoriesRanked, formatMemoriesForPrompt } = await import("./memory-store.js");
|
|
566
|
+
const memories = getActiveMemoriesRanked(30);
|
|
567
|
+
if (memories.length > 0) {
|
|
568
|
+
const formatted = formatMemoriesForPrompt(memories, 2000);
|
|
569
|
+
if (formatted) {
|
|
570
|
+
memoryBlock = `\n\n${formatted}`;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
catch { /* non-fatal */ }
|
|
575
|
+
// Detect skills installed during this auto-mode session
|
|
576
|
+
let newSkillsBlock = "";
|
|
577
|
+
if (hasSkillSnapshot()) {
|
|
578
|
+
const newSkills = detectNewSkills();
|
|
579
|
+
if (newSkills.length > 0) {
|
|
580
|
+
newSkillsBlock = formatSkillsXml(newSkills);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
// Load agent instructions (global + project)
|
|
584
|
+
let agentInstructionsBlock = "";
|
|
585
|
+
const agentInstructions = loadAgentInstructions();
|
|
586
|
+
if (agentInstructions) {
|
|
587
|
+
agentInstructionsBlock = `\n\n## Agent Instructions\n\nThe following instructions were provided by the user and must be followed in every session:\n\n${agentInstructions}`;
|
|
588
|
+
}
|
|
589
|
+
const injection = await buildGuidedExecuteContextInjection(event.prompt, process.cwd());
|
|
590
|
+
// Worktree context — override the static CWD in the system prompt
|
|
591
|
+
let worktreeBlock = "";
|
|
592
|
+
const worktreeName = getActiveWorktreeName();
|
|
593
|
+
const worktreeMainCwd = getWorktreeOriginalCwd();
|
|
594
|
+
const autoWorktree = getActiveAutoWorktreeContext();
|
|
595
|
+
if (worktreeName && worktreeMainCwd) {
|
|
596
|
+
worktreeBlock = [
|
|
597
|
+
"",
|
|
598
|
+
"",
|
|
599
|
+
"[WORKTREE CONTEXT — OVERRIDES CURRENT WORKING DIRECTORY ABOVE]",
|
|
600
|
+
`IMPORTANT: Ignore the "Current working directory" shown earlier in this prompt.`,
|
|
601
|
+
`The actual current working directory is: ${toPosixPath(process.cwd())}`,
|
|
602
|
+
"",
|
|
603
|
+
`You are working inside a GSD worktree.`,
|
|
604
|
+
`- Worktree name: ${worktreeName}`,
|
|
605
|
+
`- Worktree path (this is the real cwd): ${toPosixPath(process.cwd())}`,
|
|
606
|
+
`- Main project: ${toPosixPath(worktreeMainCwd)}`,
|
|
607
|
+
`- Branch: worktree/${worktreeName}`,
|
|
608
|
+
"",
|
|
609
|
+
"All file operations, bash commands, and GSD state resolve against the worktree path above.",
|
|
610
|
+
"Use /worktree merge to merge changes back. Use /worktree return to switch back to the main tree.",
|
|
611
|
+
].join("\n");
|
|
612
|
+
}
|
|
613
|
+
else if (autoWorktree) {
|
|
614
|
+
worktreeBlock = [
|
|
615
|
+
"",
|
|
616
|
+
"",
|
|
617
|
+
"[WORKTREE CONTEXT — OVERRIDES CURRENT WORKING DIRECTORY ABOVE]",
|
|
618
|
+
`IMPORTANT: Ignore the "Current working directory" shown earlier in this prompt.`,
|
|
619
|
+
`The actual current working directory is: ${toPosixPath(process.cwd())}`,
|
|
620
|
+
"",
|
|
621
|
+
"You are working inside a GSD auto-worktree.",
|
|
622
|
+
`- Milestone worktree: ${autoWorktree.worktreeName}`,
|
|
623
|
+
`- Worktree path (this is the real cwd): ${toPosixPath(process.cwd())}`,
|
|
624
|
+
`- Main project: ${toPosixPath(autoWorktree.originalBase)}`,
|
|
625
|
+
`- Branch: ${autoWorktree.branch}`,
|
|
626
|
+
"",
|
|
627
|
+
"All file operations, bash commands, and GSD state resolve against the worktree path above.",
|
|
628
|
+
"Write every .gsd artifact in the worktree path above, never in the main project tree.",
|
|
629
|
+
].join("\n");
|
|
630
|
+
}
|
|
631
|
+
const fullSystem = `${event.systemPrompt}\n\n[SYSTEM CONTEXT — GSD]\n\n${systemContent}${preferenceBlock}${agentInstructionsBlock}${knowledgeBlock}${memoryBlock}${newSkillsBlock}${worktreeBlock}`;
|
|
632
|
+
stopContextTimer({
|
|
633
|
+
systemPromptSize: fullSystem.length,
|
|
634
|
+
injectionSize: injection?.length ?? 0,
|
|
635
|
+
hasPreferences: preferenceBlock.length > 0,
|
|
636
|
+
hasNewSkills: newSkillsBlock.length > 0,
|
|
637
|
+
});
|
|
638
|
+
return {
|
|
639
|
+
systemPrompt: fullSystem,
|
|
640
|
+
...(injection
|
|
641
|
+
? {
|
|
642
|
+
message: {
|
|
643
|
+
customType: "gsd-guided-context",
|
|
644
|
+
content: injection,
|
|
645
|
+
display: false,
|
|
646
|
+
},
|
|
647
|
+
}
|
|
648
|
+
: {}),
|
|
649
|
+
};
|
|
650
|
+
});
|
|
651
|
+
// ── agent_end: auto-mode advancement or auto-start after discuss ───────────
|
|
652
|
+
pi.on("agent_end", async (event, ctx) => {
|
|
653
|
+
// If discuss phase just finished, start auto-mode
|
|
654
|
+
if (checkAutoStartAfterDiscuss()) {
|
|
655
|
+
depthVerificationDone = false;
|
|
656
|
+
activeQueuePhase = false;
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
// If auto-mode is already running, advance to next unit
|
|
660
|
+
if (!isAutoActive())
|
|
661
|
+
return;
|
|
662
|
+
// Fresh-session auto-mode intentionally aborts the previous session during
|
|
663
|
+
// cmdCtx.newSession(). Ignore that agent_end so we neither pause nor
|
|
664
|
+
// resolve the new unit with an event from the old session.
|
|
665
|
+
if (isSessionSwitchInFlight()) {
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
// If the agent was aborted (user pressed Escape) or hit a provider
|
|
669
|
+
// error (fetch failure, rate limit, etc.), pause auto-mode instead of
|
|
670
|
+
// advancing. This preserves the conversation so the user can inspect
|
|
671
|
+
// what happened, interact with the agent, or resume.
|
|
672
|
+
const lastMsg = event.messages[event.messages.length - 1];
|
|
673
|
+
if (lastMsg && "stopReason" in lastMsg && lastMsg.stopReason === "aborted") {
|
|
674
|
+
await pauseAuto(ctx, pi);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (lastMsg && "stopReason" in lastMsg && lastMsg.stopReason === "error") {
|
|
678
|
+
const errorDetail = "errorMessage" in lastMsg && lastMsg.errorMessage
|
|
679
|
+
? `: ${lastMsg.errorMessage}`
|
|
680
|
+
: "";
|
|
681
|
+
const errorMsg = ("errorMessage" in lastMsg && lastMsg.errorMessage) ? String(lastMsg.errorMessage) : "";
|
|
682
|
+
// ── Transient network error retry ──────────────────────────────────
|
|
683
|
+
// Before falling back to a different model, retry the current model
|
|
684
|
+
// for transient network errors (connection reset, timeout, DNS, etc.).
|
|
685
|
+
// This prevents providers with occasional network flakiness from being
|
|
686
|
+
// immediately abandoned in favor of fallback models (#941).
|
|
687
|
+
if (isTransientNetworkError(errorMsg)) {
|
|
688
|
+
const currentModelId = ctx.model?.id ?? "unknown";
|
|
689
|
+
const retryKey = `network-retry:${currentModelId}`;
|
|
690
|
+
const maxRetries = 2;
|
|
691
|
+
const currentRetries = networkRetryCounters.get(retryKey) ?? 0;
|
|
692
|
+
if (currentRetries < maxRetries) {
|
|
693
|
+
networkRetryCounters.set(retryKey, currentRetries + 1);
|
|
694
|
+
const attempt = currentRetries + 1;
|
|
695
|
+
const delayMs = attempt * 3000; // 3s, 6s backoff
|
|
696
|
+
ctx.ui.notify(`Network error on ${currentModelId}${errorDetail}. Retry ${attempt}/${maxRetries} in ${delayMs / 1000}s...`, "warning");
|
|
697
|
+
setTimeout(() => {
|
|
698
|
+
pi.sendMessage({ customType: "gsd-auto-timeout-recovery", content: "Continue execution — retrying after transient network error.", display: false }, { triggerTurn: true });
|
|
699
|
+
}, delayMs);
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
// Retries exhausted — clear counter and fall through to fallback logic
|
|
703
|
+
networkRetryCounters.delete(retryKey);
|
|
704
|
+
ctx.ui.notify(`Network retries exhausted for ${currentModelId}. Attempting model fallback.`, "warning");
|
|
705
|
+
}
|
|
706
|
+
const dash = getAutoDashboardData();
|
|
707
|
+
if (dash.currentUnit) {
|
|
708
|
+
const modelConfig = resolveModelWithFallbacksForUnit(dash.currentUnit.type);
|
|
709
|
+
if (modelConfig && modelConfig.fallbacks.length > 0) {
|
|
710
|
+
const availableModels = ctx.modelRegistry.getAvailable();
|
|
711
|
+
const currentModelId = ctx.model?.id;
|
|
712
|
+
const nextModelId = getNextFallbackModel(currentModelId, modelConfig);
|
|
713
|
+
if (nextModelId) {
|
|
714
|
+
// Clear any network retry counters when switching models
|
|
715
|
+
networkRetryCounters.clear();
|
|
716
|
+
let modelToSet;
|
|
717
|
+
const slashIdx = nextModelId.indexOf("/");
|
|
718
|
+
if (slashIdx !== -1) {
|
|
719
|
+
const provider = nextModelId.substring(0, slashIdx);
|
|
720
|
+
const id = nextModelId.substring(slashIdx + 1);
|
|
721
|
+
modelToSet = availableModels.find(m => m.provider.toLowerCase() === provider.toLowerCase()
|
|
722
|
+
&& m.id.toLowerCase() === id.toLowerCase());
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
const currentProvider = ctx.model?.provider;
|
|
726
|
+
const exactProviderMatch = availableModels.find(m => m.id === nextModelId && m.provider === currentProvider);
|
|
727
|
+
modelToSet = exactProviderMatch ?? availableModels.find(m => m.id === nextModelId);
|
|
728
|
+
}
|
|
729
|
+
if (modelToSet) {
|
|
730
|
+
const ok = await pi.setModel(modelToSet, { persist: false });
|
|
731
|
+
if (ok) {
|
|
732
|
+
ctx.ui.notify(`Model error${errorDetail}. Switched to fallback: ${nextModelId} and resuming.`, "warning");
|
|
733
|
+
// Trigger a generic "Continue execution" to resume the task since the previous attempt failed
|
|
734
|
+
pi.sendMessage({ customType: "gsd-auto-timeout-recovery", content: "Continue execution.", display: false }, { triggerTurn: true });
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
// ── Session model recovery (#1065) ──────────────────────────────────
|
|
742
|
+
// Before pausing, attempt to restore the model captured at auto-mode
|
|
743
|
+
// start. This prevents cross-session model leakage: when fallback
|
|
744
|
+
// chains are exhausted (or absent), the session retries with the model
|
|
745
|
+
// the user originally chose instead of reading (possibly stale) global
|
|
746
|
+
// preferences that another concurrent session may have modified.
|
|
747
|
+
const sessionModel = getAutoModeStartModel();
|
|
748
|
+
if (sessionModel) {
|
|
749
|
+
const currentModelId = ctx.model?.id;
|
|
750
|
+
const currentProvider = ctx.model?.provider;
|
|
751
|
+
// Only attempt recovery if the current model diverged from the session model
|
|
752
|
+
if (currentModelId !== sessionModel.id || currentProvider !== sessionModel.provider) {
|
|
753
|
+
const availableModels = ctx.modelRegistry.getAvailable();
|
|
754
|
+
const startModel = availableModels.find(m => m.provider === sessionModel.provider && m.id === sessionModel.id);
|
|
755
|
+
if (startModel) {
|
|
756
|
+
const ok = await pi.setModel(startModel, { persist: false });
|
|
757
|
+
if (ok) {
|
|
758
|
+
networkRetryCounters.clear();
|
|
759
|
+
ctx.ui.notify(`Model error${errorDetail}. Restored session model: ${sessionModel.provider}/${sessionModel.id} and resuming.`, "warning");
|
|
760
|
+
pi.sendMessage({ customType: "gsd-auto-timeout-recovery", content: "Continue execution.", display: false }, { triggerTurn: true });
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
// Classify the error: transient (auto-resume) vs permanent (manual resume)
|
|
767
|
+
const classification = classifyProviderError(errorMsg);
|
|
768
|
+
// Extract explicit retry-after from the message or response metadata
|
|
769
|
+
const explicitRetryAfterMs = ("retryAfterMs" in lastMsg && typeof lastMsg.retryAfterMs === "number")
|
|
770
|
+
? lastMsg.retryAfterMs
|
|
771
|
+
: undefined;
|
|
772
|
+
if (classification.isTransient) {
|
|
773
|
+
consecutiveTransientErrors += 1;
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
consecutiveTransientErrors = 0;
|
|
777
|
+
}
|
|
778
|
+
const baseRetryAfterMs = explicitRetryAfterMs ?? classification.suggestedDelayMs;
|
|
779
|
+
const retryAfterMs = classification.isTransient ? baseRetryAfterMs * 2 ** Math.max(0, consecutiveTransientErrors - 1) : baseRetryAfterMs;
|
|
780
|
+
const allowAutoResume = classification.isTransient
|
|
781
|
+
&& consecutiveTransientErrors <= MAX_TRANSIENT_AUTO_RESUMES;
|
|
782
|
+
if (classification.isTransient && !allowAutoResume) {
|
|
783
|
+
ctx.ui.notify(`Transient provider errors persisted after ${MAX_TRANSIENT_AUTO_RESUMES} auto-resume attempts. Pausing for manual review.`, "warning");
|
|
784
|
+
}
|
|
785
|
+
await pauseAutoForProviderError(ctx.ui, errorDetail, () => pauseAuto(ctx, pi), {
|
|
786
|
+
isRateLimit: classification.isRateLimit,
|
|
787
|
+
isTransient: allowAutoResume,
|
|
788
|
+
retryAfterMs,
|
|
789
|
+
resume: allowAutoResume
|
|
790
|
+
? () => {
|
|
791
|
+
pi.sendMessage({ customType: "gsd-auto-timeout-recovery", content: "Continue execution \u2014 provider error recovery delay elapsed.", display: false }, { triggerTurn: true });
|
|
792
|
+
}
|
|
793
|
+
: undefined,
|
|
794
|
+
});
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
try {
|
|
798
|
+
consecutiveTransientErrors = 0;
|
|
799
|
+
networkRetryCounters.clear(); // Clear network retry state on successful unit completion
|
|
800
|
+
resolveAgentEnd(event);
|
|
801
|
+
}
|
|
802
|
+
catch (err) {
|
|
803
|
+
// Safety net: if resolveAgentEnd throws, ensure auto-mode stops gracefully (#381).
|
|
804
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
805
|
+
ctx.ui.notify(`Auto-mode error in agent_end handler: ${message}. Stopping auto-mode.`, "error");
|
|
806
|
+
try {
|
|
807
|
+
await pauseAuto(ctx, pi);
|
|
808
|
+
}
|
|
809
|
+
catch {
|
|
810
|
+
// Last resort — at least log
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
// ── session_before_compact ────────────────────────────────────────────────
|
|
815
|
+
pi.on("session_before_compact", async (_event, _ctx) => {
|
|
816
|
+
// Block compaction during auto-mode — each unit is a fresh session
|
|
817
|
+
// Also block during paused state — context is valuable for the user
|
|
818
|
+
if (isAutoActive() || isAutoPaused()) {
|
|
819
|
+
return { cancel: true };
|
|
820
|
+
}
|
|
821
|
+
const basePath = process.cwd();
|
|
822
|
+
const state = await deriveState(basePath);
|
|
823
|
+
// Only save continue.md if we're actively executing a task
|
|
824
|
+
if (!state.activeMilestone || !state.activeSlice || !state.activeTask)
|
|
825
|
+
return;
|
|
826
|
+
if (state.phase !== "executing")
|
|
827
|
+
return;
|
|
828
|
+
const sDir = resolveSlicePath(basePath, state.activeMilestone.id, state.activeSlice.id);
|
|
829
|
+
if (!sDir)
|
|
830
|
+
return;
|
|
831
|
+
// Check for existing continue file (new naming or legacy)
|
|
832
|
+
const existingFile = resolveSliceFile(basePath, state.activeMilestone.id, state.activeSlice.id, "CONTINUE");
|
|
833
|
+
if (existingFile && await loadFile(existingFile))
|
|
834
|
+
return;
|
|
835
|
+
const legacyContinue = join(sDir, "continue.md");
|
|
836
|
+
if (await loadFile(legacyContinue))
|
|
837
|
+
return;
|
|
838
|
+
const continuePath = join(sDir, buildSliceFileName(state.activeSlice.id, "CONTINUE"));
|
|
839
|
+
const continueData = {
|
|
840
|
+
frontmatter: {
|
|
841
|
+
milestone: state.activeMilestone.id,
|
|
842
|
+
slice: state.activeSlice.id,
|
|
843
|
+
task: state.activeTask.id,
|
|
844
|
+
step: 0,
|
|
845
|
+
totalSteps: 0,
|
|
846
|
+
status: "compacted",
|
|
847
|
+
savedAt: new Date().toISOString(),
|
|
848
|
+
},
|
|
849
|
+
completedWork: `Task ${state.activeTask.id} (${state.activeTask.title}) was in progress when compaction occurred.`,
|
|
850
|
+
remainingWork: "Check the task plan for remaining steps.",
|
|
851
|
+
decisions: "Check task summary files for prior decisions.",
|
|
852
|
+
context: "Session was auto-compacted by Pi. Resume with /gsd.",
|
|
853
|
+
nextAction: `Resume task ${state.activeTask.id}: ${state.activeTask.title}.`,
|
|
854
|
+
};
|
|
855
|
+
await saveFile(continuePath, formatContinue(continueData));
|
|
856
|
+
});
|
|
857
|
+
// ── session_shutdown: save activity log on Ctrl+C / SIGTERM ─────────────
|
|
858
|
+
pi.on("session_shutdown", async (_event, ctx) => {
|
|
859
|
+
if (isParallelActive()) {
|
|
860
|
+
try {
|
|
861
|
+
await shutdownParallel(process.cwd());
|
|
862
|
+
}
|
|
863
|
+
catch { /* best-effort */ }
|
|
864
|
+
}
|
|
865
|
+
if (!isAutoActive() && !isAutoPaused())
|
|
866
|
+
return;
|
|
867
|
+
// Save the current session — the lock file stays on disk
|
|
868
|
+
// so the next /gsd auto knows it was interrupted
|
|
869
|
+
const dash = getAutoDashboardData();
|
|
870
|
+
if (dash.currentUnit) {
|
|
871
|
+
saveActivityLog(ctx, dash.basePath, dash.currentUnit.type, dash.currentUnit.id);
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
// ── tool_call: block CONTEXT.md writes during discussion without depth verification ──
|
|
875
|
+
pi.on("tool_call", async (event) => {
|
|
876
|
+
if (!isToolCallEventType("write", event))
|
|
877
|
+
return;
|
|
878
|
+
const result = shouldBlockContextWrite(event.toolName, event.input.path, getDiscussionMilestoneId(), isDepthVerified(), activeQueuePhase);
|
|
879
|
+
if (result.block)
|
|
880
|
+
return result;
|
|
881
|
+
});
|
|
882
|
+
// ── tool_result: persist discussion exchanges & detect depth gate ──────
|
|
883
|
+
pi.on("tool_result", async (event) => {
|
|
884
|
+
if (event.toolName !== "ask_user_questions")
|
|
885
|
+
return;
|
|
886
|
+
const milestoneId = getDiscussionMilestoneId();
|
|
887
|
+
if (!milestoneId)
|
|
888
|
+
return;
|
|
889
|
+
const details = event.details;
|
|
890
|
+
if (details?.cancelled || !details?.response)
|
|
891
|
+
return;
|
|
892
|
+
// ── Depth gate detection ──────────────────────────────────────────
|
|
893
|
+
const questions = event.input?.questions ?? [];
|
|
894
|
+
for (const q of questions) {
|
|
895
|
+
if (typeof q.id === "string" && q.id.includes("depth_verification")) {
|
|
896
|
+
depthVerificationDone = true;
|
|
897
|
+
break;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
// ── Persist exchange to DISCUSSION.md ──────────────────────────────
|
|
901
|
+
const basePath = process.cwd();
|
|
902
|
+
const milestoneDir = resolveMilestonePath(basePath, milestoneId);
|
|
903
|
+
if (!milestoneDir)
|
|
904
|
+
return;
|
|
905
|
+
const fileName = buildMilestoneFileName(milestoneId, "DISCUSSION");
|
|
906
|
+
const discussionPath = join(milestoneDir, fileName);
|
|
907
|
+
const timestamp = new Date().toISOString();
|
|
908
|
+
// Format exchange as markdown
|
|
909
|
+
const lines = [`## Exchange — ${timestamp}`, ""];
|
|
910
|
+
for (const q of questions) {
|
|
911
|
+
lines.push(`### ${q.header ?? "Question"}`);
|
|
912
|
+
lines.push("");
|
|
913
|
+
lines.push(q.question ?? "");
|
|
914
|
+
if (Array.isArray(q.options)) {
|
|
915
|
+
lines.push("");
|
|
916
|
+
for (const opt of q.options) {
|
|
917
|
+
lines.push(`- **${opt.label}** — ${opt.description ?? ""}`);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
// Append user response for this question
|
|
921
|
+
const answer = details.response?.answers?.[q.id];
|
|
922
|
+
if (answer) {
|
|
923
|
+
lines.push("");
|
|
924
|
+
const selected = Array.isArray(answer.selected) ? answer.selected.join(", ") : answer.selected;
|
|
925
|
+
lines.push(`**Selected:** ${selected}`);
|
|
926
|
+
if (answer.notes) {
|
|
927
|
+
lines.push(`**Notes:** ${answer.notes}`);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
lines.push("");
|
|
931
|
+
}
|
|
932
|
+
lines.push("---", "");
|
|
933
|
+
const newBlock = lines.join("\n");
|
|
934
|
+
const existing = await loadFile(discussionPath) ?? `# ${milestoneId} Discussion Log\n\n`;
|
|
935
|
+
await saveFile(discussionPath, existing + newBlock);
|
|
936
|
+
});
|
|
937
|
+
// ── tool_execution_start/end: track in-flight tools for idle detection ──
|
|
938
|
+
pi.on("tool_execution_start", async (event) => {
|
|
939
|
+
if (!isAutoActive())
|
|
940
|
+
return;
|
|
941
|
+
markToolStart(event.toolCallId);
|
|
942
|
+
});
|
|
943
|
+
pi.on("tool_execution_end", async (event) => {
|
|
944
|
+
markToolEnd(event.toolCallId);
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
async function buildGuidedExecuteContextInjection(prompt, basePath) {
|
|
948
|
+
const executeMatch = prompt.match(/Execute the next task:\s+(T\d+)\s+\("([^"]+)"\)\s+in slice\s+(S\d+)\s+of milestone\s+(M\d+(?:-[a-z0-9]{6})?)/i);
|
|
949
|
+
if (executeMatch) {
|
|
950
|
+
const [, taskId, taskTitle, sliceId, milestoneId] = executeMatch;
|
|
951
|
+
return buildTaskExecutionContextInjection(basePath, milestoneId, sliceId, taskId, taskTitle);
|
|
952
|
+
}
|
|
953
|
+
const resumeMatch = prompt.match(/Resume interrupted work\.[\s\S]*?slice\s+(S\d+)\s+of milestone\s+(M\d+(?:-[a-z0-9]{6})?)/i);
|
|
954
|
+
if (resumeMatch) {
|
|
955
|
+
const [, sliceId, milestoneId] = resumeMatch;
|
|
956
|
+
const state = await deriveState(basePath);
|
|
957
|
+
if (state.activeMilestone?.id === milestoneId &&
|
|
958
|
+
state.activeSlice?.id === sliceId &&
|
|
959
|
+
state.activeTask) {
|
|
960
|
+
return buildTaskExecutionContextInjection(basePath, milestoneId, sliceId, state.activeTask.id, state.activeTask.title);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
async function buildTaskExecutionContextInjection(basePath, milestoneId, sliceId, taskId, taskTitle) {
|
|
966
|
+
const taskPlanPath = resolveTaskFile(basePath, milestoneId, sliceId, taskId, "PLAN");
|
|
967
|
+
const taskPlanRelPath = relTaskFile(basePath, milestoneId, sliceId, taskId, "PLAN");
|
|
968
|
+
const taskPlanContent = taskPlanPath ? await loadFile(taskPlanPath) : null;
|
|
969
|
+
const taskPlanInline = taskPlanContent
|
|
970
|
+
? [
|
|
971
|
+
"## Inlined Task Plan (authoritative local execution contract)",
|
|
972
|
+
`Source: \`${taskPlanRelPath}\``,
|
|
973
|
+
"",
|
|
974
|
+
taskPlanContent.trim(),
|
|
975
|
+
].join("\n")
|
|
976
|
+
: [
|
|
977
|
+
"## Inlined Task Plan (authoritative local execution contract)",
|
|
978
|
+
`Task plan not found at dispatch time. Read \`${taskPlanRelPath}\` before executing.`,
|
|
979
|
+
].join("\n");
|
|
980
|
+
const slicePlanPath = resolveSliceFile(basePath, milestoneId, sliceId, "PLAN");
|
|
981
|
+
const slicePlanRelPath = relSliceFile(basePath, milestoneId, sliceId, "PLAN");
|
|
982
|
+
const slicePlanContent = slicePlanPath ? await loadFile(slicePlanPath) : null;
|
|
983
|
+
const slicePlanExcerpt = extractSliceExecutionExcerpt(slicePlanContent, slicePlanRelPath);
|
|
984
|
+
const priorTaskLines = await buildCarryForwardLines(basePath, milestoneId, sliceId, taskId);
|
|
985
|
+
const resumeSection = await buildResumeSection(basePath, milestoneId, sliceId);
|
|
986
|
+
const activeOverrides = await loadActiveOverrides(basePath);
|
|
987
|
+
const overridesSection = formatOverridesSection(activeOverrides);
|
|
988
|
+
return [
|
|
989
|
+
"[GSD Guided Execute Context]",
|
|
990
|
+
"Use this injected context as startup context for guided task execution. Treat the inlined task plan as the authoritative local execution contract. Use source artifacts to verify details and run checks.",
|
|
991
|
+
overridesSection, "",
|
|
992
|
+
"",
|
|
993
|
+
resumeSection,
|
|
994
|
+
"",
|
|
995
|
+
"## Carry-Forward Context",
|
|
996
|
+
...priorTaskLines,
|
|
997
|
+
"",
|
|
998
|
+
taskPlanInline,
|
|
999
|
+
"",
|
|
1000
|
+
slicePlanExcerpt,
|
|
1001
|
+
"",
|
|
1002
|
+
"## Backing Source Artifacts",
|
|
1003
|
+
`- Slice plan: \`${slicePlanRelPath}\``,
|
|
1004
|
+
`- Task plan source: \`${taskPlanRelPath}\``,
|
|
1005
|
+
].join("\n");
|
|
1006
|
+
}
|
|
1007
|
+
async function buildCarryForwardLines(basePath, milestoneId, sliceId, taskId) {
|
|
1008
|
+
const tDir = resolveTasksDir(basePath, milestoneId, sliceId);
|
|
1009
|
+
if (!tDir)
|
|
1010
|
+
return ["- No prior task summaries in this slice."];
|
|
1011
|
+
const currentNum = parseInt(taskId.replace(/^T/, ""), 10);
|
|
1012
|
+
const sRel = relSlicePath(basePath, milestoneId, sliceId);
|
|
1013
|
+
const summaryFiles = resolveTaskFiles(tDir, "SUMMARY")
|
|
1014
|
+
.filter((file) => parseInt(file.replace(/^T/, ""), 10) < currentNum)
|
|
1015
|
+
.sort();
|
|
1016
|
+
if (summaryFiles.length === 0)
|
|
1017
|
+
return ["- No prior task summaries in this slice."];
|
|
1018
|
+
const lines = await Promise.all(summaryFiles.map(async (file) => {
|
|
1019
|
+
const absPath = join(tDir, file);
|
|
1020
|
+
const content = await loadFile(absPath);
|
|
1021
|
+
const relPath = `${sRel}/tasks/${file}`;
|
|
1022
|
+
if (!content)
|
|
1023
|
+
return `- \`${relPath}\``;
|
|
1024
|
+
const summary = parseSummary(content);
|
|
1025
|
+
const provided = summary.frontmatter.provides.slice(0, 2).join("; ");
|
|
1026
|
+
const decisions = summary.frontmatter.key_decisions.slice(0, 2).join("; ");
|
|
1027
|
+
const patterns = summary.frontmatter.patterns_established.slice(0, 2).join("; ");
|
|
1028
|
+
const diagnostics = extractMarkdownSection(content, "Diagnostics");
|
|
1029
|
+
const parts = [summary.title || relPath];
|
|
1030
|
+
if (summary.oneLiner)
|
|
1031
|
+
parts.push(summary.oneLiner);
|
|
1032
|
+
if (provided)
|
|
1033
|
+
parts.push(`provides: ${provided}`);
|
|
1034
|
+
if (decisions)
|
|
1035
|
+
parts.push(`decisions: ${decisions}`);
|
|
1036
|
+
if (patterns)
|
|
1037
|
+
parts.push(`patterns: ${patterns}`);
|
|
1038
|
+
if (diagnostics)
|
|
1039
|
+
parts.push(`diagnostics: ${oneLine(diagnostics)}`);
|
|
1040
|
+
return `- \`${relPath}\` — ${parts.join(" | ")}`;
|
|
1041
|
+
}));
|
|
1042
|
+
return lines;
|
|
1043
|
+
}
|
|
1044
|
+
async function buildResumeSection(basePath, milestoneId, sliceId) {
|
|
1045
|
+
const continueFile = resolveSliceFile(basePath, milestoneId, sliceId, "CONTINUE");
|
|
1046
|
+
const legacyDir = resolveSlicePath(basePath, milestoneId, sliceId);
|
|
1047
|
+
const legacyPath = legacyDir ? join(legacyDir, "continue.md") : null;
|
|
1048
|
+
const continueContent = continueFile ? await loadFile(continueFile) : null;
|
|
1049
|
+
const legacyContent = !continueContent && legacyPath ? await loadFile(legacyPath) : null;
|
|
1050
|
+
const resolvedContent = continueContent ?? legacyContent;
|
|
1051
|
+
const resolvedRelPath = continueContent
|
|
1052
|
+
? relSliceFile(basePath, milestoneId, sliceId, "CONTINUE")
|
|
1053
|
+
: (legacyPath ? `${relSlicePath(basePath, milestoneId, sliceId)}/continue.md` : null);
|
|
1054
|
+
if (!resolvedContent || !resolvedRelPath) {
|
|
1055
|
+
return ["## Resume State", "- No continue file present. Start from the top of the task plan."].join("\n");
|
|
1056
|
+
}
|
|
1057
|
+
const cont = parseContinue(resolvedContent);
|
|
1058
|
+
const lines = [
|
|
1059
|
+
"## Resume State",
|
|
1060
|
+
`Source: \`${resolvedRelPath}\``,
|
|
1061
|
+
`- Status: ${cont.frontmatter.status || "in_progress"}`,
|
|
1062
|
+
];
|
|
1063
|
+
if (cont.frontmatter.step && cont.frontmatter.totalSteps) {
|
|
1064
|
+
lines.push(`- Progress: step ${cont.frontmatter.step} of ${cont.frontmatter.totalSteps}`);
|
|
1065
|
+
}
|
|
1066
|
+
if (cont.completedWork)
|
|
1067
|
+
lines.push(`- Completed: ${oneLine(cont.completedWork)}`);
|
|
1068
|
+
if (cont.remainingWork)
|
|
1069
|
+
lines.push(`- Remaining: ${oneLine(cont.remainingWork)}`);
|
|
1070
|
+
if (cont.decisions)
|
|
1071
|
+
lines.push(`- Decisions: ${oneLine(cont.decisions)}`);
|
|
1072
|
+
if (cont.nextAction)
|
|
1073
|
+
lines.push(`- Next action: ${oneLine(cont.nextAction)}`);
|
|
1074
|
+
return lines.join("\n");
|
|
1075
|
+
}
|
|
1076
|
+
function extractSliceExecutionExcerpt(content, relPath) {
|
|
1077
|
+
if (!content) {
|
|
1078
|
+
return [
|
|
1079
|
+
"## Slice Plan Excerpt",
|
|
1080
|
+
`Slice plan not found at dispatch time. Read \`${relPath}\` before running slice-level verification.`,
|
|
1081
|
+
].join("\n");
|
|
1082
|
+
}
|
|
1083
|
+
const lines = content.split("\n");
|
|
1084
|
+
const goalLine = lines.find((line) => line.startsWith("**Goal:**"))?.trim();
|
|
1085
|
+
const demoLine = lines.find((line) => line.startsWith("**Demo:**"))?.trim();
|
|
1086
|
+
const verification = extractMarkdownSection(content, "Verification");
|
|
1087
|
+
const observability = extractMarkdownSection(content, "Observability / Diagnostics");
|
|
1088
|
+
const parts = ["## Slice Plan Excerpt", `Source: \`${relPath}\``];
|
|
1089
|
+
if (goalLine)
|
|
1090
|
+
parts.push(goalLine);
|
|
1091
|
+
if (demoLine)
|
|
1092
|
+
parts.push(demoLine);
|
|
1093
|
+
if (verification)
|
|
1094
|
+
parts.push("", "### Slice Verification", verification.trim());
|
|
1095
|
+
if (observability)
|
|
1096
|
+
parts.push("", "### Slice Observability / Diagnostics", observability.trim());
|
|
1097
|
+
return parts.join("\n");
|
|
1098
|
+
}
|
|
1099
|
+
function extractMarkdownSection(content, heading) {
|
|
1100
|
+
const match = new RegExp(`^## ${escapeRegExp(heading)}\\s*$`, "m").exec(content);
|
|
1101
|
+
if (!match)
|
|
1102
|
+
return null;
|
|
1103
|
+
const start = match.index + match[0].length;
|
|
1104
|
+
const rest = content.slice(start);
|
|
1105
|
+
const nextHeading = rest.match(/^##\s+/m);
|
|
1106
|
+
const end = nextHeading?.index ?? rest.length;
|
|
1107
|
+
return rest.slice(0, end).trim();
|
|
1108
|
+
}
|
|
1109
|
+
function escapeRegExp(value) {
|
|
1110
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1111
|
+
}
|
|
1112
|
+
function oneLine(text) {
|
|
1113
|
+
return text.replace(/\s+/g, " ").trim();
|
|
1114
|
+
}
|