@herbertgao/pi-extensions 2026.8.1 → 2026.8.3
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 +13 -3
- package/node_modules/@czottmann/pi-automode/README.md +16 -2
- package/node_modules/@czottmann/pi-automode/docs/GLOSSARY.md +35 -0
- package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +18 -9
- package/node_modules/@czottmann/pi-automode/docs/defaults.md +6 -2
- package/node_modules/@czottmann/pi-automode/examples/automode.local.json +6 -0
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +11 -7
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/config.ts +100 -0
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +32 -0
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +78 -3
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/hard-deny.ts +16 -4
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/paths.ts +23 -1
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/permissions.ts +22 -1
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/types.ts +18 -2
- package/node_modules/@czottmann/pi-automode/package.json +4 -4
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-audit.md +5 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-debt.md +5 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-gain.md +5 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-help.md +5 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-review.md +5 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail.md +5 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail-frontmatter.cjs +23 -0
- package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail.mjs +99 -0
- package/node_modules/@dietrichgebert/ponytail/.qoder/rules/ponytail.md +30 -0
- package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +16 -0
- package/node_modules/@dietrichgebert/ponytail/AGENTS.md +32 -0
- package/node_modules/@dietrichgebert/ponytail/LICENSE +21 -0
- package/node_modules/@dietrichgebert/ponytail/README.es.md +298 -0
- package/node_modules/@dietrichgebert/ponytail/README.ko.md +315 -0
- package/node_modules/@dietrichgebert/ponytail/README.md +351 -0
- package/node_modules/@dietrichgebert/ponytail/assets/benchmark-3model.svg +21 -0
- package/node_modules/@dietrichgebert/ponytail/assets/benchmark-agentic.svg +62 -0
- package/node_modules/@dietrichgebert/ponytail/assets/logo-dark.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/logo-dark.svg +115 -0
- package/node_modules/@dietrichgebert/ponytail/assets/logo-greenpt-dark.svg +27 -0
- package/node_modules/@dietrichgebert/ponytail/assets/logo-greenpt.svg +27 -0
- package/node_modules/@dietrichgebert/ponytail/assets/logo.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/social-preview.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner-es.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner-ko.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner.png +0 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/claude-codex-hooks.json +44 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/copilot-hooks.json +21 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +96 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-config.js +169 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-instructions.js +98 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-mode-tracker.js +130 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-runtime.js +85 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-statusline.ps1 +24 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-statusline.sh +18 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-subagent.js +77 -0
- package/node_modules/@dietrichgebert/ponytail/hooks/qoder-hooks.json +26 -0
- package/node_modules/@dietrichgebert/ponytail/package.json +47 -0
- package/node_modules/@dietrichgebert/ponytail/pi-extension/index.js +211 -0
- package/node_modules/@dietrichgebert/ponytail/pi-extension/package.json +8 -0
- package/node_modules/@dietrichgebert/ponytail/scripts/uninstall.js +60 -0
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail/SKILL.md +120 -0
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-audit/SKILL.md +41 -0
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-debt/SKILL.md +44 -0
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-gain/SKILL.md +50 -0
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-help/SKILL.md +71 -0
- package/node_modules/@dietrichgebert/ponytail/skills/ponytail-review/SKILL.md +57 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +6 -10
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -9
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.en.svg +101 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -17
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +15 -9
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/{utils/agent-summary.ts → feature/agent-summary/core.ts} +37 -35
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-summary.ts → agent-summary/index.ts} +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +24 -83
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference.ts → reference/index.ts} +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-autocomplete.ts → reference/subagent.ts} +19 -9
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-startup-header.ts → shell/startup-header.ts} +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{working-message.ts → shell/working-message.ts} +5 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +32 -28
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +452 -94
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +727 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +66 -776
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/{feature → renderer}/markdown-enhance.ts +134 -11
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/hover.ts +130 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-interaction.ts → mouse/interaction.ts} +90 -568
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/layout.ts +144 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +143 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +195 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ansi-utils.ts +56 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-renderer.ts +4 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/line-width-safety.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-display-utils.ts +12 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/write-execution.ts +1 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-grouping.ts → tool/grouping.ts} +27 -10
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-result.ts → tool/result.ts} +4 -13
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-refresh.ts +91 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +0 -27
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +1 -0
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +2 -2
- package/node_modules/@herbertgao/pi-stash/README.md +9 -9
- package/node_modules/@herbertgao/pi-stash/package.json +1 -1
- package/node_modules/@herbertgao/pi-stash/src/index.ts +2 -1
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +20 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +6 -2
- package/node_modules/@herbertgao/pi-subagents/package.json +3 -3
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +1 -0
- package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +3 -1
- package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +85 -11
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +61 -39
- package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +26 -35
- package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +15 -1
- package/node_modules/@herbertgao/pi-subagents/src/settings.ts +12 -0
- package/node_modules/@herbertgao/pi-subagents/src/types.ts +2 -0
- package/node_modules/@narumitw/pi-btw/LICENSE +21 -0
- package/node_modules/@narumitw/pi-btw/README.md +210 -0
- package/node_modules/@narumitw/pi-btw/package.json +53 -0
- package/node_modules/@narumitw/pi-btw/src/bring-to-main.ts +632 -0
- package/node_modules/@narumitw/pi-btw/src/btw.ts +996 -0
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +339 -0
- package/node_modules/@narumitw/pi-btw/src/index.ts +1 -0
- package/node_modules/@narumitw/pi-btw/src/menu.ts +296 -0
- package/node_modules/@narumitw/pi-btw/src/settings.ts +237 -0
- package/node_modules/@narumitw/pi-btw/src/side-thread.ts +238 -0
- package/node_modules/@narumitw/pi-btw/src/text.ts +10 -0
- package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +620 -0
- package/node_modules/@pi-plugins/fast-mode/LICENSE +21 -0
- package/node_modules/@pi-plugins/fast-mode/README.md +92 -0
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts +6 -0
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -0
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +2026 -0
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -0
- package/node_modules/@pi-plugins/fast-mode/package.json +73 -0
- package/node_modules/pi-mcp-adapter/CHANGELOG.md +78 -0
- package/node_modules/pi-mcp-adapter/README.md +80 -16
- package/node_modules/pi-mcp-adapter/agent-dir.ts +40 -0
- package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +377 -0
- package/node_modules/pi-mcp-adapter/commands.ts +21 -9
- package/node_modules/pi-mcp-adapter/config.ts +110 -49
- package/node_modules/pi-mcp-adapter/direct-tools.ts +40 -27
- package/node_modules/pi-mcp-adapter/elicitation-handler.ts +37 -36
- package/node_modules/pi-mcp-adapter/errors.ts +21 -17
- package/node_modules/pi-mcp-adapter/host-html-template.ts +13 -7
- package/node_modules/pi-mcp-adapter/index.ts +52 -17
- package/node_modules/pi-mcp-adapter/init.ts +9 -7
- package/node_modules/pi-mcp-adapter/json-schema-validator.ts +2 -2
- package/node_modules/pi-mcp-adapter/lifecycle.ts +8 -8
- package/node_modules/pi-mcp-adapter/logger.ts +1 -1
- package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +122 -25
- package/node_modules/pi-mcp-adapter/mcp-auth.ts +120 -2
- package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +138 -61
- package/node_modules/pi-mcp-adapter/mcp-code.ts +13 -11
- package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +62 -17
- package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +15 -11
- package/node_modules/pi-mcp-adapter/mcp-panel.ts +34 -15
- package/node_modules/pi-mcp-adapter/mcp-probe.ts +131 -34
- package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +2 -2
- package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +7 -4
- package/node_modules/pi-mcp-adapter/mcp-trace.ts +59 -64
- package/node_modules/pi-mcp-adapter/metadata-cache.ts +34 -26
- package/node_modules/pi-mcp-adapter/npx-resolver.ts +6 -4
- package/node_modules/pi-mcp-adapter/oauth-handler.ts +1 -1
- package/node_modules/pi-mcp-adapter/oauth.ts +48 -0
- package/node_modules/pi-mcp-adapter/onboarding-state.ts +19 -11
- package/node_modules/pi-mcp-adapter/package.json +20 -9
- package/node_modules/pi-mcp-adapter/panel-keys.ts +20 -4
- package/node_modules/pi-mcp-adapter/prompts.ts +2 -2
- package/node_modules/pi-mcp-adapter/proxy-modes.ts +56 -21
- package/node_modules/pi-mcp-adapter/sampling-handler.ts +22 -15
- package/node_modules/pi-mcp-adapter/search-ranking.ts +2 -1
- package/node_modules/pi-mcp-adapter/server-manager.ts +165 -113
- package/node_modules/pi-mcp-adapter/session-recovery.ts +11 -12
- package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +3 -3
- package/node_modules/pi-mcp-adapter/state.ts +3 -1
- package/node_modules/pi-mcp-adapter/tool-approval.ts +67 -4
- package/node_modules/pi-mcp-adapter/tool-metadata.ts +6 -5
- package/node_modules/pi-mcp-adapter/tool-registrar.ts +187 -3
- package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +14 -2
- package/node_modules/pi-mcp-adapter/ts-shape.ts +9 -2
- package/node_modules/pi-mcp-adapter/types.ts +111 -22
- package/node_modules/pi-mcp-adapter/ui-app-bridge-helpers.ts +40 -0
- package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +28 -19
- package/node_modules/pi-mcp-adapter/ui-server.ts +90 -58
- package/node_modules/pi-mcp-adapter/ui-session.ts +16 -14
- package/node_modules/pi-mcp-adapter/unix-socket-transport.ts +4 -4
- package/node_modules/pi-mcp-adapter/utils.ts +23 -9
- package/node_modules/pi-web-access/CHANGELOG.md +45 -0
- package/node_modules/pi-web-access/README.md +104 -29
- package/node_modules/pi-web-access/bocha.ts +221 -0
- package/node_modules/pi-web-access/curator-page.ts +113 -12
- package/node_modules/pi-web-access/curator-server.ts +56 -20
- package/node_modules/pi-web-access/datalab-pdf-extract.ts +568 -0
- package/node_modules/pi-web-access/duckduckgo.ts +123 -0
- package/node_modules/pi-web-access/extract.ts +288 -143
- package/node_modules/pi-web-access/feature-config.ts +29 -0
- package/node_modules/pi-web-access/gemini-api.ts +4 -0
- package/node_modules/pi-web-access/gemini-search.ts +45 -12
- package/node_modules/pi-web-access/gemini-web.ts +68 -3
- package/node_modules/pi-web-access/index.ts +160 -71
- package/node_modules/pi-web-access/jina-search.ts +284 -0
- package/node_modules/pi-web-access/kagi.ts +12 -12
- package/node_modules/pi-web-access/openai-search.ts +12 -2
- package/node_modules/pi-web-access/package.json +4 -3
- package/node_modules/pi-web-access/pdf-extract.ts +327 -228
- package/node_modules/pi-web-access/storage.ts +440 -2
- package/node_modules/pi-web-access/summary-model-scope.ts +1 -1
- package/node_modules/pi-web-access/summary-review.ts +4 -2
- package/node_modules/pi-web-access/video-extract.ts +10 -8
- package/node_modules/pi-web-access/xai-search.ts +12 -2
- package/node_modules/pi-web-access/youtube-extract.ts +2 -1
- package/node_modules/remote-pi/LICENSE +21 -0
- package/node_modules/remote-pi/README.md +675 -0
- package/node_modules/remote-pi/dist/actions/handlers.d.ts +122 -0
- package/node_modules/remote-pi/dist/actions/handlers.js +160 -0
- package/node_modules/remote-pi/dist/actions/handlers.js.map +1 -0
- package/node_modules/remote-pi/dist/actions/registry.d.ts +39 -0
- package/node_modules/remote-pi/dist/actions/registry.js +58 -0
- package/node_modules/remote-pi/dist/actions/registry.js.map +1 -0
- package/node_modules/remote-pi/dist/bin/supervisord.d.ts +2 -0
- package/node_modules/remote-pi/dist/bin/supervisord.js +86 -0
- package/node_modules/remote-pi/dist/bin/supervisord.js.map +1 -0
- package/node_modules/remote-pi/dist/commands/builtin_mirror.d.ts +58 -0
- package/node_modules/remote-pi/dist/commands/builtin_mirror.js +71 -0
- package/node_modules/remote-pi/dist/commands/builtin_mirror.js.map +1 -0
- package/node_modules/remote-pi/dist/commands/list_commands.d.ts +60 -0
- package/node_modules/remote-pi/dist/commands/list_commands.js +73 -0
- package/node_modules/remote-pi/dist/commands/list_commands.js.map +1 -0
- package/node_modules/remote-pi/dist/config.d.ts +62 -0
- package/node_modules/remote-pi/dist/config.js +115 -0
- package/node_modules/remote-pi/dist/config.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/client.d.ts +20 -0
- package/node_modules/remote-pi/dist/daemon/client.js +131 -0
- package/node_modules/remote-pi/dist/daemon/client.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/control_protocol.d.ts +176 -0
- package/node_modules/remote-pi/dist/daemon/control_protocol.js +63 -0
- package/node_modules/remote-pi/dist/daemon/control_protocol.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/cron_log.d.ts +45 -0
- package/node_modules/remote-pi/dist/daemon/cron_log.js +72 -0
- package/node_modules/remote-pi/dist/daemon/cron_log.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/cron_registry.d.ts +80 -0
- package/node_modules/remote-pi/dist/daemon/cron_registry.js +194 -0
- package/node_modules/remote-pi/dist/daemon/cron_registry.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/id.d.ts +24 -0
- package/node_modules/remote-pi/dist/daemon/id.js +36 -0
- package/node_modules/remote-pi/dist/daemon/id.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/install.d.ts +170 -0
- package/node_modules/remote-pi/dist/daemon/install.js +547 -0
- package/node_modules/remote-pi/dist/daemon/install.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/registry.d.ts +63 -0
- package/node_modules/remote-pi/dist/daemon/registry.js +153 -0
- package/node_modules/remote-pi/dist/daemon/registry.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/rpc_child.d.ts +194 -0
- package/node_modules/remote-pi/dist/daemon/rpc_child.js +389 -0
- package/node_modules/remote-pi/dist/daemon/rpc_child.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/supervisor.d.ts +93 -0
- package/node_modules/remote-pi/dist/daemon/supervisor.js +596 -0
- package/node_modules/remote-pi/dist/daemon/supervisor.js.map +1 -0
- package/node_modules/remote-pi/dist/extension_ui_bridge.d.ts +26 -0
- package/node_modules/remote-pi/dist/extension_ui_bridge.js +341 -0
- package/node_modules/remote-pi/dist/extension_ui_bridge.js.map +1 -0
- package/node_modules/remote-pi/dist/index.d.ts +213 -0
- package/node_modules/remote-pi/dist/index.js +4996 -0
- package/node_modules/remote-pi/dist/index.js.map +1 -0
- package/node_modules/remote-pi/dist/mcp/mesh_result.d.ts +10 -0
- package/node_modules/remote-pi/dist/mcp/mesh_result.js +42 -0
- package/node_modules/remote-pi/dist/mcp/mesh_result.js.map +1 -0
- package/node_modules/remote-pi/dist/mcp/mesh_server.d.ts +16 -0
- package/node_modules/remote-pi/dist/mcp/mesh_server.js +327 -0
- package/node_modules/remote-pi/dist/mcp/mesh_server.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/canonical.d.ts +30 -0
- package/node_modules/remote-pi/dist/mesh/canonical.js +61 -0
- package/node_modules/remote-pi/dist/mesh/canonical.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/client.d.ts +18 -0
- package/node_modules/remote-pi/dist/mesh/client.js +125 -0
- package/node_modules/remote-pi/dist/mesh/client.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/encoding.d.ts +38 -0
- package/node_modules/remote-pi/dist/mesh/encoding.js +216 -0
- package/node_modules/remote-pi/dist/mesh/encoding.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/self_revoke.d.ts +73 -0
- package/node_modules/remote-pi/dist/mesh/self_revoke.js +401 -0
- package/node_modules/remote-pi/dist/mesh/self_revoke.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/siblings.d.ts +49 -0
- package/node_modules/remote-pi/dist/mesh/siblings.js +159 -0
- package/node_modules/remote-pi/dist/mesh/siblings.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/types.d.ts +34 -0
- package/node_modules/remote-pi/dist/mesh/types.js +11 -0
- package/node_modules/remote-pi/dist/mesh/types.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/verify.d.ts +17 -0
- package/node_modules/remote-pi/dist/mesh/verify.js +86 -0
- package/node_modules/remote-pi/dist/mesh/verify.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/crypto.d.ts +8 -0
- package/node_modules/remote-pi/dist/pairing/crypto.js +22 -0
- package/node_modules/remote-pi/dist/pairing/crypto.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/handshake.d.ts +28 -0
- package/node_modules/remote-pi/dist/pairing/handshake.js +113 -0
- package/node_modules/remote-pi/dist/pairing/handshake.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/noise-sha256.d.ts +16 -0
- package/node_modules/remote-pi/dist/pairing/noise-sha256.js +103 -0
- package/node_modules/remote-pi/dist/pairing/noise-sha256.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/qr.d.ts +59 -0
- package/node_modules/remote-pi/dist/pairing/qr.js +125 -0
- package/node_modules/remote-pi/dist/pairing/qr.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/storage.d.ts +120 -0
- package/node_modules/remote-pi/dist/pairing/storage.js +604 -0
- package/node_modules/remote-pi/dist/pairing/storage.js.map +1 -0
- package/node_modules/remote-pi/dist/protocol/codec.d.ts +7 -0
- package/node_modules/remote-pi/dist/protocol/codec.js +49 -0
- package/node_modules/remote-pi/dist/protocol/codec.js.map +1 -0
- package/node_modules/remote-pi/dist/protocol/types.d.ts +393 -0
- package/node_modules/remote-pi/dist/protocol/types.js +2 -0
- package/node_modules/remote-pi/dist/protocol/types.js.map +1 -0
- package/node_modules/remote-pi/dist/rooms.d.ts +29 -0
- package/node_modules/remote-pi/dist/rooms.js +57 -0
- package/node_modules/remote-pi/dist/rooms.js.map +1 -0
- package/node_modules/remote-pi/dist/session/address.d.ts +49 -0
- package/node_modules/remote-pi/dist/session/address.js +58 -0
- package/node_modules/remote-pi/dist/session/address.js.map +1 -0
- package/node_modules/remote-pi/dist/session/agent_bridge.d.ts +55 -0
- package/node_modules/remote-pi/dist/session/agent_bridge.js +146 -0
- package/node_modules/remote-pi/dist/session/agent_bridge.js.map +1 -0
- package/node_modules/remote-pi/dist/session/bridge.d.ts +37 -0
- package/node_modules/remote-pi/dist/session/bridge.js +130 -0
- package/node_modules/remote-pi/dist/session/bridge.js.map +1 -0
- package/node_modules/remote-pi/dist/session/broker.d.ts +189 -0
- package/node_modules/remote-pi/dist/session/broker.js +507 -0
- package/node_modules/remote-pi/dist/session/broker.js.map +1 -0
- package/node_modules/remote-pi/dist/session/broker_remote.d.ts +74 -0
- package/node_modules/remote-pi/dist/session/broker_remote.js +583 -0
- package/node_modules/remote-pi/dist/session/broker_remote.js.map +1 -0
- package/node_modules/remote-pi/dist/session/cwd_lock.d.ts +33 -0
- package/node_modules/remote-pi/dist/session/cwd_lock.js +126 -0
- package/node_modules/remote-pi/dist/session/cwd_lock.js.map +1 -0
- package/node_modules/remote-pi/dist/session/envelope.d.ts +33 -0
- package/node_modules/remote-pi/dist/session/envelope.js +117 -0
- package/node_modules/remote-pi/dist/session/envelope.js.map +1 -0
- package/node_modules/remote-pi/dist/session/global_config.d.ts +33 -0
- package/node_modules/remote-pi/dist/session/global_config.js +73 -0
- package/node_modules/remote-pi/dist/session/global_config.js.map +1 -0
- package/node_modules/remote-pi/dist/session/ipc.d.ts +27 -0
- package/node_modules/remote-pi/dist/session/ipc.js +22 -0
- package/node_modules/remote-pi/dist/session/ipc.js.map +1 -0
- package/node_modules/remote-pi/dist/session/leader_election.d.ts +32 -0
- package/node_modules/remote-pi/dist/session/leader_election.js +106 -0
- package/node_modules/remote-pi/dist/session/leader_election.js.map +1 -0
- package/node_modules/remote-pi/dist/session/local_config.d.ts +55 -0
- package/node_modules/remote-pi/dist/session/local_config.js +157 -0
- package/node_modules/remote-pi/dist/session/local_config.js.map +1 -0
- package/node_modules/remote-pi/dist/session/mesh_message.d.ts +20 -0
- package/node_modules/remote-pi/dist/session/mesh_message.js +28 -0
- package/node_modules/remote-pi/dist/session/mesh_message.js.map +1 -0
- package/node_modules/remote-pi/dist/session/mesh_node.d.ts +116 -0
- package/node_modules/remote-pi/dist/session/mesh_node.js +573 -0
- package/node_modules/remote-pi/dist/session/mesh_node.js.map +1 -0
- package/node_modules/remote-pi/dist/session/peer.d.ts +139 -0
- package/node_modules/remote-pi/dist/session/peer.js +451 -0
- package/node_modules/remote-pi/dist/session/peer.js.map +1 -0
- package/node_modules/remote-pi/dist/session/peer_inventory.d.ts +13 -0
- package/node_modules/remote-pi/dist/session/peer_inventory.js +48 -0
- package/node_modules/remote-pi/dist/session/peer_inventory.js.map +1 -0
- package/node_modules/remote-pi/dist/session/peer_limits.d.ts +9 -0
- package/node_modules/remote-pi/dist/session/peer_limits.js +21 -0
- package/node_modules/remote-pi/dist/session/peer_limits.js.map +1 -0
- package/node_modules/remote-pi/dist/session/setup_wizard.d.ts +39 -0
- package/node_modules/remote-pi/dist/session/setup_wizard.js +63 -0
- package/node_modules/remote-pi/dist/session/setup_wizard.js.map +1 -0
- package/node_modules/remote-pi/dist/session/tool_gate.d.ts +5 -0
- package/node_modules/remote-pi/dist/session/tool_gate.js +11 -0
- package/node_modules/remote-pi/dist/session/tool_gate.js.map +1 -0
- package/node_modules/remote-pi/dist/session/tools.d.ts +24 -0
- package/node_modules/remote-pi/dist/session/tools.js +252 -0
- package/node_modules/remote-pi/dist/session/tools.js.map +1 -0
- package/node_modules/remote-pi/dist/session/wizard.d.ts +13 -0
- package/node_modules/remote-pi/dist/session/wizard.js +20 -0
- package/node_modules/remote-pi/dist/session/wizard.js.map +1 -0
- package/node_modules/remote-pi/dist/settings.d.ts +15 -0
- package/node_modules/remote-pi/dist/settings.js +52 -0
- package/node_modules/remote-pi/dist/settings.js.map +1 -0
- package/node_modules/remote-pi/dist/transport/peer_channel.d.ts +37 -0
- package/node_modules/remote-pi/dist/transport/peer_channel.js +98 -0
- package/node_modules/remote-pi/dist/transport/peer_channel.js.map +1 -0
- package/node_modules/remote-pi/dist/transport/pi_forward_client.d.ts +29 -0
- package/node_modules/remote-pi/dist/transport/pi_forward_client.js +62 -0
- package/node_modules/remote-pi/dist/transport/pi_forward_client.js.map +1 -0
- package/node_modules/remote-pi/dist/transport/relay_client.d.ts +91 -0
- package/node_modules/remote-pi/dist/transport/relay_client.js +206 -0
- package/node_modules/remote-pi/dist/transport/relay_client.js.map +1 -0
- package/node_modules/remote-pi/dist/ui/footer.d.ts +32 -0
- package/node_modules/remote-pi/dist/ui/footer.js +34 -0
- package/node_modules/remote-pi/dist/ui/footer.js.map +1 -0
- package/node_modules/remote-pi/docs/daemon.md +289 -0
- package/node_modules/remote-pi/package.json +88 -0
- package/node_modules/remote-pi/service-templates/launchd.plist.template +35 -0
- package/node_modules/remote-pi/service-templates/systemd.service.template +19 -0
- package/node_modules/remote-pi/service-templates/task-launcher.vbs.template +10 -0
- package/node_modules/remote-pi/service-templates/task-scheduler.xml.template +38 -0
- package/node_modules/remote-pi/skills/agent-network/SKILL.md +310 -0
- package/package.json +37 -12
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool-diff/write-display-utils.ts +0 -29
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference-core.ts → reference/session.ts} +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-aliases.ts → shell/aliases.ts} +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ATTRIBUTION.md +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-presentation.ts +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/index.ts +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/render-utils.ts +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/shiki-highlight.ts +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/types.ts +0 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { getAgentPath } from "./agent-dir.ts";
|
|
4
|
+
import type { McpConfig, ServerEntry } from "./types.ts";
|
|
5
|
+
|
|
6
|
+
const PLUGIN_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
7
|
+
const MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
|
|
8
|
+
const PLUGIN_NAME_PATTERN = /^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/;
|
|
9
|
+
const PLUGIN_MANIFEST_FIELDS = new Set([
|
|
10
|
+
"$schema",
|
|
11
|
+
"name",
|
|
12
|
+
"version",
|
|
13
|
+
"description",
|
|
14
|
+
"author",
|
|
15
|
+
"homepage",
|
|
16
|
+
"repository",
|
|
17
|
+
"license",
|
|
18
|
+
"keywords",
|
|
19
|
+
"extensions",
|
|
20
|
+
]);
|
|
21
|
+
const MCP_CONFIG_FIELDS = new Set(["$schema", "mcpServers"]);
|
|
22
|
+
const STDIO_FIELDS = new Set(["type", "command", "args", "env", "cwd"]);
|
|
23
|
+
const HTTP_FIELDS = new Set(["type", "url", "headers"]);
|
|
24
|
+
|
|
25
|
+
interface AgentPluginManifest {
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AgentPluginSummary {
|
|
30
|
+
path: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
serverCount: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function loadAgentPluginConfigs(paths: unknown, cwd = process.cwd()): McpConfig {
|
|
36
|
+
const mcpServers: Record<string, ServerEntry> = {};
|
|
37
|
+
for (const pluginPath of getPluginPaths(paths)) {
|
|
38
|
+
const loaded = loadAgentPluginMcpConfig(pluginPath, cwd);
|
|
39
|
+
if (!loaded) continue;
|
|
40
|
+
for (const [serverName, server] of Object.entries(loaded.mcpServers)) {
|
|
41
|
+
if (mcpServers[serverName]) {
|
|
42
|
+
console.warn(`Agent Plugin at ${resolvePluginPath(pluginPath, cwd)} skips duplicate normalized MCP server ${serverName}`);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
mcpServers[serverName] = server;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return { mcpServers };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getAgentPluginSummaries(paths: unknown, cwd = process.cwd()): AgentPluginSummary[] {
|
|
52
|
+
return getPluginPaths(paths).map(path => {
|
|
53
|
+
const pluginRoot = resolvePluginPath(path, cwd);
|
|
54
|
+
const loaded = loadAgentPluginMcpConfig(path, cwd);
|
|
55
|
+
const manifest = loaded ? readPluginManifest(pluginRoot, false) : null;
|
|
56
|
+
return {
|
|
57
|
+
path: pluginRoot,
|
|
58
|
+
...(manifest?.name ? { name: manifest.name } : {}),
|
|
59
|
+
serverCount: loaded ? Object.keys(loaded.mcpServers).length : 0,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getPluginPaths(paths: unknown): string[] {
|
|
65
|
+
return Array.isArray(paths) ? paths.filter((path): path is string => typeof path === "string") : [];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function loadAgentPluginMcpConfig(path: string, cwd: string): McpConfig | null {
|
|
69
|
+
const pluginRoot = resolvePluginPath(path, cwd);
|
|
70
|
+
const manifest = readPluginManifest(pluginRoot, true);
|
|
71
|
+
if (!manifest) return null;
|
|
72
|
+
|
|
73
|
+
const mcpPath = resolve(pluginRoot, "mcp.json");
|
|
74
|
+
if (!existsSync(mcpPath)) return { mcpServers: {} };
|
|
75
|
+
if (!statSync(mcpPath).isFile()) {
|
|
76
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: mcp.json is not a regular file`);
|
|
77
|
+
return { mcpServers: {} };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let raw: unknown;
|
|
81
|
+
try {
|
|
82
|
+
raw = JSON.parse(readFileSync(mcpPath, "utf8"));
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: failed to parse mcp.json`, error);
|
|
85
|
+
return { mcpServers: {} };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return translateAgentPluginMcpConfig(raw, manifest, pluginRoot);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function readPluginManifest(pluginRoot: string, report: boolean): AgentPluginManifest | null {
|
|
92
|
+
const manifestPath = resolve(pluginRoot, "plugin.json");
|
|
93
|
+
if (!existsSync(manifestPath)) {
|
|
94
|
+
if (report) console.warn(`Agent Plugin at ${pluginRoot} is invalid: missing plugin.json`);
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
if (!statSync(manifestPath).isFile()) {
|
|
98
|
+
if (report) console.warn(`Agent Plugin at ${pluginRoot} is invalid: plugin.json is not a regular file`);
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let raw: unknown;
|
|
103
|
+
try {
|
|
104
|
+
raw = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
105
|
+
} catch (error) {
|
|
106
|
+
if (report) console.warn(`Agent Plugin at ${pluginRoot} is invalid: failed to parse plugin.json`, error);
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
110
|
+
if (report) console.warn(`Agent Plugin at ${pluginRoot} is invalid: plugin.json must be an object`);
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const manifest = raw as Record<string, unknown>;
|
|
115
|
+
for (const key of Object.keys(manifest)) {
|
|
116
|
+
if (!PLUGIN_MANIFEST_FIELDS.has(key) && report) {
|
|
117
|
+
console.warn(`Agent Plugin at ${pluginRoot} ignores unknown plugin.json field: ${key}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (manifest.$schema !== PLUGIN_SCHEMA) {
|
|
121
|
+
if (report) console.warn(`Agent Plugin at ${pluginRoot} is invalid: unsupported plugin.json $schema`);
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
if (typeof manifest.name !== "string" || manifest.name.length < 1 || manifest.name.length > 64 || !PLUGIN_NAME_PATTERN.test(manifest.name)) {
|
|
125
|
+
if (report) console.warn(`Agent Plugin at ${pluginRoot} is invalid: plugin.json name is invalid`);
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
if (manifest.extensions !== undefined && (!manifest.extensions || typeof manifest.extensions !== "object" || Array.isArray(manifest.extensions))) {
|
|
129
|
+
if (report) console.warn(`Agent Plugin ${manifest.name} ignores non-object plugin.json extensions`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return { name: manifest.name };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function translateAgentPluginMcpConfig(raw: unknown, manifest: AgentPluginManifest, pluginRoot: string): McpConfig {
|
|
136
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
137
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: mcp.json must be an object`);
|
|
138
|
+
return { mcpServers: {} };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const mcpConfig = raw as Record<string, unknown>;
|
|
142
|
+
for (const key of Object.keys(mcpConfig)) {
|
|
143
|
+
if (!MCP_CONFIG_FIELDS.has(key)) {
|
|
144
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: unknown top-level field ${key}`);
|
|
145
|
+
return { mcpServers: {} };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (mcpConfig.$schema !== MCP_SCHEMA) {
|
|
149
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: unsupported mcp.json $schema`);
|
|
150
|
+
return { mcpServers: {} };
|
|
151
|
+
}
|
|
152
|
+
if (!mcpConfig.mcpServers || typeof mcpConfig.mcpServers !== "object" || Array.isArray(mcpConfig.mcpServers)) {
|
|
153
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: mcpServers must be an object`);
|
|
154
|
+
return { mcpServers: {} };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const mcpServers: Record<string, ServerEntry> = {};
|
|
158
|
+
for (const [serverName, entry] of Object.entries(mcpConfig.mcpServers)) {
|
|
159
|
+
const translated = translateAgentPluginServer(manifest, pluginRoot, serverName, entry);
|
|
160
|
+
if (!translated) continue;
|
|
161
|
+
|
|
162
|
+
const normalizedName = formatAgentPluginServerName(manifest.name, serverName);
|
|
163
|
+
if (mcpServers[normalizedName]) {
|
|
164
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: normalized server name ${normalizedName} already exists`);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
mcpServers[normalizedName] = translated;
|
|
168
|
+
}
|
|
169
|
+
return { mcpServers };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function translateAgentPluginServer(
|
|
173
|
+
manifest: AgentPluginManifest,
|
|
174
|
+
pluginRoot: string,
|
|
175
|
+
serverName: string,
|
|
176
|
+
entry: unknown,
|
|
177
|
+
): ServerEntry | null {
|
|
178
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
179
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: entry must be an object`);
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const raw = entry as Record<string, unknown>;
|
|
184
|
+
if (raw.type === "stdio") return translateStdioServer(manifest, pluginRoot, serverName, raw);
|
|
185
|
+
if (raw.type === "streamable-http" || raw.type === "sse") return translateHttpServer(manifest, serverName, raw, raw.type);
|
|
186
|
+
|
|
187
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: unsupported type`);
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function translateStdioServer(
|
|
192
|
+
manifest: AgentPluginManifest,
|
|
193
|
+
pluginRoot: string,
|
|
194
|
+
serverName: string,
|
|
195
|
+
raw: Record<string, unknown>,
|
|
196
|
+
): ServerEntry | null {
|
|
197
|
+
for (const key of Object.keys(raw)) {
|
|
198
|
+
if (!STDIO_FIELDS.has(key)) return skipServer(manifest, serverName, `unknown field ${key}`);
|
|
199
|
+
}
|
|
200
|
+
if (typeof raw.command !== "string" || raw.command.length === 0) return skipServer(manifest, serverName, "command must be a non-empty string");
|
|
201
|
+
if (!isBareCommand(raw.command) && !raw.command.startsWith("./")) return skipServer(manifest, serverName, "command must be bare or plugin-relative");
|
|
202
|
+
|
|
203
|
+
const args = translateStringArray(raw.args, manifest, serverName, "args");
|
|
204
|
+
if (args === null) return null;
|
|
205
|
+
const env = translateEnv(raw.env, manifest, serverName);
|
|
206
|
+
if (env === null) return null;
|
|
207
|
+
|
|
208
|
+
const command = raw.command.startsWith("./") ? resolveContainedPath(pluginRoot, raw.command, pluginRoot) : raw.command;
|
|
209
|
+
if (command === null) return skipServer(manifest, serverName, "command must stay inside the plugin directory");
|
|
210
|
+
|
|
211
|
+
const pluginDataDir = getAgentPath("agent-plugin-data", manifest.name);
|
|
212
|
+
const cwd = resolvePluginCwd(raw.cwd, pluginRoot, pluginDataDir);
|
|
213
|
+
if (cwd === null) return skipServer(manifest, serverName, "cwd must be plugin-relative, PLUGIN_ROOT-rooted, or PLUGIN_DATA-rooted");
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
command,
|
|
217
|
+
args: args.map(value => expandPluginPlaceholders(value, pluginRoot, pluginDataDir)),
|
|
218
|
+
env: {
|
|
219
|
+
...Object.fromEntries(Object.entries(env).map(([key, value]) => [key, expandPluginPlaceholders(value, pluginRoot, pluginDataDir)])),
|
|
220
|
+
PLUGIN_ROOT: pluginRoot,
|
|
221
|
+
PLUGIN_DATA: pluginDataDir,
|
|
222
|
+
},
|
|
223
|
+
cwd,
|
|
224
|
+
pluginDataDir,
|
|
225
|
+
literalEnv: true,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function translateHttpServer(
|
|
230
|
+
manifest: AgentPluginManifest,
|
|
231
|
+
serverName: string,
|
|
232
|
+
raw: Record<string, unknown>,
|
|
233
|
+
type: "streamable-http" | "sse",
|
|
234
|
+
): ServerEntry | null {
|
|
235
|
+
for (const key of Object.keys(raw)) {
|
|
236
|
+
if (!HTTP_FIELDS.has(key)) return skipServer(manifest, serverName, `unknown field ${key}`);
|
|
237
|
+
}
|
|
238
|
+
if (typeof raw.url !== "string" || raw.url.length === 0) return skipServer(manifest, serverName, "url must be a non-empty string");
|
|
239
|
+
if (!isValidAgentPluginUrl(raw.url)) return skipServer(manifest, serverName, "url must be an allowed absolute HTTP(S) URL");
|
|
240
|
+
const headers = translateHeaders(raw.headers, manifest, serverName);
|
|
241
|
+
if (headers === null) return null;
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
url: raw.url,
|
|
245
|
+
httpTransport: type,
|
|
246
|
+
...(headers ? { headers } : {}),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function formatAgentPluginServerName(pluginName: string, serverName: string): string {
|
|
251
|
+
const pluginPart = pluginName.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "") || "plugin";
|
|
252
|
+
const serverPart = serverName.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "") || "server";
|
|
253
|
+
return `${pluginPart}__${serverPart}`;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function skipServer(manifest: AgentPluginManifest, serverName: string, reason: string): null {
|
|
257
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: ${reason}`);
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function translateStringArray(value: unknown, manifest: AgentPluginManifest, serverName: string, field: string): string[] | null {
|
|
262
|
+
if (value === undefined) return [];
|
|
263
|
+
if (!Array.isArray(value) || value.some(item => typeof item !== "string")) {
|
|
264
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: ${field} must be an array of strings`);
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
return value;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function translateEnv(value: unknown, manifest: AgentPluginManifest, serverName: string): Record<string, string> | null {
|
|
271
|
+
if (value === undefined) return {};
|
|
272
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
273
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: env must be an object of strings`);
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
const env: Record<string, string> = {};
|
|
277
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
278
|
+
if (key === "PLUGIN_ROOT" || key === "PLUGIN_DATA") {
|
|
279
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: env must not define ${key}`);
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
if (typeof entry !== "string") {
|
|
283
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: env values must be strings`);
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
env[key] = entry;
|
|
287
|
+
}
|
|
288
|
+
return env;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function translateHeaders(value: unknown, manifest: AgentPluginManifest, serverName: string): Record<string, string> | undefined | null {
|
|
292
|
+
if (value === undefined) return undefined;
|
|
293
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
294
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: headers must be an object of strings`);
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
const headers: Record<string, string> = {};
|
|
298
|
+
const seen = new Set<string>();
|
|
299
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
300
|
+
if (typeof entry !== "string") {
|
|
301
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: header values must be strings`);
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
const normalized = key.toLowerCase();
|
|
305
|
+
if (seen.has(normalized)) {
|
|
306
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: duplicate header ${key}`);
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
seen.add(normalized);
|
|
310
|
+
headers[key] = entry;
|
|
311
|
+
}
|
|
312
|
+
try {
|
|
313
|
+
new Headers(headers);
|
|
314
|
+
} catch {
|
|
315
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: headers are not valid HTTP fields`);
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function resolvePluginPath(path: string, cwd: string): string {
|
|
322
|
+
if (path === "~") return resolve(process.env.HOME ?? "", ".");
|
|
323
|
+
if (path.startsWith("~/")) return resolve(process.env.HOME ?? "", path.slice(2));
|
|
324
|
+
return isAbsolute(path) ? resolve(path) : resolve(cwd, path);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function isBareCommand(command: string): boolean {
|
|
328
|
+
return !command.includes("/") && !command.includes("\\") && !command.includes("${PLUGIN_ROOT}") && !command.includes("${PLUGIN_DATA}");
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function resolvePluginCwd(value: unknown, pluginRoot: string, pluginDataDir: string): string | null {
|
|
332
|
+
if (value === undefined) return pluginRoot;
|
|
333
|
+
if (typeof value !== "string") return null;
|
|
334
|
+
if (value.startsWith("./")) return resolveContainedPath(pluginRoot, value, pluginRoot);
|
|
335
|
+
if (value === "${PLUGIN_ROOT}" || value.startsWith("${PLUGIN_ROOT}/")) {
|
|
336
|
+
return resolveContainedPath(pluginRoot, value.replace("${PLUGIN_ROOT}", "."), pluginRoot);
|
|
337
|
+
}
|
|
338
|
+
if (value === "${PLUGIN_DATA}" || value.startsWith("${PLUGIN_DATA}/")) {
|
|
339
|
+
return resolveContainedPath(pluginDataDir, value.replace("${PLUGIN_DATA}", "."), pluginDataDir);
|
|
340
|
+
}
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function resolveContainedPath(root: string, value: string, containmentRoot: string): string | null {
|
|
345
|
+
const resolved = resolve(root, value);
|
|
346
|
+
const rel = relative(containmentRoot, resolved);
|
|
347
|
+
if (rel === "" || (!rel.startsWith("..") && !rel.startsWith(sep) && !isAbsolute(rel))) return resolved;
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function expandPluginPlaceholders(value: string, pluginRoot: string, pluginDataDir: string): string {
|
|
352
|
+
return value
|
|
353
|
+
.replaceAll("${PLUGIN_ROOT}", pluginRoot)
|
|
354
|
+
.replaceAll("${PLUGIN_DATA}", pluginDataDir);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function isValidAgentPluginUrl(value: string): boolean {
|
|
358
|
+
if (value.includes("${") || value.includes("$env:") || value.includes("{env:")) return false;
|
|
359
|
+
|
|
360
|
+
let url: URL;
|
|
361
|
+
try {
|
|
362
|
+
url = new URL(value);
|
|
363
|
+
} catch {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return false;
|
|
367
|
+
if (url.username || url.password || url.hash) return false;
|
|
368
|
+
if (url.protocol === "https:") return true;
|
|
369
|
+
return isLoopbackHost(url.hostname);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function isLoopbackHost(hostname: string): boolean {
|
|
373
|
+
const host = hostname.toLowerCase();
|
|
374
|
+
if (host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]") return true;
|
|
375
|
+
if (/^127(?:\.\d{1,3}){3}$/.test(host)) return true;
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
@@ -4,6 +4,7 @@ import { isServerDisabled, type McpAuthResult, type McpConfig, type McpPanelCall
|
|
|
4
4
|
import {
|
|
5
5
|
ensureCompatibilityImports,
|
|
6
6
|
getMcpDiscoverySummary,
|
|
7
|
+
getMcpStandardConfigSummary,
|
|
7
8
|
getProjectConfigPath,
|
|
8
9
|
type KnownServerPreset,
|
|
9
10
|
getServerProvenance,
|
|
@@ -24,6 +25,10 @@ import { loadOnboardingState, markSetupCompleted as persistSetupCompleted, markS
|
|
|
24
25
|
import { openPath, resolveServerUrl, sanitizeTerminalText } from "./utils.ts";
|
|
25
26
|
import { isAbortError } from "./runtime-owner.ts";
|
|
26
27
|
|
|
28
|
+
function terminalHyperlink(label: string, url: string): string {
|
|
29
|
+
return `\u001B]8;;${sanitizeTerminalText(url)}\u001B\\${sanitizeTerminalText(label)}\u001B]8;;\u001B\\`;
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
export async function showStatus(state: McpExtensionState, ctx: ExtensionContext): Promise<void> {
|
|
28
33
|
if (!ctx.hasUI) return;
|
|
29
34
|
|
|
@@ -272,13 +277,19 @@ export async function authenticateServer(
|
|
|
272
277
|
...(authStorageOptions.baseDir ? { authStorageOptions } : {}),
|
|
273
278
|
onAuthorizationUrl: (authorizationUrl) => {
|
|
274
279
|
ui.notify(
|
|
275
|
-
`Open this URL to authenticate ${serverName}:\n\n${authorizationUrl}\n\n` +
|
|
276
|
-
"After approving,
|
|
280
|
+
`Open this URL to authenticate ${serverName}:\n\n${terminalHyperlink(authorizationUrl, authorizationUrl)}\n\n` +
|
|
281
|
+
"After approving, Pi will complete automatically if the browser can reach its localhost callback. " +
|
|
282
|
+
"On a remote machine, copy the full localhost URL from the browser address bar and paste it into Pi.",
|
|
277
283
|
"info"
|
|
278
284
|
);
|
|
279
285
|
},
|
|
280
|
-
|
|
281
|
-
|
|
286
|
+
onAuthorizationInput: (_authorizationUrl, inputSignal) => ui.input(
|
|
287
|
+
`Complete ${serverName} OAuth`,
|
|
288
|
+
"Paste the full callback URL, or wait for automatic completion",
|
|
289
|
+
{ signal: inputSignal },
|
|
290
|
+
),
|
|
291
|
+
...(signal ? { signal } : {}),
|
|
292
|
+
...(runtime ? { runtime } : {}),
|
|
282
293
|
});
|
|
283
294
|
if (signal?.aborted) signal.throwIfAborted();
|
|
284
295
|
|
|
@@ -354,7 +365,7 @@ export interface PanelFlowResult {
|
|
|
354
365
|
}
|
|
355
366
|
|
|
356
367
|
function buildSharedConfigNoticeLines(configOverridePath: string | undefined, cwd: string): { lines: string[]; fingerprint: string | null } {
|
|
357
|
-
const discovery =
|
|
368
|
+
const discovery = getMcpStandardConfigSummary(configOverridePath, cwd);
|
|
358
369
|
const onboardingState = loadOnboardingState();
|
|
359
370
|
if (!discovery.hasSharedServers || onboardingState.sharedConfigHintShown) {
|
|
360
371
|
return { lines: [], fingerprint: null };
|
|
@@ -377,6 +388,7 @@ export async function openMcpSetup(
|
|
|
377
388
|
ctx: ExtensionContext,
|
|
378
389
|
configOverridePath?: string,
|
|
379
390
|
mode: "empty" | "setup" = "setup",
|
|
391
|
+
options: { includeHostConfigs?: boolean } = {},
|
|
380
392
|
): Promise<PanelFlowResult> {
|
|
381
393
|
if (!ctx.hasUI) return { configChanged: false };
|
|
382
394
|
if (state.programmaticConfig) {
|
|
@@ -384,7 +396,7 @@ export async function openMcpSetup(
|
|
|
384
396
|
return { configChanged: false };
|
|
385
397
|
}
|
|
386
398
|
|
|
387
|
-
const discovery = getMcpDiscoverySummary(configOverridePath, ctx.cwd);
|
|
399
|
+
const discovery = getMcpDiscoverySummary(configOverridePath, ctx.cwd, options);
|
|
388
400
|
const onboardingState = loadOnboardingState();
|
|
389
401
|
const { createMcpSetupPanel } = await import("./mcp-setup-panel.ts");
|
|
390
402
|
let configChanged = false;
|
|
@@ -393,7 +405,7 @@ export async function openMcpSetup(
|
|
|
393
405
|
previewImports: (imports: ImportKind[]) => previewCompatibilityImports(imports, configOverridePath),
|
|
394
406
|
previewStarterProject: () => previewStarterProjectConfig(ctx.cwd),
|
|
395
407
|
previewRepoPrompt: () => {
|
|
396
|
-
const repoPrompt = getMcpDiscoverySummary(configOverridePath, ctx.cwd).repoPrompt;
|
|
408
|
+
const repoPrompt = getMcpDiscoverySummary(configOverridePath, ctx.cwd, options).repoPrompt;
|
|
397
409
|
if (!repoPrompt.entry || !repoPrompt.targetPath || !repoPrompt.serverName) return null;
|
|
398
410
|
return previewSharedServerEntry(repoPrompt.targetPath, repoPrompt.serverName, repoPrompt.entry);
|
|
399
411
|
},
|
|
@@ -409,7 +421,7 @@ export async function openMcpSetup(
|
|
|
409
421
|
return { path };
|
|
410
422
|
},
|
|
411
423
|
addRepoPrompt: async () => {
|
|
412
|
-
const repoPrompt = getMcpDiscoverySummary(configOverridePath, ctx.cwd).repoPrompt;
|
|
424
|
+
const repoPrompt = getMcpDiscoverySummary(configOverridePath, ctx.cwd, options).repoPrompt;
|
|
413
425
|
if (!repoPrompt.entry || !repoPrompt.targetPath || !repoPrompt.serverName) {
|
|
414
426
|
throw new Error("RepoPrompt is not available to add from this setup screen.");
|
|
415
427
|
}
|
|
@@ -514,7 +526,7 @@ export async function openMcpPanel(
|
|
|
514
526
|
return { configChanged: false };
|
|
515
527
|
}
|
|
516
528
|
if (Object.keys(state.config.mcpServers).length === 0) {
|
|
517
|
-
return openMcpSetup(state, pi, ctx, configOverridePath, "empty");
|
|
529
|
+
return openMcpSetup(state, pi, ctx, configOverridePath, "empty", { includeHostConfigs: false });
|
|
518
530
|
}
|
|
519
531
|
|
|
520
532
|
const config = state.config;
|