@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/layers.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// src/layers.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var BuiltinLayerTypeSchema = z.enum(["background", "grid", "edge", "trajectory", "agent"]);
|
|
4
|
+
var AgentIdSchema = z.union([z.string(), z.number()]);
|
|
5
|
+
var BUILTIN_AGENT_ICONS = [
|
|
6
|
+
"arrow",
|
|
7
|
+
"circle",
|
|
8
|
+
"square",
|
|
9
|
+
"triangle",
|
|
10
|
+
"diamond",
|
|
11
|
+
"star",
|
|
12
|
+
"hexagon",
|
|
13
|
+
"cross",
|
|
14
|
+
"plus",
|
|
15
|
+
"pentagon"
|
|
16
|
+
];
|
|
17
|
+
var BuiltinAgentIconSchema = z.enum(BUILTIN_AGENT_ICONS);
|
|
18
|
+
var AssetAgentIconSchema = z.string().regex(/^asset:.+$/);
|
|
19
|
+
var AgentIconSchema = z.union([BuiltinAgentIconSchema, AssetAgentIconSchema]);
|
|
20
|
+
var BaseLayerMetadataSchema = z.object({
|
|
21
|
+
dependency_layer_ids: z.never().optional(),
|
|
22
|
+
z_index: z.number().optional()
|
|
23
|
+
}).loose();
|
|
24
|
+
var AgentLayerMetadataSchema = BaseLayerMetadataSchema.extend({
|
|
25
|
+
width: z.number().optional(),
|
|
26
|
+
height: z.number().optional(),
|
|
27
|
+
coord_offset: z.enum(["int", "float"]).optional()
|
|
28
|
+
}).loose();
|
|
29
|
+
var AgentItemSchema = z.object({
|
|
30
|
+
id: AgentIdSchema,
|
|
31
|
+
color: z.string().optional(),
|
|
32
|
+
icon: AgentIconSchema.optional(),
|
|
33
|
+
size: z.number().optional(),
|
|
34
|
+
x: z.number().optional(),
|
|
35
|
+
y: z.number().optional(),
|
|
36
|
+
vx: z.number().optional(),
|
|
37
|
+
vy: z.number().optional(),
|
|
38
|
+
fx: z.number().nullable().optional(),
|
|
39
|
+
fy: z.number().nullable().optional(),
|
|
40
|
+
heading: z.number().optional(),
|
|
41
|
+
data: z.record(z.string(), z.unknown()).optional()
|
|
42
|
+
}).loose();
|
|
43
|
+
var AgentItemDiffSchema = z.object({
|
|
44
|
+
id: AgentIdSchema
|
|
45
|
+
}).loose();
|
|
46
|
+
var EdgeLayerMetadataSchema = BaseLayerMetadataSchema.extend({
|
|
47
|
+
link_distance: z.number().optional(),
|
|
48
|
+
charge_strength: z.number().optional(),
|
|
49
|
+
centering_strength: z.number().optional(),
|
|
50
|
+
collision_radius: z.number().optional(),
|
|
51
|
+
max_component_distance: z.number().optional(),
|
|
52
|
+
component_spacing: z.number().optional()
|
|
53
|
+
}).loose();
|
|
54
|
+
var EdgeItemSchema = z.object({
|
|
55
|
+
source: AgentIdSchema,
|
|
56
|
+
target: AgentIdSchema,
|
|
57
|
+
directed: z.boolean().optional(),
|
|
58
|
+
style: z.enum(["solid", "dashed", "dotted"]).optional(),
|
|
59
|
+
width: z.number().optional(),
|
|
60
|
+
color: z.string().optional()
|
|
61
|
+
}).loose();
|
|
62
|
+
var EdgeItemDiffSchema = z.object({
|
|
63
|
+
source: AgentIdSchema,
|
|
64
|
+
target: AgentIdSchema
|
|
65
|
+
}).loose();
|
|
66
|
+
var EdgeItemKeySchema = z.object({
|
|
67
|
+
source: AgentIdSchema,
|
|
68
|
+
target: AgentIdSchema
|
|
69
|
+
});
|
|
70
|
+
var TrajectoryLayerMetadataSchema = BaseLayerMetadataSchema.extend({
|
|
71
|
+
length: z.number().optional(),
|
|
72
|
+
width: z.number().optional(),
|
|
73
|
+
color: z.string().optional()
|
|
74
|
+
}).loose();
|
|
75
|
+
var TrajectoryItemSchema = z.object({
|
|
76
|
+
id: AgentIdSchema,
|
|
77
|
+
length: z.number().optional(),
|
|
78
|
+
width: z.number().optional(),
|
|
79
|
+
color: z.string().optional()
|
|
80
|
+
}).loose();
|
|
81
|
+
var TrajectoryItemDiffSchema = z.object({
|
|
82
|
+
id: AgentIdSchema
|
|
83
|
+
}).loose();
|
|
84
|
+
var TrajectoryPointSchema = z.object({
|
|
85
|
+
x: z.number(),
|
|
86
|
+
y: z.number(),
|
|
87
|
+
time: z.number(),
|
|
88
|
+
color: z.string().optional()
|
|
89
|
+
});
|
|
90
|
+
var GridLayerMetadataSchema = BaseLayerMetadataSchema.extend({
|
|
91
|
+
width: z.number().optional(),
|
|
92
|
+
height: z.number().optional(),
|
|
93
|
+
x_origin: z.number().optional(),
|
|
94
|
+
x_unit: z.number().optional(),
|
|
95
|
+
x_interval: z.number().optional(),
|
|
96
|
+
x_ratio: z.number().int().min(2).optional(),
|
|
97
|
+
y_origin: z.number().optional(),
|
|
98
|
+
y_unit: z.number().optional(),
|
|
99
|
+
y_interval: z.number().optional(),
|
|
100
|
+
y_ratio: z.number().int().min(2).optional(),
|
|
101
|
+
stroke_color: z.string().optional()
|
|
102
|
+
}).loose();
|
|
103
|
+
var BackgroundInterpolationSchema = z.enum(["nearest", "linear"]);
|
|
104
|
+
var BackgroundAssetReferenceSchema = z.object({
|
|
105
|
+
asset_id: z.string(),
|
|
106
|
+
interpolation: BackgroundInterpolationSchema.optional()
|
|
107
|
+
});
|
|
108
|
+
var BackgroundSourceSchema = z.union([
|
|
109
|
+
z.string(),
|
|
110
|
+
z.instanceof(Uint8Array),
|
|
111
|
+
BackgroundAssetReferenceSchema
|
|
112
|
+
]);
|
|
113
|
+
var BackgroundLayerMetadataSchema = BaseLayerMetadataSchema.extend({
|
|
114
|
+
background: BackgroundSourceSchema.optional(),
|
|
115
|
+
interpolation: BackgroundInterpolationSchema.optional()
|
|
116
|
+
}).loose();
|
|
117
|
+
var AgentDependencyLayerIdsSchema = z.object({
|
|
118
|
+
agent: z.string()
|
|
119
|
+
}).loose();
|
|
120
|
+
var BuiltinLayerCreateBaseSchema = z.object({
|
|
121
|
+
env_id: z.string(),
|
|
122
|
+
layer_id: z.string()
|
|
123
|
+
});
|
|
124
|
+
var ItemPayloadBaseSchema = z.object({
|
|
125
|
+
env_id: z.string(),
|
|
126
|
+
layer_id: z.string()
|
|
127
|
+
});
|
|
128
|
+
var AgentLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({
|
|
129
|
+
layer_type: z.literal("agent"),
|
|
130
|
+
data: AgentLayerMetadataSchema.optional()
|
|
131
|
+
});
|
|
132
|
+
var EdgeLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({
|
|
133
|
+
layer_type: z.literal("edge"),
|
|
134
|
+
dependency_layer_ids: AgentDependencyLayerIdsSchema,
|
|
135
|
+
data: EdgeLayerMetadataSchema.optional()
|
|
136
|
+
});
|
|
137
|
+
var TrajectoryLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({
|
|
138
|
+
layer_type: z.literal("trajectory"),
|
|
139
|
+
dependency_layer_ids: AgentDependencyLayerIdsSchema,
|
|
140
|
+
data: TrajectoryLayerMetadataSchema.optional()
|
|
141
|
+
});
|
|
142
|
+
var GridLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({
|
|
143
|
+
layer_type: z.literal("grid"),
|
|
144
|
+
data: GridLayerMetadataSchema.optional()
|
|
145
|
+
});
|
|
146
|
+
var BackgroundLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({
|
|
147
|
+
layer_type: z.literal("background"),
|
|
148
|
+
data: BackgroundLayerMetadataSchema.optional()
|
|
149
|
+
});
|
|
150
|
+
var BuiltinLayerCreatePayloadSchema = z.union([
|
|
151
|
+
BackgroundLayerCreatePayloadSchema,
|
|
152
|
+
GridLayerCreatePayloadSchema,
|
|
153
|
+
EdgeLayerCreatePayloadSchema,
|
|
154
|
+
TrajectoryLayerCreatePayloadSchema,
|
|
155
|
+
AgentLayerCreatePayloadSchema
|
|
156
|
+
]);
|
|
157
|
+
var AgentItemCreatePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
158
|
+
items: z.array(AgentItemSchema)
|
|
159
|
+
});
|
|
160
|
+
var AgentItemUpdatePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
161
|
+
items: z.array(AgentItemDiffSchema)
|
|
162
|
+
});
|
|
163
|
+
var AgentItemDeletePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
164
|
+
items: z.array(AgentIdSchema)
|
|
165
|
+
});
|
|
166
|
+
var EdgeItemCreatePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
167
|
+
items: z.array(EdgeItemSchema)
|
|
168
|
+
});
|
|
169
|
+
var EdgeItemUpdatePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
170
|
+
items: z.array(EdgeItemDiffSchema)
|
|
171
|
+
});
|
|
172
|
+
var EdgeItemDeletePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
173
|
+
items: z.array(EdgeItemKeySchema)
|
|
174
|
+
});
|
|
175
|
+
var TrajectoryItemCreatePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
176
|
+
items: z.array(TrajectoryItemSchema)
|
|
177
|
+
});
|
|
178
|
+
var TrajectoryItemUpdatePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
179
|
+
items: z.array(TrajectoryItemDiffSchema)
|
|
180
|
+
});
|
|
181
|
+
var TrajectoryItemDeletePayloadSchema = ItemPayloadBaseSchema.extend({
|
|
182
|
+
items: z.array(AgentIdSchema)
|
|
183
|
+
});
|
|
184
|
+
var BuiltinLayerItemCreatePayloadSchema = z.union([
|
|
185
|
+
AgentItemCreatePayloadSchema,
|
|
186
|
+
EdgeItemCreatePayloadSchema,
|
|
187
|
+
TrajectoryItemCreatePayloadSchema
|
|
188
|
+
]);
|
|
189
|
+
var BuiltinLayerItemUpdatePayloadSchema = z.union([
|
|
190
|
+
AgentItemUpdatePayloadSchema,
|
|
191
|
+
EdgeItemUpdatePayloadSchema,
|
|
192
|
+
TrajectoryItemUpdatePayloadSchema
|
|
193
|
+
]);
|
|
194
|
+
var BuiltinLayerItemDeletePayloadSchema = z.union([
|
|
195
|
+
AgentItemDeletePayloadSchema,
|
|
196
|
+
EdgeItemDeletePayloadSchema,
|
|
197
|
+
TrajectoryItemDeletePayloadSchema
|
|
198
|
+
]);
|
|
199
|
+
export {
|
|
200
|
+
AgentDependencyLayerIdsSchema,
|
|
201
|
+
AgentIconSchema,
|
|
202
|
+
AgentIdSchema,
|
|
203
|
+
AgentItemCreatePayloadSchema,
|
|
204
|
+
AgentItemDeletePayloadSchema,
|
|
205
|
+
AgentItemDiffSchema,
|
|
206
|
+
AgentItemSchema,
|
|
207
|
+
AgentItemUpdatePayloadSchema,
|
|
208
|
+
AgentLayerCreatePayloadSchema,
|
|
209
|
+
AgentLayerMetadataSchema,
|
|
210
|
+
AssetAgentIconSchema,
|
|
211
|
+
BUILTIN_AGENT_ICONS,
|
|
212
|
+
BackgroundAssetReferenceSchema,
|
|
213
|
+
BackgroundInterpolationSchema,
|
|
214
|
+
BackgroundLayerCreatePayloadSchema,
|
|
215
|
+
BackgroundLayerMetadataSchema,
|
|
216
|
+
BackgroundSourceSchema,
|
|
217
|
+
BaseLayerMetadataSchema,
|
|
218
|
+
BuiltinAgentIconSchema,
|
|
219
|
+
BuiltinLayerCreatePayloadSchema,
|
|
220
|
+
BuiltinLayerItemCreatePayloadSchema,
|
|
221
|
+
BuiltinLayerItemDeletePayloadSchema,
|
|
222
|
+
BuiltinLayerItemUpdatePayloadSchema,
|
|
223
|
+
BuiltinLayerTypeSchema,
|
|
224
|
+
EdgeItemCreatePayloadSchema,
|
|
225
|
+
EdgeItemDeletePayloadSchema,
|
|
226
|
+
EdgeItemDiffSchema,
|
|
227
|
+
EdgeItemKeySchema,
|
|
228
|
+
EdgeItemSchema,
|
|
229
|
+
EdgeItemUpdatePayloadSchema,
|
|
230
|
+
EdgeLayerCreatePayloadSchema,
|
|
231
|
+
EdgeLayerMetadataSchema,
|
|
232
|
+
GridLayerCreatePayloadSchema,
|
|
233
|
+
GridLayerMetadataSchema,
|
|
234
|
+
TrajectoryItemCreatePayloadSchema,
|
|
235
|
+
TrajectoryItemDeletePayloadSchema,
|
|
236
|
+
TrajectoryItemDiffSchema,
|
|
237
|
+
TrajectoryItemSchema,
|
|
238
|
+
TrajectoryItemUpdatePayloadSchema,
|
|
239
|
+
TrajectoryLayerCreatePayloadSchema,
|
|
240
|
+
TrajectoryLayerMetadataSchema,
|
|
241
|
+
TrajectoryPointSchema
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=layers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/layers.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod';\n\n/**\n * The five layer types built into the default TenSnap renderer registry.\n * Third-party layer types may still use open `layer_type` strings in the\n * generic protocol payloads.\n */\nexport const BuiltinLayerTypeSchema = z.enum(['background', 'grid', 'edge', 'trajectory', 'agent']);\n\nexport type BuiltinLayerType = z.infer<typeof BuiltinLayerTypeSchema>;\n\n/** Agent ids are stable layer item keys and may be strings or numbers. */\nexport const AgentIdSchema = z.union([z.string(), z.number()]);\n\nexport type AgentId = z.infer<typeof AgentIdSchema>;\n\nexport const BUILTIN_AGENT_ICONS = [\n 'arrow',\n 'circle',\n 'square',\n 'triangle',\n 'diamond',\n 'star',\n 'hexagon',\n 'cross',\n 'plus',\n 'pentagon',\n] as const;\n\n/** Built-in symbolic agent icons rendered by the default agent layer. */\nexport const BuiltinAgentIconSchema = z.enum(BUILTIN_AGENT_ICONS);\n\n/** Asset-backed icons use the `asset:<asset_id>` reference form. */\nexport const AssetAgentIconSchema = z.string().regex(/^asset:.+$/);\n\nexport const AgentIconSchema = z.union([BuiltinAgentIconSchema, AssetAgentIconSchema]);\n\nexport type BuiltinAgentIcon = z.infer<typeof BuiltinAgentIconSchema>;\nexport type AssetAgentIcon = z.infer<typeof AssetAgentIconSchema>;\nexport type AgentIcon = z.infer<typeof AgentIconSchema>;\n\n/**\n * Common metadata accepted by all built-in layers. Dependencies are create-time\n * topology and live on `env_layer_create.dependency_layer_ids`, not in metadata.\n */\nexport const BaseLayerMetadataSchema = z.object({\n dependency_layer_ids: z.never().optional(),\n z_index: z.number().optional(),\n}).loose();\n\nexport type BaseLayerMetadata = z.infer<typeof BaseLayerMetadataSchema>;\n\n/**\n * Agent layer metadata. `coord_offset` selects integer grid-cell coordinates or\n * floating scene coordinates for x/y agent positions.\n */\nexport const AgentLayerMetadataSchema = BaseLayerMetadataSchema.extend({\n width: z.number().optional(),\n height: z.number().optional(),\n coord_offset: z.enum(['int', 'float']).optional(),\n}).loose();\n\nexport type AgentLayerMetadata = z.infer<typeof AgentLayerMetadataSchema>;\n\n/**\n * Agent items are keyed by `id`. They can represent grid agents or graph nodes;\n * graph-force fields (`vx`, `vy`, `fx`, `fy`) are renderer-maintained hints.\n */\nexport const AgentItemSchema = z.object({\n id: AgentIdSchema,\n color: z.string().optional(),\n icon: AgentIconSchema.optional(),\n size: z.number().optional(),\n x: z.number().optional(),\n y: z.number().optional(),\n vx: z.number().optional(),\n vy: z.number().optional(),\n fx: z.number().nullable().optional(),\n fy: z.number().nullable().optional(),\n heading: z.number().optional(),\n data: z.record(z.string(), z.unknown()).optional(),\n}).loose();\n\nexport type AgentItem = z.infer<typeof AgentItemSchema>;\n\n/** Agent item updates are keyed by `id` and may carry any changed fields. */\nexport const AgentItemDiffSchema = z.object({\n id: AgentIdSchema,\n}).loose();\n\nexport type AgentItemDiff = z.infer<typeof AgentItemDiffSchema>;\n\n/**\n * Edge layer metadata configures graph layout forces and edge rendering\n * defaults. Edge layers depend on an agent layer through dependency key\n * `agent`.\n */\nexport const EdgeLayerMetadataSchema = BaseLayerMetadataSchema.extend({\n link_distance: z.number().optional(),\n charge_strength: z.number().optional(),\n centering_strength: z.number().optional(),\n collision_radius: z.number().optional(),\n max_component_distance: z.number().optional(),\n component_spacing: z.number().optional(),\n}).loose();\n\nexport type EdgeLayerMetadata = z.infer<typeof EdgeLayerMetadataSchema>;\n\n/** Edge items are keyed by the ordered pair (`source`, `target`). */\nexport const EdgeItemSchema = z.object({\n source: AgentIdSchema,\n target: AgentIdSchema,\n directed: z.boolean().optional(),\n style: z.enum(['solid', 'dashed', 'dotted']).optional(),\n width: z.number().optional(),\n color: z.string().optional(),\n}).loose();\n\nexport type EdgeItem = z.infer<typeof EdgeItemSchema>;\n\n/** Edge item updates are keyed by `source` and `target`. */\nexport const EdgeItemDiffSchema = z.object({\n source: AgentIdSchema,\n target: AgentIdSchema,\n}).loose();\n\nexport type EdgeItemDiff = z.infer<typeof EdgeItemDiffSchema>;\n\n/** Delete key for one edge item. */\nexport const EdgeItemKeySchema = z.object({\n source: AgentIdSchema,\n target: AgentIdSchema,\n});\n\nexport type EdgeItemKey = z.infer<typeof EdgeItemKeySchema>;\n\n/**\n * Trajectory layer metadata sets defaults for per-agent trajectory traces.\n * Trajectory layers depend on an agent layer through dependency key `agent`.\n */\nexport const TrajectoryLayerMetadataSchema = BaseLayerMetadataSchema.extend({\n length: z.number().optional(),\n width: z.number().optional(),\n color: z.string().optional(),\n}).loose();\n\nexport type TrajectoryLayerMetadata = z.infer<typeof TrajectoryLayerMetadataSchema>;\n\n/** Per-agent trajectory config items are keyed by agent `id`. */\nexport const TrajectoryItemSchema = z.object({\n id: AgentIdSchema,\n length: z.number().optional(),\n width: z.number().optional(),\n color: z.string().optional(),\n}).loose();\n\nexport type TrajectoryItem = z.infer<typeof TrajectoryItemSchema>;\n\n/** Trajectory item updates are keyed by `id`. */\nexport const TrajectoryItemDiffSchema = z.object({\n id: AgentIdSchema,\n}).loose();\n\nexport type TrajectoryItemDiff = z.infer<typeof TrajectoryItemDiffSchema>;\n\n/** One historical trajectory sample stored by the renderer. */\nexport const TrajectoryPointSchema = z.object({\n x: z.number(),\n y: z.number(),\n time: z.number(),\n color: z.string().optional(),\n});\n\nexport type TrajectoryPoint = z.infer<typeof TrajectoryPointSchema>;\n\n/** Grid layer metadata controls parametric grid lines and optional scene size. */\nexport const GridLayerMetadataSchema = BaseLayerMetadataSchema.extend({\n width: z.number().optional(),\n height: z.number().optional(),\n x_origin: z.number().optional(),\n x_unit: z.number().optional(),\n x_interval: z.number().optional(),\n x_ratio: z.number().int().min(2).optional(),\n y_origin: z.number().optional(),\n y_unit: z.number().optional(),\n y_interval: z.number().optional(),\n y_ratio: z.number().int().min(2).optional(),\n stroke_color: z.string().optional(),\n}).loose();\n\nexport type GridLayerMetadata = z.infer<typeof GridLayerMetadataSchema>;\n\nexport const BackgroundInterpolationSchema = z.enum(['nearest', 'linear']);\n\nexport type BackgroundInterpolation = z.infer<typeof BackgroundInterpolationSchema>;\n\n/** Background image references point to a previously announced protocol asset. */\nexport const BackgroundAssetReferenceSchema = z.object({\n asset_id: z.string(),\n interpolation: BackgroundInterpolationSchema.optional(),\n});\n\nexport type BackgroundAssetReference = z.infer<typeof BackgroundAssetReferenceSchema>;\n\n/** Raw background source accepted by the built-in background layer metadata. */\nexport const BackgroundSourceSchema = z.union([\n z.string(),\n z.instanceof(Uint8Array),\n BackgroundAssetReferenceSchema,\n]);\n\nexport type BackgroundSource = z.infer<typeof BackgroundSourceSchema>;\n\n/** Background layer metadata stores color/image/asset source and interpolation. */\nexport const BackgroundLayerMetadataSchema = BaseLayerMetadataSchema.extend({\n background: BackgroundSourceSchema.optional(),\n interpolation: BackgroundInterpolationSchema.optional(),\n}).loose();\n\nexport type BackgroundLayerMetadata = z.infer<typeof BackgroundLayerMetadataSchema>;\n\n/** Dependency map shape used by edge and trajectory layers. */\nexport const AgentDependencyLayerIdsSchema = z.object({\n agent: z.string(),\n}).loose();\n\nexport type AgentDependencyLayerIds = z.infer<typeof AgentDependencyLayerIdsSchema>;\n\nconst BuiltinLayerCreateBaseSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n});\n\nconst ItemPayloadBaseSchema = z.object({\n env_id: z.string(),\n layer_id: z.string(),\n});\n\n/** Built-in `agent` layer create payload. Agent layers do not require dependency layers. */\nexport const AgentLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({\n layer_type: z.literal('agent'),\n data: AgentLayerMetadataSchema.optional(),\n});\n\nexport type AgentLayerCreatePayload = z.infer<typeof AgentLayerCreatePayloadSchema>;\n\n/** Built-in `edge` layer create payload. `dependency_layer_ids.agent` names the source agent layer. */\nexport const EdgeLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({\n layer_type: z.literal('edge'),\n dependency_layer_ids: AgentDependencyLayerIdsSchema,\n data: EdgeLayerMetadataSchema.optional(),\n});\n\nexport type EdgeLayerCreatePayload = z.infer<typeof EdgeLayerCreatePayloadSchema>;\n\n/** Built-in `trajectory` layer create payload. `dependency_layer_ids.agent` names the traced agent layer. */\nexport const TrajectoryLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({\n layer_type: z.literal('trajectory'),\n dependency_layer_ids: AgentDependencyLayerIdsSchema,\n data: TrajectoryLayerMetadataSchema.optional(),\n});\n\nexport type TrajectoryLayerCreatePayload = z.infer<typeof TrajectoryLayerCreatePayloadSchema>;\n\n/** Built-in `grid` layer create payload. Grid layers use metadata only and do not accept item messages. */\nexport const GridLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({\n layer_type: z.literal('grid'),\n data: GridLayerMetadataSchema.optional(),\n});\n\nexport type GridLayerCreatePayload = z.infer<typeof GridLayerCreatePayloadSchema>;\n\n/** Built-in `background` layer create payload. Background layers use metadata only and do not accept item messages. */\nexport const BackgroundLayerCreatePayloadSchema = BuiltinLayerCreateBaseSchema.extend({\n layer_type: z.literal('background'),\n data: BackgroundLayerMetadataSchema.optional(),\n});\n\nexport type BackgroundLayerCreatePayload = z.infer<typeof BackgroundLayerCreatePayloadSchema>;\n\n/** Union of the five built-in layer create payload specializations. */\nexport const BuiltinLayerCreatePayloadSchema = z.union([\n BackgroundLayerCreatePayloadSchema,\n GridLayerCreatePayloadSchema,\n EdgeLayerCreatePayloadSchema,\n TrajectoryLayerCreatePayloadSchema,\n AgentLayerCreatePayloadSchema,\n]);\n\nexport type BuiltinLayerCreatePayload = z.infer<typeof BuiltinLayerCreatePayloadSchema>;\n\n/** `item_create` payload specialization for built-in agent layers. */\nexport const AgentItemCreatePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(AgentItemSchema),\n});\n\nexport type AgentItemCreatePayload = z.infer<typeof AgentItemCreatePayloadSchema>;\n\n/** `item_update` payload specialization for built-in agent layers. */\nexport const AgentItemUpdatePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(AgentItemDiffSchema),\n});\n\nexport type AgentItemUpdatePayload = z.infer<typeof AgentItemUpdatePayloadSchema>;\n\n/** `item_delete` payload specialization for built-in agent layers, keyed by agent id. */\nexport const AgentItemDeletePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(AgentIdSchema),\n});\n\nexport type AgentItemDeletePayload = z.infer<typeof AgentItemDeletePayloadSchema>;\n\n/** `item_create` payload specialization for built-in edge layers. */\nexport const EdgeItemCreatePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(EdgeItemSchema),\n});\n\nexport type EdgeItemCreatePayload = z.infer<typeof EdgeItemCreatePayloadSchema>;\n\n/** `item_update` payload specialization for built-in edge layers. */\nexport const EdgeItemUpdatePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(EdgeItemDiffSchema),\n});\n\nexport type EdgeItemUpdatePayload = z.infer<typeof EdgeItemUpdatePayloadSchema>;\n\n/** `item_delete` payload specialization for built-in edge layers, keyed by source/target pairs. */\nexport const EdgeItemDeletePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(EdgeItemKeySchema),\n});\n\nexport type EdgeItemDeletePayload = z.infer<typeof EdgeItemDeletePayloadSchema>;\n\n/** `item_create` payload specialization for built-in trajectory layers. */\nexport const TrajectoryItemCreatePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(TrajectoryItemSchema),\n});\n\nexport type TrajectoryItemCreatePayload = z.infer<typeof TrajectoryItemCreatePayloadSchema>;\n\n/** `item_update` payload specialization for built-in trajectory layers. */\nexport const TrajectoryItemUpdatePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(TrajectoryItemDiffSchema),\n});\n\nexport type TrajectoryItemUpdatePayload = z.infer<typeof TrajectoryItemUpdatePayloadSchema>;\n\n/** `item_delete` payload specialization for built-in trajectory layers, keyed by agent id. */\nexport const TrajectoryItemDeletePayloadSchema = ItemPayloadBaseSchema.extend({\n items: z.array(AgentIdSchema),\n});\n\nexport type TrajectoryItemDeletePayload = z.infer<typeof TrajectoryItemDeletePayloadSchema>;\n\n/** Union of built-in layer `item_create` payload specializations. Grid and background layers have no items. */\nexport const BuiltinLayerItemCreatePayloadSchema = z.union([\n AgentItemCreatePayloadSchema,\n EdgeItemCreatePayloadSchema,\n TrajectoryItemCreatePayloadSchema,\n]);\n\nexport type BuiltinLayerItemCreatePayload = z.infer<typeof BuiltinLayerItemCreatePayloadSchema>;\n\n/** Union of built-in layer `item_update` payload specializations. Grid and background layers have no items. */\nexport const BuiltinLayerItemUpdatePayloadSchema = z.union([\n AgentItemUpdatePayloadSchema,\n EdgeItemUpdatePayloadSchema,\n TrajectoryItemUpdatePayloadSchema,\n]);\n\nexport type BuiltinLayerItemUpdatePayload = z.infer<typeof BuiltinLayerItemUpdatePayloadSchema>;\n\n/** Union of built-in layer `item_delete` payload specializations. Grid and background layers have no items. */\nexport const BuiltinLayerItemDeletePayloadSchema = z.union([\n AgentItemDeletePayloadSch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