gsd-pi 2.78.1-dev.84a383f51 → 2.78.1
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 +7 -7
- package/dist/cli.js +55 -95
- package/dist/headless-query.d.ts +0 -22
- package/dist/headless-query.js +4 -24
- package/dist/headless.d.ts +0 -10
- package/dist/headless.js +1 -16
- package/dist/loader.js +10 -7
- package/dist/onboarding.d.ts +0 -10
- package/dist/onboarding.js +2 -2
- package/dist/provider-migrations.d.ts +2 -2
- package/dist/provider-migrations.js +2 -5
- package/dist/resource-loader.d.ts +2 -5
- package/dist/resource-loader.js +5 -28
- package/dist/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +601 -0
- package/dist/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +651 -0
- package/dist/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +91 -0
- package/dist/resources/extensions/gsd/auto/loop.js +0 -23
- package/dist/resources/extensions/gsd/auto/phases.js +2 -2
- package/dist/resources/extensions/gsd/auto/run-unit.js +1 -3
- package/dist/resources/extensions/gsd/auto/session.js +0 -3
- package/dist/resources/extensions/gsd/auto-recovery.js +4 -43
- 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 +0 -30
- package/dist/resources/extensions/gsd/auto.js +5 -14
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +2 -14
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +5 -7
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +4 -5
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +31 -94
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +6 -11
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +8 -34
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +2 -38
- package/dist/resources/extensions/gsd/commands/catalog.js +5 -69
- package/dist/resources/extensions/gsd/commands/handlers/core.js +1 -22
- package/dist/resources/extensions/gsd/commands-mcp-status.js +1 -3
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -10
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +0 -4
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +1 -39
- 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 +5 -12
- package/dist/resources/extensions/gsd/gsd-db.js +2 -11
- package/dist/resources/extensions/gsd/guided-flow.js +23 -23
- package/dist/resources/extensions/gsd/memory-store.js +31 -66
- package/dist/resources/extensions/gsd/model-router.js +9 -114
- package/dist/resources/extensions/gsd/native-git-bridge.js +1 -7
- package/dist/resources/extensions/gsd/preferences-models.js +15 -91
- package/dist/resources/extensions/gsd/preferences-types.js +0 -2
- package/dist/resources/extensions/gsd/preferences-validation.js +0 -32
- package/dist/resources/extensions/gsd/preferences.js +3 -5
- package/dist/resources/extensions/gsd/prompt-loader.js +12 -23
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +3 -9
- package/dist/resources/extensions/gsd/state.js +0 -42
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +0 -1
- package/dist/resources/extensions/gsd/tests/auto-supervisor.test.mjs +53 -0
- package/dist/resources/extensions/gsd/tests/dist-redirect.mjs +112 -0
- package/dist/resources/extensions/gsd/tests/resolve-ts-hooks.mjs +23 -0
- package/dist/resources/extensions/gsd/tests/resolve-ts.mjs +5 -0
- package/dist/resources/extensions/gsd/tools/memory-tools.js +1 -18
- package/dist/resources/extensions/gsd/visualizer-overlay.js +1 -1
- package/dist/resources/extensions/gsd/watch/header-renderer.js +1 -3
- package/dist/resources/extensions/gsd/worktree-command.js +46 -26
- package/dist/resources/extensions/mcp-client/index.js +3 -6
- package/dist/resources/extensions/slash-commands/create-extension.js +22 -36
- package/dist/resources/skills/create-gsd-extension/SKILL.md +5 -9
- 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 +12 -32
- 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 +608 -0
- package/dist/rtk-shared.d.ts +0 -3
- package/dist/rtk-shared.js +0 -17
- package/dist/rtk.d.ts +5 -2
- package/dist/rtk.js +20 -3
- 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 +4 -44
- 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 +2 -4
- 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/2826.e9f5195e91f9cad2.js +11 -0
- package/dist/web/standalone/.next/static/chunks/3621.fc7480022c972438.js +20 -0
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-f2a7482d42a5614b.js → page-2f24283c162b6ab3.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-a16c7a7ecdf0c2cf.js → layout-9ecfd95f343793f0.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-151349214571e2b6.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +1 -0
- package/dist/web/standalone/.next/static/chunks/webpack-2e68521d7c82f7c2.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 +1 -2
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +46 -74
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +0 -26
- package/packages/mcp-server/src/workflow-tools.ts +58 -93
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +19 -48
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +0 -13
- 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 +3 -24
- 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 +0 -26
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js.map +1 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +20 -52
- package/packages/pi-ai/src/types.ts +0 -13
- package/packages/pi-ai/src/utils/repair-tool-json.ts +3 -24
- package/packages/pi-ai/src/utils/tests/repair-tool-json.test.ts +0 -32
- 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 +0 -6
- 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 +0 -4
- 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 +2 -19
- 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 +0 -10
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +0 -18
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +0 -13
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +16 -20
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- 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 +1 -14
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +0 -7
- package/packages/pi-coding-agent/src/core/messages.ts +0 -4
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +2 -32
- package/packages/pi-coding-agent/src/core/model-registry.ts +0 -21
- package/packages/pi-coding-agent/src/core/system-prompt.ts +15 -33
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +1 -17
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +1 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +3 -17
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +3 -20
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/gsd/auto/loop.ts +2 -24
- package/src/resources/extensions/gsd/auto/phases.ts +3 -3
- package/src/resources/extensions/gsd/auto/run-unit.ts +1 -3
- package/src/resources/extensions/gsd/auto/session.ts +0 -3
- package/src/resources/extensions/gsd/auto/types.ts +0 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +8 -46
- package/src/resources/extensions/gsd/auto-start.ts +1 -1
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +4 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +0 -38
- package/src/resources/extensions/gsd/auto.ts +4 -14
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +13 -15
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +7 -8
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +9 -10
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +31 -102
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +6 -12
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +8 -39
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +11 -39
- package/src/resources/extensions/gsd/commands/catalog.ts +5 -75
- package/src/resources/extensions/gsd/commands/handlers/core.ts +1 -22
- package/src/resources/extensions/gsd/commands-mcp-status.ts +1 -3
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -15
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +0 -4
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +1 -39
- package/src/resources/extensions/gsd/doctor-types.ts +1 -3
- 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 +5 -13
- package/src/resources/extensions/gsd/gsd-db.ts +2 -12
- package/src/resources/extensions/gsd/guided-flow.ts +25 -25
- package/src/resources/extensions/gsd/memory-store.ts +28 -81
- package/src/resources/extensions/gsd/model-router.ts +9 -172
- package/src/resources/extensions/gsd/native-git-bridge.ts +1 -7
- package/src/resources/extensions/gsd/preferences-models.ts +15 -101
- package/src/resources/extensions/gsd/preferences-types.ts +0 -6
- package/src/resources/extensions/gsd/preferences-validation.ts +0 -35
- package/src/resources/extensions/gsd/preferences.ts +2 -16
- package/src/resources/extensions/gsd/prompt-loader.ts +12 -26
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +3 -9
- package/src/resources/extensions/gsd/state.ts +0 -42
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +0 -1
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +1 -178
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +0 -58
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +5 -9
- package/src/resources/extensions/gsd/tests/auto-supervisor.test.mjs +4 -21
- 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 +211 -138
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +59 -142
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +4 -7
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +32 -89
- package/src/resources/extensions/gsd/tests/copy-planning-artifacts-samepath.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +23 -41
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +43 -3
- package/src/resources/extensions/gsd/tests/debug-logger.test.ts +3 -5
- package/src/resources/extensions/gsd/tests/discuss-empty-db-fallback.test.ts +87 -22
- package/src/resources/extensions/gsd/tests/discuss-queued-milestones.test.ts +118 -7
- package/src/resources/extensions/gsd/tests/discuss-slice-structured-questions.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +60 -18
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +76 -14
- package/src/resources/extensions/gsd/tests/empty-content-abort-loop.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +83 -22
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +63 -1
- package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +1 -26
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +0 -30
- package/src/resources/extensions/gsd/tests/headless-answers.test.ts +4 -14
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +12 -22
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +1 -64
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +0 -22
- package/src/resources/extensions/gsd/tests/integration/token-savings.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +0 -128
- package/src/resources/extensions/gsd/tests/memory-tools.test.ts +1 -33
- package/src/resources/extensions/gsd/tests/model-router.test.ts +8 -169
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +0 -8
- package/src/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +43 -32
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +10 -4
- package/src/resources/extensions/gsd/tests/preferences.test.ts +0 -127
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +0 -16
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +0 -7
- package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +19 -168
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +1 -7
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +1 -23
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +4 -51
- package/src/resources/extensions/gsd/tests/turn-epoch.test.ts +16 -7
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +7 -5
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +1 -15
- package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +0 -15
- package/src/resources/extensions/gsd/tools/memory-tools.ts +1 -17
- 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 +1 -3
- package/src/resources/extensions/gsd/workflow-logger.ts +0 -1
- package/src/resources/extensions/gsd/worktree-command.ts +44 -31
- package/src/resources/extensions/mcp-client/index.ts +3 -6
- package/src/resources/extensions/slash-commands/create-extension.ts +24 -38
- package/src/resources/skills/create-gsd-extension/SKILL.md +5 -9
- 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/workflows/create-extension.md +12 -32
- package/dist/cli-policy.d.ts +0 -13
- package/dist/cli-policy.js +0 -17
- package/dist/resources/.managed-resources-content-hash +0 -1
- package/dist/resources/extensions/gsd/auto-runtime-state.js +0 -31
- package/dist/resources/extensions/gsd/milestone-id-reservation.js +0 -36
- package/dist/resources/extensions/gsd/worktree-session-state.js +0 -33
- package/dist/runtime-checks.d.ts +0 -27
- package/dist/runtime-checks.js +0 -38
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/2824.08296bc2f9654698.js +0 -1
- package/dist/web/standalone/.next/static/chunks/3026.3af53b279375f082.js +0 -1
- package/dist/web/standalone/.next/static/chunks/315.6f68ae79b67d25cf.js +0 -1
- package/dist/web/standalone/.next/static/chunks/3497.4bfc60a3b3dea717.js +0 -1
- package/dist/web/standalone/.next/static/chunks/5516.4a07c872b5c3a663.js +0 -1
- package/dist/web/standalone/.next/static/chunks/8336.31b019697882acfb.js +0 -10
- package/dist/web/standalone/.next/static/chunks/8845.c9702695e8c5a9c5.js +0 -2
- package/dist/web/standalone/.next/static/chunks/9058.01ef3a463bda88f1.js +0 -20
- package/dist/web/standalone/.next/static/chunks/9441.1081da1125d1764f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/page-9bf2e0c50fb2ca05.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +0 -1
- package/dist/web/standalone/.next/static/chunks/webpack-f9f0dc45e4f3ac10.js +0 -1
- package/dist/worktree-status-banner.d.ts +0 -1
- package/dist/worktree-status-banner.js +0 -132
- package/packages/mcp-server/dist/alias-telemetry.d.ts +0 -8
- package/packages/mcp-server/dist/alias-telemetry.d.ts.map +0 -1
- package/packages/mcp-server/dist/alias-telemetry.js +0 -30
- package/packages/mcp-server/dist/alias-telemetry.js.map +0 -1
- package/packages/mcp-server/src/alias-telemetry.test.ts +0 -78
- package/packages/mcp-server/src/alias-telemetry.ts +0 -30
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.d.ts +0 -2
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.d.ts.map +0 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.js +0 -231
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.js.map +0 -1
- package/packages/pi-ai/src/providers/anthropic-shared.cache-breakpoint.test.ts +0 -289
- package/packages/pi-coding-agent/dist/core/token-telemetry.d.ts +0 -37
- package/packages/pi-coding-agent/dist/core/token-telemetry.d.ts.map +0 -1
- package/packages/pi-coding-agent/dist/core/token-telemetry.js +0 -49
- package/packages/pi-coding-agent/dist/core/token-telemetry.js.map +0 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.d.ts +0 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.d.ts.map +0 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +0 -133
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +0 -1
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.d.ts +0 -2
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.d.ts.map +0 -1
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.js +0 -78
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.js.map +0 -1
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.d.ts +0 -2
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.d.ts.map +0 -1
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.js +0 -181
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.js.map +0 -1
- package/packages/pi-coding-agent/src/core/token-telemetry.ts +0 -77
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +0 -212
- package/packages/pi-coding-agent/src/tests/system-prompt-cache-stability.test.ts +0 -102
- package/packages/pi-coding-agent/src/tests/token-telemetry.test.ts +0 -200
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts +0 -2
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts.map +0 -1
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js +0 -161
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js.map +0 -1
- package/packages/pi-tui/src/components/__tests__/leak-fixes-runtime.test.ts +0 -219
- package/src/resources/extensions/gsd/auto-runtime-state.ts +0 -51
- package/src/resources/extensions/gsd/milestone-id-reservation.ts +0 -47
- package/src/resources/extensions/gsd/tests/deferred-milestone-dir-4996.test.ts +0 -116
- package/src/resources/extensions/gsd/tests/doctor-orphan-milestone-4996.test.ts +0 -100
- package/src/resources/extensions/gsd/tests/ensure-preconditions-guard-4996.test.ts +0 -93
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed-runtime.test.ts +0 -47
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell-runtime.test.ts +0 -63
- package/src/resources/extensions/gsd/tests/gsd-no-project-error-runtime.test.ts +0 -81
- package/src/resources/extensions/gsd/tests/help-menu-coverage.test.ts +0 -57
- package/src/resources/extensions/gsd/tests/import-done-milestones-runtime.test.ts +0 -145
- package/src/resources/extensions/gsd/tests/merge-self-branch-guard.test.ts +0 -124
- package/src/resources/extensions/gsd/tests/milestone-id-gap-reuse-4996.test.ts +0 -152
- package/src/resources/extensions/gsd/tests/native-git-infra-errors.test.ts +0 -50
- package/src/resources/extensions/gsd/tests/register-hooks-compaction-checkpoint.test.ts +0 -93
- package/src/resources/extensions/gsd/tests/system-context-message-routing.test.ts +0 -101
- package/src/resources/extensions/gsd/worktree-session-state.ts +0 -35
- package/src/resources/extensions/mcp-client/tests/global-config.test.ts +0 -91
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +0 -58
- /package/dist/web/standalone/.next/static/{UF5VF4F1tB0miEtJS7LyX → 7afp7gq8-DVbxum83zRQ-}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{UF5VF4F1tB0miEtJS7LyX → 7afp7gq8-DVbxum83zRQ-}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { mkdtempSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { writeUnitRuntimeRecord, readUnitRuntimeRecord } from '../unit-runtime.ts';
|
|
7
|
+
import { resolveAutoSupervisorConfig } from '../preferences.ts';
|
|
8
|
+
|
|
9
|
+
test('resolveAutoSupervisorConfig provides safe timeout defaults', () => {
|
|
10
|
+
const supervisor = resolveAutoSupervisorConfig();
|
|
11
|
+
assert.equal(supervisor.soft_timeout_minutes, 20);
|
|
12
|
+
assert.equal(supervisor.idle_timeout_minutes, 10);
|
|
13
|
+
assert.equal(supervisor.hard_timeout_minutes, 30);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('writeUnitRuntimeRecord persists progress and recovery metadata defaults', () => {
|
|
17
|
+
const base = mkdtempSync(join(tmpdir(), 'gsd-auto-supervisor-'));
|
|
18
|
+
const startedAt = 1234567890;
|
|
19
|
+
|
|
20
|
+
writeUnitRuntimeRecord(base, 'plan-milestone', 'M010', startedAt, {
|
|
21
|
+
phase: 'dispatched',
|
|
22
|
+
lastProgressAt: startedAt,
|
|
23
|
+
progressCount: 1,
|
|
24
|
+
lastProgressKind: 'dispatch',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const runtime = readUnitRuntimeRecord(base, 'plan-milestone', 'M010');
|
|
28
|
+
assert.ok(runtime);
|
|
29
|
+
assert.equal(runtime.phase, 'dispatched');
|
|
30
|
+
assert.equal(runtime.lastProgressAt, startedAt);
|
|
31
|
+
assert.equal(runtime.progressCount, 1);
|
|
32
|
+
assert.equal(runtime.lastProgressKind, 'dispatch');
|
|
33
|
+
assert.equal(runtime.recoveryAttempts, 0);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('writeUnitRuntimeRecord keeps explicit recovery attempt fields', () => {
|
|
37
|
+
const base = mkdtempSync(join(tmpdir(), 'gsd-auto-supervisor-'));
|
|
38
|
+
const startedAt = 2234567890;
|
|
39
|
+
|
|
40
|
+
writeUnitRuntimeRecord(base, 'research-milestone', 'M011', startedAt, {
|
|
41
|
+
phase: 'timeout',
|
|
42
|
+
recoveryAttempts: 2,
|
|
43
|
+
lastRecoveryReason: 'idle',
|
|
44
|
+
lastProgressAt: startedAt + 50,
|
|
45
|
+
progressCount: 3,
|
|
46
|
+
lastProgressKind: 'recovery-retry',
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const runtime = JSON.parse(readFileSync(join(base, '.gsd/runtime/units/research-milestone-M011.json'), 'utf8'));
|
|
50
|
+
assert.equal(runtime.recoveryAttempts, 2);
|
|
51
|
+
assert.equal(runtime.lastRecoveryReason, 'idle');
|
|
52
|
+
assert.equal(runtime.lastProgressKind, 'recovery-retry');
|
|
53
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
const ROOT = new URL("../../../../../", import.meta.url);
|
|
8
|
+
|
|
9
|
+
export function resolve(specifier, context, nextResolve) {
|
|
10
|
+
// 1. Redirect all workspace package bare imports to source.
|
|
11
|
+
// CI portability runs don't build any packages/ dist artifacts, so every
|
|
12
|
+
// @gsd/* specifier (including transitive ones pulled in by pi-coding-agent
|
|
13
|
+
// source itself) must resolve to the TypeScript source entrypoint.
|
|
14
|
+
if (specifier === "../../packages/pi-coding-agent/src/index.js") {
|
|
15
|
+
specifier = new URL("packages/pi-coding-agent/src/index.ts", ROOT).href;
|
|
16
|
+
} else if (specifier === "@gsd/pi-coding-agent") {
|
|
17
|
+
specifier = new URL("packages/pi-coding-agent/src/index.ts", ROOT).href;
|
|
18
|
+
} else if (specifier === "@gsd/pi-ai/oauth") {
|
|
19
|
+
specifier = new URL("packages/pi-ai/src/utils/oauth/index.ts", ROOT).href;
|
|
20
|
+
} else if (specifier === "@gsd/pi-ai") {
|
|
21
|
+
specifier = new URL("packages/pi-ai/src/index.ts", ROOT).href;
|
|
22
|
+
} else if (specifier === "@gsd/pi-agent-core") {
|
|
23
|
+
specifier = new URL("packages/pi-agent-core/src/index.ts", ROOT).href;
|
|
24
|
+
} else if (specifier === "@gsd/pi-tui") {
|
|
25
|
+
specifier = new URL("packages/pi-tui/src/index.ts", ROOT).href;
|
|
26
|
+
} else if (specifier === "@gsd/native") {
|
|
27
|
+
specifier = new URL("packages/native/src/index.ts", ROOT).href;
|
|
28
|
+
} else if (specifier.startsWith("@gsd/native/")) {
|
|
29
|
+
// Sub-path imports like @gsd/native/fd, @gsd/native/text, etc.
|
|
30
|
+
const subpath = specifier.slice("@gsd/native/".length);
|
|
31
|
+
specifier = new URL(`packages/native/src/${subpath}/index.ts`, ROOT).href;
|
|
32
|
+
}
|
|
33
|
+
// 2. Redirect packages/*/dist/ → packages/*/src/ with .js→.ts for strip-types
|
|
34
|
+
// Also handles local imports — skip rewrite for dist/ paths that are real compiled artifacts.
|
|
35
|
+
|
|
36
|
+
else if (specifier.endsWith('.js') && (specifier.startsWith('./') || specifier.startsWith('../'))) {
|
|
37
|
+
if (context.parentURL && context.parentURL.includes('/src/')) {
|
|
38
|
+
if (specifier.includes('/dist/')) {
|
|
39
|
+
specifier = specifier.replace('/dist/', '/src/').replace(/\.js$/, '.ts');
|
|
40
|
+
} else {
|
|
41
|
+
specifier = specifier.replace(/\.js$/, '.ts');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// 3. Extensionless relative imports from web/ (Next.js convention).
|
|
46
|
+
// Transpiled .tsx files emit extensionless imports — try .ts then .tsx.
|
|
47
|
+
else if (
|
|
48
|
+
(specifier.startsWith('./') || specifier.startsWith('../')) &&
|
|
49
|
+
!specifier.match(/\.\w+$/) &&
|
|
50
|
+
context.parentURL &&
|
|
51
|
+
context.parentURL.includes('/web/')
|
|
52
|
+
) {
|
|
53
|
+
const baseUrl = new URL(specifier, context.parentURL);
|
|
54
|
+
for (const ext of ['.ts', '.tsx']) {
|
|
55
|
+
const candidate = fileURLToPath(baseUrl) + ext;
|
|
56
|
+
if (existsSync(candidate)) {
|
|
57
|
+
specifier = baseUrl.href + ext;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return nextResolve(specifier, context);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function load(url, context, nextLoad) {
|
|
68
|
+
// Node's --experimental-strip-types handles plain .ts but not .tsx and not
|
|
69
|
+
// all TypeScript syntax used by workspace packages (parameter properties,
|
|
70
|
+
// decorators, etc.). Transpile all workspace package source files and .tsx
|
|
71
|
+
// files through TypeScript's transpileModule to avoid those crashes.
|
|
72
|
+
const shouldTranspileWithTypeScript =
|
|
73
|
+
url.endsWith('.tsx') ||
|
|
74
|
+
(url.endsWith('.ts') && url.includes('/packages/') && url.includes('/src/'));
|
|
75
|
+
|
|
76
|
+
if (shouldTranspileWithTypeScript) {
|
|
77
|
+
const ts = require('typescript');
|
|
78
|
+
const source = readFileSync(fileURLToPath(url), 'utf-8');
|
|
79
|
+
const { outputText } = ts.transpileModule(source, {
|
|
80
|
+
fileName: fileURLToPath(url),
|
|
81
|
+
compilerOptions: {
|
|
82
|
+
jsx: ts.JsxEmit.ReactJSX,
|
|
83
|
+
module: ts.ModuleKind.ESNext,
|
|
84
|
+
target: ts.ScriptTarget.ESNext,
|
|
85
|
+
esModuleInterop: true,
|
|
86
|
+
experimentalDecorators: true,
|
|
87
|
+
emitDecoratorMetadata: true,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
// Inject CJS-compatible globals (__dirname, __filename, require) so that
|
|
91
|
+
// workspace packages compiled as ESM can still use them. This avoids the
|
|
92
|
+
// need for import.meta.url behind indirect invocation patterns that fail in
|
|
93
|
+
// CJS and in dynamically-created scopes.
|
|
94
|
+
// Only inject globals that the source file doesn't already declare itself.
|
|
95
|
+
const preambleLines = [
|
|
96
|
+
'import { fileURLToPath as __preamble_fUTP } from "node:url";',
|
|
97
|
+
'import { dirname as __preamble_dn } from "node:path";',
|
|
98
|
+
'import { createRequire as __preamble_cR } from "node:module";',
|
|
99
|
+
];
|
|
100
|
+
if (!outputText.includes('const __filename') && !outputText.includes('let __filename')) {
|
|
101
|
+
preambleLines.push('const __filename = __preamble_fUTP(import.meta.url);');
|
|
102
|
+
}
|
|
103
|
+
if (!outputText.includes('const __dirname') && !outputText.includes('let __dirname')) {
|
|
104
|
+
preambleLines.push('const __dirname = __preamble_dn(__preamble_fUTP(import.meta.url));');
|
|
105
|
+
}
|
|
106
|
+
if (!outputText.includes('const require') && !outputText.includes('let require')) {
|
|
107
|
+
preambleLines.push('const require = __preamble_cR(import.meta.url);');
|
|
108
|
+
}
|
|
109
|
+
return { format: 'module', source: preambleLines.join('\n') + '\n' + outputText, shortCircuit: true };
|
|
110
|
+
}
|
|
111
|
+
return nextLoad(url, context);
|
|
112
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
|
|
3
|
+
const ROOT = new URL("../../../../../", import.meta.url);
|
|
4
|
+
const PACKAGES_ROOT = fileURLToPath(new URL("packages/", ROOT));
|
|
5
|
+
|
|
6
|
+
export function resolve(specifier, context, nextResolve) {
|
|
7
|
+
let tsSpecifier = specifier;
|
|
8
|
+
if (specifier.includes('@gsd/')) {
|
|
9
|
+
tsSpecifier = specifier.replace('@gsd/', PACKAGES_ROOT).replace('/dist/', '/src/');
|
|
10
|
+
if (tsSpecifier.includes('/packages/pi-ai') && !tsSpecifier.endsWith('.ts')) {
|
|
11
|
+
tsSpecifier = tsSpecifier.replace(/\/packages\/pi-ai$/, '/packages/pi-ai/src/index.ts');
|
|
12
|
+
} else if (!tsSpecifier.includes('/src/') && !tsSpecifier.endsWith('.ts')) {
|
|
13
|
+
// Fallback for other gsd packages like pi-coding-agent, pi-tui, pi-agent-core
|
|
14
|
+
tsSpecifier = tsSpecifier.replace(/\/packages\/([^\/]+)$/, '/packages/$1/src/index.ts');
|
|
15
|
+
} else if (!tsSpecifier.endsWith('.ts') && !tsSpecifier.endsWith('.js') && !tsSpecifier.endsWith('.mjs')) {
|
|
16
|
+
tsSpecifier += '/index.ts';
|
|
17
|
+
}
|
|
18
|
+
} else if (specifier.endsWith('.js')) {
|
|
19
|
+
tsSpecifier = specifier.replace(/\.js$/, '.ts');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return nextResolve(tsSpecifier, context);
|
|
23
|
+
}
|
|
@@ -59,25 +59,8 @@ export function executeMemoryCapture(params) {
|
|
|
59
59
|
const scope = normalizeScope(params.scope);
|
|
60
60
|
const tags = normalizeTags(params.tags);
|
|
61
61
|
const structuredFields = normalizeStructuredFields(params.structuredFields);
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
id = createMemory({ category, content, confidence, scope, tags, structuredFields });
|
|
65
|
-
}
|
|
66
|
-
catch (err) {
|
|
67
|
-
// Surface the underlying SQL message (e.g. "database disk image is
|
|
68
|
-
// malformed", "no such table: memories") so the operator gets the
|
|
69
|
-
// actionable signal instead of an opaque "create_failed". See #4967.
|
|
70
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
71
|
-
return {
|
|
72
|
-
content: [{ type: "text", text: `Error: failed to create memory: ${message}` }],
|
|
73
|
-
details: { operation: "memory_capture", error: message },
|
|
74
|
-
isError: true,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
62
|
+
const id = createMemory({ category, content, confidence, scope, tags, structuredFields });
|
|
77
63
|
if (!id) {
|
|
78
|
-
// DB unavailable or adapter missing — distinct from the SQL-error path
|
|
79
|
-
// above. Keep the legacy create_failed token here so any consumers that
|
|
80
|
-
// explicitly key on the unavailable case continue to work.
|
|
81
64
|
return {
|
|
82
65
|
content: [{ type: "text", text: "Error: failed to create memory." }],
|
|
83
66
|
details: { operation: "memory_capture", error: "create_failed" },
|
|
@@ -6,7 +6,7 @@ import { join } from "node:path";
|
|
|
6
6
|
import { writeExportFile } from "./export.js";
|
|
7
7
|
import { gsdRoot } from "./paths.js";
|
|
8
8
|
import { stripAnsi } from "../shared/mod.js";
|
|
9
|
-
|
|
9
|
+
const TAB_COUNT = 10;
|
|
10
10
|
const TAB_LABELS = [
|
|
11
11
|
"1 Progress",
|
|
12
12
|
"2 Timeline",
|
|
@@ -96,15 +96,13 @@ export function readGitBranch(projectRoot) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Read MCP server names from .mcp.json
|
|
100
|
-
* ~/.gsd/mcp.json (or $GSD_HOME/mcp.json).
|
|
99
|
+
* Read MCP server names from .mcp.json or .gsd/mcp.json.
|
|
101
100
|
* Returns array of server name strings.
|
|
102
101
|
*/
|
|
103
102
|
export function readMcpServerNames(projectRoot) {
|
|
104
103
|
const configPaths = [
|
|
105
104
|
join(projectRoot, ".mcp.json"),
|
|
106
105
|
join(projectRoot, ".gsd", "mcp.json"),
|
|
107
|
-
join(process.env.GSD_HOME || join(homedir(), ".gsd"), "mcp.json"),
|
|
108
106
|
];
|
|
109
107
|
const names = [];
|
|
110
108
|
const seen = new Set();
|
|
@@ -18,13 +18,28 @@ 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 } from "node:path";
|
|
22
|
-
import { clearWorktreeOriginalCwd, ensureWorktreeOriginalCwdFromPath, getActiveWorktreeName, getWorktreeOriginalCwd, setWorktreeOriginalCwd, } from "./worktree-session-state.js";
|
|
23
|
-
export { getActiveWorktreeName, getWorktreeOriginalCwd } from "./worktree-session-state.js";
|
|
21
|
+
import { join, sep } from "node:path";
|
|
24
22
|
/**
|
|
25
23
|
* Tracks the original project root so we can switch back.
|
|
26
24
|
* Set when we first chdir into a worktree, cleared on return.
|
|
27
25
|
*/
|
|
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
|
+
}
|
|
28
43
|
// ─── Shared completions and handler (used by both /worktree and /wt) ────────
|
|
29
44
|
function worktreeCompletions(prefix) {
|
|
30
45
|
const parts = prefix.trim().split(/\s+/);
|
|
@@ -96,7 +111,7 @@ async function worktreeHandler(args, ctx, pi, alias) {
|
|
|
96
111
|
return;
|
|
97
112
|
}
|
|
98
113
|
// create and switch both do the same thing: switch if exists, create if not
|
|
99
|
-
const mainBase =
|
|
114
|
+
const mainBase = originalCwd ?? basePath;
|
|
100
115
|
const existing = listWorktrees(mainBase);
|
|
101
116
|
if (existing.some(wt => wt.name === name)) {
|
|
102
117
|
await handleSwitch(basePath, name, ctx);
|
|
@@ -108,7 +123,7 @@ async function worktreeHandler(args, ctx, pi, alias) {
|
|
|
108
123
|
}
|
|
109
124
|
if (trimmed === "merge" || trimmed.startsWith("merge ")) {
|
|
110
125
|
const mergeArgs = trimmed.replace(/^merge\s*/, "").trim().split(/\s+/).filter(Boolean);
|
|
111
|
-
const mainBase =
|
|
126
|
+
const mainBase = originalCwd ?? basePath;
|
|
112
127
|
const activeWt = getActiveWorktreeName();
|
|
113
128
|
if (mergeArgs.length === 0) {
|
|
114
129
|
// Bare "/worktree merge" — only valid when inside a worktree
|
|
@@ -139,7 +154,7 @@ async function worktreeHandler(args, ctx, pi, alias) {
|
|
|
139
154
|
}
|
|
140
155
|
if (trimmed === "remove" || trimmed.startsWith("remove ")) {
|
|
141
156
|
const name = trimmed.replace(/^remove\s*/, "").trim();
|
|
142
|
-
const mainBase =
|
|
157
|
+
const mainBase = originalCwd ?? basePath;
|
|
143
158
|
if (name === "all") {
|
|
144
159
|
await handleRemoveAll(mainBase, ctx);
|
|
145
160
|
return;
|
|
@@ -156,7 +171,7 @@ async function worktreeHandler(args, ctx, pi, alias) {
|
|
|
156
171
|
ctx.ui.notify(`Usage: /${alias} ${trimmed}${trimmed === "list" || trimmed === "return" ? "" : " <name>"}`, "warning");
|
|
157
172
|
return;
|
|
158
173
|
}
|
|
159
|
-
const mainBase =
|
|
174
|
+
const mainBase = originalCwd ?? basePath;
|
|
160
175
|
const nameOnly = trimmed.split(/\s+/)[0];
|
|
161
176
|
if (trimmed !== nameOnly) {
|
|
162
177
|
ctx.ui.notify(`Unknown command. Did you mean /${alias} switch ${nameOnly}?`, "warning");
|
|
@@ -177,7 +192,14 @@ export function registerWorktreeCommand(pi) {
|
|
|
177
192
|
// Restore worktree state after /reload.
|
|
178
193
|
// The module-level originalCwd resets to null when extensions are re-loaded,
|
|
179
194
|
// but process.cwd() is still inside the worktree. Detect this and recover.
|
|
180
|
-
|
|
195
|
+
if (!originalCwd) {
|
|
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
|
+
}
|
|
181
203
|
pi.registerCommand("worktree", {
|
|
182
204
|
description: "Git worktrees (also /wt): /worktree <name> | list | merge | remove",
|
|
183
205
|
getArgumentCompletions: worktreeCompletions,
|
|
@@ -238,7 +260,7 @@ async function handleCreate(basePath, name, ctx) {
|
|
|
238
260
|
// before createWorktree so the new worktree forks from committed HEAD)
|
|
239
261
|
const commitMsg = autoCommitCurrentBranch(basePath, "worktree-switch", name);
|
|
240
262
|
// Create from the main tree, not from inside another worktree
|
|
241
|
-
const mainBase =
|
|
263
|
+
const mainBase = originalCwd ?? basePath;
|
|
242
264
|
const info = createWorktree(mainBase, name);
|
|
243
265
|
// Run user-configured post-create hook (#597) — e.g. copy .env, symlink assets
|
|
244
266
|
const hookError = runWorktreePostCreateHook(mainBase, info.path);
|
|
@@ -246,8 +268,8 @@ async function handleCreate(basePath, name, ctx) {
|
|
|
246
268
|
ctx.ui.notify(hookError, "warning");
|
|
247
269
|
}
|
|
248
270
|
// Track original cwd before switching
|
|
249
|
-
if (!
|
|
250
|
-
|
|
271
|
+
if (!originalCwd)
|
|
272
|
+
originalCwd = basePath;
|
|
251
273
|
const prevCwd = process.cwd();
|
|
252
274
|
process.chdir(info.path);
|
|
253
275
|
nudgeGitBranchCache(prevCwd);
|
|
@@ -297,7 +319,7 @@ async function handleCreate(basePath, name, ctx) {
|
|
|
297
319
|
}
|
|
298
320
|
async function handleSwitch(basePath, name, ctx) {
|
|
299
321
|
try {
|
|
300
|
-
const mainBase =
|
|
322
|
+
const mainBase = originalCwd ?? basePath;
|
|
301
323
|
const wtPath = worktreePath(mainBase, name);
|
|
302
324
|
if (!existsSync(wtPath)) {
|
|
303
325
|
ctx.ui.notify(`Worktree "${name}" not found. Run /worktree list to see available worktrees.`, "warning");
|
|
@@ -306,8 +328,8 @@ async function handleSwitch(basePath, name, ctx) {
|
|
|
306
328
|
// Auto-commit dirty files before leaving current workspace
|
|
307
329
|
const commitMsg = autoCommitCurrentBranch(basePath, "worktree-switch", name);
|
|
308
330
|
// Track original cwd before switching
|
|
309
|
-
if (!
|
|
310
|
-
|
|
331
|
+
if (!originalCwd)
|
|
332
|
+
originalCwd = basePath;
|
|
311
333
|
const prevCwd = process.cwd();
|
|
312
334
|
process.chdir(wtPath);
|
|
313
335
|
nudgeGitBranchCache(prevCwd);
|
|
@@ -330,7 +352,6 @@ async function handleSwitch(basePath, name, ctx) {
|
|
|
330
352
|
}
|
|
331
353
|
}
|
|
332
354
|
async function handleReturn(ctx) {
|
|
333
|
-
const originalCwd = getWorktreeOriginalCwd();
|
|
334
355
|
if (!originalCwd) {
|
|
335
356
|
ctx.ui.notify("Already in the main project tree.", "info");
|
|
336
357
|
return;
|
|
@@ -338,7 +359,7 @@ async function handleReturn(ctx) {
|
|
|
338
359
|
// Auto-commit dirty files before leaving worktree
|
|
339
360
|
const commitMsg = autoCommitCurrentBranch(process.cwd(), "worktree-return", "worktree");
|
|
340
361
|
const returnTo = originalCwd;
|
|
341
|
-
|
|
362
|
+
originalCwd = null;
|
|
342
363
|
const prevCwd = process.cwd();
|
|
343
364
|
process.chdir(returnTo);
|
|
344
365
|
nudgeGitBranchCache(prevCwd);
|
|
@@ -388,7 +409,7 @@ const CLR = {
|
|
|
388
409
|
};
|
|
389
410
|
async function handleList(basePath, ctx) {
|
|
390
411
|
try {
|
|
391
|
-
const mainBase =
|
|
412
|
+
const mainBase = originalCwd ?? basePath;
|
|
392
413
|
const worktrees = listWorktrees(mainBase);
|
|
393
414
|
if (worktrees.length === 0) {
|
|
394
415
|
ctx.ui.notify("No GSD worktrees found. Create one with /worktree <name>.", "info");
|
|
@@ -431,7 +452,6 @@ async function handleList(basePath, ctx) {
|
|
|
431
452
|
}
|
|
432
453
|
lines.push("");
|
|
433
454
|
}
|
|
434
|
-
const originalCwd = getWorktreeOriginalCwd();
|
|
435
455
|
if (originalCwd) {
|
|
436
456
|
lines.push(` ${CLR.label("main tree")} ${CLR.path(originalCwd)}`);
|
|
437
457
|
}
|
|
@@ -519,11 +539,11 @@ async function handleMerge(basePath, name, ctx, pi, targetBranch) {
|
|
|
519
539
|
}
|
|
520
540
|
// Switch to the main tree before merging.
|
|
521
541
|
// Must be on the main branch to run git merge --squash.
|
|
522
|
-
if (
|
|
542
|
+
if (originalCwd) {
|
|
523
543
|
const prevCwd = process.cwd();
|
|
524
544
|
process.chdir(basePath);
|
|
525
545
|
nudgeGitBranchCache(prevCwd);
|
|
526
|
-
|
|
546
|
+
originalCwd = null;
|
|
527
547
|
}
|
|
528
548
|
// --- Deterministic merge path (preferred) ---
|
|
529
549
|
// Try a direct squash-merge first. Only fall back to LLM on conflict.
|
|
@@ -600,7 +620,7 @@ async function handleMerge(basePath, name, ctx, pi, targetBranch) {
|
|
|
600
620
|
}
|
|
601
621
|
async function handleRemove(basePath, name, ctx) {
|
|
602
622
|
try {
|
|
603
|
-
const mainBase =
|
|
623
|
+
const mainBase = originalCwd ?? basePath;
|
|
604
624
|
// Validate the worktree exists before attempting removal
|
|
605
625
|
const worktrees = listWorktrees(mainBase);
|
|
606
626
|
const wt = worktrees.find(w => w.name === name);
|
|
@@ -621,9 +641,9 @@ async function handleRemove(basePath, name, ctx) {
|
|
|
621
641
|
const prevCwd = process.cwd();
|
|
622
642
|
removeWorktree(mainBase, name, { deleteBranch: true });
|
|
623
643
|
// If we were in that worktree, removeWorktree chdir'd us out — clear tracking
|
|
624
|
-
if (
|
|
644
|
+
if (originalCwd && process.cwd() !== prevCwd) {
|
|
625
645
|
nudgeGitBranchCache(prevCwd);
|
|
626
|
-
|
|
646
|
+
originalCwd = null;
|
|
627
647
|
}
|
|
628
648
|
ctx.ui.notify(`${CLR.ok("✓")} Worktree ${CLR.name(name)} removed ${CLR.muted("(branch deleted)")}.`, "info");
|
|
629
649
|
}
|
|
@@ -634,7 +654,7 @@ async function handleRemove(basePath, name, ctx) {
|
|
|
634
654
|
}
|
|
635
655
|
async function handleRemoveAll(basePath, ctx) {
|
|
636
656
|
try {
|
|
637
|
-
const mainBase =
|
|
657
|
+
const mainBase = originalCwd ?? basePath;
|
|
638
658
|
const worktrees = listWorktrees(mainBase);
|
|
639
659
|
if (worktrees.length === 0) {
|
|
640
660
|
ctx.ui.notify("No worktrees to remove.", "info");
|
|
@@ -664,9 +684,9 @@ async function handleRemoveAll(basePath, ctx) {
|
|
|
664
684
|
}
|
|
665
685
|
}
|
|
666
686
|
// If we were in a worktree that got removed, clear tracking
|
|
667
|
-
if (
|
|
687
|
+
if (originalCwd && process.cwd() !== prevCwd) {
|
|
668
688
|
nudgeGitBranchCache(prevCwd);
|
|
669
|
-
|
|
689
|
+
originalCwd = null;
|
|
670
690
|
}
|
|
671
691
|
const lines = [];
|
|
672
692
|
if (removed.length > 0)
|
|
@@ -2,8 +2,7 @@
|
|
|
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)
|
|
6
|
-
* $GSD_HOME/mcp.json) using the @modelcontextprotocol/sdk Client
|
|
5
|
+
* (.mcp.json, .gsd/mcp.json) using the @modelcontextprotocol/sdk Client
|
|
7
6
|
* directly — no external CLI dependency required.
|
|
8
7
|
*
|
|
9
8
|
* Three tools:
|
|
@@ -18,7 +17,6 @@ import { Client } from "@modelcontextprotocol/sdk/client";
|
|
|
18
17
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
19
18
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
20
19
|
import { readFileSync, existsSync } from "node:fs";
|
|
21
|
-
import { homedir } from "node:os";
|
|
22
20
|
import { join } from "node:path";
|
|
23
21
|
import { buildHttpTransportOpts } from "./auth.js";
|
|
24
22
|
// ─── Connection Manager ───────────────────────────────────────────────────────
|
|
@@ -63,7 +61,6 @@ function readConfigs() {
|
|
|
63
61
|
const configPaths = [
|
|
64
62
|
join(process.cwd(), ".mcp.json"),
|
|
65
63
|
join(process.cwd(), ".gsd", "mcp.json"),
|
|
66
|
-
join(process.env.GSD_HOME || join(homedir(), ".gsd"), "mcp.json"),
|
|
67
64
|
];
|
|
68
65
|
for (const configPath of configPaths) {
|
|
69
66
|
try {
|
|
@@ -261,7 +258,7 @@ async function closeAll() {
|
|
|
261
258
|
// ─── Formatters ───────────────────────────────────────────────────────────────
|
|
262
259
|
function formatServerList(servers) {
|
|
263
260
|
if (servers.length === 0)
|
|
264
|
-
return "No MCP servers configured. Add servers to .mcp.json
|
|
261
|
+
return "No MCP servers configured. Add servers to .mcp.json or .gsd/mcp.json.";
|
|
265
262
|
const lines = [`${servers.length} MCP servers configured:\n`];
|
|
266
263
|
for (const s of servers) {
|
|
267
264
|
const connected = connections.has(s.name) ? "✓" : "○";
|
|
@@ -309,7 +306,7 @@ export default function (pi) {
|
|
|
309
306
|
pi.registerTool({
|
|
310
307
|
name: "mcp_servers",
|
|
311
308
|
label: "MCP Servers",
|
|
312
|
-
description: "List all available MCP servers configured in project files (.mcp.json, .gsd/mcp.json)
|
|
309
|
+
description: "List all available MCP servers configured in project files (.mcp.json, .gsd/mcp.json). " +
|
|
313
310
|
"Shows server names, transport type, and connection status. Use mcp_discover to get full tool schemas for a server.",
|
|
314
311
|
promptSnippet: "List available MCP servers from project configuration",
|
|
315
312
|
promptGuidelines: [
|
|
@@ -193,35 +193,38 @@ 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
|
-
"-
|
|
196
|
+
"- `~/.gsd/agent/docs/extending-pi/01-what-are-extensions.md` — capabilities overview",
|
|
197
|
+
"- `~/.gsd/agent/docs/extending-pi/03-getting-started.md` — minimal extension, hot reload",
|
|
198
|
+
"- `~/.gsd/agent/docs/extending-pi/08-extensioncontext-what-you-can-access.md` — ExtensionContext API",
|
|
199
|
+
"- `~/.gsd/agent/docs/extending-pi/09-extensionapi-what-you-can-do.md` — ExtensionAPI: registration, messaging",
|
|
200
|
+
"- `~/.gsd/agent/docs/extending-pi/22-key-rules-gotchas.md` — must-read rules before shipping",
|
|
200
201
|
];
|
|
201
202
|
if (uiSelected.includes("custom component")) {
|
|
202
|
-
docHints.push("-
|
|
203
|
-
docHints.push("-
|
|
204
|
-
docHints.push("-
|
|
205
|
-
docHints.push("-
|
|
206
|
-
docHints.push("-
|
|
203
|
+
docHints.push("- `~/.gsd/agent/docs/extending-pi/12-custom-ui-visual-components.md` — dialogs, widgets, overlays");
|
|
204
|
+
docHints.push("- `~/.gsd/agent/docs/pi-ui-tui/06-ctx-ui-custom-full-custom-components.md` — ctx.ui.custom() API");
|
|
205
|
+
docHints.push("- `~/.gsd/agent/docs/pi-ui-tui/07-built-in-components-the-building-blocks.md` — Text, Box, SelectList");
|
|
206
|
+
docHints.push("- `~/.gsd/agent/docs/pi-ui-tui/09-keyboard-input-how-to-handle-keys.md` — Key, matchesKey");
|
|
207
|
+
docHints.push("- `~/.gsd/agent/docs/pi-ui-tui/10-line-width-the-cardinal-rule.md` — truncation, width rules");
|
|
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");
|
|
207
210
|
}
|
|
208
211
|
else if (uiSelected.includes("Dialogs")) {
|
|
209
|
-
docHints.push("-
|
|
212
|
+
docHints.push("- `~/.gsd/agent/docs/pi-ui-tui/04-built-in-dialog-methods.md` — select, confirm, input, editor");
|
|
210
213
|
}
|
|
211
214
|
else if (uiSelected.includes("Status")) {
|
|
212
|
-
docHints.push("-
|
|
215
|
+
docHints.push("- `~/.gsd/agent/docs/pi-ui-tui/05-persistent-ui-elements.md` — status, widgets, footer, header");
|
|
213
216
|
}
|
|
214
217
|
if (uiSelected.includes("tool") || result.answers["purpose"]) {
|
|
215
|
-
docHints.push("-
|
|
218
|
+
docHints.push("- `~/.gsd/agent/docs/extending-pi/14-custom-rendering-controlling-what-the-user-sees.md` — renderCall / renderResult");
|
|
216
219
|
}
|
|
217
220
|
if (eventsSelected && !eventsSelected.includes("standalone")) {
|
|
218
|
-
docHints.push("-
|
|
221
|
+
docHints.push("- `~/.gsd/agent/docs/extending-pi/07-events-the-nervous-system.md` — all events reference");
|
|
219
222
|
}
|
|
220
223
|
if (eventsSelected.includes("context / prompt")) {
|
|
221
|
-
docHints.push("-
|
|
224
|
+
docHints.push("- `~/.gsd/agent/docs/extending-pi/15-system-prompt-modification.md` — system prompt hooks");
|
|
222
225
|
}
|
|
223
226
|
if (persistenceSelected.includes("session")) {
|
|
224
|
-
docHints.push("-
|
|
227
|
+
docHints.push("- `~/.gsd/agent/docs/extending-pi/13-state-management-persistence.md` — pi.appendEntry, session state");
|
|
225
228
|
}
|
|
226
229
|
const prompt = `Create a new pi extension based on this description:
|
|
227
230
|
|
|
@@ -235,30 +238,13 @@ ${docHints.join("\n")}
|
|
|
235
238
|
|
|
236
239
|
## Output
|
|
237
240
|
|
|
238
|
-
Write the complete implementation as a
|
|
241
|
+
Write the complete implementation as a single self-contained extension file:
|
|
239
242
|
|
|
240
|
-
\`~/.gsd/agent/extensions/<kebab-case-name
|
|
241
|
-
\`~/.gsd/agent/extensions/<kebab-case-name>/extension-manifest.json\`
|
|
243
|
+
\`~/.gsd/agent/extensions/<kebab-case-name>.ts\`
|
|
242
244
|
|
|
243
|
-
|
|
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
|
-
\`\`\`
|
|
245
|
+
Then register it in the main extensions index:
|
|
260
246
|
|
|
261
|
-
|
|
247
|
+
\`~/.gsd/agent/extensions/index.ts\` — import and call the new extension's default export alongside existing ones
|
|
262
248
|
|
|
263
249
|
## Rules you must follow exactly
|
|
264
250
|
|
|
@@ -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 `@mariozechner/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 `@mariozechner/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
|
+
| `@mariozechner/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
|
+
| `@mariozechner/pi-ai` | `StringEnum` (required for string enums), `Type` re-export |
|
|
40
|
+
| `@mariozechner/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,9 +65,6 @@ 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
|
|
71
68
|
**Gotchas:** key-rules-gotchas.md
|
|
72
69
|
</reference_index>
|
|
73
70
|
|
|
@@ -81,7 +78,6 @@ All domain knowledge in `references/`:
|
|
|
81
78
|
|
|
82
79
|
<success_criteria>
|
|
83
80
|
Extension is complete when:
|
|
84
|
-
- `extension-manifest.json` exists with accurate `provides` listing all registered tools/commands/hooks/shortcuts
|
|
85
81
|
- TypeScript compiles without errors (jiti handles this at runtime)
|
|
86
82
|
- Extension loads on GSD startup or `/reload` without errors
|
|
87
83
|
- Tools appear in the LLM's system prompt and are callable
|