@herbertgao/pi-extensions 2026.9.17 → 2026.9.19
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 +31 -33
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/node_modules/@herbertgao/pi-bark/package.json +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/working-message.ts +21 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +15 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/index.ts +43 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +7 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +75 -75
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/package.json +7 -7
- package/node_modules/@herbertgao/resume-from/package.json +4 -2
- package/node_modules/@herbertgao/sol-pi/package.json +6 -6
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +99 -99
- package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
- package/node_modules/@tifan/pi-handoff/package.json +1 -1
- package/node_modules/@tifan/pi-handoff/src/index.ts +56 -26
- package/node_modules/@tifan/pi-mermaid-open/package.json +1 -1
- package/node_modules/@tifan/pi-preferred-thinking/package.json +1 -1
- package/node_modules/@tifan/pi-recap/package.json +1 -1
- package/node_modules/@tifan/pi-rename/package.json +1 -1
- package/node_modules/pi-antigravity/README.md +29 -6
- package/node_modules/pi-antigravity/package.json +14 -9
- package/node_modules/pi-antigravity/src/auth/accounts.ts +327 -0
- package/node_modules/pi-antigravity/src/auth/index.ts +9 -0
- package/node_modules/pi-antigravity/src/client/client.ts +1 -1
- package/node_modules/pi-antigravity/src/image/image.ts +4 -4
- package/node_modules/pi-antigravity/src/index.ts +203 -13
- package/node_modules/pi-antigravity/src/search/index.ts +1 -0
- package/node_modules/pi-antigravity/src/search/search.ts +325 -0
- package/node_modules/pi-antigravity/src/stream/stream.ts +191 -14
- package/node_modules/pi-antigravity/src/types/enums.ts +45 -36
- package/node_modules/pi-antigravity/src/types/types.ts +5 -12
- package/node_modules/pi-antigravity/src/utils/http.ts +7 -2
- package/node_modules/pi-antigravity/src/utils/util.ts +31 -3
- package/node_modules/pi-lens/package.json +158 -158
- package/node_modules/pi-multi-account/package.json +2 -2
- package/node_modules/pi-typesafe/README.md +3 -1
- package/node_modules/pi-typesafe/dist/auth.d.ts +9 -5
- package/node_modules/pi-typesafe/dist/auth.js +7 -3
- package/node_modules/pi-typesafe/dist/backends.d.ts +33 -3
- package/node_modules/pi-typesafe/dist/backends.js +95 -1
- package/node_modules/pi-typesafe/dist/client.d.ts +5 -5
- package/node_modules/pi-typesafe/dist/client.js +12 -9
- package/node_modules/pi-typesafe/dist/credentials.d.ts +14 -8
- package/node_modules/pi-typesafe/dist/credentials.js +10 -7
- package/node_modules/pi-typesafe/dist/errors.d.ts +2 -2
- package/node_modules/pi-typesafe/dist/index.d.ts +2 -2
- package/node_modules/pi-typesafe/dist/index.js +1 -1
- package/node_modules/pi-typesafe/dist/login.d.ts +2 -2
- package/node_modules/pi-typesafe/dist/login.js +2 -2
- package/node_modules/pi-typesafe/package.json +6 -5
- package/node_modules/pi-web-access/CHANGELOG.md +72 -0
- package/node_modules/pi-web-access/README.md +34 -13
- package/node_modules/pi-web-access/chrome-cookies.ts +79 -25
- package/node_modules/pi-web-access/curator-page.ts +5 -1
- package/node_modules/pi-web-access/curator-server.ts +2 -0
- package/node_modules/pi-web-access/dist/index.js +1337 -1009
- package/node_modules/pi-web-access/exa.ts +20 -52
- package/node_modules/pi-web-access/extract.ts +41 -4
- package/node_modules/pi-web-access/gemini-search.ts +12 -4
- package/node_modules/pi-web-access/index.ts +29 -37
- package/node_modules/pi-web-access/openai-search.ts +35 -7
- package/node_modules/pi-web-access/package.json +8 -7
- package/node_modules/pi-web-access/page-query.ts +2 -2
- package/node_modules/pi-web-access/query-rewrite.ts +2 -3
- package/node_modules/pi-web-access/ssrf-protection.ts +27 -10
- package/node_modules/pi-web-access/storage.ts +48 -77
- package/node_modules/pi-web-access/summary-model-scope.ts +6 -77
- package/node_modules/pi-web-access/summary-review.ts +3 -4
- package/node_modules/pi-web-access/tavily.ts +67 -20
- package/node_modules/pi-web-access/tool-activation.ts +53 -33
- package/node_modules/pi-web-access/utils.ts +1 -1
- package/node_modules/pi-web-access/you.ts +164 -0
- package/node_modules/pi-web-access/zai.ts +161 -0
- package/node_modules/remote-pi/package.json +5 -1
- package/package.json +19 -31
- package/node_modules/pi-mcp-adapter/CHANGELOG.md +0 -1013
- package/node_modules/pi-mcp-adapter/LICENSE +0 -21
- package/node_modules/pi-mcp-adapter/OAUTH.md +0 -369
- package/node_modules/pi-mcp-adapter/README.md +0 -1021
- package/node_modules/pi-mcp-adapter/abort.ts +0 -34
- package/node_modules/pi-mcp-adapter/agent-dir.ts +0 -68
- package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +0 -416
- package/node_modules/pi-mcp-adapter/agent-plugin-provenance.ts +0 -36
- package/node_modules/pi-mcp-adapter/app-bridge.bundle.js +0 -67
- package/node_modules/pi-mcp-adapter/banner.png +0 -0
- package/node_modules/pi-mcp-adapter/bearer-command-resolver.ts +0 -193
- package/node_modules/pi-mcp-adapter/claude-plugin-loader.ts +0 -365
- package/node_modules/pi-mcp-adapter/cli.js +0 -454
- package/node_modules/pi-mcp-adapter/commands.ts +0 -861
- package/node_modules/pi-mcp-adapter/config.ts +0 -1565
- package/node_modules/pi-mcp-adapter/consent-manager.ts +0 -95
- package/node_modules/pi-mcp-adapter/direct-tool-surface.ts +0 -244
- package/node_modules/pi-mcp-adapter/direct-tools.ts +0 -428
- package/node_modules/pi-mcp-adapter/dist/abort.d.ts +0 -2
- package/node_modules/pi-mcp-adapter/dist/abort.js +0 -36
- package/node_modules/pi-mcp-adapter/dist/abort.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/agent-dir.d.ts +0 -10
- package/node_modules/pi-mcp-adapter/dist/agent-dir.js +0 -63
- package/node_modules/pi-mcp-adapter/dist/agent-dir.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.d.ts +0 -8
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js +0 -398
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.d.ts +0 -1
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js +0 -31
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.d.ts +0 -6
- package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js +0 -194
- package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.d.ts +0 -9
- package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js +0 -362
- package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/config.d.ts +0 -134
- package/node_modules/pi-mcp-adapter/dist/config.js +0 -1361
- package/node_modules/pi-mcp-adapter/dist/config.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/consent-manager.d.ts +0 -18
- package/node_modules/pi-mcp-adapter/dist/consent-manager.js +0 -88
- package/node_modules/pi-mcp-adapter/dist/consent-manager.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/elicitation-handler.d.ts +0 -17
- package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js +0 -316
- package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/errors.d.ts +0 -131
- package/node_modules/pi-mcp-adapter/dist/errors.js +0 -278
- package/node_modules/pi-mcp-adapter/dist/errors.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/http-ca.d.ts +0 -8
- package/node_modules/pi-mcp-adapter/dist/http-ca.js +0 -88
- package/node_modules/pi-mcp-adapter/dist/http-ca.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/jev-client.d.ts +0 -14
- package/node_modules/pi-mcp-adapter/dist/jev-client.js +0 -367
- package/node_modules/pi-mcp-adapter/dist/jev-client.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/jev-contracts.d.ts +0 -77
- package/node_modules/pi-mcp-adapter/dist/jev-contracts.js +0 -2
- package/node_modules/pi-mcp-adapter/dist/jev-contracts.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/jev-key-store.d.ts +0 -51
- package/node_modules/pi-mcp-adapter/dist/jev-key-store.js +0 -205
- package/node_modules/pi-mcp-adapter/dist/jev-key-store.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/json-schema-validator.d.ts +0 -2
- package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js +0 -68
- package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/lifecycle.d.ts +0 -56
- package/node_modules/pi-mcp-adapter/dist/lifecycle.js +0 -410
- package/node_modules/pi-mcp-adapter/dist/lifecycle.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/logger.d.ts +0 -51
- package/node_modules/pi-mcp-adapter/dist/logger.js +0 -131
- package/node_modules/pi-mcp-adapter/dist/logger.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.d.ts +0 -26
- package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js +0 -103
- package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.d.ts +0 -118
- package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js +0 -1097
- package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-auth.d.ts +0 -170
- package/node_modules/pi-mcp-adapter/dist/mcp-auth.js +0 -1142
- package/node_modules/pi-mcp-adapter/dist/mcp-auth.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.d.ts +0 -24
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +0 -203
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.d.ts +0 -53
- package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js +0 -441
- package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.d.ts +0 -148
- package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js +0 -689
- package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-probe.d.ts +0 -6
- package/node_modules/pi-mcp-adapter/dist/mcp-probe.js +0 -166
- package/node_modules/pi-mcp-adapter/dist/mcp-probe.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-tasks.d.ts +0 -102
- package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js +0 -369
- package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-trace.d.ts +0 -95
- package/node_modules/pi-mcp-adapter/dist/mcp-trace.js +0 -242
- package/node_modules/pi-mcp-adapter/dist/mcp-trace.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.d.ts +0 -19
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +0 -301
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/npx-resolver.d.ts +0 -6
- package/node_modules/pi-mcp-adapter/dist/npx-resolver.js +0 -505
- package/node_modules/pi-mcp-adapter/dist/npx-resolver.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.d.ts +0 -2
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js +0 -144
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/request-headers-command.d.ts +0 -10
- package/node_modules/pi-mcp-adapter/dist/request-headers-command.js +0 -312
- package/node_modules/pi-mcp-adapter/dist/request-headers-command.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/resource-tools.d.ts +0 -1
- package/node_modules/pi-mcp-adapter/dist/resource-tools.js +0 -15
- package/node_modules/pi-mcp-adapter/dist/resource-tools.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/runtime-owner.d.ts +0 -13
- package/node_modules/pi-mcp-adapter/dist/runtime-owner.js +0 -97
- package/node_modules/pi-mcp-adapter/dist/runtime-owner.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/sampling-handler.d.ts +0 -17
- package/node_modules/pi-mcp-adapter/dist/sampling-handler.js +0 -203
- package/node_modules/pi-mcp-adapter/dist/sampling-handler.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/secure-keyring.d.ts +0 -11
- package/node_modules/pi-mcp-adapter/dist/secure-keyring.js +0 -172
- package/node_modules/pi-mcp-adapter/dist/secure-keyring.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/server-manager.d.ts +0 -157
- package/node_modules/pi-mcp-adapter/dist/server-manager.js +0 -1745
- package/node_modules/pi-mcp-adapter/dist/server-manager.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/session-approvals.d.ts +0 -34
- package/node_modules/pi-mcp-adapter/dist/session-approvals.js +0 -140
- package/node_modules/pi-mcp-adapter/dist/session-approvals.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/session-recovery.d.ts +0 -26
- package/node_modules/pi-mcp-adapter/dist/session-recovery.js +0 -142
- package/node_modules/pi-mcp-adapter/dist/session-recovery.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/state.d.ts +0 -73
- package/node_modules/pi-mcp-adapter/dist/state.js +0 -2
- package/node_modules/pi-mcp-adapter/dist/state.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/types.d.ts +0 -642
- package/node_modules/pi-mcp-adapter/dist/types.js +0 -331
- package/node_modules/pi-mcp-adapter/dist/types.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.d.ts +0 -6
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -37
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.d.ts +0 -17
- package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js +0 -219
- package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.d.ts +0 -104
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js +0 -59
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.d.ts +0 -4
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js +0 -27
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.d.ts +0 -15
- package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js +0 -85
- package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js.map +0 -1
- package/node_modules/pi-mcp-adapter/dist/utils.d.ts +0 -41
- package/node_modules/pi-mcp-adapter/dist/utils.js +0 -417
- package/node_modules/pi-mcp-adapter/dist/utils.js.map +0 -1
- package/node_modules/pi-mcp-adapter/elicitation-handler.ts +0 -358
- package/node_modules/pi-mcp-adapter/error-signal.ts +0 -32
- package/node_modules/pi-mcp-adapter/errors.ts +0 -364
- package/node_modules/pi-mcp-adapter/examples/jev-accessibility-loop.mjs +0 -85
- package/node_modules/pi-mcp-adapter/examples/jev-semantic-filter.mjs +0 -34
- package/node_modules/pi-mcp-adapter/failure-backoff.ts +0 -23
- package/node_modules/pi-mcp-adapter/glimpse-ui.ts +0 -80
- package/node_modules/pi-mcp-adapter/host-html-template.ts +0 -515
- package/node_modules/pi-mcp-adapter/http-ca.ts +0 -84
- package/node_modules/pi-mcp-adapter/index.ts +0 -2106
- package/node_modules/pi-mcp-adapter/init.ts +0 -721
- package/node_modules/pi-mcp-adapter/jev-client.ts +0 -300
- package/node_modules/pi-mcp-adapter/jev-contracts.ts +0 -53
- package/node_modules/pi-mcp-adapter/jev-key-store.ts +0 -192
- package/node_modules/pi-mcp-adapter/json-schema-validator.ts +0 -83
- package/node_modules/pi-mcp-adapter/lazy-loader.ts +0 -7
- package/node_modules/pi-mcp-adapter/lifecycle.ts +0 -457
- package/node_modules/pi-mcp-adapter/logger.ts +0 -169
- package/node_modules/pi-mcp-adapter/mcp-auth-fetch.ts +0 -113
- package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +0 -1296
- package/node_modules/pi-mcp-adapter/mcp-auth.ts +0 -1287
- package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +0 -250
- package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +0 -534
- package/node_modules/pi-mcp-adapter/mcp-code.ts +0 -495
- package/node_modules/pi-mcp-adapter/mcp-install.ts +0 -60
- package/node_modules/pi-mcp-adapter/mcp-keyring-helper.cjs +0 -89
- package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +0 -819
- package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +0 -511
- package/node_modules/pi-mcp-adapter/mcp-panel-theme.ts +0 -104
- package/node_modules/pi-mcp-adapter/mcp-panel.ts +0 -1099
- package/node_modules/pi-mcp-adapter/mcp-probe.ts +0 -201
- package/node_modules/pi-mcp-adapter/mcp-references.ts +0 -373
- package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +0 -137
- package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +0 -747
- package/node_modules/pi-mcp-adapter/mcp-status.ts +0 -105
- package/node_modules/pi-mcp-adapter/mcp-tasks.ts +0 -467
- package/node_modules/pi-mcp-adapter/mcp-trace.ts +0 -306
- package/node_modules/pi-mcp-adapter/metadata-cache.ts +0 -362
- package/node_modules/pi-mcp-adapter/namespace-tools.ts +0 -334
- package/node_modules/pi-mcp-adapter/npx-resolver.ts +0 -543
- package/node_modules/pi-mcp-adapter/oauth-handler.ts +0 -30
- package/node_modules/pi-mcp-adapter/oauth.ts +0 -52
- package/node_modules/pi-mcp-adapter/onboarding-state.ts +0 -76
- package/node_modules/pi-mcp-adapter/package-mcp-loader.ts +0 -156
- package/node_modules/pi-mcp-adapter/package.json +0 -219
- package/node_modules/pi-mcp-adapter/panel-keys.ts +0 -53
- package/node_modules/pi-mcp-adapter/prompts.ts +0 -385
- package/node_modules/pi-mcp-adapter/proxy-modes.ts +0 -1735
- package/node_modules/pi-mcp-adapter/request-headers-command.ts +0 -333
- package/node_modules/pi-mcp-adapter/resource-tools.ts +0 -17
- package/node_modules/pi-mcp-adapter/runtime-owner.ts +0 -106
- package/node_modules/pi-mcp-adapter/sampling-handler.ts +0 -261
- package/node_modules/pi-mcp-adapter/sandbox-proxy-template.ts +0 -144
- package/node_modules/pi-mcp-adapter/search-ranking.ts +0 -309
- package/node_modules/pi-mcp-adapter/secure-keyring.ts +0 -170
- package/node_modules/pi-mcp-adapter/semantic-search.ts +0 -186
- package/node_modules/pi-mcp-adapter/server-manager.ts +0 -2088
- package/node_modules/pi-mcp-adapter/session-approvals.ts +0 -201
- package/node_modules/pi-mcp-adapter/session-recovery.ts +0 -158
- package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +0 -49
- package/node_modules/pi-mcp-adapter/state.ts +0 -71
- package/node_modules/pi-mcp-adapter/tool-approval.ts +0 -205
- package/node_modules/pi-mcp-adapter/tool-metadata.ts +0 -302
- package/node_modules/pi-mcp-adapter/tool-registrar.ts +0 -255
- package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +0 -573
- package/node_modules/pi-mcp-adapter/ts-shape.ts +0 -149
- package/node_modules/pi-mcp-adapter/types.ts +0 -1120
- package/node_modules/pi-mcp-adapter/ui-app-bridge-helpers.ts +0 -40
- package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +0 -266
- package/node_modules/pi-mcp-adapter/ui-server.ts +0 -993
- package/node_modules/pi-mcp-adapter/ui-session.ts +0 -624
- package/node_modules/pi-mcp-adapter/ui-stream-types.ts +0 -89
- package/node_modules/pi-mcp-adapter/ui-tool-visibility.ts +0 -25
- package/node_modules/pi-mcp-adapter/unix-socket-transport.ts +0 -85
- package/node_modules/pi-mcp-adapter/utils.ts +0 -464
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type {
|
|
3
|
-
GetPromptResult,
|
|
4
|
-
PromptMessage,
|
|
5
|
-
} from "@modelcontextprotocol/client";
|
|
6
|
-
import type { McpExtensionState } from "./state.ts";
|
|
7
|
-
import { isServerDisabled, type McpConfig, type PromptMetadata } from "./types.ts";
|
|
8
|
-
import { formatPromptCommandName } from "./types.ts";
|
|
9
|
-
import { isServerCacheValid, loadMetadataCache, reconstructPromptMetadata } from "./metadata-cache.ts";
|
|
10
|
-
import { logger } from "./logger.ts";
|
|
11
|
-
import { truncateAtWord } from "./utils.ts";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Resolve prompt metadata for slash-command registration at extension load
|
|
15
|
-
* time. Mirrors `resolveDirectTools`: reads the persistent metadata cache so
|
|
16
|
-
* commands are available before any server connects.
|
|
17
|
-
*/
|
|
18
|
-
export function resolveCachedPrompts(config: McpConfig): PromptMetadata[] {
|
|
19
|
-
const cache = loadMetadataCache();
|
|
20
|
-
if (!cache?.servers) return [];
|
|
21
|
-
|
|
22
|
-
const prefix = config.settings?.toolPrefix ?? "server";
|
|
23
|
-
const specs: PromptMetadata[] = [];
|
|
24
|
-
|
|
25
|
-
for (const [serverName, entry] of Object.entries(cache.servers)) {
|
|
26
|
-
const definition = config.mcpServers[serverName];
|
|
27
|
-
if (!definition || isServerDisabled(definition)) continue;
|
|
28
|
-
if (!entry?.prompts?.length || !isServerCacheValid(entry, definition)) continue;
|
|
29
|
-
specs.push(...reconstructPromptMetadata(serverName, entry.prompts, prefix, definition));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return specs;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Parse a slash-command argument string into positional and named MCP prompt
|
|
37
|
-
* arguments. Supports bash-style quoting so callers can pass values with
|
|
38
|
-
* spaces:
|
|
39
|
-
*
|
|
40
|
-
* /mcp__demo__brief today "important tasks"
|
|
41
|
-
* /mcp__demo__brief day=today topic="important tasks"
|
|
42
|
-
*/
|
|
43
|
-
export function parsePromptArgs(input: string): { positional: string[]; named: Record<string, string> } {
|
|
44
|
-
const positional: string[] = [];
|
|
45
|
-
const named: Record<string, string> = {};
|
|
46
|
-
|
|
47
|
-
const tokens = tokenizeArgs(input);
|
|
48
|
-
for (const token of tokens) {
|
|
49
|
-
const eq = findUnquotedEquals(token);
|
|
50
|
-
if (eq > 0) {
|
|
51
|
-
const key = token.slice(0, eq).trim();
|
|
52
|
-
const value = stripQuotes(token.slice(eq + 1).trim());
|
|
53
|
-
if (key) {
|
|
54
|
-
named[key] = value;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
positional.push(stripQuotes(token));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return { positional, named };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function tokenizeArgs(input: string): string[] {
|
|
65
|
-
const tokens: string[] = [];
|
|
66
|
-
let current = "";
|
|
67
|
-
let quote: '"' | "'" | null = null;
|
|
68
|
-
let escaped = false;
|
|
69
|
-
|
|
70
|
-
for (const char of input) {
|
|
71
|
-
if (escaped) {
|
|
72
|
-
current += char;
|
|
73
|
-
escaped = false;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (char === "\\" && quote !== "'") {
|
|
77
|
-
escaped = true;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (quote) {
|
|
81
|
-
current += char;
|
|
82
|
-
if (char === quote) quote = null;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
if (char === '"' || char === "'") {
|
|
86
|
-
quote = char;
|
|
87
|
-
current += char;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (/\s/.test(char)) {
|
|
91
|
-
if (current.length > 0) {
|
|
92
|
-
tokens.push(current);
|
|
93
|
-
current = "";
|
|
94
|
-
}
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
current += char;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (current.length > 0) tokens.push(current);
|
|
101
|
-
return tokens;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function findUnquotedEquals(token: string): number {
|
|
105
|
-
let quote: '"' | "'" | null = null;
|
|
106
|
-
for (let i = 0; i < token.length; i++) {
|
|
107
|
-
const ch = token[i];
|
|
108
|
-
if (quote) {
|
|
109
|
-
if (ch === quote) quote = null;
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
if (ch === '"' || ch === "'") quote = ch;
|
|
113
|
-
else if (ch === "=") return i;
|
|
114
|
-
}
|
|
115
|
-
return -1;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function stripQuotes(value: string): string {
|
|
119
|
-
if (value.length >= 2 && (value.startsWith('"') || value.startsWith("'")) && value.endsWith(value.charAt(0))) {
|
|
120
|
-
return value.slice(1, -1);
|
|
121
|
-
}
|
|
122
|
-
return value;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface ResolvedPromptArgs {
|
|
126
|
-
ok: boolean;
|
|
127
|
-
/** Present when `ok === true`. */
|
|
128
|
-
args?: Record<string, string>;
|
|
129
|
-
/** Present when `ok === false`. */
|
|
130
|
-
error?: string;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Map positional and named arguments onto the prompt's declared argument
|
|
135
|
-
* list. Named arguments win over positional when both target the same slot.
|
|
136
|
-
* Missing required arguments produce a helpful usage message that the
|
|
137
|
-
* command handler surfaces via `ctx.ui.notify`.
|
|
138
|
-
*/
|
|
139
|
-
export function resolvePromptArgs(
|
|
140
|
-
metadata: PromptMetadata,
|
|
141
|
-
parsed: { positional: string[]; named: Record<string, string> },
|
|
142
|
-
): ResolvedPromptArgs {
|
|
143
|
-
const args: Record<string, string> = {};
|
|
144
|
-
|
|
145
|
-
const declared = metadata.arguments;
|
|
146
|
-
let positionalIndex = 0;
|
|
147
|
-
for (const argDef of declared) {
|
|
148
|
-
const value = parsed.named[argDef.name] ?? parsed.positional[positionalIndex++];
|
|
149
|
-
if (value !== undefined && value !== "") {
|
|
150
|
-
args[argDef.name] = value;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Preserve named arguments the prompt did not declare so servers with
|
|
155
|
-
// permissive schemas still receive them. The MCP spec allows arbitrary
|
|
156
|
-
// string key/values in `prompts/get` params.arguments.
|
|
157
|
-
for (const [key, value] of Object.entries(parsed.named)) {
|
|
158
|
-
if (!(key in args)) args[key] = value;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const missing = declared.filter(a => a.required && (args[a.name] === undefined || args[a.name] === ""));
|
|
162
|
-
if (missing.length > 0) {
|
|
163
|
-
return { ok: false, error: buildUsageMessage(metadata, missing) };
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return { ok: true, args };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function buildUsageMessage(metadata: PromptMetadata, missing: PromptMetadata["arguments"]): string {
|
|
170
|
-
const usage = metadata.arguments
|
|
171
|
-
.map(a => (a.required ? `<${a.name}>` : `[${a.name}]`))
|
|
172
|
-
.join(" ");
|
|
173
|
-
const missingList = missing.map(a => a.name).join(", ");
|
|
174
|
-
return `Missing required argument${missing.length > 1 ? "s" : ""}: ${missingList}.\nUsage: /${metadata.commandName} ${usage}`.trim();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Flatten a `GetPromptResult` into a single string suitable for
|
|
179
|
-
* `pi.sendUserMessage`. MCP prompts can contain multiple messages with
|
|
180
|
-
* mixed roles; we preserve role attribution as inline markers so the model
|
|
181
|
-
* still sees the intended conversational shape without needing a
|
|
182
|
-
* multi-message replay API on the pi side.
|
|
183
|
-
*/
|
|
184
|
-
export function formatPromptResult(result: GetPromptResult): string {
|
|
185
|
-
const lines: string[] = [];
|
|
186
|
-
for (const message of result.messages) {
|
|
187
|
-
const text = extractMessageText(message);
|
|
188
|
-
if (!text) continue;
|
|
189
|
-
if (message.role === "user" && result.messages.length === 1) {
|
|
190
|
-
lines.push(text);
|
|
191
|
-
} else {
|
|
192
|
-
lines.push(`[${message.role}] ${text}`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return lines.join("\n\n").trim();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function extractMessageText(message: PromptMessage): string {
|
|
199
|
-
const content = message.content;
|
|
200
|
-
if (!content || typeof content !== "object") return "";
|
|
201
|
-
switch (content.type) {
|
|
202
|
-
case "text":
|
|
203
|
-
return content.text ?? "";
|
|
204
|
-
case "resource": {
|
|
205
|
-
const resource = content.resource;
|
|
206
|
-
if (!resource) return "";
|
|
207
|
-
if ("text" in resource && typeof resource.text === "string") {
|
|
208
|
-
return `[resource ${resource.uri}]\n${resource.text}`;
|
|
209
|
-
}
|
|
210
|
-
return `[resource ${resource.uri}]`;
|
|
211
|
-
}
|
|
212
|
-
case "resource_link":
|
|
213
|
-
return `[resource_link ${content.uri ?? ""}${content.name ? ` — ${content.name}` : ""}]`;
|
|
214
|
-
case "image":
|
|
215
|
-
return `[image ${content.mimeType ?? "unknown"}${content.data ? " (embedded)" : ""}]`;
|
|
216
|
-
case "audio":
|
|
217
|
-
return `[audio ${content.mimeType ?? "unknown"}]`;
|
|
218
|
-
default:
|
|
219
|
-
return "";
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Build the pi command definition for a single MCP prompt. Registered once
|
|
225
|
-
* per prompt at extension load time from the metadata cache; the same
|
|
226
|
-
* factory is reused by tests to invoke the handler without a running pi.
|
|
227
|
-
*/
|
|
228
|
-
export interface PromptRuntimeDependencies {
|
|
229
|
-
ensureState?: (ctx: ExtensionCommandContext) => Promise<McpExtensionState | null>;
|
|
230
|
-
lazyConnect?: (state: McpExtensionState, serverName: string, signal?: AbortSignal) => Promise<boolean>;
|
|
231
|
-
isStateCurrent?: (state: McpExtensionState) => boolean;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
let defaultRuntimePromise: Promise<typeof import("./init.ts")> | null = null;
|
|
235
|
-
function loadDefaultRuntime(): Promise<typeof import("./init.ts")> {
|
|
236
|
-
return defaultRuntimePromise ??= import("./init.ts").catch((error) => {
|
|
237
|
-
defaultRuntimePromise = null;
|
|
238
|
-
throw error;
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export function createPromptCommand(
|
|
243
|
-
pi: ExtensionAPI,
|
|
244
|
-
getState: () => McpExtensionState | null,
|
|
245
|
-
metadata: PromptMetadata,
|
|
246
|
-
runtime: PromptRuntimeDependencies = {},
|
|
247
|
-
) {
|
|
248
|
-
const description = buildCommandDescription(metadata);
|
|
249
|
-
|
|
250
|
-
return {
|
|
251
|
-
description,
|
|
252
|
-
handler: async (args: string, ctx: ExtensionCommandContext) => {
|
|
253
|
-
let state = getState();
|
|
254
|
-
if (!state && runtime.ensureState) {
|
|
255
|
-
try {
|
|
256
|
-
state = await runtime.ensureState(ctx);
|
|
257
|
-
} catch (error) {
|
|
258
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
259
|
-
if (ctx.hasUI) ctx.ui.notify(`MCP initialization failed: ${message}`, "error");
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
if (!state) {
|
|
264
|
-
if (ctx.hasUI) ctx.ui.notify("MCP not initialized", "error");
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const liveMetadata = findLivePromptMetadata(state, metadata.serverName, metadata.originalName);
|
|
269
|
-
if (state.promptMetadataLive?.has(metadata.serverName) && !liveMetadata) {
|
|
270
|
-
if (ctx.hasUI) {
|
|
271
|
-
ctx.ui.notify(
|
|
272
|
-
`MCP prompt "${metadata.originalName}" is no longer advertised by server "${metadata.serverName}". Run /mcp reconnect to refresh.`,
|
|
273
|
-
"error",
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
const live = liveMetadata ?? metadata;
|
|
279
|
-
const parsed = parsePromptArgs(args ?? "");
|
|
280
|
-
const resolved = resolvePromptArgs(live, parsed);
|
|
281
|
-
if (!resolved.ok) {
|
|
282
|
-
if (ctx.hasUI) ctx.ui.notify(resolved.error ?? "Invalid prompt arguments", "error");
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
const promptArgs = resolved.args ?? {};
|
|
286
|
-
|
|
287
|
-
if (!state.config.mcpServers[metadata.serverName]) {
|
|
288
|
-
if (ctx.hasUI) {
|
|
289
|
-
ctx.ui.notify(
|
|
290
|
-
`MCP prompt "${live.originalName}" is no longer configured. Run /mcp reconnect to refresh.`,
|
|
291
|
-
"error",
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const expectedState = state;
|
|
298
|
-
const isStateCurrent = () => runtime.isStateCurrent
|
|
299
|
-
? runtime.isStateCurrent(expectedState)
|
|
300
|
-
: getState() === expectedState;
|
|
301
|
-
const lazyConnect = runtime.lazyConnect ?? (await loadDefaultRuntime()).lazyConnect;
|
|
302
|
-
if (!isStateCurrent()) return;
|
|
303
|
-
const connected = await lazyConnect(expectedState, metadata.serverName, ctx.signal);
|
|
304
|
-
if (!isStateCurrent()) return;
|
|
305
|
-
if (!connected) {
|
|
306
|
-
if (ctx.hasUI) {
|
|
307
|
-
const conn = state.manager.getConnection(metadata.serverName);
|
|
308
|
-
const message = conn?.status === "needs-auth"
|
|
309
|
-
? `MCP server "${metadata.serverName}" needs authentication. Run /mcp-auth ${metadata.serverName}.`
|
|
310
|
-
: `MCP server "${metadata.serverName}" is not available. Run /mcp reconnect ${metadata.serverName}.`;
|
|
311
|
-
ctx.ui.notify(message, "error");
|
|
312
|
-
}
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const refreshed = findLivePromptMetadata(state, metadata.serverName, metadata.originalName);
|
|
317
|
-
if (state.promptMetadataLive?.has(metadata.serverName) && !refreshed) {
|
|
318
|
-
if (ctx.hasUI) {
|
|
319
|
-
ctx.ui.notify(
|
|
320
|
-
`MCP prompt "${metadata.originalName}" is no longer advertised by server "${metadata.serverName}". Run /mcp reconnect to refresh.`,
|
|
321
|
-
"error",
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
const dispatchMetadata = refreshed ?? live;
|
|
327
|
-
let result: GetPromptResult;
|
|
328
|
-
try {
|
|
329
|
-
result = await state.manager.getPrompt(
|
|
330
|
-
metadata.serverName,
|
|
331
|
-
dispatchMetadata.originalName,
|
|
332
|
-
Object.keys(promptArgs).length > 0 ? promptArgs : undefined,
|
|
333
|
-
ctx.signal,
|
|
334
|
-
);
|
|
335
|
-
} catch (error) {
|
|
336
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
337
|
-
logger.debug(`MCP prompt "${live.originalName}" on ${metadata.serverName} failed: ${message}`);
|
|
338
|
-
if (!isStateCurrent()) return;
|
|
339
|
-
if (ctx.hasUI) {
|
|
340
|
-
ctx.ui.notify(`MCP prompt "${live.originalName}" failed: ${message}`, "error");
|
|
341
|
-
}
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if (!isStateCurrent()) return;
|
|
346
|
-
const text = formatPromptResult(result);
|
|
347
|
-
if (!text) {
|
|
348
|
-
if (ctx.hasUI) {
|
|
349
|
-
ctx.ui.notify(`MCP prompt "${live.originalName}" returned no text content.`, "warning");
|
|
350
|
-
}
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
pi.sendUserMessage(text);
|
|
355
|
-
},
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function findLivePromptMetadata(
|
|
360
|
-
state: McpExtensionState,
|
|
361
|
-
serverName: string,
|
|
362
|
-
originalName: string,
|
|
363
|
-
): PromptMetadata | undefined {
|
|
364
|
-
return state.promptMetadata?.get(serverName)?.find(p => p.originalName === originalName);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
function buildCommandDescription(metadata: PromptMetadata): string {
|
|
368
|
-
const base = metadata.description || metadata.title || `MCP prompt from ${metadata.serverName}`;
|
|
369
|
-
return truncateAtWord(`MCP: ${base}`, 120) || `MCP prompt from ${metadata.serverName}`;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Public helper used by `/mcp prompts` to render the list of prompts known
|
|
374
|
-
* to the adapter, whether from a live connection or the metadata cache.
|
|
375
|
-
*/
|
|
376
|
-
export function listAllPromptMetadata(state: McpExtensionState): PromptMetadata[] {
|
|
377
|
-
const flat: PromptMetadata[] = [];
|
|
378
|
-
for (const list of state.promptMetadata?.values() ?? []) flat.push(...list);
|
|
379
|
-
flat.sort((a, b) => a.commandName.localeCompare(b.commandName));
|
|
380
|
-
return flat;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// Re-exported so index.ts can format cache-only prompt-command names without
|
|
384
|
-
// duplicating the namespace logic.
|
|
385
|
-
export { formatPromptCommandName };
|