From 88f66b58a346a2d0a49943bfeb89d48b615084c5 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Wed, 25 Feb 2026 21:12:58 +1300 Subject: [PATCH] feat(43-01): add RouterNodeData type, defaults, and executor - Add 'router' to NodeType union in types/nodes.ts - Add RouterNodeData interface (extends BaseNodeData, no internal state) - Add RouterNodeData to WorkflowNodeData union - Add router dimensions (200x80) to nodeDefaults.ts and validation.ts - Add router default data (empty object) to both files - Add executeRouter pure passthrough function to simpleNodeExecutors.ts - Add RouterNode export to components/nodes/index.ts Co-Authored-By: Claude Opus 4.6 --- src/components/nodes/index.ts | 1 + src/lib/quickstart/validation.ts | 4 ++++ src/store/execution/simpleNodeExecutors.ts | 11 +++++++++++ src/store/utils/nodeDefaults.ts | 4 ++++ src/types/nodes.ts | 9 +++++++++ 5 files changed, 29 insertions(+) diff --git a/src/components/nodes/index.ts b/src/components/nodes/index.ts index 03d83326..0deb8ad9 100644 --- a/src/components/nodes/index.ts +++ b/src/components/nodes/index.ts @@ -17,4 +17,5 @@ export { VideoStitchNode } from "./VideoStitchNode"; export { EaseCurveNode } from "./EaseCurveNode"; export { VideoTrimNode } from "./VideoTrimNode"; export { VideoFrameGrabNode } from "./VideoFrameGrabNode"; +export { RouterNode } from "./RouterNode"; export { GroupNode } from "./GroupNode"; diff --git a/src/lib/quickstart/validation.ts b/src/lib/quickstart/validation.ts index 4afce636..28eb5bc4 100644 --- a/src/lib/quickstart/validation.ts +++ b/src/lib/quickstart/validation.ts @@ -31,6 +31,7 @@ const VALID_NODE_TYPES: NodeType[] = [ "easeCurve", "videoTrim", "videoFrameGrab", + "router", "glbViewer", ]; @@ -57,6 +58,7 @@ const DEFAULT_DIMENSIONS: Record = easeCurve: { width: 340, height: 480 }, videoTrim: { width: 360, height: 360 }, videoFrameGrab: { width: 320, height: 320 }, + router: { width: 200, height: 80 }, glbViewer: { width: 360, height: 380 }, }; @@ -387,6 +389,8 @@ function createDefaultNodeData(type: NodeType): WorkflowNodeData { status: "idle", error: null, }; + case "router": + return {}; case "glbViewer": return { glbUrl: null, diff --git a/src/store/execution/simpleNodeExecutors.ts b/src/store/execution/simpleNodeExecutors.ts index 597d78ab..bc809905 100644 --- a/src/store/execution/simpleNodeExecutors.ts +++ b/src/store/execution/simpleNodeExecutors.ts @@ -315,6 +315,17 @@ export async function executeImageCompare(ctx: NodeExecutionContext): Promise { + // Router is pure passthrough — data flows via edge traversal in getConnectedInputs. + // Brief status flash to show execution occurred. + ctx.updateNodeData(ctx.node.id, { status: "loading" }); + await new Promise(resolve => setTimeout(resolve, 50)); + ctx.updateNodeData(ctx.node.id, { status: "complete" }); +} + /** * GLB Viewer node: receives 3D model URL from upstream, fetches and loads it. */ diff --git a/src/store/utils/nodeDefaults.ts b/src/store/utils/nodeDefaults.ts index aa45032d..7e83670a 100644 --- a/src/store/utils/nodeDefaults.ts +++ b/src/store/utils/nodeDefaults.ts @@ -18,6 +18,7 @@ import { EaseCurveNodeData, VideoTrimNodeData, VideoFrameGrabNodeData, + RouterNodeData, GLBViewerNodeData, WorkflowNodeData, GroupColor, @@ -49,6 +50,7 @@ export const defaultNodeDimensions: Record { status: "idle", error: null, } as VideoFrameGrabNodeData; + case "router": + return {} as RouterNodeData; case "glbViewer": return { glbUrl: null, diff --git a/src/types/nodes.ts b/src/types/nodes.ts index 2c23b525..c478d6ff 100644 --- a/src/types/nodes.ts +++ b/src/types/nodes.ts @@ -41,6 +41,7 @@ export type NodeType = | "easeCurve" | "videoTrim" | "videoFrameGrab" + | "router" | "generate3d" | "glbViewer"; @@ -349,6 +350,13 @@ export interface VideoFrameGrabNodeData extends BaseNodeData { error: string | null; } +/** + * Router node - pure passthrough routing node with dynamic multi-type handles + */ +export interface RouterNodeData extends BaseNodeData { + // No internal state - all routing is derived from edge connections +} + /** * Split Grid node - splits image into grid cells for parallel processing */ @@ -407,6 +415,7 @@ export type WorkflowNodeData = | EaseCurveNodeData | VideoTrimNodeData | VideoFrameGrabNodeData + | RouterNodeData | GLBViewerNodeData; /**