@herbertgao/pi-extensions 2026.9.16 → 2026.9.18
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 +14 -15
- 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/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/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +11 -53
- 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/package.json +2 -2
- 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 +1 -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 +5 -5
- package/node_modules/pi-web-access/package.json +2 -2
- package/node_modules/remote-pi/package.json +5 -1
- package/package.json +16 -28
- 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,156 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
3
|
-
import { getAgentDir, getConfigDirName } from "./agent-dir.ts";
|
|
4
|
-
import type { McpConfig, ServerEntry } from "./types.ts";
|
|
5
|
-
import { parseJsonWithComments, resolveContainedPath, resolveRealContainedPath } from "./utils.ts";
|
|
6
|
-
|
|
7
|
-
interface PackageSetting {
|
|
8
|
-
source: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface PackageManifest {
|
|
12
|
-
name?: unknown;
|
|
13
|
-
pi?: { mcp?: unknown };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function loadPackageMcpConfigs(cwd = process.cwd()): McpConfig {
|
|
17
|
-
const mcpServers: Record<string, ServerEntry> = {};
|
|
18
|
-
const seen = new Set<string>();
|
|
19
|
-
|
|
20
|
-
for (const packageRoot of getConfiguredPackageRoots(cwd)) {
|
|
21
|
-
const manifest = readPackageManifest(packageRoot);
|
|
22
|
-
if (!manifest || typeof manifest.name !== "string" || !manifest.name) continue;
|
|
23
|
-
const paths = getManifestMcpPaths(manifest.pi?.mcp, manifest.name);
|
|
24
|
-
if (!paths) continue;
|
|
25
|
-
|
|
26
|
-
const packagePrefix = formatPackageName(manifest.name);
|
|
27
|
-
const packageServers = new Set<string>();
|
|
28
|
-
for (const path of paths) {
|
|
29
|
-
const configPath = resolvePackageConfigPath(packageRoot, path);
|
|
30
|
-
if (!configPath) {
|
|
31
|
-
console.warn(`Pi package ${manifest.name} skips MCP config ${path}: file must stay inside the package`);
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const config = readMcpConfig(configPath, manifest.name);
|
|
36
|
-
if (!config) continue;
|
|
37
|
-
for (const [serverName, server] of Object.entries(config.mcpServers)) {
|
|
38
|
-
const normalizedName = `${packagePrefix}__${formatServerName(serverName)}`;
|
|
39
|
-
if (packageServers.has(normalizedName) || seen.has(normalizedName)) {
|
|
40
|
-
console.warn(`Pi package ${manifest.name} skips duplicate normalized MCP server ${normalizedName}`);
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
packageServers.add(normalizedName);
|
|
44
|
-
seen.add(normalizedName);
|
|
45
|
-
mcpServers[normalizedName] = server;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return { mcpServers };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function getConfiguredPackageRoots(cwd: string): string[] {
|
|
54
|
-
const roots: string[] = [];
|
|
55
|
-
for (const [settingsPath, scope] of [
|
|
56
|
-
[join(cwd, getConfigDirName(), "settings.json"), "project"],
|
|
57
|
-
[join(getAgentDir(), "settings.json"), "user"],
|
|
58
|
-
] as const) {
|
|
59
|
-
const settings = readOptionalJson(settingsPath, `${scope} Pi settings`);
|
|
60
|
-
if (settings === undefined) continue;
|
|
61
|
-
if (typeof settings !== "object" || settings === null || Array.isArray(settings)) {
|
|
62
|
-
throw new Error(`${scope} Pi settings ${settingsPath} must be a JSON object`);
|
|
63
|
-
}
|
|
64
|
-
const packages = (settings as { packages?: unknown }).packages;
|
|
65
|
-
if (packages === undefined) continue;
|
|
66
|
-
if (!Array.isArray(packages)) throw new Error(`${scope} Pi settings ${settingsPath} packages must be an array`);
|
|
67
|
-
for (const entry of packages) {
|
|
68
|
-
const source = typeof entry === "string"
|
|
69
|
-
? entry
|
|
70
|
-
: entry && typeof entry === "object" && !Array.isArray(entry) && typeof (entry as PackageSetting).source === "string"
|
|
71
|
-
? (entry as PackageSetting).source
|
|
72
|
-
: undefined;
|
|
73
|
-
if (!source) throw new Error(`${scope} Pi settings ${settingsPath} package entries must be strings or objects with a string source`);
|
|
74
|
-
const root = resolvePackageRoot(source, scope, cwd);
|
|
75
|
-
if (root && !roots.includes(root)) roots.push(root);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return roots;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function resolvePackageRoot(source: string, scope: "user" | "project", cwd: string): string | null {
|
|
82
|
-
const baseDir = scope === "user" ? getAgentDir() : join(cwd, getConfigDirName());
|
|
83
|
-
if (source.startsWith("npm:")) {
|
|
84
|
-
const name = source.slice(4).trim().match(/^(@?[^@]+(?:\/[^@]+)?)/)?.[1];
|
|
85
|
-
return name ? resolveContainedPath(join(baseDir, "npm", "node_modules"), name) : null;
|
|
86
|
-
}
|
|
87
|
-
const gitSource = source.startsWith("git:")
|
|
88
|
-
? source.slice(4).trim()
|
|
89
|
-
: /^(?:(?:https?|ssh):\/\/|git@[^:]+:)/.test(source) ? source : null;
|
|
90
|
-
if (gitSource) {
|
|
91
|
-
const value = gitSource
|
|
92
|
-
.replace(/^ssh:\/\/git@/, "")
|
|
93
|
-
.replace(/^git@([^:]+):/, "$1/")
|
|
94
|
-
.replace(/^[a-z]+:\/\//i, "");
|
|
95
|
-
const path = value.replace(/@[^/]+$/, "").replace(/\.git$/, "");
|
|
96
|
-
return path && !path.startsWith("/") ? resolveContainedPath(join(baseDir, "git"), path) : null;
|
|
97
|
-
}
|
|
98
|
-
return isAbsolute(source) ? resolve(source) : resolve(baseDir, source);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function readPackageManifest(packageRoot: string): PackageManifest | null {
|
|
102
|
-
const manifest = readOptionalJson(join(packageRoot, "package.json"), `Pi package manifest ${packageRoot}`);
|
|
103
|
-
return manifest && typeof manifest === "object" && !Array.isArray(manifest) ? manifest as PackageManifest : null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function getManifestMcpPaths(value: unknown, packageName: string): string[] | null {
|
|
107
|
-
const paths = typeof value === "string" ? [value] : Array.isArray(value) && value.every((path): path is string => typeof path === "string") ? value : null;
|
|
108
|
-
if (value !== undefined && !paths) console.warn(`Pi package ${packageName} ignores invalid pi.mcp manifest entry`);
|
|
109
|
-
return paths;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function readMcpConfig(path: string, packageName: string): McpConfig | null {
|
|
113
|
-
const config = readRequiredJson(path, `Pi package ${packageName} MCP config`);
|
|
114
|
-
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
115
|
-
throw new Error(`Pi package ${packageName} MCP config ${path} must be a JSON object`);
|
|
116
|
-
}
|
|
117
|
-
const servers = (config as { mcpServers?: unknown }).mcpServers;
|
|
118
|
-
if (!servers || typeof servers !== "object" || Array.isArray(servers)) {
|
|
119
|
-
throw new Error(`Pi package ${packageName} MCP config ${path} must contain a JSON object mcpServers field`);
|
|
120
|
-
}
|
|
121
|
-
const mcpServers: Record<string, ServerEntry> = {};
|
|
122
|
-
for (const [name, server] of Object.entries(servers)) {
|
|
123
|
-
if (!server || typeof server !== "object" || Array.isArray(server)) {
|
|
124
|
-
throw new Error(`Pi package ${packageName} MCP config ${path} server ${name} must be a JSON object`);
|
|
125
|
-
}
|
|
126
|
-
mcpServers[name] = server as ServerEntry;
|
|
127
|
-
}
|
|
128
|
-
return { mcpServers };
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function readRequiredJson(path: string, description: string): unknown {
|
|
132
|
-
try {
|
|
133
|
-
return parseJsonWithComments(readFileSync(path, "utf8"));
|
|
134
|
-
} catch (error) {
|
|
135
|
-
throw new Error(`${description} ${path} contains invalid JSON: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function readOptionalJson(path: string, description: string): unknown | undefined {
|
|
140
|
-
if (!existsSync(path)) return undefined;
|
|
141
|
-
return readRequiredJson(path, description);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function resolvePackageConfigPath(packageRoot: string, path: string): string | null {
|
|
145
|
-
const lexicalPath = resolveContainedPath(packageRoot, path);
|
|
146
|
-
if (!lexicalPath || !existsSync(lexicalPath) || !statSync(lexicalPath).isFile()) return null;
|
|
147
|
-
return resolveRealContainedPath(packageRoot, lexicalPath);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function formatPackageName(name: string): string {
|
|
151
|
-
return name.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "") || "package";
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function formatServerName(name: string): string {
|
|
155
|
-
return name.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "") || "server";
|
|
156
|
-
}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pi-mcp-adapter",
|
|
3
|
-
"version": "2.38.0",
|
|
4
|
-
"description": "MCP (Model Context Protocol) adapter extension for Pi coding agent",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"types": "./index.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./index.ts",
|
|
10
|
-
"import": "./index.ts",
|
|
11
|
-
"default": "./index.ts"
|
|
12
|
-
},
|
|
13
|
-
"./types": {
|
|
14
|
-
"types": "./dist/types.d.ts",
|
|
15
|
-
"import": "./dist/types.js",
|
|
16
|
-
"default": "./dist/types.js"
|
|
17
|
-
},
|
|
18
|
-
"./oauth": {
|
|
19
|
-
"types": "./oauth.ts",
|
|
20
|
-
"import": "./oauth.ts",
|
|
21
|
-
"default": "./oauth.ts"
|
|
22
|
-
},
|
|
23
|
-
"./config": {
|
|
24
|
-
"types": "./dist/config.d.ts",
|
|
25
|
-
"import": "./dist/config.js",
|
|
26
|
-
"default": "./dist/config.js"
|
|
27
|
-
},
|
|
28
|
-
"./metadata-cache": {
|
|
29
|
-
"types": "./dist/metadata-cache.d.ts",
|
|
30
|
-
"import": "./dist/metadata-cache.js",
|
|
31
|
-
"default": "./dist/metadata-cache.js"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"license": "MIT",
|
|
35
|
-
"author": "Nico Bailon",
|
|
36
|
-
"engines": {
|
|
37
|
-
"node": ">=20"
|
|
38
|
-
},
|
|
39
|
-
"bin": {
|
|
40
|
-
"pi-mcp-adapter": "cli.js"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build:public": "tsc -p tsconfig.public.json",
|
|
44
|
-
"prepack": "npm run build:public",
|
|
45
|
-
"typecheck": "tsc --noEmit",
|
|
46
|
-
"test": "node test-runner.mjs",
|
|
47
|
-
"test:vitest": "vitest run",
|
|
48
|
-
"test:public-exports": "npm run build:public && node --test public-exports.test.mjs",
|
|
49
|
-
"test:watch": "vitest",
|
|
50
|
-
"test:coverage": "vitest run --coverage",
|
|
51
|
-
"test:oauth": "PI_MCP_ADAPTER_TEST_AUTH_STORE=memory PI_MCP_ADAPTER_DISABLE_AUTH_CACHE=1 node --import tsx --test --test-concurrency=1 oauth-public-api.test.ts mcp-auth.test.ts mcp-auth-flow.test.ts mcp-auth-flow-timeout.test.ts mcp-auth-fetch.test.ts mcp-callback-server.test.ts mcp-oauth-provider.test.ts mcp-local-oauth-flow.test.ts",
|
|
52
|
-
"test:oauth-provider": "PI_MCP_ADAPTER_TEST_AUTH_STORE=memory PI_MCP_ADAPTER_DISABLE_AUTH_CACHE=1 node --import tsx --test mcp-oauth-provider.test.ts",
|
|
53
|
-
"test:conformance": "bash conformance/run.sh"
|
|
54
|
-
},
|
|
55
|
-
"repository": {
|
|
56
|
-
"type": "git",
|
|
57
|
-
"url": "git+https://github.com/nicobailon/pi-mcp-adapter.git"
|
|
58
|
-
},
|
|
59
|
-
"keywords": [
|
|
60
|
-
"pi-package",
|
|
61
|
-
"pi",
|
|
62
|
-
"mcp",
|
|
63
|
-
"model-context-protocol",
|
|
64
|
-
"ai",
|
|
65
|
-
"coding-agent",
|
|
66
|
-
"extension",
|
|
67
|
-
"claude",
|
|
68
|
-
"llm"
|
|
69
|
-
],
|
|
70
|
-
"pi": {
|
|
71
|
-
"extensions": [
|
|
72
|
-
"./index.ts"
|
|
73
|
-
],
|
|
74
|
-
"video": "https://github.com/nicobailon/pi-mcp-adapter/raw/refs/heads/main/pi-mcp.mp4"
|
|
75
|
-
},
|
|
76
|
-
"files": [
|
|
77
|
-
"cli.js",
|
|
78
|
-
"agent-dir.ts",
|
|
79
|
-
"index.ts",
|
|
80
|
-
"error-signal.ts",
|
|
81
|
-
"state.ts",
|
|
82
|
-
"utils.ts",
|
|
83
|
-
"abort.ts",
|
|
84
|
-
"runtime-owner.ts",
|
|
85
|
-
"tool-metadata.ts",
|
|
86
|
-
"ts-shape.ts",
|
|
87
|
-
"search-ranking.ts",
|
|
88
|
-
"tool-approval.ts",
|
|
89
|
-
"session-approvals.ts",
|
|
90
|
-
"init.ts",
|
|
91
|
-
"failure-backoff.ts",
|
|
92
|
-
"ui-session.ts",
|
|
93
|
-
"proxy-modes.ts",
|
|
94
|
-
"direct-tools.ts",
|
|
95
|
-
"direct-tool-surface.ts",
|
|
96
|
-
"lazy-loader.ts",
|
|
97
|
-
"namespace-tools.ts",
|
|
98
|
-
"mcp-references.ts",
|
|
99
|
-
"commands.ts",
|
|
100
|
-
"prompts.ts",
|
|
101
|
-
"onboarding-state.ts",
|
|
102
|
-
"mcp-setup-panel.ts",
|
|
103
|
-
"types.ts",
|
|
104
|
-
"ui-stream-types.ts",
|
|
105
|
-
"ui-tool-visibility.ts",
|
|
106
|
-
"ui-app-bridge-helpers.ts",
|
|
107
|
-
"config.ts",
|
|
108
|
-
"claude-plugin-loader.ts",
|
|
109
|
-
"package-mcp-loader.ts",
|
|
110
|
-
"server-manager.ts",
|
|
111
|
-
"bearer-command-resolver.ts",
|
|
112
|
-
"http-ca.ts",
|
|
113
|
-
"request-headers-command.ts",
|
|
114
|
-
"unix-socket-transport.ts",
|
|
115
|
-
"json-schema-validator.ts",
|
|
116
|
-
"session-recovery.ts",
|
|
117
|
-
"sampling-handler.ts",
|
|
118
|
-
"elicitation-handler.ts",
|
|
119
|
-
"tool-registrar.ts",
|
|
120
|
-
"tool-result-renderer.ts",
|
|
121
|
-
"mcp-output-guard.ts",
|
|
122
|
-
"mcp-code.ts",
|
|
123
|
-
"mcp-script-worker.mjs",
|
|
124
|
-
"mcp-probe.ts",
|
|
125
|
-
"mcp-install.ts",
|
|
126
|
-
"agent-plugin-loader.ts",
|
|
127
|
-
"agent-plugin-provenance.ts",
|
|
128
|
-
"resource-tools.ts",
|
|
129
|
-
"lifecycle.ts",
|
|
130
|
-
"mcp-status.ts",
|
|
131
|
-
"metadata-cache.ts",
|
|
132
|
-
"host-html-template.ts",
|
|
133
|
-
"sandbox-proxy-template.ts",
|
|
134
|
-
"ui-resource-handler.ts",
|
|
135
|
-
"consent-manager.ts",
|
|
136
|
-
"ui-server.ts",
|
|
137
|
-
"glimpse-ui.ts",
|
|
138
|
-
"npx-resolver.ts",
|
|
139
|
-
"oauth-handler.ts",
|
|
140
|
-
"oauth.ts",
|
|
141
|
-
"mcp-auth.ts",
|
|
142
|
-
"mcp-bearer-store.ts",
|
|
143
|
-
"secure-keyring.ts",
|
|
144
|
-
"jev-contracts.ts",
|
|
145
|
-
"jev-key-store.ts",
|
|
146
|
-
"jev-client.ts",
|
|
147
|
-
"semantic-search.ts",
|
|
148
|
-
"examples/jev-semantic-filter.mjs",
|
|
149
|
-
"examples/jev-accessibility-loop.mjs",
|
|
150
|
-
"mcp-keyring-helper.cjs",
|
|
151
|
-
"mcp-oauth-provider.ts",
|
|
152
|
-
"mcp-callback-server.ts",
|
|
153
|
-
"mcp-auth-flow.ts",
|
|
154
|
-
"mcp-auth-fetch.ts",
|
|
155
|
-
"mcp-panel.ts",
|
|
156
|
-
"mcp-panel-theme.ts",
|
|
157
|
-
"panel-keys.ts",
|
|
158
|
-
"mcp-tasks.ts",
|
|
159
|
-
"mcp-trace.ts",
|
|
160
|
-
"logger.ts",
|
|
161
|
-
"errors.ts",
|
|
162
|
-
"app-bridge.bundle.js",
|
|
163
|
-
"banner.png",
|
|
164
|
-
"skills",
|
|
165
|
-
"README.md",
|
|
166
|
-
"OAUTH.md",
|
|
167
|
-
"CHANGELOG.md",
|
|
168
|
-
"LICENSE",
|
|
169
|
-
"dist"
|
|
170
|
-
],
|
|
171
|
-
"dependencies": {
|
|
172
|
-
"@modelcontextprotocol/client": "2.0.0",
|
|
173
|
-
"@modelcontextprotocol/core": "2.0.0",
|
|
174
|
-
"@modelcontextprotocol/ext-apps": "^1.2.2",
|
|
175
|
-
"@modelcontextprotocol/ext-tasks": "^0.1.0",
|
|
176
|
-
"@napi-rs/keyring": "^2.1.0",
|
|
177
|
-
"@typesafe-ai/sdk": "0.6.0",
|
|
178
|
-
"ajv": "^8.17.1",
|
|
179
|
-
"ajv-formats": "^3.0.1",
|
|
180
|
-
"cross-spawn": "^7.0.6",
|
|
181
|
-
"open": "^10.2.0",
|
|
182
|
-
"recheck": "4.6.0-beta.3",
|
|
183
|
-
"smol-toml": "^1.6.1",
|
|
184
|
-
"strip-json-comments": "^5.0.3",
|
|
185
|
-
"undici": "^6.28.1",
|
|
186
|
-
"zod": "^3.25.0 || ^4.0.0"
|
|
187
|
-
},
|
|
188
|
-
"peerDependencies": {
|
|
189
|
-
"@earendil-works/pi-ai": "^0.84.1 || ^0.85.0 || ^0.86.0 || ^0.87.0",
|
|
190
|
-
"@earendil-works/pi-tui": "*",
|
|
191
|
-
"typebox": "*",
|
|
192
|
-
"zod": "^3.25.0 || ^4.0.0"
|
|
193
|
-
},
|
|
194
|
-
"peerDependenciesMeta": {
|
|
195
|
-
"@earendil-works/pi-ai": {
|
|
196
|
-
"optional": true
|
|
197
|
-
},
|
|
198
|
-
"@earendil-works/pi-tui": {
|
|
199
|
-
"optional": true
|
|
200
|
-
},
|
|
201
|
-
"typebox": {
|
|
202
|
-
"optional": true
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
"devDependencies": {
|
|
206
|
-
"@earendil-works/pi-ai": "0.87.0",
|
|
207
|
-
"@earendil-works/pi-coding-agent": "0.87.0",
|
|
208
|
-
"@earendil-works/pi-tui": "0.87.0",
|
|
209
|
-
"@modelcontextprotocol/conformance": "0.1.16",
|
|
210
|
-
"@types/bun": "^1.0.0",
|
|
211
|
-
"@types/cross-spawn": "6.0.6",
|
|
212
|
-
"@types/node": "20.19.43",
|
|
213
|
-
"@types/open": "^6.2.1",
|
|
214
|
-
"tsx": "^4.21.0",
|
|
215
|
-
"typebox": "1.3.3",
|
|
216
|
-
"typescript": "5.9.3",
|
|
217
|
-
"vitest": "^3.0.0"
|
|
218
|
-
}
|
|
219
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { matchesKey, type KeyId } from "@earendil-works/pi-tui";
|
|
2
|
-
|
|
3
|
-
/** The panel keybinding ids the adapter panels resolve through pi-tui. */
|
|
4
|
-
export type PanelSelectKeybinding =
|
|
5
|
-
| "tui.select.up"
|
|
6
|
-
| "tui.select.down"
|
|
7
|
-
| "tui.select.confirm";
|
|
8
|
-
|
|
9
|
-
/** Structural subset of pi-tui's `KeybindingsManager` (which satisfies it). */
|
|
10
|
-
export interface PanelKeybindings {
|
|
11
|
-
matches(data: string, keybinding: PanelSelectKeybinding): boolean;
|
|
12
|
-
getUserBindings?(): Record<string, KeyId | KeyId[] | undefined>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Key matchers for panel actions: user bindings when a manager is provided,
|
|
17
|
-
* otherwise the previous hardcoded defaults.
|
|
18
|
-
*/
|
|
19
|
-
export interface PanelKeys {
|
|
20
|
-
selectUp(data: string): boolean;
|
|
21
|
-
selectDown(data: string): boolean;
|
|
22
|
-
selectConfirm(data: string): boolean;
|
|
23
|
-
save(data: string): boolean;
|
|
24
|
-
saveLabel(): string | null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function configuredSaveKeys(keybindings?: PanelKeybindings): { keys: KeyId[]; configured: boolean } {
|
|
28
|
-
const explicit = keybindings?.getUserBindings?.()["mcp.panel.save"];
|
|
29
|
-
if (explicit !== undefined) return { keys: Array.isArray(explicit) ? explicit : [explicit], configured: true };
|
|
30
|
-
return { keys: [], configured: false };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function createPanelKeys(keybindings?: PanelKeybindings): PanelKeys {
|
|
34
|
-
const saveBinding = configuredSaveKeys(keybindings);
|
|
35
|
-
if (keybindings) {
|
|
36
|
-
return {
|
|
37
|
-
selectUp: (data) => keybindings.matches(data, "tui.select.up"),
|
|
38
|
-
selectDown: (data) => keybindings.matches(data, "tui.select.down"),
|
|
39
|
-
selectConfirm: (data) => keybindings.matches(data, "tui.select.confirm"),
|
|
40
|
-
save: (data) => saveBinding.keys.length > 0
|
|
41
|
-
? saveBinding.keys.some((key) => matchesKey(data, key))
|
|
42
|
-
: !saveBinding.configured && matchesKey(data, "ctrl+s"),
|
|
43
|
-
saveLabel: () => saveBinding.keys[0] ?? (saveBinding.configured ? null : "ctrl+s"),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
selectUp: (data) => matchesKey(data, "up"),
|
|
48
|
-
selectDown: (data) => matchesKey(data, "down"),
|
|
49
|
-
selectConfirm: (data) => matchesKey(data, "return"),
|
|
50
|
-
save: (data) => matchesKey(data, "ctrl+s"),
|
|
51
|
-
saveLabel: () => "ctrl+s",
|
|
52
|
-
};
|
|
53
|
-
}
|