@fitchmultz/pi-mcp-adapter 7.1.1 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -7
- package/LICENSE +1 -0
- package/OAUTH.md +4 -4
- package/README.md +43 -860
- package/dist/app-bridge.bundle.js +13 -13
- package/dist/config.js +1 -1
- package/dist/direct-tools.js +6 -5
- package/dist/error-signal.d.ts +3 -5
- package/dist/error-signal.js +3 -5
- package/dist/index.js +0 -11
- package/dist/init.js +0 -1
- package/dist/lifecycle.d.ts +0 -4
- package/dist/lifecycle.js +1 -14
- package/dist/mcp-auth-flow.d.ts +3 -9
- package/dist/mcp-auth-flow.js +4 -43
- package/dist/mcp-code.js +0 -1
- package/dist/mcp-output-guard.d.ts +5 -0
- package/dist/mcp-output-guard.js +55 -1
- package/dist/mcp-setup-panel.js +1 -1
- package/dist/proxy-modes.d.ts +1 -1
- package/dist/proxy-modes.js +89 -9
- package/dist/runtime-owner.d.ts +0 -4
- package/dist/runtime-owner.js +5 -18
- package/dist/server-manager.d.ts +2 -9
- package/dist/server-manager.js +7 -99
- package/dist/tool-loader.js +35 -6
- package/dist/tool-registrar.d.ts +11 -0
- package/dist/tool-registrar.js +23 -0
- package/dist/types.d.ts +5 -0
- package/dist/ui-message-history.d.ts +11 -0
- package/dist/ui-message-history.js +81 -0
- package/dist/ui-server.js +17 -10
- package/dist/ui-session.js +3 -2
- package/package.json +10 -13
- package/dist/checkpoint.d.ts +0 -18
- package/dist/checkpoint.js +0 -53
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fitchmultz/pi-mcp-adapter",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "8.0.1",
|
|
4
|
+
"description": "Token-efficient MCP adapter for the Pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"author": "Mitch Fultz",
|
|
19
|
-
"contributors": [
|
|
20
|
-
"Nico Bailon"
|
|
21
|
-
],
|
|
22
19
|
"homepage": "https://github.com/fitchmultz/pi-mcp-adapter",
|
|
23
20
|
"bugs": "https://github.com/fitchmultz/pi-mcp-adapter/issues",
|
|
24
21
|
"publishConfig": {
|
|
@@ -76,14 +73,14 @@
|
|
|
76
73
|
"LICENSE"
|
|
77
74
|
],
|
|
78
75
|
"dependencies": {
|
|
79
|
-
"@modelcontextprotocol/client": "2.
|
|
80
|
-
"@modelcontextprotocol/core": "2.
|
|
76
|
+
"@modelcontextprotocol/client": "2.3.1",
|
|
77
|
+
"@modelcontextprotocol/core": "2.3.1",
|
|
81
78
|
"@modelcontextprotocol/ext-apps": "2.0.3",
|
|
82
79
|
"@napi-rs/keyring": "2.1.0",
|
|
83
80
|
"cross-spawn": "7.0.6",
|
|
84
81
|
"minisearch": "7.2.0",
|
|
85
82
|
"open": "11.0.4",
|
|
86
|
-
"smol-toml": "1.9.
|
|
83
|
+
"smol-toml": "1.9.1",
|
|
87
84
|
"strip-json-comments": "5.0.3",
|
|
88
85
|
"zod": "4.6.5"
|
|
89
86
|
},
|
|
@@ -108,12 +105,12 @@
|
|
|
108
105
|
}
|
|
109
106
|
},
|
|
110
107
|
"devDependencies": {
|
|
111
|
-
"@earendil-works/pi-ai": "0.
|
|
112
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
113
|
-
"@earendil-works/pi-tui": "0.
|
|
114
|
-
"@modelcontextprotocol/server": "2.
|
|
108
|
+
"@earendil-works/pi-ai": "1.0.0",
|
|
109
|
+
"@earendil-works/pi-coding-agent": "1.0.0",
|
|
110
|
+
"@earendil-works/pi-tui": "1.0.0",
|
|
111
|
+
"@modelcontextprotocol/server": "2.3.1",
|
|
115
112
|
"@types/cross-spawn": "6.0.6",
|
|
116
|
-
"@types/node": "24.19.
|
|
113
|
+
"@types/node": "24.19.1",
|
|
117
114
|
"esbuild": "0.28.2",
|
|
118
115
|
"typebox": "1.3.27",
|
|
119
116
|
"typescript": "7.0.2",
|
package/dist/checkpoint.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import type { McpExtensionState } from "./state.ts";
|
|
3
|
-
/** Optional host event. Published Pi hosts without this event simply never emit it.
|
|
4
|
-
* Keep its structural typing local; do not require a private host package/version. */
|
|
5
|
-
export interface McpCheckpointEvent {
|
|
6
|
-
readonly boundary: "turn" | "settled";
|
|
7
|
-
readonly signal: AbortSignal;
|
|
8
|
-
invalidate(): void;
|
|
9
|
-
}
|
|
10
|
-
export type McpCheckpointResult = {
|
|
11
|
-
sleepReady: true;
|
|
12
|
-
} | {
|
|
13
|
-
sleepReady: false;
|
|
14
|
-
reason: string;
|
|
15
|
-
};
|
|
16
|
-
export declare function onSessionCheckpoint(pi: ExtensionAPI, handler: (event: McpCheckpointEvent) => Promise<McpCheckpointResult>): void;
|
|
17
|
-
/** No shutdown, credential copying, connection replay or permanent owner cancellation. */
|
|
18
|
-
export declare function prepareMcpCheckpoint(state: McpExtensionState, event: McpCheckpointEvent): Promise<McpCheckpointResult>;
|
package/dist/checkpoint.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { flushMetadataCache } from "./init.js";
|
|
2
|
-
import { getOAuthCheckpointBlocker, holdOAuthCheckpoint } from "./mcp-auth-flow.js";
|
|
3
|
-
import { isServerDisabled } from "./types.js";
|
|
4
|
-
export function onSessionCheckpoint(pi, handler) {
|
|
5
|
-
pi.on("session_checkpoint", handler);
|
|
6
|
-
}
|
|
7
|
-
/** No shutdown, credential copying, connection replay or permanent owner cancellation. */
|
|
8
|
-
export async function prepareMcpCheckpoint(state, event) {
|
|
9
|
-
event.signal.throwIfAborted();
|
|
10
|
-
const releases = [];
|
|
11
|
-
const release = () => { for (const undo of releases.splice(0).reverse())
|
|
12
|
-
undo(); };
|
|
13
|
-
// Fence all owned sources synchronously, before the first await (including trace flush).
|
|
14
|
-
event.signal.addEventListener("abort", release, { once: true });
|
|
15
|
-
const undo = () => { release(); event.signal.removeEventListener("abort", release); };
|
|
16
|
-
const blocked = (reason) => { undo(); return { sleepReady: false, reason }; };
|
|
17
|
-
try {
|
|
18
|
-
releases.push(state.owner.holdCheckpoint(event));
|
|
19
|
-
releases.push(state.manager.holdCheckpoint(event));
|
|
20
|
-
releases.push(holdOAuthCheckpoint(state.oauthRuntime, event));
|
|
21
|
-
releases.push(state.lifecycle.pauseForCheckpoint());
|
|
22
|
-
if (state.lifecycle.hasActiveHealthCheck())
|
|
23
|
-
return blocked("MCP health check is active");
|
|
24
|
-
for (const [name, definition] of Object.entries(state.config.mcpServers)) {
|
|
25
|
-
if (!isServerDisabled(definition) && !definition.url)
|
|
26
|
-
return blocked(`MCP ${name}: stdio/Unix server state is not reconstructible`);
|
|
27
|
-
}
|
|
28
|
-
const callback = state.owner.getCheckpointBlocker();
|
|
29
|
-
if (callback)
|
|
30
|
-
return blocked(callback);
|
|
31
|
-
if (state.activeScripts)
|
|
32
|
-
return blocked("MCP script is active");
|
|
33
|
-
if (state.uiServer || state.completedUiSessions.length)
|
|
34
|
-
return blocked("MCP UI session/messages require the running runtime");
|
|
35
|
-
if (state.approvedToolCalls.size || state.consentManager.hasDecisions())
|
|
36
|
-
return blocked("MCP session approvals are not persisted");
|
|
37
|
-
const oauth = getOAuthCheckpointBlocker(state.oauthRuntime);
|
|
38
|
-
if (oauth)
|
|
39
|
-
return blocked(oauth);
|
|
40
|
-
const manager = state.manager.getCheckpointBlocker();
|
|
41
|
-
if (manager)
|
|
42
|
-
return blocked(manager);
|
|
43
|
-
flushMetadataCache(state);
|
|
44
|
-
await state.manager.flushForCheckpoint();
|
|
45
|
-
event.signal.throwIfAborted();
|
|
46
|
-
// Release/cancellation is host-owned. Existing clients/timers remain usable afterwards.
|
|
47
|
-
return { sleepReady: true };
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
undo();
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
}
|