gsd-pi 2.33.1-dev.235d83a → 2.33.1-dev.29a8268
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/cli.js +0 -16
- package/dist/resource-loader.d.ts +0 -2
- package/dist/resource-loader.js +3 -36
- package/dist/resources/extensions/ask-user-questions.ts +290 -0
- package/dist/resources/extensions/async-jobs/async-bash-tool.ts +212 -0
- package/dist/resources/extensions/async-jobs/await-tool.ts +103 -0
- package/dist/resources/extensions/async-jobs/cancel-job-tool.ts +35 -0
- package/dist/resources/extensions/async-jobs/index.ts +141 -0
- package/dist/resources/extensions/async-jobs/job-manager.ts +211 -0
- package/dist/resources/extensions/aws-auth/index.ts +144 -0
- package/dist/resources/extensions/bg-shell/bg-shell-command.ts +219 -0
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.ts +400 -0
- package/dist/resources/extensions/bg-shell/bg-shell-tool.ts +985 -0
- package/dist/resources/extensions/bg-shell/index.ts +59 -0
- package/dist/resources/extensions/bg-shell/interaction.ts +198 -0
- package/dist/resources/extensions/bg-shell/output-formatter.ts +279 -0
- package/dist/resources/extensions/bg-shell/overlay.ts +437 -0
- package/dist/resources/extensions/bg-shell/process-manager.ts +464 -0
- package/dist/resources/extensions/bg-shell/readiness-detector.ts +126 -0
- package/dist/resources/extensions/bg-shell/types.ts +303 -0
- package/dist/resources/extensions/bg-shell/utilities.ts +57 -0
- package/dist/resources/extensions/browser-tools/capture.ts +199 -0
- package/dist/resources/extensions/browser-tools/core.ts +1196 -0
- package/dist/resources/extensions/browser-tools/{evaluate-helpers.js → evaluate-helpers.ts} +1 -0
- package/dist/resources/extensions/browser-tools/index.ts +71 -0
- package/dist/resources/extensions/browser-tools/lifecycle.ts +270 -0
- package/dist/resources/extensions/browser-tools/refs.ts +264 -0
- package/dist/resources/extensions/browser-tools/settle.ts +197 -0
- package/dist/resources/extensions/browser-tools/state.ts +408 -0
- package/dist/resources/extensions/browser-tools/tools/action-cache.ts +216 -0
- package/dist/resources/extensions/browser-tools/tools/assertions.ts +342 -0
- package/dist/resources/extensions/browser-tools/tools/codegen.ts +274 -0
- package/dist/resources/extensions/browser-tools/tools/device.ts +183 -0
- package/dist/resources/extensions/browser-tools/tools/extract.ts +229 -0
- package/dist/resources/extensions/browser-tools/tools/forms.ts +801 -0
- package/dist/resources/extensions/browser-tools/tools/injection-detect.ts +221 -0
- package/dist/resources/extensions/browser-tools/tools/inspection.ts +492 -0
- package/dist/resources/extensions/browser-tools/tools/intent.ts +614 -0
- package/dist/resources/extensions/browser-tools/tools/interaction.ts +865 -0
- package/dist/resources/extensions/browser-tools/tools/navigation.ts +232 -0
- package/dist/resources/extensions/browser-tools/tools/network-mock.ts +244 -0
- package/dist/resources/extensions/browser-tools/tools/pages.ts +303 -0
- package/dist/resources/extensions/browser-tools/tools/pdf.ts +92 -0
- package/dist/resources/extensions/browser-tools/tools/refs.ts +541 -0
- package/dist/resources/extensions/browser-tools/tools/screenshot.ts +101 -0
- package/dist/resources/extensions/browser-tools/tools/session.ts +400 -0
- package/dist/resources/extensions/browser-tools/tools/state-persistence.ts +202 -0
- package/dist/resources/extensions/browser-tools/tools/visual-diff.ts +209 -0
- package/dist/resources/extensions/browser-tools/tools/wait.ts +247 -0
- package/dist/resources/extensions/browser-tools/tools/zoom.ts +104 -0
- package/dist/resources/extensions/browser-tools/utils.ts +660 -0
- package/dist/resources/extensions/context7/index.ts +428 -0
- package/dist/resources/extensions/get-secrets-from-user.ts +607 -0
- package/dist/resources/extensions/google-search/index.ts +466 -0
- package/dist/resources/extensions/gsd/activity-log.ts +162 -0
- package/dist/resources/extensions/gsd/atomic-write.ts +35 -0
- package/dist/resources/extensions/gsd/auto/session.ts +236 -0
- package/dist/resources/extensions/gsd/auto-budget.ts +32 -0
- package/dist/resources/extensions/gsd/{auto-constants.js → auto-constants.ts} +1 -0
- package/dist/resources/extensions/gsd/auto-dashboard.ts +626 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.ts +224 -0
- package/dist/resources/extensions/gsd/auto-dispatch.ts +409 -0
- package/dist/resources/extensions/gsd/auto-idempotency.ts +151 -0
- package/dist/resources/extensions/gsd/auto-model-selection.ts +179 -0
- package/dist/resources/extensions/gsd/auto-observability.ts +72 -0
- package/dist/resources/extensions/gsd/auto-post-unit.ts +618 -0
- package/dist/resources/extensions/gsd/auto-prompts.ts +1273 -0
- package/dist/resources/extensions/gsd/auto-recovery.ts +578 -0
- package/dist/resources/extensions/gsd/auto-start.ts +483 -0
- package/dist/resources/extensions/gsd/auto-stuck-detection.ts +221 -0
- package/dist/resources/extensions/gsd/{auto-supervisor.js → auto-supervisor.ts} +33 -25
- package/dist/resources/extensions/gsd/auto-timeout-recovery.ts +263 -0
- package/dist/resources/extensions/gsd/auto-timers.ts +224 -0
- package/dist/resources/extensions/gsd/auto-tool-tracking.ts +54 -0
- package/dist/resources/extensions/gsd/auto-unit-closeout.ts +48 -0
- package/dist/resources/extensions/gsd/auto-verification.ts +229 -0
- package/dist/resources/extensions/gsd/auto-worktree.ts +658 -0
- package/dist/resources/extensions/gsd/auto.ts +1834 -0
- package/dist/resources/extensions/gsd/{cache.js → cache.ts} +7 -5
- package/dist/resources/extensions/gsd/captures.ts +427 -0
- package/dist/resources/extensions/gsd/claude-import.ts +656 -0
- package/dist/resources/extensions/gsd/collision-diagnostics.ts +332 -0
- package/dist/resources/extensions/gsd/commands-config.ts +102 -0
- package/dist/resources/extensions/gsd/commands-extensions.ts +328 -0
- package/dist/resources/extensions/gsd/commands-handlers.ts +395 -0
- package/dist/resources/extensions/gsd/commands-inspect.ts +91 -0
- package/dist/resources/extensions/gsd/commands-logs.ts +536 -0
- package/dist/resources/extensions/gsd/commands-maintenance.ts +206 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.ts +780 -0
- package/dist/resources/extensions/gsd/commands-workflow-templates.ts +543 -0
- package/dist/resources/extensions/gsd/commands.ts +1149 -0
- package/dist/resources/extensions/gsd/complexity-classifier.ts +320 -0
- package/dist/resources/extensions/gsd/{constants.js → constants.ts} +6 -0
- package/dist/resources/extensions/gsd/context-budget.ts +266 -0
- package/dist/resources/extensions/gsd/context-store.ts +195 -0
- package/dist/resources/extensions/gsd/crash-recovery.ts +121 -0
- package/dist/resources/extensions/gsd/dashboard-overlay.ts +681 -0
- package/dist/resources/extensions/gsd/db-writer.ts +360 -0
- package/dist/resources/extensions/gsd/debug-logger.ts +178 -0
- package/dist/resources/extensions/gsd/detection.ts +470 -0
- package/dist/resources/extensions/gsd/diff-context.ts +214 -0
- package/dist/resources/extensions/gsd/dispatch-guard.ts +81 -0
- package/dist/resources/extensions/gsd/doctor-checks.ts +612 -0
- package/dist/resources/extensions/gsd/doctor-environment.ts +497 -0
- package/dist/resources/extensions/gsd/doctor-format.ts +78 -0
- package/dist/resources/extensions/gsd/doctor-proactive.ts +292 -0
- package/dist/resources/extensions/gsd/doctor-providers.ts +343 -0
- package/dist/resources/extensions/gsd/doctor-types.ts +87 -0
- package/dist/resources/extensions/gsd/doctor.ts +722 -0
- package/dist/resources/extensions/gsd/error-utils.ts +6 -0
- package/dist/resources/extensions/gsd/{errors.js → errors.ts} +11 -6
- package/dist/resources/extensions/gsd/exit-command.ts +18 -0
- package/dist/resources/extensions/gsd/{export-html.js → export-html.ts} +614 -482
- package/dist/resources/extensions/gsd/export.ts +317 -0
- package/dist/resources/extensions/gsd/file-watcher.ts +97 -0
- package/dist/resources/extensions/gsd/files.ts +1058 -0
- package/dist/resources/extensions/gsd/forensics.ts +629 -0
- package/dist/resources/extensions/gsd/{git-constants.js → git-constants.ts} +5 -4
- package/dist/resources/extensions/gsd/git-self-heal.ts +127 -0
- package/dist/resources/extensions/gsd/git-service.ts +586 -0
- package/dist/resources/extensions/gsd/{gitignore.js → gitignore.ts} +125 -98
- package/dist/resources/extensions/gsd/gsd-db.ts +685 -0
- package/dist/resources/extensions/gsd/guided-flow-queue.ts +440 -0
- package/dist/resources/extensions/gsd/guided-flow.ts +1303 -0
- package/dist/resources/extensions/gsd/health-widget.ts +167 -0
- package/dist/resources/extensions/gsd/history.ts +143 -0
- package/dist/resources/extensions/gsd/index.ts +1401 -0
- package/dist/resources/extensions/gsd/init-wizard.ts +587 -0
- package/dist/resources/extensions/gsd/json-persistence.ts +67 -0
- package/dist/resources/extensions/gsd/{jsonl-utils.js → jsonl-utils.ts} +7 -10
- package/dist/resources/extensions/gsd/key-manager.ts +996 -0
- package/dist/resources/extensions/gsd/marketplace-discovery.ts +508 -0
- package/dist/resources/extensions/gsd/md-importer.ts +527 -0
- package/dist/resources/extensions/gsd/mechanical-completion.ts +430 -0
- package/dist/resources/extensions/gsd/memory-extractor.ts +352 -0
- package/dist/resources/extensions/gsd/memory-store.ts +441 -0
- package/dist/resources/extensions/gsd/metrics.ts +532 -0
- package/dist/resources/extensions/gsd/migrate/command.ts +219 -0
- package/dist/resources/extensions/gsd/migrate/index.ts +42 -0
- package/dist/resources/extensions/gsd/migrate/parser.ts +323 -0
- package/dist/resources/extensions/gsd/migrate/parsers.ts +539 -0
- package/dist/resources/extensions/gsd/migrate/preview.ts +48 -0
- package/dist/resources/extensions/gsd/migrate/transformer.ts +346 -0
- package/dist/resources/extensions/gsd/migrate/types.ts +370 -0
- package/dist/resources/extensions/gsd/migrate/validator.ts +55 -0
- package/dist/resources/extensions/gsd/migrate/writer.ts +579 -0
- package/dist/resources/extensions/gsd/migrate-external.ts +140 -0
- package/dist/resources/extensions/gsd/milestone-actions.ts +126 -0
- package/dist/resources/extensions/gsd/{milestone-ids.js → milestone-ids.ts} +63 -50
- package/dist/resources/extensions/gsd/model-cost-table.ts +65 -0
- package/dist/resources/extensions/gsd/model-router.ts +256 -0
- package/dist/resources/extensions/gsd/namespaced-registry.ts +467 -0
- package/dist/resources/extensions/gsd/namespaced-resolver.ts +307 -0
- package/dist/resources/extensions/gsd/native-git-bridge.ts +1041 -0
- package/dist/resources/extensions/gsd/native-parser-bridge.ts +267 -0
- package/dist/resources/extensions/gsd/notifications.ts +87 -0
- package/dist/resources/extensions/gsd/observability-validator.ts +429 -0
- package/dist/resources/extensions/gsd/parallel-eligibility.ts +233 -0
- package/dist/resources/extensions/gsd/parallel-merge.ts +157 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.ts +826 -0
- package/dist/resources/extensions/gsd/paths.ts +449 -0
- package/dist/resources/extensions/gsd/plugin-importer.ts +411 -0
- package/dist/resources/extensions/gsd/post-unit-hooks.ts +520 -0
- package/dist/resources/extensions/gsd/preferences-models.ts +329 -0
- package/dist/resources/extensions/gsd/preferences-skills.ts +169 -0
- package/dist/resources/extensions/gsd/preferences-types.ts +229 -0
- package/dist/resources/extensions/gsd/preferences-validation.ts +590 -0
- package/dist/resources/extensions/gsd/preferences.ts +416 -0
- package/dist/resources/extensions/gsd/progress-score.ts +273 -0
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.ts +213 -0
- package/dist/resources/extensions/gsd/prompt-compressor.ts +508 -0
- package/dist/resources/extensions/gsd/prompt-loader.ts +130 -0
- package/dist/resources/extensions/gsd/prompt-ordering.ts +200 -0
- package/dist/resources/extensions/gsd/provider-error-pause.ts +88 -0
- package/dist/resources/extensions/gsd/queue-order.ts +230 -0
- package/dist/resources/extensions/gsd/queue-reorder-ui.ts +276 -0
- package/dist/resources/extensions/gsd/quick.ts +212 -0
- package/dist/resources/extensions/gsd/repo-identity.ts +169 -0
- package/dist/resources/extensions/gsd/{reports.js → reports.ts} +241 -146
- package/dist/resources/extensions/gsd/{resource-version.js → resource-version.ts} +53 -50
- package/dist/resources/extensions/gsd/roadmap-slices.ts +149 -0
- package/dist/resources/extensions/gsd/routing-history.ts +286 -0
- package/dist/resources/extensions/gsd/safe-fs.ts +47 -0
- package/dist/resources/extensions/gsd/semantic-chunker.ts +336 -0
- package/dist/resources/extensions/gsd/session-forensics.ts +537 -0
- package/dist/resources/extensions/gsd/session-lock.ts +426 -0
- package/dist/resources/extensions/gsd/session-status-io.ts +179 -0
- package/dist/resources/extensions/gsd/skill-discovery.ts +139 -0
- package/dist/resources/extensions/gsd/skill-health.ts +417 -0
- package/dist/resources/extensions/gsd/{skill-telemetry.js → skill-telemetry.ts} +74 -58
- package/dist/resources/extensions/gsd/state.ts +727 -0
- package/dist/resources/extensions/gsd/structured-data-formatter.ts +144 -0
- package/dist/resources/extensions/gsd/summary-distiller.ts +258 -0
- package/dist/resources/extensions/gsd/tests/activity-log.test.ts +213 -0
- package/dist/resources/extensions/gsd/tests/agent-end-retry.test.ts +107 -0
- package/dist/resources/extensions/gsd/tests/all-milestones-complete-merge.test.ts +200 -0
- package/dist/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +50 -0
- package/dist/resources/extensions/gsd/tests/auto-dashboard.test.ts +166 -0
- package/dist/resources/extensions/gsd/tests/auto-dispatch-loop.test.ts +691 -0
- package/dist/resources/extensions/gsd/tests/auto-lock-creation.test.ts +186 -0
- package/dist/resources/extensions/gsd/tests/auto-preflight.test.ts +40 -0
- package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +640 -0
- package/dist/resources/extensions/gsd/tests/auto-reentrancy-guard.test.ts +127 -0
- package/dist/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +302 -0
- package/dist/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +257 -0
- package/dist/resources/extensions/gsd/tests/auto-skip-loop.test.ts +123 -0
- package/dist/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +340 -0
- package/dist/resources/extensions/gsd/tests/auto-worktree.test.ts +167 -0
- package/dist/resources/extensions/gsd/tests/budget-prediction.test.ts +220 -0
- package/dist/resources/extensions/gsd/tests/cache-staleness-regression.test.ts +317 -0
- package/dist/resources/extensions/gsd/tests/captures.test.ts +438 -0
- package/dist/resources/extensions/gsd/tests/claude-import-tui.test.ts +351 -0
- package/dist/resources/extensions/gsd/tests/collect-from-manifest.test.ts +469 -0
- package/dist/resources/extensions/gsd/tests/collision-diagnostics.test.ts +705 -0
- package/dist/resources/extensions/gsd/tests/commands-logs.test.ts +241 -0
- package/dist/resources/extensions/gsd/tests/complete-milestone.test.ts +209 -0
- package/dist/resources/extensions/gsd/tests/complexity-classifier.test.ts +181 -0
- package/dist/resources/extensions/gsd/tests/context-budget.test.ts +352 -0
- package/dist/resources/extensions/gsd/tests/context-compression.test.ts +193 -0
- package/dist/resources/extensions/gsd/tests/context-store.test.ts +462 -0
- package/dist/resources/extensions/gsd/tests/continue-here.test.ts +285 -0
- package/dist/resources/extensions/gsd/tests/cost-projection.test.ts +134 -0
- package/dist/resources/extensions/gsd/tests/crash-recovery.test.ts +134 -0
- package/dist/resources/extensions/gsd/tests/dashboard-budget.test.ts +346 -0
- package/dist/resources/extensions/gsd/tests/db-writer.test.ts +602 -0
- package/dist/resources/extensions/gsd/tests/debug-logger.test.ts +185 -0
- package/dist/resources/extensions/gsd/tests/derive-state-db.test.ts +405 -0
- package/dist/resources/extensions/gsd/tests/derive-state-deps.test.ts +421 -0
- package/dist/resources/extensions/gsd/tests/derive-state-draft.test.ts +308 -0
- package/dist/resources/extensions/gsd/tests/derive-state.test.ts +788 -0
- package/dist/resources/extensions/gsd/tests/detection.test.ts +398 -0
- package/dist/resources/extensions/gsd/tests/diff-context.test.ts +136 -0
- package/dist/resources/extensions/gsd/tests/discuss-prompt.test.ts +15 -0
- package/dist/resources/extensions/gsd/tests/dispatch-guard.test.ts +128 -0
- package/dist/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +132 -0
- package/dist/resources/extensions/gsd/tests/dispatch-stall-guard.test.ts +126 -0
- package/dist/resources/extensions/gsd/tests/doctor-environment.test.ts +314 -0
- package/dist/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +245 -0
- package/dist/resources/extensions/gsd/tests/doctor-git.test.ts +344 -0
- package/dist/resources/extensions/gsd/tests/doctor-proactive.test.ts +278 -0
- package/dist/resources/extensions/gsd/tests/doctor-providers.test.ts +298 -0
- package/dist/resources/extensions/gsd/tests/doctor-runtime.test.ts +302 -0
- package/dist/resources/extensions/gsd/tests/doctor.test.ts +652 -0
- package/dist/resources/extensions/gsd/tests/draft-promotion.test.ts +169 -0
- package/dist/resources/extensions/gsd/tests/exit-command.test.ts +50 -0
- package/dist/resources/extensions/gsd/tests/export-html-all.test.ts +105 -0
- package/dist/resources/extensions/gsd/tests/export-html-enhancements.test.ts +378 -0
- package/dist/resources/extensions/gsd/tests/extension-selector-separator.test.ts +144 -0
- package/dist/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +424 -0
- package/dist/resources/extensions/gsd/tests/git-self-heal.test.ts +131 -0
- package/dist/resources/extensions/gsd/tests/git-service.test.ts +1181 -0
- package/dist/resources/extensions/gsd/tests/gsd-db.test.ts +353 -0
- package/dist/resources/extensions/gsd/tests/gsd-inspect.test.ts +125 -0
- package/dist/resources/extensions/gsd/tests/gsd-tools.test.ts +326 -0
- package/dist/resources/extensions/gsd/tests/headless-answers.test.ts +340 -0
- package/dist/resources/extensions/gsd/tests/headless-query.test.ts +162 -0
- package/dist/resources/extensions/gsd/tests/idle-recovery.test.ts +485 -0
- package/dist/resources/extensions/gsd/tests/in-flight-tool-tracking.test.ts +32 -0
- package/dist/resources/extensions/gsd/tests/init-wizard.test.ts +197 -0
- package/dist/resources/extensions/gsd/tests/integration/headless-command.ts +534 -0
- package/dist/resources/extensions/gsd/tests/integration-edge.test.ts +228 -0
- package/dist/resources/extensions/gsd/tests/integration-lifecycle.test.ts +277 -0
- package/dist/resources/extensions/gsd/tests/integration-mixed-milestones.test.ts +523 -0
- package/dist/resources/extensions/gsd/tests/key-manager.test.ts +414 -0
- package/dist/resources/extensions/gsd/tests/knowledge.test.ts +161 -0
- package/dist/resources/extensions/gsd/tests/loop-regression.test.ts +877 -0
- package/dist/resources/extensions/gsd/tests/manifest-status.test.ts +283 -0
- package/dist/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +91 -0
- package/dist/resources/extensions/gsd/tests/md-importer.test.ts +410 -0
- package/dist/resources/extensions/gsd/tests/mechanical-completion.test.ts +356 -0
- package/dist/resources/extensions/gsd/tests/memory-extractor.test.ts +180 -0
- package/dist/resources/extensions/gsd/tests/memory-leak-guards.test.ts +91 -0
- package/dist/resources/extensions/gsd/tests/memory-store.test.ts +345 -0
- package/dist/resources/extensions/gsd/tests/metrics.test.ts +253 -0
- package/dist/resources/extensions/gsd/tests/migrate-command.test.ts +369 -0
- package/dist/resources/extensions/gsd/tests/migrate-parser.test.ts +757 -0
- package/dist/resources/extensions/gsd/tests/migrate-transformer.test.ts +635 -0
- package/dist/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +414 -0
- package/dist/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +303 -0
- package/dist/resources/extensions/gsd/tests/migrate-writer.test.ts +398 -0
- package/dist/resources/extensions/gsd/tests/milestone-transition-worktree.test.ts +147 -0
- package/dist/resources/extensions/gsd/tests/model-cost-table.test.ts +69 -0
- package/dist/resources/extensions/gsd/tests/model-isolation.test.ts +157 -0
- package/dist/resources/extensions/gsd/tests/model-router.test.ts +167 -0
- package/dist/resources/extensions/gsd/tests/must-have-parser.test.ts +291 -0
- package/dist/resources/extensions/gsd/tests/namespaced-registry.test.ts +1027 -0
- package/dist/resources/extensions/gsd/tests/namespaced-resolver.test.ts +671 -0
- package/dist/resources/extensions/gsd/tests/native-has-changes-cache.test.ts +61 -0
- package/dist/resources/extensions/gsd/tests/next-milestone-id.test.ts +23 -0
- package/dist/resources/extensions/gsd/tests/none-mode-gates.test.ts +114 -0
- package/dist/resources/extensions/gsd/tests/notifications.test.ts +67 -0
- package/dist/resources/extensions/gsd/tests/overrides.test.ts +131 -0
- package/dist/resources/extensions/gsd/tests/parallel-budget-atomicity.test.ts +331 -0
- package/dist/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +298 -0
- package/dist/resources/extensions/gsd/tests/parallel-merge.test.ts +468 -0
- package/dist/resources/extensions/gsd/tests/parallel-orchestration.test.ts +685 -0
- package/dist/resources/extensions/gsd/tests/parallel-worker-monitoring.test.ts +171 -0
- package/dist/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +354 -0
- package/dist/resources/extensions/gsd/tests/park-edge-cases.test.ts +276 -0
- package/dist/resources/extensions/gsd/tests/park-milestone.test.ts +401 -0
- package/dist/resources/extensions/gsd/tests/parsers.test.ts +1704 -0
- package/dist/resources/extensions/gsd/tests/plan-milestone.test.ts +133 -0
- package/dist/resources/extensions/gsd/tests/plan-quality-validator.test.ts +363 -0
- package/dist/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +42 -0
- package/dist/resources/extensions/gsd/tests/plugin-importer-live.test.ts +481 -0
- package/dist/resources/extensions/gsd/tests/plugin-importer.test.ts +1383 -0
- package/dist/resources/extensions/gsd/tests/post-unit-hooks.test.ts +337 -0
- package/dist/resources/extensions/gsd/tests/preferences.test.ts +276 -0
- package/dist/resources/extensions/gsd/tests/progress-score.test.ts +206 -0
- package/dist/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +464 -0
- package/dist/resources/extensions/gsd/tests/prompt-cache-optimizer.test.ts +314 -0
- package/dist/resources/extensions/gsd/tests/prompt-compressor.test.ts +529 -0
- package/dist/resources/extensions/gsd/tests/prompt-db.test.ts +385 -0
- package/dist/resources/extensions/gsd/tests/prompt-ordering.test.ts +296 -0
- package/dist/resources/extensions/gsd/tests/provider-errors.test.ts +338 -0
- package/dist/resources/extensions/gsd/tests/queue-draft-detection.test.ts +126 -0
- package/dist/resources/extensions/gsd/tests/queue-order.test.ts +204 -0
- package/dist/resources/extensions/gsd/tests/queue-reorder-e2e.test.ts +282 -0
- package/dist/resources/extensions/gsd/tests/reassess-detection.test.ts +154 -0
- package/dist/resources/extensions/gsd/tests/reassess-prompt.test.ts +145 -0
- package/dist/resources/extensions/gsd/tests/regex-hardening.test.ts +281 -0
- package/dist/resources/extensions/gsd/tests/remote-questions.test.ts +642 -0
- package/dist/resources/extensions/gsd/tests/remote-status.test.ts +99 -0
- package/dist/resources/extensions/gsd/tests/replan-slice.test.ts +538 -0
- package/dist/resources/extensions/gsd/tests/requirements.test.ts +106 -0
- package/dist/resources/extensions/gsd/tests/roadmap-parse-regression.test.ts +358 -0
- package/dist/resources/extensions/gsd/tests/roadmap-slices.test.ts +66 -0
- package/dist/resources/extensions/gsd/tests/routing-history.test.ts +240 -0
- package/dist/resources/extensions/gsd/tests/run-uat.test.ts +416 -0
- package/dist/resources/extensions/gsd/tests/secure-env-collect.test.ts +185 -0
- package/dist/resources/extensions/gsd/tests/semantic-chunker.test.ts +426 -0
- package/dist/resources/extensions/gsd/tests/session-lock-regression.test.ts +216 -0
- package/dist/resources/extensions/gsd/tests/session-lock.test.ts +434 -0
- package/dist/resources/extensions/gsd/tests/skill-lifecycle.test.ts +126 -0
- package/dist/resources/extensions/gsd/tests/smart-entry-draft.test.ts +123 -0
- package/dist/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +142 -0
- package/dist/resources/extensions/gsd/tests/stop-auto-remote.test.ts +156 -0
- package/dist/resources/extensions/gsd/tests/structured-data-formatter.test.ts +365 -0
- package/dist/resources/extensions/gsd/tests/summary-distiller.test.ts +323 -0
- package/dist/resources/extensions/gsd/tests/test-helpers.ts +61 -0
- package/dist/resources/extensions/gsd/tests/token-counter.test.ts +129 -0
- package/dist/resources/extensions/gsd/tests/token-optimization-benchmark.test.ts +1272 -0
- package/dist/resources/extensions/gsd/tests/token-optimization-prefs.test.ts +164 -0
- package/dist/resources/extensions/gsd/tests/token-profile.test.ts +268 -0
- package/dist/resources/extensions/gsd/tests/token-savings.test.ts +366 -0
- package/dist/resources/extensions/gsd/tests/triage-dispatch.test.ts +340 -0
- package/dist/resources/extensions/gsd/tests/triage-resolution.test.ts +416 -0
- package/dist/resources/extensions/gsd/tests/undo.test.ts +136 -0
- package/dist/resources/extensions/gsd/tests/unique-milestone-ids.test.ts +219 -0
- package/dist/resources/extensions/gsd/tests/unit-runtime.test.ts +258 -0
- package/dist/resources/extensions/gsd/tests/update-command.test.ts +67 -0
- package/dist/resources/extensions/gsd/tests/validate-directory.test.ts +222 -0
- package/dist/resources/extensions/gsd/tests/validate-milestone.test.ts +375 -0
- package/dist/resources/extensions/gsd/tests/verification-evidence.test.ts +745 -0
- package/dist/resources/extensions/gsd/tests/verification-gate.test.ts +1208 -0
- package/dist/resources/extensions/gsd/tests/visualizer-critical-path.test.ts +145 -0
- package/dist/resources/extensions/gsd/tests/visualizer-data.test.ts +446 -0
- package/dist/resources/extensions/gsd/tests/visualizer-overlay.test.ts +237 -0
- package/dist/resources/extensions/gsd/tests/visualizer-views.test.ts +718 -0
- package/dist/resources/extensions/gsd/tests/worker-registry.test.ts +148 -0
- package/dist/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
- package/dist/resources/extensions/gsd/tests/workspace-index.test.ts +38 -0
- package/dist/resources/extensions/gsd/tests/worktree-bugfix.test.ts +120 -0
- package/dist/resources/extensions/gsd/tests/worktree-e2e.test.ts +244 -0
- package/dist/resources/extensions/gsd/tests/worktree-integration.test.ts +207 -0
- package/dist/resources/extensions/gsd/tests/worktree-manager.test.ts +141 -0
- package/dist/resources/extensions/gsd/tests/worktree-post-create-hook.test.ts +165 -0
- package/dist/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +206 -0
- package/dist/resources/extensions/gsd/tests/worktree.test.ts +171 -0
- package/dist/resources/extensions/gsd/tests/write-gate.test.ts +211 -0
- package/dist/resources/extensions/gsd/token-counter.ts +65 -0
- package/dist/resources/extensions/gsd/triage-resolution.ts +284 -0
- package/dist/resources/extensions/gsd/triage-ui.ts +175 -0
- package/dist/resources/extensions/gsd/types.ts +425 -0
- package/dist/resources/extensions/gsd/undo.ts +223 -0
- package/dist/resources/extensions/gsd/unit-id.ts +14 -0
- package/dist/resources/extensions/gsd/unit-runtime.ts +192 -0
- package/dist/resources/extensions/gsd/validate-directory.ts +164 -0
- package/dist/resources/extensions/gsd/verification-evidence.ts +188 -0
- package/dist/resources/extensions/gsd/verification-gate.ts +643 -0
- package/dist/resources/extensions/gsd/visualizer-data.ts +866 -0
- package/dist/resources/extensions/gsd/visualizer-overlay.ts +566 -0
- package/dist/resources/extensions/gsd/visualizer-views.ts +1171 -0
- package/dist/resources/extensions/gsd/workflow-templates.ts +241 -0
- package/dist/resources/extensions/gsd/workspace-index.ts +217 -0
- package/dist/resources/extensions/gsd/worktree-command.ts +807 -0
- package/dist/resources/extensions/gsd/worktree-manager.ts +449 -0
- package/dist/resources/extensions/gsd/worktree.ts +257 -0
- package/dist/resources/extensions/mac-tools/index.ts +852 -0
- package/dist/resources/extensions/mcp-client/index.ts +459 -0
- package/dist/resources/extensions/remote-questions/config.ts +83 -0
- package/dist/resources/extensions/remote-questions/discord-adapter.ts +148 -0
- package/dist/resources/extensions/remote-questions/format.ts +315 -0
- package/dist/resources/extensions/remote-questions/http-client.ts +76 -0
- package/dist/resources/extensions/remote-questions/manager.ts +184 -0
- package/dist/resources/extensions/remote-questions/{mod.js → mod.ts} +10 -1
- package/dist/resources/extensions/remote-questions/notify.ts +90 -0
- package/dist/resources/extensions/remote-questions/remote-command.ts +457 -0
- package/dist/resources/extensions/remote-questions/slack-adapter.ts +141 -0
- package/dist/resources/extensions/remote-questions/status.ts +31 -0
- package/dist/resources/extensions/remote-questions/store.ts +81 -0
- package/dist/resources/extensions/remote-questions/telegram-adapter.ts +149 -0
- package/dist/resources/extensions/remote-questions/types.ts +102 -0
- package/dist/resources/extensions/search-the-web/cache.ts +78 -0
- package/dist/resources/extensions/search-the-web/command-search-provider.ts +101 -0
- package/dist/resources/extensions/search-the-web/format.ts +258 -0
- package/dist/resources/extensions/search-the-web/http.ts +238 -0
- package/dist/resources/extensions/search-the-web/index.ts +65 -0
- package/dist/resources/extensions/search-the-web/native-search.ts +193 -0
- package/dist/resources/extensions/search-the-web/provider.ts +148 -0
- package/dist/resources/extensions/search-the-web/tavily.ts +116 -0
- package/dist/resources/extensions/search-the-web/tool-fetch-page.ts +589 -0
- package/dist/resources/extensions/search-the-web/tool-llm-context.ts +608 -0
- package/dist/resources/extensions/search-the-web/tool-search.ts +649 -0
- package/dist/resources/extensions/search-the-web/url-utils.ts +125 -0
- package/dist/resources/extensions/shared/confirm-ui.ts +126 -0
- package/dist/resources/extensions/shared/{format-utils.js → format-utils.ts} +91 -85
- package/dist/resources/extensions/shared/frontmatter.ts +117 -0
- package/dist/resources/extensions/shared/interview-ui.ts +613 -0
- package/dist/resources/extensions/shared/{mod.js → mod.ts} +24 -2
- package/dist/resources/extensions/shared/next-action-ui.ts +212 -0
- package/dist/resources/extensions/shared/{path-display.js → path-display.ts} +3 -2
- package/dist/resources/extensions/shared/sanitize.ts +19 -0
- package/dist/resources/extensions/shared/terminal.ts +23 -0
- package/dist/resources/extensions/shared/tests/format-utils.test.ts +153 -0
- package/dist/resources/extensions/shared/ui.ts +400 -0
- package/dist/resources/extensions/shared/wizard-ui.ts +551 -0
- package/dist/resources/extensions/slash-commands/audit.ts +88 -0
- package/dist/resources/extensions/slash-commands/clear.ts +10 -0
- package/dist/resources/extensions/slash-commands/create-extension.ts +297 -0
- package/dist/resources/extensions/slash-commands/create-slash-command.ts +234 -0
- package/dist/resources/extensions/slash-commands/index.ts +12 -0
- package/dist/resources/extensions/subagent/agents.ts +126 -0
- package/dist/resources/extensions/subagent/index.ts +1121 -0
- package/dist/resources/extensions/subagent/isolation.ts +501 -0
- package/dist/resources/extensions/subagent/worker-registry.ts +99 -0
- package/dist/resources/extensions/ttsr/index.ts +168 -0
- package/dist/resources/extensions/ttsr/rule-loader.ts +74 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.ts +456 -0
- package/dist/resources/extensions/universal-config/discovery.ts +104 -0
- package/dist/resources/extensions/universal-config/format.ts +191 -0
- package/dist/resources/extensions/universal-config/index.ts +120 -0
- package/dist/resources/extensions/universal-config/scanners.ts +642 -0
- package/dist/resources/extensions/universal-config/tests/discovery.test.ts +119 -0
- package/dist/resources/extensions/universal-config/tests/format.test.ts +127 -0
- package/dist/resources/extensions/universal-config/tests/scanners.test.ts +456 -0
- package/dist/resources/extensions/universal-config/tools.ts +60 -0
- package/dist/resources/extensions/universal-config/types.ts +135 -0
- package/dist/resources/extensions/voice/index.ts +272 -0
- package/dist/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
- package/dist/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
- package/package.json +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 +0 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +4 -31
- package/packages/pi-coding-agent/dist/core/extensions/loader.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/src/core/extensions/index.ts +0 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +4 -35
- package/packages/pi-coding-agent/src/index.ts +0 -1
- package/src/resources/extensions/bg-shell/index.ts +46 -41
- package/src/resources/extensions/browser-tools/index.ts +67 -156
- package/src/resources/extensions/gsd/auto-verification.ts +2 -20
- package/src/resources/extensions/gsd/auto-worktree.ts +2 -3
- package/src/resources/extensions/gsd/commands.ts +31 -39
- package/src/resources/extensions/gsd/git-service.ts +0 -7
- package/src/resources/extensions/gsd/index.ts +32 -93
- package/src/resources/extensions/gsd/quick.ts +3 -52
- package/src/resources/extensions/gsd/repo-identity.ts +22 -56
- package/src/resources/extensions/gsd/tests/loop-regression.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +0 -65
- package/src/resources/extensions/gsd/types.ts +0 -4
- package/src/resources/extensions/gsd/verification-evidence.ts +1 -1
- package/src/resources/extensions/gsd/verification-gate.ts +2 -23
- package/src/resources/extensions/gsd/worktree-command.ts +11 -17
- package/src/resources/extensions/search-the-web/command-search-provider.ts +1 -1
- package/src/resources/extensions/search-the-web/index.ts +52 -35
- package/src/resources/extensions/search-the-web/tavily.ts +1 -1
- package/dist/resources/extensions/ask-user-questions.js +0 -217
- package/dist/resources/extensions/async-jobs/async-bash-tool.js +0 -180
- package/dist/resources/extensions/async-jobs/await-tool.js +0 -90
- package/dist/resources/extensions/async-jobs/cancel-job-tool.js +0 -28
- package/dist/resources/extensions/async-jobs/index.js +0 -119
- package/dist/resources/extensions/async-jobs/job-manager.js +0 -159
- package/dist/resources/extensions/aws-auth/index.js +0 -138
- package/dist/resources/extensions/bg-shell/bg-shell-command.js +0 -182
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.js +0 -343
- package/dist/resources/extensions/bg-shell/bg-shell-tool.js +0 -831
- package/dist/resources/extensions/bg-shell/index.js +0 -41
- package/dist/resources/extensions/bg-shell/interaction.js +0 -160
- package/dist/resources/extensions/bg-shell/output-formatter.js +0 -245
- package/dist/resources/extensions/bg-shell/overlay.js +0 -378
- package/dist/resources/extensions/bg-shell/process-manager.js +0 -413
- package/dist/resources/extensions/bg-shell/readiness-detector.js +0 -109
- package/dist/resources/extensions/bg-shell/types.js +0 -96
- package/dist/resources/extensions/bg-shell/utilities.js +0 -50
- package/dist/resources/extensions/browser-tools/capture.js +0 -179
- package/dist/resources/extensions/browser-tools/core.js +0 -899
- package/dist/resources/extensions/browser-tools/index.js +0 -123
- package/dist/resources/extensions/browser-tools/lifecycle.js +0 -222
- package/dist/resources/extensions/browser-tools/refs.js +0 -254
- package/dist/resources/extensions/browser-tools/settle.js +0 -173
- package/dist/resources/extensions/browser-tools/state.js +0 -126
- package/dist/resources/extensions/browser-tools/tools/action-cache.js +0 -179
- package/dist/resources/extensions/browser-tools/tools/assertions.js +0 -320
- package/dist/resources/extensions/browser-tools/tools/codegen.js +0 -242
- package/dist/resources/extensions/browser-tools/tools/device.js +0 -162
- package/dist/resources/extensions/browser-tools/tools/extract.js +0 -191
- package/dist/resources/extensions/browser-tools/tools/forms.js +0 -710
- package/dist/resources/extensions/browser-tools/tools/injection-detect.js +0 -178
- package/dist/resources/extensions/browser-tools/tools/inspection.js +0 -426
- package/dist/resources/extensions/browser-tools/tools/intent.js +0 -556
- package/dist/resources/extensions/browser-tools/tools/interaction.js +0 -776
- package/dist/resources/extensions/browser-tools/tools/navigation.js +0 -208
- package/dist/resources/extensions/browser-tools/tools/network-mock.js +0 -194
- package/dist/resources/extensions/browser-tools/tools/pages.js +0 -280
- package/dist/resources/extensions/browser-tools/tools/pdf.js +0 -74
- package/dist/resources/extensions/browser-tools/tools/refs.js +0 -485
- package/dist/resources/extensions/browser-tools/tools/screenshot.js +0 -87
- package/dist/resources/extensions/browser-tools/tools/session.js +0 -375
- package/dist/resources/extensions/browser-tools/tools/state-persistence.js +0 -180
- package/dist/resources/extensions/browser-tools/tools/visual-diff.js +0 -174
- package/dist/resources/extensions/browser-tools/tools/wait.js +0 -201
- package/dist/resources/extensions/browser-tools/tools/zoom.js +0 -90
- package/dist/resources/extensions/browser-tools/utils.js +0 -490
- package/dist/resources/extensions/context7/index.js +0 -337
- package/dist/resources/extensions/get-secrets-from-user.js +0 -492
- package/dist/resources/extensions/google-search/index.js +0 -373
- package/dist/resources/extensions/gsd/activity-log.js +0 -146
- package/dist/resources/extensions/gsd/atomic-write.js +0 -38
- package/dist/resources/extensions/gsd/auto/session.js +0 -187
- package/dist/resources/extensions/gsd/auto-budget.js +0 -30
- package/dist/resources/extensions/gsd/auto-dashboard.js +0 -509
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +0 -180
- package/dist/resources/extensions/gsd/auto-dispatch.js +0 -382
- package/dist/resources/extensions/gsd/auto-idempotency.js +0 -106
- package/dist/resources/extensions/gsd/auto-model-selection.js +0 -133
- package/dist/resources/extensions/gsd/auto-observability.js +0 -54
- package/dist/resources/extensions/gsd/auto-post-unit.js +0 -495
- package/dist/resources/extensions/gsd/auto-prompts.js +0 -1121
- package/dist/resources/extensions/gsd/auto-recovery.js +0 -550
- package/dist/resources/extensions/gsd/auto-start.js +0 -393
- package/dist/resources/extensions/gsd/auto-stuck-detection.js +0 -165
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +0 -183
- package/dist/resources/extensions/gsd/auto-timers.js +0 -181
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +0 -50
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +0 -30
- package/dist/resources/extensions/gsd/auto-verification.js +0 -209
- package/dist/resources/extensions/gsd/auto-worktree.js +0 -594
- package/dist/resources/extensions/gsd/auto.js +0 -1485
- package/dist/resources/extensions/gsd/captures.js +0 -348
- package/dist/resources/extensions/gsd/claude-import.js +0 -540
- package/dist/resources/extensions/gsd/collision-diagnostics.js +0 -226
- package/dist/resources/extensions/gsd/commands-bootstrap.js +0 -223
- package/dist/resources/extensions/gsd/commands-config.js +0 -89
- package/dist/resources/extensions/gsd/commands-extensions.js +0 -259
- package/dist/resources/extensions/gsd/commands-handlers.js +0 -310
- package/dist/resources/extensions/gsd/commands-inspect.js +0 -70
- package/dist/resources/extensions/gsd/commands-logs.js +0 -468
- package/dist/resources/extensions/gsd/commands-maintenance.js +0 -185
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +0 -660
- package/dist/resources/extensions/gsd/commands-workflow-templates.js +0 -408
- package/dist/resources/extensions/gsd/commands.js +0 -1024
- package/dist/resources/extensions/gsd/complexity-classifier.js +0 -257
- package/dist/resources/extensions/gsd/context-budget.js +0 -187
- package/dist/resources/extensions/gsd/context-store.js +0 -165
- package/dist/resources/extensions/gsd/crash-recovery.js +0 -110
- package/dist/resources/extensions/gsd/dashboard-overlay.js +0 -562
- package/dist/resources/extensions/gsd/db-writer.js +0 -298
- package/dist/resources/extensions/gsd/debug-logger.js +0 -161
- package/dist/resources/extensions/gsd/detection.js +0 -373
- package/dist/resources/extensions/gsd/diff-context.js +0 -168
- package/dist/resources/extensions/gsd/dispatch-guard.js +0 -76
- package/dist/resources/extensions/gsd/doctor-checks.js +0 -563
- package/dist/resources/extensions/gsd/doctor-environment.js +0 -429
- package/dist/resources/extensions/gsd/doctor-format.js +0 -71
- package/dist/resources/extensions/gsd/doctor-proactive.js +0 -239
- package/dist/resources/extensions/gsd/doctor-providers.js +0 -292
- package/dist/resources/extensions/gsd/doctor-types.js +0 -12
- package/dist/resources/extensions/gsd/doctor.js +0 -672
- package/dist/resources/extensions/gsd/error-utils.js +0 -6
- package/dist/resources/extensions/gsd/exit-command.js +0 -11
- package/dist/resources/extensions/gsd/export.js +0 -268
- package/dist/resources/extensions/gsd/file-watcher.js +0 -76
- package/dist/resources/extensions/gsd/files.js +0 -937
- package/dist/resources/extensions/gsd/forensics.js +0 -511
- package/dist/resources/extensions/gsd/git-self-heal.js +0 -113
- package/dist/resources/extensions/gsd/git-service.js +0 -460
- package/dist/resources/extensions/gsd/gsd-db.js +0 -590
- package/dist/resources/extensions/gsd/guided-flow-queue.js +0 -366
- package/dist/resources/extensions/gsd/guided-flow.js +0 -1149
- package/dist/resources/extensions/gsd/health-widget.js +0 -141
- package/dist/resources/extensions/gsd/history.js +0 -118
- package/dist/resources/extensions/gsd/index.js +0 -1250
- package/dist/resources/extensions/gsd/init-wizard.js +0 -479
- package/dist/resources/extensions/gsd/json-persistence.js +0 -62
- package/dist/resources/extensions/gsd/key-manager.js +0 -829
- package/dist/resources/extensions/gsd/marketplace-discovery.js +0 -356
- package/dist/resources/extensions/gsd/md-importer.js +0 -440
- package/dist/resources/extensions/gsd/mechanical-completion.js +0 -351
- package/dist/resources/extensions/gsd/memory-extractor.js +0 -295
- package/dist/resources/extensions/gsd/memory-store.js +0 -351
- package/dist/resources/extensions/gsd/metrics.js +0 -377
- package/dist/resources/extensions/gsd/migrate/command.js +0 -157
- package/dist/resources/extensions/gsd/migrate/index.js +0 -7
- package/dist/resources/extensions/gsd/migrate/parser.js +0 -268
- package/dist/resources/extensions/gsd/migrate/parsers.js +0 -477
- package/dist/resources/extensions/gsd/migrate/preview.js +0 -47
- package/dist/resources/extensions/gsd/migrate/transformer.js +0 -278
- package/dist/resources/extensions/gsd/migrate/types.js +0 -4
- package/dist/resources/extensions/gsd/migrate/validator.js +0 -41
- package/dist/resources/extensions/gsd/migrate/writer.js +0 -477
- package/dist/resources/extensions/gsd/migrate-external.js +0 -130
- package/dist/resources/extensions/gsd/milestone-actions.js +0 -111
- package/dist/resources/extensions/gsd/model-cost-table.js +0 -48
- package/dist/resources/extensions/gsd/model-router.js +0 -187
- package/dist/resources/extensions/gsd/namespaced-registry.js +0 -322
- package/dist/resources/extensions/gsd/namespaced-resolver.js +0 -176
- package/dist/resources/extensions/gsd/native-git-bridge.js +0 -842
- package/dist/resources/extensions/gsd/native-parser-bridge.js +0 -156
- package/dist/resources/extensions/gsd/notifications.js +0 -58
- package/dist/resources/extensions/gsd/observability-validator.js +0 -398
- package/dist/resources/extensions/gsd/parallel-eligibility.js +0 -182
- package/dist/resources/extensions/gsd/parallel-merge.js +0 -121
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +0 -687
- package/dist/resources/extensions/gsd/paths.js +0 -414
- package/dist/resources/extensions/gsd/plugin-importer.js +0 -254
- package/dist/resources/extensions/gsd/post-unit-hooks.js +0 -433
- package/dist/resources/extensions/gsd/preferences-models.js +0 -294
- package/dist/resources/extensions/gsd/preferences-skills.js +0 -154
- package/dist/resources/extensions/gsd/preferences-types.js +0 -73
- package/dist/resources/extensions/gsd/preferences-validation.js +0 -607
- package/dist/resources/extensions/gsd/preferences.js +0 -325
- package/dist/resources/extensions/gsd/progress-score.js +0 -197
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.js +0 -150
- package/dist/resources/extensions/gsd/prompt-compressor.js +0 -393
- package/dist/resources/extensions/gsd/prompt-loader.js +0 -119
- package/dist/resources/extensions/gsd/prompt-ordering.js +0 -170
- package/dist/resources/extensions/gsd/provider-error-pause.js +0 -60
- package/dist/resources/extensions/gsd/queue-order.js +0 -178
- package/dist/resources/extensions/gsd/queue-reorder-ui.js +0 -234
- package/dist/resources/extensions/gsd/quick.js +0 -230
- package/dist/resources/extensions/gsd/repo-identity.js +0 -187
- package/dist/resources/extensions/gsd/roadmap-slices.js +0 -130
- package/dist/resources/extensions/gsd/routing-history.js +0 -210
- package/dist/resources/extensions/gsd/safe-fs.js +0 -52
- package/dist/resources/extensions/gsd/semantic-chunker.js +0 -254
- package/dist/resources/extensions/gsd/session-forensics.js +0 -427
- package/dist/resources/extensions/gsd/session-lock.js +0 -376
- package/dist/resources/extensions/gsd/session-status-io.js +0 -134
- package/dist/resources/extensions/gsd/skill-discovery.js +0 -121
- package/dist/resources/extensions/gsd/skill-health.js +0 -324
- package/dist/resources/extensions/gsd/state.js +0 -653
- package/dist/resources/extensions/gsd/structured-data-formatter.js +0 -97
- package/dist/resources/extensions/gsd/summary-distiller.js +0 -212
- package/dist/resources/extensions/gsd/token-counter.js +0 -54
- package/dist/resources/extensions/gsd/triage-resolution.js +0 -217
- package/dist/resources/extensions/gsd/triage-ui.js +0 -125
- package/dist/resources/extensions/gsd/types.js +0 -4
- package/dist/resources/extensions/gsd/undo.js +0 -210
- package/dist/resources/extensions/gsd/unit-id.js +0 -7
- package/dist/resources/extensions/gsd/unit-runtime.js +0 -130
- package/dist/resources/extensions/gsd/validate-directory.js +0 -143
- package/dist/resources/extensions/gsd/verification-evidence.js +0 -123
- package/dist/resources/extensions/gsd/verification-gate.js +0 -543
- package/dist/resources/extensions/gsd/visualizer-data.js +0 -612
- package/dist/resources/extensions/gsd/visualizer-overlay.js +0 -501
- package/dist/resources/extensions/gsd/visualizer-views.js +0 -893
- package/dist/resources/extensions/gsd/workflow-templates.js +0 -188
- package/dist/resources/extensions/gsd/workspace-index.js +0 -139
- package/dist/resources/extensions/gsd/worktree-command-bootstrap.js +0 -40
- package/dist/resources/extensions/gsd/worktree-command.js +0 -676
- package/dist/resources/extensions/gsd/worktree-manager.js +0 -359
- package/dist/resources/extensions/gsd/worktree.js +0 -236
- package/dist/resources/extensions/mac-tools/index.js +0 -768
- package/dist/resources/extensions/mcp-client/index.js +0 -363
- package/dist/resources/extensions/package.json +0 -3
- package/dist/resources/extensions/remote-questions/config.js +0 -70
- package/dist/resources/extensions/remote-questions/discord-adapter.js +0 -134
- package/dist/resources/extensions/remote-questions/format.js +0 -234
- package/dist/resources/extensions/remote-questions/http-client.js +0 -43
- package/dist/resources/extensions/remote-questions/manager.js +0 -156
- package/dist/resources/extensions/remote-questions/notify.js +0 -89
- package/dist/resources/extensions/remote-questions/remote-command.js +0 -453
- package/dist/resources/extensions/remote-questions/slack-adapter.js +0 -123
- package/dist/resources/extensions/remote-questions/status.js +0 -25
- package/dist/resources/extensions/remote-questions/store.js +0 -70
- package/dist/resources/extensions/remote-questions/telegram-adapter.js +0 -123
- package/dist/resources/extensions/remote-questions/types.js +0 -5
- package/dist/resources/extensions/search-the-web/cache.js +0 -74
- package/dist/resources/extensions/search-the-web/command-search-provider.js +0 -79
- package/dist/resources/extensions/search-the-web/format.js +0 -161
- package/dist/resources/extensions/search-the-web/http.js +0 -178
- package/dist/resources/extensions/search-the-web/index.js +0 -41
- package/dist/resources/extensions/search-the-web/native-search.js +0 -166
- package/dist/resources/extensions/search-the-web/provider.js +0 -143
- package/dist/resources/extensions/search-the-web/tavily.js +0 -82
- package/dist/resources/extensions/search-the-web/tool-fetch-page.js +0 -452
- package/dist/resources/extensions/search-the-web/tool-llm-context.js +0 -455
- package/dist/resources/extensions/search-the-web/tool-search.js +0 -482
- package/dist/resources/extensions/search-the-web/url-utils.js +0 -121
- package/dist/resources/extensions/shared/confirm-ui.js +0 -96
- package/dist/resources/extensions/shared/frontmatter.js +0 -109
- package/dist/resources/extensions/shared/interview-ui.js +0 -569
- package/dist/resources/extensions/shared/next-action-ui.js +0 -168
- package/dist/resources/extensions/shared/sanitize.js +0 -17
- package/dist/resources/extensions/shared/terminal.js +0 -21
- package/dist/resources/extensions/shared/ui.js +0 -245
- package/dist/resources/extensions/shared/wizard-ui.js +0 -478
- package/dist/resources/extensions/slash-commands/audit.js +0 -72
- package/dist/resources/extensions/slash-commands/clear.js +0 -8
- package/dist/resources/extensions/slash-commands/create-extension.js +0 -264
- package/dist/resources/extensions/slash-commands/create-slash-command.js +0 -208
- package/dist/resources/extensions/slash-commands/index.js +0 -10
- package/dist/resources/extensions/subagent/agents.js +0 -103
- package/dist/resources/extensions/subagent/index.js +0 -905
- package/dist/resources/extensions/subagent/isolation.js +0 -384
- package/dist/resources/extensions/subagent/worker-registry.js +0 -73
- package/dist/resources/extensions/ttsr/index.js +0 -144
- package/dist/resources/extensions/ttsr/rule-loader.js +0 -70
- package/dist/resources/extensions/ttsr/ttsr-manager.js +0 -380
- package/dist/resources/extensions/universal-config/discovery.js +0 -94
- package/dist/resources/extensions/universal-config/format.js +0 -178
- package/dist/resources/extensions/universal-config/index.js +0 -99
- package/dist/resources/extensions/universal-config/scanners.js +0 -574
- package/dist/resources/extensions/universal-config/tools.js +0 -57
- package/dist/resources/extensions/universal-config/types.js +0 -8
- package/dist/resources/extensions/voice/index.js +0 -247
- package/dist/startup-timings.d.ts +0 -2
- package/dist/startup-timings.js +0 -22
- package/src/resources/extensions/gsd/commands-bootstrap.ts +0 -252
- package/src/resources/extensions/gsd/tests/quick-branch-lifecycle.test.ts +0 -281
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +0 -71
- package/src/resources/extensions/gsd/worktree-command-bootstrap.ts +0 -46
- package/src/resources/extensions/package.json +0 -3
|
@@ -0,0 +1,985 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bg_shell tool registration — the core tool that agents use to manage background processes.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { StringEnum } from "@gsd/pi-ai";
|
|
6
|
+
import type { ExtensionAPI } from "@gsd/pi-coding-agent";
|
|
7
|
+
import { Text } from "@gsd/pi-tui";
|
|
8
|
+
import { Type } from "@sinclair/typebox";
|
|
9
|
+
|
|
10
|
+
import type { BgProcessInfo, ProcessType } from "./types.js";
|
|
11
|
+
import { DEFAULT_READY_TIMEOUT } from "./types.js";
|
|
12
|
+
import {
|
|
13
|
+
processes,
|
|
14
|
+
startProcess,
|
|
15
|
+
killProcess,
|
|
16
|
+
restartProcess,
|
|
17
|
+
getInfo,
|
|
18
|
+
getGroupStatus,
|
|
19
|
+
persistManifest,
|
|
20
|
+
} from "./process-manager.js";
|
|
21
|
+
import {
|
|
22
|
+
generateDigest,
|
|
23
|
+
getHighlights,
|
|
24
|
+
getOutput,
|
|
25
|
+
formatDigestText,
|
|
26
|
+
} from "./output-formatter.js";
|
|
27
|
+
import { waitForReady } from "./readiness-detector.js";
|
|
28
|
+
import { queryShellEnv, sendAndWait, runOnSession } from "./interaction.js";
|
|
29
|
+
import { toPosixPath } from "../shared/path-display.js";
|
|
30
|
+
|
|
31
|
+
import type { BgShellSharedState } from "./index.js";
|
|
32
|
+
|
|
33
|
+
export function registerBgShellTool(pi: ExtensionAPI, state: BgShellSharedState): void {
|
|
34
|
+
pi.registerTool({
|
|
35
|
+
name: "bg_shell",
|
|
36
|
+
label: "Background Shell",
|
|
37
|
+
description:
|
|
38
|
+
"Run shell commands in the background without blocking. Manages persistent background processes with intelligent lifecycle tracking. " +
|
|
39
|
+
"Actions: start (launch with auto-classification & readiness detection), digest (structured summary ~30 tokens vs ~2000 raw), " +
|
|
40
|
+
"output (raw lines with incremental delivery), wait_for_ready (block until process signals readiness), " +
|
|
41
|
+
"send (write stdin), send_and_wait (expect-style: send + wait for output pattern), " +
|
|
42
|
+
"run (execute a command on a persistent shell session, block until done, return output + exit code), " +
|
|
43
|
+
"env (query shell cwd and environment variables), " +
|
|
44
|
+
"signal (send OS signal), list (all processes with status), kill (terminate), restart (kill + relaunch), " +
|
|
45
|
+
"group_status (health of a process group), highlights (significant output lines only).",
|
|
46
|
+
|
|
47
|
+
promptGuidelines: [
|
|
48
|
+
"Use bg_shell to start long-running processes (servers, watchers, builds) that should not block the agent.",
|
|
49
|
+
"After starting a server, use 'wait_for_ready' to efficiently block until it's listening — avoids polling loops entirely.",
|
|
50
|
+
"Use 'digest' instead of 'output' when you just need status — it returns a structured ~30-token summary instead of ~2000 tokens of raw output.",
|
|
51
|
+
"Use 'highlights' to see only significant output (errors, URLs, results) — typically 5-15 lines instead of hundreds.",
|
|
52
|
+
"Use 'output' only when you need raw lines for debugging — add filter:'error|warning' to narrow results.",
|
|
53
|
+
"The 'output' action returns only new output since the last check (incremental). Repeated calls are cheap on context.",
|
|
54
|
+
"Set type:'server' and ready_port:3000 for dev servers so readiness detection is automatic.",
|
|
55
|
+
"Set group:'my-stack' on related processes to manage them together with 'group_status'.",
|
|
56
|
+
"Use 'run' to execute a command on a persistent shell session and block until it completes — returns structured output + exit code. Shell state (env vars, cwd, virtualenvs) persists across runs.",
|
|
57
|
+
"Use 'send_and_wait' for interactive CLIs: send input and wait for expected output pattern.",
|
|
58
|
+
"Use 'env' to check the current working directory and active environment variables of a shell session — useful after cd, source, or export commands.",
|
|
59
|
+
"Background processes are session-scoped by default: a new session reaps them unless you set persist_across_sessions:true.",
|
|
60
|
+
"Use 'restart' to kill and relaunch with the same config — preserves restart count.",
|
|
61
|
+
"Background processes are auto-classified (server/build/test/watcher) based on the command.",
|
|
62
|
+
"Process crashes and errors are automatically surfaced as alerts at the start of your next turn — you don't need to poll.",
|
|
63
|
+
"To create a persistent shell session: bg_shell start with type:'shell'. The session stays alive for interactive use with 'send', 'send_and_wait', or 'run'.",
|
|
64
|
+
],
|
|
65
|
+
|
|
66
|
+
parameters: Type.Object({
|
|
67
|
+
action: StringEnum([
|
|
68
|
+
"start",
|
|
69
|
+
"digest",
|
|
70
|
+
"output",
|
|
71
|
+
"highlights",
|
|
72
|
+
"wait_for_ready",
|
|
73
|
+
"send",
|
|
74
|
+
"send_and_wait",
|
|
75
|
+
"run",
|
|
76
|
+
"env",
|
|
77
|
+
"signal",
|
|
78
|
+
"list",
|
|
79
|
+
"kill",
|
|
80
|
+
"restart",
|
|
81
|
+
"group_status",
|
|
82
|
+
] as const),
|
|
83
|
+
command: Type.Optional(
|
|
84
|
+
Type.String({ description: "Shell command to run (for start, run)" }),
|
|
85
|
+
),
|
|
86
|
+
label: Type.Optional(
|
|
87
|
+
Type.String({ description: "Short human-readable label for the process (for start)" }),
|
|
88
|
+
),
|
|
89
|
+
id: Type.Optional(
|
|
90
|
+
Type.String({ description: "Process ID (for digest, output, highlights, wait_for_ready, send, send_and_wait, run, signal, kill, restart)" }),
|
|
91
|
+
),
|
|
92
|
+
stream: Type.Optional(
|
|
93
|
+
StringEnum(["stdout", "stderr", "both"] as const),
|
|
94
|
+
),
|
|
95
|
+
tail: Type.Optional(
|
|
96
|
+
Type.Number({ description: "Number of most recent lines to return (for output). Defaults to 100." }),
|
|
97
|
+
),
|
|
98
|
+
filter: Type.Optional(
|
|
99
|
+
Type.String({ description: "Regex pattern to filter output lines (for output). Case-insensitive." }),
|
|
100
|
+
),
|
|
101
|
+
input: Type.Optional(
|
|
102
|
+
Type.String({ description: "Text to write to process stdin (for send, send_and_wait)" }),
|
|
103
|
+
),
|
|
104
|
+
wait_pattern: Type.Optional(
|
|
105
|
+
Type.String({ description: "Regex to wait for in output (for send_and_wait)" }),
|
|
106
|
+
),
|
|
107
|
+
signal_name: Type.Optional(
|
|
108
|
+
Type.String({ description: "OS signal to send, e.g. SIGINT, SIGTERM, SIGHUP (for signal)" }),
|
|
109
|
+
),
|
|
110
|
+
timeout: Type.Optional(
|
|
111
|
+
Type.Number({ description: "Timeout in milliseconds (for wait_for_ready, send_and_wait, run). Default: 30000 for wait_for_ready/send_and_wait, 120000 for run" }),
|
|
112
|
+
),
|
|
113
|
+
type: Type.Optional(
|
|
114
|
+
StringEnum(["server", "build", "test", "watcher", "generic", "shell"] as const),
|
|
115
|
+
),
|
|
116
|
+
ready_pattern: Type.Optional(
|
|
117
|
+
Type.String({ description: "Regex pattern that indicates the process is ready (for start)" }),
|
|
118
|
+
),
|
|
119
|
+
ready_port: Type.Optional(
|
|
120
|
+
Type.Number({ description: "Port to probe for readiness (for start). When open, process is considered ready." }),
|
|
121
|
+
),
|
|
122
|
+
ready_timeout: Type.Optional(
|
|
123
|
+
Type.Number({ description: "Max milliseconds to wait for ready_port/ready_pattern before marking as error (default: 30000)" }),
|
|
124
|
+
),
|
|
125
|
+
group: Type.Optional(
|
|
126
|
+
Type.String({ description: "Group name for related processes (for start, group_status)" }),
|
|
127
|
+
),
|
|
128
|
+
persist_across_sessions: Type.Optional(
|
|
129
|
+
Type.Boolean({
|
|
130
|
+
description: "Keep this process running after a new session starts. Default: false.",
|
|
131
|
+
default: false,
|
|
132
|
+
}),
|
|
133
|
+
),
|
|
134
|
+
}),
|
|
135
|
+
|
|
136
|
+
async execute(_toolCallId, params, signal, _onUpdate, ctx) {
|
|
137
|
+
state.latestCtx = ctx;
|
|
138
|
+
|
|
139
|
+
switch (params.action) {
|
|
140
|
+
// ── start ──────────────────────────────────────────
|
|
141
|
+
case "start": {
|
|
142
|
+
if (!params.command) {
|
|
143
|
+
return {
|
|
144
|
+
content: [{ type: "text" as const, text: "Error: 'command' is required for start" }],
|
|
145
|
+
isError: true, details: undefined as unknown,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const bg = startProcess({
|
|
150
|
+
command: params.command,
|
|
151
|
+
cwd: ctx.cwd,
|
|
152
|
+
ownerSessionFile: ctx.sessionManager.getSessionFile() ?? null,
|
|
153
|
+
persistAcrossSessions: params.persist_across_sessions ?? false,
|
|
154
|
+
label: params.label,
|
|
155
|
+
type: params.type as ProcessType | undefined,
|
|
156
|
+
readyPattern: params.ready_pattern,
|
|
157
|
+
readyPort: params.ready_port,
|
|
158
|
+
readyTimeout: params.ready_timeout,
|
|
159
|
+
group: params.group,
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// Give the process a moment to potentially fail immediately
|
|
163
|
+
await new Promise(r => setTimeout(r, 500));
|
|
164
|
+
|
|
165
|
+
// Persist manifest
|
|
166
|
+
persistManifest(ctx.cwd);
|
|
167
|
+
|
|
168
|
+
const info = getInfo(bg);
|
|
169
|
+
let text = `Started background process ${bg.id}\n`;
|
|
170
|
+
text += ` label: ${bg.label}\n`;
|
|
171
|
+
text += ` type: ${bg.processType}\n`;
|
|
172
|
+
text += ` status: ${bg.status}\n`;
|
|
173
|
+
text += ` command: ${bg.command}\n`;
|
|
174
|
+
text += ` cwd: ${toPosixPath(bg.cwd)}`;
|
|
175
|
+
if (bg.group) text += `\n group: ${bg.group}`;
|
|
176
|
+
if (bg.persistAcrossSessions) text += `\n persist_across_sessions: true`;
|
|
177
|
+
if (bg.readyPort) text += `\n ready_port: ${bg.readyPort}`;
|
|
178
|
+
if (bg.readyPattern) text += `\n ready_pattern: ${bg.readyPattern}`;
|
|
179
|
+
if (bg.ports.length > 0) text += `\n detected ports: ${bg.ports.join(", ")}`;
|
|
180
|
+
if (bg.urls.length > 0) text += `\n detected urls: ${bg.urls.join(", ")}`;
|
|
181
|
+
|
|
182
|
+
if (!bg.alive) {
|
|
183
|
+
text += `\n exit code: ${bg.exitCode}`;
|
|
184
|
+
const errLines = bg.output.filter(l => l.stream === "stderr").map(l => l.line);
|
|
185
|
+
const errOut = errLines.join("\n").trim();
|
|
186
|
+
if (errOut) text += `\n stderr:\n${errOut}`;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
content: [{ type: "text" as const, text }],
|
|
191
|
+
details: { action: "start", process: info },
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ── digest ─────────────────────────────────────────
|
|
196
|
+
case "digest": {
|
|
197
|
+
// Can get digest for a single process or all
|
|
198
|
+
if (params.id) {
|
|
199
|
+
const bg = processes.get(params.id);
|
|
200
|
+
if (!bg) {
|
|
201
|
+
return {
|
|
202
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
203
|
+
isError: true, details: undefined as unknown,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const digest = generateDigest(bg, true);
|
|
207
|
+
return {
|
|
208
|
+
content: [{ type: "text" as const, text: formatDigestText(bg, digest) }],
|
|
209
|
+
details: { action: "digest", process: getInfo(bg), digest },
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// All processes digest
|
|
214
|
+
const all = Array.from(processes.values());
|
|
215
|
+
if (all.length === 0) {
|
|
216
|
+
return {
|
|
217
|
+
content: [{ type: "text" as const, text: "No background processes." }],
|
|
218
|
+
details: { action: "digest", processes: [] },
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const lines = all.map(bg => {
|
|
223
|
+
const d = generateDigest(bg, true);
|
|
224
|
+
const status = bg.alive
|
|
225
|
+
? (bg.status === "ready" ? "✓" : bg.status === "error" ? "✗" : "⋯")
|
|
226
|
+
: "○";
|
|
227
|
+
const portInfo = d.ports.length > 0 ? ` :${d.ports.join(",")}` : "";
|
|
228
|
+
const errInfo = d.errors.length > 0 ? ` (${d.errors.length} errors)` : "";
|
|
229
|
+
return `${status} ${bg.id} ${bg.label} [${bg.processType}] ${d.uptime}${portInfo}${errInfo} — ${d.changeSummary}`;
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
content: [{ type: "text" as const, text: `Background processes (${all.length}):\n${lines.join("\n")}` }],
|
|
234
|
+
details: { action: "digest", count: all.length },
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// ── highlights ──────────────────────────────────────
|
|
239
|
+
case "highlights": {
|
|
240
|
+
if (!params.id) {
|
|
241
|
+
return {
|
|
242
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for highlights" }],
|
|
243
|
+
isError: true, details: undefined as unknown,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const bg = processes.get(params.id);
|
|
248
|
+
if (!bg) {
|
|
249
|
+
return {
|
|
250
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
251
|
+
isError: true, details: undefined as unknown,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const highlights = getHighlights(bg, params.tail || 15);
|
|
256
|
+
const info = getInfo(bg);
|
|
257
|
+
let text = `Highlights for ${bg.id} (${bg.label}) — ${bg.status}:\n`;
|
|
258
|
+
if (highlights.length === 0) {
|
|
259
|
+
text += "(no significant output)";
|
|
260
|
+
} else {
|
|
261
|
+
text += highlights.join("\n");
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return {
|
|
265
|
+
content: [{ type: "text" as const, text }],
|
|
266
|
+
details: { action: "highlights", process: info, lineCount: highlights.length },
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ── output ─────────────────────────────────────────
|
|
271
|
+
case "output": {
|
|
272
|
+
if (!params.id) {
|
|
273
|
+
return {
|
|
274
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for output" }],
|
|
275
|
+
isError: true, details: undefined as unknown,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const bg = processes.get(params.id);
|
|
280
|
+
if (!bg) {
|
|
281
|
+
return {
|
|
282
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
283
|
+
isError: true, details: undefined as unknown,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const stream = params.stream || "both";
|
|
288
|
+
const tail = params.tail ?? 100;
|
|
289
|
+
const output = getOutput(bg, {
|
|
290
|
+
stream,
|
|
291
|
+
tail,
|
|
292
|
+
filter: params.filter,
|
|
293
|
+
incremental: true,
|
|
294
|
+
});
|
|
295
|
+
const info = getInfo(bg);
|
|
296
|
+
|
|
297
|
+
let text = `Process ${bg.id} (${bg.label})`;
|
|
298
|
+
text += ` — ${bg.alive ? `${bg.status}` : `exited (code ${bg.exitCode})`}`;
|
|
299
|
+
if (output) {
|
|
300
|
+
text += `\n${output}`;
|
|
301
|
+
} else {
|
|
302
|
+
text += `\n(no new output since last check)`;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return {
|
|
306
|
+
content: [{ type: "text" as const, text }],
|
|
307
|
+
details: { action: "output", process: info, stream, tail },
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// ── wait_for_ready ──────────────────────────────────
|
|
312
|
+
case "wait_for_ready": {
|
|
313
|
+
if (!params.id) {
|
|
314
|
+
return {
|
|
315
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for wait_for_ready" }],
|
|
316
|
+
isError: true, details: undefined as unknown,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const bg = processes.get(params.id);
|
|
321
|
+
if (!bg) {
|
|
322
|
+
return {
|
|
323
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
324
|
+
isError: true, details: undefined as unknown,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Already ready?
|
|
329
|
+
if (bg.status === "ready") {
|
|
330
|
+
const digest = generateDigest(bg, true);
|
|
331
|
+
return {
|
|
332
|
+
content: [{ type: "text" as const, text: `Process ${bg.id} is already ready.\n${formatDigestText(bg, digest)}` }],
|
|
333
|
+
details: { action: "wait_for_ready", process: getInfo(bg), ready: true },
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const timeout = params.timeout || DEFAULT_READY_TIMEOUT;
|
|
338
|
+
const result = await waitForReady(bg, timeout, signal ?? undefined);
|
|
339
|
+
|
|
340
|
+
const digest = generateDigest(bg, true);
|
|
341
|
+
let text: string;
|
|
342
|
+
if (result.ready) {
|
|
343
|
+
text = `✓ Process ${bg.id} is ready: ${result.detail}\n${formatDigestText(bg, digest)}`;
|
|
344
|
+
} else {
|
|
345
|
+
text = `✗ Process ${bg.id} not ready: ${result.detail}\n${formatDigestText(bg, digest)}`;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return {
|
|
349
|
+
content: [{ type: "text" as const, text }],
|
|
350
|
+
details: { action: "wait_for_ready", process: getInfo(bg), ready: result.ready, detail: result.detail },
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// ── send ───────────────────────────────────────────
|
|
355
|
+
case "send": {
|
|
356
|
+
if (!params.id) {
|
|
357
|
+
return {
|
|
358
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for send" }],
|
|
359
|
+
isError: true, details: undefined as unknown,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
if (params.input === undefined) {
|
|
363
|
+
return {
|
|
364
|
+
content: [{ type: "text" as const, text: "Error: 'input' is required for send" }],
|
|
365
|
+
isError: true, details: undefined as unknown,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const bg = processes.get(params.id);
|
|
370
|
+
if (!bg) {
|
|
371
|
+
return {
|
|
372
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
373
|
+
isError: true, details: undefined as unknown,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (!bg.alive) {
|
|
378
|
+
return {
|
|
379
|
+
content: [{ type: "text" as const, text: `Error: Process ${params.id} has already exited` }],
|
|
380
|
+
isError: true, details: undefined as unknown,
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
try {
|
|
385
|
+
bg.proc.stdin?.write(params.input + "\n");
|
|
386
|
+
return {
|
|
387
|
+
content: [{ type: "text" as const, text: `Sent input to process ${bg.id}` }],
|
|
388
|
+
details: { action: "send", process: getInfo(bg) },
|
|
389
|
+
};
|
|
390
|
+
} catch (err) {
|
|
391
|
+
return {
|
|
392
|
+
content: [{ type: "text" as const, text: `Error writing to stdin: ${err instanceof Error ? err.message : String(err)}` }],
|
|
393
|
+
isError: true, details: undefined as unknown,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// ── send_and_wait ───────────────────────────────────
|
|
399
|
+
case "send_and_wait": {
|
|
400
|
+
if (!params.id) {
|
|
401
|
+
return {
|
|
402
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for send_and_wait" }],
|
|
403
|
+
isError: true, details: undefined as unknown,
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
if (params.input === undefined) {
|
|
407
|
+
return {
|
|
408
|
+
content: [{ type: "text" as const, text: "Error: 'input' is required for send_and_wait" }],
|
|
409
|
+
isError: true, details: undefined as unknown,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
if (!params.wait_pattern) {
|
|
413
|
+
return {
|
|
414
|
+
content: [{ type: "text" as const, text: "Error: 'wait_pattern' is required for send_and_wait" }],
|
|
415
|
+
isError: true, details: undefined as unknown,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const bg = processes.get(params.id);
|
|
420
|
+
if (!bg) {
|
|
421
|
+
return {
|
|
422
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
423
|
+
isError: true, details: undefined as unknown,
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
if (!bg.alive) {
|
|
428
|
+
return {
|
|
429
|
+
content: [{ type: "text" as const, text: `Error: Process ${params.id} has already exited` }],
|
|
430
|
+
isError: true, details: undefined as unknown,
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const timeout = params.timeout || 10000;
|
|
435
|
+
const result = await sendAndWait(bg, params.input, params.wait_pattern, timeout, signal ?? undefined);
|
|
436
|
+
|
|
437
|
+
let text: string;
|
|
438
|
+
if (result.matched) {
|
|
439
|
+
text = `✓ Pattern matched for process ${bg.id}\n${result.output}`;
|
|
440
|
+
} else {
|
|
441
|
+
text = `✗ Pattern not matched (timed out after ${timeout}ms)\n${result.output}`;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return {
|
|
445
|
+
content: [{ type: "text" as const, text }],
|
|
446
|
+
details: { action: "send_and_wait", process: getInfo(bg), matched: result.matched },
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// ── run ────────────────────────────────────────────
|
|
451
|
+
case "run": {
|
|
452
|
+
if (!params.id) {
|
|
453
|
+
return {
|
|
454
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for run" }],
|
|
455
|
+
isError: true, details: undefined as unknown,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
if (!params.command) {
|
|
459
|
+
return {
|
|
460
|
+
content: [{ type: "text" as const, text: "Error: 'command' is required for run" }],
|
|
461
|
+
isError: true, details: undefined as unknown,
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const bg = processes.get(params.id);
|
|
466
|
+
if (!bg) {
|
|
467
|
+
return {
|
|
468
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
469
|
+
isError: true, details: undefined as unknown,
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (!bg.alive) {
|
|
474
|
+
return {
|
|
475
|
+
content: [{ type: "text" as const, text: `Error: Process ${params.id} has already exited` }],
|
|
476
|
+
isError: true, details: undefined as unknown,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
const runTimeout = params.timeout || 120000;
|
|
481
|
+
const result = await runOnSession(bg, params.command, runTimeout, signal ?? undefined);
|
|
482
|
+
|
|
483
|
+
let text: string;
|
|
484
|
+
if (result.timedOut) {
|
|
485
|
+
text = `Command timed out after ${runTimeout}ms\nOutput:\n${result.output}`;
|
|
486
|
+
} else {
|
|
487
|
+
text = `Exit code: ${result.exitCode}\n${result.output}`;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
return {
|
|
491
|
+
content: [{ type: "text" as const, text }],
|
|
492
|
+
details: { action: "run", process: getInfo(bg), exitCode: result.exitCode, timedOut: result.timedOut },
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// ── env ───────────────────────────────────────────
|
|
497
|
+
case "env": {
|
|
498
|
+
if (!params.id) {
|
|
499
|
+
return {
|
|
500
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for env" }],
|
|
501
|
+
isError: true, details: undefined as unknown,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const bg = processes.get(params.id);
|
|
506
|
+
if (!bg) {
|
|
507
|
+
return {
|
|
508
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
509
|
+
isError: true, details: undefined as unknown,
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if (!bg.alive) {
|
|
514
|
+
return {
|
|
515
|
+
content: [{ type: "text" as const, text: `Error: Process ${params.id} has already exited` }],
|
|
516
|
+
isError: true, details: undefined as unknown,
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
const timeout = params.timeout || 5000;
|
|
521
|
+
const envResult = await queryShellEnv(bg, timeout, signal ?? undefined);
|
|
522
|
+
|
|
523
|
+
if (!envResult) {
|
|
524
|
+
return {
|
|
525
|
+
content: [{ type: "text" as const, text: `Failed to query environment for process ${bg.id} (timed out or process died)` }],
|
|
526
|
+
isError: true, details: undefined as unknown,
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
let text = `Shell environment for ${bg.id} (${bg.label}):\n`;
|
|
531
|
+
text += ` cwd: ${toPosixPath(envResult.cwd)}\n`;
|
|
532
|
+
text += ` shell: ${envResult.shell}\n`;
|
|
533
|
+
|
|
534
|
+
const envEntries = Object.entries(envResult.env);
|
|
535
|
+
if (envEntries.length > 0) {
|
|
536
|
+
text += ` environment:\n`;
|
|
537
|
+
for (const [key, value] of envEntries) {
|
|
538
|
+
const displayValue = value.length > 100 ? value.slice(0, 97) + "..." : value;
|
|
539
|
+
text += ` ${key}=${displayValue}\n`;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return {
|
|
544
|
+
content: [{ type: "text" as const, text: text.trimEnd() }],
|
|
545
|
+
details: { action: "env", process: getInfo(bg), env: envResult },
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// ── signal ─────────────────────────────────────────
|
|
550
|
+
case "signal": {
|
|
551
|
+
if (!params.id) {
|
|
552
|
+
return {
|
|
553
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for signal" }],
|
|
554
|
+
isError: true, details: undefined as unknown,
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
const bg = processes.get(params.id);
|
|
559
|
+
if (!bg) {
|
|
560
|
+
return {
|
|
561
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
562
|
+
isError: true, details: undefined as unknown,
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
const sig = (params.signal_name || "SIGINT") as NodeJS.Signals;
|
|
567
|
+
const sent = killProcess(params.id, sig);
|
|
568
|
+
|
|
569
|
+
return {
|
|
570
|
+
content: [{ type: "text" as const, text: sent ? `Sent ${sig} to process ${bg.id} (${bg.label})` : `Failed to send ${sig} to process ${bg.id}` }],
|
|
571
|
+
details: { action: "signal", process: getInfo(bg), signal: sig },
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// ── list ───────────────────────────────────────────
|
|
576
|
+
case "list": {
|
|
577
|
+
const all = Array.from(processes.values()).map(getInfo);
|
|
578
|
+
|
|
579
|
+
if (all.length === 0) {
|
|
580
|
+
return {
|
|
581
|
+
content: [{ type: "text" as const, text: "No background processes." }],
|
|
582
|
+
details: { action: "list", processes: [] },
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const lines = all.map(p => {
|
|
587
|
+
const status = p.alive
|
|
588
|
+
? (p.status === "ready" ? "✓ ready" : p.status === "error" ? "✗ error" : "⋯ starting")
|
|
589
|
+
: `○ ${p.status} (code ${p.exitCode})`;
|
|
590
|
+
const portInfo = p.ports.length > 0 ? ` :${p.ports.join(",")}` : "";
|
|
591
|
+
const urlInfo = p.urls.length > 0 ? ` ${p.urls[0]}` : "";
|
|
592
|
+
const groupInfo = p.group ? ` [${p.group}]` : "";
|
|
593
|
+
return `${p.id} ${status} ${p.uptime} ${p.label} [${p.processType}]${portInfo}${urlInfo}${groupInfo}`;
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
return {
|
|
597
|
+
content: [{ type: "text" as const, text: `Background processes (${all.length}):\n${lines.join("\n")}` }],
|
|
598
|
+
details: { action: "list", processes: all },
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// ── kill ───────────────────────────────────────────
|
|
603
|
+
case "kill": {
|
|
604
|
+
if (!params.id) {
|
|
605
|
+
return {
|
|
606
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for kill" }],
|
|
607
|
+
isError: true, details: undefined as unknown,
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const bg = processes.get(params.id);
|
|
612
|
+
if (!bg) {
|
|
613
|
+
return {
|
|
614
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
615
|
+
isError: true, details: undefined as unknown,
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
const killed = killProcess(params.id, "SIGTERM");
|
|
620
|
+
await new Promise(r => setTimeout(r, 300));
|
|
621
|
+
if (bg.alive) {
|
|
622
|
+
killProcess(params.id, "SIGKILL");
|
|
623
|
+
await new Promise(r => setTimeout(r, 200));
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
const info = getInfo(bg);
|
|
627
|
+
if (!bg.alive) processes.delete(params.id);
|
|
628
|
+
|
|
629
|
+
// Update manifest
|
|
630
|
+
persistManifest(ctx.cwd);
|
|
631
|
+
|
|
632
|
+
return {
|
|
633
|
+
content: [{ type: "text" as const, text: killed ? `Killed process ${bg.id} (${bg.label})` : `Failed to kill process ${bg.id}` }],
|
|
634
|
+
details: { action: "kill", process: info },
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// ── restart ────────────────────────────────────────
|
|
639
|
+
case "restart": {
|
|
640
|
+
if (!params.id) {
|
|
641
|
+
return {
|
|
642
|
+
content: [{ type: "text" as const, text: "Error: 'id' is required for restart" }],
|
|
643
|
+
isError: true, details: undefined as unknown,
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
const newBg = await restartProcess(params.id);
|
|
648
|
+
if (!newBg) {
|
|
649
|
+
return {
|
|
650
|
+
content: [{ type: "text" as const, text: `Error: No process found with id '${params.id}'` }],
|
|
651
|
+
isError: true, details: undefined as unknown,
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// Give it a moment
|
|
656
|
+
await new Promise(r => setTimeout(r, 500));
|
|
657
|
+
persistManifest(ctx.cwd);
|
|
658
|
+
|
|
659
|
+
const info = getInfo(newBg);
|
|
660
|
+
let text = `Restarted process (restart #${newBg.restartCount})\n`;
|
|
661
|
+
text += ` new id: ${newBg.id}\n`;
|
|
662
|
+
text += ` label: ${newBg.label}\n`;
|
|
663
|
+
text += ` type: ${newBg.processType}\n`;
|
|
664
|
+
text += ` status: ${newBg.status}\n`;
|
|
665
|
+
text += ` command: ${newBg.command}`;
|
|
666
|
+
|
|
667
|
+
return {
|
|
668
|
+
content: [{ type: "text" as const, text }],
|
|
669
|
+
details: { action: "restart", process: info, previousId: params.id },
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// ── group_status ────────────────────────────────────
|
|
674
|
+
case "group_status": {
|
|
675
|
+
if (!params.group) {
|
|
676
|
+
// List all groups
|
|
677
|
+
const groups = new Set<string>();
|
|
678
|
+
for (const p of processes.values()) {
|
|
679
|
+
if (p.group) groups.add(p.group);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (groups.size === 0) {
|
|
683
|
+
return {
|
|
684
|
+
content: [{ type: "text" as const, text: "No process groups defined." }],
|
|
685
|
+
details: { action: "group_status", groups: [] },
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
const statuses = Array.from(groups).map(g => {
|
|
690
|
+
const gs = getGroupStatus(g);
|
|
691
|
+
const icon = gs.healthy ? "✓" : "✗";
|
|
692
|
+
const procs = gs.processes.map(p => `${p.id} (${p.status})`).join(", ");
|
|
693
|
+
return `${icon} ${g}: ${procs}`;
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
return {
|
|
697
|
+
content: [{ type: "text" as const, text: `Process groups:\n${statuses.join("\n")}` }],
|
|
698
|
+
details: { action: "group_status", groups: Array.from(groups) },
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
const gs = getGroupStatus(params.group);
|
|
703
|
+
const icon = gs.healthy ? "✓" : "✗";
|
|
704
|
+
let text = `${icon} Group '${params.group}' — ${gs.healthy ? "healthy" : "unhealthy"}\n`;
|
|
705
|
+
for (const p of gs.processes) {
|
|
706
|
+
text += ` ${p.id}: ${p.label} — ${p.status}${p.alive ? "" : " (dead)"}\n`;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
return {
|
|
710
|
+
content: [{ type: "text" as const, text }],
|
|
711
|
+
details: { action: "group_status", groupStatus: gs },
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
default:
|
|
716
|
+
return {
|
|
717
|
+
content: [{ type: "text" as const, text: `Unknown action: ${params.action}` }],
|
|
718
|
+
isError: true, details: undefined as unknown,
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
|
|
723
|
+
// ── Rendering ────────────────────────────────────────────────────
|
|
724
|
+
|
|
725
|
+
renderCall(args, theme) {
|
|
726
|
+
let text = theme.fg("toolTitle", theme.bold("bg_shell "));
|
|
727
|
+
text += theme.fg("accent", args.action);
|
|
728
|
+
if (args.command) text += " " + theme.fg("muted", `$ ${args.command}`);
|
|
729
|
+
if (args.id) text += " " + theme.fg("dim", `[${args.id}]`);
|
|
730
|
+
if (args.label) text += " " + theme.fg("dim", `(${args.label})`);
|
|
731
|
+
if (args.type) text += " " + theme.fg("dim", `type:${args.type}`);
|
|
732
|
+
if (args.ready_port) text += " " + theme.fg("dim", `port:${args.ready_port}`);
|
|
733
|
+
if (args.group) text += " " + theme.fg("dim", `group:${args.group}`);
|
|
734
|
+
return new Text(text, 0, 0);
|
|
735
|
+
},
|
|
736
|
+
|
|
737
|
+
renderResult(result, { expanded }, theme) {
|
|
738
|
+
const details = result.details as Record<string, unknown> | undefined;
|
|
739
|
+
if (!details) {
|
|
740
|
+
const text = result.content[0];
|
|
741
|
+
return new Text(text?.type === "text" ? text.text : "", 0, 0);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
const action = details.action as string;
|
|
745
|
+
|
|
746
|
+
if ((result as any).isError) {
|
|
747
|
+
const text = result.content[0];
|
|
748
|
+
return new Text(
|
|
749
|
+
theme.fg("error", text?.type === "text" ? text.text : "Error"),
|
|
750
|
+
0, 0,
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
switch (action) {
|
|
755
|
+
case "start": {
|
|
756
|
+
const proc = details.process as BgProcessInfo;
|
|
757
|
+
let text = theme.fg("success", "▸ Started ");
|
|
758
|
+
text += theme.fg("accent", proc.id);
|
|
759
|
+
text += " " + theme.fg("muted", proc.label);
|
|
760
|
+
text += " " + theme.fg("dim", `[${proc.processType}]`);
|
|
761
|
+
if (proc.ports.length > 0) text += " " + theme.fg("dim", `:${proc.ports.join(",")}`);
|
|
762
|
+
if (!proc.alive) {
|
|
763
|
+
text += " " + theme.fg("error", `(exited: ${proc.exitCode})`);
|
|
764
|
+
}
|
|
765
|
+
return new Text(text, 0, 0);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
case "digest": {
|
|
769
|
+
const proc = details.process as BgProcessInfo | undefined;
|
|
770
|
+
if (proc) {
|
|
771
|
+
const statusIcon = proc.status === "ready" ? theme.fg("success", "✓")
|
|
772
|
+
: proc.status === "error" ? theme.fg("error", "✗")
|
|
773
|
+
: theme.fg("warning", "⋯");
|
|
774
|
+
let text = `${statusIcon} ${theme.fg("accent", proc.id)} ${theme.fg("muted", proc.label)}`;
|
|
775
|
+
if (expanded) {
|
|
776
|
+
const rawText = result.content[0];
|
|
777
|
+
if (rawText?.type === "text") {
|
|
778
|
+
const lines = rawText.text.split("\n").slice(1);
|
|
779
|
+
for (const line of lines.slice(0, 20)) {
|
|
780
|
+
text += "\n " + theme.fg("dim", line);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
return new Text(text, 0, 0);
|
|
785
|
+
}
|
|
786
|
+
return new Text(theme.fg("dim", `${details.count ?? 0} process(es)`), 0, 0);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
case "highlights": {
|
|
790
|
+
const proc = details.process as BgProcessInfo;
|
|
791
|
+
const lineCount = details.lineCount as number;
|
|
792
|
+
let text = theme.fg("accent", proc.id) + " " + theme.fg("dim", `${lineCount} highlights`);
|
|
793
|
+
if (expanded) {
|
|
794
|
+
const rawText = result.content[0];
|
|
795
|
+
if (rawText?.type === "text") {
|
|
796
|
+
const lines = rawText.text.split("\n").slice(1);
|
|
797
|
+
for (const line of lines.slice(0, 20)) {
|
|
798
|
+
text += "\n " + theme.fg("toolOutput", line);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
return new Text(text, 0, 0);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
case "output": {
|
|
806
|
+
const proc = details.process as BgProcessInfo;
|
|
807
|
+
const statusIcon = proc.alive
|
|
808
|
+
? (proc.status === "ready" ? theme.fg("success", "●") : proc.status === "error" ? theme.fg("error", "●") : theme.fg("warning", "●"))
|
|
809
|
+
: theme.fg("error", "○");
|
|
810
|
+
let text = `${statusIcon} ${theme.fg("accent", proc.id)} ${theme.fg("muted", proc.label)}`;
|
|
811
|
+
|
|
812
|
+
if (expanded) {
|
|
813
|
+
const rawText = result.content[0];
|
|
814
|
+
if (rawText?.type === "text") {
|
|
815
|
+
const lines = rawText.text.split("\n").slice(1);
|
|
816
|
+
const show = lines.slice(0, 30);
|
|
817
|
+
for (const line of show) {
|
|
818
|
+
text += "\n " + theme.fg("toolOutput", line);
|
|
819
|
+
}
|
|
820
|
+
if (lines.length > 30) {
|
|
821
|
+
text += `\n ${theme.fg("dim", `... ${lines.length - 30} more lines`)}`;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
} else {
|
|
825
|
+
text += " " + theme.fg("dim", `(${proc.stdoutLines} stdout, ${proc.stderrLines} stderr lines)`);
|
|
826
|
+
}
|
|
827
|
+
return new Text(text, 0, 0);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
case "wait_for_ready": {
|
|
831
|
+
const proc = details.process as BgProcessInfo;
|
|
832
|
+
const ready = details.ready as boolean;
|
|
833
|
+
if (ready) {
|
|
834
|
+
let text = theme.fg("success", "✓ Ready ") + theme.fg("accent", proc.id);
|
|
835
|
+
if (proc.ports.length > 0) text += " " + theme.fg("dim", `:${proc.ports.join(",")}`);
|
|
836
|
+
if (proc.urls.length > 0) text += " " + theme.fg("dim", proc.urls[0]);
|
|
837
|
+
return new Text(text, 0, 0);
|
|
838
|
+
} else {
|
|
839
|
+
return new Text(
|
|
840
|
+
theme.fg("error", "✗ Not ready ") + theme.fg("accent", proc.id) + " " + theme.fg("dim", String(details.detail)),
|
|
841
|
+
0, 0,
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
case "send": {
|
|
847
|
+
const proc = details.process as BgProcessInfo;
|
|
848
|
+
return new Text(
|
|
849
|
+
theme.fg("success", "→ ") + theme.fg("muted", `stdin → ${proc.id}`),
|
|
850
|
+
0, 0,
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
case "send_and_wait": {
|
|
855
|
+
const proc = details.process as BgProcessInfo;
|
|
856
|
+
const matched = details.matched as boolean;
|
|
857
|
+
if (matched) {
|
|
858
|
+
return new Text(
|
|
859
|
+
theme.fg("success", "✓ ") + theme.fg("muted", `Pattern matched — ${proc.id}`),
|
|
860
|
+
0, 0,
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
return new Text(
|
|
864
|
+
theme.fg("warning", "✗ ") + theme.fg("muted", `Timed out — ${proc.id}`),
|
|
865
|
+
0, 0,
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
case "run": {
|
|
870
|
+
const proc = details.process as BgProcessInfo;
|
|
871
|
+
const exitCode = details.exitCode as number;
|
|
872
|
+
const timedOut = details.timedOut as boolean;
|
|
873
|
+
if (timedOut) {
|
|
874
|
+
let text = theme.fg("warning", "⏱ Timed out ") + theme.fg("accent", proc.id);
|
|
875
|
+
if (expanded) {
|
|
876
|
+
const rawText = result.content[0];
|
|
877
|
+
if (rawText?.type === "text") {
|
|
878
|
+
const lines = rawText.text.split("\n").slice(1);
|
|
879
|
+
for (const line of lines.slice(0, 30)) {
|
|
880
|
+
text += "\n " + theme.fg("toolOutput", line);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return new Text(text, 0, 0);
|
|
885
|
+
}
|
|
886
|
+
const icon = exitCode === 0 ? theme.fg("success", "✓") : theme.fg("error", "✗");
|
|
887
|
+
let text = `${icon} ${theme.fg("accent", proc.id)} ${theme.fg("dim", `exit:${exitCode}`)}`;
|
|
888
|
+
if (expanded) {
|
|
889
|
+
const rawText = result.content[0];
|
|
890
|
+
if (rawText?.type === "text") {
|
|
891
|
+
const lines = rawText.text.split("\n").slice(1);
|
|
892
|
+
for (const line of lines.slice(0, 30)) {
|
|
893
|
+
text += "\n " + theme.fg("toolOutput", line);
|
|
894
|
+
}
|
|
895
|
+
if (lines.length > 30) {
|
|
896
|
+
text += `\n ${theme.fg("dim", `... ${lines.length - 30} more lines`)}`;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return new Text(text, 0, 0);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
case "signal": {
|
|
904
|
+
const sig = details.signal as string;
|
|
905
|
+
const proc = details.process as BgProcessInfo;
|
|
906
|
+
return new Text(
|
|
907
|
+
theme.fg("warning", `${sig} `) + theme.fg("muted", `→ ${proc.id}`),
|
|
908
|
+
0, 0,
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
case "list": {
|
|
913
|
+
const procs = details.processes as BgProcessInfo[];
|
|
914
|
+
if (procs.length === 0) {
|
|
915
|
+
return new Text(theme.fg("dim", "No background processes"), 0, 0);
|
|
916
|
+
}
|
|
917
|
+
let text = theme.fg("muted", `${procs.length} background process(es)`);
|
|
918
|
+
if (expanded) {
|
|
919
|
+
for (const p of procs) {
|
|
920
|
+
const statusIcon = p.alive
|
|
921
|
+
? (p.status === "ready" ? theme.fg("success", "●") : p.status === "error" ? theme.fg("error", "●") : theme.fg("warning", "●"))
|
|
922
|
+
: theme.fg("error", "○");
|
|
923
|
+
const portInfo = p.ports.length > 0 ? ` :${p.ports.join(",")}` : "";
|
|
924
|
+
text += `\n ${statusIcon} ${theme.fg("accent", p.id)} ${theme.fg("dim", p.uptime)} ${theme.fg("muted", p.label)} [${p.processType}]${portInfo}`;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return new Text(text, 0, 0);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
case "kill": {
|
|
931
|
+
const proc = details.process as BgProcessInfo;
|
|
932
|
+
return new Text(
|
|
933
|
+
theme.fg("success", "✓ Killed ") + theme.fg("accent", proc.id) + " " + theme.fg("muted", proc.label),
|
|
934
|
+
0, 0,
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
case "restart": {
|
|
939
|
+
const proc = details.process as BgProcessInfo;
|
|
940
|
+
return new Text(
|
|
941
|
+
theme.fg("success", "↻ Restarted ") + theme.fg("accent", proc.id) + " " + theme.fg("muted", proc.label) + " " + theme.fg("dim", `#${proc.restartCount}`),
|
|
942
|
+
0, 0,
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
case "env": {
|
|
947
|
+
const proc = details.process as BgProcessInfo;
|
|
948
|
+
const envData = details.env as { cwd: string; shell: string } | undefined;
|
|
949
|
+
let text = theme.fg("accent", proc.id) + " " + theme.fg("muted", proc.label);
|
|
950
|
+
if (envData) {
|
|
951
|
+
text += " " + theme.fg("dim", `cwd: ${envData.cwd}`);
|
|
952
|
+
}
|
|
953
|
+
if (expanded) {
|
|
954
|
+
const rawText = result.content[0];
|
|
955
|
+
if (rawText?.type === "text") {
|
|
956
|
+
const lines = rawText.text.split("\n").slice(1);
|
|
957
|
+
for (const line of lines.slice(0, 15)) {
|
|
958
|
+
text += "\n " + theme.fg("dim", line);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
return new Text(text, 0, 0);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
case "group_status": {
|
|
966
|
+
const gs = details.groupStatus as ReturnType<typeof getGroupStatus> | undefined;
|
|
967
|
+
if (gs) {
|
|
968
|
+
const icon = gs.healthy ? theme.fg("success", "✓") : theme.fg("error", "✗");
|
|
969
|
+
return new Text(
|
|
970
|
+
`${icon} ${theme.fg("accent", gs.group)} — ${gs.processes.length} process(es)`,
|
|
971
|
+
0, 0,
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
const groups = details.groups as string[];
|
|
975
|
+
return new Text(theme.fg("dim", `${groups?.length ?? 0} group(s)`), 0, 0);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
default: {
|
|
979
|
+
const text = result.content[0];
|
|
980
|
+
return new Text(text?.type === "text" ? text.text : "", 0, 0);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
});
|
|
985
|
+
}
|