@foldkit/devtools-mcp 0.25.0-canary.7ee214268c60 → 0.25.0-canary.90746b32d2ca
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 +29 -23
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +2 -2
- package/dist/relayClient.d.ts +2 -2
- package/dist/relayClient.d.ts.map +1 -1
- package/dist/relayLocation.d.ts.map +1 -1
- package/dist/relayRegistry.d.ts.map +1 -1
- package/dist/relayRegistryTrust.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +42 -36
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +6 -6
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ With it attached, agents can:
|
|
|
6
6
|
|
|
7
7
|
- Read the current Model, or any historical Model by history index
|
|
8
8
|
- Narrow reads with dot-string paths and summarized payloads to fit token budgets
|
|
9
|
-
- List and inspect the Message history, with Command and Mount lifecycle, diffs, and
|
|
9
|
+
- List and inspect the Message history, with Command and Mount lifecycle, diffs, and Block chains
|
|
10
10
|
- Query history server-side: filter entries by changed Model paths, count Messages by tag, tail the latest entries, and diff the Models at two indices
|
|
11
11
|
- Read the recorded init Model, the Commands returned from `init`, and the Mounts that fired during the first render
|
|
12
12
|
- Inspect Runtime state: current index, retained history bounds, pause status
|
|
@@ -36,17 +36,21 @@ pnpm add -D @foldkit/devtools-mcp
|
|
|
36
36
|
yarn add -D @foldkit/devtools-mcp
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Set `devTools.dispatch` to `true` when calling `Program.make` to let the agent discover and dispatch Messages. Foldkit derives the dispatch Schema from the completed root Block, including generated envelopes for registered child Blocks. The Runtime rejects a payload that does not match that Schema before it reaches update:
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
|
-
|
|
42
|
+
Program.make({
|
|
43
|
+
block: ApplicationBlock,
|
|
44
|
+
container,
|
|
43
45
|
devTools: {
|
|
44
46
|
// Rest of your DevTools config
|
|
45
|
-
|
|
47
|
+
dispatch: true,
|
|
46
48
|
},
|
|
47
49
|
})
|
|
48
50
|
```
|
|
49
51
|
|
|
52
|
+
If the completed Message Codec needs Services for decoding, `dispatch: true` adds them to the Program's requirements. Supply any remaining decoding Services through `program.provide(...)`; the dispatch opt-in does not provide them.
|
|
53
|
+
|
|
50
54
|
Restart your dev server, then restart your AI agent. The MCP server will appear with the `foldkit_*` tools attached.
|
|
51
55
|
|
|
52
56
|
The browser bridge runs inside your app, so the MCP server only sees a Runtime while the app is open in a browser tab. Close the tab and the Runtime disappears from `foldkit_list_runtimes`.
|
|
@@ -57,29 +61,29 @@ Treat this server as privileged access to the running application. A connected a
|
|
|
57
61
|
|
|
58
62
|
Keep API keys, passwords, access and refresh tokens, authorization headers, session material, and private personal data out of those values. Long-lived secrets belong behind a server boundary, including in local demos. If the browser must temporarily carry a sensitive value, use Effect `Redacted` with a `Schema.Redacted` field configured with `disallowJsonEncode: true`. `Redacted` protects normal string, JSON, and inspection output; it does not encrypt the value or hide a browser-side credential from the person running the browser.
|
|
59
63
|
|
|
60
|
-
`excludeFromHistory` is for noisy Messages, not sensitive ones. The resulting Model remains inspectable.
|
|
64
|
+
`excludeFromHistory` is for noisy Messages, not sensitive ones. The resulting Model remains inspectable. External dispatch is disabled by default; read and replay tools remain available. Set `devToolsMcpPort: false` in the Foldkit Vite plugin options to keep the in-browser DevTools without starting the MCP relay, or set `devTools: false` in the application config to disable recording and the browser bridge too.
|
|
61
65
|
|
|
62
66
|
## Tools
|
|
63
67
|
|
|
64
68
|
Every tool except `foldkit_list_runtimes` accepts an optional `runtime_id`. Without one, the tool uses the most recently connected Runtime of the most recently started dev server.
|
|
65
69
|
|
|
66
|
-
| Tool | Description
|
|
67
|
-
| ------------------------------- |
|
|
68
|
-
| `foldkit_list_runtimes` | Returns metadata for every connected browser tab. Each tab carries the `projectRoot` of the dev server it belongs to, unless `FOLDKIT_DEVTOOLS_MCP_PORT` or `FOLDKIT_DEVTOOLS_MCP_HOST` is set. Agents call this first to discover which Runtime to target.
|
|
69
|
-
| `foldkit_get_model` | Snapshots the current Model. Accepts an optional `path` to narrow to a subtree and `expand` to control summarization.
|
|
70
|
-
| `foldkit_get_model_at` | Snapshots a historical Model after a given history entry. Pass `index: N - 1` to read the Model just before Message `N`. Same `path`/`expand` semantics as `foldkit_get_model`. Indices outside the readable range (older entries are evicted past the rolling buffer) are rejected with the valid bounds. For the initial Model (and the init Commands and Mounts), use `foldkit_get_init`.
|
|
71
|
-
| `foldkit_get_init` | Reads the recorded initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. Each Command and Mount carries its declared args. Equivalent to selecting the synthetic "init" row in the DevTools panel.
|
|
72
|
-
| `foldkit_get_runtime_state` | Snapshots the Runtime's DevTools state: history bounds, current paused/live status, and whether init is recorded. Useful for understanding what `foldkit_list_messages` and `foldkit_get_message` will see and detecting whether the Runtime is paused.
|
|
73
|
-
| `foldkit_list_messages` | Lists Message history entries. Each entry carries the Message body, Commands triggered (with args), Mounts that started or ended during the resulting render (with args), timestamp, an `isModelChanged` flag, the diff path lists (`changedPaths` / `affectedPaths`), and any extracted
|
|
74
|
-
| `foldkit_count_messages_by_tag` | Counts retained history entries by Message tag, without payloads, sorted by count descending. A cheap reconnaissance call before paging through history: it surfaces the high-frequency Messages worth filtering out, and with `changed_paths_match` it answers which Message tags touch a Model subtree.
|
|
75
|
-
| `foldkit_diff_models` | Diffs the Models at two history indices server-side, returning path-level changes `{ path, before, after }` with summarized values. Each side is `{ _tag: 'Present', value }`, or `{ _tag: 'Absent' }` when the path does not exist on that side. Pass `changed_paths_match` to narrow the diff to a subtree.
|
|
76
|
-
| `foldkit_get_message` | Reads one entry at a given index. The response carries the SerializedEntry only; to inspect the Model around the entry, call `foldkit_get_model_at` with `index - 1` (before) and `index` (after). Use `foldkit_get_init` for the synthetic init entry.
|
|
77
|
-
| `foldkit_list_keyframes` | Returns the indices Foldkit can replay back to. Index `-1` is the initial Model.
|
|
78
|
-
| `foldkit_replay_to_keyframe` | Time-travels the Runtime to a previous state. The Runtime is paused at that snapshot until `foldkit_resume` is called.
|
|
79
|
-
| `foldkit_resume` | Resumes normal execution after a replay.
|
|
80
|
-
| `foldkit_get_message_schema` | Describes the Runtime's Message Schema so agents can construct valid Messages without reading the application source. With no arguments, returns a small variant index (top-level tag names plus payload fields). With `variant_tag` set to a dot-separated path of variant tags (e.g. `"GotChildMessage.Opened"`), narrows the JSON Schema along the chain and collapses deeper unions to summary placeholders. Returns `maybeResult: None` when
|
|
81
|
-
| `foldkit_dispatch_message` | Dispatches a Message into the Runtime as if your application produced it. The Runtime decodes the payload against your Schema and returns a clean error if it does not match.
|
|
82
|
-
| `foldkit_dispatch_messages` | Dispatches an ordered batch of 1 to 100 Messages in one call, first to last. The Runtime validates every payload before dispatching any of them, so one invalid entry rejects the whole batch with its zero-based position and nothing is dispatched. The response reports the predicted history index for each Message.
|
|
70
|
+
| Tool | Description |
|
|
71
|
+
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `foldkit_list_runtimes` | Returns metadata for every connected browser tab. Each tab carries the `projectRoot` of the dev server it belongs to, unless `FOLDKIT_DEVTOOLS_MCP_PORT` or `FOLDKIT_DEVTOOLS_MCP_HOST` is set. Agents call this first to discover which Runtime to target. |
|
|
73
|
+
| `foldkit_get_model` | Snapshots the current Model. Accepts an optional `path` to narrow to a subtree and `expand` to control summarization. |
|
|
74
|
+
| `foldkit_get_model_at` | Snapshots a historical Model after a given history entry. Pass `index: N - 1` to read the Model just before Message `N`. Same `path`/`expand` semantics as `foldkit_get_model`. Indices outside the readable range (older entries are evicted past the rolling buffer) are rejected with the valid bounds. For the initial Model (and the init Commands and Mounts), use `foldkit_get_init`. |
|
|
75
|
+
| `foldkit_get_init` | Reads the recorded initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. Each Command and Mount carries its declared args. Equivalent to selecting the synthetic "init" row in the DevTools panel. |
|
|
76
|
+
| `foldkit_get_runtime_state` | Snapshots the Runtime's DevTools state: history bounds, current paused/live status, and whether init is recorded. Useful for understanding what `foldkit_list_messages` and `foldkit_get_message` will see and detecting whether the Runtime is paused. |
|
|
77
|
+
| `foldkit_list_messages` | Lists Message history entries. Each entry carries the Message body, Commands triggered (with args), Mounts that started or ended during the resulting render (with args), timestamp, an `isModelChanged` flag, the diff path lists (`changedPaths` / `affectedPaths`), and any extracted Block chain. Filter server-side with `changed_paths_match`, read the latest entries with `from_end`, and paginate forward with `since_index`. |
|
|
78
|
+
| `foldkit_count_messages_by_tag` | Counts retained history entries by Message tag, without payloads, sorted by count descending. A cheap reconnaissance call before paging through history: it surfaces the high-frequency Messages worth filtering out, and with `changed_paths_match` it answers which Message tags touch a Model subtree. |
|
|
79
|
+
| `foldkit_diff_models` | Diffs the Models at two history indices server-side, returning path-level changes `{ path, before, after }` with summarized values. Each side is `{ _tag: 'Present', value }`, or `{ _tag: 'Absent' }` when the path does not exist on that side. Pass `changed_paths_match` to narrow the diff to a subtree. |
|
|
80
|
+
| `foldkit_get_message` | Reads one entry at a given index. The response carries the SerializedEntry only; to inspect the Model around the entry, call `foldkit_get_model_at` with `index - 1` (before) and `index` (after). Use `foldkit_get_init` for the synthetic init entry. |
|
|
81
|
+
| `foldkit_list_keyframes` | Returns the indices Foldkit can replay back to. Index `-1` is the initial Model. |
|
|
82
|
+
| `foldkit_replay_to_keyframe` | Time-travels the Runtime to a previous state. The Runtime is paused at that snapshot until `foldkit_resume` is called. |
|
|
83
|
+
| `foldkit_resume` | Resumes normal execution after a replay. |
|
|
84
|
+
| `foldkit_get_message_schema` | Describes the Runtime's Message Schema so agents can construct valid Messages without reading the application source. With no arguments, returns a small variant index (top-level tag names plus payload fields). With `variant_tag` set to a dot-separated path of variant tags (e.g. `"GotChildMessage.Opened"`), narrows the JSON Schema along the chain and collapses deeper unions to summary placeholders. Returns `maybeResult: None` when external dispatch is not enabled. |
|
|
85
|
+
| `foldkit_dispatch_message` | Dispatches a Message into the Runtime as if your application produced it. The Runtime decodes the payload against your Schema and returns a clean error if it does not match. |
|
|
86
|
+
| `foldkit_dispatch_messages` | Dispatches an ordered batch of 1 to 100 Messages in one call, first to last. The Runtime validates every payload before dispatching any of them, so one invalid entry rejects the whole batch with its zero-based position and nothing is dispatched. The response reports the predicted history index for each Message. |
|
|
83
87
|
|
|
84
88
|
### Reading the Model efficiently
|
|
85
89
|
|
|
@@ -107,6 +111,8 @@ Three components cooperate:
|
|
|
107
111
|
|
|
108
112
|
Multiple browser tabs can be connected at once and each is addressable by its connection id. Tabs that close (gracefully or not) are pruned from the live Runtime list automatically.
|
|
109
113
|
|
|
114
|
+
The bridge derives JSON Schema for its transport boundary. A Message payload must have a supported JSON representation to be dispatched from MCP. Browser-memory values such as `File` cannot be constructed through this connection.
|
|
115
|
+
|
|
110
116
|
## Configuration
|
|
111
117
|
|
|
112
118
|
An agent started at a workspace root can inspect every Foldkit app running under it. If no dev server runs under the agent's project root, the MCP server finds the nearest root that encloses it. This also lets an agent started in `src/` or through a symlink find the app. `foldkit_list_runtimes` lists the Runtimes from every matching dev server and includes each server's `projectRoot`.
|
|
@@ -127,7 +133,7 @@ On Windows, both processes use PowerShell to check the directory's owner, access
|
|
|
127
133
|
## Notes
|
|
128
134
|
|
|
129
135
|
- The MCP bridge shares its lifecycle with Foldkit DevTools. If you set `devTools: false` in your program config, the bridge does not start and the Runtime is invisible to MCP. The default enables the bridge in dev.
|
|
130
|
-
-
|
|
136
|
+
- External dispatch and Message Schema discovery require `devTools: { dispatch: true }`. The other tools still work with the default configuration.
|
|
131
137
|
- The relay only runs at dev time. Production builds never include the relay or the bridge, regardless of any `show` setting.
|
|
132
138
|
|
|
133
139
|
## Documentation
|
package/dist/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","
|
|
1
|
+
{"version":3,"file":"install.d.ts","sources":["../src/install.ts"],"names":[],"mappings":"AAoEA;;;;;GAKG;AACH,eAAO,MAAM,OAAO,QAAO,IAkB1B,CAAA"}
|
package/dist/install.js
CHANGED
|
@@ -36,9 +36,9 @@ const printNextSteps = (alreadyRegistered) => {
|
|
|
36
36
|
console.log('');
|
|
37
37
|
console.log('Next steps:');
|
|
38
38
|
console.log('');
|
|
39
|
-
console.log(' 1.
|
|
39
|
+
console.log(' 1. Enable Message dispatch in Program.make or Program.makeElement:');
|
|
40
40
|
console.log('');
|
|
41
|
-
console.log(' devTools: {
|
|
41
|
+
console.log(' devTools: { dispatch: true }');
|
|
42
42
|
console.log('');
|
|
43
43
|
console.log(' 2. Start your dev server, then restart your AI agent (Claude Code, Cursor, etc.).');
|
|
44
44
|
console.log('');
|
package/dist/relayClient.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type Cause, Effect, Option } from 'effect';
|
|
|
2
2
|
import { Request, type Response, type RuntimeInfo } from 'foldkit/devtools-protocol';
|
|
3
3
|
import type { RelayTarget } from './relayLocation.js';
|
|
4
4
|
export type ListedRuntime = Readonly<{
|
|
5
|
-
runtime:
|
|
5
|
+
runtime: RuntimeInfo;
|
|
6
6
|
maybeProjectRoot: Option.Option<string>;
|
|
7
7
|
}>;
|
|
8
8
|
/**
|
|
@@ -25,7 +25,7 @@ export type ListedRuntime = Readonly<{
|
|
|
25
25
|
*/
|
|
26
26
|
export type RelayClient = Readonly<{
|
|
27
27
|
listRuntimes: Effect.Effect<ReadonlyArray<ListedRuntime>, Error>;
|
|
28
|
-
sendRequest: (request:
|
|
28
|
+
sendRequest: (request: Request, maybeRuntimeId: Option.Option<string>) => Effect.Effect<Response, Cause.TimeoutError | Error>;
|
|
29
29
|
close: Effect.Effect<void>;
|
|
30
30
|
}>;
|
|
31
31
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayClient.d.ts","
|
|
1
|
+
{"version":3,"file":"relayClient.d.ts","sources":["../src/relayClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EAKV,MAAM,EAKN,MAAM,EASP,MAAM,QAAQ,CAAA;AACf,OAAO,EACL,OAAO,EAEP,KAAK,QAAQ,EAEb,KAAK,WAAW,EACjB,MAAM,2BAA2B,CAAA;AAIlC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAqDrD,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,OAAO,EAAE,WAAW,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;CACxC,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,CAAA;IAChE,WAAW,EAAE,CACX,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAClC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,CAAA;IACxD,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CAC3B,CAAC,CAAA;AAiBF;;;GAGG;AACH,eAAO,MAAM,WAAW,UAAW,KAAK,KAAG,MACe,CAAA;AA4H1D,eAAO,MAAM,eAAe,GAAI,QAAQ,kBACtB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KACzE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAkTzC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayLocation.d.ts","
|
|
1
|
+
{"version":3,"file":"relayLocation.d.ts","sources":["../src/relayLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAGzD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAE3B,MAAM,oBAAoB,CAAA;AAS3B,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1C,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1C,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;CACxC,CAAC,CAAA;AAEF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAe5B,CAAA;AAmDrB,eAAO,MAAM,kBAAkB,aACnB,QAAQ,KACjB,MAAM,CAAC,MAAM,CAAC,MAAM,CAiBtB,CAAA;AAED,eAAO,MAAM,mBAAmB,aACpB,QAAQ,kBACF,mBAAmB,KAClC,MAAM,CAAC,MAAM,CACd,aAAa,CAAC,WAAW,CAAC,EAC1B,KAAK,EACL,qBAAqB,GAAG,mBAAmB,CAAC,mBAAmB,CAmB7D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayRegistry.d.ts","
|
|
1
|
+
{"version":3,"file":"relayRegistry.d.ts","sources":["../src/relayRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EACN,UAAU,EACV,OAAO,EAGP,IAAI,EACJ,GAAG,EAIJ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAGL,WAAW,EACZ,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,yBAAyB,CAAA;AAMhC,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAA;AAErE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,KAAK,EAAE,kBAAkB,CAAA;IACzB,gBAAgB,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;CACnD,CAAC,CAAA;AAEF,KAAK,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,GAAG,KAAK,CAAC,CAAA;AA8FrE,eAAO,MAAM,YAAY,SACjB,MAAM,aACD,MAAM,WACR,WAAW,KACnB,OASF,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,CASnE,CAAA;AAwEJ,eAAO,MAAM,cAAc,gBACZ,MAAM,kBACH,mBAAmB,KAClC,MAAM,CAAC,MAAM,CACd,aAAa,CAAC,WAAW,CAAC,EAC1B,KAAK,EACL,qBAAqB,GAAG,mBAAmB,CAAC,mBAAmB,CAqD7D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayRegistryTrust.d.ts","
|
|
1
|
+
{"version":3,"file":"relayRegistryTrust.d.ts","sources":["../src/relayRegistryTrust.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EACN,UAAU,EACV,MAAM,EAIP,MAAM,QAAQ,CAAA;AACf,OAAO,EAAgB,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAyElE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;CACpC,CAAC,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,OAAO,EAAE,CACP,SAAS,EAAE,MAAM,KACd,MAAM,CAAC,MAAM,CAChB,uBAAuB,EACvB,KAAK,EACL,mBAAmB,CAAC,mBAAmB,CACxC,CAAA;CACF,CAAC,CAAA;AAEF,KAAK,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,CAAA;AAE/D,eAAO,MAAM,6BAA6B,SAClC,aAAa,mBACF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KACrC,MAAM,CAAC,MAAM,CAAC,MAAM,CAkBnB,CAAA;AA2OJ,eAAO,MAAM,uBAAuB,SAC5B,MAAM,kBACI,MAAM,KACrB,MAAM,CAAC,MAAM,CAAC,MAAM,CAwCtB,CAAA;AAuFD,eAAO,MAAM,4BAA4B,gBAC1B,aAAa,CAAC,MAAM,CAAC,kBAClB,MAAM,KACrB,MAAM,CAAC,MAAM,CAAC,MAAM,CAwEtB,CAAA;AAED,eAAO,MAAM,cAAc,eAAgB,MAAM,KAAG,MAOjD,CAAA;AAEH,eAAO,MAAM,sBAAsB,cACtB,MAAM,YACP,MAAM,KACf,MAAM,CAAC,MAAM,CAAC,MAAM,CAGgB,CAAA;AAuHvC,eAAO,MAAM,qBAAqB,oBACf,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAC3B,MAAM,KAChB,MAAM,CAAC,MAAM,CACd,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EACrB,KAAK,EACL,mBAAmB,CAAC,mBAAmB,CAQrC,CAAA;AA+BJ,eAAO,MAAM,kBAAkB,EAAE,kBAgFhC,CAAA"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","
|
|
1
|
+
{"version":3,"file":"server.d.ts","sources":["../src/server.ts"],"names":[],"mappings":""}
|
package/dist/server.js
CHANGED
|
@@ -31400,7 +31400,7 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
31400
31400
|
seen.ref = def.innerType;
|
|
31401
31401
|
};
|
|
31402
31402
|
//#endregion
|
|
31403
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
31403
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
31404
31404
|
function isZ4Schema(s) {
|
|
31405
31405
|
return !!s._zod;
|
|
31406
31406
|
}
|
|
@@ -32424,7 +32424,7 @@ function datetime(params) {
|
|
|
32424
32424
|
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
32425
32425
|
}
|
|
32426
32426
|
//#endregion
|
|
32427
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
32427
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
32428
32428
|
const LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
32429
32429
|
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
32430
32430
|
LATEST_PROTOCOL_VERSION,
|
|
@@ -34319,7 +34319,7 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
34319
34319
|
}
|
|
34320
34320
|
};
|
|
34321
34321
|
//#endregion
|
|
34322
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
34322
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
34323
34323
|
/**
|
|
34324
34324
|
* Experimental task interfaces for MCP SDK.
|
|
34325
34325
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -34336,7 +34336,7 @@ function isTerminal(status) {
|
|
|
34336
34336
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
34337
34337
|
}
|
|
34338
34338
|
//#endregion
|
|
34339
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
34339
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
34340
34340
|
function getMethodLiteral(schema) {
|
|
34341
34341
|
const methodSchema = getObjectShape(schema)?.method;
|
|
34342
34342
|
if (!methodSchema) throw new Error("Schema is missing a method literal");
|
|
@@ -41775,7 +41775,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
41775
41775
|
exports.default = formatsPlugin;
|
|
41776
41776
|
}));
|
|
41777
41777
|
//#endregion
|
|
41778
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
41778
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
41779
41779
|
var import_ajv = /* @__PURE__ */ __toESM(require_ajv(), 1);
|
|
41780
41780
|
var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
|
|
41781
41781
|
function createDefaultAjvInstance() {
|
|
@@ -41851,7 +41851,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
41851
41851
|
}
|
|
41852
41852
|
};
|
|
41853
41853
|
//#endregion
|
|
41854
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
41854
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
41855
41855
|
/**
|
|
41856
41856
|
* Experimental server task features for MCP SDK.
|
|
41857
41857
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -42069,7 +42069,7 @@ var ExperimentalServerTasks = class {
|
|
|
42069
42069
|
}
|
|
42070
42070
|
};
|
|
42071
42071
|
//#endregion
|
|
42072
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
42072
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
42073
42073
|
/**
|
|
42074
42074
|
* Experimental task capability assertion helpers.
|
|
42075
42075
|
* WARNING: These APIs are experimental and may change without notice.
|
|
@@ -42114,7 +42114,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
42114
42114
|
}
|
|
42115
42115
|
}
|
|
42116
42116
|
//#endregion
|
|
42117
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
42117
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
42118
42118
|
/**
|
|
42119
42119
|
* An MCP server on top of a pluggable transport.
|
|
42120
42120
|
*
|
|
@@ -42193,14 +42193,7 @@ var Server = class extends Protocol {
|
|
|
42193
42193
|
setRequestHandler(requestSchema, handler) {
|
|
42194
42194
|
const methodSchema = getObjectShape(requestSchema)?.method;
|
|
42195
42195
|
if (!methodSchema) throw new Error("Schema is missing a method literal");
|
|
42196
|
-
|
|
42197
|
-
if (isZ4Schema(methodSchema)) {
|
|
42198
|
-
const v4Schema = methodSchema;
|
|
42199
|
-
methodValue = (v4Schema._zod?.def)?.value ?? v4Schema.value;
|
|
42200
|
-
} else {
|
|
42201
|
-
const v3Schema = methodSchema;
|
|
42202
|
-
methodValue = v3Schema._def?.value ?? v3Schema.value;
|
|
42203
|
-
}
|
|
42196
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
42204
42197
|
if (typeof methodValue !== "string") throw new Error("Schema method literal must be a string");
|
|
42205
42198
|
if (methodValue === "tools/call") {
|
|
42206
42199
|
const wrappedHandler = async (request, extra) => {
|
|
@@ -42443,13 +42436,18 @@ var Server = class extends Protocol {
|
|
|
42443
42436
|
return this.notification({ method: "notifications/prompts/list_changed" });
|
|
42444
42437
|
}
|
|
42445
42438
|
};
|
|
42446
|
-
//#endregion
|
|
42447
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
42448
42439
|
/**
|
|
42449
42440
|
* Buffers a continuous stdio stream into discrete JSON-RPC messages.
|
|
42450
42441
|
*/
|
|
42451
42442
|
var ReadBuffer = class {
|
|
42443
|
+
constructor(options) {
|
|
42444
|
+
this._maxBufferSize = options?.maxBufferSize ?? 10485760;
|
|
42445
|
+
}
|
|
42452
42446
|
append(chunk) {
|
|
42447
|
+
if ((this._buffer?.length ?? 0) + chunk.length > this._maxBufferSize) {
|
|
42448
|
+
this.clear();
|
|
42449
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
42450
|
+
}
|
|
42453
42451
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
42454
42452
|
}
|
|
42455
42453
|
readMessage() {
|
|
@@ -42471,25 +42469,30 @@ function serializeMessage(message) {
|
|
|
42471
42469
|
return JSON.stringify(message) + "\n";
|
|
42472
42470
|
}
|
|
42473
42471
|
//#endregion
|
|
42474
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
42472
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@4.6.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
42475
42473
|
/**
|
|
42476
42474
|
* Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.
|
|
42477
42475
|
*
|
|
42478
42476
|
* This transport is only available in Node.js environments.
|
|
42479
42477
|
*/
|
|
42480
42478
|
var StdioServerTransport = class {
|
|
42481
|
-
constructor(_stdin = process$1.stdin, _stdout = process$1.stdout) {
|
|
42479
|
+
constructor(_stdin = process$1.stdin, _stdout = process$1.stdout, options) {
|
|
42482
42480
|
this._stdin = _stdin;
|
|
42483
42481
|
this._stdout = _stdout;
|
|
42484
|
-
this._readBuffer = new ReadBuffer();
|
|
42485
42482
|
this._started = false;
|
|
42486
42483
|
this._ondata = (chunk) => {
|
|
42487
|
-
|
|
42488
|
-
|
|
42484
|
+
try {
|
|
42485
|
+
this._readBuffer.append(chunk);
|
|
42486
|
+
this.processReadBuffer();
|
|
42487
|
+
} catch (error) {
|
|
42488
|
+
this.onerror?.(error);
|
|
42489
|
+
this.close().catch(() => {});
|
|
42490
|
+
}
|
|
42489
42491
|
};
|
|
42490
42492
|
this._onerror = (error) => {
|
|
42491
42493
|
this.onerror?.(error);
|
|
42492
42494
|
};
|
|
42495
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
|
|
42493
42496
|
}
|
|
42494
42497
|
/**
|
|
42495
42498
|
* Starts listening for messages on stdin.
|
|
@@ -42553,9 +42556,9 @@ const printNextSteps = (alreadyRegistered) => {
|
|
|
42553
42556
|
console.log("");
|
|
42554
42557
|
console.log("Next steps:");
|
|
42555
42558
|
console.log("");
|
|
42556
|
-
console.log(" 1.
|
|
42559
|
+
console.log(" 1. Enable Message dispatch in Program.make or Program.makeElement:");
|
|
42557
42560
|
console.log("");
|
|
42558
|
-
console.log(" devTools: {
|
|
42561
|
+
console.log(" devTools: { dispatch: true }");
|
|
42559
42562
|
console.log("");
|
|
42560
42563
|
console.log(" 2. Start your dev server, then restart your AI agent (Claude Code, Cursor, etc.).");
|
|
42561
42564
|
console.log("");
|
|
@@ -42637,6 +42640,7 @@ const getDirectPropertyNames = (propertySignatures) => {
|
|
|
42637
42640
|
}
|
|
42638
42641
|
return names;
|
|
42639
42642
|
};
|
|
42643
|
+
const callableTaggedStructs = /* @__PURE__ */ new WeakSet();
|
|
42640
42644
|
const makeCallable = (tag, fields) => {
|
|
42641
42645
|
const schema = TaggedStruct(tag, fields);
|
|
42642
42646
|
const propertyNames = Object.hasOwn(fields, "_tag") ? void 0 : getDirectPropertyNames(schema.ast.propertySignatures);
|
|
@@ -42656,7 +42660,7 @@ const makeCallable = (tag, fields) => {
|
|
|
42656
42660
|
}
|
|
42657
42661
|
return output;
|
|
42658
42662
|
} : make;
|
|
42659
|
-
|
|
42663
|
+
const callable = new Proxy(function() {}, {
|
|
42660
42664
|
apply(_target, _thisArg, argumentsList) {
|
|
42661
42665
|
return construct(argumentsList[0]);
|
|
42662
42666
|
},
|
|
@@ -42670,6 +42674,8 @@ const makeCallable = (tag, fields) => {
|
|
|
42670
42674
|
return Reflect.getPrototypeOf(schema);
|
|
42671
42675
|
}
|
|
42672
42676
|
});
|
|
42677
|
+
callableTaggedStructs.add(callable);
|
|
42678
|
+
return callable;
|
|
42673
42679
|
};
|
|
42674
42680
|
const reservedUnionPropertyNames = /* @__PURE__ */ new Set(["members", "subset"]);
|
|
42675
42681
|
const taggedUnionTypeOnlyPropertyNames = /* @__PURE__ */ new Set([
|
|
@@ -42748,18 +42754,18 @@ function defineTaggedUnion(casesByTag) {
|
|
|
42748
42754
|
}
|
|
42749
42755
|
//#endregion
|
|
42750
42756
|
//#region ../foldkit/src/devTools/protocol.ts
|
|
42751
|
-
/** A serialized Command produced during a Message dispatch (or `init`). `args` is `Some` when the Command declared an args record. `
|
|
42757
|
+
/** A serialized Command produced during a Message dispatch (or `init`). `args` is `Some` when the Command declared an args record. `maybeBlockPath` is `None` until the result Message resolves, `Some([])` for a top-level result, and `Some(tags)` for a Block-routed result. */
|
|
42752
42758
|
const SerializedCommand = Struct({
|
|
42753
42759
|
name: String$2,
|
|
42754
42760
|
args: OptionFromNullOr(Record(String$2, Unknown)),
|
|
42755
|
-
|
|
42761
|
+
maybeBlockPath: OptionFromNullOr(ArraySchema(String$2))
|
|
42756
42762
|
});
|
|
42757
42763
|
/** A serialized Mount lifecycle event (start or end). `args` is `Some` when the Mount's definition declared an args record, and carries the runtime values used to construct the MountAction instance. */
|
|
42758
42764
|
const SerializedMount = Struct({
|
|
42759
42765
|
name: String$2,
|
|
42760
42766
|
args: OptionFromNullOr(Record(String$2, Unknown))
|
|
42761
42767
|
});
|
|
42762
|
-
/** A serialized history entry as it appears on the wire. `
|
|
42768
|
+
/** A serialized history entry as it appears on the wire. `blockPath` lists `Got<Child>Message` wrapper tags from outer to inner when the entry came up through a Block chain; `maybeLeafTag` is `Some` with the innermost child Message tag when one exists. `mountStarts` lists Mounts that fired during the render after this Message; `mountEnds` lists Mounts whose elements were unmounted during that render. The Messages dispatched by mount Effects appear as their own entries elsewhere in history. */
|
|
42763
42769
|
const SerializedEntry = Struct({
|
|
42764
42770
|
index: Number$1,
|
|
42765
42771
|
tag: String$2,
|
|
@@ -42771,7 +42777,7 @@ const SerializedEntry = Struct({
|
|
|
42771
42777
|
isModelChanged: Boolean$1,
|
|
42772
42778
|
changedPaths: ArraySchema(String$2),
|
|
42773
42779
|
affectedPaths: ArraySchema(String$2),
|
|
42774
|
-
|
|
42780
|
+
blockPath: ArraySchema(String$2),
|
|
42775
42781
|
maybeLeafTag: OptionFromNullOr(String$2)
|
|
42776
42782
|
});
|
|
42777
42783
|
/** Metadata about a single keyframe. The index identifies the point in history where the runtime can replay back to. */
|
|
@@ -47326,7 +47332,7 @@ const DispatchMessagesInput = Struct({
|
|
|
47326
47332
|
});
|
|
47327
47333
|
const GetMessageSchemaInput = Struct({
|
|
47328
47334
|
runtime_id: RuntimeIdField,
|
|
47329
|
-
variant_tag: optional$1(String$2.annotate({ description: "Optional dot-separated path of variant `_tag` values. When omitted, the tool returns a small variant index (tag names plus payload field names plus a tagged-union indicator) so agents can enumerate the top-level union cheaply. When provided, the tool walks the path through each variant's single tagged-union payload field, narrows the schema along the chain, and collapses any union deeper than the path to a `{ \"_summary\": \"union\", \"variants\": [...] }` placeholder. Extend the path to drill further. Examples: `\"ScrolledSidebar\"` (one top-level variant), `\"GotMobileMenuDialogMessage.GotAnimationMessage\"` (two levels of a
|
|
47335
|
+
variant_tag: optional$1(String$2.annotate({ description: "Optional dot-separated path of variant `_tag` values. When omitted, the tool returns a small variant index (tag names plus payload field names plus a tagged-union indicator) so agents can enumerate the top-level union cheaply. When provided, the tool walks the path through each variant's single tagged-union payload field, narrows the schema along the chain, and collapses any union deeper than the path to a `{ \"_summary\": \"union\", \"variants\": [...] }` placeholder. Extend the path to drill further. Examples: `\"ScrolledSidebar\"` (one top-level variant), `\"GotMobileMenuDialogMessage.GotAnimationMessage\"` (two levels of a Block chain)." }))
|
|
47330
47336
|
});
|
|
47331
47337
|
/**
|
|
47332
47338
|
* Extract the inner JSON Schema from Effect's `JsonSchema.Document` wrapper.
|
|
@@ -47435,13 +47441,13 @@ const buildTools = (relayClient) => [
|
|
|
47435
47441
|
},
|
|
47436
47442
|
{
|
|
47437
47443
|
name: "foldkit_get_message",
|
|
47438
|
-
description: "Read a single Message history entry by absolute index. The response carries the SerializedEntry (tag, message body, commands, mountStarts, mountEnds, timestamp, `isModelChanged`, `changedPaths` for leaf-level mutations, `affectedPaths` adding their ancestor paths). Each entry in `commands` carries the Command name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `
|
|
47444
|
+
description: "Read a single Message history entry by absolute index. The response carries the SerializedEntry (tag, message body, commands, mountStarts, mountEnds, timestamp, `isModelChanged`, `changedPaths` for leaf-level mutations, `affectedPaths` adding their ancestor paths). Each entry in `commands` carries the Command name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `maybeBlockPath` (`None` before the result resolves, `Some([])` for a resolved top-level Command, or `Some(tags)` for a resolved Block Command). `mountStarts` lists Mounts that fired during the render after this Message; `mountEnds` lists Mounts whose elements were unmounted during that render. Each Mount carries its `name` and `args` (`Some(record)` when the Mount declared an args schema, `None` otherwise). For Block-routed entries (tag matches `Got*Message`), the entry also carries `blockPath` listing wrapper tags from outer to inner and `maybeLeafTag` naming the innermost child Message. Model snapshots are not included; call foldkit_get_model_at with `index - 1` (before) and `index` (after) to inspect Model state around the entry.",
|
|
47439
47445
|
inputSchema: toInputSchema(GetMessageInput),
|
|
47440
47446
|
handle: runRuntimeTool(GetMessageInput, ({ index }) => Request.RequestGetMessage({ index }), relayClient)
|
|
47441
47447
|
},
|
|
47442
47448
|
{
|
|
47443
47449
|
name: "foldkit_get_init",
|
|
47444
|
-
description: "Read the runtime's initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. The init entry is the synthetic row at index -1 in the DevTools panel; this tool exposes the same data without time-travelling the runtime. `maybeModel` is `None` until the runtime has finished its first render and recorded init, then stays `Some` for the rest of the runtime's life. `commands` lists init-time Commands in the order they were produced, each with its name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `
|
|
47450
|
+
description: "Read the runtime's initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. The init entry is the synthetic row at index -1 in the DevTools panel; this tool exposes the same data without time-travelling the runtime. `maybeModel` is `None` until the runtime has finished its first render and recorded init, then stays `Some` for the rest of the runtime's life. `commands` lists init-time Commands in the order they were produced, each with its name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `maybeBlockPath` (`None` before the result resolves, `Some([])` for a resolved top-level Command, or `Some(tags)` for a resolved Block Command); `mountStarts` lists Mounts whose elements appeared in the initial render, each with its name and `args` (`Some(record)` when the Mount declared an args schema, `None` otherwise).",
|
|
47445
47451
|
inputSchema: toInputSchema(GetInitInput),
|
|
47446
47452
|
handle: runRuntimeTool(GetInitInput, () => Request.RequestGetInit(), relayClient)
|
|
47447
47453
|
},
|
|
@@ -47471,19 +47477,19 @@ const buildTools = (relayClient) => [
|
|
|
47471
47477
|
},
|
|
47472
47478
|
{
|
|
47473
47479
|
name: "foldkit_get_message_schema",
|
|
47474
|
-
description: "Describe the Message Schema for a Foldkit runtime so agents can construct valid payloads for `foldkit_dispatch_message`. Call with no arguments to receive a small variant index (every top-level variant's `_tag`, its payload field names, and which payload fields are themselves tagged-union shapes). Then call with `variant_tag: \"ChosenVariant\"` to drill in. The argument is a dot-separated path of variant `_tag` values: each segment names a variant, and the walker steps through the variant's single tagged-union payload field to reach the next. So `\"GotMobileMenuDialogMessage\"` narrows one level; `\"GotMobileMenuDialogMessage.GotAnimationMessage\"` narrows two levels of a
|
|
47480
|
+
description: "Describe the Message Schema for a Foldkit runtime so agents can construct valid payloads for `foldkit_dispatch_message`. Call with no arguments to receive a small variant index (every top-level variant's `_tag`, its payload field names, and which payload fields are themselves tagged-union shapes). Then call with `variant_tag: \"ChosenVariant\"` to drill in. The argument is a dot-separated path of variant `_tag` values: each segment names a variant, and the walker steps through the variant's single tagged-union payload field to reach the next. So `\"GotMobileMenuDialogMessage\"` narrows one level; `\"GotMobileMenuDialogMessage.GotAnimationMessage\"` narrows two levels of a Block chain. Discriminated unions deeper than the supplied path collapse to `{ \"_summary\": \"union\", \"variants\": [...] }` placeholders so the response stays compact even for deeply-nested apps; extend the path to drill further. `Schema.Option` fields render as `anyOf: [{_tag: \"Some\", value}, {_tag: \"None\"}]`. The full document follows the JSON Schema draft-2020-12 shape from `Schema.toJsonSchemaDocument`: `{ dialect, schema, definitions }`. Returns `maybeResult: None` when the Program has not enabled `devTools.dispatch` (dispatch is also unavailable). Fields with no JSON representation, notably `Schema.instanceOf(File)` for user-uploaded files, render as `{type: \"null\"}`; those variants can't be dispatched via MCP because their values live in browser memory.",
|
|
47475
47481
|
inputSchema: toInputSchema(GetMessageSchemaInput),
|
|
47476
47482
|
handle: runRuntimeTool(GetMessageSchemaInput, ({ variant_tag }) => Request.RequestGetMessageSchema({ maybeVariantTag: fromNullishOr(variant_tag) }), relayClient)
|
|
47477
47483
|
},
|
|
47478
47484
|
{
|
|
47479
47485
|
name: "foldkit_dispatch_message",
|
|
47480
|
-
description: "Dispatch a Message into a Foldkit runtime, as if the application itself produced it. Requires
|
|
47486
|
+
description: "Dispatch a Message into a Foldkit runtime, as if the application itself produced it. Requires `devTools: { dispatch: true }` on the Program; without it, dispatch is rejected. Call `foldkit_get_message_schema` with no arguments to enumerate the variants, then with `variant_tag` to learn one variant's exact payload shape, before constructing the Message object. The runtime decodes the payload and returns a clean error if it doesn't match. Messages configured with excludeFromHistory are rejected before execution. A successful response identifies the confirmed recorded history entry. A child Message that becomes stale before queued execution is discarded and returns an error. To dispatch several Messages in order with one call, use foldkit_dispatch_messages.",
|
|
47481
47487
|
inputSchema: toInputSchema(DispatchMessageInput),
|
|
47482
47488
|
handle: runRuntimeTool(DispatchMessageInput, ({ message }) => Request.RequestDispatchMessage({ message }), relayClient)
|
|
47483
47489
|
},
|
|
47484
47490
|
{
|
|
47485
47491
|
name: "foldkit_dispatch_messages",
|
|
47486
|
-
description: `Dispatch an ordered batch of Messages into a Foldkit runtime in one call, first to last, as if the application produced them in quick succession. Prefer this over repeated foldkit_dispatch_message calls when staging state that takes several Messages: reproducing a bug, filling a form, or building a history fixture. Takes 1 to 100 Messages. Validation is all-or-nothing: the runtime decodes every payload against the Message Schema before dispatching any of them, and one invalid entry rejects the whole batch with an error naming its zero-based position, so there is never a partially applied prefix to clean up.
|
|
47492
|
+
description: `Dispatch an ordered batch of Messages into a Foldkit runtime in one call, first to last, as if the application produced them in quick succession. Prefer this over repeated foldkit_dispatch_message calls when staging state that takes several Messages: reproducing a bug, filling a form, or building a history fixture. Takes 1 to 100 Messages. Validation is all-or-nothing: the runtime decodes every payload against the Message Schema before dispatching any of them, and one invalid entry rejects the whole batch with an error naming its zero-based position, so there is never a partially applied prefix to clean up. Messages excluded from history are rejected before dispatch. On success, acceptedAtIndices contains the exact recorded history indices in request order. A Message whose captured child occurrence becomes stale before queued execution is omitted, while unrelated Messages recorded between batch entries keep their own indices. Requires devTools: { dispatch: true }, like foldkit_dispatch_message.`,
|
|
47487
47493
|
inputSchema: toInputSchema(DispatchMessagesInput),
|
|
47488
47494
|
handle: runRuntimeTool(DispatchMessagesInput, ({ messages }) => Request.RequestDispatchMessages({ messages }), relayClient)
|
|
47489
47495
|
},
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAkB,MAAM,QAAQ,CAAA;AAOtD,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAA;AAsNzB,KAAK,UAAU,GAAG,QAAQ,CAAC;IACzB,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAA;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC,CAAA;AAEF,8HAA8H;AAC9H,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;CACzD,CAAC,CAAA;AAyEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,gBACR,WAAW,KACvB,aAAa,CAAC,cAAc,CAsM9B,CAAA"}
|
package/dist/tools.js
CHANGED
|
@@ -104,7 +104,7 @@ const DispatchMessagesInput = Schema.Struct({
|
|
|
104
104
|
}),
|
|
105
105
|
});
|
|
106
106
|
const VariantTagField = Schema.optional(Schema.String.annotate({
|
|
107
|
-
description: 'Optional dot-separated path of variant `_tag` values. When omitted, the tool returns a small variant index (tag names plus payload field names plus a tagged-union indicator) so agents can enumerate the top-level union cheaply. When provided, the tool walks the path through each variant\'s single tagged-union payload field, narrows the schema along the chain, and collapses any union deeper than the path to a `{ "_summary": "union", "variants": [...] }` placeholder. Extend the path to drill further. Examples: `"ScrolledSidebar"` (one top-level variant), `"GotMobileMenuDialogMessage.GotAnimationMessage"` (two levels of a
|
|
107
|
+
description: 'Optional dot-separated path of variant `_tag` values. When omitted, the tool returns a small variant index (tag names plus payload field names plus a tagged-union indicator) so agents can enumerate the top-level union cheaply. When provided, the tool walks the path through each variant\'s single tagged-union payload field, narrows the schema along the chain, and collapses any union deeper than the path to a `{ "_summary": "union", "variants": [...] }` placeholder. Extend the path to drill further. Examples: `"ScrolledSidebar"` (one top-level variant), `"GotMobileMenuDialogMessage.GotAnimationMessage"` (two levels of a Block chain).',
|
|
108
108
|
}));
|
|
109
109
|
const GetMessageSchemaInput = Schema.Struct({
|
|
110
110
|
runtime_id: RuntimeIdField,
|
|
@@ -212,13 +212,13 @@ export const buildTools = (relayClient) => [
|
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
name: 'foldkit_get_message',
|
|
215
|
-
description: 'Read a single Message history entry by absolute index. The response carries the SerializedEntry (tag, message body, commands, mountStarts, mountEnds, timestamp, `isModelChanged`, `changedPaths` for leaf-level mutations, `affectedPaths` adding their ancestor paths). Each entry in `commands` carries the Command name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `
|
|
215
|
+
description: 'Read a single Message history entry by absolute index. The response carries the SerializedEntry (tag, message body, commands, mountStarts, mountEnds, timestamp, `isModelChanged`, `changedPaths` for leaf-level mutations, `affectedPaths` adding their ancestor paths). Each entry in `commands` carries the Command name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `maybeBlockPath` (`None` before the result resolves, `Some([])` for a resolved top-level Command, or `Some(tags)` for a resolved Block Command). `mountStarts` lists Mounts that fired during the render after this Message; `mountEnds` lists Mounts whose elements were unmounted during that render. Each Mount carries its `name` and `args` (`Some(record)` when the Mount declared an args schema, `None` otherwise). For Block-routed entries (tag matches `Got*Message`), the entry also carries `blockPath` listing wrapper tags from outer to inner and `maybeLeafTag` naming the innermost child Message. Model snapshots are not included; call foldkit_get_model_at with `index - 1` (before) and `index` (after) to inspect Model state around the entry.',
|
|
216
216
|
inputSchema: toInputSchema(GetMessageInput),
|
|
217
217
|
handle: runRuntimeTool(GetMessageInput, ({ index }) => Request.RequestGetMessage({ index }), relayClient),
|
|
218
218
|
},
|
|
219
219
|
{
|
|
220
220
|
name: 'foldkit_get_init',
|
|
221
|
-
description: "Read the runtime's initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. The init entry is the synthetic row at index -1 in the DevTools panel; this tool exposes the same data without time-travelling the runtime. `maybeModel` is `None` until the runtime has finished its first render and recorded init, then stays `Some` for the rest of the runtime's life. `commands` lists init-time Commands in the order they were produced, each with its name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `
|
|
221
|
+
description: "Read the runtime's initial Model, the Commands returned from the application's `init` function, and the Mounts that fired during the first render. The init entry is the synthetic row at index -1 in the DevTools panel; this tool exposes the same data without time-travelling the runtime. `maybeModel` is `None` until the runtime has finished its first render and recorded init, then stays `Some` for the rest of the runtime's life. `commands` lists init-time Commands in the order they were produced, each with its name, `args` (`Some(record)` when the Command declared an args schema, `None` otherwise), and `maybeBlockPath` (`None` before the result resolves, `Some([])` for a resolved top-level Command, or `Some(tags)` for a resolved Block Command); `mountStarts` lists Mounts whose elements appeared in the initial render, each with its name and `args` (`Some(record)` when the Mount declared an args schema, `None` otherwise).",
|
|
222
222
|
inputSchema: toInputSchema(GetInitInput),
|
|
223
223
|
handle: runRuntimeTool(GetInitInput, () => Request.RequestGetInit(), relayClient),
|
|
224
224
|
},
|
|
@@ -248,7 +248,7 @@ export const buildTools = (relayClient) => [
|
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
250
|
name: 'foldkit_get_message_schema',
|
|
251
|
-
description: 'Describe the Message Schema for a Foldkit runtime so agents can construct valid payloads for `foldkit_dispatch_message`. Call with no arguments to receive a small variant index (every top-level variant\'s `_tag`, its payload field names, and which payload fields are themselves tagged-union shapes). Then call with `variant_tag: "ChosenVariant"` to drill in. The argument is a dot-separated path of variant `_tag` values: each segment names a variant, and the walker steps through the variant\'s single tagged-union payload field to reach the next. So `"GotMobileMenuDialogMessage"` narrows one level; `"GotMobileMenuDialogMessage.GotAnimationMessage"` narrows two levels of a
|
|
251
|
+
description: 'Describe the Message Schema for a Foldkit runtime so agents can construct valid payloads for `foldkit_dispatch_message`. Call with no arguments to receive a small variant index (every top-level variant\'s `_tag`, its payload field names, and which payload fields are themselves tagged-union shapes). Then call with `variant_tag: "ChosenVariant"` to drill in. The argument is a dot-separated path of variant `_tag` values: each segment names a variant, and the walker steps through the variant\'s single tagged-union payload field to reach the next. So `"GotMobileMenuDialogMessage"` narrows one level; `"GotMobileMenuDialogMessage.GotAnimationMessage"` narrows two levels of a Block chain. Discriminated unions deeper than the supplied path collapse to `{ "_summary": "union", "variants": [...] }` placeholders so the response stays compact even for deeply-nested apps; extend the path to drill further. `Schema.Option` fields render as `anyOf: [{_tag: "Some", value}, {_tag: "None"}]`. The full document follows the JSON Schema draft-2020-12 shape from `Schema.toJsonSchemaDocument`: `{ dialect, schema, definitions }`. Returns `maybeResult: None` when the Program has not enabled `devTools.dispatch` (dispatch is also unavailable). Fields with no JSON representation, notably `Schema.instanceOf(File)` for user-uploaded files, render as `{type: "null"}`; those variants can\'t be dispatched via MCP because their values live in browser memory.',
|
|
252
252
|
inputSchema: toInputSchema(GetMessageSchemaInput),
|
|
253
253
|
handle: runRuntimeTool(GetMessageSchemaInput, ({ variant_tag }) => Request.RequestGetMessageSchema({
|
|
254
254
|
maybeVariantTag: Option.fromNullishOr(variant_tag),
|
|
@@ -256,13 +256,13 @@ export const buildTools = (relayClient) => [
|
|
|
256
256
|
},
|
|
257
257
|
{
|
|
258
258
|
name: 'foldkit_dispatch_message',
|
|
259
|
-
description: "Dispatch a Message into a Foldkit runtime, as if the application itself produced it. Requires
|
|
259
|
+
description: "Dispatch a Message into a Foldkit runtime, as if the application itself produced it. Requires `devTools: { dispatch: true }` on the Program; without it, dispatch is rejected. Call `foldkit_get_message_schema` with no arguments to enumerate the variants, then with `variant_tag` to learn one variant's exact payload shape, before constructing the Message object. The runtime decodes the payload and returns a clean error if it doesn't match. Messages configured with excludeFromHistory are rejected before execution. A successful response identifies the confirmed recorded history entry. A child Message that becomes stale before queued execution is discarded and returns an error. To dispatch several Messages in order with one call, use foldkit_dispatch_messages.",
|
|
260
260
|
inputSchema: toInputSchema(DispatchMessageInput),
|
|
261
261
|
handle: runRuntimeTool(DispatchMessageInput, ({ message }) => Request.RequestDispatchMessage({ message }), relayClient),
|
|
262
262
|
},
|
|
263
263
|
{
|
|
264
264
|
name: 'foldkit_dispatch_messages',
|
|
265
|
-
description: `Dispatch an ordered batch of Messages into a Foldkit runtime in one call, first to last, as if the application produced them in quick succession. Prefer this over repeated foldkit_dispatch_message calls when staging state that takes several Messages: reproducing a bug, filling a form, or building a history fixture. Takes 1 to ${MAX_DISPATCH_BATCH_SIZE} Messages. Validation is all-or-nothing: the runtime decodes every payload against the Message Schema before dispatching any of them, and one invalid entry rejects the whole batch with an error naming its zero-based position, so there is never a partially applied prefix to clean up.
|
|
265
|
+
description: `Dispatch an ordered batch of Messages into a Foldkit runtime in one call, first to last, as if the application produced them in quick succession. Prefer this over repeated foldkit_dispatch_message calls when staging state that takes several Messages: reproducing a bug, filling a form, or building a history fixture. Takes 1 to ${MAX_DISPATCH_BATCH_SIZE} Messages. Validation is all-or-nothing: the runtime decodes every payload against the Message Schema before dispatching any of them, and one invalid entry rejects the whole batch with an error naming its zero-based position, so there is never a partially applied prefix to clean up. Messages excluded from history are rejected before dispatch. On success, acceptedAtIndices contains the exact recorded history indices in request order. A Message whose captured child occurrence becomes stale before queued execution is omitted, while unrelated Messages recorded between batch entries keep their own indices. Requires devTools: { dispatch: true }, like foldkit_dispatch_message.`,
|
|
266
266
|
inputSchema: toInputSchema(DispatchMessagesInput),
|
|
267
267
|
handle: runRuntimeTool(DispatchMessagesInput, ({ messages }) => Request.RequestDispatchMessages({ messages }), relayClient),
|
|
268
268
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldkit/devtools-mcp",
|
|
3
|
-
"version": "0.25.0-canary.
|
|
3
|
+
"version": "0.25.0-canary.90746b32d2ca",
|
|
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,24 +16,24 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"effect": "4.0.0",
|
|
20
|
-
"foldkit": "0.169.0-canary.
|
|
19
|
+
"effect": "4.0.0 || 4.0.6",
|
|
20
|
+
"foldkit": "0.169.0-canary.90746b32d2ca"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@modelcontextprotocol/sdk": "1.
|
|
23
|
+
"@modelcontextprotocol/sdk": "1.31.0",
|
|
24
24
|
"ws": "^8.21.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@effect/platform-node": "4.0.0",
|
|
28
|
-
"@foldkit/vite-plugin": "0.28.0-canary.
|
|
28
|
+
"@foldkit/vite-plugin": "0.28.0-canary.90746b32d2ca",
|
|
29
29
|
"@types/node": "26.4.0",
|
|
30
30
|
"@types/ws": "^8.18.1",
|
|
31
31
|
"effect": "4.0.0",
|
|
32
|
-
"foldkit": "0.169.0-canary.
|
|
32
|
+
"foldkit": "0.169.0-canary.90746b32d2ca",
|
|
33
33
|
"rimraf": "^6.1.3",
|
|
34
34
|
"rolldown": "^1.2.11",
|
|
35
|
-
"typescript": "
|
|
36
|
-
"vite": "^8.3.
|
|
35
|
+
"typescript": "7.1.0-beta",
|
|
36
|
+
"vite": "^8.3.3",
|
|
37
37
|
"vitest": "^4.1.11"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|