@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
|
@@ -0,0 +1,1342 @@
|
|
|
1
|
+
# TenSnap Protocol Type Definitions
|
|
2
|
+
|
|
3
|
+
This file is generated from the runtime Zod schemas. Edit `src/*.ts`, not this file.
|
|
4
|
+
|
|
5
|
+
## Package Metadata
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| Package | `@tensnap/protocol` |
|
|
10
|
+
| Version | `0.2.1` |
|
|
11
|
+
| Description | Canonical TenSnap renderer/simulator protocol payload types, schemas, and codecs. |
|
|
12
|
+
| License | `MIT` |
|
|
13
|
+
| Generated At | `2026-07-09T18:05:00.513Z` |
|
|
14
|
+
| Source Files | `packages/protocol/src/asset.ts`, `packages/protocol/src/chart.ts`, `packages/protocol/src/controls.ts`, `packages/protocol/src/layers.ts`, `packages/protocol/src/schemas.ts`, `packages/protocol/src/types.ts` |
|
|
15
|
+
|
|
16
|
+
## Payload Schemas
|
|
17
|
+
|
|
18
|
+
### MetadataUpdatePayload
|
|
19
|
+
|
|
20
|
+
Schema: `MetadataUpdatePayloadSchema` (schemas.ts)
|
|
21
|
+
|
|
22
|
+
`metadata_update` carries scenario-wide metadata, including the current
|
|
23
|
+
simulation time. It replaces the old split between time-step start and end
|
|
24
|
+
events, and may carry additional simulator-defined metadata fields.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
export type MetadataUpdatePayload = {
|
|
28
|
+
time?: number | undefined;
|
|
29
|
+
[x: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### StateSyncBoundaryPayload
|
|
34
|
+
|
|
35
|
+
Schema: `StateSyncBoundaryPayloadSchema` (schemas.ts)
|
|
36
|
+
|
|
37
|
+
`state_sync_begin` and `state_sync_end` bracket a simulator replay triggered
|
|
38
|
+
by `state_sync`. When present, `request_id` is generated by the renderer and
|
|
39
|
+
echoed by the simulator so initial sync and reconnect transactions can be
|
|
40
|
+
correlated without making Scenario transport-aware.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
export type StateSyncBoundaryPayload = {
|
|
44
|
+
request_id?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### TickTimingBreakdown
|
|
49
|
+
|
|
50
|
+
Schema: `TickTimingBreakdownSchema` (schemas.ts)
|
|
51
|
+
|
|
52
|
+
Optional per-action timing buckets used for tick diagnostics.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
export type TickTimingBreakdown = {
|
|
56
|
+
simulate_ms?: number | undefined;
|
|
57
|
+
communicate_ms?: number | undefined;
|
|
58
|
+
render_ms?: number | undefined;
|
|
59
|
+
[x: string]: number;
|
|
60
|
+
};
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### ActionEndPayload
|
|
64
|
+
|
|
65
|
+
Schema: `ActionEndPayloadSchema` (schemas.ts)
|
|
66
|
+
|
|
67
|
+
`action_end` signals completion of one simulator action execution. Simulators
|
|
68
|
+
should emit state mutations caused by the action before the matching
|
|
69
|
+
`action_end`. For continuous actions, explicit `continue: false` stops the
|
|
70
|
+
renderer-driven loop; `tick_id` should echo the renderer-supplied id.
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
export type ActionEndPayload = {
|
|
74
|
+
id: string;
|
|
75
|
+
tick_id?: string | undefined;
|
|
76
|
+
continue?: boolean | undefined;
|
|
77
|
+
timings?: TickTimingBreakdown | undefined;
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### ActionDeletePayload
|
|
82
|
+
|
|
83
|
+
Schema: `ActionDeletePayloadSchema` (schemas.ts)
|
|
84
|
+
|
|
85
|
+
`action_delete` removes a renderer-visible action by id.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
export type ActionDeletePayload = {
|
|
89
|
+
id: string;
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### EnvCreatePayload
|
|
94
|
+
|
|
95
|
+
Schema: `EnvCreatePayloadSchema` (schemas.ts)
|
|
96
|
+
|
|
97
|
+
`env_create` creates a scenario environment container. `2d` covers grid-like
|
|
98
|
+
and graph-like scenes; rendering semantics are expressed by layers.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
export type EnvCreatePayload = {
|
|
102
|
+
id: string;
|
|
103
|
+
type: "uniform" | "2d";
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### EnvDeletePayload
|
|
108
|
+
|
|
109
|
+
Schema: `EnvDeletePayloadSchema` (schemas.ts)
|
|
110
|
+
|
|
111
|
+
`env_delete` removes a scenario environment container by id.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
export type EnvDeletePayload = {
|
|
115
|
+
id: string;
|
|
116
|
+
};
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### EnvLayerCreatePayload
|
|
120
|
+
|
|
121
|
+
Schema: `EnvLayerCreatePayloadSchema` (schemas.ts)
|
|
122
|
+
|
|
123
|
+
`env_layer_create` creates an environment-local layer with fixed topology and
|
|
124
|
+
optional metadata. `dependency_layer_ids` is create-time topology; simulators
|
|
125
|
+
should recreate the layer or environment if dependencies need to change.
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
export type EnvLayerCreatePayload = {
|
|
129
|
+
env_id: string;
|
|
130
|
+
layer_id: string;
|
|
131
|
+
layer_type: string;
|
|
132
|
+
dependency_layer_ids?: {
|
|
133
|
+
[key: string]: string;
|
|
134
|
+
} | undefined;
|
|
135
|
+
data?: {
|
|
136
|
+
[key: string]: unknown;
|
|
137
|
+
} | undefined;
|
|
138
|
+
};
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### EnvLayerUpdatePayload
|
|
142
|
+
|
|
143
|
+
Schema: `EnvLayerUpdatePayloadSchema` (schemas.ts)
|
|
144
|
+
|
|
145
|
+
`env_layer_update` replaces layer metadata as a whole object. It is not an
|
|
146
|
+
item diff channel and must not be used to mutate dependency topology.
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
export type EnvLayerUpdatePayload = {
|
|
150
|
+
env_id: string;
|
|
151
|
+
layer_id: string;
|
|
152
|
+
data: {
|
|
153
|
+
[key: string]: unknown;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### EnvLayerDeletePayload
|
|
159
|
+
|
|
160
|
+
Schema: `EnvLayerDeletePayloadSchema` (schemas.ts)
|
|
161
|
+
|
|
162
|
+
`env_layer_delete` removes one layer from an environment.
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
export type EnvLayerDeletePayload = {
|
|
166
|
+
env_id: string;
|
|
167
|
+
layer_id: string;
|
|
168
|
+
};
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### ItemCreatePayload
|
|
172
|
+
|
|
173
|
+
Schema: `ItemCreatePayloadSchema` (schemas.ts)
|
|
174
|
+
|
|
175
|
+
`item_create` creates layer-owned items. The exact item schema and primary
|
|
176
|
+
key are provided by the layer registry entry for the target layer type.
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
export type ItemCreatePayload = {
|
|
180
|
+
env_id: string;
|
|
181
|
+
layer_id: string;
|
|
182
|
+
items: ItemRecord[];
|
|
183
|
+
};
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### ItemUpdatePayload
|
|
187
|
+
|
|
188
|
+
Schema: `ItemUpdatePayloadSchema` (schemas.ts)
|
|
189
|
+
|
|
190
|
+
`item_update` carries field-level diffs for existing layer-owned items.
|
|
191
|
+
Diffs must include the layer registry primary key fields so the renderer can
|
|
192
|
+
identify each target item.
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
export type ItemUpdatePayload = {
|
|
196
|
+
env_id: string;
|
|
197
|
+
layer_id: string;
|
|
198
|
+
items: ItemDiff[];
|
|
199
|
+
};
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### ItemDeletePayload
|
|
203
|
+
|
|
204
|
+
Schema: `ItemDeletePayloadSchema` (schemas.ts)
|
|
205
|
+
|
|
206
|
+
`item_delete` removes layer-owned items. Single-key layers may delete by
|
|
207
|
+
primitive id; multi-key layers, such as edge layers keyed by source/target,
|
|
208
|
+
delete by object keys matching the registry primary key fields.
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
export type ItemDeletePayload = {
|
|
212
|
+
env_id: string;
|
|
213
|
+
layer_id: string;
|
|
214
|
+
items: PrimitiveItemKey[] | ItemKey[];
|
|
215
|
+
};
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### ParameterDeletePayload
|
|
219
|
+
|
|
220
|
+
Schema: `ParameterDeletePayloadSchema` (schemas.ts)
|
|
221
|
+
|
|
222
|
+
`param_delete` removes a renderer-visible parameter by id.
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
export type ParameterDeletePayload = {
|
|
226
|
+
id: string;
|
|
227
|
+
};
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### ParameterSyncPayload
|
|
231
|
+
|
|
232
|
+
Schema: `ParameterSyncPayloadSchema` (schemas.ts)
|
|
233
|
+
|
|
234
|
+
`param_sync` pushes a simulator-side value correction after an optimistic
|
|
235
|
+
renderer edit. A simulator should not emit `param_sync` for every accepted
|
|
236
|
+
`param_change`; it should emit one only when it rejects the edit or coerces it
|
|
237
|
+
to a different canonical value. Definition changes, including enum option or
|
|
238
|
+
label-list changes, are sent with full `param_update` payloads instead.
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
export type ParameterSyncPayload = {
|
|
242
|
+
id: string;
|
|
243
|
+
value: unknown;
|
|
244
|
+
};
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### ChartDeletePayload
|
|
248
|
+
|
|
249
|
+
Schema: `ChartDeletePayloadSchema` (schemas.ts)
|
|
250
|
+
|
|
251
|
+
`chart_delete` removes a chart or chart series by id.
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
export type ChartDeletePayload = {
|
|
255
|
+
id: string;
|
|
256
|
+
};
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### ChartUpdatePayload
|
|
260
|
+
|
|
261
|
+
Schema: `ChartUpdatePayloadSchema` (schemas.ts)
|
|
262
|
+
|
|
263
|
+
`chart_update` carries incremental data points and chart operations such as
|
|
264
|
+
`clear`. Chart metadata is maintained separately through `chart_create`.
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
export type ChartUpdatePayload = {
|
|
268
|
+
updates?: ChartUpdateData[] | undefined;
|
|
269
|
+
operations?: ChartUpdateOperation[] | undefined;
|
|
270
|
+
};
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### LogPayload
|
|
274
|
+
|
|
275
|
+
Schema: `LogPayloadSchema` (schemas.ts)
|
|
276
|
+
|
|
277
|
+
`log` is a diagnostic event emitted by either runtime side.
|
|
278
|
+
|
|
279
|
+
```ts
|
|
280
|
+
export type LogPayload = {
|
|
281
|
+
message: string;
|
|
282
|
+
level?: LogLevel | undefined;
|
|
283
|
+
target?: string | undefined;
|
|
284
|
+
timestamp?: number | undefined;
|
|
285
|
+
data?: unknown | undefined;
|
|
286
|
+
};
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### ErrorPayload
|
|
290
|
+
|
|
291
|
+
Schema: `ErrorPayloadSchema` (schemas.ts)
|
|
292
|
+
|
|
293
|
+
`error` reports a protocol-level or runtime error.
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
export type ErrorPayload = {
|
|
297
|
+
error: string;
|
|
298
|
+
};
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### AssetMetaPayload
|
|
302
|
+
|
|
303
|
+
Schema: `AssetMetaPayloadSchema` (schemas.ts)
|
|
304
|
+
|
|
305
|
+
`asset_meta` announces cacheable asset descriptors without sending bytes.
|
|
306
|
+
|
|
307
|
+
```ts
|
|
308
|
+
export type AssetMetaPayload = {
|
|
309
|
+
assets: AssetMeta[];
|
|
310
|
+
};
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### AssetDataPayload
|
|
314
|
+
|
|
315
|
+
Schema: `AssetDataPayloadSchema` (schemas.ts)
|
|
316
|
+
|
|
317
|
+
`asset_data` sends one asset's bytes. JSON transports carry base64/data URL
|
|
318
|
+
strings, while binary transports may carry raw `Uint8Array` values.
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
export type AssetDataPayload = {
|
|
322
|
+
id: string;
|
|
323
|
+
hash: string;
|
|
324
|
+
mime: string;
|
|
325
|
+
data: string | Uint8Array;
|
|
326
|
+
};
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### AssetDeletePayload
|
|
330
|
+
|
|
331
|
+
Schema: `AssetDeletePayloadSchema` (schemas.ts)
|
|
332
|
+
|
|
333
|
+
`asset_delete` removes cached renderer-side assets by id.
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
export type AssetDeletePayload = {
|
|
337
|
+
ids: string[];
|
|
338
|
+
};
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### AssetSyncPayload
|
|
342
|
+
|
|
343
|
+
Schema: `AssetSyncPayloadSchema` (schemas.ts)
|
|
344
|
+
|
|
345
|
+
`asset_sync` reports the renderer's currently held asset hashes.
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
export type AssetSyncPayload = {
|
|
349
|
+
assets: {
|
|
350
|
+
[key: string]: string;
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### ScreenshotRequestPayload
|
|
356
|
+
|
|
357
|
+
Schema: `ScreenshotRequestPayloadSchema` (schemas.ts)
|
|
358
|
+
|
|
359
|
+
`screenshot_request` asks the renderer to capture an environment or chart.
|
|
360
|
+
Exactly one of `env_id` or `chart_id` should identify the target. `format`
|
|
361
|
+
defaults to `png`; `quality` is a 0-1 JPEG hint.
|
|
362
|
+
|
|
363
|
+
```ts
|
|
364
|
+
export type ScreenshotRequestPayload = {
|
|
365
|
+
request_id: string;
|
|
366
|
+
env_id?: string | undefined;
|
|
367
|
+
chart_id?: string | undefined;
|
|
368
|
+
format?: ("png" | "jpeg") | undefined;
|
|
369
|
+
quality?: number | undefined;
|
|
370
|
+
};
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### ScreenshotResponsePayload
|
|
374
|
+
|
|
375
|
+
Schema: `ScreenshotResponsePayloadSchema` (schemas.ts)
|
|
376
|
+
|
|
377
|
+
`screenshot_response` returns a captured image or an error to the simulator.
|
|
378
|
+
JSON mode uses base64/data URL strings; binary mode may use raw bytes.
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
export type ScreenshotResponsePayload = {
|
|
382
|
+
request_id: string;
|
|
383
|
+
data?: (string | Uint8Array) | undefined;
|
|
384
|
+
mime?: string | undefined;
|
|
385
|
+
error?: string | undefined;
|
|
386
|
+
};
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### StateSyncRequest
|
|
390
|
+
|
|
391
|
+
Schema: `StateSyncRequestSchema` (schemas.ts)
|
|
392
|
+
|
|
393
|
+
`state_sync` is sent by the renderer on connect or reconnect. It summarizes
|
|
394
|
+
renderer-held definitions so the simulator can replay create, update, and
|
|
395
|
+
delete messages between `state_sync_begin` and `state_sync_end`; simulators
|
|
396
|
+
do not answer with a reverse `state_sync`.
|
|
397
|
+
|
|
398
|
+
```ts
|
|
399
|
+
export type StateSyncRequest = {
|
|
400
|
+
request_id?: string | undefined;
|
|
401
|
+
parameters: Parameter[];
|
|
402
|
+
actions: Action[];
|
|
403
|
+
envs: {
|
|
404
|
+
id: string;
|
|
405
|
+
type: string;
|
|
406
|
+
layers: {
|
|
407
|
+
layer_id: string;
|
|
408
|
+
layer_type: string;
|
|
409
|
+
}[];
|
|
410
|
+
}[];
|
|
411
|
+
charts: ChartMetadata[];
|
|
412
|
+
};
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### ParameterChangePayload
|
|
416
|
+
|
|
417
|
+
Schema: `ParameterChangePayloadSchema` (schemas.ts)
|
|
418
|
+
|
|
419
|
+
`param_change` is a renderer-side optimistic parameter edit. The simulator is
|
|
420
|
+
expected to apply accepted values without emitting any sync message. If the
|
|
421
|
+
edit is rejected or normalized to a different value, the simulator sends
|
|
422
|
+
`param_sync`; if the parameter definition changes, such as enum options, it
|
|
423
|
+
sends a full `param_update`.
|
|
424
|
+
|
|
425
|
+
```ts
|
|
426
|
+
export type ParameterChangePayload = {
|
|
427
|
+
id: string;
|
|
428
|
+
value: unknown;
|
|
429
|
+
};
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### ActionStartPayload
|
|
433
|
+
|
|
434
|
+
Schema: `ActionStartPayloadSchema` (schemas.ts)
|
|
435
|
+
|
|
436
|
+
`action_start` starts one action execution. `continuous` requests a
|
|
437
|
+
renderer-driven loop, and `tick_id` lets the renderer correlate the eventual
|
|
438
|
+
`action_end` with one in-flight dispatch.
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
export type ActionStartPayload = {
|
|
442
|
+
id: string;
|
|
443
|
+
tick_id?: string | undefined;
|
|
444
|
+
continuous?: boolean | undefined;
|
|
445
|
+
};
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## Message Envelopes
|
|
449
|
+
|
|
450
|
+
### SimulatorToRendererMessage
|
|
451
|
+
|
|
452
|
+
Schema: `SimulatorToRendererMessageSchema` (schemas.ts)
|
|
453
|
+
|
|
454
|
+
Simulator-to-renderer messages mutate renderer-owned Scenario state or ask
|
|
455
|
+
renderer-side facilities, such as asset cache and screenshots, to do work.
|
|
456
|
+
|
|
457
|
+
```ts
|
|
458
|
+
export type SimulatorToRendererMessage = {
|
|
459
|
+
type: "metadata_update" | "state_sync_begin" | "state_sync_end" | "action_end" | "action_create" | "action_update" | "action_delete" | "env_create" | "env_delete" | "env_layer_create" | "env_layer_update" | "env_layer_delete" | "item_create" | "item_update" | "item_delete" | "param_create" | "param_update" | "param_delete" | "param_sync" | "chart_create" | "chart_update" | "chart_delete" | "asset_meta" | "asset_data" | "asset_delete" | "screenshot_request" | "log" | "error";
|
|
460
|
+
payload: unknown;
|
|
461
|
+
timestamp?: number | undefined;
|
|
462
|
+
};
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### RendererToSimulatorMessage
|
|
466
|
+
|
|
467
|
+
Schema: `RendererToSimulatorMessageSchema` (schemas.ts)
|
|
468
|
+
|
|
469
|
+
Renderer-to-simulator messages express renderer intent, renderer state
|
|
470
|
+
summary, or renderer-generated output.
|
|
471
|
+
|
|
472
|
+
```ts
|
|
473
|
+
export type RendererToSimulatorMessage = {
|
|
474
|
+
type: "state_sync" | "param_change" | "action_start" | "asset_sync" | "screenshot_response" | "error";
|
|
475
|
+
payload: unknown;
|
|
476
|
+
timestamp?: number | undefined;
|
|
477
|
+
};
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### AnyProtocolMessage
|
|
481
|
+
|
|
482
|
+
Schema: `AnyProtocolMessageSchema` (schemas.ts)
|
|
483
|
+
|
|
484
|
+
No schema comment is defined.
|
|
485
|
+
|
|
486
|
+
```ts
|
|
487
|
+
export type AnyProtocolMessage = SimulatorToRendererMessage | RendererToSimulatorMessage;
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
## Built-in Layer Schemas
|
|
491
|
+
|
|
492
|
+
### BuiltinLayerType
|
|
493
|
+
|
|
494
|
+
Schema: `BuiltinLayerTypeSchema` (layers.ts)
|
|
495
|
+
|
|
496
|
+
The five layer types built into the default TenSnap renderer registry.
|
|
497
|
+
Third-party layer types may still use open `layer_type` strings in the
|
|
498
|
+
generic protocol payloads.
|
|
499
|
+
|
|
500
|
+
```ts
|
|
501
|
+
export type BuiltinLayerType = "background" | "grid" | "edge" | "trajectory" | "agent";
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### AgentId
|
|
505
|
+
|
|
506
|
+
Schema: `AgentIdSchema` (layers.ts)
|
|
507
|
+
|
|
508
|
+
Agent ids are stable layer item keys and may be strings or numbers.
|
|
509
|
+
|
|
510
|
+
```ts
|
|
511
|
+
export type AgentId = string | number;
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### BuiltinAgentIcon
|
|
515
|
+
|
|
516
|
+
Schema: `BuiltinAgentIconSchema` (layers.ts)
|
|
517
|
+
|
|
518
|
+
Built-in symbolic agent icons rendered by the default agent layer.
|
|
519
|
+
|
|
520
|
+
```ts
|
|
521
|
+
export type BuiltinAgentIcon = "arrow" | "circle" | "square" | "triangle" | "diamond" | "star" | "hexagon" | "cross" | "plus" | "pentagon";
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### AssetAgentIcon
|
|
525
|
+
|
|
526
|
+
Schema: `AssetAgentIconSchema` (layers.ts)
|
|
527
|
+
|
|
528
|
+
Asset-backed icons use the `asset:<asset_id>` reference form.
|
|
529
|
+
|
|
530
|
+
```ts
|
|
531
|
+
export type AssetAgentIcon = `asset:${string}`;
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### AgentIcon
|
|
535
|
+
|
|
536
|
+
Schema: `AgentIconSchema` (layers.ts)
|
|
537
|
+
|
|
538
|
+
No schema comment is defined.
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
export type AgentIcon = BuiltinAgentIcon | AssetAgentIcon;
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### BaseLayerMetadata
|
|
545
|
+
|
|
546
|
+
Schema: `BaseLayerMetadataSchema` (layers.ts)
|
|
547
|
+
|
|
548
|
+
Common metadata accepted by all built-in layers. Dependencies are create-time
|
|
549
|
+
topology and live on `env_layer_create.dependency_layer_ids`, not in metadata.
|
|
550
|
+
|
|
551
|
+
```ts
|
|
552
|
+
export type BaseLayerMetadata = {
|
|
553
|
+
dependency_layer_ids?: never | undefined;
|
|
554
|
+
z_index?: number | undefined;
|
|
555
|
+
[x: string]: unknown;
|
|
556
|
+
};
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### AgentLayerMetadata
|
|
560
|
+
|
|
561
|
+
Schema: `AgentLayerMetadataSchema` (layers.ts)
|
|
562
|
+
|
|
563
|
+
Agent layer metadata. `coord_offset` selects integer grid-cell coordinates or
|
|
564
|
+
floating scene coordinates for x/y agent positions.
|
|
565
|
+
|
|
566
|
+
```ts
|
|
567
|
+
export type AgentLayerMetadata = {
|
|
568
|
+
dependency_layer_ids?: never | undefined;
|
|
569
|
+
z_index?: number | undefined;
|
|
570
|
+
width?: number | undefined;
|
|
571
|
+
height?: number | undefined;
|
|
572
|
+
coord_offset?: ("int" | "float") | undefined;
|
|
573
|
+
[x: string]: unknown;
|
|
574
|
+
};
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### AgentItem
|
|
578
|
+
|
|
579
|
+
Schema: `AgentItemSchema` (layers.ts)
|
|
580
|
+
|
|
581
|
+
Agent items are keyed by `id`. They can represent grid agents or graph nodes;
|
|
582
|
+
graph-force fields (`vx`, `vy`, `fx`, `fy`) are renderer-maintained hints.
|
|
583
|
+
|
|
584
|
+
```ts
|
|
585
|
+
export type AgentItem = {
|
|
586
|
+
id: AgentId;
|
|
587
|
+
color?: string | undefined;
|
|
588
|
+
icon?: AgentIcon | undefined;
|
|
589
|
+
size?: number | undefined;
|
|
590
|
+
x?: number | undefined;
|
|
591
|
+
y?: number | undefined;
|
|
592
|
+
vx?: number | undefined;
|
|
593
|
+
vy?: number | undefined;
|
|
594
|
+
fx?: (number | null) | undefined;
|
|
595
|
+
fy?: (number | null) | undefined;
|
|
596
|
+
heading?: number | undefined;
|
|
597
|
+
data?: {
|
|
598
|
+
[key: string]: unknown;
|
|
599
|
+
} | undefined;
|
|
600
|
+
[x: string]: unknown;
|
|
601
|
+
};
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
### AgentItemDiff
|
|
605
|
+
|
|
606
|
+
Schema: `AgentItemDiffSchema` (layers.ts)
|
|
607
|
+
|
|
608
|
+
Agent item updates are keyed by `id` and may carry any changed fields.
|
|
609
|
+
|
|
610
|
+
```ts
|
|
611
|
+
export type AgentItemDiff = {
|
|
612
|
+
id: AgentId;
|
|
613
|
+
[x: string]: unknown;
|
|
614
|
+
};
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
### EdgeLayerMetadata
|
|
618
|
+
|
|
619
|
+
Schema: `EdgeLayerMetadataSchema` (layers.ts)
|
|
620
|
+
|
|
621
|
+
Edge layer metadata configures graph layout forces and edge rendering
|
|
622
|
+
defaults. Edge layers depend on an agent layer through dependency key
|
|
623
|
+
`agent`.
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
export type EdgeLayerMetadata = {
|
|
627
|
+
dependency_layer_ids?: never | undefined;
|
|
628
|
+
z_index?: number | undefined;
|
|
629
|
+
link_distance?: number | undefined;
|
|
630
|
+
charge_strength?: number | undefined;
|
|
631
|
+
centering_strength?: number | undefined;
|
|
632
|
+
collision_radius?: number | undefined;
|
|
633
|
+
max_component_distance?: number | undefined;
|
|
634
|
+
component_spacing?: number | undefined;
|
|
635
|
+
[x: string]: unknown;
|
|
636
|
+
};
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
### EdgeItem
|
|
640
|
+
|
|
641
|
+
Schema: `EdgeItemSchema` (layers.ts)
|
|
642
|
+
|
|
643
|
+
Edge items are keyed by the ordered pair (`source`, `target`).
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
export type EdgeItem = {
|
|
647
|
+
source: AgentId;
|
|
648
|
+
target: AgentId;
|
|
649
|
+
directed?: boolean | undefined;
|
|
650
|
+
style?: ("solid" | "dashed" | "dotted") | undefined;
|
|
651
|
+
width?: number | undefined;
|
|
652
|
+
color?: string | undefined;
|
|
653
|
+
[x: string]: unknown;
|
|
654
|
+
};
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### EdgeItemDiff
|
|
658
|
+
|
|
659
|
+
Schema: `EdgeItemDiffSchema` (layers.ts)
|
|
660
|
+
|
|
661
|
+
Edge item updates are keyed by `source` and `target`.
|
|
662
|
+
|
|
663
|
+
```ts
|
|
664
|
+
export type EdgeItemDiff = {
|
|
665
|
+
source: AgentId;
|
|
666
|
+
target: AgentId;
|
|
667
|
+
[x: string]: unknown;
|
|
668
|
+
};
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
### EdgeItemKey
|
|
672
|
+
|
|
673
|
+
Schema: `EdgeItemKeySchema` (layers.ts)
|
|
674
|
+
|
|
675
|
+
Delete key for one edge item.
|
|
676
|
+
|
|
677
|
+
```ts
|
|
678
|
+
export type EdgeItemKey = {
|
|
679
|
+
source: AgentId;
|
|
680
|
+
target: AgentId;
|
|
681
|
+
};
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
### TrajectoryLayerMetadata
|
|
685
|
+
|
|
686
|
+
Schema: `TrajectoryLayerMetadataSchema` (layers.ts)
|
|
687
|
+
|
|
688
|
+
Trajectory layer metadata sets defaults for per-agent trajectory traces.
|
|
689
|
+
Trajectory layers depend on an agent layer through dependency key `agent`.
|
|
690
|
+
|
|
691
|
+
```ts
|
|
692
|
+
export type TrajectoryLayerMetadata = {
|
|
693
|
+
dependency_layer_ids?: never | undefined;
|
|
694
|
+
z_index?: number | undefined;
|
|
695
|
+
length?: number | undefined;
|
|
696
|
+
width?: number | undefined;
|
|
697
|
+
color?: string | undefined;
|
|
698
|
+
[x: string]: unknown;
|
|
699
|
+
};
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
### TrajectoryItem
|
|
703
|
+
|
|
704
|
+
Schema: `TrajectoryItemSchema` (layers.ts)
|
|
705
|
+
|
|
706
|
+
Per-agent trajectory config items are keyed by agent `id`.
|
|
707
|
+
|
|
708
|
+
```ts
|
|
709
|
+
export type TrajectoryItem = {
|
|
710
|
+
id: AgentId;
|
|
711
|
+
length?: number | undefined;
|
|
712
|
+
width?: number | undefined;
|
|
713
|
+
color?: string | undefined;
|
|
714
|
+
[x: string]: unknown;
|
|
715
|
+
};
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
### TrajectoryItemDiff
|
|
719
|
+
|
|
720
|
+
Schema: `TrajectoryItemDiffSchema` (layers.ts)
|
|
721
|
+
|
|
722
|
+
Trajectory item updates are keyed by `id`.
|
|
723
|
+
|
|
724
|
+
```ts
|
|
725
|
+
export type TrajectoryItemDiff = {
|
|
726
|
+
id: AgentId;
|
|
727
|
+
[x: string]: unknown;
|
|
728
|
+
};
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
### TrajectoryPoint
|
|
732
|
+
|
|
733
|
+
Schema: `TrajectoryPointSchema` (layers.ts)
|
|
734
|
+
|
|
735
|
+
One historical trajectory sample stored by the renderer.
|
|
736
|
+
|
|
737
|
+
```ts
|
|
738
|
+
export type TrajectoryPoint = {
|
|
739
|
+
x: number;
|
|
740
|
+
y: number;
|
|
741
|
+
time: number;
|
|
742
|
+
color?: string | undefined;
|
|
743
|
+
};
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### GridLayerMetadata
|
|
747
|
+
|
|
748
|
+
Schema: `GridLayerMetadataSchema` (layers.ts)
|
|
749
|
+
|
|
750
|
+
Grid layer metadata controls parametric grid lines and optional scene size.
|
|
751
|
+
|
|
752
|
+
```ts
|
|
753
|
+
export type GridLayerMetadata = {
|
|
754
|
+
dependency_layer_ids?: never | undefined;
|
|
755
|
+
z_index?: number | undefined;
|
|
756
|
+
width?: number | undefined;
|
|
757
|
+
height?: number | undefined;
|
|
758
|
+
x_origin?: number | undefined;
|
|
759
|
+
x_unit?: number | undefined;
|
|
760
|
+
x_interval?: number | undefined;
|
|
761
|
+
x_ratio?: number | undefined;
|
|
762
|
+
y_origin?: number | undefined;
|
|
763
|
+
y_unit?: number | undefined;
|
|
764
|
+
y_interval?: number | undefined;
|
|
765
|
+
y_ratio?: number | undefined;
|
|
766
|
+
stroke_color?: string | undefined;
|
|
767
|
+
[x: string]: unknown;
|
|
768
|
+
};
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
### BackgroundInterpolation
|
|
772
|
+
|
|
773
|
+
Schema: `BackgroundInterpolationSchema` (layers.ts)
|
|
774
|
+
|
|
775
|
+
No schema comment is defined.
|
|
776
|
+
|
|
777
|
+
```ts
|
|
778
|
+
export type BackgroundInterpolation = "nearest" | "linear";
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
### BackgroundAssetReference
|
|
782
|
+
|
|
783
|
+
Schema: `BackgroundAssetReferenceSchema` (layers.ts)
|
|
784
|
+
|
|
785
|
+
Background image references point to a previously announced protocol asset.
|
|
786
|
+
|
|
787
|
+
```ts
|
|
788
|
+
export type BackgroundAssetReference = {
|
|
789
|
+
asset_id: string;
|
|
790
|
+
interpolation?: BackgroundInterpolation | undefined;
|
|
791
|
+
};
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
### BackgroundSource
|
|
795
|
+
|
|
796
|
+
Schema: `BackgroundSourceSchema` (layers.ts)
|
|
797
|
+
|
|
798
|
+
Raw background source accepted by the built-in background layer metadata.
|
|
799
|
+
|
|
800
|
+
```ts
|
|
801
|
+
export type BackgroundSource = string | Uint8Array | BackgroundAssetReference;
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
### BackgroundLayerMetadata
|
|
805
|
+
|
|
806
|
+
Schema: `BackgroundLayerMetadataSchema` (layers.ts)
|
|
807
|
+
|
|
808
|
+
Background layer metadata stores color/image/asset source and interpolation.
|
|
809
|
+
|
|
810
|
+
```ts
|
|
811
|
+
export type BackgroundLayerMetadata = {
|
|
812
|
+
dependency_layer_ids?: never | undefined;
|
|
813
|
+
z_index?: number | undefined;
|
|
814
|
+
background?: BackgroundSource | undefined;
|
|
815
|
+
interpolation?: BackgroundInterpolation | undefined;
|
|
816
|
+
[x: string]: unknown;
|
|
817
|
+
};
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
### AgentDependencyLayerIds
|
|
821
|
+
|
|
822
|
+
Schema: `AgentDependencyLayerIdsSchema` (layers.ts)
|
|
823
|
+
|
|
824
|
+
Dependency map shape used by edge and trajectory layers.
|
|
825
|
+
|
|
826
|
+
```ts
|
|
827
|
+
export type AgentDependencyLayerIds = {
|
|
828
|
+
agent: string;
|
|
829
|
+
[x: string]: unknown;
|
|
830
|
+
};
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### AgentLayerCreatePayload
|
|
834
|
+
|
|
835
|
+
Schema: `AgentLayerCreatePayloadSchema` (layers.ts)
|
|
836
|
+
|
|
837
|
+
Built-in `agent` layer create payload. Agent layers do not require dependency layers.
|
|
838
|
+
|
|
839
|
+
```ts
|
|
840
|
+
export type AgentLayerCreatePayload = {
|
|
841
|
+
env_id: string;
|
|
842
|
+
layer_id: string;
|
|
843
|
+
layer_type: "agent";
|
|
844
|
+
data?: AgentLayerMetadata | undefined;
|
|
845
|
+
};
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
### EdgeLayerCreatePayload
|
|
849
|
+
|
|
850
|
+
Schema: `EdgeLayerCreatePayloadSchema` (layers.ts)
|
|
851
|
+
|
|
852
|
+
Built-in `edge` layer create payload. `dependency_layer_ids.agent` names the source agent layer.
|
|
853
|
+
|
|
854
|
+
```ts
|
|
855
|
+
export type EdgeLayerCreatePayload = {
|
|
856
|
+
env_id: string;
|
|
857
|
+
layer_id: string;
|
|
858
|
+
layer_type: "edge";
|
|
859
|
+
dependency_layer_ids: AgentDependencyLayerIds;
|
|
860
|
+
data?: EdgeLayerMetadata | undefined;
|
|
861
|
+
};
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
### TrajectoryLayerCreatePayload
|
|
865
|
+
|
|
866
|
+
Schema: `TrajectoryLayerCreatePayloadSchema` (layers.ts)
|
|
867
|
+
|
|
868
|
+
Built-in `trajectory` layer create payload. `dependency_layer_ids.agent` names the traced agent layer.
|
|
869
|
+
|
|
870
|
+
```ts
|
|
871
|
+
export type TrajectoryLayerCreatePayload = {
|
|
872
|
+
env_id: string;
|
|
873
|
+
layer_id: string;
|
|
874
|
+
layer_type: "trajectory";
|
|
875
|
+
dependency_layer_ids: AgentDependencyLayerIds;
|
|
876
|
+
data?: TrajectoryLayerMetadata | undefined;
|
|
877
|
+
};
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
### GridLayerCreatePayload
|
|
881
|
+
|
|
882
|
+
Schema: `GridLayerCreatePayloadSchema` (layers.ts)
|
|
883
|
+
|
|
884
|
+
Built-in `grid` layer create payload. Grid layers use metadata only and do not accept item messages.
|
|
885
|
+
|
|
886
|
+
```ts
|
|
887
|
+
export type GridLayerCreatePayload = {
|
|
888
|
+
env_id: string;
|
|
889
|
+
layer_id: string;
|
|
890
|
+
layer_type: "grid";
|
|
891
|
+
data?: GridLayerMetadata | undefined;
|
|
892
|
+
};
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
### BackgroundLayerCreatePayload
|
|
896
|
+
|
|
897
|
+
Schema: `BackgroundLayerCreatePayloadSchema` (layers.ts)
|
|
898
|
+
|
|
899
|
+
Built-in `background` layer create payload. Background layers use metadata only and do not accept item messages.
|
|
900
|
+
|
|
901
|
+
```ts
|
|
902
|
+
export type BackgroundLayerCreatePayload = {
|
|
903
|
+
env_id: string;
|
|
904
|
+
layer_id: string;
|
|
905
|
+
layer_type: "background";
|
|
906
|
+
data?: BackgroundLayerMetadata | undefined;
|
|
907
|
+
};
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
### BuiltinLayerCreatePayload
|
|
911
|
+
|
|
912
|
+
Schema: `BuiltinLayerCreatePayloadSchema` (layers.ts)
|
|
913
|
+
|
|
914
|
+
Union of the five built-in layer create payload specializations.
|
|
915
|
+
|
|
916
|
+
```ts
|
|
917
|
+
export type BuiltinLayerCreatePayload = BackgroundLayerCreatePayload | GridLayerCreatePayload | EdgeLayerCreatePayload | TrajectoryLayerCreatePayload | AgentLayerCreatePayload;
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
### AgentItemCreatePayload
|
|
921
|
+
|
|
922
|
+
Schema: `AgentItemCreatePayloadSchema` (layers.ts)
|
|
923
|
+
|
|
924
|
+
`item_create` payload specialization for built-in agent layers.
|
|
925
|
+
|
|
926
|
+
```ts
|
|
927
|
+
export type AgentItemCreatePayload = {
|
|
928
|
+
env_id: string;
|
|
929
|
+
layer_id: string;
|
|
930
|
+
items: AgentItem[];
|
|
931
|
+
};
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
### AgentItemUpdatePayload
|
|
935
|
+
|
|
936
|
+
Schema: `AgentItemUpdatePayloadSchema` (layers.ts)
|
|
937
|
+
|
|
938
|
+
`item_update` payload specialization for built-in agent layers.
|
|
939
|
+
|
|
940
|
+
```ts
|
|
941
|
+
export type AgentItemUpdatePayload = {
|
|
942
|
+
env_id: string;
|
|
943
|
+
layer_id: string;
|
|
944
|
+
items: AgentItemDiff[];
|
|
945
|
+
};
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
### AgentItemDeletePayload
|
|
949
|
+
|
|
950
|
+
Schema: `AgentItemDeletePayloadSchema` (layers.ts)
|
|
951
|
+
|
|
952
|
+
`item_delete` payload specialization for built-in agent layers, keyed by agent id.
|
|
953
|
+
|
|
954
|
+
```ts
|
|
955
|
+
export type AgentItemDeletePayload = {
|
|
956
|
+
env_id: string;
|
|
957
|
+
layer_id: string;
|
|
958
|
+
items: AgentId[];
|
|
959
|
+
};
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
### EdgeItemCreatePayload
|
|
963
|
+
|
|
964
|
+
Schema: `EdgeItemCreatePayloadSchema` (layers.ts)
|
|
965
|
+
|
|
966
|
+
`item_create` payload specialization for built-in edge layers.
|
|
967
|
+
|
|
968
|
+
```ts
|
|
969
|
+
export type EdgeItemCreatePayload = {
|
|
970
|
+
env_id: string;
|
|
971
|
+
layer_id: string;
|
|
972
|
+
items: EdgeItem[];
|
|
973
|
+
};
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
### EdgeItemUpdatePayload
|
|
977
|
+
|
|
978
|
+
Schema: `EdgeItemUpdatePayloadSchema` (layers.ts)
|
|
979
|
+
|
|
980
|
+
`item_update` payload specialization for built-in edge layers.
|
|
981
|
+
|
|
982
|
+
```ts
|
|
983
|
+
export type EdgeItemUpdatePayload = {
|
|
984
|
+
env_id: string;
|
|
985
|
+
layer_id: string;
|
|
986
|
+
items: EdgeItemDiff[];
|
|
987
|
+
};
|
|
988
|
+
```
|
|
989
|
+
|
|
990
|
+
### EdgeItemDeletePayload
|
|
991
|
+
|
|
992
|
+
Schema: `EdgeItemDeletePayloadSchema` (layers.ts)
|
|
993
|
+
|
|
994
|
+
`item_delete` payload specialization for built-in edge layers, keyed by source/target pairs.
|
|
995
|
+
|
|
996
|
+
```ts
|
|
997
|
+
export type EdgeItemDeletePayload = {
|
|
998
|
+
env_id: string;
|
|
999
|
+
layer_id: string;
|
|
1000
|
+
items: EdgeItemKey[];
|
|
1001
|
+
};
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
### TrajectoryItemCreatePayload
|
|
1005
|
+
|
|
1006
|
+
Schema: `TrajectoryItemCreatePayloadSchema` (layers.ts)
|
|
1007
|
+
|
|
1008
|
+
`item_create` payload specialization for built-in trajectory layers.
|
|
1009
|
+
|
|
1010
|
+
```ts
|
|
1011
|
+
export type TrajectoryItemCreatePayload = {
|
|
1012
|
+
env_id: string;
|
|
1013
|
+
layer_id: string;
|
|
1014
|
+
items: TrajectoryItem[];
|
|
1015
|
+
};
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
### TrajectoryItemUpdatePayload
|
|
1019
|
+
|
|
1020
|
+
Schema: `TrajectoryItemUpdatePayloadSchema` (layers.ts)
|
|
1021
|
+
|
|
1022
|
+
`item_update` payload specialization for built-in trajectory layers.
|
|
1023
|
+
|
|
1024
|
+
```ts
|
|
1025
|
+
export type TrajectoryItemUpdatePayload = {
|
|
1026
|
+
env_id: string;
|
|
1027
|
+
layer_id: string;
|
|
1028
|
+
items: TrajectoryItemDiff[];
|
|
1029
|
+
};
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
### TrajectoryItemDeletePayload
|
|
1033
|
+
|
|
1034
|
+
Schema: `TrajectoryItemDeletePayloadSchema` (layers.ts)
|
|
1035
|
+
|
|
1036
|
+
`item_delete` payload specialization for built-in trajectory layers, keyed by agent id.
|
|
1037
|
+
|
|
1038
|
+
```ts
|
|
1039
|
+
export type TrajectoryItemDeletePayload = {
|
|
1040
|
+
env_id: string;
|
|
1041
|
+
layer_id: string;
|
|
1042
|
+
items: AgentId[];
|
|
1043
|
+
};
|
|
1044
|
+
```
|
|
1045
|
+
|
|
1046
|
+
### BuiltinLayerItemCreatePayload
|
|
1047
|
+
|
|
1048
|
+
Schema: `BuiltinLayerItemCreatePayloadSchema` (layers.ts)
|
|
1049
|
+
|
|
1050
|
+
Union of built-in layer `item_create` payload specializations. Grid and background layers have no items.
|
|
1051
|
+
|
|
1052
|
+
```ts
|
|
1053
|
+
export type BuiltinLayerItemCreatePayload = AgentItemCreatePayload | EdgeItemCreatePayload | TrajectoryItemCreatePayload;
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
### BuiltinLayerItemUpdatePayload
|
|
1057
|
+
|
|
1058
|
+
Schema: `BuiltinLayerItemUpdatePayloadSchema` (layers.ts)
|
|
1059
|
+
|
|
1060
|
+
Union of built-in layer `item_update` payload specializations. Grid and background layers have no items.
|
|
1061
|
+
|
|
1062
|
+
```ts
|
|
1063
|
+
export type BuiltinLayerItemUpdatePayload = AgentItemUpdatePayload | EdgeItemUpdatePayload | TrajectoryItemUpdatePayload;
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
### BuiltinLayerItemDeletePayload
|
|
1067
|
+
|
|
1068
|
+
Schema: `BuiltinLayerItemDeletePayloadSchema` (layers.ts)
|
|
1069
|
+
|
|
1070
|
+
Union of built-in layer `item_delete` payload specializations. Grid and background layers have no items.
|
|
1071
|
+
|
|
1072
|
+
```ts
|
|
1073
|
+
export type BuiltinLayerItemDeletePayload = AgentItemDeletePayload | EdgeItemDeletePayload | TrajectoryItemDeletePayload;
|
|
1074
|
+
```
|
|
1075
|
+
|
|
1076
|
+
## Controls, Charts, And Assets
|
|
1077
|
+
|
|
1078
|
+
### AssetId
|
|
1079
|
+
|
|
1080
|
+
Schema: `AssetIdSchema` (asset.ts)
|
|
1081
|
+
|
|
1082
|
+
Asset identifiers and metadata are protocol payloads, not renderer cache
|
|
1083
|
+
objects. Renderers may resolve them into blob URLs or local buffers, but the
|
|
1084
|
+
wire contract stays content-addressed by id plus hash.
|
|
1085
|
+
|
|
1086
|
+
```ts
|
|
1087
|
+
export type AssetId = string;
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
### AssetMeta
|
|
1091
|
+
|
|
1092
|
+
Schema: `AssetMetaSchema` (asset.ts)
|
|
1093
|
+
|
|
1094
|
+
No schema comment is defined.
|
|
1095
|
+
|
|
1096
|
+
```ts
|
|
1097
|
+
export type AssetMeta = {
|
|
1098
|
+
id: AssetId;
|
|
1099
|
+
hash: string;
|
|
1100
|
+
mime: string;
|
|
1101
|
+
size: number;
|
|
1102
|
+
label?: string | undefined;
|
|
1103
|
+
};
|
|
1104
|
+
```
|
|
1105
|
+
|
|
1106
|
+
### ChartMetadata
|
|
1107
|
+
|
|
1108
|
+
Schema: `ChartMetadataSchema` (chart.ts)
|
|
1109
|
+
|
|
1110
|
+
Protocol-level chart types describe series identity and updates only. Chart
|
|
1111
|
+
rendering config, layouts, and UI-specific storage live in renderer packages.
|
|
1112
|
+
|
|
1113
|
+
```ts
|
|
1114
|
+
export type ChartMetadata = {
|
|
1115
|
+
id: string;
|
|
1116
|
+
label: string;
|
|
1117
|
+
color?: string | undefined;
|
|
1118
|
+
};
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
### ChartGroupMetadata
|
|
1122
|
+
|
|
1123
|
+
Schema: `ChartGroupMetadataSchema` (chart.ts)
|
|
1124
|
+
|
|
1125
|
+
No schema comment is defined.
|
|
1126
|
+
|
|
1127
|
+
```ts
|
|
1128
|
+
export type ChartGroupMetadata = {
|
|
1129
|
+
id: string;
|
|
1130
|
+
label: string;
|
|
1131
|
+
color?: string | undefined;
|
|
1132
|
+
dataList?: ChartMetadata[] | undefined;
|
|
1133
|
+
};
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
### ChartUpdateData
|
|
1137
|
+
|
|
1138
|
+
Schema: `ChartUpdateDataSchema` (chart.ts)
|
|
1139
|
+
|
|
1140
|
+
No schema comment is defined.
|
|
1141
|
+
|
|
1142
|
+
```ts
|
|
1143
|
+
export type ChartUpdateData = {
|
|
1144
|
+
id: string;
|
|
1145
|
+
time?: number | undefined;
|
|
1146
|
+
value: unknown;
|
|
1147
|
+
};
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
### ChartUpdateOperation
|
|
1151
|
+
|
|
1152
|
+
Schema: `ChartUpdateOperationSchema` (chart.ts)
|
|
1153
|
+
|
|
1154
|
+
No schema comment is defined.
|
|
1155
|
+
|
|
1156
|
+
```ts
|
|
1157
|
+
export type ChartUpdateOperation = {
|
|
1158
|
+
id: string;
|
|
1159
|
+
operation: "clear";
|
|
1160
|
+
};
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
### ParameterType
|
|
1164
|
+
|
|
1165
|
+
Schema: `ParameterTypeSchema` (controls.ts)
|
|
1166
|
+
|
|
1167
|
+
Parameters describe mutable simulator configuration exposed to the renderer.
|
|
1168
|
+
Actions are intentionally separate in protocol v0.2: they have their own
|
|
1169
|
+
lifecycle and renderer-driven continuous loop semantics.
|
|
1170
|
+
|
|
1171
|
+
```ts
|
|
1172
|
+
export type ParameterType = "number" | "enum" | "boolean" | "string";
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
### ParameterBase
|
|
1176
|
+
|
|
1177
|
+
Schema: `ParameterBaseSchema` (controls.ts)
|
|
1178
|
+
|
|
1179
|
+
No schema comment is defined.
|
|
1180
|
+
|
|
1181
|
+
```ts
|
|
1182
|
+
export type ParameterBase = {
|
|
1183
|
+
id: string;
|
|
1184
|
+
type: ParameterType;
|
|
1185
|
+
label: string;
|
|
1186
|
+
allowRuntimeChange?: boolean | undefined;
|
|
1187
|
+
};
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
### NumberParameter
|
|
1191
|
+
|
|
1192
|
+
Schema: `NumberParameterSchema` (controls.ts)
|
|
1193
|
+
|
|
1194
|
+
No schema comment is defined.
|
|
1195
|
+
|
|
1196
|
+
```ts
|
|
1197
|
+
export type NumberParameter = {
|
|
1198
|
+
id: string;
|
|
1199
|
+
type: "number";
|
|
1200
|
+
label: string;
|
|
1201
|
+
allowRuntimeChange?: boolean | undefined;
|
|
1202
|
+
value: number;
|
|
1203
|
+
min?: number | undefined;
|
|
1204
|
+
max?: number | undefined;
|
|
1205
|
+
step?: number | undefined;
|
|
1206
|
+
};
|
|
1207
|
+
```
|
|
1208
|
+
|
|
1209
|
+
### EnumParameter
|
|
1210
|
+
|
|
1211
|
+
Schema: `EnumParameterSchema` (controls.ts)
|
|
1212
|
+
|
|
1213
|
+
No schema comment is defined.
|
|
1214
|
+
|
|
1215
|
+
```ts
|
|
1216
|
+
export type EnumParameter = {
|
|
1217
|
+
id: string;
|
|
1218
|
+
type: "enum";
|
|
1219
|
+
label: string;
|
|
1220
|
+
allowRuntimeChange?: boolean | undefined;
|
|
1221
|
+
value: string;
|
|
1222
|
+
options: string[];
|
|
1223
|
+
labels?: {
|
|
1224
|
+
[key: string]: string;
|
|
1225
|
+
} | undefined;
|
|
1226
|
+
};
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
### BooleanParameter
|
|
1230
|
+
|
|
1231
|
+
Schema: `BooleanParameterSchema` (controls.ts)
|
|
1232
|
+
|
|
1233
|
+
No schema comment is defined.
|
|
1234
|
+
|
|
1235
|
+
```ts
|
|
1236
|
+
export type BooleanParameter = {
|
|
1237
|
+
id: string;
|
|
1238
|
+
type: "boolean";
|
|
1239
|
+
label: string;
|
|
1240
|
+
allowRuntimeChange?: boolean | undefined;
|
|
1241
|
+
value: boolean;
|
|
1242
|
+
};
|
|
1243
|
+
```
|
|
1244
|
+
|
|
1245
|
+
### StringParameter
|
|
1246
|
+
|
|
1247
|
+
Schema: `StringParameterSchema` (controls.ts)
|
|
1248
|
+
|
|
1249
|
+
No schema comment is defined.
|
|
1250
|
+
|
|
1251
|
+
```ts
|
|
1252
|
+
export type StringParameter = {
|
|
1253
|
+
id: string;
|
|
1254
|
+
type: "string";
|
|
1255
|
+
label: string;
|
|
1256
|
+
allowRuntimeChange?: boolean | undefined;
|
|
1257
|
+
value: string;
|
|
1258
|
+
};
|
|
1259
|
+
```
|
|
1260
|
+
|
|
1261
|
+
### Parameter
|
|
1262
|
+
|
|
1263
|
+
Schema: `ParameterSchema` (controls.ts)
|
|
1264
|
+
|
|
1265
|
+
No schema comment is defined.
|
|
1266
|
+
|
|
1267
|
+
```ts
|
|
1268
|
+
export type Parameter = NumberParameter | EnumParameter | BooleanParameter | StringParameter;
|
|
1269
|
+
```
|
|
1270
|
+
|
|
1271
|
+
### Action
|
|
1272
|
+
|
|
1273
|
+
Schema: `ActionSchema` (controls.ts)
|
|
1274
|
+
|
|
1275
|
+
No schema comment is defined.
|
|
1276
|
+
|
|
1277
|
+
```ts
|
|
1278
|
+
export type Action = {
|
|
1279
|
+
id: string;
|
|
1280
|
+
label: string;
|
|
1281
|
+
continuous?: boolean | undefined;
|
|
1282
|
+
allowRuntimeChange?: boolean | undefined;
|
|
1283
|
+
};
|
|
1284
|
+
```
|
|
1285
|
+
|
|
1286
|
+
## Supporting Schemas
|
|
1287
|
+
|
|
1288
|
+
### ItemRecord
|
|
1289
|
+
|
|
1290
|
+
Schema: `ItemSchema` (schemas.ts)
|
|
1291
|
+
|
|
1292
|
+
No schema comment is defined.
|
|
1293
|
+
|
|
1294
|
+
```ts
|
|
1295
|
+
export type ItemRecord = {
|
|
1296
|
+
[key: string]: unknown;
|
|
1297
|
+
};
|
|
1298
|
+
```
|
|
1299
|
+
|
|
1300
|
+
### ItemDiff
|
|
1301
|
+
|
|
1302
|
+
Schema: `ItemDiffSchema` (schemas.ts)
|
|
1303
|
+
|
|
1304
|
+
No schema comment is defined.
|
|
1305
|
+
|
|
1306
|
+
```ts
|
|
1307
|
+
export type ItemDiff = {
|
|
1308
|
+
[key: string]: unknown;
|
|
1309
|
+
};
|
|
1310
|
+
```
|
|
1311
|
+
|
|
1312
|
+
### ItemKey
|
|
1313
|
+
|
|
1314
|
+
Schema: `ItemKeySchema` (schemas.ts)
|
|
1315
|
+
|
|
1316
|
+
No schema comment is defined.
|
|
1317
|
+
|
|
1318
|
+
```ts
|
|
1319
|
+
export type ItemKey = {
|
|
1320
|
+
[key: string]: unknown;
|
|
1321
|
+
};
|
|
1322
|
+
```
|
|
1323
|
+
|
|
1324
|
+
### PrimitiveItemKey
|
|
1325
|
+
|
|
1326
|
+
Schema: `PrimitiveItemKeySchema` (schemas.ts)
|
|
1327
|
+
|
|
1328
|
+
No schema comment is defined.
|
|
1329
|
+
|
|
1330
|
+
```ts
|
|
1331
|
+
export type PrimitiveItemKey = string | number;
|
|
1332
|
+
```
|
|
1333
|
+
|
|
1334
|
+
### LogLevel
|
|
1335
|
+
|
|
1336
|
+
Schema: `LogLevelSchema` (schemas.ts)
|
|
1337
|
+
|
|
1338
|
+
No schema comment is defined.
|
|
1339
|
+
|
|
1340
|
+
```ts
|
|
1341
|
+
export type LogLevel = "debug" | "info" | "warning" | "error" | "critical";
|
|
1342
|
+
```
|