foldkit 0.152.0 → 0.153.0

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.
Files changed (56) hide show
  1. package/dist/asyncData/asyncData.d.ts.map +1 -1
  2. package/dist/asyncData/asyncData.js +10 -7
  3. package/dist/canvas/shape.d.ts.map +1 -1
  4. package/dist/canvas/shape.js +11 -11
  5. package/dist/command/interruptible/interruptible.d.ts +12 -23
  6. package/dist/command/interruptible/interruptible.d.ts.map +1 -1
  7. package/dist/command/interruptible/interruptible.js +12 -16
  8. package/dist/command/interruptible/public.d.ts +1 -1
  9. package/dist/command/interruptible/public.d.ts.map +1 -1
  10. package/dist/command/interruptible/public.js +1 -1
  11. package/dist/devTools/protocol.d.ts +391 -527
  12. package/dist/devTools/protocol.d.ts.map +1 -1
  13. package/dist/devTools/protocol.js +96 -192
  14. package/dist/devTools/public.d.ts +1 -1
  15. package/dist/devTools/public.d.ts.map +1 -1
  16. package/dist/devTools/public.js +1 -1
  17. package/dist/devTools/summarize.d.ts +19 -25
  18. package/dist/devTools/summarize.d.ts.map +1 -1
  19. package/dist/devTools/summarize.js +19 -24
  20. package/dist/devTools/webSocketBridge.d.ts +1 -1
  21. package/dist/devTools/webSocketBridge.d.ts.map +1 -1
  22. package/dist/devTools/webSocketBridge.js +45 -41
  23. package/dist/navigation/index.d.ts +1 -1
  24. package/dist/navigation/index.d.ts.map +1 -1
  25. package/dist/navigation/index.js +1 -1
  26. package/dist/navigation/public.d.ts +1 -1
  27. package/dist/navigation/public.d.ts.map +1 -1
  28. package/dist/navigation/public.js +1 -1
  29. package/dist/navigation/urlRequest.d.ts +15 -31
  30. package/dist/navigation/urlRequest.d.ts.map +1 -1
  31. package/dist/navigation/urlRequest.js +5 -10
  32. package/dist/route/index.d.ts +2 -1
  33. package/dist/route/index.d.ts.map +1 -1
  34. package/dist/route/index.js +1 -1
  35. package/dist/route/public.d.ts +2 -2
  36. package/dist/route/public.d.ts.map +1 -1
  37. package/dist/route/public.js +1 -1
  38. package/dist/runtime/browserListeners.d.ts.map +1 -1
  39. package/dist/runtime/browserListeners.js +3 -3
  40. package/dist/schema/index.d.ts +140 -49
  41. package/dist/schema/index.d.ts.map +1 -1
  42. package/dist/schema/index.js +132 -31
  43. package/dist/schema/public.d.ts +2 -2
  44. package/dist/schema/public.d.ts.map +1 -1
  45. package/dist/schema/public.js +1 -1
  46. package/dist/test/apps/contextMenu.d.ts +10 -7
  47. package/dist/test/apps/contextMenu.d.ts.map +1 -1
  48. package/dist/test/apps/contextMenu.js +6 -7
  49. package/dist/test/apps/formChild.d.ts +0 -16
  50. package/dist/test/apps/formChild.d.ts.map +1 -1
  51. package/dist/test/apps/formChild.js +0 -3
  52. package/dist/test/apps/uploads.d.ts +4 -1
  53. package/dist/test/apps/uploads.d.ts.map +1 -1
  54. package/dist/test/scene.d.ts +1 -1
  55. package/dist/test/scene.d.ts.map +1 -1
  56. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/devTools/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAM5C,0NAA0N;AAC1N,eAAO,MAAM,iBAAiB;;;EAG5B,CAAA;AACF,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D,0MAA0M;AAC1M,eAAO,MAAM,eAAe;;;EAG1B,CAAA;AACF,yFAAyF;AACzF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEzD,wfAAwf;AACxf,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;EAa1B,CAAA;AACF,iFAAiF;AACjF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEzD,wHAAwH;AACxH,eAAO,MAAM,YAAY;;EAEvB,CAAA;AACF,wCAAwC;AAC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
3
3
  // SHARED
4
4
  /** A serialized Command produced during a Message dispatch (or `init`). `args` is `Some` when the Command's definition declared an args record, and carries the runtime values used to construct the Command instance. */
5
5
  export const SerializedCommand = S.Struct({
@@ -37,149 +37,66 @@ export const RuntimeInfo = S.Struct({
37
37
  title: S.String,
38
38
  });
39
39
  // REQUEST
40
- /** Request the current Model snapshot, optionally narrowed to a path and/or expanded. */
41
- export const RequestGetModel = ts('RequestGetModel', {
42
- maybePath: S.OptionFromNullOr(S.String),
43
- expand: S.Boolean,
44
- });
45
- /** Request a historical Model snapshot at an absolute history index, optionally narrowed to a path and/or expanded. Use `index: -1` for the initial Model. */
46
- export const RequestGetModelAt = ts('RequestGetModelAt', {
47
- index: S.Number,
48
- maybePath: S.OptionFromNullOr(S.String),
49
- expand: S.Boolean,
50
- });
51
- /** Request recent history entries. `maybeSinceIndex` starts the page at an absolute index; `fromEnd` returns the final entries instead (the two are mutually exclusive). `maybeChangedPathsMatch` filters entries server-side to those whose `changedPaths` match at least one dot-string pattern: segments compare pairwise for the length of the shorter list and `*` matches any single segment, so `root.grid` matches changes anywhere inside the grid subtree and `root.grid.5.3` also matches a wholesale replacement recorded at `root.grid`. The two newer fields decode with defaults when absent, so requests from an older MCP server keep working against a newer runtime. */
52
- export const RequestListMessages = ts('RequestListMessages', {
53
- limit: S.Number,
54
- maybeSinceIndex: S.OptionFromNullOr(S.Number),
55
- maybeChangedPathsMatch: S.OptionFromNullOr(S.Array(S.String)).pipe(S.withDecodingDefault(Effect.succeed(null))),
56
- fromEnd: S.Boolean.pipe(S.withDecodingDefault(Effect.succeed(false))),
57
- });
58
- /** Request a histogram of retained history entries by Message tag. Accepts the same `maybeSinceIndex` / `maybeChangedPathsMatch` filters as `RequestListMessages` but returns only counts, so the response stays small regardless of history size. */
59
- export const RequestCountMessagesByTag = ts('RequestCountMessagesByTag', {
60
- maybeSinceIndex: S.OptionFromNullOr(S.Number),
61
- maybeChangedPathsMatch: S.OptionFromNullOr(S.Array(S.String)),
62
- });
63
- /** Request a path-level diff between the Models at two absolute history indices. Each index follows `RequestGetModelAt` semantics (the Model right after that entry was applied; -1 is the initial Model). `maybeChangedPathsMatch` narrows the reported changes with the same pattern semantics as `RequestListMessages`. */
64
- export const RequestDiffModels = ts('RequestDiffModels', {
65
- fromIndex: S.Number,
66
- toIndex: S.Number,
67
- maybeChangedPathsMatch: S.OptionFromNullOr(S.Array(S.String)),
68
- });
69
- /** Request a single history entry by index. To inspect the Model around the entry, call `RequestGetModelAt` with `index - 1` (before) and `index` (after). */
70
- export const RequestGetMessage = ts('RequestGetMessage', {
71
- index: S.Number,
72
- });
73
- /** Request the list of available keyframes. */
74
- export const RequestListKeyframes = ts('RequestListKeyframes');
75
- /** Request the runtime jump to a specific keyframe. The runtime is paused on success; resume via RequestResume. */
76
- export const RequestReplayToKeyframe = ts('RequestReplayToKeyframe', {
77
- keyframeIndex: S.Number,
78
- });
79
- /** Request the runtime resume normal execution from a paused state. */
80
- export const RequestResume = ts('RequestResume');
81
- /** Request the recorded init data: the initial Model and the names of Commands returned from `init`. */
82
- export const RequestGetInit = ts('RequestGetInit');
83
- /** Request a snapshot of the runtime's DevTools state: history bounds, current paused/live status, and whether init is recorded. */
84
- export const RequestGetRuntimeState = ts('RequestGetRuntimeState');
85
- /** Request the runtime dispatch a Message at the current state. The payload is opaque to the protocol; the runtime validates against the app's Message Schema. */
86
- export const RequestDispatchMessage = ts('RequestDispatchMessage', {
87
- message: S.Unknown,
88
- });
89
40
  /** The largest batch `RequestDispatchMessages` accepts. Matches the DevTools store's default history size, so a batch cannot evict its own earliest entries before the caller reads them back. The runtime rejects a larger batch with `ResponseError`, and MCP clients reject it earlier still, at their own input boundary. */
90
41
  export const MAX_DISPATCH_BATCH_SIZE = 100;
91
- /** Request the runtime dispatch an ordered batch of Messages at the current state. Payloads are opaque to the protocol; the runtime decodes every entry against the app's Message Schema before dispatching any of them, so one invalid entry rejects the whole batch and no Message from it is dispatched. Decoded Messages dispatch in array order through the same path as single dispatch, so the runtime may still record its own Messages between entries, exactly as with rapid user input. Batches larger than `MAX_DISPATCH_BATCH_SIZE` are rejected outright. */
92
- export const RequestDispatchMessages = ts('RequestDispatchMessages', {
93
- messages: S.Array(S.Unknown),
42
+ /** A request from the MCP server. The Vite plugin handles
43
+ * `Request.RequestListRuntimes`; it forwards every other request to a browser
44
+ * runtime. */
45
+ export const Request = defineTaggedUnion({
46
+ RequestGetModel: {
47
+ maybePath: S.OptionFromNullOr(S.String),
48
+ expand: S.Boolean,
49
+ },
50
+ RequestGetModelAt: {
51
+ index: S.Number,
52
+ maybePath: S.OptionFromNullOr(S.String),
53
+ expand: S.Boolean,
54
+ },
55
+ RequestListMessages: {
56
+ limit: S.Number,
57
+ maybeSinceIndex: S.OptionFromNullOr(S.Number),
58
+ maybeChangedPathsMatch: S.OptionFromNullOr(S.Array(S.String)).pipe(S.withDecodingDefault(Effect.succeed(null))),
59
+ fromEnd: S.Boolean.pipe(S.withDecodingDefault(Effect.succeed(false))),
60
+ },
61
+ RequestCountMessagesByTag: {
62
+ maybeSinceIndex: S.OptionFromNullOr(S.Number),
63
+ maybeChangedPathsMatch: S.OptionFromNullOr(S.Array(S.String)),
64
+ },
65
+ RequestDiffModels: {
66
+ fromIndex: S.Number,
67
+ toIndex: S.Number,
68
+ maybeChangedPathsMatch: S.OptionFromNullOr(S.Array(S.String)),
69
+ },
70
+ RequestGetMessage: { index: S.Number },
71
+ RequestListKeyframes: {},
72
+ RequestReplayToKeyframe: { keyframeIndex: S.Number },
73
+ RequestResume: {},
74
+ RequestDispatchMessage: { message: S.Unknown },
75
+ RequestDispatchMessages: { messages: S.Array(S.Unknown) },
76
+ RequestListRuntimes: {},
77
+ RequestGetInit: {},
78
+ RequestGetRuntimeState: {},
79
+ RequestGetMessageSchema: { maybeVariantTag: S.OptionFromNullOr(S.String) },
94
80
  });
95
- /** Request a description of the app's Message Schema. The runtime derives a JSON Schema document once at bridge boot from the configured `DevToolsConfig.Message`; the response is `None` when no Message Schema was configured. With `maybeVariantTag: None`, the response carries a small variant index (tag names plus payload field names and a tagged-union indicator) so MCP clients can enumerate the top-level variants without paying for the full schema. With `maybeVariantTag: Some(path)`, the value is interpreted as a dot-separated path of variant `_tag` values walked through each variant's single tagged-union payload field; the response carries the JSON Schema document narrowed along that chain, with any deeper unions collapsed to summary placeholders. Use the index to discover variants, then fetch one variant before calling `RequestDispatchMessage`. */
96
- export const RequestGetMessageSchema = ts('RequestGetMessageSchema', {
97
- maybeVariantTag: S.OptionFromNullOr(S.String),
98
- });
99
- /** Request the list of currently connected browser runtimes. Handled by the Vite plugin, not forwarded to a runtime. */
100
- export const RequestListRuntimes = ts('RequestListRuntimes');
101
- /** A request from the MCP server. RequestListRuntimes is handled at the Vite plugin layer; all other requests are routed to a browser runtime. */
102
- export const Request = S.Union([
103
- RequestGetModel,
104
- RequestGetModelAt,
105
- RequestListMessages,
106
- RequestCountMessagesByTag,
107
- RequestDiffModels,
108
- RequestGetMessage,
109
- RequestListKeyframes,
110
- RequestReplayToKeyframe,
111
- RequestResume,
112
- RequestDispatchMessage,
113
- RequestDispatchMessages,
114
- RequestListRuntimes,
115
- RequestGetInit,
116
- RequestGetRuntimeState,
117
- RequestGetMessageSchema,
118
- ]);
119
81
  // RESPONSE
120
- /** Response carrying a Model snapshot. The `value` is the resolved subtree at `atPath` (or the whole Model when no path was supplied). When `summarized` is true, large arrays/records/strings have been collapsed to `_summary` placeholders to keep payloads small for AI agents; pass `expand: true` on the Request to receive the literal value. */
121
- export const ResponseModel = ts('ResponseModel', {
122
- value: S.Unknown,
123
- atPath: S.String,
124
- summarized: S.Boolean,
125
- });
126
- /** Response carrying a page of history entries. For forward reads, `maybeNextIndex` is `Some` of the absolute index of the next entry matching the request's filters (pass it as `RequestListMessages.maybeSinceIndex` to fetch the next page) and `None` when the page reaches the end of matching history. Tail reads (`fromEnd`) always carry `None`. */
127
- export const ResponseMessages = ts('ResponseMessages', {
128
- entries: S.Array(SerializedEntry),
129
- maybeNextIndex: S.OptionFromNullOr(S.Number),
130
- });
131
- /** Response carrying a single history entry. Model snapshots are not included; use `RequestGetModelAt` with `index - 1` and `index` to inspect Model state around the entry. */
132
- export const ResponseMessage = ts('ResponseMessage', {
133
- entry: SerializedEntry,
134
- });
135
82
  /** One row of a Message-tag histogram. */
136
83
  export const MessageTagCount = S.Struct({
137
84
  tag: S.String,
138
85
  count: S.Number,
139
86
  });
140
- /** Response carrying a Message-tag histogram, sorted by count descending then tag ascending. `totalCount` is the number of entries counted after filters. `scannedFromIndex` / `scannedToIndex` bound the absolute index range scanned (`scannedToIndex` is -1 when no entries are retained), so callers learn the live history bounds without a separate runtime-state call. */
141
- export const ResponseMessageCounts = ts('ResponseMessageCounts', {
142
- counts: S.Array(MessageTagCount),
143
- totalCount: S.Number,
144
- scannedFromIndex: S.Number,
145
- scannedToIndex: S.Number,
87
+ /** The value on one side of a Model diff. `DiffValue.Present` carries the
88
+ * value. `DiffValue.Absent` means the path does not exist on that side, which
89
+ * keeps a missing path distinct from a path whose value is `null`. */
90
+ export const DiffValue = defineTaggedUnion({
91
+ Absent: {},
92
+ Present: { value: S.Unknown },
146
93
  });
147
- /** The value on one side of a Model diff path: `Present` carries the summarized value; `Absent` means the path does not exist on that side (an added or removed key or element). The tagged shape is deliberate: a nullable encoding could not distinguish an absent path from a path whose value is literally `null`. `undefined`, which JSON cannot represent, is reported as `null`. */
148
- export const DiffValueAbsent = ts('Absent');
149
- /** The value on one side of a Model diff path. See `DiffValue`. */
150
- export const DiffValuePresent = ts('Present', { value: S.Unknown });
151
- /** The value on one side of a Model diff path. */
152
- export const DiffValue = S.Union([DiffValueAbsent, DiffValuePresent]);
153
94
  /** One changed path in a Model diff. `before` is the value at `fromIndex`, `after` the value at `toIndex`. */
154
95
  export const ModelDiffChange = S.Struct({
155
96
  path: S.String,
156
97
  before: DiffValue,
157
98
  after: DiffValue,
158
99
  });
159
- /** Response carrying a path-level Model diff between two history indices. Changes list the leaf paths where the Models differ, sorted by path with numeric segments in numeric order; values are summarized with the same rules `ResponseModel` applies when `expand` is false. */
160
- export const ResponseModelDiff = ts('ResponseModelDiff', {
161
- fromIndex: S.Number,
162
- toIndex: S.Number,
163
- changes: S.Array(ModelDiffChange),
164
- });
165
- /** Response carrying the list of available keyframes. */
166
- export const ResponseKeyframes = ts('ResponseKeyframes', {
167
- keyframes: S.Array(KeyframeInfo),
168
- });
169
- /** Response confirming a successful replay. The runtime is paused at this Model. */
170
- export const ResponseReplayed = ts('ResponseReplayed', {
171
- model: S.Unknown,
172
- });
173
- /** Response confirming the runtime resumed normal execution. */
174
- export const ResponseResumed = ts('ResponseResumed');
175
- /** Response confirming a Message was dispatched. The `acceptedAtIndex` is the absolute history index where the entry is predicted to land. Computed from the runtime's history length at dispatch time. The runtime processes Messages in arrival order, so the index is reliable whenever the bridge is the only Message source, but the app produces its own Messages too (user input, Subscription emissions, Command results); one recorded between the snapshot and the dispatch shifts the entry past this index. Messages excluded from history via `excludeFromHistory` still drive `update` but are never recorded, so no entry lands at the predicted index for them, and a Message dispatched into a crashed or disposed runtime is dropped without recording anything. */
176
- export const ResponseDispatched = ts('ResponseDispatched', {
177
- acceptedAtIndex: S.Number,
178
- });
179
- /** Response confirming a batch dispatch. `acceptedAtIndices` aligns with the request's `messages` order; each value is the absolute history index where that entry is predicted to land, computed from one history snapshot at dispatch time with the same caveats as `ResponseDispatched.acceptedAtIndex`. An `excludeFromHistory` Message inside the batch records no entry, so entries after it land below their predicted index. */
180
- export const ResponseDispatchedBatch = ts('ResponseDispatchedBatch', {
181
- acceptedAtIndices: S.Array(S.Number),
182
- });
183
100
  /** One variant entry in a `MessageSchemaIndex`. `payloadFields` lists the variant's payload property names (excluding `_tag`); `unionFields` lists the subset of those properties whose schemas are themselves `_tag`-discriminated unions. A Submodel-wrapper variant always shows up with `unionFields: ['message']`, but the same flag also catches plain tagged-union value types like `UrlRequest = Internal | External`. Either way, the agent will need to pick a variant when filling these fields. */
184
101
  export const MessageSchemaIndexEntry = S.Struct({
185
102
  tag: S.String,
@@ -190,74 +107,61 @@ export const MessageSchemaIndexEntry = S.Struct({
190
107
  export const MessageSchemaIndex = S.Struct({
191
108
  variants: S.Array(MessageSchemaIndexEntry),
192
109
  });
193
- /** The result payload carried by `ResponseMessageSchema`. `MessageSchemaIndexResult` is returned when the request omitted `maybeVariantTag`; `MessageSchemaDocumentResult` carries a JSON Schema document narrowed to one variant when a tag was supplied. */
194
- export const MessageSchemaIndexResult = ts('MessageSchemaIndexResult', {
195
- index: MessageSchemaIndex,
196
- });
197
- /** A JSON Schema document carrying a single variant of the runtime's Message union, plus the original `definitions` block so any `$ref`s the variant carries still resolve. */
198
- export const MessageSchemaDocumentResult = ts('MessageSchemaDocumentResult', {
199
- document: S.Unknown,
200
- });
201
- const MessageSchemaResult = S.Union([
202
- MessageSchemaIndexResult,
203
- MessageSchemaDocumentResult,
204
- ]);
205
- /** Response describing the app's Message Schema. `maybeResult` is `Some(MessageSchemaIndexResult)` for index requests, `Some(MessageSchemaDocumentResult)` for variant-narrowed requests, and `None` when the runtime has not configured `DevToolsConfig.Message` or when JSON Schema derivation failed. Variant tags appear as `_tag` enums in the document, nested Submodel Messages recurse correctly, and `S.Option` fields render as `anyOf: [{_tag: 'Some', value}, {_tag: 'None'}]`. Apps using `S.OptionFromNullishOr(T)` (the Foldkit-canonical option codec for shapes that cross a JSON boundary) instead see the field as nullable `anyOf: [T, null]`; agents dispatching against that shape send either the bare value or `null`, not a tagged `Some`/`None` envelope. Fields with no JSON representation, such as `S.instanceOf(File)`, render as `{ type: 'null' }` rather than throwing; those variants cannot be dispatched via the bridge because their values live in browser memory. A few AST nodes (symbol-keyed structs, symbol-indexed records, tuples with post-rest elements) still cause the derivation to throw; the bridge guards the call and returns `None` in that case while logging a warning to the dev console. */
206
- export const ResponseMessageSchema = ts('ResponseMessageSchema', {
207
- maybeResult: S.OptionFromNullOr(MessageSchemaResult),
208
- });
209
- /** Response carrying the list of connected runtimes. */
210
- export const ResponseRuntimes = ts('ResponseRuntimes', {
211
- runtimes: S.Array(RuntimeInfo),
212
- });
213
- /** Response carrying the recorded init data. `maybeModel` is `None` until the runtime has finished its first render and recorded init; once set it stays set for the rest of the runtime's life. `commands` lists the Commands returned from the application's `init` function in the order they were produced, with their args when declared. `mountStarts` lists the Mounts that fired during the initial render, with their args when declared. */
214
- export const ResponseInit = ts('ResponseInit', {
215
- maybeModel: S.OptionFromNullOr(S.Unknown),
216
- commands: S.Array(SerializedCommand),
217
- mountStarts: S.Array(SerializedMount),
218
- });
219
- /** Response carrying a snapshot of the runtime's DevTools state. `currentIndex` is the absolute index of the most recently recorded Message, or -1 when no Messages have been recorded yet. `startIndex` is the earliest absolute index still retained in the rolling buffer (older entries are evicted past `maxEntries`). `totalEntries` is the number of retained entries. `isPaused` is true while the runtime is paused at a replayed snapshot; `maybePausedAtIndex` is `Some(index)` then and `None` otherwise. `hasInitModel` is true once the runtime has finished initialising. */
220
- export const ResponseRuntimeState = ts('ResponseRuntimeState', {
221
- currentIndex: S.Number,
222
- startIndex: S.Number,
223
- totalEntries: S.Number,
224
- isPaused: S.Boolean,
225
- maybePausedAtIndex: S.OptionFromNullOr(S.Number),
226
- hasInitModel: S.Boolean,
227
- });
228
- /** Response carrying an error reason for a failed Request. */
229
- export const ResponseError = ts('ResponseError', {
230
- reason: S.String,
110
+ /** The result of requesting the app's Message Schema. It is either a compact
111
+ * index of Message variants or the JSON Schema document for one variant. */
112
+ export const MessageSchemaResult = defineTaggedUnion({
113
+ MessageSchemaIndexResult: { index: MessageSchemaIndex },
114
+ MessageSchemaDocumentResult: { document: S.Unknown },
231
115
  });
232
116
  /** A response replying to a Request. */
233
- export const Response = S.Union([
234
- ResponseModel,
235
- ResponseMessages,
236
- ResponseMessage,
237
- ResponseMessageCounts,
238
- ResponseModelDiff,
239
- ResponseKeyframes,
240
- ResponseReplayed,
241
- ResponseResumed,
242
- ResponseDispatched,
243
- ResponseDispatchedBatch,
244
- ResponseRuntimes,
245
- ResponseInit,
246
- ResponseRuntimeState,
247
- ResponseMessageSchema,
248
- ResponseError,
249
- ]);
250
- // EVENT
251
- /** A new browser runtime connected. */
252
- export const EventConnected = ts('EventConnected', {
253
- runtime: RuntimeInfo,
254
- });
255
- /** A previously connected runtime disconnected. */
256
- export const EventDisconnected = ts('EventDisconnected', {
257
- connectionId: S.String,
117
+ export const Response = defineTaggedUnion({
118
+ ResponseModel: { value: S.Unknown, atPath: S.String, summarized: S.Boolean },
119
+ ResponseMessages: {
120
+ entries: S.Array(SerializedEntry),
121
+ maybeNextIndex: S.OptionFromNullOr(S.Number),
122
+ },
123
+ ResponseMessage: { entry: SerializedEntry },
124
+ ResponseMessageCounts: {
125
+ counts: S.Array(MessageTagCount),
126
+ totalCount: S.Number,
127
+ scannedFromIndex: S.Number,
128
+ scannedToIndex: S.Number,
129
+ },
130
+ ResponseModelDiff: {
131
+ fromIndex: S.Number,
132
+ toIndex: S.Number,
133
+ changes: S.Array(ModelDiffChange),
134
+ },
135
+ ResponseKeyframes: { keyframes: S.Array(KeyframeInfo) },
136
+ ResponseReplayed: { model: S.Unknown },
137
+ ResponseResumed: {},
138
+ ResponseDispatched: { acceptedAtIndex: S.Number },
139
+ ResponseDispatchedBatch: { acceptedAtIndices: S.Array(S.Number) },
140
+ ResponseRuntimes: { runtimes: S.Array(RuntimeInfo) },
141
+ ResponseInit: {
142
+ maybeModel: S.OptionFromNullOr(S.Unknown),
143
+ commands: S.Array(SerializedCommand),
144
+ mountStarts: S.Array(SerializedMount),
145
+ },
146
+ ResponseRuntimeState: {
147
+ currentIndex: S.Number,
148
+ startIndex: S.Number,
149
+ totalEntries: S.Number,
150
+ isPaused: S.Boolean,
151
+ maybePausedAtIndex: S.OptionFromNullOr(S.Number),
152
+ hasInitModel: S.Boolean,
153
+ },
154
+ ResponseMessageSchema: {
155
+ maybeResult: S.OptionFromNullOr(MessageSchemaResult),
156
+ },
157
+ ResponseError: { reason: S.String },
258
158
  });
159
+ // EVENT
259
160
  /** A runtime lifecycle event used by the Vite plugin to track which browser tabs are connected. Not forwarded to MCP clients. */
260
- export const Event = S.Union([EventConnected, EventDisconnected]);
161
+ export const Event = defineTaggedUnion({
162
+ EventConnected: { runtime: RuntimeInfo },
163
+ EventDisconnected: { connectionId: S.String },
164
+ });
261
165
  // FRAME
262
166
  /** A wire frame carrying a Request from the MCP server. The id is opaque, used only by the MCP server to correlate the matching Response. The maybeConnectionId routes the request to a specific runtime when present. */
263
167
  export const RequestFrame = S.Struct({
@@ -1,2 +1,2 @@
1
- export { EventConnected, EventDisconnected, EventFrame, Event, KeyframeInfo, DiffValue, DiffValueAbsent, DiffValuePresent, MAX_DISPATCH_BATCH_SIZE, MessageTagCount, ModelDiffChange, RequestCountMessagesByTag, RequestDiffModels, RequestDispatchMessage, RequestDispatchMessages, RequestFrame, RequestGetInit, RequestGetMessage, RequestGetMessageSchema, RequestGetModel, RequestGetModelAt, RequestGetRuntimeState, RequestListKeyframes, RequestListMessages, RequestListRuntimes, RequestReplayToKeyframe, RequestResume, Request, ResponseDispatched, ResponseDispatchedBatch, ResponseError, ResponseFrame, ResponseInit, ResponseKeyframes, ResponseMessage, ResponseMessageCounts, ResponseMessages, ResponseMessageSchema, ResponseModel, ResponseModelDiff, ResponseReplayed, ResponseResumed, ResponseRuntimes, ResponseRuntimeState, Response, RuntimeInfo, SerializedEntry, } from './protocol.js';
1
+ export { DiffValue, Event, EventFrame, KeyframeInfo, MAX_DISPATCH_BATCH_SIZE, MessageSchemaResult, MessageTagCount, ModelDiffChange, Request, RequestFrame, Response, ResponseFrame, RuntimeInfo, SerializedEntry, } from './protocol.js';
2
2
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/devTools/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,KAAK,EACL,YAAY,EACZ,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,OAAO,EACP,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/devTools/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAA"}
@@ -1 +1 @@
1
- export { EventConnected, EventDisconnected, EventFrame, Event, KeyframeInfo, DiffValue, DiffValueAbsent, DiffValuePresent, MAX_DISPATCH_BATCH_SIZE, MessageTagCount, ModelDiffChange, RequestCountMessagesByTag, RequestDiffModels, RequestDispatchMessage, RequestDispatchMessages, RequestFrame, RequestGetInit, RequestGetMessage, RequestGetMessageSchema, RequestGetModel, RequestGetModelAt, RequestGetRuntimeState, RequestListKeyframes, RequestListMessages, RequestListRuntimes, RequestReplayToKeyframe, RequestResume, Request, ResponseDispatched, ResponseDispatchedBatch, ResponseError, ResponseFrame, ResponseInit, ResponseKeyframes, ResponseMessage, ResponseMessageCounts, ResponseMessages, ResponseMessageSchema, ResponseModel, ResponseModelDiff, ResponseReplayed, ResponseResumed, ResponseRuntimes, ResponseRuntimeState, Response, RuntimeInfo, SerializedEntry, } from './protocol.js';
1
+ export { DiffValue, Event, EventFrame, KeyframeInfo, MAX_DISPATCH_BATCH_SIZE, MessageSchemaResult, MessageTagCount, ModelDiffChange, Request, RequestFrame, Response, ResponseFrame, RuntimeInfo, SerializedEntry, } from './protocol.js';
@@ -1,27 +1,24 @@
1
1
  import { Schema as S } from 'effect';
2
- declare const PathResolution: S.Union<readonly [import("../schema/index.js").CallableTaggedStruct<"Found", {
3
- value: S.Unknown;
4
- atPath: S.String;
5
- }>, import("../schema/index.js").CallableTaggedStruct<"NotFound", {
6
- failedAt: S.String;
7
- reason: S.String;
8
- availableKeys: S.$Array<S.String>;
9
- }>]>;
2
+ declare const PathResolution: import("../schema/index.js").TaggedUnion<{
3
+ readonly Found: {
4
+ readonly value: S.Unknown;
5
+ readonly atPath: S.String;
6
+ };
7
+ readonly NotFound: {
8
+ readonly failedAt: S.String;
9
+ readonly reason: S.String;
10
+ readonly availableKeys: S.$Array<S.String>;
11
+ };
12
+ }>;
10
13
  /**
11
- * Result of resolving a dot-string path against a Model snapshot.
12
- *
13
- * The path representation matches `SerializedEntry.changedPaths` exactly:
14
- * dot-separated, anchored at the literal segment `root`. `Found.atPath`
15
- * echoes the canonicalized path; `NotFound.availableKeys` lists the keys
16
- * present at the deepest segment that resolved, so an agent can recover with
17
- * one follow-up call.
14
+ * The result of looking up a `root.foo.bar` path in a Model snapshot.
15
+ * `PathResolution.Found` returns the value and the path where it was found.
16
+ * `PathResolution.NotFound` reports where the lookup stopped and which keys
17
+ * were available there.
18
18
  */
19
19
  export type PathResolution = typeof PathResolution.Type;
20
- /**
21
- * Walk a dot-string path against a Model snapshot. Returns the resolved value
22
- * on success, or a structured `NotFound` describing the deepest segment that
23
- * resolved plus its available keys so an agent can refine.
24
- */
20
+ /** Looks up a `root.foo.bar` path in a Model snapshot. On failure, returns the
21
+ * deepest path reached and the keys available there. */
25
22
  export declare const resolvePath: (root: unknown, path: string) => PathResolution;
26
23
  /**
27
24
  * Apply structural summarization rules to a value:
@@ -34,11 +31,8 @@ export declare const resolvePath: (root: unknown, path: string) => PathResolutio
34
31
  * with `expand: false`. Use raw values directly when `expand: true`.
35
32
  */
36
33
  export declare const summarizeValue: (value: unknown) => unknown;
37
- /**
38
- * Format a `NotFound` resolution as a single human-readable line for the
39
- * `ResponseError.reason` channel. Includes the available keys at the failure
40
- * point so an agent can refine the path on the next call.
41
- */
34
+ /** Formats a `NotFound` result for `ResponseError.reason`, including the keys
35
+ * available where the lookup stopped. */
42
36
  export declare const formatPathNotFound: (notFound: Extract<PathResolution, {
43
37
  _tag: "NotFound";
44
38
  }>) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"summarize.d.ts","sourceRoot":"","sources":["../../src/devTools/summarize.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,MAAM,IAAI,CAAC,EACZ,MAAM,QAAQ,CAAA;AAwBf,QAAA,MAAM,cAAc;;;;;;;IAA6B,CAAA;AAEjD;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AA8BvD;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,OAAO,EAAE,MAAM,MAAM,KAAG,cAmCzD,CAAA;AAyDD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,OAAgC,CAAA;AAYhF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,KACtD,MAIC,CAAA"}
1
+ {"version":3,"file":"summarize.d.ts","sourceRoot":"","sources":["../../src/devTools/summarize.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,MAAM,IAAI,CAAC,EACZ,MAAM,QAAQ,CAAA;AAaf,QAAA,MAAM,cAAc;;;;;;;;;;EAOlB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AA8BvD;wDACwD;AACxD,eAAO,MAAM,WAAW,GAAI,MAAM,OAAO,EAAE,MAAM,MAAM,KAAG,cAsCzD,CAAA;AAyDD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,OAAgC,CAAA;AAYhF;yCACyC;AACzC,eAAO,MAAM,kBAAkB,GAC7B,UAAU,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,KACtD,MAIC,CAAA"}
@@ -1,54 +1,52 @@
1
1
  import { Array as Array_, Function, Match as M, Option, Predicate, Record, Schema as S, } from 'effect';
2
2
  import { OptionExt } from '../effectExtensions/index.js';
3
- import { ts } from '../schema/index.js';
3
+ import { defineTaggedUnion } from '../schema/index.js';
4
4
  const ROOT = 'root';
5
5
  const PATH_SEPARATOR = '.';
6
6
  const MAX_DEPTH = 3;
7
7
  const STRING_TRUNCATE = 200;
8
8
  const ARRAY_SAMPLE = 2;
9
9
  // PATH
10
- const Found = ts('Found', {
11
- value: S.Unknown,
12
- atPath: S.String,
10
+ const PathResolution = defineTaggedUnion({
11
+ Found: { value: S.Unknown, atPath: S.String },
12
+ NotFound: {
13
+ failedAt: S.String,
14
+ reason: S.String,
15
+ availableKeys: S.Array(S.String),
16
+ },
13
17
  });
14
- const NotFound = ts('NotFound', {
15
- failedAt: S.String,
16
- reason: S.String,
17
- availableKeys: S.Array(S.String),
18
- });
19
- const PathResolution = S.Union([Found, NotFound]);
20
18
  const isExpandable = Predicate.isObjectOrArray;
21
19
  const keysOf = (value) => M.value(value).pipe(M.when(Array.isArray, items => Array_.makeBy(items.length, index => index.toString())), M.when(Predicate.isObject, Record.keys), M.orElse(() => []));
22
20
  const segmentsOf = (path) => path === ROOT ? [] : path.split(PATH_SEPARATOR).slice(1);
23
21
  const isRootAnchored = (path) => path === ROOT || path.startsWith(`${ROOT}${PATH_SEPARATOR}`);
24
22
  const descend = (parent, segment) => M.value(parent).pipe(M.when(Array.isArray, array => Option.liftPredicate(Number(segment), Number.isInteger).pipe(Option.flatMap(index => Array_.get(array, index)))), M.when(Predicate.isObject, record => Record.get(record, segment)), M.orElse(() => Option.none()));
25
- /**
26
- * Walk a dot-string path against a Model snapshot. Returns the resolved value
27
- * on success, or a structured `NotFound` describing the deepest segment that
28
- * resolved plus its available keys so an agent can refine.
29
- */
23
+ /** Looks up a `root.foo.bar` path in a Model snapshot. On failure, returns the
24
+ * deepest path reached and the keys available there. */
30
25
  export const resolvePath = (root, path) => {
31
26
  if (!isRootAnchored(path)) {
32
- return NotFound({
27
+ return PathResolution.NotFound({
33
28
  failedAt: '',
34
29
  reason: `Path must start with '${ROOT}'. Received: '${path}'.`,
35
30
  availableKeys: [],
36
31
  });
37
32
  }
38
- const initial = Found({ value: root, atPath: ROOT });
33
+ const initial = PathResolution.Found({
34
+ value: root,
35
+ atPath: ROOT,
36
+ });
39
37
  return Array_.reduce(segmentsOf(path), initial, (resolution, segment) => {
40
38
  if (resolution._tag === 'NotFound') {
41
39
  return resolution;
42
40
  }
43
41
  return Option.match(descend(resolution.value, segment), {
44
- onNone: () => NotFound({
42
+ onNone: () => PathResolution.NotFound({
45
43
  failedAt: resolution.atPath,
46
44
  reason: isExpandable(resolution.value)
47
45
  ? `No '${segment}' at '${resolution.atPath}'.`
48
46
  : `Cannot descend into a primitive at '${resolution.atPath}' (looking for '${segment}').`,
49
47
  availableKeys: keysOf(resolution.value),
50
48
  }),
51
- onSome: descended => Found({
49
+ onSome: descended => PathResolution.Found({
52
50
  value: descended,
53
51
  atPath: `${resolution.atPath}${PATH_SEPARATOR}${segment}`,
54
52
  }),
@@ -100,11 +98,8 @@ const summarizeAt = (value, depth) => M.value(value).pipe(M.when(Predicate.isStr
100
98
  export const summarizeValue = (value) => summarizeAt(value, 0);
101
99
  // FORMAT
102
100
  const formatAvailableKeys = (keys) => OptionExt.when(Array_.isReadonlyArrayNonEmpty(keys), `Available keys: ${keys.join(', ')}.`);
103
- /**
104
- * Format a `NotFound` resolution as a single human-readable line for the
105
- * `ResponseError.reason` channel. Includes the available keys at the failure
106
- * point so an agent can refine the path on the next call.
107
- */
101
+ /** Formats a `NotFound` result for `ResponseError.reason`, including the keys
102
+ * available where the lookup stopped. */
108
103
  export const formatPathNotFound = (notFound) => Option.match(formatAvailableKeys(notFound.availableKeys), {
109
104
  onNone: () => notFound.reason,
110
105
  onSome: hint => `${notFound.reason} ${hint}`,
@@ -1,5 +1,5 @@
1
1
  import { Effect, Option, Schema as S, Scope } from 'effect';
2
- import { type Request, type Response } from './protocol.js';
2
+ import { type Request, Response } from './protocol.js';
3
3
  import { type DevToolsStore } from './store.js';
4
4
  type Hot = NonNullable<ImportMeta['hot']>;
5
5
  /** HMR channel the bridge announces connection lifecycle events on. */
@@ -1 +1 @@
1
- {"version":3,"file":"webSocketBridge.d.ts","sourceRoot":"","sources":["../../src/devTools/webSocketBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EAIN,MAAM,EAEN,MAAM,IAAI,CAAC,EACX,KAAK,EAGN,MAAM,QAAQ,CAAA;AAcf,OAAO,EAYL,KAAK,OAAO,EAEZ,KAAK,QAAQ,EAiBd,MAAM,eAAe,CAAA;AAatB,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,YAAY,CAAA;AAQnB,KAAK,GAAG,GAAG,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;AAKzC,uEAAuE;AACvE,eAAO,MAAM,aAAa,2BAA2B,CAAA;AAmBrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,aAAa,EACpB,KAAK,GAAG,EACR,UAAU,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EACnD,oBAAoB,MAAM,CAAC,MAAM,CAAC,CAAC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