gsd-pi 2.78.0 → 2.78.1-dev.84a383f51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -23
- package/dist/claude-cli-check.js +91 -32
- package/dist/cli-policy.d.ts +13 -0
- package/dist/cli-policy.js +17 -0
- package/dist/cli.js +95 -55
- package/dist/headless-query.d.ts +22 -0
- package/dist/headless-query.js +24 -4
- package/dist/headless.d.ts +10 -0
- package/dist/headless.js +16 -1
- package/dist/loader.js +7 -10
- package/dist/onboarding.d.ts +10 -0
- package/dist/onboarding.js +2 -2
- package/dist/provider-migrations.d.ts +2 -2
- package/dist/provider-migrations.js +5 -2
- package/dist/resource-loader.d.ts +5 -2
- package/dist/resource-loader.js +28 -5
- package/dist/resources/.managed-resources-content-hash +1 -0
- package/dist/resources/extensions/claude-code-cli/readiness.js +115 -31
- package/dist/resources/extensions/gsd/auto/loop.js +23 -0
- package/dist/resources/extensions/gsd/auto/phases.js +2 -2
- package/dist/resources/extensions/gsd/auto/run-unit.js +3 -1
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +43 -4
- package/dist/resources/extensions/gsd/auto-runtime-state.js +31 -0
- package/dist/resources/extensions/gsd/auto-start.js +1 -1
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +2 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +30 -0
- package/dist/resources/extensions/gsd/auto.js +14 -5
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +14 -2
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +7 -5
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +5 -4
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +94 -31
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +11 -6
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +34 -8
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +38 -2
- package/dist/resources/extensions/gsd/commands/catalog.js +69 -5
- package/dist/resources/extensions/gsd/commands/handlers/core.js +22 -1
- package/dist/resources/extensions/gsd/commands-mcp-status.js +3 -1
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +10 -1
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +4 -0
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +39 -1
- package/dist/resources/extensions/gsd/error-classifier.js +1 -1
- package/dist/resources/extensions/gsd/forensics.js +2 -2
- package/dist/resources/extensions/gsd/git-service.js +12 -5
- package/dist/resources/extensions/gsd/gsd-db.js +11 -2
- package/dist/resources/extensions/gsd/guided-flow.js +23 -23
- package/dist/resources/extensions/gsd/memory-store.js +66 -31
- package/dist/resources/extensions/gsd/milestone-id-reservation.js +36 -0
- package/dist/resources/extensions/gsd/model-router.js +114 -9
- package/dist/resources/extensions/gsd/native-git-bridge.js +7 -1
- package/dist/resources/extensions/gsd/preferences-models.js +91 -15
- package/dist/resources/extensions/gsd/preferences-types.js +2 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +32 -0
- package/dist/resources/extensions/gsd/preferences.js +5 -3
- package/dist/resources/extensions/gsd/prompt-loader.js +23 -12
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +9 -3
- package/dist/resources/extensions/gsd/state.js +42 -0
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/dist/resources/extensions/gsd/tools/memory-tools.js +18 -1
- package/dist/resources/extensions/gsd/visualizer-overlay.js +1 -1
- package/dist/resources/extensions/gsd/watch/header-renderer.js +3 -1
- package/dist/resources/extensions/gsd/worktree-command.js +26 -46
- package/dist/resources/extensions/gsd/worktree-session-state.js +33 -0
- package/dist/resources/extensions/mcp-client/index.js +6 -3
- package/dist/resources/extensions/slash-commands/create-extension.js +36 -22
- package/dist/resources/skills/create-gsd-extension/SKILL.md +9 -5
- package/dist/resources/skills/create-gsd-extension/references/custom-commands.md +1 -1
- package/dist/resources/skills/create-gsd-extension/references/custom-rendering.md +5 -5
- package/dist/resources/skills/create-gsd-extension/references/custom-tools.md +4 -4
- package/dist/resources/skills/create-gsd-extension/references/custom-ui.md +6 -6
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +3 -3
- package/dist/resources/skills/create-gsd-extension/references/packaging-distribution.md +1 -1
- package/dist/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +3 -3
- package/dist/resources/skills/create-gsd-extension/workflows/create-extension.md +32 -12
- package/dist/rtk-shared.d.ts +3 -0
- package/dist/rtk-shared.js +17 -0
- package/dist/rtk.d.ts +2 -5
- package/dist/rtk.js +3 -20
- package/dist/runtime-checks.d.ts +27 -0
- package/dist/runtime-checks.js +38 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +13 -13
- package/dist/web/standalone/.next/build-manifest.json +4 -4
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +44 -4
- package/dist/web/standalone/.next/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +4 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +13 -13
- package/dist/web/standalone/.next/server/chunks/63.js +3 -3
- package/dist/web/standalone/.next/server/chunks/6897.js +1 -1
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +2 -2
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/server/webpack-runtime.js +1 -1
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +1 -0
- package/dist/web/standalone/.next/static/chunks/2824.08296bc2f9654698.js +1 -0
- package/dist/web/standalone/.next/static/chunks/3026.3af53b279375f082.js +1 -0
- package/dist/web/standalone/.next/static/chunks/315.6f68ae79b67d25cf.js +1 -0
- package/dist/web/standalone/.next/static/chunks/3497.4bfc60a3b3dea717.js +1 -0
- package/dist/web/standalone/.next/static/chunks/5516.4a07c872b5c3a663.js +1 -0
- package/dist/web/standalone/.next/static/chunks/8336.31b019697882acfb.js +10 -0
- package/dist/web/standalone/.next/static/chunks/8845.c9702695e8c5a9c5.js +2 -0
- package/dist/web/standalone/.next/static/chunks/9058.01ef3a463bda88f1.js +20 -0
- package/dist/web/standalone/.next/static/chunks/9441.1081da1125d1764f.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-9bf2e0c50fb2ca05.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
- package/dist/web/standalone/.next/static/chunks/webpack-f9f0dc45e4f3ac10.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/package.json +2 -1
- package/dist/web/standalone/server.js +1 -1
- package/dist/worktree-status-banner.d.ts +1 -0
- package/dist/worktree-status-banner.js +132 -0
- package/package.json +1 -1
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/dist/alias-telemetry.d.ts +8 -0
- package/packages/mcp-server/dist/alias-telemetry.d.ts.map +1 -0
- package/packages/mcp-server/dist/alias-telemetry.js +30 -0
- package/packages/mcp-server/dist/alias-telemetry.js.map +1 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +74 -46
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/alias-telemetry.test.ts +78 -0
- package/packages/mcp-server/src/alias-telemetry.ts +30 -0
- package/packages/mcp-server/src/workflow-tools.test.ts +26 -0
- package/packages/mcp-server/src/workflow-tools.ts +93 -58
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.js +231 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +48 -19
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +13 -0
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.js +24 -3
- package/packages/pi-ai/dist/utils/repair-tool-json.js.map +1 -1
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js +26 -0
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/providers/anthropic-shared.cache-breakpoint.test.ts +289 -0
- package/packages/pi-ai/src/providers/anthropic-shared.ts +52 -20
- package/packages/pi-ai/src/types.ts +13 -0
- package/packages/pi-ai/src/utils/repair-tool-json.ts +24 -3
- package/packages/pi-ai/src/utils/tests/repair-tool-json.test.ts +32 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +6 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +4 -0
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +19 -2
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +10 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +18 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +13 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +20 -16
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/token-telemetry.d.ts +37 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.js +49 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +133 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +14 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.js +78 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.js +181 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.js.map +1 -0
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +7 -0
- package/packages/pi-coding-agent/src/core/messages.ts +4 -0
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +32 -2
- package/packages/pi-coding-agent/src/core/model-registry.ts +21 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +33 -15
- package/packages/pi-coding-agent/src/core/token-telemetry.ts +77 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +212 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +17 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +1 -1
- package/packages/pi-coding-agent/src/tests/system-prompt-cache-stability.test.ts +102 -0
- package/packages/pi-coding-agent/src/tests/token-telemetry.test.ts +200 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +17 -3
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js +161 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js.map +1 -0
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +20 -3
- package/packages/pi-tui/src/components/__tests__/leak-fixes-runtime.test.ts +219 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +116 -29
- package/src/resources/extensions/gsd/auto/loop.ts +24 -2
- package/src/resources/extensions/gsd/auto/phases.ts +3 -3
- package/src/resources/extensions/gsd/auto/run-unit.ts +3 -1
- package/src/resources/extensions/gsd/auto/session.ts +3 -0
- package/src/resources/extensions/gsd/auto/types.ts +1 -0
- package/src/resources/extensions/gsd/auto-recovery.ts +46 -8
- package/src/resources/extensions/gsd/auto-runtime-state.ts +51 -0
- package/src/resources/extensions/gsd/auto-start.ts +1 -1
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +2 -4
- package/src/resources/extensions/gsd/auto-worktree.ts +38 -0
- package/src/resources/extensions/gsd/auto.ts +14 -4
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +15 -13
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +8 -7
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +10 -9
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +102 -31
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +12 -6
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +39 -8
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +39 -11
- package/src/resources/extensions/gsd/commands/catalog.ts +75 -5
- package/src/resources/extensions/gsd/commands/handlers/core.ts +22 -1
- package/src/resources/extensions/gsd/commands-mcp-status.ts +3 -1
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +15 -1
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +4 -0
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +39 -1
- package/src/resources/extensions/gsd/doctor-types.ts +3 -1
- package/src/resources/extensions/gsd/error-classifier.ts +1 -1
- package/src/resources/extensions/gsd/forensics.ts +2 -2
- package/src/resources/extensions/gsd/git-service.ts +13 -5
- package/src/resources/extensions/gsd/gsd-db.ts +12 -2
- package/src/resources/extensions/gsd/guided-flow.ts +25 -25
- package/src/resources/extensions/gsd/memory-store.ts +81 -28
- package/src/resources/extensions/gsd/milestone-id-reservation.ts +47 -0
- package/src/resources/extensions/gsd/model-router.ts +172 -9
- package/src/resources/extensions/gsd/native-git-bridge.ts +7 -1
- package/src/resources/extensions/gsd/preferences-models.ts +101 -15
- package/src/resources/extensions/gsd/preferences-types.ts +6 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +35 -0
- package/src/resources/extensions/gsd/preferences.ts +16 -2
- package/src/resources/extensions/gsd/prompt-loader.ts +26 -12
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +9 -3
- package/src/resources/extensions/gsd/state.ts +42 -0
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +178 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +9 -5
- package/src/resources/extensions/gsd/tests/auto-supervisor.test.mjs +21 -4
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/budget-prediction.test.ts +138 -211
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +142 -59
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +7 -4
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +89 -32
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +41 -23
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +3 -43
- package/src/resources/extensions/gsd/tests/debug-logger.test.ts +5 -3
- package/src/resources/extensions/gsd/tests/deferred-milestone-dir-4996.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/discuss-empty-db-fallback.test.ts +22 -87
- package/src/resources/extensions/gsd/tests/discuss-queued-milestones.test.ts +7 -118
- package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +18 -60
- package/src/resources/extensions/gsd/tests/doctor-orphan-milestone-4996.test.ts +100 -0
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +14 -76
- package/src/resources/extensions/gsd/tests/ensure-preconditions-guard-4996.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +22 -83
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +1 -63
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed-runtime.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +26 -1
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell-runtime.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/gsd-no-project-error-runtime.test.ts +81 -0
- package/src/resources/extensions/gsd/tests/headless-answers.test.ts +14 -4
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +22 -12
- package/src/resources/extensions/gsd/tests/help-menu-coverage.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/import-done-milestones-runtime.test.ts +145 -0
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/integration/token-savings.test.ts +0 -23
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +128 -0
- package/src/resources/extensions/gsd/tests/memory-tools.test.ts +33 -1
- package/src/resources/extensions/gsd/tests/merge-self-branch-guard.test.ts +124 -0
- package/src/resources/extensions/gsd/tests/milestone-id-gap-reuse-4996.test.ts +152 -0
- package/src/resources/extensions/gsd/tests/model-router.test.ts +169 -8
- package/src/resources/extensions/gsd/tests/native-git-infra-errors.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +32 -43
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +4 -10
- package/src/resources/extensions/gsd/tests/preferences.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/register-hooks-compaction-checkpoint.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +168 -19
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +23 -1
- package/src/resources/extensions/gsd/tests/system-context-message-routing.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +51 -4
- package/src/resources/extensions/gsd/tests/turn-epoch.test.ts +7 -16
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +5 -7
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +15 -0
- package/src/resources/extensions/gsd/tools/memory-tools.ts +17 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +8 -8
- package/src/resources/extensions/gsd/visualizer-overlay.ts +1 -1
- package/src/resources/extensions/gsd/watch/header-renderer.ts +3 -1
- package/src/resources/extensions/gsd/workflow-logger.ts +1 -0
- package/src/resources/extensions/gsd/worktree-command.ts +31 -44
- package/src/resources/extensions/gsd/worktree-session-state.ts +35 -0
- package/src/resources/extensions/mcp-client/index.ts +6 -3
- package/src/resources/extensions/mcp-client/tests/global-config.test.ts +91 -0
- package/src/resources/extensions/slash-commands/create-extension.ts +38 -24
- package/src/resources/skills/create-gsd-extension/SKILL.md +9 -5
- package/src/resources/skills/create-gsd-extension/references/custom-commands.md +1 -1
- package/src/resources/skills/create-gsd-extension/references/custom-rendering.md +5 -5
- package/src/resources/skills/create-gsd-extension/references/custom-tools.md +4 -4
- package/src/resources/skills/create-gsd-extension/references/custom-ui.md +6 -6
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +3 -3
- package/src/resources/skills/create-gsd-extension/references/packaging-distribution.md +1 -1
- package/src/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +3 -3
- package/src/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +2 -2
- package/src/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +3 -3
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +58 -0
- package/src/resources/skills/create-gsd-extension/workflows/create-extension.md +32 -12
- package/dist/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +0 -601
- package/dist/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +0 -651
- package/dist/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +0 -91
- package/dist/resources/extensions/gsd/tests/auto-supervisor.test.mjs +0 -53
- package/dist/resources/extensions/gsd/tests/dist-redirect.mjs +0 -112
- package/dist/resources/extensions/gsd/tests/resolve-ts-hooks.mjs +0 -23
- package/dist/resources/extensions/gsd/tests/resolve-ts.mjs +0 -5
- package/dist/resources/skills/github-workflows/references/gh/tests/__init__.py +0 -0
- package/dist/resources/skills/github-workflows/references/gh/tests/test_github_project_setup.py +0 -608
- package/dist/web/standalone/.next/static/chunks/2826.e9f5195e91f9cad2.js +0 -11
- package/dist/web/standalone/.next/static/chunks/3621.fc7480022c972438.js +0 -20
- package/dist/web/standalone/.next/static/chunks/app/page-151349214571e2b6.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
- package/dist/web/standalone/.next/static/chunks/webpack-2e68521d7c82f7c2.js +0 -1
- package/src/resources/extensions/gsd/tests/copy-planning-artifacts-samepath.test.ts +0 -22
- package/src/resources/extensions/gsd/tests/discuss-slice-structured-questions.test.ts +0 -47
- package/src/resources/extensions/gsd/tests/empty-content-abort-loop.test.ts +0 -75
- /package/dist/web/standalone/.next/static/{C1zT2kEfoLhDdbWPWKrXd → UF5VF4F1tB0miEtJS7LyX}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{C1zT2kEfoLhDdbWPWKrXd → UF5VF4F1tB0miEtJS7LyX}/_ssgManifest.js +0 -0
|
@@ -96,13 +96,15 @@ export function readGitBranch(projectRoot) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Read MCP server names from .mcp.json
|
|
99
|
+
* Read MCP server names from .mcp.json, .gsd/mcp.json, and the global
|
|
100
|
+
* ~/.gsd/mcp.json (or $GSD_HOME/mcp.json).
|
|
100
101
|
* Returns array of server name strings.
|
|
101
102
|
*/
|
|
102
103
|
export function readMcpServerNames(projectRoot) {
|
|
103
104
|
const configPaths = [
|
|
104
105
|
join(projectRoot, ".mcp.json"),
|
|
105
106
|
join(projectRoot, ".gsd", "mcp.json"),
|
|
107
|
+
join(process.env.GSD_HOME || join(homedir(), ".gsd"), "mcp.json"),
|
|
106
108
|
];
|
|
107
109
|
const names = [];
|
|
108
110
|
const seen = new Set();
|
|
@@ -18,28 +18,13 @@ import { createWorktree, listWorktrees, removeWorktree, mergeWorktreeToMain, dif
|
|
|
18
18
|
import { inferCommitType } from "./git-service.js";
|
|
19
19
|
import { existsSync, realpathSync, readdirSync, rmSync, unlinkSync } from "node:fs";
|
|
20
20
|
import { nativeMergeAbort } from "./native-git-bridge.js";
|
|
21
|
-
import { join
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { clearWorktreeOriginalCwd, ensureWorktreeOriginalCwdFromPath, getActiveWorktreeName, getWorktreeOriginalCwd, setWorktreeOriginalCwd, } from "./worktree-session-state.js";
|
|
23
|
+
export { getActiveWorktreeName, getWorktreeOriginalCwd } from "./worktree-session-state.js";
|
|
22
24
|
/**
|
|
23
25
|
* Tracks the original project root so we can switch back.
|
|
24
26
|
* Set when we first chdir into a worktree, cleared on return.
|
|
25
27
|
*/
|
|
26
|
-
let originalCwd = null;
|
|
27
|
-
/** Get the original project root if currently in a worktree, or null. */
|
|
28
|
-
export function getWorktreeOriginalCwd() {
|
|
29
|
-
return originalCwd;
|
|
30
|
-
}
|
|
31
|
-
/** Get the name of the active worktree, or null if not in one. */
|
|
32
|
-
export function getActiveWorktreeName() {
|
|
33
|
-
if (!originalCwd)
|
|
34
|
-
return null;
|
|
35
|
-
const cwd = process.cwd();
|
|
36
|
-
const wtDir = join(originalCwd, ".gsd", "worktrees");
|
|
37
|
-
if (!cwd.startsWith(wtDir))
|
|
38
|
-
return null;
|
|
39
|
-
const rel = cwd.slice(wtDir.length + 1);
|
|
40
|
-
const name = rel.split("/")[0] ?? rel.split("\\")[0];
|
|
41
|
-
return name || null;
|
|
42
|
-
}
|
|
43
28
|
// ─── Shared completions and handler (used by both /worktree and /wt) ────────
|
|
44
29
|
function worktreeCompletions(prefix) {
|
|
45
30
|
const parts = prefix.trim().split(/\s+/);
|
|
@@ -111,7 +96,7 @@ async function worktreeHandler(args, ctx, pi, alias) {
|
|
|
111
96
|
return;
|
|
112
97
|
}
|
|
113
98
|
// create and switch both do the same thing: switch if exists, create if not
|
|
114
|
-
const mainBase =
|
|
99
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
115
100
|
const existing = listWorktrees(mainBase);
|
|
116
101
|
if (existing.some(wt => wt.name === name)) {
|
|
117
102
|
await handleSwitch(basePath, name, ctx);
|
|
@@ -123,7 +108,7 @@ async function worktreeHandler(args, ctx, pi, alias) {
|
|
|
123
108
|
}
|
|
124
109
|
if (trimmed === "merge" || trimmed.startsWith("merge ")) {
|
|
125
110
|
const mergeArgs = trimmed.replace(/^merge\s*/, "").trim().split(/\s+/).filter(Boolean);
|
|
126
|
-
const mainBase =
|
|
111
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
127
112
|
const activeWt = getActiveWorktreeName();
|
|
128
113
|
if (mergeArgs.length === 0) {
|
|
129
114
|
// Bare "/worktree merge" — only valid when inside a worktree
|
|
@@ -154,7 +139,7 @@ async function worktreeHandler(args, ctx, pi, alias) {
|
|
|
154
139
|
}
|
|
155
140
|
if (trimmed === "remove" || trimmed.startsWith("remove ")) {
|
|
156
141
|
const name = trimmed.replace(/^remove\s*/, "").trim();
|
|
157
|
-
const mainBase =
|
|
142
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
158
143
|
if (name === "all") {
|
|
159
144
|
await handleRemoveAll(mainBase, ctx);
|
|
160
145
|
return;
|
|
@@ -171,7 +156,7 @@ async function worktreeHandler(args, ctx, pi, alias) {
|
|
|
171
156
|
ctx.ui.notify(`Usage: /${alias} ${trimmed}${trimmed === "list" || trimmed === "return" ? "" : " <name>"}`, "warning");
|
|
172
157
|
return;
|
|
173
158
|
}
|
|
174
|
-
const mainBase =
|
|
159
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
175
160
|
const nameOnly = trimmed.split(/\s+/)[0];
|
|
176
161
|
if (trimmed !== nameOnly) {
|
|
177
162
|
ctx.ui.notify(`Unknown command. Did you mean /${alias} switch ${nameOnly}?`, "warning");
|
|
@@ -192,14 +177,7 @@ export function registerWorktreeCommand(pi) {
|
|
|
192
177
|
// Restore worktree state after /reload.
|
|
193
178
|
// The module-level originalCwd resets to null when extensions are re-loaded,
|
|
194
179
|
// but process.cwd() is still inside the worktree. Detect this and recover.
|
|
195
|
-
|
|
196
|
-
const cwd = process.cwd();
|
|
197
|
-
const marker = `${sep}.gsd${sep}worktrees${sep}`;
|
|
198
|
-
const markerIdx = cwd.indexOf(marker);
|
|
199
|
-
if (markerIdx !== -1) {
|
|
200
|
-
originalCwd = cwd.slice(0, markerIdx);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
180
|
+
ensureWorktreeOriginalCwdFromPath();
|
|
203
181
|
pi.registerCommand("worktree", {
|
|
204
182
|
description: "Git worktrees (also /wt): /worktree <name> | list | merge | remove",
|
|
205
183
|
getArgumentCompletions: worktreeCompletions,
|
|
@@ -260,7 +238,7 @@ async function handleCreate(basePath, name, ctx) {
|
|
|
260
238
|
// before createWorktree so the new worktree forks from committed HEAD)
|
|
261
239
|
const commitMsg = autoCommitCurrentBranch(basePath, "worktree-switch", name);
|
|
262
240
|
// Create from the main tree, not from inside another worktree
|
|
263
|
-
const mainBase =
|
|
241
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
264
242
|
const info = createWorktree(mainBase, name);
|
|
265
243
|
// Run user-configured post-create hook (#597) — e.g. copy .env, symlink assets
|
|
266
244
|
const hookError = runWorktreePostCreateHook(mainBase, info.path);
|
|
@@ -268,8 +246,8 @@ async function handleCreate(basePath, name, ctx) {
|
|
|
268
246
|
ctx.ui.notify(hookError, "warning");
|
|
269
247
|
}
|
|
270
248
|
// Track original cwd before switching
|
|
271
|
-
if (!
|
|
272
|
-
|
|
249
|
+
if (!getWorktreeOriginalCwd())
|
|
250
|
+
setWorktreeOriginalCwd(basePath);
|
|
273
251
|
const prevCwd = process.cwd();
|
|
274
252
|
process.chdir(info.path);
|
|
275
253
|
nudgeGitBranchCache(prevCwd);
|
|
@@ -319,7 +297,7 @@ async function handleCreate(basePath, name, ctx) {
|
|
|
319
297
|
}
|
|
320
298
|
async function handleSwitch(basePath, name, ctx) {
|
|
321
299
|
try {
|
|
322
|
-
const mainBase =
|
|
300
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
323
301
|
const wtPath = worktreePath(mainBase, name);
|
|
324
302
|
if (!existsSync(wtPath)) {
|
|
325
303
|
ctx.ui.notify(`Worktree "${name}" not found. Run /worktree list to see available worktrees.`, "warning");
|
|
@@ -328,8 +306,8 @@ async function handleSwitch(basePath, name, ctx) {
|
|
|
328
306
|
// Auto-commit dirty files before leaving current workspace
|
|
329
307
|
const commitMsg = autoCommitCurrentBranch(basePath, "worktree-switch", name);
|
|
330
308
|
// Track original cwd before switching
|
|
331
|
-
if (!
|
|
332
|
-
|
|
309
|
+
if (!getWorktreeOriginalCwd())
|
|
310
|
+
setWorktreeOriginalCwd(basePath);
|
|
333
311
|
const prevCwd = process.cwd();
|
|
334
312
|
process.chdir(wtPath);
|
|
335
313
|
nudgeGitBranchCache(prevCwd);
|
|
@@ -352,6 +330,7 @@ async function handleSwitch(basePath, name, ctx) {
|
|
|
352
330
|
}
|
|
353
331
|
}
|
|
354
332
|
async function handleReturn(ctx) {
|
|
333
|
+
const originalCwd = getWorktreeOriginalCwd();
|
|
355
334
|
if (!originalCwd) {
|
|
356
335
|
ctx.ui.notify("Already in the main project tree.", "info");
|
|
357
336
|
return;
|
|
@@ -359,7 +338,7 @@ async function handleReturn(ctx) {
|
|
|
359
338
|
// Auto-commit dirty files before leaving worktree
|
|
360
339
|
const commitMsg = autoCommitCurrentBranch(process.cwd(), "worktree-return", "worktree");
|
|
361
340
|
const returnTo = originalCwd;
|
|
362
|
-
|
|
341
|
+
clearWorktreeOriginalCwd();
|
|
363
342
|
const prevCwd = process.cwd();
|
|
364
343
|
process.chdir(returnTo);
|
|
365
344
|
nudgeGitBranchCache(prevCwd);
|
|
@@ -409,7 +388,7 @@ const CLR = {
|
|
|
409
388
|
};
|
|
410
389
|
async function handleList(basePath, ctx) {
|
|
411
390
|
try {
|
|
412
|
-
const mainBase =
|
|
391
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
413
392
|
const worktrees = listWorktrees(mainBase);
|
|
414
393
|
if (worktrees.length === 0) {
|
|
415
394
|
ctx.ui.notify("No GSD worktrees found. Create one with /worktree <name>.", "info");
|
|
@@ -452,6 +431,7 @@ async function handleList(basePath, ctx) {
|
|
|
452
431
|
}
|
|
453
432
|
lines.push("");
|
|
454
433
|
}
|
|
434
|
+
const originalCwd = getWorktreeOriginalCwd();
|
|
455
435
|
if (originalCwd) {
|
|
456
436
|
lines.push(` ${CLR.label("main tree")} ${CLR.path(originalCwd)}`);
|
|
457
437
|
}
|
|
@@ -539,11 +519,11 @@ async function handleMerge(basePath, name, ctx, pi, targetBranch) {
|
|
|
539
519
|
}
|
|
540
520
|
// Switch to the main tree before merging.
|
|
541
521
|
// Must be on the main branch to run git merge --squash.
|
|
542
|
-
if (
|
|
522
|
+
if (getWorktreeOriginalCwd()) {
|
|
543
523
|
const prevCwd = process.cwd();
|
|
544
524
|
process.chdir(basePath);
|
|
545
525
|
nudgeGitBranchCache(prevCwd);
|
|
546
|
-
|
|
526
|
+
clearWorktreeOriginalCwd();
|
|
547
527
|
}
|
|
548
528
|
// --- Deterministic merge path (preferred) ---
|
|
549
529
|
// Try a direct squash-merge first. Only fall back to LLM on conflict.
|
|
@@ -620,7 +600,7 @@ async function handleMerge(basePath, name, ctx, pi, targetBranch) {
|
|
|
620
600
|
}
|
|
621
601
|
async function handleRemove(basePath, name, ctx) {
|
|
622
602
|
try {
|
|
623
|
-
const mainBase =
|
|
603
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
624
604
|
// Validate the worktree exists before attempting removal
|
|
625
605
|
const worktrees = listWorktrees(mainBase);
|
|
626
606
|
const wt = worktrees.find(w => w.name === name);
|
|
@@ -641,9 +621,9 @@ async function handleRemove(basePath, name, ctx) {
|
|
|
641
621
|
const prevCwd = process.cwd();
|
|
642
622
|
removeWorktree(mainBase, name, { deleteBranch: true });
|
|
643
623
|
// If we were in that worktree, removeWorktree chdir'd us out — clear tracking
|
|
644
|
-
if (
|
|
624
|
+
if (getWorktreeOriginalCwd() && process.cwd() !== prevCwd) {
|
|
645
625
|
nudgeGitBranchCache(prevCwd);
|
|
646
|
-
|
|
626
|
+
clearWorktreeOriginalCwd();
|
|
647
627
|
}
|
|
648
628
|
ctx.ui.notify(`${CLR.ok("✓")} Worktree ${CLR.name(name)} removed ${CLR.muted("(branch deleted)")}.`, "info");
|
|
649
629
|
}
|
|
@@ -654,7 +634,7 @@ async function handleRemove(basePath, name, ctx) {
|
|
|
654
634
|
}
|
|
655
635
|
async function handleRemoveAll(basePath, ctx) {
|
|
656
636
|
try {
|
|
657
|
-
const mainBase =
|
|
637
|
+
const mainBase = getWorktreeOriginalCwd() ?? basePath;
|
|
658
638
|
const worktrees = listWorktrees(mainBase);
|
|
659
639
|
if (worktrees.length === 0) {
|
|
660
640
|
ctx.ui.notify("No worktrees to remove.", "info");
|
|
@@ -684,9 +664,9 @@ async function handleRemoveAll(basePath, ctx) {
|
|
|
684
664
|
}
|
|
685
665
|
}
|
|
686
666
|
// If we were in a worktree that got removed, clear tracking
|
|
687
|
-
if (
|
|
667
|
+
if (getWorktreeOriginalCwd() && process.cwd() !== prevCwd) {
|
|
688
668
|
nudgeGitBranchCache(prevCwd);
|
|
689
|
-
|
|
669
|
+
clearWorktreeOriginalCwd();
|
|
690
670
|
}
|
|
691
671
|
const lines = [];
|
|
692
672
|
if (removed.length > 0)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// GSD worktree session state
|
|
2
|
+
let originalCwd = null;
|
|
3
|
+
export function getWorktreeOriginalCwd() {
|
|
4
|
+
return originalCwd;
|
|
5
|
+
}
|
|
6
|
+
export function setWorktreeOriginalCwd(cwd) {
|
|
7
|
+
originalCwd = cwd;
|
|
8
|
+
}
|
|
9
|
+
export function clearWorktreeOriginalCwd() {
|
|
10
|
+
originalCwd = null;
|
|
11
|
+
}
|
|
12
|
+
export function ensureWorktreeOriginalCwdFromPath(cwd = process.cwd()) {
|
|
13
|
+
if (originalCwd)
|
|
14
|
+
return originalCwd;
|
|
15
|
+
const marker = `${/\\/.test(cwd) ? "\\" : "/"}.gsd${/\\/.test(cwd) ? "\\" : "/"}worktrees${/\\/.test(cwd) ? "\\" : "/"}`;
|
|
16
|
+
const markerIdx = cwd.indexOf(marker);
|
|
17
|
+
if (markerIdx !== -1) {
|
|
18
|
+
originalCwd = cwd.slice(0, markerIdx);
|
|
19
|
+
}
|
|
20
|
+
return originalCwd;
|
|
21
|
+
}
|
|
22
|
+
export function getActiveWorktreeName() {
|
|
23
|
+
if (!originalCwd)
|
|
24
|
+
return null;
|
|
25
|
+
const cwd = process.cwd();
|
|
26
|
+
const wtDir = `${originalCwd.replace(/[\\/]+$/, "")}/.gsd/worktrees`.replaceAll("\\", "/");
|
|
27
|
+
const normalizedCwd = cwd.replaceAll("\\", "/");
|
|
28
|
+
if (!normalizedCwd.startsWith(`${wtDir}/`))
|
|
29
|
+
return null;
|
|
30
|
+
const rel = normalizedCwd.slice(wtDir.length + 1);
|
|
31
|
+
const name = rel.split("/")[0];
|
|
32
|
+
return name || null;
|
|
33
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* MCP Client Extension — Native MCP server integration for pi
|
|
3
3
|
*
|
|
4
4
|
* Provides on-demand access to MCP servers configured in project files
|
|
5
|
-
* (.mcp.json, .gsd/mcp.json)
|
|
5
|
+
* (.mcp.json, .gsd/mcp.json) and the global ~/.gsd/mcp.json (or
|
|
6
|
+
* $GSD_HOME/mcp.json) using the @modelcontextprotocol/sdk Client
|
|
6
7
|
* directly — no external CLI dependency required.
|
|
7
8
|
*
|
|
8
9
|
* Three tools:
|
|
@@ -17,6 +18,7 @@ import { Client } from "@modelcontextprotocol/sdk/client";
|
|
|
17
18
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
18
19
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
19
20
|
import { readFileSync, existsSync } from "node:fs";
|
|
21
|
+
import { homedir } from "node:os";
|
|
20
22
|
import { join } from "node:path";
|
|
21
23
|
import { buildHttpTransportOpts } from "./auth.js";
|
|
22
24
|
// ─── Connection Manager ───────────────────────────────────────────────────────
|
|
@@ -61,6 +63,7 @@ function readConfigs() {
|
|
|
61
63
|
const configPaths = [
|
|
62
64
|
join(process.cwd(), ".mcp.json"),
|
|
63
65
|
join(process.cwd(), ".gsd", "mcp.json"),
|
|
66
|
+
join(process.env.GSD_HOME || join(homedir(), ".gsd"), "mcp.json"),
|
|
64
67
|
];
|
|
65
68
|
for (const configPath of configPaths) {
|
|
66
69
|
try {
|
|
@@ -258,7 +261,7 @@ async function closeAll() {
|
|
|
258
261
|
// ─── Formatters ───────────────────────────────────────────────────────────────
|
|
259
262
|
function formatServerList(servers) {
|
|
260
263
|
if (servers.length === 0)
|
|
261
|
-
return "No MCP servers configured. Add servers to .mcp.json or .gsd/mcp.json.";
|
|
264
|
+
return "No MCP servers configured. Add servers to .mcp.json, .gsd/mcp.json, or $GSD_HOME/mcp.json (default: ~/.gsd/mcp.json).";
|
|
262
265
|
const lines = [`${servers.length} MCP servers configured:\n`];
|
|
263
266
|
for (const s of servers) {
|
|
264
267
|
const connected = connections.has(s.name) ? "✓" : "○";
|
|
@@ -306,7 +309,7 @@ export default function (pi) {
|
|
|
306
309
|
pi.registerTool({
|
|
307
310
|
name: "mcp_servers",
|
|
308
311
|
label: "MCP Servers",
|
|
309
|
-
description: "List all available MCP servers configured in project files (.mcp.json, .gsd/mcp.json). " +
|
|
312
|
+
description: "List all available MCP servers configured in project files (.mcp.json, .gsd/mcp.json) or globally ($GSD_HOME/mcp.json, default: ~/.gsd/mcp.json). " +
|
|
310
313
|
"Shows server names, transport type, and connection status. Use mcp_discover to get full tool schemas for a server.",
|
|
311
314
|
promptSnippet: "List available MCP servers from project configuration",
|
|
312
315
|
promptGuidelines: [
|
|
@@ -193,38 +193,35 @@ function sendPrompt(description, result, pi) {
|
|
|
193
193
|
? (Array.isArray(persistenceAnswer.selected) ? persistenceAnswer.selected[0] : persistenceAnswer.selected)
|
|
194
194
|
: "";
|
|
195
195
|
const docHints = [
|
|
196
|
-
"-
|
|
197
|
-
"-
|
|
198
|
-
"-
|
|
199
|
-
"-
|
|
200
|
-
"- `~/.gsd/agent/docs/extending-pi/22-key-rules-gotchas.md` — must-read rules before shipping",
|
|
196
|
+
"- `docs/extension-sdk/README.md` — overview, quick start, directory layout",
|
|
197
|
+
"- `docs/extension-sdk/api-reference.md` — ExtensionAPI and ExtensionContext surfaces",
|
|
198
|
+
"- `docs/extension-sdk/building-extensions.md` — tools, commands, events, UI, state",
|
|
199
|
+
"- `docs/extension-sdk/rules.md` — non-negotiable rules and gotchas",
|
|
201
200
|
];
|
|
202
201
|
if (uiSelected.includes("custom component")) {
|
|
203
|
-
docHints.push("-
|
|
204
|
-
docHints.push("-
|
|
205
|
-
docHints.push("-
|
|
206
|
-
docHints.push("-
|
|
207
|
-
docHints.push("-
|
|
208
|
-
docHints.push("- `~/.gsd/agent/docs/pi-ui-tui/19-building-a-complete-component-step-by-step.md` — step-by-step guide");
|
|
209
|
-
docHints.push("- `~/.gsd/agent/docs/pi-ui-tui/21-common-mistakes-and-how-to-avoid-them.md` — pitfalls");
|
|
202
|
+
docHints.push("- `docs/extension-sdk/building-extensions.md#custom-components` — ctx.ui.custom() API");
|
|
203
|
+
docHints.push("- `docs/dev/pi-ui-tui/06-ctx-ui-custom-full-custom-components.md` — step-by-step component guide");
|
|
204
|
+
docHints.push("- `docs/dev/pi-ui-tui/07-built-in-components-the-building-blocks.md` — Text, Box, SelectList");
|
|
205
|
+
docHints.push("- `docs/dev/pi-ui-tui/09-keyboard-input-how-to-handle-keys.md` — Key, matchesKey");
|
|
206
|
+
docHints.push("- `docs/dev/pi-ui-tui/10-line-width-the-cardinal-rule.md` — truncation, width rules");
|
|
210
207
|
}
|
|
211
208
|
else if (uiSelected.includes("Dialogs")) {
|
|
212
|
-
docHints.push("-
|
|
209
|
+
docHints.push("- `docs/extension-sdk/building-extensions.md#built-in-dialogs` — select, confirm, input");
|
|
213
210
|
}
|
|
214
211
|
else if (uiSelected.includes("Status")) {
|
|
215
|
-
docHints.push("-
|
|
212
|
+
docHints.push("- `docs/extension-sdk/building-extensions.md#persistent-ui-elements` — status, widgets");
|
|
216
213
|
}
|
|
217
214
|
if (uiSelected.includes("tool") || result.answers["purpose"]) {
|
|
218
|
-
docHints.push("-
|
|
215
|
+
docHints.push("- `docs/dev/extending-pi/14-custom-rendering-controlling-what-the-user-sees.md` — renderCall / renderResult");
|
|
219
216
|
}
|
|
220
217
|
if (eventsSelected && !eventsSelected.includes("standalone")) {
|
|
221
|
-
docHints.push("-
|
|
218
|
+
docHints.push("- `docs/dev/extending-pi/07-events-the-nervous-system.md` — all events reference");
|
|
222
219
|
}
|
|
223
220
|
if (eventsSelected.includes("context / prompt")) {
|
|
224
|
-
docHints.push("-
|
|
221
|
+
docHints.push("- `docs/dev/extending-pi/15-system-prompt-modification.md` — system prompt hooks");
|
|
225
222
|
}
|
|
226
223
|
if (persistenceSelected.includes("session")) {
|
|
227
|
-
docHints.push("-
|
|
224
|
+
docHints.push("- `docs/extension-sdk/building-extensions.md#state-management` — state reconstruction, appendEntry");
|
|
228
225
|
}
|
|
229
226
|
const prompt = `Create a new pi extension based on this description:
|
|
230
227
|
|
|
@@ -238,13 +235,30 @@ ${docHints.join("\n")}
|
|
|
238
235
|
|
|
239
236
|
## Output
|
|
240
237
|
|
|
241
|
-
Write the complete implementation as a
|
|
238
|
+
Write the complete implementation as a directory-based extension:
|
|
242
239
|
|
|
243
|
-
\`~/.gsd/agent/extensions/<kebab-case-name
|
|
240
|
+
\`~/.gsd/agent/extensions/<kebab-case-name>/index.ts\`
|
|
241
|
+
\`~/.gsd/agent/extensions/<kebab-case-name>/extension-manifest.json\`
|
|
244
242
|
|
|
245
|
-
|
|
243
|
+
The manifest must follow this format:
|
|
244
|
+
\`\`\`json
|
|
245
|
+
{
|
|
246
|
+
"id": "<kebab-case-name>",
|
|
247
|
+
"name": "<Human Name>",
|
|
248
|
+
"version": "1.0.0",
|
|
249
|
+
"description": "<one-line description>",
|
|
250
|
+
"tier": "community",
|
|
251
|
+
"requires": { "platform": ">=2.29.0" },
|
|
252
|
+
"provides": {
|
|
253
|
+
"tools": ["<tool_names_registered>"],
|
|
254
|
+
"commands": ["<command_names_registered>"],
|
|
255
|
+
"hooks": ["<event_names_subscribed>"],
|
|
256
|
+
"shortcuts": ["<shortcut_keys_registered>"]
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
\`\`\`
|
|
246
260
|
|
|
247
|
-
|
|
261
|
+
Only include non-empty arrays in \`provides\`. See \`docs/extension-sdk/manifest-spec.md\` for the full spec.
|
|
248
262
|
|
|
249
263
|
## Rules you must follow exactly
|
|
250
264
|
|
|
@@ -19,8 +19,8 @@ Note: `~/.gsd/agent/extensions/` is reserved for bundled extensions synced from
|
|
|
19
19
|
3. **Commands** — Give users slash commands (`pi.registerCommand()`). Users type `/mycommand`.
|
|
20
20
|
|
|
21
21
|
**Non-negotiable rules:**
|
|
22
|
-
- Use `StringEnum` from `@
|
|
23
|
-
- Truncate tool output to 50KB / 2000 lines max (use `truncateHead`/`truncateTail` from `@
|
|
22
|
+
- Use `StringEnum` from `@gsd/pi-ai` for string enum params (NOT `Type.Union`/`Type.Literal` — breaks Google's API)
|
|
23
|
+
- Truncate tool output to 50KB / 2000 lines max (use `truncateHead`/`truncateTail` from `@gsd/pi-coding-agent`)
|
|
24
24
|
- Store stateful tool state in `details` for branching support
|
|
25
25
|
- Check `signal?.aborted` in long-running tool executions
|
|
26
26
|
- Use `pi.exec()` not `child_process` for shell commands
|
|
@@ -34,10 +34,10 @@ Note: `~/.gsd/agent/extensions/` is reserved for bundled extensions synced from
|
|
|
34
34
|
|
|
35
35
|
| Package | Purpose |
|
|
36
36
|
|---------|---------|
|
|
37
|
-
| `@
|
|
37
|
+
| `@gsd/pi-coding-agent` | `ExtensionAPI`, `ExtensionContext`, `Theme`, event types, tool utilities, `DynamicBorder`, `BorderedLoader`, `CustomEditor`, `highlightCode` |
|
|
38
38
|
| `@sinclair/typebox` | `Type.Object`, `Type.String`, `Type.Number`, `Type.Optional`, `Type.Boolean`, `Type.Array` |
|
|
39
|
-
| `@
|
|
40
|
-
| `@
|
|
39
|
+
| `@gsd/pi-ai` | `StringEnum` (required for string enums), `Type` re-export |
|
|
40
|
+
| `@gsd/pi-tui` | `Text`, `Box`, `Container`, `Spacer`, `Markdown`, `SelectList`, `Input`, `matchesKey`, `Key`, `truncateToWidth`, `visibleWidth` |
|
|
41
41
|
| Node.js built-ins | `node:fs`, `node:path`, `node:child_process`, etc. |
|
|
42
42
|
|
|
43
43
|
</essential_principles>
|
|
@@ -65,6 +65,9 @@ All domain knowledge in `references/`:
|
|
|
65
65
|
**Capabilities:** custom-tools.md, custom-commands.md, custom-ui.md, custom-rendering.md
|
|
66
66
|
**Patterns:** state-management.md, system-prompt-modification.md, compaction-session-control.md
|
|
67
67
|
**Infrastructure:** model-provider-management.md, remote-execution-overrides.md, packaging-distribution.md, mode-behavior.md
|
|
68
|
+
**Spec:** `docs/extension-sdk/manifest-spec.md` — manifest format, tiers, validation
|
|
69
|
+
**Testing:** `docs/extension-sdk/testing.md` — mock patterns, test conventions
|
|
70
|
+
**SDK:** `docs/extension-sdk/` — the authoritative GSD-2 extension guide
|
|
68
71
|
**Gotchas:** key-rules-gotchas.md
|
|
69
72
|
</reference_index>
|
|
70
73
|
|
|
@@ -78,6 +81,7 @@ All domain knowledge in `references/`:
|
|
|
78
81
|
|
|
79
82
|
<success_criteria>
|
|
80
83
|
Extension is complete when:
|
|
84
|
+
- `extension-manifest.json` exists with accurate `provides` listing all registered tools/commands/hooks/shortcuts
|
|
81
85
|
- TypeScript compiles without errors (jiti handles this at runtime)
|
|
82
86
|
- Extension loads on GSD startup or `/reload` without errors
|
|
83
87
|
- Tools appear in the LLM's system prompt and are callable
|
|
@@ -19,7 +19,7 @@ pi.registerCommand("deploy", {
|
|
|
19
19
|
Add tab-completion for command arguments:
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import type { AutocompleteItem } from "@
|
|
22
|
+
import type { AutocompleteItem } from "@gsd/pi-tui";
|
|
23
23
|
|
|
24
24
|
pi.registerCommand("deploy", {
|
|
25
25
|
description: "Deploy to an environment",
|
|
@@ -6,8 +6,8 @@ Custom rendering for tools and messages — control how they appear in the TUI.
|
|
|
6
6
|
Tools can provide `renderCall` (how the call looks) and `renderResult` (how the result looks):
|
|
7
7
|
|
|
8
8
|
```typescript
|
|
9
|
-
import { Text } from "@
|
|
10
|
-
import { keyHint } from "@
|
|
9
|
+
import { Text } from "@gsd/pi-tui";
|
|
10
|
+
import { keyHint } from "@gsd/pi-coding-agent";
|
|
11
11
|
|
|
12
12
|
pi.registerTool({
|
|
13
13
|
name: "my_tool",
|
|
@@ -54,7 +54,7 @@ If you omit `renderCall`/`renderResult`, the built-in renderer is used. Useful f
|
|
|
54
54
|
Key hint helpers for showing keybinding info in render output:
|
|
55
55
|
|
|
56
56
|
```typescript
|
|
57
|
-
import { keyHint, appKeyHint, editorKey, rawKeyHint } from "@
|
|
57
|
+
import { keyHint, appKeyHint, editorKey, rawKeyHint } from "@gsd/pi-coding-agent";
|
|
58
58
|
|
|
59
59
|
// Editor action hint (respects user keybinding config)
|
|
60
60
|
keyHint("expandTools", "to expand") // e.g., "Ctrl+O to expand"
|
|
@@ -69,7 +69,7 @@ rawKeyHint("Ctrl+O", "to expand")
|
|
|
69
69
|
Register a renderer for custom message types:
|
|
70
70
|
|
|
71
71
|
```typescript
|
|
72
|
-
import { Text } from "@
|
|
72
|
+
import { Text } from "@gsd/pi-tui";
|
|
73
73
|
|
|
74
74
|
pi.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
75
75
|
const { expanded } = options;
|
|
@@ -92,7 +92,7 @@ pi.sendMessage({
|
|
|
92
92
|
|
|
93
93
|
<syntax_highlighting>
|
|
94
94
|
```typescript
|
|
95
|
-
import { highlightCode, getLanguageFromPath } from "@
|
|
95
|
+
import { highlightCode, getLanguageFromPath } from "@gsd/pi-coding-agent";
|
|
96
96
|
|
|
97
97
|
const lang = getLanguageFromPath("/path/to/file.rs"); // "rust"
|
|
98
98
|
const highlighted = highlightCode(code, lang, theme);
|
|
@@ -5,7 +5,7 @@ Complete custom tools reference — registration, parameters, execution, output
|
|
|
5
5
|
<registration>
|
|
6
6
|
```typescript
|
|
7
7
|
import { Type } from "@sinclair/typebox";
|
|
8
|
-
import { StringEnum } from "@
|
|
8
|
+
import { StringEnum } from "@gsd/pi-ai";
|
|
9
9
|
|
|
10
10
|
pi.registerTool({
|
|
11
11
|
name: "my_tool", // Unique identifier (snake_case)
|
|
@@ -60,7 +60,7 @@ pi.registerTool({
|
|
|
60
60
|
**⚠️ MUST use `StringEnum` for string enum parameters:**
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
|
-
import { StringEnum } from "@
|
|
63
|
+
import { StringEnum } from "@gsd/pi-ai";
|
|
64
64
|
|
|
65
65
|
// ✅ Correct — works with all providers including Google
|
|
66
66
|
action: StringEnum(["list", "add", "remove"] as const)
|
|
@@ -77,7 +77,7 @@ Tools MUST truncate output to avoid context overflow. Built-in limit: 50KB / 200
|
|
|
77
77
|
import {
|
|
78
78
|
truncateHead, truncateTail, formatSize,
|
|
79
79
|
DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES,
|
|
80
|
-
} from "@
|
|
80
|
+
} from "@gsd/pi-coding-agent";
|
|
81
81
|
|
|
82
82
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
83
83
|
const output = await runCommand();
|
|
@@ -129,7 +129,7 @@ Use `pi.setActiveTools(names)` to enable/disable tools at runtime.
|
|
|
129
129
|
Register a tool with the same name as a built-in (`read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`) to override it. **Must match exact result shape including `details` type.**
|
|
130
130
|
|
|
131
131
|
```typescript
|
|
132
|
-
import { createReadTool } from "@
|
|
132
|
+
import { createReadTool } from "@gsd/pi-coding-agent";
|
|
133
133
|
|
|
134
134
|
pi.registerTool({
|
|
135
135
|
name: "read",
|
|
@@ -277,7 +277,7 @@ bottom-left bottom-center bottom-right
|
|
|
277
277
|
Replace the main input editor permanently:
|
|
278
278
|
|
|
279
279
|
```typescript
|
|
280
|
-
import { CustomEditor } from "@
|
|
280
|
+
import { CustomEditor } from "@gsd/pi-coding-agent";
|
|
281
281
|
|
|
282
282
|
class VimEditor extends CustomEditor {
|
|
283
283
|
private mode: "normal" | "insert" = "insert";
|
|
@@ -307,7 +307,7 @@ ctx.ui.setEditorComponent(undefined); // Restore default
|
|
|
307
307
|
</custom_editor>
|
|
308
308
|
|
|
309
309
|
<built_in_components>
|
|
310
|
-
**From `@
|
|
310
|
+
**From `@gsd/pi-tui`:**
|
|
311
311
|
|
|
312
312
|
| Component | Constructor | Purpose |
|
|
313
313
|
|-----------|-------------|---------|
|
|
@@ -352,7 +352,7 @@ const settings = new SettingsList(items, 15, getSettingsListTheme(),
|
|
|
352
352
|
);
|
|
353
353
|
```
|
|
354
354
|
|
|
355
|
-
**From `@
|
|
355
|
+
**From `@gsd/pi-coding-agent`:**
|
|
356
356
|
|
|
357
357
|
| Component | Constructor | Purpose |
|
|
358
358
|
|-----------|-------------|---------|
|
|
@@ -363,7 +363,7 @@ const settings = new SettingsList(items, 15, getSettingsListTheme(),
|
|
|
363
363
|
|
|
364
364
|
<keyboard_input>
|
|
365
365
|
```typescript
|
|
366
|
-
import { matchesKey, Key } from "@
|
|
366
|
+
import { matchesKey, Key } from "@gsd/pi-tui";
|
|
367
367
|
|
|
368
368
|
handleInput(data: string) {
|
|
369
369
|
// Basic keys
|
|
@@ -403,7 +403,7 @@ handleInput(data: string) {
|
|
|
403
403
|
**Cardinal rule: each line from render() must not exceed `width` visible characters.**
|
|
404
404
|
|
|
405
405
|
```typescript
|
|
406
|
-
import { visibleWidth, truncateToWidth, wrapTextWithAnsi } from "@
|
|
406
|
+
import { visibleWidth, truncateToWidth, wrapTextWithAnsi } from "@gsd/pi-tui";
|
|
407
407
|
|
|
408
408
|
visibleWidth("\x1b[32mHello\x1b[0m"); // Returns 5 (ignores ANSI codes)
|
|
409
409
|
truncateToWidth("Very long text here", 10); // "Very lo..."
|
|
@@ -470,7 +470,7 @@ Always use theme from callback params, never import directly.
|
|
|
470
470
|
|
|
471
471
|
**Syntax highlighting:**
|
|
472
472
|
```typescript
|
|
473
|
-
import { highlightCode, getLanguageFromPath } from "@
|
|
473
|
+
import { highlightCode, getLanguageFromPath } from "@gsd/pi-coding-agent";
|
|
474
474
|
const lang = getLanguageFromPath("/file.rs"); // "rust"
|
|
475
475
|
const highlighted = highlightCode(code, lang, theme);
|
|
476
476
|
```
|
|
@@ -47,7 +47,7 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
47
47
|
|
|
48
48
|
**tool_call** — Fired before tool executes. Can block.
|
|
49
49
|
```typescript
|
|
50
|
-
import { isToolCallEventType } from "@
|
|
50
|
+
import { isToolCallEventType } from "@gsd/pi-coding-agent";
|
|
51
51
|
|
|
52
52
|
pi.on("tool_call", async (event, ctx) => {
|
|
53
53
|
if (isToolCallEventType("bash", event)) {
|
|
@@ -61,7 +61,7 @@ pi.on("tool_call", async (event, ctx) => {
|
|
|
61
61
|
|
|
62
62
|
**tool_result** — Fired after tool executes. Can modify result. Handlers chain like middleware.
|
|
63
63
|
```typescript
|
|
64
|
-
import { isToolResultEventType } from "@
|
|
64
|
+
import { isToolResultEventType } from "@gsd/pi-coding-agent";
|
|
65
65
|
|
|
66
66
|
pi.on("tool_result", async (event, ctx) => {
|
|
67
67
|
if (isToolResultEventType("bash", event)) {
|
|
@@ -105,7 +105,7 @@ pi.on("model_select", async (event, ctx) => {
|
|
|
105
105
|
Built-in type guards for tool events:
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
|
-
import { isToolCallEventType, isToolResultEventType } from "@
|
|
108
|
+
import { isToolCallEventType, isToolResultEventType } from "@gsd/pi-coding-agent";
|
|
109
109
|
|
|
110
110
|
// Tool calls — narrows event.input type
|
|
111
111
|
if (isToolCallEventType("bash", event)) { /* event.input: { command, timeout? } */ }
|
|
@@ -39,7 +39,7 @@ If no `pi` manifest exists, auto-discovers:
|
|
|
39
39
|
</convention_directories>
|
|
40
40
|
|
|
41
41
|
<dependencies>
|
|
42
|
-
- List `@
|
|
42
|
+
- List `@gsd/pi-ai`, `@gsd/pi-coding-agent`, `@gsd/pi-tui`, `@sinclair/typebox` in `peerDependencies` with `"*"` — they're bundled by the runtime.
|
|
43
43
|
- Other npm deps go in `dependencies`. The runtime runs `npm install` on package installation.
|
|
44
44
|
</dependencies>
|
|
45
45
|
|
|
@@ -6,7 +6,7 @@ Remote execution via pluggable operations, spawnHook for bash, and tool override
|
|
|
6
6
|
Built-in tools support pluggable operations for SSH, containers, etc.:
|
|
7
7
|
|
|
8
8
|
```typescript
|
|
9
|
-
import { createReadTool, createBashTool, createWriteTool } from "@
|
|
9
|
+
import { createReadTool, createBashTool, createWriteTool } from "@gsd/pi-coding-agent";
|
|
10
10
|
|
|
11
11
|
// Create tool with custom remote operations
|
|
12
12
|
const remoteBash = createBashTool(cwd, {
|
|
@@ -37,7 +37,7 @@ const bashTool = createBashTool(cwd, {
|
|
|
37
37
|
Full SSH pattern with flag-based switching:
|
|
38
38
|
|
|
39
39
|
```typescript
|
|
40
|
-
import { createBashTool, type ExtensionAPI } from "@
|
|
40
|
+
import { createBashTool, type ExtensionAPI } from "@gsd/pi-coding-agent";
|
|
41
41
|
|
|
42
42
|
export default function (pi: ExtensionAPI) {
|
|
43
43
|
pi.registerFlag("ssh", { description: "SSH target", type: "string" });
|
|
@@ -65,7 +65,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
65
65
|
Override built-in tools for logging/access control — omit renderCall/renderResult to keep built-in rendering:
|
|
66
66
|
|
|
67
67
|
```typescript
|
|
68
|
-
import { createReadTool } from "@
|
|
68
|
+
import { createReadTool } from "@gsd/pi-coding-agent";
|
|
69
69
|
import { Type } from "@sinclair/typebox";
|
|
70
70
|
|
|
71
71
|
pi.registerTool({
|