@neta-art/cohub 5.10.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +47 -50
  2. package/dist/board/animation.d.ts +157 -67
  3. package/dist/board/animation.js +161 -306
  4. package/dist/board/core/connections.js +4 -4
  5. package/dist/board/core/export-plan.js +1 -1
  6. package/dist/board/core/shape-types.js +0 -1
  7. package/dist/board/geometry.js +4 -4
  8. package/dist/board/index.d.ts +8 -7
  9. package/dist/board/index.js +8 -9
  10. package/dist/board/mutation.d.ts +2 -17
  11. package/dist/board/mutation.js +2 -93
  12. package/dist/board/render/renderers/text-card-renderer.js +1 -1
  13. package/dist/board/semantic-document.d.ts +30 -0
  14. package/dist/board/semantic-document.js +271 -0
  15. package/dist/board/semantic-mutation.d.ts +10 -0
  16. package/dist/board/semantic-mutation.js +203 -0
  17. package/dist/chunks/http.d.ts +27 -95
  18. package/dist/chunks/http.js +628 -1610
  19. package/dist/chunks/transport.js +1 -1
  20. package/dist/chunks/websocket.d.ts +3462 -533
  21. package/dist/chunks/websocket.js +1 -1
  22. package/dist/http.d.ts +3 -3
  23. package/dist/index.d.ts +158 -299
  24. package/dist/index.js +1207 -499
  25. package/dist/protocol/dist/board-authoring.d.ts +1305 -0
  26. package/dist/protocol/dist/board-authoring.js +291 -0
  27. package/dist/protocol/dist/board-capability-registry.d.ts +2 -0
  28. package/dist/protocol/dist/board-capability-registry.js +74 -0
  29. package/dist/protocol/dist/board-codec.d.ts +2 -0
  30. package/dist/protocol/dist/board-codec.js +19 -0
  31. package/dist/protocol/dist/board-composition.d.ts +383 -0
  32. package/dist/protocol/dist/board-composition.js +310 -0
  33. package/dist/protocol/dist/board-connection.d.ts +16 -16
  34. package/dist/protocol/dist/board-connection.js +16 -16
  35. package/dist/protocol/dist/board-constants.js +0 -25
  36. package/dist/protocol/dist/board-document.d.ts +34 -3
  37. package/dist/protocol/dist/board-document.js +3 -1
  38. package/dist/protocol/dist/board-effect.d.ts +94 -0
  39. package/dist/protocol/dist/board-effect.js +53 -0
  40. package/dist/protocol/dist/board-json.js +16 -0
  41. package/dist/protocol/dist/board-node.d.ts +1 -12
  42. package/dist/protocol/dist/board-node.js +1 -81
  43. package/dist/protocol/dist/board.d.ts +42 -245
  44. package/dist/protocol/dist/board.js +56 -117
  45. package/dist/protocol/dist/index.d.ts +9 -4
  46. package/dist/types.d.ts +4 -1
  47. package/docs/work-runtime-guide.md +19 -3
  48. package/package.json +2 -2
  49. package/dist/board/codec.d.ts +0 -27
  50. package/dist/board/codec.js +0 -277
  51. package/dist/board/nodes.d.ts +0 -113
  52. package/dist/board/nodes.js +0 -154
  53. package/dist/protocol/dist/board-content.js +0 -26
  54. package/dist/protocol/dist/identifiers.js +0 -10
  55. package/dist/protocol/dist/index.js +0 -14
  56. package/dist/protocol/dist/provenance.js +0 -15
  57. package/dist/protocol/dist/public-identifiers.js +0 -38
  58. package/dist/protocol/dist/realtime/board-awareness.js +0 -119
  59. package/dist/protocol/dist/ui-command.js +0 -2
  60. package/dist/protocol/dist/work-promotion-stats.js +0 -11
  61. package/dist/protocol/dist/work-surface.js +0 -2
  62. package/dist/protocol/dist/work-view-stats.js +0 -3
@@ -35,7 +35,7 @@ declare const BoardConnectionAnchorSchema: z.ZodUnion<readonly [z.ZodObject<{
35
35
  type BoardConnectionAnchor = z.infer<typeof BoardConnectionAnchorSchema>;
36
36
  declare const AUTO_BOARD_CONNECTION_ANCHOR: BoardConnectionAnchor;
37
37
  declare const BoardConnectionEndpointSchema: z.ZodObject<{
38
- nodeId: z.ZodString;
38
+ itemId: z.ZodString;
39
39
  portId: z.ZodOptional<z.ZodString>;
40
40
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
41
41
  kind: z.ZodLiteral<"auto">;
@@ -125,7 +125,7 @@ declare const DEFAULT_BOARD_CONNECTION_STYLE: BoardConnectionStyle;
125
125
  declare const BoardConnectionSchema: z.ZodObject<{
126
126
  id: z.ZodString;
127
127
  source: z.ZodObject<{
128
- nodeId: z.ZodString;
128
+ itemId: z.ZodString;
129
129
  portId: z.ZodOptional<z.ZodString>;
130
130
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
131
131
  kind: z.ZodLiteral<"auto">;
@@ -145,7 +145,7 @@ declare const BoardConnectionSchema: z.ZodObject<{
145
145
  }, z.core.$strip>]>>;
146
146
  }, z.core.$strip>;
147
147
  target: z.ZodObject<{
148
- nodeId: z.ZodString;
148
+ itemId: z.ZodString;
149
149
  portId: z.ZodOptional<z.ZodString>;
150
150
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
151
151
  kind: z.ZodLiteral<"auto">;
@@ -193,7 +193,7 @@ declare const BoardConnectionSchema: z.ZodObject<{
193
193
  }>>;
194
194
  }, z.core.$strip>>;
195
195
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
196
- }, z.core.$strip>;
196
+ }, z.core.$strict>;
197
197
  type BoardConnection = z.infer<typeof BoardConnectionSchema>;
198
198
  /** Server-owned fields, mirroring how nodes carry a board id and revision. */
199
199
  type BoardConnectionRecord = BoardConnection & {
@@ -212,7 +212,7 @@ type BoardConnectionInput = BoardConnection;
212
212
  */
213
213
  declare const BoardConnectionPatchSchema: z.ZodObject<{
214
214
  source: z.ZodOptional<z.ZodObject<{
215
- nodeId: z.ZodString;
215
+ itemId: z.ZodString;
216
216
  portId: z.ZodOptional<z.ZodString>;
217
217
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
218
218
  kind: z.ZodLiteral<"auto">;
@@ -232,7 +232,7 @@ declare const BoardConnectionPatchSchema: z.ZodObject<{
232
232
  }, z.core.$strip>]>>;
233
233
  }, z.core.$strip>>;
234
234
  target: z.ZodOptional<z.ZodObject<{
235
- nodeId: z.ZodString;
235
+ itemId: z.ZodString;
236
236
  portId: z.ZodOptional<z.ZodString>;
237
237
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
238
238
  kind: z.ZodLiteral<"auto">;
@@ -280,26 +280,26 @@ declare const BoardConnectionPatchSchema: z.ZodObject<{
280
280
  }>>;
281
281
  }, z.core.$strip>>>;
282
282
  metadata: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
283
- }, z.core.$strip>;
283
+ }, z.core.$strict>;
284
284
  type BoardConnectionPatch = z.infer<typeof BoardConnectionPatchSchema>;
285
- /** Both node ids a connection touches, deduped for a self-loop. */
286
- declare function connectionNodeIds(connection: BoardConnection): string[];
285
+ /** Both item ids a connection touches, deduped for a self-loop. */
286
+ declare function connectionItemIds(connection: BoardConnection): string[];
287
287
  /** Whether a connection touches the given node. */
288
- declare function connectionTouchesNode(connection: BoardConnection, nodeId: string): boolean;
289
- /** The node at the far end of a connection from `nodeId`, or null. */
290
- declare function connectionOtherNodeId(connection: BoardConnection, nodeId: string): string | null;
288
+ declare function connectionTouchesItem(connection: BoardConnection, itemId: string): boolean;
289
+ /** The item at the far end of a connection from `itemId`, or null. */
290
+ declare function connectionOtherItemId(connection: BoardConnection, itemId: string): string | null;
291
291
  declare function normalizeBoardConnectionStyle(style: Partial<BoardConnectionStyle> | undefined): BoardConnectionStyle;
292
292
  /**
293
293
  * Build a connection with every default filled in.
294
294
  *
295
- * Callers only state what they mean (which nodes, and optionally the relation),
295
+ * Callers only state what they mean (which items, and optionally the relation),
296
296
  * so a connection created by the editor, an agent or the CLI is byte-identical
297
297
  * for the same intent.
298
298
  */
299
299
  declare function createBoardConnection(input: {
300
300
  id: string;
301
- sourceNodeId: string;
302
- targetNodeId: string;
301
+ sourceItemId: string;
302
+ targetItemId: string;
303
303
  relation?: string;
304
304
  direction?: BoardConnectionDirection;
305
305
  label?: string;
@@ -314,4 +314,4 @@ declare function createBoardConnection(input: {
314
314
  /** Reverse a connection's endpoints, preserving the relation's reading order. */
315
315
  declare function flipBoardConnection(connection: BoardConnection): BoardConnection;
316
316
  //#endregion
317
- export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle };
317
+ export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle };
@@ -10,7 +10,7 @@ import { z } from "zod";
10
10
  * force a bounding box to be persisted and kept in sync with both endpoints —
11
11
  * a second source of truth that is stale the moment either node moves.
12
12
  *
13
- * The stored form is therefore purely semantic: which nodes, in which direction,
13
+ * The stored form is therefore purely semantic: which items, in which direction,
14
14
  * anchored where, routed how. Every world coordinate is resolved at read time
15
15
  * from the live node frames (see the SDK's connection geometry), so a connection
16
16
  * can never drift from the nodes it describes.
@@ -54,7 +54,7 @@ const BoardConnectionAnchorSchema = z.union([
54
54
  ]);
55
55
  const AUTO_BOARD_CONNECTION_ANCHOR = { kind: "auto" };
56
56
  const BoardConnectionEndpointSchema = z.object({
57
- nodeId: z.string().min(1).max(160),
57
+ itemId: z.string().min(1).max(160),
58
58
  /** Optional semantic port. Older connections omit it and remain valid. */
59
59
  portId: z.string().min(1).max(120).optional(),
60
60
  anchor: BoardConnectionAnchorSchema.default(AUTO_BOARD_CONNECTION_ANCHOR)
@@ -140,7 +140,7 @@ const BoardConnectionSchema = z.object({
140
140
  routing: BoardConnectionRoutingSchema.default(DEFAULT_BOARD_CONNECTION_ROUTING),
141
141
  style: BoardConnectionStyleSchema.default(DEFAULT_BOARD_CONNECTION_STYLE),
142
142
  metadata: z.record(z.string(), z.unknown()).default({})
143
- });
143
+ }).strict();
144
144
  /**
145
145
  * A patch to an existing connection.
146
146
  *
@@ -148,18 +148,18 @@ const BoardConnectionSchema = z.object({
148
148
  * endpoints is an edit of the same relation, not a new one.
149
149
  */
150
150
  const BoardConnectionPatchSchema = BoardConnectionSchema.omit({ id: true }).partial();
151
- /** Both node ids a connection touches, deduped for a self-loop. */
152
- function connectionNodeIds(connection) {
153
- return connection.source.nodeId === connection.target.nodeId ? [connection.source.nodeId] : [connection.source.nodeId, connection.target.nodeId];
151
+ /** Both item ids a connection touches, deduped for a self-loop. */
152
+ function connectionItemIds(connection) {
153
+ return connection.source.itemId === connection.target.itemId ? [connection.source.itemId] : [connection.source.itemId, connection.target.itemId];
154
154
  }
155
155
  /** Whether a connection touches the given node. */
156
- function connectionTouchesNode(connection, nodeId) {
157
- return connection.source.nodeId === nodeId || connection.target.nodeId === nodeId;
156
+ function connectionTouchesItem(connection, itemId) {
157
+ return connection.source.itemId === itemId || connection.target.itemId === itemId;
158
158
  }
159
- /** The node at the far end of a connection from `nodeId`, or null. */
160
- function connectionOtherNodeId(connection, nodeId) {
161
- if (connection.source.nodeId === nodeId) return connection.target.nodeId;
162
- if (connection.target.nodeId === nodeId) return connection.source.nodeId;
159
+ /** The item at the far end of a connection from `itemId`, or null. */
160
+ function connectionOtherItemId(connection, itemId) {
161
+ if (connection.source.itemId === itemId) return connection.target.itemId;
162
+ if (connection.target.itemId === itemId) return connection.source.itemId;
163
163
  return null;
164
164
  }
165
165
  function normalizeBoardConnectionStyle(style) {
@@ -172,7 +172,7 @@ function normalizeBoardConnectionStyle(style) {
172
172
  /**
173
173
  * Build a connection with every default filled in.
174
174
  *
175
- * Callers only state what they mean (which nodes, and optionally the relation),
175
+ * Callers only state what they mean (which items, and optionally the relation),
176
176
  * so a connection created by the editor, an agent or the CLI is byte-identical
177
177
  * for the same intent.
178
178
  */
@@ -180,12 +180,12 @@ function createBoardConnection(input) {
180
180
  return {
181
181
  id: input.id,
182
182
  source: {
183
- nodeId: input.sourceNodeId,
183
+ itemId: input.sourceItemId,
184
184
  ...input.sourcePortId ? { portId: input.sourcePortId } : {},
185
185
  anchor: input.sourceAnchor ?? AUTO_BOARD_CONNECTION_ANCHOR
186
186
  },
187
187
  target: {
188
- nodeId: input.targetNodeId,
188
+ itemId: input.targetItemId,
189
189
  ...input.targetPortId ? { portId: input.targetPortId } : {},
190
190
  anchor: input.targetAnchor ?? AUTO_BOARD_CONNECTION_ANCHOR
191
191
  },
@@ -216,4 +216,4 @@ function flipBoardConnection(connection) {
216
216
  };
217
217
  }
218
218
  //#endregion
219
- export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle };
219
+ export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle };
@@ -11,7 +11,6 @@ const DEFAULT_BOARD_RENDER_LIMITS = {
11
11
  simulationSteps: 1e5
12
12
  };
13
13
  const BOARD_BUILTIN_CLIP_KINDS = [
14
- "motion.keyframes",
15
14
  "motion.path",
16
15
  "draw.reveal",
17
16
  "draw.handwrite",
@@ -20,9 +19,6 @@ const BOARD_BUILTIN_CLIP_KINDS = [
20
19
  "effects.trail",
21
20
  "effects.impact",
22
21
  "effects.flash",
23
- "effects.color",
24
- "camera.pan",
25
- "camera.zoom",
26
22
  "camera.focus",
27
23
  "camera.shake"
28
24
  ];
@@ -63,16 +59,6 @@ const BOARD_FONT_STACK = "\"Geist\", system-ui, -apple-system, \"Noto Sans CJK S
63
59
  const BOARD_MONO_FONT_STACK = "\"Geist Mono\", \"Fira Code\", ui-monospace, \"Noto Sans Mono CJK SC\", monospace";
64
60
  function clipSchema(id) {
65
61
  switch (id) {
66
- case "motion.keyframes": return { params: {
67
- x: {
68
- coordinateSpace: "world-offset",
69
- unit: "board"
70
- },
71
- y: {
72
- coordinateSpace: "world-offset",
73
- unit: "board"
74
- }
75
- } };
76
62
  case "motion.path": return { params: { points: {
77
63
  coordinateSpace: "world-offset",
78
64
  unit: "board"
@@ -81,17 +67,6 @@ function clipSchema(id) {
81
67
  coordinateSpace: "world",
82
68
  unit: "board"
83
69
  } } };
84
- case "camera.pan": return { params: {
85
- x: {
86
- coordinateSpace: "screen-offset",
87
- unit: "css-px"
88
- },
89
- y: {
90
- coordinateSpace: "screen-offset",
91
- unit: "css-px"
92
- }
93
- } };
94
- case "camera.zoom": return { params: { scale: { unit: "ratio" } } };
95
70
  case "camera.focus": return { params: {
96
71
  focus: {
97
72
  coordinateSpace: "world",
@@ -100,6 +100,7 @@ declare const BoardTextItemSchema: z.ZodObject<{
100
100
  height: z.ZodNumber;
101
101
  rotation: z.ZodDefault<z.ZodNumber>;
102
102
  }, z.core.$strip>;
103
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
104
  locked: z.ZodOptional<z.ZodBoolean>;
104
105
  style: z.ZodOptional<z.ZodObject<{
105
106
  variant: z.ZodDefault<z.ZodString>;
@@ -133,6 +134,7 @@ declare const BoardGeoItemSchema: z.ZodObject<{
133
134
  height: z.ZodNumber;
134
135
  rotation: z.ZodDefault<z.ZodNumber>;
135
136
  }, z.core.$strip>;
137
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
138
  locked: z.ZodOptional<z.ZodBoolean>;
137
139
  style: z.ZodOptional<z.ZodObject<{
138
140
  variant: z.ZodDefault<z.ZodString>;
@@ -178,6 +180,7 @@ declare const BoardDrawItemSchema: z.ZodObject<{
178
180
  height: z.ZodNumber;
179
181
  rotation: z.ZodDefault<z.ZodNumber>;
180
182
  }, z.core.$strip>;
183
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
184
  locked: z.ZodOptional<z.ZodBoolean>;
182
185
  style: z.ZodOptional<z.ZodObject<{
183
186
  variant: z.ZodDefault<z.ZodString>;
@@ -224,6 +227,7 @@ declare const BoardArrowItemSchema: z.ZodObject<{
224
227
  height: z.ZodNumber;
225
228
  rotation: z.ZodDefault<z.ZodNumber>;
226
229
  }, z.core.$strip>;
230
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
227
231
  locked: z.ZodOptional<z.ZodBoolean>;
228
232
  style: z.ZodOptional<z.ZodObject<{
229
233
  variant: z.ZodDefault<z.ZodString>;
@@ -269,6 +273,7 @@ declare const BoardFrameItemSchema: z.ZodObject<{
269
273
  height: z.ZodNumber;
270
274
  rotation: z.ZodDefault<z.ZodNumber>;
271
275
  }, z.core.$strip>;
276
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
272
277
  locked: z.ZodOptional<z.ZodBoolean>;
273
278
  style: z.ZodOptional<z.ZodObject<{
274
279
  variant: z.ZodDefault<z.ZodString>;
@@ -302,6 +307,7 @@ declare const BoardImageItemSchema: z.ZodObject<{
302
307
  height: z.ZodNumber;
303
308
  rotation: z.ZodDefault<z.ZodNumber>;
304
309
  }, z.core.$strip>;
310
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
305
311
  locked: z.ZodOptional<z.ZodBoolean>;
306
312
  style: z.ZodOptional<z.ZodObject<{
307
313
  variant: z.ZodDefault<z.ZodString>;
@@ -351,6 +357,7 @@ declare const BoardVideoItemSchema: z.ZodObject<{
351
357
  height: z.ZodNumber;
352
358
  rotation: z.ZodDefault<z.ZodNumber>;
353
359
  }, z.core.$strip>;
360
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
354
361
  locked: z.ZodOptional<z.ZodBoolean>;
355
362
  style: z.ZodOptional<z.ZodObject<{
356
363
  variant: z.ZodDefault<z.ZodString>;
@@ -394,6 +401,7 @@ declare const BoardAudioItemSchema: z.ZodObject<{
394
401
  height: z.ZodNumber;
395
402
  rotation: z.ZodDefault<z.ZodNumber>;
396
403
  }, z.core.$strip>;
404
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
397
405
  locked: z.ZodOptional<z.ZodBoolean>;
398
406
  style: z.ZodOptional<z.ZodObject<{
399
407
  variant: z.ZodDefault<z.ZodString>;
@@ -464,6 +472,7 @@ declare const BoardFileItemSchema: z.ZodObject<{
464
472
  height: z.ZodNumber;
465
473
  rotation: z.ZodDefault<z.ZodNumber>;
466
474
  }, z.core.$strip>;
475
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
467
476
  locked: z.ZodOptional<z.ZodBoolean>;
468
477
  style: z.ZodOptional<z.ZodObject<{
469
478
  variant: z.ZodDefault<z.ZodString>;
@@ -591,6 +600,7 @@ declare const BoardTaskItemSchema: z.ZodObject<{
591
600
  height: z.ZodNumber;
592
601
  rotation: z.ZodDefault<z.ZodNumber>;
593
602
  }, z.core.$strip>;
603
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
594
604
  locked: z.ZodOptional<z.ZodBoolean>;
595
605
  style: z.ZodOptional<z.ZodObject<{
596
606
  variant: z.ZodDefault<z.ZodString>;
@@ -678,6 +688,7 @@ type BoardUnknownItem = {
678
688
  id: string;
679
689
  type: typeof UNKNOWN_BOARD_ITEM_TYPE;
680
690
  frame: z.infer<typeof BoardFrameSchema>;
691
+ parentId?: string | null;
681
692
  locked?: boolean;
682
693
  style?: z.infer<typeof BoardItemStyleSchema>;
683
694
  metadata?: Record<string, unknown>;
@@ -695,6 +706,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
695
706
  height: number;
696
707
  rotation: number;
697
708
  };
709
+ parentId?: string | null | undefined;
698
710
  locked?: boolean | undefined;
699
711
  style?: {
700
712
  variant: string;
@@ -733,6 +745,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
733
745
  height: number;
734
746
  rotation: number;
735
747
  };
748
+ parentId?: string | null | undefined;
736
749
  locked?: boolean | undefined;
737
750
  style?: {
738
751
  variant: string;
@@ -765,6 +778,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
765
778
  height: number;
766
779
  rotation: number;
767
780
  };
781
+ parentId?: string | null | undefined;
768
782
  locked?: boolean | undefined;
769
783
  style?: {
770
784
  variant: string;
@@ -798,6 +812,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
798
812
  height: number;
799
813
  rotation: number;
800
814
  };
815
+ parentId?: string | null | undefined;
801
816
  locked?: boolean | undefined;
802
817
  style?: {
803
818
  variant: string;
@@ -831,6 +846,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
831
846
  height: number;
832
847
  rotation: number;
833
848
  };
849
+ parentId?: string | null | undefined;
834
850
  locked?: boolean | undefined;
835
851
  style?: {
836
852
  variant: string;
@@ -893,6 +909,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
893
909
  height: number;
894
910
  rotation: number;
895
911
  };
912
+ parentId?: string | null | undefined;
896
913
  locked?: boolean | undefined;
897
914
  style?: {
898
915
  variant: string;
@@ -916,6 +933,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
916
933
  height: number;
917
934
  rotation: number;
918
935
  };
936
+ parentId?: string | null | undefined;
919
937
  locked?: boolean | undefined;
920
938
  style?: {
921
939
  variant: string;
@@ -940,6 +958,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
940
958
  height: number;
941
959
  rotation: number;
942
960
  };
961
+ parentId?: string | null | undefined;
943
962
  locked?: boolean | undefined;
944
963
  style?: {
945
964
  variant: string;
@@ -967,6 +986,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
967
986
  height: number;
968
987
  rotation: number;
969
988
  };
989
+ parentId?: string | null | undefined;
970
990
  locked?: boolean | undefined;
971
991
  style?: {
972
992
  variant: string;
@@ -1001,6 +1021,7 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
1001
1021
  height: number;
1002
1022
  rotation: number;
1003
1023
  };
1024
+ parentId?: string | null | undefined;
1004
1025
  locked?: boolean | undefined;
1005
1026
  style?: {
1006
1027
  variant: string;
@@ -1078,6 +1099,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1078
1099
  height: number;
1079
1100
  rotation: number;
1080
1101
  };
1102
+ parentId?: string | null | undefined;
1081
1103
  locked?: boolean | undefined;
1082
1104
  style?: {
1083
1105
  variant: string;
@@ -1116,6 +1138,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1116
1138
  height: number;
1117
1139
  rotation: number;
1118
1140
  };
1141
+ parentId?: string | null | undefined;
1119
1142
  locked?: boolean | undefined;
1120
1143
  style?: {
1121
1144
  variant: string;
@@ -1148,6 +1171,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1148
1171
  height: number;
1149
1172
  rotation: number;
1150
1173
  };
1174
+ parentId?: string | null | undefined;
1151
1175
  locked?: boolean | undefined;
1152
1176
  style?: {
1153
1177
  variant: string;
@@ -1181,6 +1205,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1181
1205
  height: number;
1182
1206
  rotation: number;
1183
1207
  };
1208
+ parentId?: string | null | undefined;
1184
1209
  locked?: boolean | undefined;
1185
1210
  style?: {
1186
1211
  variant: string;
@@ -1214,6 +1239,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1214
1239
  height: number;
1215
1240
  rotation: number;
1216
1241
  };
1242
+ parentId?: string | null | undefined;
1217
1243
  locked?: boolean | undefined;
1218
1244
  style?: {
1219
1245
  variant: string;
@@ -1276,6 +1302,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1276
1302
  height: number;
1277
1303
  rotation: number;
1278
1304
  };
1305
+ parentId?: string | null | undefined;
1279
1306
  locked?: boolean | undefined;
1280
1307
  style?: {
1281
1308
  variant: string;
@@ -1299,6 +1326,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1299
1326
  height: number;
1300
1327
  rotation: number;
1301
1328
  };
1329
+ parentId?: string | null | undefined;
1302
1330
  locked?: boolean | undefined;
1303
1331
  style?: {
1304
1332
  variant: string;
@@ -1323,6 +1351,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1323
1351
  height: number;
1324
1352
  rotation: number;
1325
1353
  };
1354
+ parentId?: string | null | undefined;
1326
1355
  locked?: boolean | undefined;
1327
1356
  style?: {
1328
1357
  variant: string;
@@ -1350,6 +1379,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1350
1379
  height: number;
1351
1380
  rotation: number;
1352
1381
  };
1382
+ parentId?: string | null | undefined;
1353
1383
  locked?: boolean | undefined;
1354
1384
  style?: {
1355
1385
  variant: string;
@@ -1384,6 +1414,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1384
1414
  height: number;
1385
1415
  rotation: number;
1386
1416
  };
1417
+ parentId?: string | null | undefined;
1387
1418
  locked?: boolean | undefined;
1388
1419
  style?: {
1389
1420
  variant: string;
@@ -1401,7 +1432,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1401
1432
  connections: z.ZodDefault<z.ZodArray<z.ZodObject<{
1402
1433
  id: z.ZodString;
1403
1434
  source: z.ZodObject<{
1404
- nodeId: z.ZodString;
1435
+ itemId: z.ZodString;
1405
1436
  portId: z.ZodOptional<z.ZodString>;
1406
1437
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
1407
1438
  kind: z.ZodLiteral<"auto">;
@@ -1421,7 +1452,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1421
1452
  }, z.core.$strip>]>>;
1422
1453
  }, z.core.$strip>;
1423
1454
  target: z.ZodObject<{
1424
- nodeId: z.ZodString;
1455
+ itemId: z.ZodString;
1425
1456
  portId: z.ZodOptional<z.ZodString>;
1426
1457
  anchor: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
1427
1458
  kind: z.ZodLiteral<"auto">;
@@ -1469,7 +1500,7 @@ declare const BoardDocumentSchema: z.ZodObject<{
1469
1500
  }>>;
1470
1501
  }, z.core.$strip>>;
1471
1502
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1472
- }, z.core.$strip>>>;
1503
+ }, z.core.$strict>>>;
1473
1504
  }, z.core.$strip>;
1474
1505
  type BoardFrame = z.infer<typeof BoardFrameSchema>;
1475
1506
  type BoardViewport = z.infer<typeof BoardViewportSchema>;
@@ -100,6 +100,7 @@ const BoardMediaSnapshotSchema = z.object({
100
100
  const BoardItemBaseSchema = z.object({
101
101
  id: z.string().min(1),
102
102
  frame: BoardFrameSchema,
103
+ parentId: z.string().min(1).nullable().optional(),
103
104
  /** When true the shape cannot be moved, resized, or deleted. */
104
105
  locked: z.boolean().optional(),
105
106
  style: BoardItemStyleSchema.optional(),
@@ -378,6 +379,7 @@ function makeUnknownItem(raw) {
378
379
  height: 80,
379
380
  rotation: 0
380
381
  },
382
+ ...typeof record.parentId === "string" || record.parentId === null ? { parentId: record.parentId } : {},
381
383
  ...record.locked === true ? { locked: true } : {},
382
384
  ...styleParsed.success && record.style ? { style: styleParsed.data } : {},
383
385
  ...record.metadata && typeof record.metadata === "object" ? { metadata: record.metadata } : {},
@@ -431,7 +433,7 @@ function parseBoardDocument(input) {
431
433
  function withResolvedConnections(document) {
432
434
  if (document.connections.length === 0) return document;
433
435
  const ids = new Set(document.items.map((item) => item.id));
434
- const connections = document.connections.filter((connection) => ids.has(connection.source.nodeId) && ids.has(connection.target.nodeId));
436
+ const connections = document.connections.filter((connection) => ids.has(connection.source.itemId) && ids.has(connection.target.itemId));
435
437
  return connections.length === document.connections.length ? document : {
436
438
  ...document,
437
439
  connections
@@ -0,0 +1,94 @@
1
+ import { z } from "zod";
2
+ //#region ../protocol/dist/board-effect.d.ts
3
+ declare const BoardAssetRefSchema: z.ZodObject<{
4
+ type: z.ZodEnum<{
5
+ extension: "extension";
6
+ "space-file": "space-file";
7
+ }>;
8
+ ref: z.ZodString;
9
+ digest: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strict>;
11
+ declare const BoardEffectSchema: z.ZodObject<{
12
+ id: z.ZodString;
13
+ boardId: z.ZodString;
14
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
15
+ type: z.ZodLiteral<"item">;
16
+ itemId: z.ZodString;
17
+ }, z.core.$strict>, z.ZodObject<{
18
+ type: z.ZodLiteral<"board">;
19
+ }, z.core.$strict>], "type">;
20
+ kind: z.ZodString;
21
+ kindVersion: z.ZodNumber;
22
+ enabled: z.ZodDefault<z.ZodBoolean>;
23
+ lifecycle: z.ZodEnum<{
24
+ manual: "manual";
25
+ persistent: "persistent";
26
+ "when-visible": "when-visible";
27
+ }>;
28
+ timeOrigin: z.ZodEnum<{
29
+ activation: "activation";
30
+ board: "board";
31
+ visible: "visible";
32
+ }>;
33
+ layer: z.ZodDefault<z.ZodEnum<{
34
+ behind: "behind";
35
+ front: "front";
36
+ screen: "screen";
37
+ }>>;
38
+ seed: z.ZodString;
39
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
+ assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
41
+ type: z.ZodEnum<{
42
+ extension: "extension";
43
+ "space-file": "space-file";
44
+ }>;
45
+ ref: z.ZodString;
46
+ digest: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strict>>>;
48
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
49
+ revision: z.ZodNumber;
50
+ }, z.core.$strict>;
51
+ type BoardAssetRef = z.infer<typeof BoardAssetRefSchema>;
52
+ type BoardEffect = z.infer<typeof BoardEffectSchema>;
53
+ /** The client-authored effect form: no server-owned `boardId`/`revision`. */
54
+ declare const BoardEffectInputSchema: z.ZodObject<{
55
+ id: z.ZodString;
56
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
57
+ type: z.ZodLiteral<"item">;
58
+ itemId: z.ZodString;
59
+ }, z.core.$strict>, z.ZodObject<{
60
+ type: z.ZodLiteral<"board">;
61
+ }, z.core.$strict>], "type">;
62
+ kind: z.ZodString;
63
+ kindVersion: z.ZodNumber;
64
+ enabled: z.ZodDefault<z.ZodBoolean>;
65
+ lifecycle: z.ZodEnum<{
66
+ manual: "manual";
67
+ persistent: "persistent";
68
+ "when-visible": "when-visible";
69
+ }>;
70
+ timeOrigin: z.ZodEnum<{
71
+ activation: "activation";
72
+ board: "board";
73
+ visible: "visible";
74
+ }>;
75
+ layer: z.ZodDefault<z.ZodEnum<{
76
+ behind: "behind";
77
+ front: "front";
78
+ screen: "screen";
79
+ }>>;
80
+ seed: z.ZodString;
81
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
82
+ assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
83
+ type: z.ZodEnum<{
84
+ extension: "extension";
85
+ "space-file": "space-file";
86
+ }>;
87
+ ref: z.ZodString;
88
+ digest: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strict>>>;
90
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
91
+ }, z.core.$strict>;
92
+ type BoardEffectInput = z.infer<typeof BoardEffectInputSchema>;
93
+ //#endregion
94
+ export { BoardAssetRef, BoardAssetRefSchema, BoardEffect, BoardEffectInput, BoardEffectInputSchema, BoardEffectSchema };
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+ //#region ../protocol/dist/board-effect.js
3
+ /**
4
+ * Board effect schema, isolated so `board-authoring.ts` can reuse the exact
5
+ * definition without a runtime cycle through `board.ts`. One definition, one
6
+ * strictness level — semantic mutations and Board create must not drift apart.
7
+ */
8
+ const idSchema = z.string().min(1).max(160);
9
+ const extensionIdSchema = z.string().regex(/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)+$/).max(160);
10
+ const jsonObjectSchema = z.record(z.string(), z.unknown());
11
+ const BoardAssetRefSchema = z.object({
12
+ type: z.enum(["space-file", "extension"]),
13
+ ref: z.string().min(1).max(4096),
14
+ digest: z.string().min(16).max(160).optional()
15
+ }).strict();
16
+ const BoardEffectSchema = z.object({
17
+ id: idSchema,
18
+ boardId: z.string().uuid(),
19
+ target: z.discriminatedUnion("type", [z.object({
20
+ type: z.literal("item"),
21
+ itemId: idSchema
22
+ }).strict(), z.object({ type: z.literal("board") }).strict()]),
23
+ kind: extensionIdSchema,
24
+ kindVersion: z.number().int().positive(),
25
+ enabled: z.boolean().default(true),
26
+ lifecycle: z.enum([
27
+ "persistent",
28
+ "when-visible",
29
+ "manual"
30
+ ]),
31
+ timeOrigin: z.enum([
32
+ "board",
33
+ "visible",
34
+ "activation"
35
+ ]),
36
+ layer: z.enum([
37
+ "behind",
38
+ "front",
39
+ "screen"
40
+ ]).default("front"),
41
+ seed: z.string().min(1).max(160),
42
+ params: jsonObjectSchema.default({}),
43
+ assetRefs: z.array(BoardAssetRefSchema).default([]),
44
+ metadata: jsonObjectSchema.default({}),
45
+ revision: z.number().int().nonnegative()
46
+ }).strict();
47
+ /** The client-authored effect form: no server-owned `boardId`/`revision`. */
48
+ const BoardEffectInputSchema = BoardEffectSchema.omit({
49
+ boardId: true,
50
+ revision: true
51
+ });
52
+ //#endregion
53
+ export { BoardAssetRefSchema, BoardEffectInputSchema, BoardEffectSchema };