@neta-art/cohub 5.4.3 → 5.5.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.
@@ -1,5 +1,5 @@
1
1
  import { BOARD_DOCUMENT_KIND, InvalidBoardFileError, isBoardPath, parseBoardManifest, serializeBoardManifest } from "../protocol/dist/board.js";
2
- import { BoardAppearanceSchema, BoardFileSnapshotSchema, UNKNOWN_BOARD_ITEM_TYPE, parseBoardDocument } from "../protocol/dist/board-document.js";
2
+ import { BoardAppearanceSchema, BoardFileSnapshotSchema, BoardTaskSnapshotSchema, UNKNOWN_BOARD_ITEM_TYPE, parseBoardDocument } from "../protocol/dist/board-document.js";
3
3
  import { TEXT_FONT_SIZE, clampBoardTextFontSize } from "./core/text-metrics.js";
4
4
  import "../protocol/dist/index.js";
5
5
  //#region src/board/codec.ts
@@ -83,6 +83,24 @@ function pointFromData(value) {
83
83
  y: 0
84
84
  };
85
85
  }
86
+ function unknownItemFromNode(node, frame, style, locked, data) {
87
+ const raw = {
88
+ ...data,
89
+ id: node.nodeId,
90
+ type: node.type,
91
+ frame
92
+ };
93
+ if (style) raw.style = style;
94
+ if (locked) raw.locked = true;
95
+ return {
96
+ id: node.nodeId,
97
+ type: UNKNOWN_BOARD_ITEM_TYPE,
98
+ frame,
99
+ ...locked ? { locked } : {},
100
+ style,
101
+ raw
102
+ };
103
+ }
86
104
  function boardNodeToItemValue(node) {
87
105
  const frame = frameFromNode(node);
88
106
  const style = styleFromNode(node);
@@ -191,24 +209,20 @@ function boardNodeToItemValue(node) {
191
209
  style
192
210
  };
193
211
  }
194
- default: {
195
- const raw = {
196
- ...data,
212
+ case "task": {
213
+ const parsed = BoardTaskSnapshotSchema.safeParse(node.view ?? {});
214
+ if (parsed.success && typeof data.taskRunId === "string") return {
197
215
  id: node.nodeId,
198
- type: node.type,
199
- frame
200
- };
201
- if (style) raw.style = style;
202
- if (locked) raw.locked = true;
203
- return {
204
- id: node.nodeId,
205
- type: UNKNOWN_BOARD_ITEM_TYPE,
216
+ type: "task",
217
+ taskRunId: data.taskRunId,
218
+ snapshot: parsed.data,
206
219
  frame,
207
220
  ...locked ? { locked } : {},
208
- style,
209
- raw
221
+ style
210
222
  };
223
+ return unknownItemFromNode(node, frame, style, locked, data);
211
224
  }
225
+ default: return unknownItemFromNode(node, frame, style, locked, data);
212
226
  }
213
227
  }
214
228
  function boardNodeToItem(node) {
@@ -16,6 +16,13 @@ function imageAssetKey(item) {
16
16
  if (snapshot?.coverUrl) return `url:${snapshot.coverUrl}`;
17
17
  return null;
18
18
  }
19
+ if (item.type === "task") {
20
+ const output = item.snapshot.primaryOutput;
21
+ if (output?.type === "image" || output?.type === "video") {
22
+ const url = output.url;
23
+ return url ? `url:${url}` : null;
24
+ }
25
+ }
19
26
  return null;
20
27
  }
21
28
  /** The source a key resolves from, recovered from its namespace prefix. */
@@ -2,7 +2,7 @@ import { BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, clampBoardStrokeSize } fr
2
2
  import { 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 } from "../protocol/dist/board-connection.js";
3
3
  import { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BoardManifest, BoardNodeRecord, BoardRecord, InvalidBoardFileError, isBoardPath, parseBoardManifest, serializeBoardManifest } from "../protocol/dist/board.js";
4
4
  import { BoardExtensionDefinition, BoardExtensionRegistry, BoardPresetDefinition, CompiledSequence, DEFAULT_BOARD_LIMITS, QualityProfile, RenderBounds, TimelineClipInput, TimelineInput, clip, compileSequence, createBoardExtensionRegistry, timeline } from "./animation.js";
5
- import { BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, BoardMediaSnapshot, BoardMediaSnapshotSchema, BoardPoint, BoardPointSchema, BoardTextItem, BoardTextItemSchema, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, DrawPoint, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, SpaceFileRef, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections } from "../protocol/dist/board-document.js";
5
+ import { BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, BoardMediaSnapshot, BoardMediaSnapshotSchema, BoardPoint, BoardPointSchema, BoardTaskItem, BoardTaskItemSchema, BoardTaskOutput, BoardTaskOutputSchema, BoardTaskSnapshot, BoardTaskSnapshotSchema, BoardTextItem, BoardTextItemSchema, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, DrawPoint, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, SpaceFileRef, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections } from "../protocol/dist/board-document.js";
6
6
  import { BOARD_NODE_SOURCE, DEFAULT_BOARD_APPEARANCE, ITEM_BASE_KEYS, WireBackedBoardItem, boardBootstrapToDocument, boardNodeToItem, isRecord, nodeInputFromRecord, sourceForItem } from "./codec.js";
7
7
  import { CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, CornerResizeHandle, EDGE_RESIZE_HANDLES, FIT_PADDING, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, Point, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, Rect, ResizeHandle, ScreenPoint, Size, VIEWPORT_MARGIN_RATIO, WorldPoint, angleFromCenter, clamp, clampZoom, degToRad, expandRect, fitToContent, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, handlePosition, itemBounds, normalizeRotation, normalizeViewport, panBy, pointToWorld, radToDeg, rectCenter, rectContainsPoint, rectsIntersect, resizeFrame, resizeFrameToSize, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, scaleFrames, screenPoint, screenToWorld, selectionBounds, unionRects, visibleWorldRect, worldPoint, worldToScreen, zoomAround } from "./geometry.js";
8
8
  import { ResolvedArrow, arrowBounds, arrowFrame, distanceToArrow, resolveArrow, sampleArrow, translateArrow } from "./core/arrow-geometry.js";
@@ -17,4 +17,4 @@ import { ShapeDefinition, definitionForItem, getShapeDefinition, registerShapeDe
17
17
  import { TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, boardTextLineHeight, clampBoardTextFontSize, measureBoardText, setBoardTextMeasurer } from "./core/text-metrics.js";
18
18
  import { BoardStyledToolId, BoardToolStyleMap, BoardToolStylePatch, DEFAULT_BOARD_TOOL_STYLES, createBoardToolStyles } from "./core/tool-styles.js";
19
19
  import { boardImageKeySource, imageAssetKey } from "./image-key.js";
20
- export { AUTO_BOARD_CONNECTION_ANCHOR, type ArrowShapeProps, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_NODE_SOURCE, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardColorEntry, BoardColorId, BoardColorValue, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardExportAssetSelection, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, BoardExtensionDefinition, BoardExtensionRegistry, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, BoardFileSnapshotFacts, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, type BoardManifest, BoardMediaSnapshot, BoardMediaSnapshotSchema, type BoardNodeRecord, BoardPoint, BoardPointSchema, BoardPresetDefinition, type BoardRecord, BoardRelationSchema, BoardShapeColors, BoardStyledToolId, BoardTextItem, BoardTextItemSchema, BoardToolStyleMap, BoardToolStylePatch, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, BuildSnapshotInput, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, CompiledSequence, ConnectionIndex, CornerResizeHandle, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPoint, DrawPointSchema, type DrawShapeProps, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, FileAvailability, FilePreviewKind, FrameLookup, GEO_KINDS, type GeoKind, type GeoShapeProps, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, type HandleDragResult, ITEM_BASE_KEYS, type ImageShapeProps, InvalidBoardFileError, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, Point, QualityProfile, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, Rect, RenderBounds, ResizeHandle, ResolvedArrow, ResolvedConnection, ResolvedConnectionEndpoint, ResolvedCover, ScreenPoint, type ShapeCapabilities, ShapeDefinition, type ShapeGeometry, type ShapeHandle, type ShapeHandleId, type ShapeResizeMode, Size, SpaceFileRef, SpaceFileRefSchema, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, type TextShapeProps, TimelineClipInput, TimelineInput, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, type VideoShapeProps, WireBackedBoardItem, WorldPoint, anchorPointOnFrame, anchorToWorld, angleFromCenter, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardBootstrapToDocument, boardColorCssVar, boardFrameLookup, boardImageKeySource, boardNodeToItem, boardTextLineHeight, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, clip, compileSequence, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, createBoardExtensionRegistry, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, fileBaseName, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getShapeDefinition, handlePosition, imageAssetKey, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isRecord, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, nodeInputFromRecord, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeRotation, normalizeViewport, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, pathMidpoint, pickBoardColor, planBoardExport, pointToWorld, radToDeg, readCoverFromFrontmatter, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectsIntersect, registerShapeDefinition, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleRadius, scaleFrames, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, sourceForItem, splitFrontmatter, timeline, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldPoint, worldToAnchor, worldToScreen, zoomAround };
20
+ export { AUTO_BOARD_CONNECTION_ANCHOR, type ArrowShapeProps, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_NODE_SOURCE, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardColorEntry, BoardColorId, BoardColorValue, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardExportAssetSelection, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, BoardExtensionDefinition, BoardExtensionRegistry, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, BoardFileSnapshotFacts, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, type BoardManifest, BoardMediaSnapshot, BoardMediaSnapshotSchema, type BoardNodeRecord, BoardPoint, BoardPointSchema, BoardPresetDefinition, type BoardRecord, BoardRelationSchema, BoardShapeColors, BoardStyledToolId, BoardTaskItem, BoardTaskItemSchema, BoardTaskOutput, BoardTaskOutputSchema, BoardTaskSnapshot, BoardTaskSnapshotSchema, BoardTextItem, BoardTextItemSchema, BoardToolStyleMap, BoardToolStylePatch, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, BuildSnapshotInput, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, CompiledSequence, ConnectionIndex, CornerResizeHandle, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPoint, DrawPointSchema, type DrawShapeProps, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, FileAvailability, FilePreviewKind, FrameLookup, GEO_KINDS, type GeoKind, type GeoShapeProps, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, type HandleDragResult, ITEM_BASE_KEYS, type ImageShapeProps, InvalidBoardFileError, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, Point, QualityProfile, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, Rect, RenderBounds, ResizeHandle, ResolvedArrow, ResolvedConnection, ResolvedConnectionEndpoint, ResolvedCover, ScreenPoint, type ShapeCapabilities, ShapeDefinition, type ShapeGeometry, type ShapeHandle, type ShapeHandleId, type ShapeResizeMode, Size, SpaceFileRef, SpaceFileRefSchema, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, type TextShapeProps, TimelineClipInput, TimelineInput, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, type VideoShapeProps, WireBackedBoardItem, WorldPoint, anchorPointOnFrame, anchorToWorld, angleFromCenter, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardBootstrapToDocument, boardColorCssVar, boardFrameLookup, boardImageKeySource, boardNodeToItem, boardTextLineHeight, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, clip, compileSequence, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, createBoardExtensionRegistry, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, fileBaseName, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getShapeDefinition, handlePosition, imageAssetKey, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isRecord, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, nodeInputFromRecord, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeRotation, normalizeViewport, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, pathMidpoint, pickBoardColor, planBoardExport, pointToWorld, radToDeg, readCoverFromFrontmatter, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectsIntersect, registerShapeDefinition, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleRadius, scaleFrames, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, sourceForItem, splitFrontmatter, timeline, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldPoint, worldToAnchor, worldToScreen, zoomAround };
@@ -2,7 +2,7 @@ import { BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, clampBoardStrokeSize } fr
2
2
  import { BoardExtensionRegistry, DEFAULT_BOARD_LIMITS, clip, compileSequence, createBoardExtensionRegistry, timeline } from "./animation.js";
3
3
  import { 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 } from "../protocol/dist/board-connection.js";
4
4
  import { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, InvalidBoardFileError, isBoardPath, parseBoardManifest, serializeBoardManifest } from "../protocol/dist/board.js";
5
- import { BoardAppearanceSchema, BoardArrowItemSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections } from "../protocol/dist/board-document.js";
5
+ import { BoardAppearanceSchema, BoardArrowItemSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardTaskItemSchema, BoardTaskOutputSchema, BoardTaskSnapshotSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections } from "../protocol/dist/board-document.js";
6
6
  import { TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, boardTextLineHeight, clampBoardTextFontSize, measureBoardText, setBoardTextMeasurer } from "./core/text-metrics.js";
7
7
  import { BOARD_NODE_SOURCE, DEFAULT_BOARD_APPEARANCE, ITEM_BASE_KEYS, boardBootstrapToDocument, boardNodeToItem, isRecord, nodeInputFromRecord, sourceForItem } from "./codec.js";
8
8
  import { CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, EDGE_RESIZE_HANDLES, FIT_PADDING, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, VIEWPORT_MARGIN_RATIO, angleFromCenter, clamp, clampZoom, degToRad, expandRect, fitToContent, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, handlePosition, itemBounds, normalizeRotation, normalizeViewport, panBy, pointToWorld, radToDeg, rectCenter, rectContainsPoint, rectsIntersect, resizeFrame, resizeFrameToSize, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, scaleFrames, screenPoint, screenToWorld, selectionBounds, unionRects, visibleWorldRect, worldPoint, worldToScreen, zoomAround } from "./geometry.js";
@@ -17,4 +17,4 @@ import { BOARD_COLORS, DEFAULT_BOARD_COLOR, boardColorCssVar, buildFallbackShape
17
17
  import { FULL_CAPABILITIES, GEO_KINDS, isGeoKind, resizeModeForCapabilities } from "./core/shape-types.js";
18
18
  import { definitionForItem, getShapeDefinition, registerShapeDefinition, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, unknownShapeDefinition } from "./core/shape-definition.js";
19
19
  import { DEFAULT_BOARD_TOOL_STYLES, createBoardToolStyles } from "./core/tool-styles.js";
20
- export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_NODE_SOURCE, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BoardAppearanceSchema, BoardArrowItemSchema, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardExtensionRegistry, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardRelationSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPointSchema, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, GEO_KINDS, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, ITEM_BASE_KEYS, InvalidBoardFileError, KNOWN_BOARD_ITEM_TYPES, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, SpaceFileRefSchema, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, anchorPointOnFrame, anchorToWorld, angleFromCenter, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardBootstrapToDocument, boardColorCssVar, boardFrameLookup, boardImageKeySource, boardNodeToItem, boardTextLineHeight, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, clip, compileSequence, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, createBoardExtensionRegistry, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, fileBaseName, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getShapeDefinition, handlePosition, imageAssetKey, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isRecord, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, nodeInputFromRecord, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeRotation, normalizeViewport, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, pathMidpoint, pickBoardColor, planBoardExport, pointToWorld, radToDeg, readCoverFromFrontmatter, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectsIntersect, registerShapeDefinition, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleRadius, scaleFrames, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, sourceForItem, splitFrontmatter, timeline, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldPoint, worldToAnchor, worldToScreen, zoomAround };
20
+ export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_NODE_SOURCE, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BoardAppearanceSchema, BoardArrowItemSchema, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardExtensionRegistry, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardRelationSchema, BoardTaskItemSchema, BoardTaskOutputSchema, BoardTaskSnapshotSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPointSchema, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, GEO_KINDS, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, ITEM_BASE_KEYS, InvalidBoardFileError, KNOWN_BOARD_ITEM_TYPES, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, SpaceFileRefSchema, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, anchorPointOnFrame, anchorToWorld, angleFromCenter, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardBootstrapToDocument, boardColorCssVar, boardFrameLookup, boardImageKeySource, boardNodeToItem, boardTextLineHeight, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, clip, compileSequence, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, createBoardExtensionRegistry, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, fileBaseName, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getShapeDefinition, handlePosition, imageAssetKey, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isRecord, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, nodeInputFromRecord, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeRotation, normalizeViewport, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, pathMidpoint, pickBoardColor, planBoardExport, pointToWorld, radToDeg, readCoverFromFrontmatter, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectsIntersect, registerShapeDefinition, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleRadius, scaleFrames, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, sourceForItem, splitFrontmatter, timeline, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldPoint, worldToAnchor, worldToScreen, zoomAround };
@@ -5,6 +5,7 @@ import { fileCardRenderer } from "./file-card-renderer.js";
5
5
  import { frameCardRenderer } from "./frame-card-renderer.js";
6
6
  import { geoCardRenderer } from "./geo-card-renderer.js";
7
7
  import { imageCardRenderer } from "./image-card-renderer.js";
8
+ import { taskCardRenderer } from "./task-card-renderer.js";
8
9
  import { textCardRenderer } from "./text-card-renderer.js";
9
10
  import { unknownCardRenderer } from "./unknown-card-renderer.js";
10
11
  import { videoCardRenderer } from "./video-card-renderer.js";
@@ -14,6 +15,7 @@ const boardCardRenderers = [
14
15
  imageCardRenderer,
15
16
  videoCardRenderer,
16
17
  fileCardRenderer,
18
+ taskCardRenderer,
17
19
  geoCardRenderer,
18
20
  drawCardRenderer,
19
21
  arrowCardRenderer,
@@ -0,0 +1,12 @@
1
+ import { BoardCardRenderer } from "./board-renderer-registry.js";
2
+ //#region src/board/render/renderers/task-card-renderer.d.ts
3
+ /** Scale a texture into a frame without cropping or distortion. */
4
+ declare function containTaskPreviewRect(width: number, height: number, imageWidth: number, imageHeight: number): {
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ };
10
+ declare const taskCardRenderer: BoardCardRenderer;
11
+ //#endregion
12
+ export { containTaskPreviewRect, taskCardRenderer };
@@ -0,0 +1,389 @@
1
+ import { BOARD_FONT_STACK, BOARD_MONO_FONT_STACK } from "../../../protocol/dist/board-constants.js";
2
+ import { syncTextResolution, textResolutionForZoom } from "../text-resolution.js";
3
+ import { drawFarPlate } from "./far-plate.js";
4
+ import { positionShell } from "./base-card-renderer.js";
5
+ import { fitTextToLines } from "./file-card-renderer.js";
6
+ import { Container, Graphics, Sprite, Text } from "pixi.js";
7
+ //#region src/board/render/renderers/task-card-renderer.ts
8
+ const RADIUS = 4;
9
+ const PADDING = 12;
10
+ const META_HEIGHT = 28;
11
+ const FULL_DETAIL_ZOOM = .55;
12
+ const WAVEFORM_BARS = 44;
13
+ const WAVEFORM_GAP = 2;
14
+ const PLAY_BADGE_RADIUS = 15;
15
+ const partsByContainer = /* @__PURE__ */ new WeakMap();
16
+ function previewKindFor(item) {
17
+ const output = item.snapshot.primaryOutput;
18
+ if (!output) return "empty";
19
+ if (output.type === "image" || output.type === "video") return "texture";
20
+ if (output.type === "audio") return "waveform";
21
+ return output.textExcerpt ? "text" : "empty";
22
+ }
23
+ function stateSurfaceFor(item, kind, hasTexture, previewFailed) {
24
+ if (kind === "texture" && !hasTexture) {
25
+ if (item.snapshot.status === "failed") return "failed";
26
+ return previewFailed ? "unavailable" : "media-loading";
27
+ }
28
+ if (kind !== "empty") return null;
29
+ if (item.snapshot.status === "failed") return "failed";
30
+ if (item.snapshot.status === "running") return "generating";
31
+ if (item.snapshot.status === "pending") return "queued";
32
+ return "empty";
33
+ }
34
+ function stateLabel(surface) {
35
+ switch (surface) {
36
+ case "generating": return "Generating";
37
+ case "queued": return "Queued";
38
+ case "failed": return "Failed";
39
+ case "unavailable": return "Preview unavailable";
40
+ case "empty": return "No preview";
41
+ default: return "";
42
+ }
43
+ }
44
+ function statusColor(item, context) {
45
+ if (item.snapshot.status === "failed") return context.colors.rose.stroke;
46
+ if (item.snapshot.status === "running") return context.colors.brand.stroke;
47
+ return context.colors.neutral.stroke;
48
+ }
49
+ function metadata(item) {
50
+ const extra = item.snapshot.outputCount > 1 ? `+${item.snapshot.outputCount - 1}` : null;
51
+ return [item.snapshot.model, extra].filter(Boolean).join(" · ");
52
+ }
53
+ /** Scale a texture into a frame without cropping or distortion. */
54
+ function containTaskPreviewRect(width, height, imageWidth, imageHeight) {
55
+ if (width <= 0 || height <= 0 || imageWidth <= 0 || imageHeight <= 0) return {
56
+ x: 0,
57
+ y: 0,
58
+ width: 0,
59
+ height: 0
60
+ };
61
+ const scale = Math.min(width / imageWidth, height / imageHeight);
62
+ const renderedWidth = imageWidth * scale;
63
+ const renderedHeight = imageHeight * scale;
64
+ return {
65
+ x: (width - renderedWidth) / 2,
66
+ y: (height - renderedHeight) / 2,
67
+ width: renderedWidth,
68
+ height: renderedHeight
69
+ };
70
+ }
71
+ function waveformBars(seed, count) {
72
+ let hash = 2166136261;
73
+ for (let index = 0; index < seed.length; index += 1) {
74
+ hash ^= seed.charCodeAt(index);
75
+ hash = Math.imul(hash, 16777619) >>> 0;
76
+ }
77
+ const bars = [];
78
+ for (let index = 0; index < count; index += 1) {
79
+ hash ^= hash << 13;
80
+ hash ^= hash >>> 17;
81
+ hash ^= hash << 5;
82
+ hash >>>= 0;
83
+ const unit = hash % 1e3 / 1e3;
84
+ const envelope = Math.sin(Math.PI * (index + .5) / count);
85
+ bars.push(.18 + unit * .82 * (.45 + envelope * .55));
86
+ }
87
+ return bars;
88
+ }
89
+ function drawWaveform(graphics, seed, rect, color) {
90
+ const count = Math.max(8, Math.min(WAVEFORM_BARS, Math.floor(rect.width / 4)));
91
+ const step = rect.width / count;
92
+ const barWidth = Math.max(1.5, step - WAVEFORM_GAP);
93
+ const centerY = rect.y + rect.height / 2;
94
+ const maxHeight = Math.max(2, rect.height * .68);
95
+ const bars = waveformBars(seed, count);
96
+ for (let index = 0; index < count; index += 1) {
97
+ const amplitude = (bars[index] ?? .4) * maxHeight;
98
+ graphics.roundRect(rect.x + index * step + (step - barWidth) / 2, centerY - amplitude / 2, barWidth, amplitude, barWidth / 2);
99
+ }
100
+ graphics.fill({
101
+ color,
102
+ alpha: .68
103
+ });
104
+ }
105
+ function drawPlayBadge(graphics, rect, context) {
106
+ const radius = Math.min(PLAY_BADGE_RADIUS, Math.max(8, Math.min(rect.width, rect.height) * .16));
107
+ const cx = rect.x + rect.width / 2;
108
+ const cy = rect.y + rect.height / 2;
109
+ graphics.circle(cx, cy, radius).fill({
110
+ color: context.palette.bg,
111
+ alpha: .64
112
+ });
113
+ const size = radius * .72;
114
+ graphics.moveTo(cx - size * .34, cy - size * .56).lineTo(cx + size * .62, cy).lineTo(cx - size * .34, cy + size * .56).closePath().fill({
115
+ color: context.palette.text,
116
+ alpha: .94
117
+ });
118
+ }
119
+ /** Static state marks avoid implying measurable progress or keeping Pixi awake. */
120
+ function drawStateMark(graphics, surface, cx, cy, color) {
121
+ if (surface === "generating" || surface === "media-loading") {
122
+ graphics.circle(cx, cy, 4).fill({
123
+ color,
124
+ alpha: .9
125
+ });
126
+ graphics.circle(cx - 12, cy + 7, 2.5).fill({
127
+ color,
128
+ alpha: .48
129
+ });
130
+ graphics.circle(cx + 11, cy + 6, 3).fill({
131
+ color,
132
+ alpha: .68
133
+ });
134
+ graphics.circle(cx + 3, cy - 12, 2).fill({
135
+ color,
136
+ alpha: .36
137
+ });
138
+ return;
139
+ }
140
+ if (surface === "queued") {
141
+ graphics.circle(cx, cy, 10).stroke({
142
+ color,
143
+ width: 1.5,
144
+ alpha: .62
145
+ }).circle(cx, cy, 3).fill({
146
+ color,
147
+ alpha: .78
148
+ });
149
+ return;
150
+ }
151
+ if (surface === "failed") {
152
+ graphics.circle(cx, cy, 11).stroke({
153
+ color,
154
+ width: 1.5,
155
+ alpha: .86
156
+ });
157
+ graphics.moveTo(cx - 4, cy - 4).lineTo(cx + 4, cy + 4).moveTo(cx + 4, cy - 4).lineTo(cx - 4, cy + 4).stroke({
158
+ color,
159
+ width: 1.5,
160
+ alpha: .94,
161
+ cap: "round"
162
+ });
163
+ return;
164
+ }
165
+ if (surface === "unavailable") graphics.roundRect(cx - 12, cy - 9, 24, 18, 3).stroke({
166
+ color,
167
+ width: 1.25,
168
+ alpha: .62
169
+ }).moveTo(cx - 8, cy + 5).lineTo(cx + 8, cy - 5).stroke({
170
+ color,
171
+ width: 1.25,
172
+ alpha: .72,
173
+ cap: "round"
174
+ });
175
+ }
176
+ function drawFailedBadge(graphics, width, color, context) {
177
+ const cx = Math.max(12, width - 12);
178
+ const cy = 12;
179
+ graphics.circle(cx, cy, 8).fill({
180
+ color: context.palette.bg,
181
+ alpha: .72
182
+ });
183
+ graphics.moveTo(cx - 2.5, cy - 2.5).lineTo(cx + 2.5, 14.5).moveTo(cx + 2.5, cy - 2.5).lineTo(cx - 2.5, 14.5).stroke({
184
+ color,
185
+ width: 1.5,
186
+ alpha: .96,
187
+ cap: "round"
188
+ });
189
+ }
190
+ function sync(container, item, context) {
191
+ const parts = partsByContainer.get(container);
192
+ if (!parts) return;
193
+ positionShell(parts.root, item);
194
+ const { width, height } = item.frame;
195
+ const selected = context.selectedIds.has(item.id);
196
+ const hovered = context.hoveredId === item.id;
197
+ const full = context.zoom >= FULL_DETAIL_ZOOM;
198
+ const color = statusColor(item, context);
199
+ const key = context.assetKey(item);
200
+ if (key !== parts.assetKey) {
201
+ if (parts.assetKey) context.releaseTexture(parts.assetKey);
202
+ parts.assetKey = key;
203
+ if (key) context.acquireTexture(key);
204
+ }
205
+ const texture = key ? context.getTexture(key) : null;
206
+ const previewFailed = Boolean(key && !texture && context.hasError(key));
207
+ const kind = previewKindFor(item);
208
+ const surface = stateSurfaceFor(item, kind, Boolean(texture), previewFailed);
209
+ const frame = {
210
+ x: 1,
211
+ y: 1,
212
+ width: Math.max(1, width - 2),
213
+ height: Math.max(1, height - 2)
214
+ };
215
+ const metaText = item.snapshot.primaryOutput ? metadata(item) : "";
216
+ const showMeta = full && Boolean(metaText);
217
+ const failedWithOutput = item.snapshot.status === "failed" && kind !== "empty";
218
+ syncTextResolution(parts.body, parts, context.zoom);
219
+ syncTextResolution(parts.meta, parts, context.zoom);
220
+ const visualSig = [
221
+ width,
222
+ height,
223
+ selected,
224
+ hovered,
225
+ full,
226
+ color,
227
+ kind,
228
+ surface,
229
+ showMeta,
230
+ failedWithOutput,
231
+ item.snapshot.primaryOutput?.type ?? "none",
232
+ item.taskRunId,
233
+ texture ? `${texture.width}x${texture.height}` : "none",
234
+ context.palette.surface,
235
+ context.palette.hover,
236
+ context.palette.border,
237
+ context.palette.bg
238
+ ].join("|");
239
+ if (visualSig !== parts.visualSig) {
240
+ parts.visualSig = visualSig;
241
+ parts.plate.clear().roundRect(0, 0, width, height, RADIUS).fill({
242
+ color: context.palette.surface,
243
+ alpha: .98
244
+ }).roundRect(0, 0, width, height, RADIUS).stroke({
245
+ color: selected ? context.palette.brand : hovered ? context.palette.muted : context.palette.border,
246
+ width: selected ? 2 : 1,
247
+ alpha: selected ? .96 : .82
248
+ });
249
+ parts.clip.clear().roundRect(1, 1, frame.width, frame.height, RADIUS - 1).fill({ color: 16777215 });
250
+ parts.previewBg.clear().rect(frame.x, frame.y, frame.width, frame.height).fill({
251
+ color: context.palette.hover,
252
+ alpha: .5
253
+ });
254
+ parts.previewMask.clear().rect(frame.x, frame.y, frame.width, frame.height).fill({ color: 16777215 });
255
+ parts.previewArt.clear();
256
+ if (kind === "waveform") {
257
+ const bottomInset = showMeta ? META_HEIGHT : 0;
258
+ drawWaveform(parts.previewArt, item.taskRunId, {
259
+ x: frame.x + PADDING,
260
+ y: frame.y + PADDING,
261
+ width: Math.max(1, frame.width - PADDING * 2),
262
+ height: Math.max(1, frame.height - PADDING * 2 - bottomInset)
263
+ }, context.colors.brand.stroke);
264
+ }
265
+ if (kind === "texture" && texture && item.snapshot.primaryOutput?.type === "video" && full) drawPlayBadge(parts.previewArt, frame, context);
266
+ if (surface) {
267
+ const markY = frame.y + frame.height / 2 - (full && stateLabel(surface) ? 10 : 0);
268
+ drawStateMark(parts.previewArt, surface, frame.x + frame.width / 2, markY, surface === "failed" ? color : context.colors.neutral.stroke);
269
+ }
270
+ if (showMeta) parts.previewArt.rect(frame.x, frame.y + frame.height - META_HEIGHT, frame.width, META_HEIGHT).fill({
271
+ color: context.palette.bg,
272
+ alpha: .68
273
+ });
274
+ if (failedWithOutput) drawFailedBadge(parts.previewArt, width, color, context);
275
+ }
276
+ parts.preview.visible = kind === "texture" && Boolean(texture);
277
+ if (parts.preview.visible && texture) {
278
+ if (parts.preview.texture !== texture) parts.preview.texture = texture;
279
+ const fitted = containTaskPreviewRect(frame.width, frame.height, texture.width, texture.height);
280
+ parts.preview.position.set(frame.x + fitted.x, frame.y + fitted.y);
281
+ parts.preview.width = fitted.width;
282
+ parts.preview.height = fitted.height;
283
+ }
284
+ const bodyText = kind === "text" ? item.snapshot.primaryOutput?.textExcerpt ?? "" : stateLabel(surface);
285
+ const textSig = [
286
+ bodyText,
287
+ metaText,
288
+ kind,
289
+ surface,
290
+ full,
291
+ width,
292
+ height,
293
+ context.palette.text,
294
+ context.palette.muted
295
+ ].join("|");
296
+ if (textSig !== parts.textSig) {
297
+ parts.textSig = textSig;
298
+ parts.body.style.fill = surface === "failed" ? color : context.palette.text;
299
+ fitTextToLines(parts.body, bodyText, kind === "text" ? Math.max(1, Math.floor((height - PADDING * 2 - (showMeta ? META_HEIGHT : 0)) / 16)) : 1, Math.max(24, width - PADDING * 2));
300
+ parts.meta.style.fill = context.palette.text;
301
+ fitTextToLines(parts.meta, metaText, 1, Math.max(24, width - PADDING * 2));
302
+ }
303
+ parts.body.visible = full && Boolean(bodyText);
304
+ parts.meta.visible = showMeta;
305
+ if (kind === "text") parts.body.position.set(PADDING, PADDING);
306
+ else parts.body.position.set(Math.max(PADDING, (width - parts.body.width) / 2), height / 2 + 10);
307
+ parts.meta.position.set(PADDING, height - META_HEIGHT + 7);
308
+ }
309
+ const taskCardRenderer = {
310
+ id: "task-card",
311
+ canRender: (item) => item.type === "task",
312
+ create: (item, context) => {
313
+ const root = new Container();
314
+ const plate = new Graphics();
315
+ const clip = new Graphics();
316
+ const previewBg = new Graphics();
317
+ const preview = new Sprite();
318
+ const previewMask = new Graphics();
319
+ const previewArt = new Graphics();
320
+ const resolution = textResolutionForZoom(context.zoom);
321
+ const body = new Text({
322
+ text: "",
323
+ style: {
324
+ fontFamily: BOARD_FONT_STACK,
325
+ fontSize: 11.5,
326
+ fontWeight: "500",
327
+ wordWrap: true,
328
+ breakWords: true
329
+ },
330
+ resolution,
331
+ roundPixels: true
332
+ });
333
+ const meta = new Text({
334
+ text: "",
335
+ style: {
336
+ fontFamily: BOARD_MONO_FONT_STACK,
337
+ fontSize: 10,
338
+ fontWeight: "500",
339
+ wordWrap: true,
340
+ breakWords: true
341
+ },
342
+ resolution,
343
+ roundPixels: true
344
+ });
345
+ preview.mask = previewMask;
346
+ root.mask = clip;
347
+ root.addChild(plate, clip, previewBg, preview, previewMask, previewArt, body, meta);
348
+ partsByContainer.set(root, {
349
+ root,
350
+ plate,
351
+ clip,
352
+ previewBg,
353
+ preview,
354
+ previewMask,
355
+ previewArt,
356
+ body,
357
+ meta,
358
+ assetKey: null,
359
+ visualSig: "",
360
+ textSig: "",
361
+ resolution
362
+ });
363
+ if (item.type === "task") sync(root, item, context);
364
+ return root;
365
+ },
366
+ update: (container, item, context) => {
367
+ if (item.type === "task") sync(container, item, context);
368
+ },
369
+ renderFar: (graphics, item, context) => {
370
+ if (item.type !== "task") return;
371
+ const active = item.snapshot.status === "failed" || item.snapshot.status === "running" || item.snapshot.status === "pending";
372
+ drawFarPlate(graphics, item.frame, {
373
+ fill: context.palette.surface,
374
+ fillAlpha: .82,
375
+ ...active ? {
376
+ accent: statusColor(item, context),
377
+ accentAlpha: .9
378
+ } : {}
379
+ });
380
+ },
381
+ destroy: (container, context) => {
382
+ const parts = partsByContainer.get(container);
383
+ if (parts?.assetKey) context.releaseTexture(parts.assetKey);
384
+ parts?.root.destroy({ children: true });
385
+ partsByContainer.delete(container);
386
+ }
387
+ };
388
+ //#endregion
389
+ export { containTaskPreviewRect, taskCardRenderer };
@@ -2289,7 +2289,7 @@ type UiCommandDispatchedEvent = {
2289
2289
  };
2290
2290
  type RealtimeServerEvent = SystemReadyEvent | SystemAuthOkEvent | SystemRequestErrorEvent | SystemPongEvent | SystemAckOkEvent | SystemSubscribeOkEvent | SystemSubscribeErrorEvent | SessionCreatedEvent | SessionUpdatedEvent | SessionRequestAcceptedEvent | SessionRequestErrorEvent | SessionTurnCreatedEvent | SessionTurnPatchEvent | SessionTurnErrorEvent | SessionTurnLifecycleEvent | SessionTurnUpdatedEvent | SessionTurnFinalizedEvent | SessionTurnNotifyEvent | SessionMessagePersistedEvent | SpaceFsChangedEvent | SpacePortsChangedEvent | SpacePresenceUpdatedEvent | BoardTransactionAppliedEvent | BoardAwarenessUpdatedEvent | BoardPlaybackChangedEvent | WorkVersionPublishedEvent | TaskCreatedEvent | TaskUpdatedEvent | LabelAssignmentsUpdatedEvent | UiCommandDispatchedEvent | RealtimeRoomEvent | RealtimeRoomJoinedEvent | RealtimeRoomMemberChangedEvent | RealtimeRoomPresenceUpdatedEvent | RealtimeRoomRequestEvent | RealtimeRoomRequestErrorEvent | RealtimeRoomClosedEvent;
2291
2291
  //#endregion
2292
- //#region ../../node_modules/.pnpm/@neta-art+generation@0.1.20/node_modules/@neta-art/generation/dist/builtins-8R5iZQ10.d.ts
2292
+ //#region ../../node_modules/.pnpm/@neta-art+generation@0.1.21/node_modules/@neta-art/generation/dist/builtins-8R5iZQ10.d.ts
2293
2293
  //#region src/types.d.ts
2294
2294
  declare const MODEL_SCHEMA: "neta.generation.model.v1";
2295
2295
  type GenerationSource = {
@@ -440,13 +440,116 @@ declare const BoardFileItemSchema: z.ZodObject<{
440
440
  coverUrl: z.ZodOptional<z.ZodString>;
441
441
  }, z.core.$strip>>;
442
442
  }, z.core.$strip>;
443
+ declare const BoardTaskOutputSchema: z.ZodObject<{
444
+ type: z.ZodEnum<{
445
+ audio: "audio";
446
+ image: "image";
447
+ text: "text";
448
+ video: "video";
449
+ }>;
450
+ url: z.ZodOptional<z.ZodString>;
451
+ textExcerpt: z.ZodOptional<z.ZodString>;
452
+ mimeType: z.ZodOptional<z.ZodString>;
453
+ naturalWidth: z.ZodOptional<z.ZodNumber>;
454
+ naturalHeight: z.ZodOptional<z.ZodNumber>;
455
+ }, z.core.$strip>;
456
+ /**
457
+ * Cached task facts used for an immediate first paint. The task run remains the
458
+ * source of truth and live clients refresh this projection by `taskRunId`.
459
+ */
460
+ declare const BoardTaskSnapshotSchema: z.ZodObject<{
461
+ taskType: z.ZodString;
462
+ status: z.ZodEnum<{
463
+ completed: "completed";
464
+ failed: "failed";
465
+ pending: "pending";
466
+ running: "running";
467
+ }>;
468
+ title: z.ZodString;
469
+ model: z.ZodOptional<z.ZodString>;
470
+ promptExcerpt: z.ZodOptional<z.ZodString>;
471
+ outputCount: z.ZodDefault<z.ZodNumber>;
472
+ primaryOutput: z.ZodOptional<z.ZodObject<{
473
+ type: z.ZodEnum<{
474
+ audio: "audio";
475
+ image: "image";
476
+ text: "text";
477
+ video: "video";
478
+ }>;
479
+ url: z.ZodOptional<z.ZodString>;
480
+ textExcerpt: z.ZodOptional<z.ZodString>;
481
+ mimeType: z.ZodOptional<z.ZodString>;
482
+ naturalWidth: z.ZodOptional<z.ZodNumber>;
483
+ naturalHeight: z.ZodOptional<z.ZodNumber>;
484
+ }, z.core.$strip>>;
485
+ updatedAt: z.ZodOptional<z.ZodString>;
486
+ }, z.core.$strip>;
487
+ /** A stable reference to a task run with a small, replaceable display cache. */
488
+ declare const BoardTaskItemSchema: z.ZodObject<{
489
+ id: z.ZodString;
490
+ frame: z.ZodObject<{
491
+ x: z.ZodNumber;
492
+ y: z.ZodNumber;
493
+ width: z.ZodNumber;
494
+ height: z.ZodNumber;
495
+ rotation: z.ZodDefault<z.ZodNumber>;
496
+ }, z.core.$strip>;
497
+ locked: z.ZodOptional<z.ZodBoolean>;
498
+ style: z.ZodOptional<z.ZodObject<{
499
+ variant: z.ZodDefault<z.ZodString>;
500
+ theme: z.ZodOptional<z.ZodString>;
501
+ accentColor: z.ZodOptional<z.ZodString>;
502
+ size: z.ZodDefault<z.ZodEnum<{
503
+ lg: "lg";
504
+ md: "md";
505
+ sm: "sm";
506
+ }>>;
507
+ emphasis: z.ZodDefault<z.ZodEnum<{
508
+ epic: "epic";
509
+ legendary: "legendary";
510
+ normal: "normal";
511
+ rare: "rare";
512
+ }>>;
513
+ effects: z.ZodDefault<z.ZodArray<z.ZodString>>;
514
+ }, z.core.$strip>>;
515
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
516
+ type: z.ZodLiteral<"task">;
517
+ taskRunId: z.ZodString;
518
+ snapshot: z.ZodObject<{
519
+ taskType: z.ZodString;
520
+ status: z.ZodEnum<{
521
+ completed: "completed";
522
+ failed: "failed";
523
+ pending: "pending";
524
+ running: "running";
525
+ }>;
526
+ title: z.ZodString;
527
+ model: z.ZodOptional<z.ZodString>;
528
+ promptExcerpt: z.ZodOptional<z.ZodString>;
529
+ outputCount: z.ZodDefault<z.ZodNumber>;
530
+ primaryOutput: z.ZodOptional<z.ZodObject<{
531
+ type: z.ZodEnum<{
532
+ audio: "audio";
533
+ image: "image";
534
+ text: "text";
535
+ video: "video";
536
+ }>;
537
+ url: z.ZodOptional<z.ZodString>;
538
+ textExcerpt: z.ZodOptional<z.ZodString>;
539
+ mimeType: z.ZodOptional<z.ZodString>;
540
+ naturalWidth: z.ZodOptional<z.ZodNumber>;
541
+ naturalHeight: z.ZodOptional<z.ZodNumber>;
542
+ }, z.core.$strip>>;
543
+ updatedAt: z.ZodOptional<z.ZodString>;
544
+ }, z.core.$strip>;
545
+ }, z.core.$strip>;
443
546
  /**
444
547
  * The set of shape types this client understands natively. Anything else is
445
548
  * preserved verbatim as an unknown item (see BoardUnknownItem) so documents
446
549
  * authored by newer clients round-trip losslessly — data is never dropped or
447
550
  * silently downgraded just because this client predates a shape type.
448
551
  */
449
- declare const KNOWN_BOARD_ITEM_TYPES: readonly ["image", "video", "file", "text", "geo", "draw", "arrow", "frame"];
552
+ declare const KNOWN_BOARD_ITEM_TYPES: readonly ["image", "video", "file", "task", "text", "geo", "draw", "arrow", "frame"];
450
553
  type KnownBoardItemType = (typeof KNOWN_BOARD_ITEM_TYPES)[number];
451
554
  /**
452
555
  * A forward-compatible carrier for shape types this client does not recognise.
@@ -570,6 +673,44 @@ declare const BoardItemSchema: z.ZodPipe<z.ZodAny, z.ZodTransform<BoardUnknownIt
570
673
  coverPath?: string | undefined;
571
674
  coverUrl?: string | undefined;
572
675
  } | undefined;
676
+ } | {
677
+ id: string;
678
+ frame: {
679
+ x: number;
680
+ y: number;
681
+ width: number;
682
+ height: number;
683
+ rotation: number;
684
+ };
685
+ locked?: boolean | undefined;
686
+ style?: {
687
+ variant: string;
688
+ theme?: string | undefined;
689
+ accentColor?: string | undefined;
690
+ size: "lg" | "md" | "sm";
691
+ emphasis: "epic" | "legendary" | "normal" | "rare";
692
+ effects: string[];
693
+ } | undefined;
694
+ metadata?: Record<string, unknown> | undefined;
695
+ type: "task";
696
+ taskRunId: string;
697
+ snapshot: {
698
+ taskType: string;
699
+ status: "completed" | "failed" | "pending" | "running";
700
+ title: string;
701
+ model?: string | undefined;
702
+ promptExcerpt?: string | undefined;
703
+ outputCount: number;
704
+ primaryOutput?: {
705
+ type: "audio" | "image" | "text" | "video";
706
+ url?: string | undefined;
707
+ textExcerpt?: string | undefined;
708
+ mimeType?: string | undefined;
709
+ naturalWidth?: number | undefined;
710
+ naturalHeight?: number | undefined;
711
+ } | undefined;
712
+ updatedAt?: string | undefined;
713
+ };
573
714
  } | {
574
715
  id: string;
575
716
  frame: {
@@ -845,6 +986,44 @@ declare const BoardDocumentSchema: z.ZodObject<{
845
986
  coverPath?: string | undefined;
846
987
  coverUrl?: string | undefined;
847
988
  } | undefined;
989
+ } | {
990
+ id: string;
991
+ frame: {
992
+ x: number;
993
+ y: number;
994
+ width: number;
995
+ height: number;
996
+ rotation: number;
997
+ };
998
+ locked?: boolean | undefined;
999
+ style?: {
1000
+ variant: string;
1001
+ theme?: string | undefined;
1002
+ accentColor?: string | undefined;
1003
+ size: "lg" | "md" | "sm";
1004
+ emphasis: "epic" | "legendary" | "normal" | "rare";
1005
+ effects: string[];
1006
+ } | undefined;
1007
+ metadata?: Record<string, unknown> | undefined;
1008
+ type: "task";
1009
+ taskRunId: string;
1010
+ snapshot: {
1011
+ taskType: string;
1012
+ status: "completed" | "failed" | "pending" | "running";
1013
+ title: string;
1014
+ model?: string | undefined;
1015
+ promptExcerpt?: string | undefined;
1016
+ outputCount: number;
1017
+ primaryOutput?: {
1018
+ type: "audio" | "image" | "text" | "video";
1019
+ url?: string | undefined;
1020
+ textExcerpt?: string | undefined;
1021
+ mimeType?: string | undefined;
1022
+ naturalWidth?: number | undefined;
1023
+ naturalHeight?: number | undefined;
1024
+ } | undefined;
1025
+ updatedAt?: string | undefined;
1026
+ };
848
1027
  } | {
849
1028
  id: string;
850
1029
  frame: {
@@ -1064,8 +1243,11 @@ type BoardImageItem = z.infer<typeof BoardImageItemSchema>;
1064
1243
  type BoardVideoItem = z.infer<typeof BoardVideoItemSchema>;
1065
1244
  type BoardFileSnapshot = z.infer<typeof BoardFileSnapshotSchema>;
1066
1245
  type BoardFileItem = z.infer<typeof BoardFileItemSchema>;
1246
+ type BoardTaskOutput = z.infer<typeof BoardTaskOutputSchema>;
1247
+ type BoardTaskSnapshot = z.infer<typeof BoardTaskSnapshotSchema>;
1248
+ type BoardTaskItem = z.infer<typeof BoardTaskItemSchema>;
1067
1249
  /** Known (natively handled) item variants. */
1068
- type BoardKnownItem = BoardImageItem | BoardVideoItem | BoardFileItem | BoardTextItem | BoardGeoItem | BoardDrawItem | BoardArrowItem | BoardFrameItem;
1250
+ type BoardKnownItem = BoardImageItem | BoardVideoItem | BoardFileItem | BoardTaskItem | BoardTextItem | BoardGeoItem | BoardDrawItem | BoardArrowItem | BoardFrameItem;
1069
1251
  /** Any item, including forward-compatible unknown types. */
1070
1252
  type BoardItem = BoardKnownItem | BoardUnknownItem;
1071
1253
  type BoardDocument = z.infer<typeof BoardDocumentSchema>;
@@ -1090,4 +1272,4 @@ declare function isMediaItem(item: BoardItem): item is BoardImageItem | BoardVid
1090
1272
  /** Whether an item references a workspace file (image, video or file card). */
1091
1273
  declare function isFileBackedItem(item: BoardItem): item is BoardImageItem | BoardVideoItem | BoardFileItem;
1092
1274
  //#endregion
1093
- export { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, BoardMediaSnapshot, BoardMediaSnapshotSchema, BoardPoint, BoardPointSchema, BoardTextItem, BoardTextItemSchema, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, DrawPoint, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, SpaceFileRef, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections };
1275
+ export { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, BoardMediaSnapshot, BoardMediaSnapshotSchema, BoardPoint, BoardPointSchema, BoardTaskItem, BoardTaskItemSchema, BoardTaskOutput, BoardTaskOutputSchema, BoardTaskSnapshot, BoardTaskSnapshotSchema, BoardTextItem, BoardTextItemSchema, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, DrawPoint, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, SpaceFileRef, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections };
@@ -202,6 +202,46 @@ const BoardFileItemSchema = BoardItemBaseSchema.extend({
202
202
  ref: SpaceFileRefSchema,
203
203
  snapshot: BoardFileSnapshotSchema.optional()
204
204
  });
205
+ const BoardTaskOutputSchema = z.object({
206
+ type: z.enum([
207
+ "image",
208
+ "video",
209
+ "audio",
210
+ "text"
211
+ ]),
212
+ /** Remote preview only. Inline data is intentionally never persisted. */
213
+ url: z.string().url().optional(),
214
+ textExcerpt: z.string().max(480).optional(),
215
+ mimeType: z.string().max(160).optional(),
216
+ /** Intrinsic media size, cached so the node can match the preview aspect. */
217
+ naturalWidth: z.number().positive().optional(),
218
+ naturalHeight: z.number().positive().optional()
219
+ });
220
+ /**
221
+ * Cached task facts used for an immediate first paint. The task run remains the
222
+ * source of truth and live clients refresh this projection by `taskRunId`.
223
+ */
224
+ const BoardTaskSnapshotSchema = z.object({
225
+ taskType: z.string().min(1).max(120),
226
+ status: z.enum([
227
+ "pending",
228
+ "running",
229
+ "completed",
230
+ "failed"
231
+ ]),
232
+ title: z.string().min(1).max(240),
233
+ model: z.string().max(160).optional(),
234
+ promptExcerpt: z.string().max(480).optional(),
235
+ outputCount: z.number().int().nonnegative().default(0),
236
+ primaryOutput: BoardTaskOutputSchema.optional(),
237
+ updatedAt: z.string().optional()
238
+ });
239
+ /** A stable reference to a task run with a small, replaceable display cache. */
240
+ const BoardTaskItemSchema = BoardItemBaseSchema.extend({
241
+ type: z.literal("task"),
242
+ taskRunId: z.string().min(1),
243
+ snapshot: BoardTaskSnapshotSchema
244
+ });
205
245
  /**
206
246
  * The set of shape types this client understands natively. Anything else is
207
247
  * preserved verbatim as an unknown item (see BoardUnknownItem) so documents
@@ -212,6 +252,7 @@ const KNOWN_BOARD_ITEM_TYPES = [
212
252
  "image",
213
253
  "video",
214
254
  "file",
255
+ "task",
215
256
  "text",
216
257
  "geo",
217
258
  "draw",
@@ -251,6 +292,10 @@ function parseBoardItemLoose(raw) {
251
292
  const parsed = BoardFileItemSchema.safeParse(raw);
252
293
  return parsed.success ? parsed.data : makeUnknownItem(raw);
253
294
  }
295
+ case "task": {
296
+ const parsed = BoardTaskItemSchema.safeParse(raw);
297
+ return parsed.success ? parsed.data : makeUnknownItem(raw);
298
+ }
254
299
  case "text": {
255
300
  const parsed = BoardTextItemSchema.safeParse(raw);
256
301
  return parsed.success ? parsed.data : makeUnknownItem(raw);
@@ -358,4 +403,4 @@ function isFileBackedItem(item) {
358
403
  return item.type === "image" || item.type === "video" || item.type === "file";
359
404
  }
360
405
  //#endregion
361
- export { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BoardAppearanceSchema, BoardArrowItemSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections };
406
+ export { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BoardAppearanceSchema, BoardArrowItemSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardTaskItemSchema, BoardTaskOutputSchema, BoardTaskSnapshotSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub",
3
- "version": "5.4.3",
3
+ "version": "5.5.0",
4
4
  "description": "Cohub SDK for spaces, sessions, boards, and realtime agent collaboration.",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,