{ "kind": "open-flow-workflow", "version": 1, "name": "Vancine Seedance Video", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_5a9cdd20b7a0e28f": { "name": "Enter Seedance video request", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "model" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "prompt" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "size" } ] }, "n_b7a64963021a90ce": { "inputs": { "model": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5a9cdd20b7a0e28f", "output": "model" } ] }, "prompt": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5a9cdd20b7a0e28f", "output": "prompt" } ] }, "size": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5a9cdd20b7a0e28f", "output": "size" } ] } }, "name": "Validate video request", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "model" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "prompt" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "size" } ], "outputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "body" } ], "name": "Validate video request", "moduleId": "n_68a519e1c3cf2b21", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_55772a1be5dafbd0": { "inputs": { "url": { "kind": "value", "value": "https://vancine.com/v1/video/generations" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b7a64963021a90ce", "output": "body" } ] }, "auth.token": { "kind": "unset" } }, "name": "Submit one Vancine video task", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.token" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Submit one Vancine video task", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "authentication": { "type": "bearer" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_3f42e86d2b9dee66": { "inputs": { "submission": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_55772a1be5dafbd0", "output": "body" } ] }, "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3f42e86d2b9dee66", "output": "state" } ] }, "maxPolls": { "kind": "value", "value": 120 }, "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_1c0cb5be08fdcbc2", "output": "body" } ] } }, "name": "Check task status and poll limit", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "submission" }, { "jsonSchema": { "type": "object", "properties": { "taskId": { "type": "string", "minLength": 1 }, "polls": { "type": "integer", "minimum": 0 } }, "required": [ "taskId", "polls" ], "additionalProperties": false }, "nullable": true, "handle": "previousState" }, { "jsonSchema": {}, "nullable": true, "handle": "response" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "maxPolls" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "taskId": { "type": "string", "minLength": 1 }, "polls": { "type": "integer", "minimum": 0 } }, "required": [ "taskId", "polls" ], "additionalProperties": false }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "task_id" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "status" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "result_url" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "polls" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "pollUrl" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "pending" } ], "name": "Check task status and poll limit", "moduleId": "n_d0c6ed7af4b499d6", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_ab468396f044d7f1": { "inputs": {}, "name": "Task still pending", "kind": "condition", "matchMode": "first", "cases": [ { "output": "pending", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_3f42e86d2b9dee66", "output": "pending" } }, "operator": "==", "right": { "kind": "value", "value": true } } ] } ] } ] }, "n_31571d1bf042ed3b": { "inputs": {}, "name": "Wait five seconds", "kind": "wait", "inputDefinitions": [], "prompt": "Wait five seconds", "autoContinue": { "kind": "after", "durationMs": 5000 } }, "n_1c0cb5be08fdcbc2": { "inputs": { "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3f42e86d2b9dee66", "output": "pollUrl" } ] }, "auth.token": { "kind": "unset" } }, "name": "Read Vancine task status", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.token" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Read Vancine task status", "executor": { "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "authentication": { "type": "bearer" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_0e47615ecad2fe9d": { "name": "Completed video URL", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "task_id" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "status" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "result_url" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "polls" } ], "outputMappings": { "task_id": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3f42e86d2b9dee66", "output": "task_id" } ] }, "status": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3f42e86d2b9dee66", "output": "status" } ] }, "result_url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3f42e86d2b9dee66", "output": "result_url" } ] }, "polls": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3f42e86d2b9dee66", "output": "polls" } ] } } } }, "edges": [ { "source": "n_5a9cdd20b7a0e28f", "target": "n_b7a64963021a90ce" }, { "source": "n_b7a64963021a90ce", "target": "n_55772a1be5dafbd0" }, { "source": "n_55772a1be5dafbd0", "target": "n_3f42e86d2b9dee66" }, { "source": "n_3f42e86d2b9dee66", "target": "n_ab468396f044d7f1" }, { "source": "n_ab468396f044d7f1", "target": "n_31571d1bf042ed3b", "sourceHandle": "pending" }, { "source": "n_31571d1bf042ed3b", "target": "n_1c0cb5be08fdcbc2", "sourceHandle": "continue" }, { "source": "n_1c0cb5be08fdcbc2", "target": "n_3f42e86d2b9dee66" }, { "source": "n_ab468396f044d7f1", "target": "n_0e47615ecad2fe9d", "sourceHandle": "otherwise" } ] } }, "modules": { "n_68a519e1c3cf2b21": { "name": "Validate video request", "imports": [], "source": "export default function prepareVancineRequest({ model, prompt, size }) {\n for (const [name, value] of Object.entries({ model, prompt, size })) {\n if (typeof value !== 'string' || value.trim() === '' || /^YOUR_/i.test(value)) throw new Error('Configure a nonempty Vancine ' + name + '.');\n }\n return { body: { model, prompt, size } };\n}\n" }, "n_d0c6ed7af4b499d6": { "name": "Check task status and poll limit", "imports": [], "source": "export default function collectVancineStatus({ submission, previousState, response, maxPolls }) {\n if (!Number.isSafeInteger(maxPolls) || maxPolls < 1) throw new Error('maxPolls must be a positive integer.');\n let state, status = 'queued', result_url = '', pending = true;\n if (previousState === null) {\n if (response !== null) throw new Error('Unexpected poll response before initialization.');\n const taskId = submission?.task_id || submission?.id || submission?.data?.task_id || submission?.data?.id;\n if (typeof taskId !== 'string' || taskId.trim() === '') throw new Error('Vancine submission returned no task ID; inspect the service before submitting again.');\n state = { taskId, polls: 0 };\n } else {\n if (typeof previousState.taskId !== 'string' || previousState.taskId.trim() === '' || !Number.isSafeInteger(previousState.polls) || previousState.polls < 0 || previousState.polls >= maxPolls) throw new Error('Invalid Vancine polling state.');\n state = { taskId: previousState.taskId, polls: previousState.polls + 1 };\n if (!response || typeof response !== 'object' || Array.isArray(response)) throw new Error('Vancine returned no task status object.');\n const data = response.data && typeof response.data === 'object' && !Array.isArray(response.data) ? response.data : {};\n const reportedId = data.task_id || response.task_id || response.id || data.id;\n if (reportedId !== undefined && reportedId !== state.taskId) throw new Error('The Vancine poll response belongs to another task.');\n status = data.status || response.status;\n if (typeof status !== 'string' || status.trim() === '') throw new Error('Vancine returned no task status.');\n if (status === 'SUCCESS' || status === 'completed') {\n result_url = data.result_url || response.metadata?.url || data.data?.content?.video_url || '';\n if (typeof result_url !== 'string' || !/^https?:\\/\\/[^\\s<>]+$/i.test(result_url)) throw new Error('Completed Vancine task has no HTTP(S) result URL.');\n pending = false;\n } else if (status === 'FAILURE' || status === 'failed') {\n const reason = data.fail_reason || data.error?.message || response.error?.message || 'unknown';\n throw new Error('Seedance task ' + state.taskId + ' failed: ' + String(reason));\n } else if (state.polls >= maxPolls) {\n throw new Error('Polling exceeded ' + maxPolls + ' attempts for task ' + state.taskId + '; the remote task may still be running.');\n }\n }\n return { state, task_id: state.taskId, pollUrl: 'https://vancine.com/v1/video/generations/' + encodeURIComponent(state.taskId), polls: state.polls, pending, status, result_url };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }