@foldkit/devtools-mcp 0.22.0 → 0.23.0-canary.c9c641bf8179
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 -20
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +4 -6
- package/dist/relayLocation.d.ts +9 -0
- package/dist/relayLocation.d.ts.map +1 -0
- package/dist/relayLocation.js +33 -0
- package/dist/relayRegistry.d.ts +5 -0
- package/dist/relayRegistry.d.ts.map +1 -0
- package/dist/relayRegistry.js +70 -0
- package/dist/server.js +9231 -1664
- package/dist/webSocketClient.d.ts +1 -9
- package/dist/webSocketClient.d.ts.map +1 -1
- package/dist/webSocketClient.js +9 -12
- package/package.json +13 -8
|
@@ -24,13 +24,5 @@ export type WebSocketClient = Readonly<{
|
|
|
24
24
|
sendRequest: (request: typeof Request.Type, maybeRuntimeId: Option.Option<string>) => Effect.Effect<typeof Response.Type, Cause.TimeoutError | Error>;
|
|
25
25
|
close: Effect.Effect<void>;
|
|
26
26
|
}>;
|
|
27
|
-
|
|
28
|
-
* Construct a WebSocket client that maintains its connection to the Foldkit
|
|
29
|
-
* Vite plugin's DevTools relay in the background. The Effect succeeds
|
|
30
|
-
* immediately with a client whose connection state evolves over time. The
|
|
31
|
-
* initial connect is retried with exponential backoff; later disconnects
|
|
32
|
-
* reconnect via the same loop. `sendRequest` fails with a clear "not
|
|
33
|
-
* connected" error while no relay is reachable.
|
|
34
|
-
*/
|
|
35
|
-
export declare const connectWebSocketClient: (url: string) => Effect.Effect<WebSocketClient>;
|
|
27
|
+
export declare const connectWebSocketClient: <Services>(resolveUrl: Effect.Effect<string, never, Services>) => Effect.Effect<WebSocketClient, never, Services>;
|
|
36
28
|
//# sourceMappingURL=webSocketClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webSocketClient.d.ts","sourceRoot":"","sources":["../src/webSocketClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,K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C,KACjD,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,QAAQ,CAoI7C,CAAA"}
|
package/dist/webSocketClient.js
CHANGED
|
@@ -7,6 +7,11 @@ const MAX_RECONNECT_DELAY = Duration.seconds(30);
|
|
|
7
7
|
const encodeRequestFrameToJson = Schema.encodeUnknownSync(Schema.fromJsonString(RequestFrame));
|
|
8
8
|
const generateRequestId = () => `req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
9
9
|
const reconnectSchedule = Schedule.exponential(INITIAL_RECONNECT_DELAY).pipe(Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.min(duration, MAX_RECONNECT_DELAY))));
|
|
10
|
+
const relayUrlForLog = (url) => {
|
|
11
|
+
const parsed = new URL(url);
|
|
12
|
+
parsed.search = '';
|
|
13
|
+
return parsed.toString();
|
|
14
|
+
};
|
|
10
15
|
const attemptOpen = (url) => Effect.callback(resume => {
|
|
11
16
|
const socket = new WebSocket(url);
|
|
12
17
|
let settled = false;
|
|
@@ -46,15 +51,7 @@ const waitForClose = (socket) => Effect.callback(resume => {
|
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
});
|
|
49
|
-
|
|
50
|
-
* Construct a WebSocket client that maintains its connection to the Foldkit
|
|
51
|
-
* Vite plugin's DevTools relay in the background. The Effect succeeds
|
|
52
|
-
* immediately with a client whose connection state evolves over time. The
|
|
53
|
-
* initial connect is retried with exponential backoff; later disconnects
|
|
54
|
-
* reconnect via the same loop. `sendRequest` fails with a clear "not
|
|
55
|
-
* connected" error while no relay is reachable.
|
|
56
|
-
*/
|
|
57
|
-
export const connectWebSocketClient = (url) => Effect.gen(function* () {
|
|
54
|
+
export const connectWebSocketClient = (resolveUrl) => Effect.gen(function* () {
|
|
58
55
|
const pendingResponsesRef = yield* Ref.make(HashMap.empty());
|
|
59
56
|
const currentSocketRef = yield* Ref.make(Option.none());
|
|
60
57
|
const isManuallyClosedRef = yield* Ref.make(false);
|
|
@@ -67,10 +64,10 @@ export const connectWebSocketClient = (url) => Effect.gen(function* () {
|
|
|
67
64
|
console.error(`[foldkit-devtools-mcp] socket error: ${error.message}`);
|
|
68
65
|
});
|
|
69
66
|
};
|
|
70
|
-
const openWithBackoff = pipe(attemptOpen(url), Effect.tapError(error => Console.error(`[foldkit-devtools-mcp] connect attempt failed: ${error.message}`)), Effect.retry(reconnectSchedule), Effect.orDie);
|
|
67
|
+
const openWithBackoff = pipe(resolveUrl, Effect.flatMap(url => attemptOpen(url).pipe(Effect.map(socket => ({ socket, url })), Effect.tapError(error => Console.error(`[foldkit-devtools-mcp] connect attempt to ${relayUrlForLog(url)} failed: ${error.message}`)))), Effect.retry(reconnectSchedule), Effect.orDie);
|
|
71
68
|
const maintainConnection = Effect.gen(function* () {
|
|
72
|
-
const socket = yield* openWithBackoff;
|
|
73
|
-
yield* Console.error(`[foldkit-devtools-mcp] connected to ${url}`);
|
|
69
|
+
const { socket, url } = yield* openWithBackoff;
|
|
70
|
+
yield* Console.error(`[foldkit-devtools-mcp] connected to ${relayUrlForLog(url)}`);
|
|
74
71
|
attachMessageHandler(socket);
|
|
75
72
|
yield* Ref.set(currentSocketRef, Option.some(socket));
|
|
76
73
|
yield* waitForClose(socket);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldkit/devtools-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0-canary.c9c641bf8179",
|
|
4
4
|
"description": "MCP server exposing Foldkit DevTools to AI agents (Claude Code, Cursor, etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/server.js",
|
|
@@ -16,21 +16,25 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"effect": "4.0.0-rc.
|
|
20
|
-
"foldkit": "
|
|
19
|
+
"effect": "4.0.0-rc.117",
|
|
20
|
+
"foldkit": "0.164.0-canary.c9c641bf8179"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
24
24
|
"ws": "^8.21.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@
|
|
27
|
+
"@effect/platform-node": "4.0.0-rc.117",
|
|
28
|
+
"@types/node": "26.4.0",
|
|
28
29
|
"@types/ws": "^8.18.1",
|
|
29
|
-
"effect": "4.0.0-rc.
|
|
30
|
+
"effect": "4.0.0-rc.117",
|
|
30
31
|
"rimraf": "^6.1.3",
|
|
31
|
-
"rolldown": "^1.2.
|
|
32
|
+
"rolldown": "^1.2.11",
|
|
32
33
|
"typescript": "^7.0.2",
|
|
33
|
-
"
|
|
34
|
+
"vite": "^8.3.1",
|
|
35
|
+
"vitest": "^4.1.11",
|
|
36
|
+
"@foldkit/vite-plugin": "0.25.0-canary.c9c641bf8179",
|
|
37
|
+
"foldkit": "0.164.0-canary.c9c641bf8179"
|
|
34
38
|
},
|
|
35
39
|
"files": [
|
|
36
40
|
"dist"
|
|
@@ -61,6 +65,7 @@
|
|
|
61
65
|
"build": "pnpm run clean && tsc -b && pnpm run bundle",
|
|
62
66
|
"bundle": "rolldown -c rolldown.config.ts",
|
|
63
67
|
"watch": "tsc -b --watch",
|
|
64
|
-
"typecheck": "tsc -b --noEmit"
|
|
68
|
+
"typecheck": "tsc -b --noEmit && tsc -p tsconfig.test.json",
|
|
69
|
+
"test": "vitest run"
|
|
65
70
|
}
|
|
66
71
|
}
|