@tensnap/protocol 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/codec.js.map +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -0
- package/dist/index.js.map +4 -4
- package/dist/layers.d.ts +637 -0
- package/dist/layers.d.ts.map +1 -0
- package/dist/layers.js +243 -0
- package/dist/layers.js.map +7 -0
- package/dist/protocol-types.md +1342 -0
- package/dist/schemas.d.ts +105 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js.map +2 -2
- package/dist/types.d.ts +45 -156
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -5
package/dist/schemas.d.ts
CHANGED
|
@@ -3,17 +3,35 @@ export declare const ItemSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
|
3
3
|
export declare const ItemDiffSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
4
4
|
export declare const ItemKeySchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
5
5
|
export declare const PrimitiveItemKeySchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
6
|
+
/**
|
|
7
|
+
* `metadata_update` carries scenario-wide metadata, including the current
|
|
8
|
+
* simulation time. It replaces the old split between time-step start and end
|
|
9
|
+
* events, and may carry additional simulator-defined metadata fields.
|
|
10
|
+
*/
|
|
6
11
|
export declare const MetadataUpdatePayloadSchema: z.ZodObject<{
|
|
7
12
|
time: z.ZodOptional<z.ZodNumber>;
|
|
8
13
|
}, z.core.$loose>;
|
|
14
|
+
/**
|
|
15
|
+
* `state_sync_begin` and `state_sync_end` bracket a simulator replay triggered
|
|
16
|
+
* by `state_sync`. When present, `request_id` is generated by the renderer and
|
|
17
|
+
* echoed by the simulator so initial sync and reconnect transactions can be
|
|
18
|
+
* correlated without making Scenario transport-aware.
|
|
19
|
+
*/
|
|
9
20
|
export declare const StateSyncBoundaryPayloadSchema: z.ZodObject<{
|
|
10
21
|
request_id: z.ZodOptional<z.ZodString>;
|
|
11
22
|
}, z.core.$strip>;
|
|
23
|
+
/** Optional per-action timing buckets used for tick diagnostics. */
|
|
12
24
|
export declare const TickTimingBreakdownSchema: z.ZodObject<{
|
|
13
25
|
simulate_ms: z.ZodOptional<z.ZodNumber>;
|
|
14
26
|
communicate_ms: z.ZodOptional<z.ZodNumber>;
|
|
15
27
|
render_ms: z.ZodOptional<z.ZodNumber>;
|
|
16
28
|
}, z.core.$catchall<z.ZodNumber>>;
|
|
29
|
+
/**
|
|
30
|
+
* `action_end` signals completion of one simulator action execution. Simulators
|
|
31
|
+
* should emit state mutations caused by the action before the matching
|
|
32
|
+
* `action_end`. For continuous actions, explicit `continue: false` stops the
|
|
33
|
+
* renderer-driven loop; `tick_id` should echo the renderer-supplied id.
|
|
34
|
+
*/
|
|
17
35
|
export declare const ActionEndPayloadSchema: z.ZodObject<{
|
|
18
36
|
id: z.ZodString;
|
|
19
37
|
tick_id: z.ZodOptional<z.ZodString>;
|
|
@@ -24,9 +42,14 @@ export declare const ActionEndPayloadSchema: z.ZodObject<{
|
|
|
24
42
|
render_ms: z.ZodOptional<z.ZodNumber>;
|
|
25
43
|
}, z.core.$catchall<z.ZodNumber>>>;
|
|
26
44
|
}, z.core.$strip>;
|
|
45
|
+
/** `action_delete` removes a renderer-visible action by id. */
|
|
27
46
|
export declare const ActionDeletePayloadSchema: z.ZodObject<{
|
|
28
47
|
id: z.ZodString;
|
|
29
48
|
}, z.core.$strip>;
|
|
49
|
+
/**
|
|
50
|
+
* `env_create` creates a scenario environment container. `2d` covers grid-like
|
|
51
|
+
* and graph-like scenes; rendering semantics are expressed by layers.
|
|
52
|
+
*/
|
|
30
53
|
export declare const EnvCreatePayloadSchema: z.ZodObject<{
|
|
31
54
|
id: z.ZodString;
|
|
32
55
|
type: z.ZodEnum<{
|
|
@@ -34,9 +57,15 @@ export declare const EnvCreatePayloadSchema: z.ZodObject<{
|
|
|
34
57
|
"2d": "2d";
|
|
35
58
|
}>;
|
|
36
59
|
}, z.core.$strip>;
|
|
60
|
+
/** `env_delete` removes a scenario environment container by id. */
|
|
37
61
|
export declare const EnvDeletePayloadSchema: z.ZodObject<{
|
|
38
62
|
id: z.ZodString;
|
|
39
63
|
}, z.core.$strip>;
|
|
64
|
+
/**
|
|
65
|
+
* `env_layer_create` creates an environment-local layer with fixed topology and
|
|
66
|
+
* optional metadata. `dependency_layer_ids` is create-time topology; simulators
|
|
67
|
+
* should recreate the layer or environment if dependencies need to change.
|
|
68
|
+
*/
|
|
40
69
|
export declare const EnvLayerCreatePayloadSchema: z.ZodObject<{
|
|
41
70
|
env_id: z.ZodString;
|
|
42
71
|
layer_id: z.ZodString;
|
|
@@ -44,40 +73,72 @@ export declare const EnvLayerCreatePayloadSchema: z.ZodObject<{
|
|
|
44
73
|
dependency_layer_ids: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
45
74
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
46
75
|
}, z.core.$strip>;
|
|
76
|
+
/**
|
|
77
|
+
* `env_layer_update` replaces layer metadata as a whole object. It is not an
|
|
78
|
+
* item diff channel and must not be used to mutate dependency topology.
|
|
79
|
+
*/
|
|
47
80
|
export declare const EnvLayerUpdatePayloadSchema: z.ZodObject<{
|
|
48
81
|
env_id: z.ZodString;
|
|
49
82
|
layer_id: z.ZodString;
|
|
50
83
|
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
51
84
|
}, z.core.$strip>;
|
|
85
|
+
/** `env_layer_delete` removes one layer from an environment. */
|
|
52
86
|
export declare const EnvLayerDeletePayloadSchema: z.ZodObject<{
|
|
53
87
|
env_id: z.ZodString;
|
|
54
88
|
layer_id: z.ZodString;
|
|
55
89
|
}, z.core.$strip>;
|
|
90
|
+
/**
|
|
91
|
+
* `item_create` creates layer-owned items. The exact item schema and primary
|
|
92
|
+
* key are provided by the layer registry entry for the target layer type.
|
|
93
|
+
*/
|
|
56
94
|
export declare const ItemCreatePayloadSchema: z.ZodObject<{
|
|
57
95
|
env_id: z.ZodString;
|
|
58
96
|
layer_id: z.ZodString;
|
|
59
97
|
items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
98
|
}, z.core.$strip>;
|
|
99
|
+
/**
|
|
100
|
+
* `item_update` carries field-level diffs for existing layer-owned items.
|
|
101
|
+
* Diffs must include the layer registry primary key fields so the renderer can
|
|
102
|
+
* identify each target item.
|
|
103
|
+
*/
|
|
61
104
|
export declare const ItemUpdatePayloadSchema: z.ZodObject<{
|
|
62
105
|
env_id: z.ZodString;
|
|
63
106
|
layer_id: z.ZodString;
|
|
64
107
|
items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
65
108
|
}, z.core.$strip>;
|
|
109
|
+
/**
|
|
110
|
+
* `item_delete` removes layer-owned items. Single-key layers may delete by
|
|
111
|
+
* primitive id; multi-key layers, such as edge layers keyed by source/target,
|
|
112
|
+
* delete by object keys matching the registry primary key fields.
|
|
113
|
+
*/
|
|
66
114
|
export declare const ItemDeletePayloadSchema: z.ZodObject<{
|
|
67
115
|
env_id: z.ZodString;
|
|
68
116
|
layer_id: z.ZodString;
|
|
69
117
|
items: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
70
118
|
}, z.core.$strip>;
|
|
119
|
+
/** `param_delete` removes a renderer-visible parameter by id. */
|
|
71
120
|
export declare const ParameterDeletePayloadSchema: z.ZodObject<{
|
|
72
121
|
id: z.ZodString;
|
|
73
122
|
}, z.core.$strip>;
|
|
123
|
+
/**
|
|
124
|
+
* `param_sync` pushes a simulator-side value correction after an optimistic
|
|
125
|
+
* renderer edit. A simulator should not emit `param_sync` for every accepted
|
|
126
|
+
* `param_change`; it should emit one only when it rejects the edit or coerces it
|
|
127
|
+
* to a different canonical value. Definition changes, including enum option or
|
|
128
|
+
* label-list changes, are sent with full `param_update` payloads instead.
|
|
129
|
+
*/
|
|
74
130
|
export declare const ParameterSyncPayloadSchema: z.ZodObject<{
|
|
75
131
|
id: z.ZodString;
|
|
76
132
|
value: z.ZodUnknown;
|
|
77
133
|
}, z.core.$strip>;
|
|
134
|
+
/** `chart_delete` removes a chart or chart series by id. */
|
|
78
135
|
export declare const ChartDeletePayloadSchema: z.ZodObject<{
|
|
79
136
|
id: z.ZodString;
|
|
80
137
|
}, z.core.$strip>;
|
|
138
|
+
/**
|
|
139
|
+
* `chart_update` carries incremental data points and chart operations such as
|
|
140
|
+
* `clear`. Chart metadata is maintained separately through `chart_create`.
|
|
141
|
+
*/
|
|
81
142
|
export declare const ChartUpdatePayloadSchema: z.ZodObject<{
|
|
82
143
|
updates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
83
144
|
id: z.ZodString;
|
|
@@ -96,6 +157,7 @@ export declare const LogLevelSchema: z.ZodEnum<{
|
|
|
96
157
|
warning: "warning";
|
|
97
158
|
critical: "critical";
|
|
98
159
|
}>;
|
|
160
|
+
/** `log` is a diagnostic event emitted by either runtime side. */
|
|
99
161
|
export declare const LogPayloadSchema: z.ZodObject<{
|
|
100
162
|
message: z.ZodString;
|
|
101
163
|
level: z.ZodOptional<z.ZodEnum<{
|
|
@@ -109,9 +171,11 @@ export declare const LogPayloadSchema: z.ZodObject<{
|
|
|
109
171
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
110
172
|
data: z.ZodOptional<z.ZodUnknown>;
|
|
111
173
|
}, z.core.$strip>;
|
|
174
|
+
/** `error` reports a protocol-level or runtime error. */
|
|
112
175
|
export declare const ErrorPayloadSchema: z.ZodObject<{
|
|
113
176
|
error: z.ZodString;
|
|
114
177
|
}, z.core.$strip>;
|
|
178
|
+
/** `asset_meta` announces cacheable asset descriptors without sending bytes. */
|
|
115
179
|
export declare const AssetMetaPayloadSchema: z.ZodObject<{
|
|
116
180
|
assets: z.ZodArray<z.ZodObject<{
|
|
117
181
|
id: z.ZodString;
|
|
@@ -121,18 +185,29 @@ export declare const AssetMetaPayloadSchema: z.ZodObject<{
|
|
|
121
185
|
label: z.ZodOptional<z.ZodString>;
|
|
122
186
|
}, z.core.$strip>>;
|
|
123
187
|
}, z.core.$strip>;
|
|
188
|
+
/**
|
|
189
|
+
* `asset_data` sends one asset's bytes. JSON transports carry base64/data URL
|
|
190
|
+
* strings, while binary transports may carry raw `Uint8Array` values.
|
|
191
|
+
*/
|
|
124
192
|
export declare const AssetDataPayloadSchema: z.ZodObject<{
|
|
125
193
|
id: z.ZodString;
|
|
126
194
|
hash: z.ZodString;
|
|
127
195
|
mime: z.ZodString;
|
|
128
196
|
data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
|
|
129
197
|
}, z.core.$strip>;
|
|
198
|
+
/** `asset_delete` removes cached renderer-side assets by id. */
|
|
130
199
|
export declare const AssetDeletePayloadSchema: z.ZodObject<{
|
|
131
200
|
ids: z.ZodArray<z.ZodString>;
|
|
132
201
|
}, z.core.$strip>;
|
|
202
|
+
/** `asset_sync` reports the renderer's currently held asset hashes. */
|
|
133
203
|
export declare const AssetSyncPayloadSchema: z.ZodObject<{
|
|
134
204
|
assets: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
135
205
|
}, z.core.$strip>;
|
|
206
|
+
/**
|
|
207
|
+
* `screenshot_request` asks the renderer to capture an environment or chart.
|
|
208
|
+
* Exactly one of `env_id` or `chart_id` should identify the target. `format`
|
|
209
|
+
* defaults to `png`; `quality` is a 0-1 JPEG hint.
|
|
210
|
+
*/
|
|
136
211
|
export declare const ScreenshotRequestPayloadSchema: z.ZodObject<{
|
|
137
212
|
request_id: z.ZodString;
|
|
138
213
|
env_id: z.ZodOptional<z.ZodString>;
|
|
@@ -143,12 +218,22 @@ export declare const ScreenshotRequestPayloadSchema: z.ZodObject<{
|
|
|
143
218
|
}>>;
|
|
144
219
|
quality: z.ZodOptional<z.ZodNumber>;
|
|
145
220
|
}, z.core.$strip>;
|
|
221
|
+
/**
|
|
222
|
+
* `screenshot_response` returns a captured image or an error to the simulator.
|
|
223
|
+
* JSON mode uses base64/data URL strings; binary mode may use raw bytes.
|
|
224
|
+
*/
|
|
146
225
|
export declare const ScreenshotResponsePayloadSchema: z.ZodObject<{
|
|
147
226
|
request_id: z.ZodString;
|
|
148
227
|
data: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>;
|
|
149
228
|
mime: z.ZodOptional<z.ZodString>;
|
|
150
229
|
error: z.ZodOptional<z.ZodString>;
|
|
151
230
|
}, z.core.$strip>;
|
|
231
|
+
/**
|
|
232
|
+
* `state_sync` is sent by the renderer on connect or reconnect. It summarizes
|
|
233
|
+
* renderer-held definitions so the simulator can replay create, update, and
|
|
234
|
+
* delete messages between `state_sync_begin` and `state_sync_end`; simulators
|
|
235
|
+
* do not answer with a reverse `state_sync`.
|
|
236
|
+
*/
|
|
152
237
|
export declare const StateSyncRequestSchema: z.ZodObject<{
|
|
153
238
|
request_id: z.ZodOptional<z.ZodString>;
|
|
154
239
|
parameters: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -201,15 +286,31 @@ export declare const StateSyncRequestSchema: z.ZodObject<{
|
|
|
201
286
|
color: z.ZodOptional<z.ZodString>;
|
|
202
287
|
}, z.core.$strip>>;
|
|
203
288
|
}, z.core.$strip>;
|
|
289
|
+
/**
|
|
290
|
+
* `param_change` is a renderer-side optimistic parameter edit. The simulator is
|
|
291
|
+
* expected to apply accepted values without emitting any sync message. If the
|
|
292
|
+
* edit is rejected or normalized to a different value, the simulator sends
|
|
293
|
+
* `param_sync`; if the parameter definition changes, such as enum options, it
|
|
294
|
+
* sends a full `param_update`.
|
|
295
|
+
*/
|
|
204
296
|
export declare const ParameterChangePayloadSchema: z.ZodObject<{
|
|
205
297
|
id: z.ZodString;
|
|
206
298
|
value: z.ZodUnknown;
|
|
207
299
|
}, z.core.$strip>;
|
|
300
|
+
/**
|
|
301
|
+
* `action_start` starts one action execution. `continuous` requests a
|
|
302
|
+
* renderer-driven loop, and `tick_id` lets the renderer correlate the eventual
|
|
303
|
+
* `action_end` with one in-flight dispatch.
|
|
304
|
+
*/
|
|
208
305
|
export declare const ActionStartPayloadSchema: z.ZodObject<{
|
|
209
306
|
id: z.ZodString;
|
|
210
307
|
tick_id: z.ZodOptional<z.ZodString>;
|
|
211
308
|
continuous: z.ZodOptional<z.ZodBoolean>;
|
|
212
309
|
}, z.core.$strip>;
|
|
310
|
+
/**
|
|
311
|
+
* Simulator-to-renderer messages mutate renderer-owned Scenario state or ask
|
|
312
|
+
* renderer-side facilities, such as asset cache and screenshots, to do work.
|
|
313
|
+
*/
|
|
213
314
|
export declare const SimulatorToRendererMessageSchema: z.ZodObject<{
|
|
214
315
|
type: z.ZodEnum<{
|
|
215
316
|
error: "error";
|
|
@@ -244,6 +345,10 @@ export declare const SimulatorToRendererMessageSchema: z.ZodObject<{
|
|
|
244
345
|
payload: z.ZodUnknown;
|
|
245
346
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
246
347
|
}, z.core.$strip>;
|
|
348
|
+
/**
|
|
349
|
+
* Renderer-to-simulator messages express renderer intent, renderer state
|
|
350
|
+
* summary, or renderer-generated output.
|
|
351
|
+
*/
|
|
247
352
|
export declare const RendererToSimulatorMessageSchema: z.ZodObject<{
|
|
248
353
|
type: z.ZodEnum<{
|
|
249
354
|
error: "error";
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,UAAU,wCAA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K1C,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUjC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;iBAInC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC3C,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;iBAW3C,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAGnC,CAAC;AAEH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqC5C,CAAC"}
|
package/dist/schemas.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/schemas.ts", "../src/asset.ts", "../src/chart.ts", "../src/controls.ts", "../src/binary.ts"],
|
|
4
|
-
"sourcesContent": ["import { z } from 'zod';\nimport { AssetMetaSchema } from './asset';\nimport {\n ChartGroupMetadataSchema,\n ChartMetadataSchema,\n ChartUpdateDataSchema,\n ChartUpdateOperationSchema,\n} from './chart';\nimport { ActionSchema, ParameterSchema } from './controls';\nimport { isEncodedBinaryString } from './binary';\n\nconst BinaryPayloadStringSchema = z.string().refine(\n (value) => isEncodedBinaryString(value),\n 'Expected a base64 string or a base64 data URL for binary payload data.',\n);\n\nconst BinaryPayloadDataSchema = z.union([BinaryPayloadStringSchema, z.instanceof(Uint8Array)]);\n\nexport const ItemSchema = z.record(z.string(), z.unknown());\nexport const ItemDiffSchema = z.record(z.string(), z.unknown());\nexport const ItemKeySchema = z.record(z.string(), z.unknown());\nexport const PrimitiveItemKeySchema = z.union([z.string(), z.number()]);\n\nexport const MetadataUpdatePayloadSchema = z.object({\n time: z.number().optional(),\n}).loose();\n\nexport const StateSyncBoundaryPayloadSchema = z.object({\n request_id: z.string().optional(),\n});\n\nexport const TickTimingBreakdownSchema = z.object({\n simulate_ms: z.number().nonnegative().optional(),\n communicate_ms: z.number().nonnegative().optional(),\n render_ms: z.number().nonnegative().optional(),\n}).catchall(z.number().nonnegative());\n\nexport const ActionEndPayloadSchema = z.object({\n id: z.string(),\n tick_id: z.string().optional(),\n continue: z.boolean().optional(),\n timings: TickTimingBreakdownSchema.optional(),\n});\n\nexport const ActionDeletePayloadSchema = z.object({ id: z.string() });\n\nexport const EnvCreatePayloadSchema = z.object({\n id: z.string(),\n type: z.enum(['uniform', '2d']),\n});\n\nexport const EnvDeletePayloadSchema = z.object({ id: z.string() });\n\nexport const EnvLayerCreatePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n layer_type: z.string(),\n dependency_layer_ids: z.record(z.string(), z.string()).optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const EnvLayerUpdatePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n data: z.record(z.string(), z.unknown()),\n});\n\nexport const EnvLayerDeletePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n});\n\nexport const ItemCreatePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n items: z.array(ItemSchema),\n});\n\nexport const ItemUpdatePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n items: z.array(ItemDiffSchema),\n});\n\nexport const ItemDeletePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n items: z.union([z.array(PrimitiveItemKeySchema), z.array(ItemKeySchema)]),\n});\n\nexport const ParameterDeletePayloadSchema = z.object({ id: z.string() });\n\nexport const ParameterSyncPayloadSchema = z.object({\n id: z.string(),\n value: z.unknown(),\n});\n\nexport const ChartDeletePayloadSchema = z.object({ id: z.string() });\n\nexport const ChartUpdatePayloadSchema = z.object({\n updates: z.array(ChartUpdateDataSchema).optional(),\n operations: z.array(ChartUpdateOperationSchema).optional(),\n});\n\nexport const LogLevelSchema = z.enum(['debug', 'info', 'warning', 'error', 'critical']);\n\nexport const LogPayloadSchema = z.object({\n message: z.string(),\n level: LogLevelSchema.optional(),\n target: z.string().optional(),\n timestamp: z.number().optional(),\n data: z.unknown().optional(),\n});\n\nexport const ErrorPayloadSchema = z.object({ error: z.string() });\n\nexport const AssetMetaPayloadSchema = z.object({\n assets: z.array(AssetMetaSchema),\n});\n\nexport const AssetDataPayloadSchema = z.object({\n id: z.string(),\n hash: z.string(),\n mime: z.string(),\n data: BinaryPayloadDataSchema,\n});\n\nexport const AssetDeletePayloadSchema = z.object({\n ids: z.array(z.string()),\n});\n\nexport const AssetSyncPayloadSchema = z.object({\n assets: z.record(z.string(), z.string()),\n});\n\nexport const ScreenshotRequestPayloadSchema = z.object({\n request_id: z.string(),\n env_id: z.string().optional(),\n chart_id: z.string().optional(),\n format: z.enum(['png', 'jpeg']).optional(),\n quality: z.number().min(0).max(1).optional(),\n});\n\nexport const ScreenshotResponsePayloadSchema = z.object({\n request_id: z.string(),\n data: BinaryPayloadDataSchema.optional(),\n mime: z.string().optional(),\n error: z.string().optional(),\n});\n\nexport const StateSyncRequestSchema = z.object({\n request_id: z.string().optional(),\n parameters: z.array(ParameterSchema),\n actions: z.array(ActionSchema),\n envs: z.array(z.object({\n id: z.string(),\n type: z.string(),\n layers: z.array(z.object({ layer_id: z.string(), layer_type: z.string() })),\n })),\n charts: z.array(ChartMetadataSchema),\n});\n\nexport const ParameterChangePayloadSchema = z.object({\n id: z.string(),\n value: z.unknown(),\n});\n\nexport const ActionStartPayloadSchema = z.object({\n id: z.string(),\n tick_id: z.string().optional(),\n continuous: z.boolean().optional(),\n});\n\nexport const SimulatorToRendererMessageSchema = z.object({\n type: z.enum([\n 'metadata_update',\n 'state_sync_begin',\n 'state_sync_end',\n 'action_end',\n 'action_create',\n 'action_update',\n 'action_delete',\n 'env_create',\n 'env_delete',\n 'env_layer_create',\n 'env_layer_update',\n 'env_layer_delete',\n 'item_create',\n 'item_update',\n 'item_delete',\n 'param_create',\n 'param_update',\n 'param_delete',\n 'param_sync',\n 'chart_create',\n 'chart_update',\n 'chart_delete',\n 'asset_meta',\n 'asset_data',\n 'asset_delete',\n 'screenshot_request',\n 'log',\n 'error',\n ]),\n payload: z.unknown(),\n timestamp: z.number().optional(),\n});\n\nexport const RendererToSimulatorMessageSchema = z.object({\n type: z.enum([\n 'state_sync',\n 'param_change',\n 'action_start',\n 'asset_sync',\n 'screenshot_response',\n 'error',\n ]),\n payload: z.unknown(),\n timestamp: z.number().optional(),\n});\n\nexport const AnyProtocolMessageSchema = z.union([\n SimulatorToRendererMessageSchema,\n RendererToSimulatorMessageSchema,\n]);\n\nexport const getPayloadSchema = (type: string) => {\n switch (type) {\n case 'metadata_update': return MetadataUpdatePayloadSchema;\n case 'state_sync_begin': return StateSyncBoundaryPayloadSchema;\n case 'state_sync_end': return StateSyncBoundaryPayloadSchema;\n case 'action_end': return ActionEndPayloadSchema;\n case 'action_create': return ActionSchema;\n case 'action_update': return ActionSchema;\n case 'action_delete': return ActionDeletePayloadSchema;\n case 'env_create': return EnvCreatePayloadSchema;\n case 'env_delete': return EnvDeletePayloadSchema;\n case 'env_layer_create': return EnvLayerCreatePayloadSchema;\n case 'env_layer_update': return EnvLayerUpdatePayloadSchema;\n case 'env_layer_delete': return EnvLayerDeletePayloadSchema;\n case 'item_create': return ItemCreatePayloadSchema;\n case 'item_update': return ItemUpdatePayloadSchema;\n case 'item_delete': return ItemDeletePayloadSchema;\n case 'param_create': return ParameterSchema;\n case 'param_update': return ParameterSchema;\n case 'param_delete': return ParameterDeletePayloadSchema;\n case 'param_sync': return ParameterSyncPayloadSchema;\n case 'chart_create': return ChartGroupMetadataSchema;\n case 'chart_update': return ChartUpdatePayloadSchema;\n case 'chart_delete': return ChartDeletePayloadSchema;\n case 'asset_meta': return AssetMetaPayloadSchema;\n case 'asset_data': return AssetDataPayloadSchema;\n case 'asset_delete': return AssetDeletePayloadSchema;\n case 'screenshot_request': return ScreenshotRequestPayloadSchema;\n case 'screenshot_response': return ScreenshotResponsePayloadSchema;\n case 'log': return LogPayloadSchema;\n case 'error': return ErrorPayloadSchema;\n case 'state_sync': return StateSyncRequestSchema;\n case 'param_change': return ParameterChangePayloadSchema;\n case 'action_start': return ActionStartPayloadSchema;\n case 'asset_sync': return AssetSyncPayloadSchema;\n default: return z.unknown();\n }\n};\n", "import { z } from 'zod';\n\n/**\n * Asset identifiers and metadata are protocol payloads, not renderer cache\n * objects. Renderers may resolve them into blob URLs or local buffers, but the\n * wire contract stays content-addressed by id plus hash.\n */\nexport const AssetIdSchema = z.string();\n\nexport type AssetId = z.infer<typeof AssetIdSchema>;\n\nexport const AssetMetaSchema = z.object({\n id: AssetIdSchema,\n hash: z.string(),\n mime: z.string(),\n size: z.number(),\n label: z.string().optional(),\n});\n\nexport type AssetMeta = z.infer<typeof AssetMetaSchema>;\n", "import { z } from 'zod';\n\n/**\n * Protocol-level chart types describe series identity and updates only. Chart\n * rendering config, layouts, and UI-specific storage live in renderer packages.\n */\nexport const ChartMetadataSchema = z.object({\n id: z.string(),\n label: z.string(),\n color: z.string().optional(),\n});\n\nexport type ChartMetadata = z.infer<typeof ChartMetadataSchema>;\n\nexport const ChartGroupMetadataSchema = ChartMetadataSchema.extend({\n dataList: z.array(ChartMetadataSchema).optional(),\n});\n\nexport type ChartGroupMetadata = z.infer<typeof ChartGroupMetadataSchema>;\n\nexport const ChartUpdateDataSchema = z.object({\n id: z.string(),\n time: z.number().optional(),\n value: z.unknown(),\n});\n\nexport type ChartUpdateData = z.infer<typeof ChartUpdateDataSchema>;\n\nexport const ChartUpdateOperationSchema = z.object({\n id: z.string(),\n operation: z.literal('clear'),\n});\n\nexport type ChartUpdateOperation = z.infer<typeof ChartUpdateOperationSchema>;\n", "import { z } from 'zod';\n\n/**\n * Parameters describe mutable simulator configuration exposed to the renderer.\n * Actions are intentionally separate in protocol v0.2: they have their own\n * lifecycle and renderer-driven continuous loop semantics.\n */\nexport const ParameterTypeSchema = z.enum(['number', 'enum', 'boolean', 'string']);\n\nexport type ParameterType = z.infer<typeof ParameterTypeSchema>;\n\nexport const ParameterBaseSchema = z.object({\n id: z.string(),\n type: ParameterTypeSchema,\n label: z.string(),\n allowRuntimeChange: z.boolean().optional(),\n});\n\nexport type ParameterBase = z.infer<typeof ParameterBaseSchema>;\n\nexport const NumberParameterSchema = ParameterBaseSchema.extend({\n type: z.literal('number'),\n value: z.number(),\n min: z.number().optional(),\n max: z.number().optional(),\n step: z.number().optional(),\n});\n\nexport type NumberParameter = z.infer<typeof NumberParameterSchema>;\n\nexport const EnumParameterSchema = ParameterBaseSchema.extend({\n type: z.literal('enum'),\n value: z.string(),\n options: z.array(z.string()),\n labels: z.record(z.string(), z.string()).optional(),\n});\n\nexport type EnumParameter = z.infer<typeof EnumParameterSchema>;\n\nexport const BooleanParameterSchema = ParameterBaseSchema.extend({\n type: z.literal('boolean'),\n value: z.boolean(),\n});\n\nexport type BooleanParameter = z.infer<typeof BooleanParameterSchema>;\n\nexport const StringParameterSchema = ParameterBaseSchema.extend({\n type: z.literal('string'),\n value: z.string(),\n});\n\nexport type StringParameter = z.infer<typeof StringParameterSchema>;\n\nexport const ParameterSchema = z.union([\n NumberParameterSchema,\n EnumParameterSchema,\n BooleanParameterSchema,\n StringParameterSchema,\n]);\n\nexport type Parameter = z.infer<typeof ParameterSchema>;\n\nexport const ActionSchema = z.object({\n id: z.string(),\n label: z.string(),\n continuous: z.boolean().optional(),\n allowRuntimeChange: z.boolean().optional(),\n});\n\n/** A renderer-visible command exposed by the simulator. */\nexport type Action = z.infer<typeof ActionSchema>;\n", "const BASE64_DATA_URL_MARKER = ';base64,';\n\ninterface BufferEncoderResult {\n toString(encoding: 'base64'): string;\n}\n\ninterface BufferLike {\n from(data: Uint8Array): BufferEncoderResult;\n from(data: string, encoding: 'base64'): ArrayLike<number>;\n}\n\nexport interface DecodedBinaryString {\n bytes: Uint8Array;\n mime?: string;\n encoding: 'base64' | 'data-url';\n}\n\nfunction getGlobalBuffer(): BufferLike | undefined {\n return (globalThis as { Buffer?: BufferLike }).Buffer;\n}\n\nexport function encodeBytesAsBase64(bytes: Uint8Array): string {\n const buffer = getGlobalBuffer();\n if (buffer) {\n return buffer.from(bytes).toString('base64');\n }\n\n if (typeof btoa === 'function') {\n let binary = '';\n for (let index = 0; index < bytes.length; index += 1) {\n binary += String.fromCharCode(bytes[index]);\n }\n return btoa(binary);\n }\n\n throw new Error('No base64 encoder is available in this runtime.');\n}\n\nexport function encodeBytesAsDataUrl(\n bytes: Uint8Array,\n mime = 'application/octet-stream',\n): string {\n return `data:${mime};base64,${encodeBytesAsBase64(bytes)}`;\n}\n\nexport function decodeBinaryString(value: string): DecodedBinaryString {\n const decoded = tryDecodeBinaryString(value);\n if (!decoded) {\n throw new Error('Expected a base64 string or a base64 data URL.');\n }\n return decoded;\n}\n\nexport function isEncodedBinaryString(value: string): boolean {\n return tryDecodeBinaryString(value) !== null;\n}\n\nfunction tryDecodeBinaryString(value: string): DecodedBinaryString | null {\n if (value.startsWith('data:')) {\n const dataUrl = tryDecodeBase64DataUrl(value);\n if (dataUrl) {\n return dataUrl;\n }\n }\n\n const bytes = tryDecodeBase64(value);\n if (!bytes) {\n return null;\n }\n\n return {\n bytes,\n encoding: 'base64',\n };\n}\n\nfunction tryDecodeBase64DataUrl(value: string): DecodedBinaryString | null {\n const markerIndex = value.indexOf(BASE64_DATA_URL_MARKER);\n if (markerIndex === -1) {\n return null;\n }\n\n const mime = value.slice(5, markerIndex) || undefined;\n const base64 = value.slice(markerIndex + BASE64_DATA_URL_MARKER.length);\n const bytes = tryDecodeBase64(base64);\n if (!bytes) {\n return null;\n }\n\n return {\n bytes,\n mime,\n encoding: 'data-url',\n };\n}\n\nfunction tryDecodeBase64(value: string): Uint8Array | null {\n const normalized = value.replace(/\\s+/g, '');\n if (!normalized || normalized.length % 4 !== 0 || /[^A-Za-z0-9+/=]/.test(normalized)) {\n return null;\n }\n\n try {\n const buffer = getGlobalBuffer();\n if (buffer) {\n return new Uint8Array(buffer.from(normalized, 'base64'));\n }\n\n if (typeof atob === 'function') {\n const binary = atob(normalized);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n return bytes;\n }\n } catch {\n return null;\n }\n\n throw new Error('No base64 decoder is available in this runtime.');\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAOX,IAAM,gBAAgB,EAAE,OAAO;AAI/B,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACtC,IAAI;AAAA,EACJ,MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,OAAO;AAAA,EACf,OAAO,EAAE,OAAO,EAAE,SAAS;AAC7B,CAAC;;;ACjBD,SAAS,KAAAC,UAAS;AAMX,IAAM,sBAAsBA,GAAE,OAAO;AAAA,EAC1C,IAAIA,GAAE,OAAO;AAAA,EACb,OAAOA,GAAE,OAAO;AAAA,EAChB,OAAOA,GAAE,OAAO,EAAE,SAAS;AAC7B,CAAC;AAIM,IAAM,2BAA2B,oBAAoB,OAAO;AAAA,EACjE,UAAUA,GAAE,MAAM,mBAAmB,EAAE,SAAS;AAClD,CAAC;AAIM,IAAM,wBAAwBA,GAAE,OAAO;AAAA,EAC5C,IAAIA,GAAE,OAAO;AAAA,EACb,MAAMA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,OAAOA,GAAE,QAAQ;AACnB,CAAC;AAIM,IAAM,6BAA6BA,GAAE,OAAO;AAAA,EACjD,IAAIA,GAAE,OAAO;AAAA,EACb,WAAWA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AAS,KAAK,UAAU;AAC9B,YAAM,QAAQ,IAAI,WAAW,OAAO,MAAM;AAC1C,eAAS,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;AACrD,cAAM,KAAK,IAAI,OAAO,WAAW,KAAK;AAAA,MACxC;AACA,aAAO;AAAA,IACT;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,QAAM,IAAI,MAAM,iDAAiD;AACnE;;;AJ9GA,IAAM,4BAA4BC,GAAE,OAAO,EAAE;AAAA,EAC3C,CAAC,UAAU,sBAAsB,KAAK;AAAA,EACtC;AACF;AAEA,IAAM,0BAA0BA,GAAE,MAAM,CAAC,2BAA2BA,GAAE,WAAW,UAAU,CAAC,CAAC;AAEtF,IAAM,aAAaA,GAAE,OAAOA,GAAE,OAAO,GAAGA,GAAE,QAAQ,CAAC;AACnD,IAAM,iBAAiBA,GAAE,OAAOA,GAAE,OAAO,GAAGA,GAAE,QAAQ,CAAC;AACvD,IAAM,gBAAgBA,GAAE,OAAOA,GAAE,OAAO,GAAGA,GAAE,QAAQ,CAAC;AACtD,IAAM,yBAAyBA,GAAE,MAAM,CAACA,GAAE,OAAO,GAAGA,GAAE,OAAO,CAAC,CAAC;
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod';\nimport { AssetMetaSchema } from './asset';\nimport {\n ChartGroupMetadataSchema,\n ChartMetadataSchema,\n ChartUpdateDataSchema,\n ChartUpdateOperationSchema,\n} from './chart';\nimport { ActionSchema, ParameterSchema } from './controls';\nimport { isEncodedBinaryString } from './binary';\n\nconst BinaryPayloadStringSchema = z.string().refine(\n (value) => isEncodedBinaryString(value),\n 'Expected a base64 string or a base64 data URL for binary payload data.',\n);\n\nconst BinaryPayloadDataSchema = z.union([BinaryPayloadStringSchema, z.instanceof(Uint8Array)]);\n\nexport const ItemSchema = z.record(z.string(), z.unknown());\nexport const ItemDiffSchema = z.record(z.string(), z.unknown());\nexport const ItemKeySchema = z.record(z.string(), z.unknown());\nexport const PrimitiveItemKeySchema = z.union([z.string(), z.number()]);\n\n/**\n * `metadata_update` carries scenario-wide metadata, including the current\n * simulation time. It replaces the old split between time-step start and end\n * events, and may carry additional simulator-defined metadata fields.\n */\nexport const MetadataUpdatePayloadSchema = z.object({\n time: z.number().optional(),\n}).loose();\n\n/**\n * `state_sync_begin` and `state_sync_end` bracket a simulator replay triggered\n * by `state_sync`. When present, `request_id` is generated by the renderer and\n * echoed by the simulator so initial sync and reconnect transactions can be\n * correlated without making Scenario transport-aware.\n */\nexport const StateSyncBoundaryPayloadSchema = z.object({\n request_id: z.string().optional(),\n});\n\n/** Optional per-action timing buckets used for tick diagnostics. */\nexport const TickTimingBreakdownSchema = z.object({\n simulate_ms: z.number().nonnegative().optional(),\n communicate_ms: z.number().nonnegative().optional(),\n render_ms: z.number().nonnegative().optional(),\n}).catchall(z.number().nonnegative());\n\n/**\n * `action_end` signals completion of one simulator action execution. Simulators\n * should emit state mutations caused by the action before the matching\n * `action_end`. For continuous actions, explicit `continue: false` stops the\n * renderer-driven loop; `tick_id` should echo the renderer-supplied id.\n */\nexport const ActionEndPayloadSchema = z.object({\n id: z.string(),\n tick_id: z.string().optional(),\n continue: z.boolean().optional(),\n timings: TickTimingBreakdownSchema.optional(),\n});\n\n/** `action_delete` removes a renderer-visible action by id. */\nexport const ActionDeletePayloadSchema = z.object({ id: z.string() });\n\n/**\n * `env_create` creates a scenario environment container. `2d` covers grid-like\n * and graph-like scenes; rendering semantics are expressed by layers.\n */\nexport const EnvCreatePayloadSchema = z.object({\n id: z.string(),\n type: z.enum(['uniform', '2d']),\n});\n\n/** `env_delete` removes a scenario environment container by id. */\nexport const EnvDeletePayloadSchema = z.object({ id: z.string() });\n\n/**\n * `env_layer_create` creates an environment-local layer with fixed topology and\n * optional metadata. `dependency_layer_ids` is create-time topology; simulators\n * should recreate the layer or environment if dependencies need to change.\n */\nexport const EnvLayerCreatePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n layer_type: z.string(),\n dependency_layer_ids: z.record(z.string(), z.string()).optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n});\n\n/**\n * `env_layer_update` replaces layer metadata as a whole object. It is not an\n * item diff channel and must not be used to mutate dependency topology.\n */\nexport const EnvLayerUpdatePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n data: z.record(z.string(), z.unknown()),\n});\n\n/** `env_layer_delete` removes one layer from an environment. */\nexport const EnvLayerDeletePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n});\n\n/**\n * `item_create` creates layer-owned items. The exact item schema and primary\n * key are provided by the layer registry entry for the target layer type.\n */\nexport const ItemCreatePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n items: z.array(ItemSchema),\n});\n\n/**\n * `item_update` carries field-level diffs for existing layer-owned items.\n * Diffs must include the layer registry primary key fields so the renderer can\n * identify each target item.\n */\nexport const ItemUpdatePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n items: z.array(ItemDiffSchema),\n});\n\n/**\n * `item_delete` removes layer-owned items. Single-key layers may delete by\n * primitive id; multi-key layers, such as edge layers keyed by source/target,\n * delete by object keys matching the registry primary key fields.\n */\nexport const ItemDeletePayloadSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n items: z.union([z.array(PrimitiveItemKeySchema), z.array(ItemKeySchema)]),\n});\n\n/** `param_delete` removes a renderer-visible parameter by id. */\nexport const ParameterDeletePayloadSchema = z.object({ id: z.string() });\n\n/**\n * `param_sync` pushes a simulator-side value correction after an optimistic\n * renderer edit. A simulator should not emit `param_sync` for every accepted\n * `param_change`; it should emit one only when it rejects the edit or coerces it\n * to a different canonical value. Definition changes, including enum option or\n * label-list changes, are sent with full `param_update` payloads instead.\n */\nexport const ParameterSyncPayloadSchema = z.object({\n id: z.string(),\n value: z.unknown(),\n});\n\n/** `chart_delete` removes a chart or chart series by id. */\nexport const ChartDeletePayloadSchema = z.object({ id: z.string() });\n\n/**\n * `chart_update` carries incremental data points and chart operations such as\n * `clear`. Chart metadata is maintained separately through `chart_create`.\n */\nexport const ChartUpdatePayloadSchema = z.object({\n updates: z.array(ChartUpdateDataSchema).optional(),\n operations: z.array(ChartUpdateOperationSchema).optional(),\n});\n\nexport const LogLevelSchema = z.enum(['debug', 'info', 'warning', 'error', 'critical']);\n\n/** `log` is a diagnostic event emitted by either runtime side. */\nexport const LogPayloadSchema = z.object({\n message: z.string(),\n level: LogLevelSchema.optional(),\n target: z.string().optional(),\n timestamp: z.number().optional(),\n data: z.unknown().optional(),\n});\n\n/** `error` reports a protocol-level or runtime error. */\nexport const ErrorPayloadSchema = z.object({ error: z.string() });\n\n/** `asset_meta` announces cacheable asset descriptors without sending bytes. */\nexport const AssetMetaPayloadSchema = z.object({\n assets: z.array(AssetMetaSchema),\n});\n\n/**\n * `asset_data` sends one asset's bytes. JSON transports carry base64/data URL\n * strings, while binary transports may carry raw `Uint8Array` values.\n */\nexport const AssetDataPayloadSchema = z.object({\n id: z.string(),\n hash: z.string(),\n mime: z.string(),\n data: BinaryPayloadDataSchema,\n});\n\n/** `asset_delete` removes cached renderer-side assets by id. */\nexport const AssetDeletePayloadSchema = z.object({\n ids: z.array(z.string()),\n});\n\n/** `asset_sync` reports the renderer's currently held asset hashes. */\nexport const AssetSyncPayloadSchema = z.object({\n assets: z.record(z.string(), z.string()),\n});\n\n/**\n * `screenshot_request` asks the renderer to capture an environment or chart.\n * Exactly one of `env_id` or `chart_id` should identify the target. `format`\n * defaults to `png`; `quality` is a 0-1 JPEG hint.\n */\nexport const ScreenshotRequestPayloadSchema = z.object({\n request_id: z.string(),\n env_id: z.string().optional(),\n chart_id: z.string().optional(),\n format: z.enum(['png', 'jpeg']).optional(),\n quality: z.number().min(0).max(1).optional(),\n});\n\n/**\n * `screenshot_response` returns a captured image or an error to the simulator.\n * JSON mode uses base64/data URL strings; binary mode may use raw bytes.\n */\nexport const ScreenshotResponsePayloadSchema = z.object({\n request_id: z.string(),\n data: BinaryPayloadDataSchema.optional(),\n mime: z.string().optional(),\n error: z.string().optional(),\n});\n\n/**\n * `state_sync` is sent by the renderer on connect or reconnect. It summarizes\n * renderer-held definitions so the simulator can replay create, update, and\n * delete messages between `state_sync_begin` and `state_sync_end`; simulators\n * do not answer with a reverse `state_sync`.\n */\nexport const StateSyncRequestSchema = z.object({\n request_id: z.string().optional(),\n parameters: z.array(ParameterSchema),\n actions: z.array(ActionSchema),\n envs: z.array(z.object({\n id: z.string(),\n type: z.string(),\n layers: z.array(z.object({ layer_id: z.string(), layer_type: z.string() })),\n })),\n charts: z.array(ChartMetadataSchema),\n});\n\n/**\n * `param_change` is a renderer-side optimistic parameter edit. The simulator is\n * expected to apply accepted values without emitting any sync message. If the\n * edit is rejected or normalized to a different value, the simulator sends\n * `param_sync`; if the parameter definition changes, such as enum options, it\n * sends a full `param_update`.\n */\nexport const ParameterChangePayloadSchema = z.object({\n id: z.string(),\n value: z.unknown(),\n});\n\n/**\n * `action_start` starts one action execution. `continuous` requests a\n * renderer-driven loop, and `tick_id` lets the renderer correlate the eventual\n * `action_end` with one in-flight dispatch.\n */\nexport const ActionStartPayloadSchema = z.object({\n id: z.string(),\n tick_id: z.string().optional(),\n continuous: z.boolean().optional(),\n});\n\n/**\n * Simulator-to-renderer messages mutate renderer-owned Scenario state or ask\n * renderer-side facilities, such as asset cache and screenshots, to do work.\n */\nexport const SimulatorToRendererMessageSchema = z.object({\n type: z.enum([\n 'metadata_update',\n 'state_sync_begin',\n 'state_sync_end',\n 'action_end',\n 'action_create',\n 'action_update',\n 'action_delete',\n 'env_create',\n 'env_delete',\n 'env_layer_create',\n 'env_layer_update',\n 'env_layer_delete',\n 'item_create',\n 'item_update',\n 'item_delete',\n 'param_create',\n 'param_update',\n 'param_delete',\n 'param_sync',\n 'chart_create',\n 'chart_update',\n 'chart_delete',\n 'asset_meta',\n 'asset_data',\n 'asset_delete',\n 'screenshot_request',\n 'log',\n 'error',\n ]),\n payload: z.unknown(),\n timestamp: z.number().optional(),\n});\n\n/**\n * Renderer-to-simulator messages express renderer intent, renderer state\n * summary, or renderer-generated output.\n */\nexport const RendererToSimulatorMessageSchema = z.object({\n type: z.enum([\n 'state_sync',\n 'param_change',\n 'action_start',\n 'asset_sync',\n 'screenshot_response',\n 'error',\n ]),\n payload: z.unknown(),\n timestamp: z.number().optional(),\n});\n\nexport const AnyProtocolMessageSchema = z.union([\n SimulatorToRendererMessageSchema,\n RendererToSimulatorMessageSchema,\n]);\n\nexport const getPayloadSchema = (type: string) => {\n switch (type) {\n case 'metadata_update': return MetadataUpdatePayloadSchema;\n case 'state_sync_begin': return StateSyncBoundaryPayloadSchema;\n case 'state_sync_end': return StateSyncBoundaryPayloadSchema;\n case 'action_end': return ActionEndPayloadSchema;\n case 'action_create': return ActionSchema;\n case 'action_update': return ActionSchema;\n case 'action_delete': return ActionDeletePayloadSchema;\n case 'env_create': return EnvCreatePayloadSchema;\n case 'env_delete': return EnvDeletePayloadSchema;\n case 'env_layer_create': return EnvLayerCreatePayloadSchema;\n case 'env_layer_update': return EnvLayerUpdatePayloadSchema;\n case 'env_layer_delete': return EnvLayerDeletePayloadSchema;\n case 'item_create': return ItemCreatePayloadSchema;\n case 'item_update': return ItemUpdatePayloadSchema;\n case 'item_delete': return ItemDeletePayloadSchema;\n case 'param_create': return ParameterSchema;\n case 'param_update': return ParameterSchema;\n case 'param_delete': return ParameterDeletePayloadSchema;\n case 'param_sync': return ParameterSyncPayloadSchema;\n case 'chart_create': return ChartGroupMetadataSchema;\n case 'chart_update': return ChartUpdatePayloadSchema;\n case 'chart_delete': return ChartDeletePayloadSchema;\n case 'asset_meta': return AssetMetaPayloadSchema;\n case 'asset_data': return AssetDataPayloadSchema;\n case 'asset_delete': return AssetDeletePayloadSchema;\n case 'screenshot_request': return ScreenshotRequestPayloadSchema;\n case 'screenshot_response': return ScreenshotResponsePayloadSchema;\n case 'log': return LogPayloadSchema;\n case 'error': return ErrorPayloadSchema;\n case 'state_sync': return StateSyncRequestSchema;\n case 'param_change': return ParameterChangePayloadSchema;\n case 'action_start': return ActionStartPayloadSchema;\n case 'asset_sync': return AssetSyncPayloadSchema;\n default: return z.unknown();\n }\n};\n", "import { z } from 'zod';\n\n/**\n * Asset identifiers and metadata are protocol payloads, not renderer cache\n * objects. Renderers may resolve them into blob URLs or local buffers, but the\n * wire contract stays content-addressed by id plus hash.\n */\nexport const AssetIdSchema = z.string();\n\nexport type AssetId = z.infer<typeof AssetIdSchema>;\n\nexport const AssetMetaSchema = z.object({\n id: AssetIdSchema,\n hash: z.string(),\n mime: z.string(),\n size: z.number(),\n label: z.string().optional(),\n});\n\nexport type AssetMeta = z.infer<typeof AssetMetaSchema>;\n", "import { z } from 'zod';\n\n/**\n * Protocol-level chart types describe series identity and updates only. Chart\n * rendering config, layouts, and UI-specific storage live in renderer packages.\n */\nexport const ChartMetadataSchema = z.object({\n id: z.string(),\n label: z.string(),\n color: z.string().optional(),\n});\n\nexport type ChartMetadata = z.infer<typeof ChartMetadataSchema>;\n\nexport const ChartGroupMetadataSchema = ChartMetadataSchema.extend({\n dataList: z.array(ChartMetadataSchema).optional(),\n});\n\nexport type ChartGroupMetadata = z.infer<typeof ChartGroupMetadataSchema>;\n\nexport const ChartUpdateDataSchema = z.object({\n id: z.string(),\n time: z.number().optional(),\n value: z.unknown(),\n});\n\nexport type ChartUpdateData = z.infer<typeof ChartUpdateDataSchema>;\n\nexport const ChartUpdateOperationSchema = z.object({\n id: z.string(),\n operation: z.literal('clear'),\n});\n\nexport type ChartUpdateOperation = z.infer<typeof ChartUpdateOperationSchema>;\n", "import { z } from 'zod';\n\n/**\n * Parameters describe mutable simulator configuration exposed to the renderer.\n * Actions are intentionally separate in protocol v0.2: they have their own\n * lifecycle and renderer-driven continuous loop semantics.\n */\nexport const ParameterTypeSchema = z.enum(['number', 'enum', 'boolean', 'string']);\n\nexport type ParameterType = z.infer<typeof ParameterTypeSchema>;\n\nexport const ParameterBaseSchema = z.object({\n id: z.string(),\n type: ParameterTypeSchema,\n label: z.string(),\n allowRuntimeChange: z.boolean().optional(),\n});\n\nexport type ParameterBase = z.infer<typeof ParameterBaseSchema>;\n\nexport const NumberParameterSchema = ParameterBaseSchema.extend({\n type: z.literal('number'),\n value: z.number(),\n min: z.number().optional(),\n max: z.number().optional(),\n step: z.number().optional(),\n});\n\nexport type NumberParameter = z.infer<typeof NumberParameterSchema>;\n\nexport const EnumParameterSchema = ParameterBaseSchema.extend({\n type: z.literal('enum'),\n value: z.string(),\n options: z.array(z.string()),\n labels: z.record(z.string(), z.string()).optional(),\n});\n\nexport type EnumParameter = z.infer<typeof EnumParameterSchema>;\n\nexport const BooleanParameterSchema = ParameterBaseSchema.extend({\n type: z.literal('boolean'),\n value: z.boolean(),\n});\n\nexport type BooleanParameter = z.infer<typeof BooleanParameterSchema>;\n\nexport const StringParameterSchema = ParameterBaseSchema.extend({\n type: z.literal('string'),\n value: z.string(),\n});\n\nexport type StringParameter = z.infer<typeof StringParameterSchema>;\n\nexport const ParameterSchema = z.union([\n NumberParameterSchema,\n EnumParameterSchema,\n BooleanParameterSchema,\n StringParameterSchema,\n]);\n\nexport type Parameter = z.infer<typeof ParameterSchema>;\n\nexport const ActionSchema = z.object({\n id: z.string(),\n label: z.string(),\n continuous: z.boolean().optional(),\n allowRuntimeChange: z.boolean().optional(),\n});\n\n/** A renderer-visible command exposed by the simulator. */\nexport type Action = z.infer<typeof ActionSchema>;\n", "const BASE64_DATA_URL_MARKER = ';base64,';\n\ninterface BufferEncoderResult {\n toString(encoding: 'base64'): string;\n}\n\ninterface BufferLike {\n from(data: Uint8Array): BufferEncoderResult;\n from(data: string, encoding: 'base64'): ArrayLike<number>;\n}\n\nexport interface DecodedBinaryString {\n bytes: Uint8Array;\n mime?: string;\n encoding: 'base64' | 'data-url';\n}\n\nfunction getGlobalBuffer(): BufferLike | undefined {\n return (globalThis as { Buffer?: BufferLike }).Buffer;\n}\n\nexport function encodeBytesAsBase64(bytes: Uint8Array): string {\n const buffer = getGlobalBuffer();\n if (buffer) {\n return buffer.from(bytes).toString('base64');\n }\n\n if (typeof btoa === 'function') {\n let binary = '';\n for (let index = 0; index < bytes.length; index += 1) {\n binary += String.fromCharCode(bytes[index]);\n }\n return btoa(binary);\n }\n\n throw new Error('No base64 encoder is available in this runtime.');\n}\n\nexport function encodeBytesAsDataUrl(\n bytes: Uint8Array,\n mime = 'application/octet-stream',\n): string {\n return `data:${mime};base64,${encodeBytesAsBase64(bytes)}`;\n}\n\nexport function decodeBinaryString(value: string): DecodedBinaryString {\n const decoded = tryDecodeBinaryString(value);\n if (!decoded) {\n throw new Error('Expected a base64 string or a base64 data URL.');\n }\n return decoded;\n}\n\nexport function isEncodedBinaryString(value: string): boolean {\n return tryDecodeBinaryString(value) !== null;\n}\n\nfunction tryDecodeBinaryString(value: string): DecodedBinaryString | null {\n if (value.startsWith('data:')) {\n const dataUrl = tryDecodeBase64DataUrl(value);\n if (dataUrl) {\n return dataUrl;\n }\n }\n\n const bytes = tryDecodeBase64(value);\n if (!bytes) {\n return null;\n }\n\n return {\n bytes,\n encoding: 'base64',\n };\n}\n\nfunction tryDecodeBase64DataUrl(value: string): DecodedBinaryString | null {\n const markerIndex = value.indexOf(BASE64_DATA_URL_MARKER);\n if (markerIndex === -1) {\n return null;\n }\n\n const mime = value.slice(5, markerIndex) || undefined;\n const base64 = value.slice(markerIndex + BASE64_DATA_URL_MARKER.length);\n const bytes = tryDecodeBase64(base64);\n if (!bytes) {\n return null;\n }\n\n return {\n bytes,\n mime,\n encoding: 'data-url',\n };\n}\n\nfunction tryDecodeBase64(value: string): Uint8Array | null {\n const normalized = value.replace(/\\s+/g, '');\n if (!normalized || normalized.length % 4 !== 0 || /[^A-Za-z0-9+/=]/.test(normalized)) {\n return null;\n }\n\n try {\n const buffer = getGlobalBuffer();\n if (buffer) {\n return new Uint8Array(buffer.from(normalized, 'base64'));\n }\n\n if (typeof atob === 'function') {\n const binary = atob(normalized);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n return bytes;\n }\n } catch {\n return null;\n }\n\n throw new Error('No base64 decoder is available in this runtime.');\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAS;AAOX,IAAM,gBAAgB,EAAE,OAAO;AAI/B,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACtC,IAAI;AAAA,EACJ,MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,OAAO;AAAA,EACf,OAAO,EAAE,OAAO,EAAE,SAAS;AAC7B,CAAC;;;ACjBD,SAAS,KAAAC,UAAS;AAMX,IAAM,sBAAsBA,GAAE,OAAO;AAAA,EAC1C,IAAIA,GAAE,OAAO;AAAA,EACb,OAAOA,GAAE,OAAO;AAAA,EAChB,OAAOA,GAAE,OAAO,EAAE,SAAS;AAC7B,CAAC;AAIM,IAAM,2BAA2B,oBAAoB,OAAO;AAAA,EACjE,UAAUA,GAAE,MAAM,mBAAmB,EAAE,SAAS;AAClD,CAAC;AAIM,IAAM,wBAAwBA,GAAE,OAAO;AAAA,EAC5C,IAAIA,GAAE,OAAO;AAAA,EACb,MAAMA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,OAAOA,GAAE,QAAQ;AACnB,CAAC;AAIM,IAAM,6BAA6BA,GAAE,OAAO;AAAA,EACjD,IAAIA,GAAE,OAAO;AAAA,EACb,WAAWA,GAAE,QAAQ,OAAO;AAC9B,CAAC;;;AC/BD,SAAS,KAAAC,UAAS;AAOX,IAAM,sBAAsBA,GAAE,KAAK,CAAC,UAAU,QAAQ,WAAW,QAAQ,CAAC;AAI1E,IAAM,sBAAsBA,GAAE,OAAO;AAAA,EAC1C,IAAIA,GAAE,OAAO;AAAA,EACb,MAAM;AAAA,EACN,OAAOA,GAAE,OAAO;AAAA,EAChB,oBAAoBA,GAAE,QAAQ,EAAE,SAAS;AAC3C,CAAC;AAIM,IAAM,wBA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Ae,aAAO;AAAA,IAC3B,KAAK;AAAe,aAAO;AAAA,IAC3B,KAAK;AAAe,aAAO;AAAA,IAC3B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAc,aAAO;AAAA,IAC1B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAc,aAAO;AAAA,IAC1B,KAAK;AAAc,aAAO;AAAA,IAC1B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAsB,aAAO;AAAA,IAClC,KAAK;AAAuB,aAAO;AAAA,IACnC,KAAK;AAAO,aAAO;AAAA,IACnB,KAAK;AAAS,aAAO;AAAA,IACrB,KAAK;AAAc,aAAO;AAAA,IAC1B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAgB,aAAO;AAAA,IAC5B,KAAK;AAAc,aAAO;AAAA,IAC1B;AAAS,aAAOA,GAAE,QAAQ;AAAA,EAC5B;AACF;",
|
|
6
6
|
"names": ["z", "z", "z", "z"]
|
|
7
7
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ChartGroupMetadata, ChartMetadata, ChartUpdateData, ChartUpdateOperation } from './chart';
|
|
1
|
+
import type { z } from 'zod';
|
|
3
2
|
import type { Action, Parameter } from './controls';
|
|
3
|
+
import type { ChartGroupMetadata } from './chart';
|
|
4
|
+
import type { ActionDeletePayloadSchema, ActionEndPayloadSchema, ActionStartPayloadSchema, AnyProtocolMessageSchema, AssetDataPayloadSchema, AssetDeletePayloadSchema, AssetMetaPayloadSchema, AssetSyncPayloadSchema, ChartDeletePayloadSchema, ChartUpdatePayloadSchema, EnvCreatePayloadSchema, EnvDeletePayloadSchema, EnvLayerCreatePayloadSchema, EnvLayerDeletePayloadSchema, EnvLayerUpdatePayloadSchema, ErrorPayloadSchema, ItemCreatePayloadSchema, ItemDeletePayloadSchema, ItemDiffSchema, ItemKeySchema, ItemSchema, ItemUpdatePayloadSchema, LogLevelSchema, LogPayloadSchema, MetadataUpdatePayloadSchema, ParameterChangePayloadSchema, ParameterDeletePayloadSchema, ParameterSyncPayloadSchema, PrimitiveItemKeySchema, RendererToSimulatorMessageSchema, ScreenshotRequestPayloadSchema, ScreenshotResponsePayloadSchema, SimulatorToRendererMessageSchema, StateSyncBoundaryPayloadSchema, StateSyncRequestSchema, TickTimingBreakdownSchema } from './schemas';
|
|
4
5
|
/**
|
|
5
6
|
* Protocol v0.2 uses renderer/simulator terms instead of client/server terms.
|
|
6
7
|
* The renderer owns synchronized session state; the simulator emits updates and
|
|
@@ -8,14 +9,14 @@ import type { Action, Parameter } from './controls';
|
|
|
8
9
|
* events.
|
|
9
10
|
*/
|
|
10
11
|
export type EnvironmentId = string;
|
|
11
|
-
export type ScenarioEnvironmentType =
|
|
12
|
-
export type ItemRecord =
|
|
13
|
-
export type ItemDiff =
|
|
14
|
-
export type ItemKey =
|
|
15
|
-
export type PrimitiveItemKey =
|
|
16
|
-
export type ItemDeleteItems =
|
|
17
|
-
export type SimulatorToRendererMessageType =
|
|
18
|
-
export type RendererToSimulatorMessageType =
|
|
12
|
+
export type ScenarioEnvironmentType = z.infer<typeof EnvCreatePayloadSchema>['type'];
|
|
13
|
+
export type ItemRecord = z.infer<typeof ItemSchema>;
|
|
14
|
+
export type ItemDiff = z.infer<typeof ItemDiffSchema>;
|
|
15
|
+
export type ItemKey = z.infer<typeof ItemKeySchema>;
|
|
16
|
+
export type PrimitiveItemKey = z.infer<typeof PrimitiveItemKeySchema>;
|
|
17
|
+
export type ItemDeleteItems = ItemDeletePayload['items'];
|
|
18
|
+
export type SimulatorToRendererMessageType = z.infer<typeof SimulatorToRendererMessageSchema>['type'];
|
|
19
|
+
export type RendererToSimulatorMessageType = z.infer<typeof RendererToSimulatorMessageSchema>['type'];
|
|
19
20
|
export type ProtocolMessageType = SimulatorToRendererMessageType | RendererToSimulatorMessageType;
|
|
20
21
|
/** Transport-neutral envelope shared by every protocol message. */
|
|
21
22
|
export interface ProtocolMessage<TType extends ProtocolMessageType = ProtocolMessageType, TPayload = unknown> {
|
|
@@ -23,158 +24,46 @@ export interface ProtocolMessage<TType extends ProtocolMessageType = ProtocolMes
|
|
|
23
24
|
payload: TPayload;
|
|
24
25
|
timestamp?: number;
|
|
25
26
|
}
|
|
26
|
-
export interface SimulatorToRendererMessage<TPayload =
|
|
27
|
-
}
|
|
28
|
-
export interface RendererToSimulatorMessage<TPayload =
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
timings?: TickTimingBreakdown;
|
|
50
|
-
}
|
|
51
|
-
export interface ActionDeletePayload {
|
|
52
|
-
id: string;
|
|
53
|
-
}
|
|
54
|
-
export interface EnvCreatePayload {
|
|
55
|
-
id: EnvironmentId;
|
|
56
|
-
type: ScenarioEnvironmentType;
|
|
57
|
-
}
|
|
58
|
-
export interface EnvDeletePayload {
|
|
59
|
-
id: EnvironmentId;
|
|
60
|
-
}
|
|
61
|
-
export interface EnvLayerCreatePayload {
|
|
62
|
-
env_id: EnvironmentId;
|
|
63
|
-
layer_id: string;
|
|
64
|
-
layer_type: string;
|
|
65
|
-
/** Create-time topology. Change dependencies by recreating the layer. */
|
|
66
|
-
dependency_layer_ids?: Record<string, string>;
|
|
67
|
-
data?: Record<string, unknown>;
|
|
68
|
-
}
|
|
69
|
-
export interface EnvLayerUpdatePayload {
|
|
70
|
-
env_id: EnvironmentId;
|
|
71
|
-
layer_id: string;
|
|
72
|
-
data: Record<string, unknown>;
|
|
73
|
-
}
|
|
74
|
-
export interface EnvLayerDeletePayload {
|
|
75
|
-
env_id: EnvironmentId;
|
|
76
|
-
layer_id: string;
|
|
77
|
-
}
|
|
78
|
-
export interface ItemCreatePayload<TItem extends ItemRecord = ItemRecord> {
|
|
79
|
-
env_id: EnvironmentId;
|
|
80
|
-
layer_id: string;
|
|
81
|
-
items: TItem[];
|
|
82
|
-
}
|
|
83
|
-
export interface ItemUpdatePayload<TItem extends ItemDiff = ItemDiff> {
|
|
84
|
-
env_id: EnvironmentId;
|
|
85
|
-
layer_id: string;
|
|
86
|
-
items: TItem[];
|
|
87
|
-
}
|
|
88
|
-
export interface ItemDeletePayload<TItems extends ItemDeleteItems = ItemDeleteItems> {
|
|
89
|
-
env_id: EnvironmentId;
|
|
90
|
-
layer_id: string;
|
|
91
|
-
items: TItems;
|
|
92
|
-
}
|
|
93
|
-
export interface ParameterDeletePayload {
|
|
94
|
-
id: string;
|
|
95
|
-
}
|
|
96
|
-
export interface ParameterSyncPayload {
|
|
97
|
-
id: string;
|
|
98
|
-
value: unknown;
|
|
99
|
-
}
|
|
100
|
-
export interface ChartDeletePayload {
|
|
101
|
-
id: string;
|
|
102
|
-
}
|
|
103
|
-
export interface ChartUpdatePayload {
|
|
104
|
-
updates?: ChartUpdateData[];
|
|
105
|
-
operations?: ChartUpdateOperation[];
|
|
106
|
-
}
|
|
107
|
-
export type LogLevel = 'debug' | 'info' | 'warning' | 'error' | 'critical';
|
|
108
|
-
export interface LogPayload {
|
|
109
|
-
message: string;
|
|
110
|
-
level?: LogLevel;
|
|
111
|
-
target?: string;
|
|
112
|
-
timestamp?: number;
|
|
113
|
-
data?: unknown;
|
|
114
|
-
}
|
|
27
|
+
export interface SimulatorToRendererMessage<TPayload = SimulatorToRendererPayload> extends ProtocolMessage<SimulatorToRendererMessageType, TPayload> {
|
|
28
|
+
}
|
|
29
|
+
export interface RendererToSimulatorMessage<TPayload = RendererToSimulatorPayload> extends ProtocolMessage<RendererToSimulatorMessageType, TPayload> {
|
|
30
|
+
}
|
|
31
|
+
export type MetadataUpdatePayload = z.infer<typeof MetadataUpdatePayloadSchema>;
|
|
32
|
+
export type StateSyncBoundaryPayload = z.infer<typeof StateSyncBoundaryPayloadSchema>;
|
|
33
|
+
export type TickTimingBreakdown = z.infer<typeof TickTimingBreakdownSchema>;
|
|
34
|
+
export type ActionEndPayload = z.infer<typeof ActionEndPayloadSchema>;
|
|
35
|
+
export type ActionDeletePayload = z.infer<typeof ActionDeletePayloadSchema>;
|
|
36
|
+
export type EnvCreatePayload = z.infer<typeof EnvCreatePayloadSchema>;
|
|
37
|
+
export type EnvDeletePayload = z.infer<typeof EnvDeletePayloadSchema>;
|
|
38
|
+
export type EnvLayerCreatePayload = z.infer<typeof EnvLayerCreatePayloadSchema>;
|
|
39
|
+
export type EnvLayerUpdatePayload = z.infer<typeof EnvLayerUpdatePayloadSchema>;
|
|
40
|
+
export type EnvLayerDeletePayload = z.infer<typeof EnvLayerDeletePayloadSchema>;
|
|
41
|
+
export type ItemCreatePayload = z.infer<typeof ItemCreatePayloadSchema>;
|
|
42
|
+
export type ItemUpdatePayload = z.infer<typeof ItemUpdatePayloadSchema>;
|
|
43
|
+
export type ItemDeletePayload = z.infer<typeof ItemDeletePayloadSchema>;
|
|
44
|
+
export type ParameterDeletePayload = z.infer<typeof ParameterDeletePayloadSchema>;
|
|
45
|
+
export type ParameterSyncPayload = z.infer<typeof ParameterSyncPayloadSchema>;
|
|
46
|
+
export type ChartDeletePayload = z.infer<typeof ChartDeletePayloadSchema>;
|
|
47
|
+
export type ChartUpdatePayload = z.infer<typeof ChartUpdatePayloadSchema>;
|
|
48
|
+
export type LogLevel = z.infer<typeof LogLevelSchema>;
|
|
49
|
+
export type LogPayload = z.infer<typeof LogPayloadSchema>;
|
|
115
50
|
export interface NormalizedLogPayload extends LogPayload {
|
|
116
51
|
level: LogLevel;
|
|
117
52
|
timestamp: number;
|
|
118
53
|
}
|
|
119
|
-
export
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
export
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
export
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/** JSON transports carry base64/data URLs; binary transports carry bytes. */
|
|
130
|
-
data: string | Uint8Array;
|
|
131
|
-
}
|
|
132
|
-
export interface AssetDeletePayload {
|
|
133
|
-
ids: AssetId[];
|
|
134
|
-
}
|
|
135
|
-
export interface AssetSyncPayload {
|
|
136
|
-
assets: Record<AssetId, string>;
|
|
137
|
-
}
|
|
138
|
-
export interface ScreenshotRequestPayload {
|
|
139
|
-
request_id: string;
|
|
140
|
-
env_id?: string;
|
|
141
|
-
chart_id?: string;
|
|
142
|
-
format?: 'png' | 'jpeg';
|
|
143
|
-
quality?: number;
|
|
144
|
-
}
|
|
145
|
-
export interface ScreenshotResponsePayload {
|
|
146
|
-
request_id: string;
|
|
147
|
-
data?: string | Uint8Array;
|
|
148
|
-
mime?: string;
|
|
149
|
-
error?: string;
|
|
150
|
-
}
|
|
151
|
-
export interface StateSyncRequest {
|
|
152
|
-
request_id?: string;
|
|
153
|
-
/** Current renderer-held definitions used by the simulator to replay deltas. */
|
|
154
|
-
parameters: Parameter[];
|
|
155
|
-
actions: Action[];
|
|
156
|
-
envs: Array<{
|
|
157
|
-
id: EnvironmentId;
|
|
158
|
-
type: string;
|
|
159
|
-
layers: Array<{
|
|
160
|
-
layer_id: string;
|
|
161
|
-
layer_type: string;
|
|
162
|
-
}>;
|
|
163
|
-
}>;
|
|
164
|
-
charts: ChartMetadata[];
|
|
165
|
-
}
|
|
166
|
-
export interface ParameterChangePayload {
|
|
167
|
-
id: string;
|
|
168
|
-
value: unknown;
|
|
169
|
-
}
|
|
170
|
-
export interface ActionStartPayload {
|
|
171
|
-
id: string;
|
|
172
|
-
tick_id?: string;
|
|
173
|
-
continuous?: boolean;
|
|
174
|
-
}
|
|
54
|
+
export type ErrorPayload = z.infer<typeof ErrorPayloadSchema>;
|
|
55
|
+
export type AssetMetaPayload = z.infer<typeof AssetMetaPayloadSchema>;
|
|
56
|
+
export type AssetDataPayload = z.infer<typeof AssetDataPayloadSchema>;
|
|
57
|
+
export type AssetDeletePayload = z.infer<typeof AssetDeletePayloadSchema>;
|
|
58
|
+
export type AssetSyncPayload = z.infer<typeof AssetSyncPayloadSchema>;
|
|
59
|
+
export type ScreenshotRequestPayload = z.infer<typeof ScreenshotRequestPayloadSchema>;
|
|
60
|
+
export type ScreenshotResponsePayload = z.infer<typeof ScreenshotResponsePayloadSchema>;
|
|
61
|
+
export type StateSyncRequest = z.infer<typeof StateSyncRequestSchema>;
|
|
62
|
+
export type ParameterChangePayload = z.infer<typeof ParameterChangePayloadSchema>;
|
|
63
|
+
export type ActionStartPayload = z.infer<typeof ActionStartPayloadSchema>;
|
|
175
64
|
export type SimulatorToRendererPayload = MetadataUpdatePayload | StateSyncBoundaryPayload | ActionEndPayload | Action | ActionDeletePayload | EnvCreatePayload | EnvDeletePayload | EnvLayerCreatePayload | EnvLayerUpdatePayload | EnvLayerDeletePayload | ItemCreatePayload | ItemUpdatePayload | ItemDeletePayload | Parameter | ParameterDeletePayload | ParameterSyncPayload | ChartGroupMetadata | ChartUpdatePayload | ChartDeletePayload | AssetMetaPayload | AssetDataPayload | AssetDeletePayload | ScreenshotRequestPayload | LogPayload | ErrorPayload;
|
|
176
65
|
export type RendererToSimulatorPayload = StateSyncRequest | ParameterChangePayload | ActionStartPayload | AssetSyncPayload | ScreenshotResponsePayload | ErrorPayload;
|
|
177
66
|
export type SimulatorToRendererWSMessage = SimulatorToRendererMessage<SimulatorToRendererPayload>;
|
|
178
67
|
export type RendererToSimulatorWSMessage = RendererToSimulatorMessage<RendererToSimulatorPayload>;
|
|
179
|
-
export type AnyProtocolMessage =
|
|
68
|
+
export type AnyProtocolMessage = z.infer<typeof AnyProtocolMessageSchema>;
|
|
180
69
|
//# sourceMappingURL=types.d.ts.map
|