@neta-art/cohub 5.4.3 → 5.6.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.
- package/README.md +10 -0
- package/dist/board/codec.js +28 -14
- package/dist/board/image-key.js +7 -0
- package/dist/board/index.d.ts +3 -2
- package/dist/board/index.js +3 -2
- package/dist/board/render/renderers/board-renderer-registry.js +2 -0
- package/dist/board/render/renderers/task-card-renderer.d.ts +12 -0
- package/dist/board/render/renderers/task-card-renderer.js +389 -0
- package/dist/board/task.d.ts +15 -0
- package/dist/board/task.js +182 -0
- package/dist/chunks/http.d.ts +6 -0
- package/dist/chunks/http.js +11 -0
- package/dist/chunks/websocket.d.ts +1 -1
- package/dist/protocol/dist/board-document.d.ts +185 -3
- package/dist/protocol/dist/board-document.js +46 -1
- package/dist/types.d.ts +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,6 +124,16 @@ const stop = board.subscribe({
|
|
|
124
124
|
stop();
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
+
Task nodes keep a small, replaceable display snapshot beside their stable `taskRunId`. The SDK can build that projection from an authoritative TaskRun without copying the full payload, result or inline media into a Board:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { taskRunToBoardTaskSnapshot } from "@neta-art/cohub/board";
|
|
131
|
+
|
|
132
|
+
const snapshot = taskRunToBoardTaskSnapshot(taskRun);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Use `client.tasks.getMany(ids, { spaceId })` to restore the TaskRuns for a Board in one request. The server applies the same Space permissions and result sanitization as the regular task list endpoint.
|
|
136
|
+
|
|
127
137
|
Board is split by dependency: the model runs anywhere, drawing needs PixiJS.
|
|
128
138
|
`@neta-art/cohub/board` carries the document schema, geometry, the shape layer,
|
|
129
139
|
timeline compilation and export planning, with no renderer and no PixiJS — so
|
package/dist/board/codec.js
CHANGED
|
@@ -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
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
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:
|
|
199
|
-
|
|
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) {
|
package/dist/board/image-key.js
CHANGED
|
@@ -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. */
|
package/dist/board/index.d.ts
CHANGED
|
@@ -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,5 @@ 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
|
-
|
|
20
|
+
import { normalizeBoardTaskOutputUrl, taskRunToBoardTaskSnapshot } from "./task.js";
|
|
21
|
+
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, normalizeBoardTaskOutputUrl, 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, taskRunToBoardTaskSnapshot, timeline, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldPoint, worldToAnchor, worldToScreen, zoomAround };
|
package/dist/board/index.js
CHANGED
|
@@ -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,5 @@ 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
|
-
|
|
20
|
+
import { normalizeBoardTaskOutputUrl, taskRunToBoardTaskSnapshot } from "./task.js";
|
|
21
|
+
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, normalizeBoardTaskOutputUrl, 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, taskRunToBoardTaskSnapshot, 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 };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BoardTaskSnapshot } from "../protocol/dist/board-document.js";
|
|
2
|
+
import { TaskRunRecord } from "../types.js";
|
|
3
|
+
//#region src/board/task.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Normalize a persistable remote media URL and reject credentialed or visibly
|
|
6
|
+
* non-public hosts. Server-side fetchers must still validate resolved DNS addresses.
|
|
7
|
+
*/
|
|
8
|
+
declare function normalizeBoardTaskOutputUrl(value: unknown): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Project an authoritative TaskRun into a small, replaceable Board display cache.
|
|
11
|
+
* Raw payloads, complete results and inline media are never copied into the Board.
|
|
12
|
+
*/
|
|
13
|
+
declare function taskRunToBoardTaskSnapshot(run: TaskRunRecord): BoardTaskSnapshot;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { normalizeBoardTaskOutputUrl, taskRunToBoardTaskSnapshot };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//#region src/board/task.ts
|
|
2
|
+
const EXCERPT_LIMIT = 240;
|
|
3
|
+
function record(value) {
|
|
4
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
5
|
+
}
|
|
6
|
+
function cleanExcerpt(value, limit = EXCERPT_LIMIT) {
|
|
7
|
+
if (typeof value !== "string") return void 0;
|
|
8
|
+
const clean = value.replace(/\s+/g, " ").trim();
|
|
9
|
+
if (!clean) return void 0;
|
|
10
|
+
return clean.length > limit ? `${clean.slice(0, limit - 3).trimEnd()}...` : clean;
|
|
11
|
+
}
|
|
12
|
+
function parseIpv4(host) {
|
|
13
|
+
const parts = host.split(".").map(Number);
|
|
14
|
+
return parts.length === 4 && parts.every((part) => Number.isInteger(part) && part >= 0 && part <= 255) ? parts : null;
|
|
15
|
+
}
|
|
16
|
+
function isBlockedIpv4(host) {
|
|
17
|
+
const parts = parseIpv4(host);
|
|
18
|
+
if (!parts) return false;
|
|
19
|
+
const [first, second, third] = parts;
|
|
20
|
+
if (first === 0 || first === 10 || first === 127) return true;
|
|
21
|
+
if (first === 100 && second >= 64 && second <= 127) return true;
|
|
22
|
+
if (first === 169 && second === 254) return true;
|
|
23
|
+
if (first === 172 && second >= 16 && second <= 31) return true;
|
|
24
|
+
if (first === 192 && second === 168) return true;
|
|
25
|
+
if (first === 192 && second === 0 && (third === 0 || third === 2)) return true;
|
|
26
|
+
if (first === 192 && second === 88 && third === 99) return true;
|
|
27
|
+
if (first === 198 && (second === 18 || second === 19)) return true;
|
|
28
|
+
if (first === 198 && second === 51 && third === 100) return true;
|
|
29
|
+
if (first === 203 && second === 0 && third === 113) return true;
|
|
30
|
+
return first >= 224;
|
|
31
|
+
}
|
|
32
|
+
function expandIpv6(host) {
|
|
33
|
+
const [head, tail, extra] = host.toLowerCase().split("::");
|
|
34
|
+
if (extra !== void 0) return null;
|
|
35
|
+
const headParts = head ? head.split(":").filter(Boolean) : [];
|
|
36
|
+
const tailParts = tail ? tail.split(":").filter(Boolean) : [];
|
|
37
|
+
const missing = 8 - headParts.length - tailParts.length;
|
|
38
|
+
if (missing < 0 || tail === void 0 && missing !== 0) return null;
|
|
39
|
+
const parts = [
|
|
40
|
+
...headParts,
|
|
41
|
+
...Array.from({ length: missing }, () => "0"),
|
|
42
|
+
...tailParts
|
|
43
|
+
];
|
|
44
|
+
if (parts.length !== 8 || parts.some((part) => !/^[0-9a-f]{1,4}$/.test(part))) return null;
|
|
45
|
+
return parts.map((part) => part.padStart(4, "0"));
|
|
46
|
+
}
|
|
47
|
+
function isBlockedIpv6(host) {
|
|
48
|
+
const parts = expandIpv6(host);
|
|
49
|
+
if (!parts) return true;
|
|
50
|
+
if (parts.every((part) => part === "0000")) return true;
|
|
51
|
+
if (parts.slice(0, 7).every((part) => part === "0000") && parts[7] === "0001") return true;
|
|
52
|
+
if (parts.slice(0, 5).every((part) => part === "0000") && parts[5] === "ffff") {
|
|
53
|
+
const high = Number.parseInt(parts[6] ?? "0", 16);
|
|
54
|
+
const low = Number.parseInt(parts[7] ?? "0", 16);
|
|
55
|
+
return isBlockedIpv4(`${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`);
|
|
56
|
+
}
|
|
57
|
+
if (parts.slice(0, 6).every((part) => part === "0000")) return true;
|
|
58
|
+
const first = Number.parseInt(parts[0] ?? "0", 16);
|
|
59
|
+
if ((first & 65024) === 64512) return true;
|
|
60
|
+
if ((first & 65472) === 65152 || (first & 65472) === 65216) return true;
|
|
61
|
+
if ((first & 65280) === 65280) return true;
|
|
62
|
+
return parts[0] === "2001" && parts[1] === "0db8";
|
|
63
|
+
}
|
|
64
|
+
function isBlockedTaskOutputHost(hostname) {
|
|
65
|
+
const host = hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
66
|
+
if (host === "localhost" || host.endsWith(".localhost") || host.endsWith(".local") || host.endsWith(".internal")) return true;
|
|
67
|
+
if (parseIpv4(host)) return isBlockedIpv4(host);
|
|
68
|
+
return host.includes(":") && isBlockedIpv6(host);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Normalize a persistable remote media URL and reject credentialed or visibly
|
|
72
|
+
* non-public hosts. Server-side fetchers must still validate resolved DNS addresses.
|
|
73
|
+
*/
|
|
74
|
+
function normalizeBoardTaskOutputUrl(value) {
|
|
75
|
+
if (typeof value !== "string") return void 0;
|
|
76
|
+
try {
|
|
77
|
+
const url = new URL(value.trim());
|
|
78
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return void 0;
|
|
79
|
+
if (url.username || url.password || isBlockedTaskOutputHost(url.hostname)) return void 0;
|
|
80
|
+
return url.toString();
|
|
81
|
+
} catch {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function blockText(block) {
|
|
86
|
+
return cleanExcerpt(block.text ?? block.content ?? block.value);
|
|
87
|
+
}
|
|
88
|
+
function blockUrl(block) {
|
|
89
|
+
const source = record(block.source);
|
|
90
|
+
return normalizeBoardTaskOutputUrl(source?.url ?? source?.src ?? block.url ?? block.src);
|
|
91
|
+
}
|
|
92
|
+
function blockMimeType(block) {
|
|
93
|
+
const source = record(block.source);
|
|
94
|
+
const value = source?.mediaType ?? source?.media_type ?? source?.mimeType ?? block.mediaType ?? block.media_type ?? block.mimeType;
|
|
95
|
+
return typeof value === "string" ? value : void 0;
|
|
96
|
+
}
|
|
97
|
+
function positiveNumber(value) {
|
|
98
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
99
|
+
}
|
|
100
|
+
function blockNaturalSize(block) {
|
|
101
|
+
const source = record(block.source);
|
|
102
|
+
const naturalWidth = positiveNumber(source?.width ?? source?.naturalWidth ?? block.width ?? block.naturalWidth);
|
|
103
|
+
const naturalHeight = positiveNumber(source?.height ?? source?.naturalHeight ?? block.height ?? block.naturalHeight);
|
|
104
|
+
return {
|
|
105
|
+
...naturalWidth ? { naturalWidth } : {},
|
|
106
|
+
...naturalHeight ? { naturalHeight } : {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function contentBlocks(value) {
|
|
110
|
+
return Array.isArray(value) ? value.filter((item) => record(item)) : [];
|
|
111
|
+
}
|
|
112
|
+
function taskData(run) {
|
|
113
|
+
const payload = record(run.payload);
|
|
114
|
+
return record(payload?.data) ?? payload;
|
|
115
|
+
}
|
|
116
|
+
function generationOutput(run) {
|
|
117
|
+
return contentBlocks(record(run.result)?.output);
|
|
118
|
+
}
|
|
119
|
+
function generationPrompt(run) {
|
|
120
|
+
for (const block of contentBlocks(taskData(run)?.content)) {
|
|
121
|
+
const text = blockText(block);
|
|
122
|
+
if (text) return text;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function primaryOutput(blocks) {
|
|
126
|
+
for (const block of blocks) {
|
|
127
|
+
if (block.type !== "image" && block.type !== "video") continue;
|
|
128
|
+
const url = blockUrl(block);
|
|
129
|
+
if (!url) continue;
|
|
130
|
+
const mimeType = blockMimeType(block);
|
|
131
|
+
return {
|
|
132
|
+
type: block.type,
|
|
133
|
+
url,
|
|
134
|
+
...mimeType ? { mimeType } : {},
|
|
135
|
+
...blockNaturalSize(block)
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
for (const block of blocks) {
|
|
139
|
+
if (block.type === "audio") {
|
|
140
|
+
const url = blockUrl(block);
|
|
141
|
+
const mimeType = blockMimeType(block);
|
|
142
|
+
return {
|
|
143
|
+
type: "audio",
|
|
144
|
+
...url ? { url } : {},
|
|
145
|
+
...mimeType ? { mimeType } : {}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (block.type === "text") {
|
|
149
|
+
const textExcerpt = blockText(block);
|
|
150
|
+
if (textExcerpt) return {
|
|
151
|
+
type: "text",
|
|
152
|
+
textExcerpt
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function taskTypeTitle(taskType) {
|
|
158
|
+
return taskType.replace(/[._-]+/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Project an authoritative TaskRun into a small, replaceable Board display cache.
|
|
162
|
+
* Raw payloads, complete results and inline media are never copied into the Board.
|
|
163
|
+
*/
|
|
164
|
+
function taskRunToBoardTaskSnapshot(run) {
|
|
165
|
+
const data = taskData(run);
|
|
166
|
+
const blocks = run.taskType === "generation" ? generationOutput(run) : [];
|
|
167
|
+
const promptExcerpt = run.taskType === "generation" ? generationPrompt(run) : cleanExcerpt(data?.command ?? data?.prompt ?? data?.title);
|
|
168
|
+
const model = typeof data?.model === "string" ? data.model : void 0;
|
|
169
|
+
const primary = primaryOutput(blocks);
|
|
170
|
+
return {
|
|
171
|
+
taskType: run.taskType,
|
|
172
|
+
status: run.status,
|
|
173
|
+
title: promptExcerpt ?? taskTypeTitle(run.taskType),
|
|
174
|
+
...model ? { model } : {},
|
|
175
|
+
...promptExcerpt ? { promptExcerpt } : {},
|
|
176
|
+
outputCount: blocks.length,
|
|
177
|
+
...primary ? { primaryOutput: primary } : {},
|
|
178
|
+
updatedAt: run.updatedAt
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
export { normalizeBoardTaskOutputUrl, taskRunToBoardTaskSnapshot };
|
package/dist/chunks/http.d.ts
CHANGED
|
@@ -1662,7 +1662,13 @@ declare class TasksApi {
|
|
|
1662
1662
|
private readonly transport;
|
|
1663
1663
|
constructor(transport: HttpTransport);
|
|
1664
1664
|
get(taskRunId: string): Promise<TaskRunDetailResponse>;
|
|
1665
|
+
getMany(taskRunIds: string[], options?: {
|
|
1666
|
+
spaceId?: string;
|
|
1667
|
+
}): Promise<{
|
|
1668
|
+
runs: TaskRunRecord[];
|
|
1669
|
+
}>;
|
|
1665
1670
|
list(filters?: {
|
|
1671
|
+
ids?: string[];
|
|
1666
1672
|
cronJobId?: string;
|
|
1667
1673
|
spaceId?: string;
|
|
1668
1674
|
sessionId?: string;
|
package/dist/chunks/http.js
CHANGED
|
@@ -3135,8 +3135,19 @@ var TasksApi = class {
|
|
|
3135
3135
|
get(taskRunId) {
|
|
3136
3136
|
return this.transport.request(`/api/tasks/${taskRunId}`);
|
|
3137
3137
|
}
|
|
3138
|
+
getMany(taskRunIds, options) {
|
|
3139
|
+
const ids = [...new Set(taskRunIds.filter(Boolean))];
|
|
3140
|
+
if (ids.length === 0) return Promise.resolve({ runs: [] });
|
|
3141
|
+
if (ids.length > 100) throw new Error("At most 100 task runs can be fetched at once");
|
|
3142
|
+
return this.list({
|
|
3143
|
+
ids,
|
|
3144
|
+
spaceId: options?.spaceId,
|
|
3145
|
+
limit: ids.length
|
|
3146
|
+
}).then(({ runs }) => ({ runs }));
|
|
3147
|
+
}
|
|
3138
3148
|
list(filters) {
|
|
3139
3149
|
const params = new URLSearchParams();
|
|
3150
|
+
if (filters?.ids?.length) params.set("ids", [...new Set(filters.ids)].join(","));
|
|
3140
3151
|
if (filters?.cronJobId) params.set("cronJobId", filters.cronJobId);
|
|
3141
3152
|
if (filters?.spaceId) params.set("spaceId", filters.spaceId);
|
|
3142
3153
|
if (filters?.sessionId) params.set("sessionId", filters.sessionId);
|
|
@@ -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.
|
|
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/dist/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BoardCapability, BoardRenderCost } from "./protocol/dist/board-constants.js";
|
|
2
|
+
import { BoardAssetRef, BoardClip, BoardDiagnostic, BoardEffect, BoardManifest, BoardNodeInput, BoardNodeRecord, BoardRecord, BoardSequence, BoardTarget, BoardValidationResult } from "./protocol/dist/board.js";
|
|
3
|
+
import "./protocol/dist/index.js";
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
type UserProfile = {
|
|
6
|
+
userUuid: string;
|
|
7
|
+
logtoUserId?: string;
|
|
8
|
+
username: string | null;
|
|
9
|
+
displayName: string;
|
|
10
|
+
avatarUrl: string | null;
|
|
11
|
+
syncedAt?: string;
|
|
12
|
+
};
|
|
13
|
+
type TaskRunRecord = {
|
|
14
|
+
id: string;
|
|
15
|
+
jobId: string;
|
|
16
|
+
cronJobId: string | null;
|
|
17
|
+
taskType: string;
|
|
18
|
+
status: "pending" | "running" | "completed" | "failed";
|
|
19
|
+
payload: unknown;
|
|
20
|
+
result: unknown;
|
|
21
|
+
errorMessage: string | null;
|
|
22
|
+
attemptCount: number;
|
|
23
|
+
spaceId: string | null;
|
|
24
|
+
sessionId: string | null;
|
|
25
|
+
turnId: string | null;
|
|
26
|
+
userUuid: string | null;
|
|
27
|
+
userProfile?: UserProfile;
|
|
28
|
+
scheduledAt: string | null;
|
|
29
|
+
startedAt: string | null;
|
|
30
|
+
finishedAt: string | null;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { TaskRunRecord, UserProfile };
|