@nodaro/shared 3.54.0 → 3.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{chunk-NEIWY6CC.cjs → chunk-6HUWQLF2.cjs} +6 -6
  2. package/dist/{chunk-NEIWY6CC.cjs.map → chunk-6HUWQLF2.cjs.map} +1 -1
  3. package/dist/{chunk-ND3IE3IB.cjs → chunk-G7IUQKRU.cjs} +17 -17
  4. package/dist/{chunk-ND3IE3IB.cjs.map → chunk-G7IUQKRU.cjs.map} +1 -1
  5. package/dist/{chunk-IB5B3EBD.js → chunk-JCNTNAZP.js} +13 -7
  6. package/dist/chunk-JCNTNAZP.js.map +1 -0
  7. package/dist/{chunk-6F6GGX2W.cjs → chunk-M7LU4NTI.cjs} +3 -2
  8. package/dist/chunk-M7LU4NTI.cjs.map +1 -0
  9. package/dist/{chunk-6UR5UE5G.js → chunk-MCIBQ5BF.js} +3 -3
  10. package/dist/{chunk-6UR5UE5G.js.map → chunk-MCIBQ5BF.js.map} +1 -1
  11. package/dist/{chunk-C4R7BTBQ.js → chunk-TADEEG5E.js} +3 -2
  12. package/dist/chunk-TADEEG5E.js.map +1 -0
  13. package/dist/{chunk-ADWIAQQS.js → chunk-UWMXMLMV.js} +3 -3
  14. package/dist/{chunk-ADWIAQQS.js.map → chunk-UWMXMLMV.js.map} +1 -1
  15. package/dist/{chunk-3GMTGX3D.cjs → chunk-WVACGZYV.cjs} +4 -4
  16. package/dist/{chunk-3GMTGX3D.cjs.map → chunk-WVACGZYV.cjs.map} +1 -1
  17. package/dist/{chunk-ANMCMSGR.cjs → chunk-YTXP4VHD.cjs} +13 -7
  18. package/dist/chunk-YTXP4VHD.cjs.map +1 -0
  19. package/dist/{chunk-NMX6HQC3.js → chunk-ZAK276QF.js} +3 -3
  20. package/dist/{chunk-NMX6HQC3.js.map → chunk-ZAK276QF.js.map} +1 -1
  21. package/dist/entries/apps.cjs +38 -38
  22. package/dist/entries/apps.js +3 -3
  23. package/dist/entries/i18n.cjs +11 -11
  24. package/dist/entries/i18n.d.cts +5 -4
  25. package/dist/entries/i18n.d.ts +5 -4
  26. package/dist/entries/i18n.js +1 -1
  27. package/dist/entries/nodes.cjs +199 -199
  28. package/dist/entries/nodes.js +3 -3
  29. package/dist/entries/video.cjs +24 -24
  30. package/dist/entries/video.d.cts +11 -10
  31. package/dist/entries/video.d.ts +11 -10
  32. package/dist/entries/video.js +1 -1
  33. package/dist/index.cjs +269 -269
  34. package/dist/index.js +5 -5
  35. package/package.json +1 -1
  36. package/src/__tests__/entry-matches-query.test.ts +34 -0
  37. package/src/__tests__/video-link-needs.test.ts +23 -4
  38. package/src/__tests__/video-link.test.ts +1 -1
  39. package/src/i18n/index.ts +6 -4
  40. package/src/i18n/style.ar.ts +1 -1
  41. package/src/i18n/style.de.ts +1 -1
  42. package/src/i18n/style.es.ts +1 -1
  43. package/src/i18n/style.fr.ts +1 -1
  44. package/src/i18n/style.he.ts +1 -1
  45. package/src/i18n/style.hi.ts +1 -1
  46. package/src/i18n/style.ja.ts +1 -1
  47. package/src/i18n/style.ko.ts +1 -1
  48. package/src/i18n/style.pt-BR.ts +1 -1
  49. package/src/i18n/style.ru.ts +1 -1
  50. package/src/i18n/style.zh-CN.ts +1 -1
  51. package/src/video-link.ts +35 -15
  52. package/dist/chunk-6F6GGX2W.cjs.map +0 -1
  53. package/dist/chunk-ANMCMSGR.cjs.map +0 -1
  54. package/dist/chunk-C4R7BTBQ.js.map +0 -1
  55. package/dist/chunk-IB5B3EBD.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/producer-types.ts","../src/exposed-field-keys.ts","../src/render-nodes.ts","../src/presentation-utils.ts"],"names":["composeUnitSet","unitProducers","composeUnitRecord","UGC_PRIMARY_HANDLE","unitFanOutEach","applyEdlCreditId","speakerViewCreditId","SPEAKER_VIEW_CREDIT_IDS","unitsPresenting","url","text","dropStaleVideoLinkFields"],"mappings":";;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AACT;AAGO,SAAS,cAAc,IAAA,EAAgC;AAC5D,EAAA,OAAO,IAAA,CAAK,IAAA,KAAS,MAAA,GAAS,IAAA,CAAK,SAAS,IAAA,CAAK,EAAA;AACnD;AAGO,SAAS,kBAAA,CACd,OACA,OAAA,EACoB;AACpB,EAAA,OAAO,KAAA,CACJ,MAAA,CAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,IAAU,IAAA,CAAK,IAAA,KAAS,OAAA,IAAW,IAAA,CAAK,IAAA,KAAS,QAAA,EAAU,OAAO,OAAA,CAAQ,GAAA,CAAI,KAAK,MAAM,CAAA;AAC3G,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA,CACA,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,IAAA,IAAI,IAAA,CAAK,SAAS,OAAA,EAAS;AACzB,MAAA,OAAO,EAAE,GAAG,IAAA,EAAM,KAAA,EAAO,mBAAmB,IAAA,CAAK,KAAA,EAAO,OAAO,CAAA,EAAE;AAAA,IACnE;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA;AACL","file":"chunk-3GMTGX3D.cjs","sourcesContent":["/**\n * Producer-type sets — single source of truth for the node types whose\n * primary output is a video URL, audio URL, etc.\n *\n * Consumed by:\n * - backend/src/services/workflow-engine/execution-graph.ts (orchestrator\n * dispatch + asset-type tagging in payload-builder, output-extractor,\n * inline-executor — re-exported there as VIDEO_SOURCE_TYPES /\n * AUDIO_SOURCE_TYPES for backwards compatibility).\n * - frontend/src/lib/generate-video-handles.ts (handle connection\n * validation on the Generate Video node).\n *\n * Lifting these here ensures the frontend handle validator can never reject\n * a connection from a node type that the backend would happily route at\n * execution time (the prior drift bug, see issue 1 of the Task 4.1 review).\n */\nimport { UGC_PRIMARY_HANDLE } from \"./ugc-node-wires.js\"\nimport { composeUnitRecord, composeUnitSet, unitFanOutEach, unitProducers } from \"./unit-contract-compose.js\"\n\n// Each producer set below is its hand-written members ∪ the node units\n// (tools/units/README.md) of that producer kind, from their generated contract\n// rows, in that order — a type in both throws at load (composeUnitSet).\n\n/**\n * Source node types whose primary output is a video URL.\n * Mirrors the backend execution-graph VIDEO_SOURCE_TYPES verbatim.\n */\nexport const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"VIDEO_PRODUCER_TYPES\", [\n \"image-to-video\",\n \"video-to-video\",\n \"switchx\", // Beeble SwitchX relight/composite\n \"text-to-video\",\n // Unified video node — emits videoUrl identically to i2v/t2v (its payload-builder\n // case dispatches dynamically to \"image-to-video\" or \"text-to-video\" jobName based\n // on whether a start frame is wired). Without this, getPrimaryOutput would fall\n // through to the imageUrl/videoUrl/audioUrl/text default and downstream consumers\n // could silently misroute the output.\n \"generate-video\",\n // Generate Video Pro — Seedance-2-family multi-segment stitch variant of\n // generate-video (same \"emits videoUrl\" contract; a trimmed provider +\n // handle set). Must mirror generate-video here or its output can't connect\n // downstream (the recurring \"cannot connect the outputs\" bug class).\n \"generate-video-pro\",\n // Edit Video Pro — Seedance-2-family span-replace sibling of generate-\n // video-pro (same \"emits videoUrl\" contract; source video + prompt in,\n // ONE video out). Must mirror generate-video-pro here or its output can't\n // connect downstream (the recurring \"cannot connect the outputs\" bug class).\n \"edit-video-pro\",\n \"upload-video\",\n \"youtube-video\",\n \"combine-videos\",\n \"lip-sync\",\n \"speech-to-video\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n \"extend-video\",\n // face-swap output is video (writes generatedVideoUrl, per-result `url`).\n // Frontend execution-graph already includes it in VIDEO_SOURCE_TYPES; this\n // entry brings the shared set in line so canvas typed-handle validation\n // doesn't reject face-swap → video-consumer edges that the orchestrator\n // would happily route at runtime.\n \"face-swap\",\n // Speaker View (C3.2): an EDL rendered with its speakers framed — one VIDEO\n // out (no audio-only render). Registered in RENDER_NODE_TYPES as well.\n \"speaker-view\",\n \"video-retake\",\n // video-sfx: adds an SFX track to a video → emits a video URL. Belongs here so\n // canvas handle validation accepts video-sfx → video-consumer edges and the\n // backend routes its output as video (it was previously relying on a fallback).\n \"video-sfx\",\n \"suno-music-video\",\n \"merge-video-audio\",\n \"add-captions\",\n \"resize-video\",\n \"social-media-format\",\n \"trim-video\",\n \"render-video\",\n \"speed-ramp\",\n \"loop-video\",\n \"fade-video\",\n // Video Mask emits its mask as a video; Mask Composite its composite.\n \"video-mask\",\n \"mask-composite\",\n \"transcode-video\",\n \"manual-edit\",\n // AI Avatar (HeyGen): avatar + voice/audio → video.\n \"ai-avatar\",\n // Cinematic Avatar (HeyGen cinematic_avatar): prompt + 1–3 avatar looks → video.\n \"cinematic-avatar\",\n // Assemble Narrated Video: fits N (clip, voice) blocks into one MP4 → video.\n \"assemble-narrated-video\",\n // Still to Video: one still image + one audio track → MP4 (local FFmpeg,\n // no provider). Emits generatedVideoUrl like every other ffmpeg video node.\n \"still-to-video\",\n // Slideshow: 2-100 stills + one optional audio track → MP4 (local FFmpeg,\n // no provider). Same contract; images arrive via the image-collage lane.\n \"slideshow\",\n // 3D Render Pro: authors a scene AND exports it in one operation, settling\n // with the standard `videoUrl` field. It is a video producer as much as it\n // is a composition producer — omitting it here is the \"cannot connect the\n // outputs\" bug, and its `composition` handle is typed separately.\n \"pro-3d-render\",\n // Video Overlay: timed image layers over a video in one local FFmpeg pass\n // (the base audio copied) — emits a video URL on `video-out`.\n \"video-overlay\",\n // UGC Clip: renders one clip of a UGC video from its ticket — emits a video\n // URL on `video-out` (one per fan-out iteration).\n \"ugc-clip\",\n // UGC Finish: the video's clips, finished, as one ordered list — a registered producer, so a\n // Bundle edge into Combine Videos routes each one as a video, in order.\n \"ugc-finish-clips\",\n], unitProducers(\"video\"))\n\n/**\n * Source node types whose output media-type cannot be classified\n * statically — iterators, dynamic dispatchers, sub-workflow wrappers.\n * The orchestrator decides their actual output type at execution time\n * based on what's wired upstream (loop iterates upstream column type;\n * sub-workflow emits its leaf node's type; adjust-volume passes through\n * video or audio based on its `lastInputType` runtime field;\n * voice-changer emits audio in audio mode, video+audio in video mode).\n *\n * Typed-handle validators (frontend/src/lib/{generate-image,generate-\n * video,ffmpeg}-handles.ts) must include these as acceptors on EVERY\n * media-typed input handle — otherwise the canvas validator hard-\n * rejects edges that the orchestrator would happily route at runtime.\n *\n * Lifted here from `frontend/src/lib/ffmpeg-handles.ts` (where the\n * escape hatch was first added) so the same set drives ALL handle\n * validators uniformly. Adding a new dynamic-output node type means\n * one edit here instead of N across sibling validator files.\n *\n * Intentionally OMITTED:\n * - `webhook-trigger` / `schedule-trigger` — their outputs are\n * user-defined JSON shapes, not media URLs. Accepting them as\n * media producers creates false-positive drops at the canvas\n * that fail at execution. Users wanting trigger → media flows\n * should wire through an upload node.\n */\nexport const DYNAMIC_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"DYNAMIC_PRODUCER_TYPES\", [\n \"list\",\n \"sub-workflow\",\n \"adjust-volume\",\n // Pitch & Tempo: audio in → audio out, video in → video out (picture\n // copied). Dual-mode like adjust-volume; stays in AUDIO_PRODUCER_TYPES as\n // its default.\n \"pitch-tempo\",\n // Dual-mode: audio in → audio out; video in → video out (+ revoiced audio).\n // Listed here so canvas validators accept its output on BOTH audio and video\n // input handles (it also stays in AUDIO_PRODUCER_TYPES as its default).\n \"voice-changer\",\n // voice-changer-pro (renamed from voice-recast in #3581) is a behavioral\n // twin of voice-changer — identical dual-mode output. Must mirror it in\n // EVERY producer set or its outputs can't connect (was the \"cannot connect\n // the outputs of voice-changer-pro\" bug). Guarded by producer-types.test.ts.\n \"voice-changer-pro\",\n // Dubbing joined the dual-mode family with the full-surface upgrade:\n // audio in → dubbed audio; video in (or a video sourceUrl) → dubbed VIDEO\n // (+ audio sidecar). Same wiring contract as voice-changer; stays in\n // AUDIO_PRODUCER_TYPES as its default. Explicitly asserted in\n // producer-types.test.ts (the suite does not fail on omission).\n \"dubbing\",\n \"reduce\",\n // Dual-output time chunker (UI label \"Split into Chunks\"; type id stays\n // \"split-media\"): video in → video chunks, audio in → audio chunks — two\n // independent lanes on two output handles. Like voice-changer, the canvas\n // validator only sees the source NODE type, not which handle a wire leaves,\n // so it lives here to be accepted on BOTH audio and video input handles. The\n // backend routes the correct lane by sourceHandle in getPrimaryOutput\n // (output-extractor.ts); the frontend does so in extractNodeOutput.\n \"split-media\",\n // apply-edl renders an EDL into ONE media output whose type is decided at\n // run time by the node's `output` setting (video OR audio) — so its static\n // medium is genuinely unknown and it belongs here, letting canvas validators\n // accept its default media handle on BOTH audio and video input handles. It\n // ALSO emits a fixed `json` handle (the remapped Transcript); that half lives\n // in JSON_PRODUCER_TYPES (frontend/src/lib/data-handles.ts). The FIRST node\n // with both a dynamic media handle and a fixed json handle. Because\n // getOutputType (presentation-utils.ts) deliberately returns \"data\" for\n // DYNAMIC members, apply-edl is ALSO added to the literal VIDEO_OUTPUT_TYPES\n // there so a published app renders the cut as video, mirroring the\n // voice-changer/dubbing precedent. Asserted in producer-types.test.ts (the\n // suite does not fail on omission).\n \"apply-edl\",\n], unitProducers(\"dynamic\"))\n\n/**\n * Source node types whose primary output is an audio URL.\n * Mirrors the backend execution-graph AUDIO_SOURCE_TYPES verbatim.\n */\nexport const AUDIO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"AUDIO_PRODUCER_TYPES\", [\n \"text-to-speech\",\n \"text-to-audio\",\n \"generate-music\",\n \"upload-audio\",\n \"suno-generate\",\n \"suno-cover\",\n \"suno-extend\",\n \"suno-separate\",\n \"audio-separation\",\n \"suno-mashup\",\n \"suno-replace-section\",\n \"suno-add-instrumental\",\n \"suno-add-vocals\",\n \"suno-convert-wav\",\n \"suno-upload-extend\",\n \"trim-audio\",\n \"mix-audio\",\n \"combine-audio\",\n \"adjust-volume\",\n \"audio-fx\",\n \"pitch-tempo\",\n \"reference-audio\",\n \"audio-isolation\",\n \"text-to-dialogue\",\n \"voice-changer\",\n // Twin of voice-changer (see DYNAMIC_PRODUCER_TYPES note). Audio is its\n // default output mode; video mode is handled via DYNAMIC membership.\n \"voice-changer-pro\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n // Extract Audio: demuxes a video's audio track to a standalone MP3.\n \"extract-audio\",\n], unitProducers(\"audio\"))\n\n/**\n * Source node types whose output is an IMAGE URL — what feeds a References\n * input. ONE set for the canvas validators (`frontend/src/lib/\n * generate-image-handles.ts` re-exports it), the backend's Generate Image\n * handle migration and the MCP edge normalizer (`llm-chat`'s legacy `in`):\n * they used to keep separate copies, and the backend's lagged by eight types.\n */\nexport const IMAGE_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"IMAGE_PRODUCER_TYPES\", [\n \"upload-image\", \"generate-image\", \"edit-image\", \"image-to-image\", \"modify-image\", \"upscale-image\", \"remove-background\",\n // extract-frame produces a single still image extracted from a video source.\n \"extract-frame\",\n // generate-mask emits the source image AND a mask PNG; its `image` source\n // pip is the passthrough (the same image as the input).\n \"generate-mask\",\n // paint-mask emits the hand-painted mask PNG (a plain image at runtime).\n // Membership is what makes mask targets accept it — mask is an advisory\n // color, not a gated type.\n \"paint-mask\",\n // reference-sheet's `sheet` is one composited image and `panels` carries\n // clean reference images; both resolve to image URLs at runtime.\n \"reference-sheet\",\n // reference-board's `image` pip emits a real generated board image.\n \"reference-board\",\n // image-collage composites N images → ONE image.\n \"image-collage\",\n // image-overlay places layers on a base → ONE image.\n \"image-overlay\",\n // 3D Render Pro's `stills` handle carries one PNG per shot of the exported\n // composition (spread into referenceImageUrls like reference-sheet\n // `panels`). A validator sees only the source NODE type, so this also makes\n // its `video` pip droppable on an image input — the handle-blind trade\n // reference-sheet and split-media already make; the input resolvers route\n // by handle, so only `stills` becomes an image at runtime. Deliberately NOT\n // in IMAGE_SOURCE_TYPES on either engine: that set types the node's PRIMARY\n // asset, and 3D Render Pro's is the MP4.\n \"pro-3d-render\",\n], unitProducers(\"image\"))\n\n/**\n * Source node types whose primary output is a LIST that, by default, fans out\n * one downstream execution per element when an edge leaves them WITHOUT an\n * explicit `outputMode` (all other edges default to \"last\"). `selector` is\n * included because its picked/rest channels are lists too.\n *\n * Single source of truth for the fan-out \"each\" default, consumed by:\n * - backend/src/services/workflow-engine/input-resolver.ts (DEFAULT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/types.ts (FAN_OUT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/node-input-resolver.ts\n *\n * These three previously kept independent copies; the backend copy drifted\n * (missing the four list-transform types), so server-side workflow runs\n * silently dropped all-but-the-first item for filter-list / deduplicate /\n * merge-lists / sort-list sources while the canvas fanned out N ways. Lifting\n * the set here makes that drift impossible.\n */\nexport const FAN_OUT_EACH_TYPES: ReadonlySet<string> = new Set([\n \"list\",\n \"split-text\",\n \"filter-list\",\n \"deduplicate\",\n \"merge-lists\",\n \"sort-list\",\n \"selector\",\n // edit-plan `clips` mode emits a bare `Edl[]` on `data.generatedJson`, so an\n // edge leaving it defaults to \"each\" — one downstream execution (typically an\n // apply-edl render) per clip. The `tighten`/`chapters` modes emit an OBJECT,\n // for which the list extractors return undefined, so an \"each\" edge falls back\n // to the scalar `edl` value (no fan-out) — the same graceful degradation\n // web-scrape relies on. See `unwrapEditPlanOutput` in `edit-plan-contract.ts`.\n \"edit-plan\",\n // Content Ideas emits one creative brief per idea on `listResults`, so an\n // edge leaving it defaults to \"each\" — the node after it (typically\n // Generate Script) runs once per idea, on the server too.\n \"content-ideas\",\n])\n\n/**\n * Per-HANDLE \"each\" defaults, for a node whose outputs differ in kind: on the\n * `each` handles an edge without an explicit `outputMode` defaults to \"each\",\n * on its other handles to \"last\". `primary` is the handle an edge with no\n * `sourceHandle` reads (agent-written workflow JSON often omits it).\n *\n * The list an \"each\" edge reads is the node's per-iteration results\n * (`listResults`) — it exists only when the node itself ran once per item, so\n * after a single run the edge degrades to the single value, exactly like a\n * `FAN_OUT_EACH_TYPES` member with one item.\n *\n * Its hand-written rows ∪ the node units' rows (`contract.fanOutEach`,\n * generated/unit-contracts.ts); a type in both refuses to load.\n */\nexport const FAN_OUT_EACH_HANDLES: Readonly<Record<string, { readonly each: readonly string[]; readonly primary: string }>> = composeUnitRecord(\"FAN_OUT_EACH_HANDLES\", {\n // Camera Switch run once per clip (Edit Plan in clips mode): each clip's\n // switched EDL is its own Apply EDL render. Its transcript is the same for\n // every clip (the master clock, renamed), so that handle stays one value\n // (decided 2026-10-04).\n \"camera-switch\": { each: [\"edl\"], primary: \"edl\" },\n // UGC Clips: one ticket per clip on `clips` (each); `plan-out` and\n // `transcript` carry one value. Not a FAN_OUT_EACH_TYPES member — every\n // handle of such a member would fan out. Its one run writes the tickets as\n // its list (`listResults`, the editor's `__listResults`). The pip an edge\n // with no handle reads is the UGC wires' own (UGC_PRIMARY_HANDLE).\n \"ugc-clips\": { each: [\"clips\"], primary: UGC_PRIMARY_HANDLE[\"ugc-clips\"]! },\n // A node unit declares its row in unit.json (contract.fanOutEach); it is added after these.\n}, unitFanOutEach())\n\n/**\n * Fan-out nodes whose iterations must ALL succeed: one failed item fails the\n * node (today's rule tolerates a partial list). UGC Clip — a missing clip\n * silently drops a beat from the script (spec R17). Already-started items\n * finish and settle; their jobs are reused on the next run.\n */\nexport const FAN_OUT_ALL_OR_NOTHING_TYPES: ReadonlySet<string> = new Set([\"ugc-clip\"])\n\n/**\n * Nodes whose saved list is the list their last run PRODUCED — `__listResults`\n * (Extract Field's JSON value on `generatedJson`) — and never a history in\n * `generatedResults`: Extract Field, JSON Process and Site Capture. No run of the first two writes\n * one; earlier builds' server runs did (the run's text, the links of a list of\n * links), and both engines' list readers leave it out for these two (decided\n * 2026-10-05). Single source of truth for the backend engine and the editor.\n */\nexport const OWN_LIST_NODE_TYPES: ReadonlySet<string> = new Set([\n \"extract-field\",\n \"json-process\",\n // Site Capture: its stills, in page order — the last capture's, never every capture's (site-capture-node.ts).\n \"site-capture\",\n])\n\n/** Whether a node's saved list is its own `__listResults`, never a history. */\nexport function ownsItsList(nodeType: string | null | undefined): boolean {\n return typeof nodeType === \"string\" && OWN_LIST_NODE_TYPES.has(nodeType)\n}\n\n/** The `outputMode` an edge has when none is set on it — the ONE rule both\n * engines, the credit estimate and the editor read. */\nexport function defaultEdgeOutputMode(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): \"each\" | \"last\" {\n if (typeof sourceType !== \"string\") return \"last\"\n if (FAN_OUT_EACH_TYPES.has(sourceType)) return \"each\"\n const entry = FAN_OUT_EACH_HANDLES[sourceType]\n if (!entry) return \"last\"\n return entry.each.includes(sourceHandle || entry.primary) ? \"each\" : \"last\"\n}\n\n/** Whether an edge from `sourceHandle` reads the node's per-iteration results\n * (`listResults` — each iteration's PRIMARY output). False on the other\n * handles of a `FAN_OUT_EACH_HANDLES` node: Camera Switch's transcript is one\n * value, never the list of switched EDLs, whatever mode its edge is set to. */\nexport function listResultsServeHandle(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): boolean {\n const entry = typeof sourceType === \"string\" ? FAN_OUT_EACH_HANDLES[sourceType] : undefined\n return !entry || entry.each.includes(sourceHandle || entry.primary)\n}\n\n/**\n * FAN-IN targets: nodes that FOLD everything wired into them into ONE run,\n * instead of running once per upstream item. Keyed by node type; the value\n * names the target handles that fold (`\"*\"` = every handle). An edge into any\n * other handle of such a node is routed normally — Content Ideas folds its\n * recipes but reads its brand from a `field-brand` wire like any field.\n *\n * Single source of truth for both engines' input resolvers (the backend and\n * the editor each used to keep a private `new Set([\"reduce\"])`). A fan-in\n * node is never itself fanned out by an upstream list.\n */\nexport const FAN_IN_TARGETS: Readonly<Record<string, \"*\" | readonly string[]>> = {\n // Choose Best — every wire is a candidate.\n reduce: \"*\",\n // Content Ideas — one or more recipes, from several Content Recipe nodes\n // and/or one that ran once per post.\n \"content-ideas\": [\"recipes\"],\n // Telegram Reply — one message per run, whatever is wired into its text\n // input: a list (or a writer that ran once per item) arrives as one\n // message, never as a burst of sends to the owner's chat.\n \"telegram-account-send\": [\"in\"],\n // The list operators — they READ the whole list wired into them (their\n // executors collect every upstream item themselves) and emit a list. Run\n // once per item by an \"each\" wire (a Split Text, a List, a node that ran per\n // item), every iteration saw the same whole list and answered with its\n // first match: a Filter List fed 11 stories handed 11 copies of story one\n // downstream, and every paid stage after it ran 11 times on it\n // (2026-10-06). A list operator is never fanned out, on any wire.\n \"filter-list\": \"*\",\n deduplicate: \"*\",\n \"merge-lists\": \"*\",\n \"sort-list\": \"*\",\n selector: \"*\",\n // Speaker Frames on a clip pack (P3-24 (a), decided 2026-10-06): ONE run over\n // the union of the clips' spans — the pack's EDLs fold onto its `edl` wire\n // instead of running one detection job (and one minimum charge) per clip.\n \"speaker-frames\": [\"edl\"],\n // UGC Finish: ONE run over every clip of the video, in clip order — the finish plans its\n // cut and its sound over all of them at once, so it is never run once per clip.\n \"ugc-finish-clips\": [\"clips\"],\n}\n\nexport function isFanInNodeType(nodeType: string | undefined | null): boolean {\n return typeof nodeType === \"string\" && Object.prototype.hasOwnProperty.call(FAN_IN_TARGETS, nodeType)\n}\n\n/** True when an edge into `targetHandle` of a `targetType` node is folded.\n * An edge with NO target handle (workflow JSON written by an agent often\n * omits it) lands on the node's primary input, which is the folding one. */\nexport function isFanInEdge(targetType: string | undefined | null, targetHandle: string | null | undefined): boolean {\n if (!isFanInNodeType(targetType)) return false\n const spec = FAN_IN_TARGETS[targetType as string]!\n if (spec === \"*\") return true\n return targetHandle == null || targetHandle === \"\" || spec.includes(targetHandle)\n}\n","/**\n * Exposed-field keys that were renamed to the node's real data field.\n *\n * A published app stores which fields it exposes as `{ type: \"field\", nodeId, field }` items in its\n * immutable snapshot settings, and external callers send `inputOverrides[nodeId][field]` with that same\n * string — it is part of the public wire contract (docs/embed-app-guide.md). Renaming a descriptor's key\n * must not strand the apps already published with the old spelling: they keep that string forever, so every\n * place that turns a stored key into a node-data key — or compares it with a descriptor key — goes through\n * `canonicalExposedFieldKey`.\n *\n * CLOSED LIST. A row needs a spelling that was published (a card that existed in apps) and a target the\n * node's descriptor now declares (the frontend guard `exposable-field-keys.test.ts` checks both). Only list a\n * field whose card cannot carry `allowedValues` (slider / toggle / text / color): the server validates\n * `allowedValues` against the stored key (backend routes/app-runner.ts `validateRestrictedFields`). Never list\n * a field of an outbound node type: the run-request override lock (backend lib/input-override-lock.ts) reads\n * the stored key, before this table renames it.\n */\nexport const LEGACY_EXPOSED_FIELD_KEYS: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n // Published as the Text to Speech slider's key. The node's data field, and every runner, route and config\n // panel, has always been `similarityBoost` — so the slider moved nothing.\n \"text-to-speech\": { similarity: \"similarityBoost\" },\n}\n\n/** The node-data key an exposed field's stored key stands for. Unknown node types and keys pass through. */\nexport function canonicalExposedFieldKey(nodeType: string | undefined, key: string): string {\n if (typeof nodeType !== \"string\" || !Object.hasOwn(LEGACY_EXPOSED_FIELD_KEYS, nodeType)) return key\n const renames = LEGACY_EXPOSED_FIELD_KEYS[nodeType]!\n return Object.hasOwn(renames, key) ? renames[key]! : key\n}\n\n/**\n * The override map with every legacy spelling replaced by its current key. When the caller sent both\n * spellings the current one wins (it is their current intent) and the legacy key is dropped — a dead key\n * is never written to node data. Returns the same object when nothing renames; never mutates.\n */\nexport function canonicalizeOverrideKeys(\n nodeType: string | undefined,\n overrides: Record<string, unknown>,\n): Record<string, unknown> {\n let out: Record<string, unknown> | undefined\n for (const key of Object.keys(overrides)) {\n const current = canonicalExposedFieldKey(nodeType, key)\n if (current === key) continue\n out ??= { ...overrides }\n delete out[key]\n if (!Object.hasOwn(overrides, current)) out[current] = overrides[key]\n }\n return out ?? overrides\n}\n","/**\n * The render-node registry (SV18, decided 2026-10-06): every node type that\n * turns an EDL into a finished file, and how each one behaves wherever the\n * platform gives a render its meaning — review and the Preview label, privacy,\n * the latest-batch reader, the owner-only listings, and what its `json` handle\n * carries.\n *\n * ONE registry, read by both engines, the editor, the listings and MCP, so a\n * second render (Speaker View) joins by adding one entry — never by finding\n * every `=== \"apply-edl\"`. The backend census test\n * (`render-node-census.test.ts`) fails a new `apply-edl` literal at any site\n * that is not pure registration of that node.\n *\n * The key is the node type AND the job name: a render's job is never renamed\n * (by quality or otherwise — only its credit id changes), so the same key\n * answers for `node.type` and for `jobs.job_type`.\n */\nimport { applyEdlCreditId, speakerViewCreditId, SPEAKER_VIEW_CREDIT_IDS } from \"./credit-identifiers.js\"\nimport type { RenderMedium } from \"./render-output.js\"\n\n/** Where a render's player maps the output clock back to the master clock\n * from: the EDL it was given (`input_data.edl`), or the EDL it emitted on its\n * `json` output (a render that rewrites its EDL, e.g. by splitting turns). */\nexport type RenderClockSource = \"input\" | \"output-json\"\n\n/** What a render's `json` output handle carries. Only a `transcript` is handed\n * on as one (Add Captions, the word-timing preflight). */\nexport type RenderJsonKind = \"transcript\" | \"edl\"\n\n/** Where a render's wired transcript, remapped through its cut, comes out\n * (Apply EDL's on its `json`; Speaker View's on its own `transcript` pip,\n * decided 2026-10-08). */\nexport interface RenderTranscriptOutput {\n /** The output pip — also the key it rides on the job's `output_data` and on\n * a run's node output. */\n readonly handle: string\n /** The saved node-data field that holds it (the landed take's). */\n readonly dataField: string\n}\n\n/** The pip a render's `json` output (its `jsonKind`) comes out on, and its key\n * on the job's `output_data`. */\nexport const RENDER_JSON_HANDLE = \"json\"\n\nexport interface RenderNodeDescriptor {\n /** The medium the render's order asks for (its node data, or its job's\n * `input_data`) — before any output exists to say. */\n readonly mediumOf: (data: Readonly<Record<string, unknown>>) => RenderMedium\n /** The credit id a render reserves on — a per-OUTPUT-MINUTE row: every\n * render is charged its row × the minutes it renders. Chosen from the\n * render's `quality` and `output` (as its node data or its job's request\n * carries them) and, for a render priced in tiers, the `priceTier` the\n * render rule judged it to be in (Speaker View's, decided 2026-10-10). A\n * tiered render given no tier names its dearer row. */\n readonly creditId: (quality: unknown, output?: unknown, priceTier?: unknown) => string\n /** Every id `creditId` can name (each must have a price row). */\n readonly creditIds: readonly string[]\n readonly clockMapFrom: RenderClockSource\n /** Listed in its owner's own views only, never in a public one (decided\n * 2026-10-06): a Preview is private, and a public final would be exposure\n * nobody decided. */\n readonly ownerOnlyListing: boolean\n /** An `each` wire reads its LATEST batch only, never its accumulated history\n * (TA6, decided 2026-10-04). */\n readonly latestBatch: boolean\n readonly jsonKind: RenderJsonKind\n /** Where its remapped transcript comes out. On the `json` pip exactly when\n * `jsonKind` is `transcript` (a guard test holds the two together). */\n readonly transcriptOutput: RenderTranscriptOutput\n}\n\ntype Data = Readonly<Record<string, unknown>>\n\n/** Its `output` setting, video when absent. */\nconst outputSettingMedium = (data: Data): RenderMedium => (data.output === \"audio\" ? \"audio\" : \"video\")\n\nconst descriptor = (d: RenderNodeDescriptor): RenderNodeDescriptor =>\n Object.freeze({ ...d, creditIds: Object.freeze([...d.creditIds]), transcriptOutput: Object.freeze({ ...d.transcriptOutput }) })\n\nexport const RENDER_NODE_TYPES: Readonly<Record<string, RenderNodeDescriptor>> = Object.freeze({\n \"apply-edl\": descriptor({\n mediumOf: outputSettingMedium,\n creditId: (quality) => applyEdlCreditId(quality),\n creditIds: [\"apply-edl\", \"apply-edl:proxy\"],\n clockMapFrom: \"input\",\n ownerOnlyListing: true,\n latestBatch: true,\n jsonKind: \"transcript\",\n transcriptOutput: { handle: RENDER_JSON_HANDLE, dataField: \"generatedJson\" },\n }),\n // Speaker View (C3.2): video only; its `json` is the EDL as it drew it (the\n // turns split, the layouts written), so a player maps the output clock\n // through THAT, and Add Captions never takes it for a Transcript. The wired\n // transcript, remapped through that same drawn edit, comes out on its own\n // `transcript` pip (decided 2026-10-08) — what a caption step reads.\n \"speaker-view\": descriptor({\n mediumOf: () => \"video\",\n creditId: (quality, _output, priceTier) => speakerViewCreditId(quality, priceTier),\n creditIds: SPEAKER_VIEW_CREDIT_IDS,\n clockMapFrom: \"output-json\",\n ownerOnlyListing: true,\n latestBatch: true,\n jsonKind: \"edl\",\n transcriptOutput: { handle: \"transcript\", dataField: \"generatedTranscript\" },\n }),\n})\n\n/** Every render node type, in registry order. */\nexport const RENDER_NODE_TYPE_IDS: readonly string[] = Object.freeze(Object.keys(RENDER_NODE_TYPES))\n\n/** The descriptor of a render node type (or job name); `undefined` for any\n * other value. Own keys only, so `\"constructor\"` is not a render. */\nexport function renderNodeOf(type: unknown): RenderNodeDescriptor | undefined {\n return typeof type === \"string\" && Object.hasOwn(RENDER_NODE_TYPES, type) ? RENDER_NODE_TYPES[type] : undefined\n}\n\n/** Is this node type (or job name) a render? */\nexport function isRenderNodeType(type: unknown): type is string {\n return renderNodeOf(type) !== undefined\n}\n\n/** Does an `each` wire from this node read its latest batch only? */\nexport function rendersLatestBatch(type: unknown): boolean {\n return renderNodeOf(type)?.latestBatch === true\n}\n\n/** Is this node a render whose `json` output is a Transcript? */\nexport function rendersTranscriptJson(type: unknown): boolean {\n return renderNodeOf(type)?.jsonKind === \"transcript\"\n}\n\n/** Where a render's remapped transcript comes out; `undefined` for any other\n * node type. */\nexport function renderTranscriptOutputOf(type: unknown): RenderTranscriptOutput | undefined {\n return renderNodeOf(type)?.transcriptOutput\n}\n\n/** Is `handle` one of a render's data pips — its `json` or its transcript —\n * rather than its media? Every other pip of a render (the default included)\n * is the rendered media. `false` for any other node type. */\nexport function isRenderDataHandle(type: unknown, handle: unknown): boolean {\n const d = renderNodeOf(type)\n if (!d || typeof handle !== \"string\") return false\n return handle === RENDER_JSON_HANDLE || handle === d.transcriptOutput.handle\n}\n\n/** One json output a render lands on its node: its key on the job's\n * `output_data` (and on a run's node output) and its saved node-data field. */\nexport interface RenderSavedJsonOutput {\n readonly outputKey: string\n readonly dataField: string\n}\n\n/** The json outputs a render lands on its node, `json` first, each once — what\n * every lane that lands a take (or picks one) writes or restores. Empty for\n * any other node type. */\nexport function renderSavedJsonOutputs(type: unknown): readonly RenderSavedJsonOutput[] {\n const d = renderNodeOf(type)\n if (!d) return []\n const json: RenderSavedJsonOutput = { outputKey: RENDER_JSON_HANDLE, dataField: \"generatedJson\" }\n const t = d.transcriptOutput\n return t.handle === RENDER_JSON_HANDLE ? [json] : [json, { outputKey: t.handle, dataField: t.dataField }]\n}\n\n/** The render job types that list in their owner's own views only. */\nexport const OWNER_ONLY_LISTING_RENDER_TYPES: readonly string[] = Object.freeze(\n RENDER_NODE_TYPE_IDS.filter((t) => RENDER_NODE_TYPES[t]!.ownerOnlyListing),\n)\n","/**\n * Presentation / API utilities — pure logic, no React deps.\n * Shared between frontend (presentation mode) and backend (API schema generation).\n */\n\nimport type { GenericNode, GenericEdge } from \"./types.js\"\nimport type { PresentationItem } from \"./presentation-types.js\"\nimport { AUDIO_PRODUCER_TYPES, VIDEO_PRODUCER_TYPES } from \"./producer-types.js\"\nimport { canonicalizeOverrideKeys } from \"./exposed-field-keys.js\"\nimport { RENDER_NODE_TYPE_IDS } from \"./render-nodes.js\"\nimport { dropStaleVideoLinkFields } from \"./video-link.js\"\nimport { composeUnitSet, unitsPresenting } from \"./unit-contract-compose.js\"\n\n// ---------------------------------------------------------------------------\n// Node type sets\n// ---------------------------------------------------------------------------\n\nexport const INPUT_NODE_TYPES = new Set([\n \"text-prompt\",\n \"upload-image\",\n \"upload-video\",\n \"upload-audio\",\n \"tone\",\n \"style-guide\",\n \"provider\",\n \"scene-count\",\n \"duration\",\n \"aspect-ratio\",\n \"motion\",\n \"camera-motion\",\n \"framing\",\n \"lens\",\n \"camera-format\",\n \"lighting\",\n \"color-look\",\n \"atmosphere\",\n \"action-fx\",\n \"temporal\",\n \"reference-audio\",\n \"youtube-video\",\n])\n\nconst TRIGGER_NODE_TYPES = new Set([\n \"webhook-trigger\",\n \"schedule-trigger\",\n])\n\nconst ALWAYS_EXCLUDED_TYPES = new Set([\n \"sticky-note\",\n \"webhook-trigger\",\n \"schedule-trigger\",\n \"sub-workflow-input\",\n \"sub-workflow-output\",\n])\n\nconst NON_OUTPUT_TYPES = new Set([\n \"text-prompt\",\n \"list\",\n \"upload-image\",\n \"upload-video\",\n \"upload-audio\",\n \"reference-audio\",\n \"rss-feed\",\n \"youtube-video\",\n \"tone\",\n \"style-guide\",\n \"provider\",\n \"scene-count\",\n \"duration\",\n \"aspect-ratio\",\n \"motion\",\n \"camera-motion\",\n \"framing\",\n \"lens\",\n \"camera-format\",\n \"lighting\",\n \"color-look\",\n \"atmosphere\",\n \"action-fx\",\n \"temporal\",\n \"sticky-note\",\n \"sub-workflow-input\",\n \"sub-workflow-output\",\n \"webhook-trigger\",\n \"schedule-trigger\",\n \"combine-text\",\n \"split-text\",\n \"save-to-storage\",\n \"webhook-output\",\n \"component\",\n])\n\n/**\n * Node types that count as an output even when something is wired to their\n * output handle (the legacy `presentationVisible` rule below).\n *\n * A hand-kept list, and one the platform has outgrown: it is unioned at the use\n * site with the producer vocabularies the canvas validators already maintain\n * (see `isMediaProducingType`), so a new media node is covered by the set it\n * must join anyway rather than by remembering to edit this one.\n */\nconst MEDIA_PRODUCING_TYPES = new Set([\n \"generate-image\",\n \"edit-image\",\n \"image-to-image\",\n \"image-to-video\",\n \"text-to-video\",\n \"video-to-video\",\n \"text-to-speech\",\n \"generate-music\",\n \"text-to-audio\",\n \"generate-script\",\n \"ai-writer\",\n \"llm-chat\",\n \"render-video\",\n \"video-composer\",\n \"after-effects\",\n \"lottie-overlay\",\n \"3d-title\",\n \"motion-graphics\",\n \"composite\",\n \"text-to-dialogue\",\n \"voice-changer\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n \"extend-video\",\n \"lip-sync\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n])\n\n// Output type categorizations — each the hand-written list ∪ the node units\n// that declare the same presentation (contract.presents, generated rows); a\n// type in both throws at load (composeUnitSet).\nconst IMAGE_OUTPUT_TYPES = composeUnitSet(\"IMAGE_OUTPUT_TYPES\", [\n \"generate-image\", \"edit-image\", \"image-to-image\",\n \"upload-image\",\n], unitsPresenting(\"image\"))\n\n/**\n * Video-output types NOT already declared by `VIDEO_PRODUCER_TYPES` — the two\n * are unioned in `getOutputType`, which is where the reading order (and the\n * reason the literal sets win) is documented.\n */\nconst VIDEO_OUTPUT_TYPES = composeUnitSet(\"VIDEO_OUTPUT_TYPES\", [\n \"image-to-video\", \"text-to-video\", \"video-to-video\", \"extend-video\",\n \"render-video\", \"video-composer\", \"after-effects\", \"lottie-overlay\",\n \"3d-title\", \"motion-graphics\", \"composite\",\n \"combine-videos\", \"merge-video-audio\", \"resize-video\", \"trim-video\",\n \"speed-ramp\", \"loop-video\", \"fade-video\", \"transcode-video\",\n \"upload-video\",\n \"lip-sync\", \"motion-transfer\", \"video-upscale\", \"video-depth\", \"add-captions\",\n \"social-media-format\",\n // A render (Apply EDL) renders an EDL into video OR audio. Its medium is\n // decided at run time (DYNAMIC_PRODUCER_TYPES), so getOutputType would answer\n // \"data\" and a published app would render the cut as a JSON blob. Declaring\n // every render here — as the voice-changer/dubbing precedent does for their\n // default medium — makes the classifier answer \"video\" (the common case; an\n // audio-only cut still plays in a video element). Asserted in\n // producer-types.test.ts.\n ...RENDER_NODE_TYPE_IDS,\n], unitsPresenting(\"video\"))\n\nconst AUDIO_OUTPUT_TYPES = composeUnitSet(\"AUDIO_OUTPUT_TYPES\", [\n \"text-to-speech\", \"generate-music\", \"text-to-audio\",\n \"text-to-dialogue\", \"voice-changer\", \"dubbing\", \"voice-remix\",\n \"voice-design\", \"mix-audio\", \"adjust-volume\", \"audio-fx\", \"pitch-tempo\", \"trim-audio\",\n \"audio-isolation\",\n \"audio-separation\",\n \"upload-audio\",\n], unitsPresenting(\"audio\"))\n\nconst TEXT_OUTPUT_TYPES = composeUnitSet(\"TEXT_OUTPUT_TYPES\", [\n \"generate-script\", \"ai-writer\", \"llm-chat\", \"transcribe\", \"image-to-text\", \"qa-check\",\n \"text-prompt\",\n // UGC Cards' output card is its Notes: a run hands it on as the node's text\n // (`output.text`, `generatedText` on the canvas).\n \"ugc-cards\",\n], unitsPresenting(\"text\"))\n\n// ---------------------------------------------------------------------------\n// Output type enum\n// ---------------------------------------------------------------------------\n\nexport type OutputType = \"image\" | \"video\" | \"audio\" | \"text\" | \"data\"\n\n// ---------------------------------------------------------------------------\n// Core functions\n// ---------------------------------------------------------------------------\n\n/** Get nodes that act as user inputs (text prompts, uploads, parameters). */\nexport function getInputNodes<T extends GenericNode>(nodes: T[], curatedOnly = true): T[] {\n return nodes.filter((n) => {\n if (!n.type || ALWAYS_EXCLUDED_TYPES.has(n.type)) return false\n if (n.hidden) return false\n if (curatedOnly) {\n // New explicit flag\n if (n.data.presentationInput === true) return true\n // Backwards compat: old flag on input-type nodes\n if (n.data.presentationVisible === true && INPUT_NODE_TYPES.has(n.type)) return true\n return false\n }\n return true\n })\n}\n\n/** Get leaf/media-producing nodes that represent workflow outputs. */\nexport function getOutputNodes<T extends GenericNode>(\n nodes: T[],\n edges: GenericEdge[],\n curatedOnly = true,\n): T[] {\n const nodesWithOutgoing = new Set(edges.map((e) => e.source))\n\n return nodes.filter((n) => {\n if (!n.type || ALWAYS_EXCLUDED_TYPES.has(n.type)) return false\n if (n.hidden) return false\n if (curatedOnly) {\n // New explicit flag\n if (n.data.presentationOutput === true) return true\n // Backwards compat: old flag on output-eligible nodes\n if (n.data.presentationVisible === true) {\n if (NON_OUTPUT_TYPES.has(n.type)) return false\n return !nodesWithOutgoing.has(n.id) || isMediaProducingType(n.type)\n }\n return false\n }\n return true\n })\n}\n\n/**\n * Map node type to its output media type.\n *\n * The four literal sets above are read FIRST and win: they are the presentation\n * classifier's own opinion, including for dual-mode nodes whose default medium\n * is not their handle set (voice-changer and dubbing are audio here even though\n * they can emit video).\n *\n * Anything they do not name falls through to the producer vocabularies the\n * canvas validators and the orchestrator already maintain\n * (`packages/shared/src/producer-types.ts`). Those sets are what a new media\n * node MUST join for its outputs to connect at all, so deriving the tail from\n * them is what stops this map from silently drifting behind the node catalogue\n * — which it had (3D Render Pro, Generate Video, Generate Video Pro and a dozen\n * ffmpeg nodes all read as `\"data\"`, so a published app rendered them as a JSON\n * blob and `/v1` app schemas declared the wrong output type).\n *\n * `DYNAMIC_PRODUCER_TYPES` is deliberately NOT consulted: a node whose medium\n * is decided at run time has no static answer, and `\"data\"` is the honest one.\n */\nexport function getOutputType(nodeType: string | undefined): OutputType {\n if (!nodeType) return \"data\"\n if (IMAGE_OUTPUT_TYPES.has(nodeType)) return \"image\"\n if (VIDEO_OUTPUT_TYPES.has(nodeType)) return \"video\"\n if (AUDIO_OUTPUT_TYPES.has(nodeType)) return \"audio\"\n if (TEXT_OUTPUT_TYPES.has(nodeType)) return \"text\"\n if (VIDEO_PRODUCER_TYPES.has(nodeType)) return \"video\"\n if (AUDIO_PRODUCER_TYPES.has(nodeType)) return \"audio\"\n return \"data\"\n}\n\n/**\n * Whether a node produces media of its own — the test the legacy\n * `presentationVisible` rule uses to keep a media node as an OUTPUT even when\n * it also feeds something downstream.\n *\n * Same union, same reason as `getOutputType`: the hand-kept list plus the\n * producer vocabularies. Text producers stay where the literal list put them\n * (`generate-script`, `ai-writer`, `llm-chat` are members; `transcribe` and\n * `qa-check` are not) — this is about media, not about every node with a value.\n */\nfunction isMediaProducingType(nodeType: string): boolean {\n if (MEDIA_PRODUCING_TYPES.has(nodeType)) return true\n const output = getOutputType(nodeType)\n return output === \"image\" || output === \"video\" || output === \"audio\"\n}\n\n/** Extract the result URL or text from a node's data. */\nexport function getNodeResult(\n nodeData: Record<string, unknown>,\n): { url?: string; text?: string } {\n // Preview node: extract first visible item from previewItems\n const previewItems = nodeData.previewItems as\n | Array<{ type: string; value: string; visible?: boolean }>\n | undefined\n if (previewItems && previewItems.length > 0) {\n const first = previewItems.find((item) => item.visible !== false) ?? previewItems[0]\n if (first) {\n if (first.type === \"image\" || first.type === \"video\" || first.type === \"audio\") {\n return { url: first.value }\n }\n return { text: first.value }\n }\n }\n\n const results = nodeData.generatedResults as\n | Array<Record<string, unknown>>\n | undefined\n\n if (results && results.length > 0) {\n const idx = (nodeData.activeResultIndex as number) ?? 0\n const active = results[idx] ?? results[0]\n const url = (active?.url ?? active?.imageUrl ?? active?.videoUrl ?? active?.audioUrl) as\n | string\n | undefined\n const text = (active?.text ?? active?.script) as string | undefined\n return { url, text }\n }\n\n // Fallback to individual generated fields\n const url = (nodeData.generatedImageUrl ??\n nodeData.generatedVideoUrl ??\n nodeData.generatedAudioUrl) as string | undefined\n const text = (nodeData.generatedScript ?? nodeData.generatedText) as\n | string\n | undefined\n\n return { url, text }\n}\n\n/** Human-readable label for a node. */\nexport function getNodeLabel(node: GenericNode): string {\n return (\n (node.data.label as string) ||\n node.type?.replace(/-/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase()) ||\n \"Node\"\n )\n}\n\n// ---------------------------------------------------------------------------\n// Input field schema (for API schema generation)\n// ---------------------------------------------------------------------------\n\nexport interface InputFieldSchema {\n key: string\n type: \"text\" | \"image-url\" | \"video-url\" | \"audio-url\" | \"select\" | \"number\"\n options?: string[]\n}\n\n// Override field per input-node type. The `key` for a parameter-picker MUST be\n// the field that `getParameterValue()` (parameter-node-value.ts) actually reads\n// — for multi-dimension pickers, its FIRST per-dimension field (the\n// \"representative key\"). A mismatch silently drops the curated app/MCP/SDK input\n// (the override lands on a field nothing reads). This map is the single source\n// of truth for app-input override fields (consumed by extract-app-inputs.ts,\n// api-tokens.ts, and the app-runner). Its parity with getParameterValue is\n// guarded by input-field-map-parity.test.ts so the two can't drift.\nexport const INPUT_FIELD_MAP: Record<string, InputFieldSchema> = {\n // --- Source / upload nodes (not parameter pickers) ---\n \"text-prompt\": { key: \"text\", type: \"text\" },\n \"upload-image\": { key: \"url\", type: \"image-url\" },\n \"upload-video\": { key: \"url\", type: \"video-url\" },\n \"upload-audio\": { key: \"url\", type: \"audio-url\" },\n \"reference-audio\": { key: \"extractedAudioUrl\", type: \"audio-url\" },\n // A LINK, not an upload (rule: `videoLinkInputProblem`, video-link.ts); still a `video-url` media input.\n \"youtube-video\": { key: \"youtubeUrl\", type: \"video-url\" },\n // --- Classic parameters ---\n \"provider\": { key: \"provider\", type: \"select\" },\n \"style-guide\": { key: \"text\", type: \"text\" }, // reads data.text (was wrongly \"styleGuide\")\n \"scene-count\": { key: \"count\", type: \"number\" },\n \"duration\": { key: \"seconds\", type: \"number\" }, // reads data.seconds (was wrongly \"duration\")\n \"aspect-ratio\": { key: \"ratio\", type: \"select\" }, // reads data.ratio (was wrongly \"aspectRatio\")\n // --- Single-field parameter pickers ---\n \"tone\": { key: \"tone\", type: \"select\" },\n \"motion\": { key: \"motion\", type: \"select\" },\n \"camera-motion\": { key: \"cameraMotion\", type: \"select\" },\n \"lens\": { key: \"lens\", type: \"select\" },\n \"camera-format\": { key: \"cameraFormat\", type: \"select\" },\n \"color-look\": { key: \"colorLook\", type: \"select\" },\n \"atmosphere\": { key: \"atmosphere\", type: \"select\" },\n \"style\": { key: \"style\", type: \"select\" },\n \"setting\": { key: \"setting\", type: \"select\" },\n \"mood\": { key: \"mood\", type: \"select\" },\n \"photographer\": { key: \"photographer\", type: \"select\" },\n \"aesthetic\": { key: \"aesthetic\", type: \"select\" },\n \"era\": { key: \"era\", type: \"select\" },\n \"material\": { key: \"material\", type: \"select\" },\n \"animal\": { key: \"animal\", type: \"select\" },\n \"vehicle\": { key: \"vehicle\", type: \"select\" },\n \"weapon\": { key: \"weapon\", type: \"select\" },\n \"furniture\": { key: \"furniture\", type: \"select\" },\n \"photo-genre\": { key: \"photoGenre\", type: \"select\" },\n \"backdrop\": { key: \"backdrop\", type: \"select\" },\n \"held-prop\": { key: \"heldProp\", type: \"select\" },\n \"render-quality\": { key: \"renderQuality\", type: \"select\" },\n \"composition-effects\": { key: \"compositionEffect\", type: \"select\" },\n \"post-process-effects\": { key: \"postProcess\", type: \"select\" },\n \"action-fx\": { key: \"actionFx\", type: \"select\" },\n \"character-fx\": { key: \"characterFx\", type: \"select\" },\n \"character-motion\": { key: \"characterMotion\", type: \"select\" },\n \"transition\": { key: \"transition\", type: \"select\" },\n \"loop-subject\": { key: \"loopSubject\", type: \"select\" },\n // --- Multi-dimension pickers: representative (first) field. Overriding only\n // sets that dimension; full hint composition runs in the executors. ---\n \"framing\": { key: \"shotSize\", type: \"select\" },\n \"lighting\": { key: \"timeOfDay\", type: \"select\" },\n \"temporal\": { key: \"temporalSpeed\", type: \"select\" },\n \"person\": { key: \"type\", type: \"select\" },\n \"pose\": { key: \"pose\", type: \"select\" },\n \"styling\": { key: \"makeup\", type: \"select\" },\n \"exposure-settings\": { key: \"aperture\", type: \"select\" },\n \"music-genre\": { key: \"subgenre\", type: \"select\" },\n \"music-mood\": { key: \"emotion\", type: \"select\" },\n \"instrumentation\": { key: \"production\", type: \"select\" },\n \"voice-character\": { key: \"timbre\", type: \"select\" },\n \"voice-delivery\": { key: \"archetype\", type: \"select\" },\n // --- UGC (Cloud) ---\n \"ugc-creator\": { key: \"source\", type: \"select\" },\n}\n\n/**\n * Extra API-settable keys for node types whose card writes more than one field\n * (INPUT_FIELD_MAP is one key per node type). Read by extract-app-inputs and the\n * app runner; every key here must be in UGC_OVERRIDABLE_FIELDS for a UGC type.\n */\nexport const INPUT_FIELD_EXTRA_KEYS: Readonly<Record<string, readonly InputFieldSchema[]>> = {\n \"ugc-creator\": [{ key: \"gender\", type: \"select\" }, { key: \"photoUrl\", type: \"image-url\" }],\n // The script's language: changes together with UGC_OVERRIDABLE_FIELDS[\"ugc-script\"] and UgcScriptData.language.\n \"ugc-script\": [{ key: \"language\", type: \"select\" }],\n}\n\n/** The extra override fields of a node type (none for most types). */\nexport function getInputFieldExtraKeys(nodeType: string): readonly InputFieldSchema[] {\n return Object.hasOwn(INPUT_FIELD_EXTRA_KEYS, nodeType) ? INPUT_FIELD_EXTRA_KEYS[nodeType]! : []\n}\n\n/** Get the overridable field schema for an input node type. */\nexport function getInputFieldSchema(nodeType: string): InputFieldSchema | undefined {\n return INPUT_FIELD_MAP[nodeType]\n}\n\nconst MEDIA_INPUT_FIELD_TYPES: ReadonlySet<InputFieldSchema[\"type\"]> = new Set([\n \"image-url\",\n \"video-url\",\n \"audio-url\",\n])\n\n/**\n * Shallow-merge run-time input overrides (a published app's inputs, an API-token\n * run, MCP `run_app` / `run_workflow` inputs, a wired component handle) over a\n * node's SAVED data — the one merge every such lane must use.\n *\n * `metadata` holds facts measured FROM the node's media (its length, its\n * dimensions). When an override swaps that media — the node's primary input\n * field is a media url (`INPUT_FIELD_MAP`) and the override changes it — the\n * snapshot's facts describe a file that is no longer there, so they are dropped\n * unless the override supplies its own. Left behind, a publisher's\n * `metadata.durationSeconds` outranks the run's own transcript as Edit Plan's\n * duration basis and under-buckets a caller's longer episode: an estimate that\n * passes the balance precheck for a run the reserve then refuses.\n *\n * Schema-driven on purpose: a new media input node is covered by its\n * `INPUT_FIELD_MAP` row, with no list to remember here.\n *\n * An override sent under a renamed exposed-field key (an app published before\n * the rename) lands on the node's current field — `canonicalizeOverrideKeys`.\n *\n * An override of `null` clears the field: the merged node has no such key.\n */\nexport function mergeNodeInputOverrides(\n nodeType: string | undefined,\n data: Record<string, unknown>,\n overrides: Record<string, unknown>,\n): Record<string, unknown> {\n const incoming = canonicalizeOverrideKeys(nodeType, overrides)\n // A Video URL node on a new link sheds what was fetched for the old one.\n const base = nodeType === \"youtube-video\" ? dropStaleVideoLinkFields(data, incoming) : data\n const merged: Record<string, unknown> = { ...base, ...incoming }\n // A null override CLEARS the field: the run has no value there, neither null nor the saved one. JSON cannot\n // carry `undefined`, so this is how a run says \"unset\" (an app card clearing a lever the chosen model lacks).\n for (const [key, value] of Object.entries(incoming)) {\n if (value === null) delete merged[key]\n }\n const schema = nodeType ? INPUT_FIELD_MAP[nodeType] : undefined\n if (\n schema &&\n MEDIA_INPUT_FIELD_TYPES.has(schema.type) &&\n schema.key in overrides &&\n overrides[schema.key] !== data[schema.key] &&\n !(\"metadata\" in overrides)\n ) {\n delete merged.metadata\n }\n return merged\n}\n\n// ---------------------------------------------------------------------------\n// Migration & validation helpers (PresentationItem)\n// ---------------------------------------------------------------------------\n\n/** Migrate a legacy string[] order to PresentationItem[]. */\nexport function migrateToItems(order: string[] | undefined): PresentationItem[] | undefined {\n if (!order) return undefined\n return order.map((nodeId) => ({ type: \"node\" as const, nodeId }))\n}\n\n/** Strip nested groups — groups may only contain non-group items. */\nexport function validateNoNestedGroups(items: PresentationItem[]): PresentationItem[] {\n return items.map((item) => {\n if (item.type === \"group\") {\n return { ...item, items: item.items.filter((child) => child.type !== \"group\") }\n }\n return item\n })\n}\n\n/** Recursively flatten all items, unwrapping groups. */\nexport function flattenItems(items: PresentationItem[]): PresentationItem[] {\n const result: PresentationItem[] = []\n for (const item of items) {\n if (item.type === \"group\") {\n result.push(...flattenItems(item.items))\n } else {\n result.push(item)\n }\n }\n return result\n}\n\n/** Get the sortable/unique ID for a PresentationItem. */\nexport function getItemSortId(item: PresentationItem): string {\n return item.type === \"node\" ? item.nodeId : item.id\n}\n\n/** Remove items whose nodeId no longer exists in the workflow. */\nexport function cleanOrphanedItems(\n items: PresentationItem[],\n nodeIds: Set<string>\n): PresentationItem[] {\n return items\n .filter((item) => {\n if (item.type === \"node\" || item.type === \"field\" || item.type === \"output\") return nodeIds.has(item.nodeId)\n return true\n })\n .map((item) => {\n if (item.type === \"group\") {\n return { ...item, items: cleanOrphanedItems(item.items, nodeIds) }\n }\n return item\n })\n}\n"]}
1
+ {"version":3,"sources":["../src/producer-types.ts","../src/exposed-field-keys.ts","../src/render-nodes.ts","../src/presentation-utils.ts"],"names":["composeUnitSet","unitProducers","composeUnitRecord","UGC_PRIMARY_HANDLE","unitFanOutEach","applyEdlCreditId","speakerViewCreditId","SPEAKER_VIEW_CREDIT_IDS","unitsPresenting","url","text","dropStaleVideoLinkFields"],"mappings":";;;;;;;;AA2BO,IAAM,oBAAA,GAA4CA,iCAAe,sBAAA,EAAwB;AAAA,EAC9F,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,oBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA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MAAM,CAAA;AAC3G,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA,CACA,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,IAAA,IAAI,IAAA,CAAK,SAAS,OAAA,EAAS;AACzB,MAAA,OAAO,EAAE,GAAG,IAAA,EAAM,KAAA,EAAO,mBAAmB,IAAA,CAAK,KAAA,EAAO,OAAO,CAAA,EAAE;AAAA,IACnE;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA;AACL","file":"chunk-WVACGZYV.cjs","sourcesContent":["/**\n * Producer-type sets — single source of truth for the node types whose\n * primary output is a video URL, audio URL, etc.\n *\n * Consumed by:\n * - backend/src/services/workflow-engine/execution-graph.ts (orchestrator\n * dispatch + asset-type tagging in payload-builder, output-extractor,\n * inline-executor — re-exported there as VIDEO_SOURCE_TYPES /\n * AUDIO_SOURCE_TYPES for backwards compatibility).\n * - frontend/src/lib/generate-video-handles.ts (handle connection\n * validation on the Generate Video node).\n *\n * Lifting these here ensures the frontend handle validator can never reject\n * a connection from a node type that the backend would happily route at\n * execution time (the prior drift bug, see issue 1 of the Task 4.1 review).\n */\nimport { UGC_PRIMARY_HANDLE } from \"./ugc-node-wires.js\"\nimport { composeUnitRecord, composeUnitSet, unitFanOutEach, unitProducers } from \"./unit-contract-compose.js\"\n\n// Each producer set below is its hand-written members ∪ the node units\n// (tools/units/README.md) of that producer kind, from their generated contract\n// rows, in that order — a type in both throws at load (composeUnitSet).\n\n/**\n * Source node types whose primary output is a video URL.\n * Mirrors the backend execution-graph VIDEO_SOURCE_TYPES verbatim.\n */\nexport const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"VIDEO_PRODUCER_TYPES\", [\n \"image-to-video\",\n \"video-to-video\",\n \"switchx\", // Beeble SwitchX relight/composite\n \"text-to-video\",\n // Unified video node — emits videoUrl identically to i2v/t2v (its payload-builder\n // case dispatches dynamically to \"image-to-video\" or \"text-to-video\" jobName based\n // on whether a start frame is wired). Without this, getPrimaryOutput would fall\n // through to the imageUrl/videoUrl/audioUrl/text default and downstream consumers\n // could silently misroute the output.\n \"generate-video\",\n // Generate Video Pro — Seedance-2-family multi-segment stitch variant of\n // generate-video (same \"emits videoUrl\" contract; a trimmed provider +\n // handle set). Must mirror generate-video here or its output can't connect\n // downstream (the recurring \"cannot connect the outputs\" bug class).\n \"generate-video-pro\",\n // Edit Video Pro — Seedance-2-family span-replace sibling of generate-\n // video-pro (same \"emits videoUrl\" contract; source video + prompt in,\n // ONE video out). Must mirror generate-video-pro here or its output can't\n // connect downstream (the recurring \"cannot connect the outputs\" bug class).\n \"edit-video-pro\",\n \"upload-video\",\n \"youtube-video\",\n \"combine-videos\",\n \"lip-sync\",\n \"speech-to-video\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n \"extend-video\",\n // face-swap output is video (writes generatedVideoUrl, per-result `url`).\n // Frontend execution-graph already includes it in VIDEO_SOURCE_TYPES; this\n // entry brings the shared set in line so canvas typed-handle validation\n // doesn't reject face-swap → video-consumer edges that the orchestrator\n // would happily route at runtime.\n \"face-swap\",\n // Speaker View (C3.2): an EDL rendered with its speakers framed — one VIDEO\n // out (no audio-only render). Registered in RENDER_NODE_TYPES as well.\n \"speaker-view\",\n \"video-retake\",\n // video-sfx: adds an SFX track to a video → emits a video URL. Belongs here so\n // canvas handle validation accepts video-sfx → video-consumer edges and the\n // backend routes its output as video (it was previously relying on a fallback).\n \"video-sfx\",\n \"suno-music-video\",\n \"merge-video-audio\",\n \"add-captions\",\n \"resize-video\",\n \"social-media-format\",\n \"trim-video\",\n \"render-video\",\n \"speed-ramp\",\n \"loop-video\",\n \"fade-video\",\n // Video Mask emits its mask as a video; Mask Composite its composite.\n \"video-mask\",\n \"mask-composite\",\n \"transcode-video\",\n \"manual-edit\",\n // AI Avatar (HeyGen): avatar + voice/audio → video.\n \"ai-avatar\",\n // Cinematic Avatar (HeyGen cinematic_avatar): prompt + 1–3 avatar looks → video.\n \"cinematic-avatar\",\n // Assemble Narrated Video: fits N (clip, voice) blocks into one MP4 → video.\n \"assemble-narrated-video\",\n // Still to Video: one still image + one audio track → MP4 (local FFmpeg,\n // no provider). Emits generatedVideoUrl like every other ffmpeg video node.\n \"still-to-video\",\n // Slideshow: 2-100 stills + one optional audio track → MP4 (local FFmpeg,\n // no provider). Same contract; images arrive via the image-collage lane.\n \"slideshow\",\n // 3D Render Pro: authors a scene AND exports it in one operation, settling\n // with the standard `videoUrl` field. It is a video producer as much as it\n // is a composition producer — omitting it here is the \"cannot connect the\n // outputs\" bug, and its `composition` handle is typed separately.\n \"pro-3d-render\",\n // Video Overlay: timed image layers over a video in one local FFmpeg pass\n // (the base audio copied) — emits a video URL on `video-out`.\n \"video-overlay\",\n // UGC Clip: renders one clip of a UGC video from its ticket — emits a video\n // URL on `video-out` (one per fan-out iteration).\n \"ugc-clip\",\n // UGC Finish: the video's clips, finished, as one ordered list — a registered producer, so a\n // Bundle edge into Combine Videos routes each one as a video, in order.\n \"ugc-finish-clips\",\n], unitProducers(\"video\"))\n\n/**\n * Source node types whose output media-type cannot be classified\n * statically — iterators, dynamic dispatchers, sub-workflow wrappers.\n * The orchestrator decides their actual output type at execution time\n * based on what's wired upstream (loop iterates upstream column type;\n * sub-workflow emits its leaf node's type; adjust-volume passes through\n * video or audio based on its `lastInputType` runtime field;\n * voice-changer emits audio in audio mode, video+audio in video mode).\n *\n * Typed-handle validators (frontend/src/lib/{generate-image,generate-\n * video,ffmpeg}-handles.ts) must include these as acceptors on EVERY\n * media-typed input handle — otherwise the canvas validator hard-\n * rejects edges that the orchestrator would happily route at runtime.\n *\n * Lifted here from `frontend/src/lib/ffmpeg-handles.ts` (where the\n * escape hatch was first added) so the same set drives ALL handle\n * validators uniformly. Adding a new dynamic-output node type means\n * one edit here instead of N across sibling validator files.\n *\n * Intentionally OMITTED:\n * - `webhook-trigger` / `schedule-trigger` — their outputs are\n * user-defined JSON shapes, not media URLs. Accepting them as\n * media producers creates false-positive drops at the canvas\n * that fail at execution. Users wanting trigger → media flows\n * should wire through an upload node.\n */\nexport const DYNAMIC_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"DYNAMIC_PRODUCER_TYPES\", [\n \"list\",\n \"sub-workflow\",\n \"adjust-volume\",\n // Pitch & Tempo: audio in → audio out, video in → video out (picture\n // copied). Dual-mode like adjust-volume; stays in AUDIO_PRODUCER_TYPES as\n // its default.\n \"pitch-tempo\",\n // Dual-mode: audio in → audio out; video in → video out (+ revoiced audio).\n // Listed here so canvas validators accept its output on BOTH audio and video\n // input handles (it also stays in AUDIO_PRODUCER_TYPES as its default).\n \"voice-changer\",\n // voice-changer-pro (renamed from voice-recast in #3581) is a behavioral\n // twin of voice-changer — identical dual-mode output. Must mirror it in\n // EVERY producer set or its outputs can't connect (was the \"cannot connect\n // the outputs of voice-changer-pro\" bug). Guarded by producer-types.test.ts.\n \"voice-changer-pro\",\n // Dubbing joined the dual-mode family with the full-surface upgrade:\n // audio in → dubbed audio; video in (or a video sourceUrl) → dubbed VIDEO\n // (+ audio sidecar). Same wiring contract as voice-changer; stays in\n // AUDIO_PRODUCER_TYPES as its default. Explicitly asserted in\n // producer-types.test.ts (the suite does not fail on omission).\n \"dubbing\",\n \"reduce\",\n // Dual-output time chunker (UI label \"Split into Chunks\"; type id stays\n // \"split-media\"): video in → video chunks, audio in → audio chunks — two\n // independent lanes on two output handles. Like voice-changer, the canvas\n // validator only sees the source NODE type, not which handle a wire leaves,\n // so it lives here to be accepted on BOTH audio and video input handles. The\n // backend routes the correct lane by sourceHandle in getPrimaryOutput\n // (output-extractor.ts); the frontend does so in extractNodeOutput.\n \"split-media\",\n // apply-edl renders an EDL into ONE media output whose type is decided at\n // run time by the node's `output` setting (video OR audio) — so its static\n // medium is genuinely unknown and it belongs here, letting canvas validators\n // accept its default media handle on BOTH audio and video input handles. It\n // ALSO emits a fixed `json` handle (the remapped Transcript); that half lives\n // in JSON_PRODUCER_TYPES (frontend/src/lib/data-handles.ts). The FIRST node\n // with both a dynamic media handle and a fixed json handle. Because\n // getOutputType (presentation-utils.ts) deliberately returns \"data\" for\n // DYNAMIC members, apply-edl is ALSO added to the literal VIDEO_OUTPUT_TYPES\n // there so a published app renders the cut as video, mirroring the\n // voice-changer/dubbing precedent. Asserted in producer-types.test.ts (the\n // suite does not fail on omission).\n \"apply-edl\",\n], unitProducers(\"dynamic\"))\n\n/**\n * Source node types whose primary output is an audio URL.\n * Mirrors the backend execution-graph AUDIO_SOURCE_TYPES verbatim.\n */\nexport const AUDIO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"AUDIO_PRODUCER_TYPES\", [\n \"text-to-speech\",\n \"text-to-audio\",\n \"generate-music\",\n \"upload-audio\",\n \"suno-generate\",\n \"suno-cover\",\n \"suno-extend\",\n \"suno-separate\",\n \"audio-separation\",\n \"suno-mashup\",\n \"suno-replace-section\",\n \"suno-add-instrumental\",\n \"suno-add-vocals\",\n \"suno-convert-wav\",\n \"suno-upload-extend\",\n \"trim-audio\",\n \"mix-audio\",\n \"combine-audio\",\n \"adjust-volume\",\n \"audio-fx\",\n \"pitch-tempo\",\n \"reference-audio\",\n \"audio-isolation\",\n \"text-to-dialogue\",\n \"voice-changer\",\n // Twin of voice-changer (see DYNAMIC_PRODUCER_TYPES note). Audio is its\n // default output mode; video mode is handled via DYNAMIC membership.\n \"voice-changer-pro\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n // Extract Audio: demuxes a video's audio track to a standalone MP3.\n \"extract-audio\",\n], unitProducers(\"audio\"))\n\n/**\n * Source node types whose output is an IMAGE URL — what feeds a References\n * input. ONE set for the canvas validators (`frontend/src/lib/\n * generate-image-handles.ts` re-exports it), the backend's Generate Image\n * handle migration and the MCP edge normalizer (`llm-chat`'s legacy `in`):\n * they used to keep separate copies, and the backend's lagged by eight types.\n */\nexport const IMAGE_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"IMAGE_PRODUCER_TYPES\", [\n \"upload-image\", \"generate-image\", \"edit-image\", \"image-to-image\", \"modify-image\", \"upscale-image\", \"remove-background\",\n // extract-frame produces a single still image extracted from a video source.\n \"extract-frame\",\n // generate-mask emits the source image AND a mask PNG; its `image` source\n // pip is the passthrough (the same image as the input).\n \"generate-mask\",\n // paint-mask emits the hand-painted mask PNG (a plain image at runtime).\n // Membership is what makes mask targets accept it — mask is an advisory\n // color, not a gated type.\n \"paint-mask\",\n // reference-sheet's `sheet` is one composited image and `panels` carries\n // clean reference images; both resolve to image URLs at runtime.\n \"reference-sheet\",\n // reference-board's `image` pip emits a real generated board image.\n \"reference-board\",\n // image-collage composites N images → ONE image.\n \"image-collage\",\n // image-overlay places layers on a base → ONE image.\n \"image-overlay\",\n // 3D Render Pro's `stills` handle carries one PNG per shot of the exported\n // composition (spread into referenceImageUrls like reference-sheet\n // `panels`). A validator sees only the source NODE type, so this also makes\n // its `video` pip droppable on an image input — the handle-blind trade\n // reference-sheet and split-media already make; the input resolvers route\n // by handle, so only `stills` becomes an image at runtime. Deliberately NOT\n // in IMAGE_SOURCE_TYPES on either engine: that set types the node's PRIMARY\n // asset, and 3D Render Pro's is the MP4.\n \"pro-3d-render\",\n], unitProducers(\"image\"))\n\n/**\n * Source node types whose primary output is a LIST that, by default, fans out\n * one downstream execution per element when an edge leaves them WITHOUT an\n * explicit `outputMode` (all other edges default to \"last\"). `selector` is\n * included because its picked/rest channels are lists too.\n *\n * Single source of truth for the fan-out \"each\" default, consumed by:\n * - backend/src/services/workflow-engine/input-resolver.ts (DEFAULT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/types.ts (FAN_OUT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/node-input-resolver.ts\n *\n * These three previously kept independent copies; the backend copy drifted\n * (missing the four list-transform types), so server-side workflow runs\n * silently dropped all-but-the-first item for filter-list / deduplicate /\n * merge-lists / sort-list sources while the canvas fanned out N ways. Lifting\n * the set here makes that drift impossible.\n */\nexport const FAN_OUT_EACH_TYPES: ReadonlySet<string> = new Set([\n \"list\",\n \"split-text\",\n \"filter-list\",\n \"deduplicate\",\n \"merge-lists\",\n \"sort-list\",\n \"selector\",\n // edit-plan `clips` mode emits a bare `Edl[]` on `data.generatedJson`, so an\n // edge leaving it defaults to \"each\" — one downstream execution (typically an\n // apply-edl render) per clip. The `tighten`/`chapters` modes emit an OBJECT,\n // for which the list extractors return undefined, so an \"each\" edge falls back\n // to the scalar `edl` value (no fan-out) — the same graceful degradation\n // web-scrape relies on. See `unwrapEditPlanOutput` in `edit-plan-contract.ts`.\n \"edit-plan\",\n // Content Ideas emits one creative brief per idea on `listResults`, so an\n // edge leaving it defaults to \"each\" — the node after it (typically\n // Generate Script) runs once per idea, on the server too.\n \"content-ideas\",\n])\n\n/**\n * Per-HANDLE \"each\" defaults, for a node whose outputs differ in kind: on the\n * `each` handles an edge without an explicit `outputMode` defaults to \"each\",\n * on its other handles to \"last\". `primary` is the handle an edge with no\n * `sourceHandle` reads (agent-written workflow JSON often omits it).\n *\n * The list an \"each\" edge reads is the node's per-iteration results\n * (`listResults`) — it exists only when the node itself ran once per item, so\n * after a single run the edge degrades to the single value, exactly like a\n * `FAN_OUT_EACH_TYPES` member with one item.\n *\n * Its hand-written rows ∪ the node units' rows (`contract.fanOutEach`,\n * generated/unit-contracts.ts); a type in both refuses to load.\n */\nexport const FAN_OUT_EACH_HANDLES: Readonly<Record<string, { readonly each: readonly string[]; readonly primary: string }>> = composeUnitRecord(\"FAN_OUT_EACH_HANDLES\", {\n // Camera Switch run once per clip (Edit Plan in clips mode): each clip's\n // switched EDL is its own Apply EDL render. Its transcript is the same for\n // every clip (the master clock, renamed), so that handle stays one value\n // (decided 2026-10-04).\n \"camera-switch\": { each: [\"edl\"], primary: \"edl\" },\n // UGC Clips: one ticket per clip on `clips` (each); `plan-out` and\n // `transcript` carry one value. Not a FAN_OUT_EACH_TYPES member — every\n // handle of such a member would fan out. Its one run writes the tickets as\n // its list (`listResults`, the editor's `__listResults`). The pip an edge\n // with no handle reads is the UGC wires' own (UGC_PRIMARY_HANDLE).\n \"ugc-clips\": { each: [\"clips\"], primary: UGC_PRIMARY_HANDLE[\"ugc-clips\"]! },\n // A node unit declares its row in unit.json (contract.fanOutEach); it is added after these.\n}, unitFanOutEach())\n\n/**\n * Fan-out nodes whose iterations must ALL succeed: one failed item fails the\n * node (today's rule tolerates a partial list). UGC Clip — a missing clip\n * silently drops a beat from the script (spec R17). Already-started items\n * finish and settle; their jobs are reused on the next run.\n */\nexport const FAN_OUT_ALL_OR_NOTHING_TYPES: ReadonlySet<string> = new Set([\"ugc-clip\"])\n\n/**\n * Nodes whose saved list is the list their last run PRODUCED — `__listResults`\n * (Extract Field's JSON value on `generatedJson`) — and never a history in\n * `generatedResults`: Extract Field, JSON Process and Site Capture. No run of the first two writes\n * one; earlier builds' server runs did (the run's text, the links of a list of\n * links), and both engines' list readers leave it out for these two (decided\n * 2026-10-05). Single source of truth for the backend engine and the editor.\n */\nexport const OWN_LIST_NODE_TYPES: ReadonlySet<string> = new Set([\n \"extract-field\",\n \"json-process\",\n // Site Capture: its stills, in page order — the last capture's, never every capture's (site-capture-node.ts).\n \"site-capture\",\n])\n\n/** Whether a node's saved list is its own `__listResults`, never a history. */\nexport function ownsItsList(nodeType: string | null | undefined): boolean {\n return typeof nodeType === \"string\" && OWN_LIST_NODE_TYPES.has(nodeType)\n}\n\n/** The `outputMode` an edge has when none is set on it — the ONE rule both\n * engines, the credit estimate and the editor read. */\nexport function defaultEdgeOutputMode(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): \"each\" | \"last\" {\n if (typeof sourceType !== \"string\") return \"last\"\n if (FAN_OUT_EACH_TYPES.has(sourceType)) return \"each\"\n const entry = FAN_OUT_EACH_HANDLES[sourceType]\n if (!entry) return \"last\"\n return entry.each.includes(sourceHandle || entry.primary) ? \"each\" : \"last\"\n}\n\n/** Whether an edge from `sourceHandle` reads the node's per-iteration results\n * (`listResults` — each iteration's PRIMARY output). False on the other\n * handles of a `FAN_OUT_EACH_HANDLES` node: Camera Switch's transcript is one\n * value, never the list of switched EDLs, whatever mode its edge is set to. */\nexport function listResultsServeHandle(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): boolean {\n const entry = typeof sourceType === \"string\" ? FAN_OUT_EACH_HANDLES[sourceType] : undefined\n return !entry || entry.each.includes(sourceHandle || entry.primary)\n}\n\n/**\n * FAN-IN targets: nodes that FOLD everything wired into them into ONE run,\n * instead of running once per upstream item. Keyed by node type; the value\n * names the target handles that fold (`\"*\"` = every handle). An edge into any\n * other handle of such a node is routed normally — Content Ideas folds its\n * recipes but reads its brand from a `field-brand` wire like any field.\n *\n * Single source of truth for both engines' input resolvers (the backend and\n * the editor each used to keep a private `new Set([\"reduce\"])`). A fan-in\n * node is never itself fanned out by an upstream list.\n */\nexport const FAN_IN_TARGETS: Readonly<Record<string, \"*\" | readonly string[]>> = {\n // Choose Best — every wire is a candidate.\n reduce: \"*\",\n // Content Ideas — one or more recipes, from several Content Recipe nodes\n // and/or one that ran once per post.\n \"content-ideas\": [\"recipes\"],\n // Telegram Reply — one message per run, whatever is wired into its text\n // input: a list (or a writer that ran once per item) arrives as one\n // message, never as a burst of sends to the owner's chat.\n \"telegram-account-send\": [\"in\"],\n // The list operators — they READ the whole list wired into them (their\n // executors collect every upstream item themselves) and emit a list. Run\n // once per item by an \"each\" wire (a Split Text, a List, a node that ran per\n // item), every iteration saw the same whole list and answered with its\n // first match: a Filter List fed 11 stories handed 11 copies of story one\n // downstream, and every paid stage after it ran 11 times on it\n // (2026-10-06). A list operator is never fanned out, on any wire.\n \"filter-list\": \"*\",\n deduplicate: \"*\",\n \"merge-lists\": \"*\",\n \"sort-list\": \"*\",\n selector: \"*\",\n // Speaker Frames on a clip pack (P3-24 (a), decided 2026-10-06): ONE run over\n // the union of the clips' spans — the pack's EDLs fold onto its `edl` wire\n // instead of running one detection job (and one minimum charge) per clip.\n \"speaker-frames\": [\"edl\"],\n // UGC Finish: ONE run over every clip of the video, in clip order — the finish plans its\n // cut and its sound over all of them at once, so it is never run once per clip.\n \"ugc-finish-clips\": [\"clips\"],\n}\n\nexport function isFanInNodeType(nodeType: string | undefined | null): boolean {\n return typeof nodeType === \"string\" && Object.prototype.hasOwnProperty.call(FAN_IN_TARGETS, nodeType)\n}\n\n/** True when an edge into `targetHandle` of a `targetType` node is folded.\n * An edge with NO target handle (workflow JSON written by an agent often\n * omits it) lands on the node's primary input, which is the folding one. */\nexport function isFanInEdge(targetType: string | undefined | null, targetHandle: string | null | undefined): boolean {\n if (!isFanInNodeType(targetType)) return false\n const spec = FAN_IN_TARGETS[targetType as string]!\n if (spec === \"*\") return true\n return targetHandle == null || targetHandle === \"\" || spec.includes(targetHandle)\n}\n","/**\n * Exposed-field keys that were renamed to the node's real data field.\n *\n * A published app stores which fields it exposes as `{ type: \"field\", nodeId, field }` items in its\n * immutable snapshot settings, and external callers send `inputOverrides[nodeId][field]` with that same\n * string — it is part of the public wire contract (docs/embed-app-guide.md). Renaming a descriptor's key\n * must not strand the apps already published with the old spelling: they keep that string forever, so every\n * place that turns a stored key into a node-data key — or compares it with a descriptor key — goes through\n * `canonicalExposedFieldKey`.\n *\n * CLOSED LIST. A row needs a spelling that was published (a card that existed in apps) and a target the\n * node's descriptor now declares (the frontend guard `exposable-field-keys.test.ts` checks both). Only list a\n * field whose card cannot carry `allowedValues` (slider / toggle / text / color): the server validates\n * `allowedValues` against the stored key (backend routes/app-runner.ts `validateRestrictedFields`). Never list\n * a field of an outbound node type: the run-request override lock (backend lib/input-override-lock.ts) reads\n * the stored key, before this table renames it.\n */\nexport const LEGACY_EXPOSED_FIELD_KEYS: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n // Published as the Text to Speech slider's key. The node's data field, and every runner, route and config\n // panel, has always been `similarityBoost` — so the slider moved nothing.\n \"text-to-speech\": { similarity: \"similarityBoost\" },\n}\n\n/** The node-data key an exposed field's stored key stands for. Unknown node types and keys pass through. */\nexport function canonicalExposedFieldKey(nodeType: string | undefined, key: string): string {\n if (typeof nodeType !== \"string\" || !Object.hasOwn(LEGACY_EXPOSED_FIELD_KEYS, nodeType)) return key\n const renames = LEGACY_EXPOSED_FIELD_KEYS[nodeType]!\n return Object.hasOwn(renames, key) ? renames[key]! : key\n}\n\n/**\n * The override map with every legacy spelling replaced by its current key. When the caller sent both\n * spellings the current one wins (it is their current intent) and the legacy key is dropped — a dead key\n * is never written to node data. Returns the same object when nothing renames; never mutates.\n */\nexport function canonicalizeOverrideKeys(\n nodeType: string | undefined,\n overrides: Record<string, unknown>,\n): Record<string, unknown> {\n let out: Record<string, unknown> | undefined\n for (const key of Object.keys(overrides)) {\n const current = canonicalExposedFieldKey(nodeType, key)\n if (current === key) continue\n out ??= { ...overrides }\n delete out[key]\n if (!Object.hasOwn(overrides, current)) out[current] = overrides[key]\n }\n return out ?? overrides\n}\n","/**\n * The render-node registry (SV18, decided 2026-10-06): every node type that\n * turns an EDL into a finished file, and how each one behaves wherever the\n * platform gives a render its meaning — review and the Preview label, privacy,\n * the latest-batch reader, the owner-only listings, and what its `json` handle\n * carries.\n *\n * ONE registry, read by both engines, the editor, the listings and MCP, so a\n * second render (Speaker View) joins by adding one entry — never by finding\n * every `=== \"apply-edl\"`. The backend census test\n * (`render-node-census.test.ts`) fails a new `apply-edl` literal at any site\n * that is not pure registration of that node.\n *\n * The key is the node type AND the job name: a render's job is never renamed\n * (by quality or otherwise — only its credit id changes), so the same key\n * answers for `node.type` and for `jobs.job_type`.\n */\nimport { applyEdlCreditId, speakerViewCreditId, SPEAKER_VIEW_CREDIT_IDS } from \"./credit-identifiers.js\"\nimport type { RenderMedium } from \"./render-output.js\"\n\n/** Where a render's player maps the output clock back to the master clock\n * from: the EDL it was given (`input_data.edl`), or the EDL it emitted on its\n * `json` output (a render that rewrites its EDL, e.g. by splitting turns). */\nexport type RenderClockSource = \"input\" | \"output-json\"\n\n/** What a render's `json` output handle carries. Only a `transcript` is handed\n * on as one (Add Captions, the word-timing preflight). */\nexport type RenderJsonKind = \"transcript\" | \"edl\"\n\n/** Where a render's wired transcript, remapped through its cut, comes out\n * (Apply EDL's on its `json`; Speaker View's on its own `transcript` pip,\n * decided 2026-10-08). */\nexport interface RenderTranscriptOutput {\n /** The output pip — also the key it rides on the job's `output_data` and on\n * a run's node output. */\n readonly handle: string\n /** The saved node-data field that holds it (the landed take's). */\n readonly dataField: string\n}\n\n/** The pip a render's `json` output (its `jsonKind`) comes out on, and its key\n * on the job's `output_data`. */\nexport const RENDER_JSON_HANDLE = \"json\"\n\nexport interface RenderNodeDescriptor {\n /** The medium the render's order asks for (its node data, or its job's\n * `input_data`) — before any output exists to say. */\n readonly mediumOf: (data: Readonly<Record<string, unknown>>) => RenderMedium\n /** The credit id a render reserves on — a per-OUTPUT-MINUTE row: every\n * render is charged its row × the minutes it renders. Chosen from the\n * render's `quality` and `output` (as its node data or its job's request\n * carries them) and, for a render priced in tiers, the `priceTier` the\n * render rule judged it to be in (Speaker View's, decided 2026-10-10). A\n * tiered render given no tier names its dearer row. */\n readonly creditId: (quality: unknown, output?: unknown, priceTier?: unknown) => string\n /** Every id `creditId` can name (each must have a price row). */\n readonly creditIds: readonly string[]\n readonly clockMapFrom: RenderClockSource\n /** Listed in its owner's own views only, never in a public one (decided\n * 2026-10-06): a Preview is private, and a public final would be exposure\n * nobody decided. */\n readonly ownerOnlyListing: boolean\n /** An `each` wire reads its LATEST batch only, never its accumulated history\n * (TA6, decided 2026-10-04). */\n readonly latestBatch: boolean\n readonly jsonKind: RenderJsonKind\n /** Where its remapped transcript comes out. On the `json` pip exactly when\n * `jsonKind` is `transcript` (a guard test holds the two together). */\n readonly transcriptOutput: RenderTranscriptOutput\n}\n\ntype Data = Readonly<Record<string, unknown>>\n\n/** Its `output` setting, video when absent. */\nconst outputSettingMedium = (data: Data): RenderMedium => (data.output === \"audio\" ? \"audio\" : \"video\")\n\nconst descriptor = (d: RenderNodeDescriptor): RenderNodeDescriptor =>\n Object.freeze({ ...d, creditIds: Object.freeze([...d.creditIds]), transcriptOutput: Object.freeze({ ...d.transcriptOutput }) })\n\nexport const RENDER_NODE_TYPES: Readonly<Record<string, RenderNodeDescriptor>> = Object.freeze({\n \"apply-edl\": descriptor({\n mediumOf: outputSettingMedium,\n creditId: (quality) => applyEdlCreditId(quality),\n creditIds: [\"apply-edl\", \"apply-edl:proxy\"],\n clockMapFrom: \"input\",\n ownerOnlyListing: true,\n latestBatch: true,\n jsonKind: \"transcript\",\n transcriptOutput: { handle: RENDER_JSON_HANDLE, dataField: \"generatedJson\" },\n }),\n // Speaker View (C3.2): video only; its `json` is the EDL as it drew it (the\n // turns split, the layouts written), so a player maps the output clock\n // through THAT, and Add Captions never takes it for a Transcript. The wired\n // transcript, remapped through that same drawn edit, comes out on its own\n // `transcript` pip (decided 2026-10-08) — what a caption step reads.\n \"speaker-view\": descriptor({\n mediumOf: () => \"video\",\n creditId: (quality, _output, priceTier) => speakerViewCreditId(quality, priceTier),\n creditIds: SPEAKER_VIEW_CREDIT_IDS,\n clockMapFrom: \"output-json\",\n ownerOnlyListing: true,\n latestBatch: true,\n jsonKind: \"edl\",\n transcriptOutput: { handle: \"transcript\", dataField: \"generatedTranscript\" },\n }),\n})\n\n/** Every render node type, in registry order. */\nexport const RENDER_NODE_TYPE_IDS: readonly string[] = Object.freeze(Object.keys(RENDER_NODE_TYPES))\n\n/** The descriptor of a render node type (or job name); `undefined` for any\n * other value. Own keys only, so `\"constructor\"` is not a render. */\nexport function renderNodeOf(type: unknown): RenderNodeDescriptor | undefined {\n return typeof type === \"string\" && Object.hasOwn(RENDER_NODE_TYPES, type) ? RENDER_NODE_TYPES[type] : undefined\n}\n\n/** Is this node type (or job name) a render? */\nexport function isRenderNodeType(type: unknown): type is string {\n return renderNodeOf(type) !== undefined\n}\n\n/** Does an `each` wire from this node read its latest batch only? */\nexport function rendersLatestBatch(type: unknown): boolean {\n return renderNodeOf(type)?.latestBatch === true\n}\n\n/** Is this node a render whose `json` output is a Transcript? */\nexport function rendersTranscriptJson(type: unknown): boolean {\n return renderNodeOf(type)?.jsonKind === \"transcript\"\n}\n\n/** Where a render's remapped transcript comes out; `undefined` for any other\n * node type. */\nexport function renderTranscriptOutputOf(type: unknown): RenderTranscriptOutput | undefined {\n return renderNodeOf(type)?.transcriptOutput\n}\n\n/** Is `handle` one of a render's data pips — its `json` or its transcript —\n * rather than its media? Every other pip of a render (the default included)\n * is the rendered media. `false` for any other node type. */\nexport function isRenderDataHandle(type: unknown, handle: unknown): boolean {\n const d = renderNodeOf(type)\n if (!d || typeof handle !== \"string\") return false\n return handle === RENDER_JSON_HANDLE || handle === d.transcriptOutput.handle\n}\n\n/** One json output a render lands on its node: its key on the job's\n * `output_data` (and on a run's node output) and its saved node-data field. */\nexport interface RenderSavedJsonOutput {\n readonly outputKey: string\n readonly dataField: string\n}\n\n/** The json outputs a render lands on its node, `json` first, each once — what\n * every lane that lands a take (or picks one) writes or restores. Empty for\n * any other node type. */\nexport function renderSavedJsonOutputs(type: unknown): readonly RenderSavedJsonOutput[] {\n const d = renderNodeOf(type)\n if (!d) return []\n const json: RenderSavedJsonOutput = { outputKey: RENDER_JSON_HANDLE, dataField: \"generatedJson\" }\n const t = d.transcriptOutput\n return t.handle === RENDER_JSON_HANDLE ? [json] : [json, { outputKey: t.handle, dataField: t.dataField }]\n}\n\n/** The render job types that list in their owner's own views only. */\nexport const OWNER_ONLY_LISTING_RENDER_TYPES: readonly string[] = Object.freeze(\n RENDER_NODE_TYPE_IDS.filter((t) => RENDER_NODE_TYPES[t]!.ownerOnlyListing),\n)\n","/**\n * Presentation / API utilities — pure logic, no React deps.\n * Shared between frontend (presentation mode) and backend (API schema generation).\n */\n\nimport type { GenericNode, GenericEdge } from \"./types.js\"\nimport type { PresentationItem } from \"./presentation-types.js\"\nimport { AUDIO_PRODUCER_TYPES, VIDEO_PRODUCER_TYPES } from \"./producer-types.js\"\nimport { canonicalizeOverrideKeys } from \"./exposed-field-keys.js\"\nimport { RENDER_NODE_TYPE_IDS } from \"./render-nodes.js\"\nimport { dropStaleVideoLinkFields } from \"./video-link.js\"\nimport { composeUnitSet, unitsPresenting } from \"./unit-contract-compose.js\"\n\n// ---------------------------------------------------------------------------\n// Node type sets\n// ---------------------------------------------------------------------------\n\nexport const INPUT_NODE_TYPES = new Set([\n \"text-prompt\",\n \"upload-image\",\n \"upload-video\",\n \"upload-audio\",\n \"tone\",\n \"style-guide\",\n \"provider\",\n \"scene-count\",\n \"duration\",\n \"aspect-ratio\",\n \"motion\",\n \"camera-motion\",\n \"framing\",\n \"lens\",\n \"camera-format\",\n \"lighting\",\n \"color-look\",\n \"atmosphere\",\n \"action-fx\",\n \"temporal\",\n \"reference-audio\",\n \"youtube-video\",\n])\n\nconst TRIGGER_NODE_TYPES = new Set([\n \"webhook-trigger\",\n \"schedule-trigger\",\n])\n\nconst ALWAYS_EXCLUDED_TYPES = new Set([\n \"sticky-note\",\n \"webhook-trigger\",\n \"schedule-trigger\",\n \"sub-workflow-input\",\n \"sub-workflow-output\",\n])\n\nconst NON_OUTPUT_TYPES = new Set([\n \"text-prompt\",\n \"list\",\n \"upload-image\",\n \"upload-video\",\n \"upload-audio\",\n \"reference-audio\",\n \"rss-feed\",\n \"youtube-video\",\n \"tone\",\n \"style-guide\",\n \"provider\",\n \"scene-count\",\n \"duration\",\n \"aspect-ratio\",\n \"motion\",\n \"camera-motion\",\n \"framing\",\n \"lens\",\n \"camera-format\",\n \"lighting\",\n \"color-look\",\n \"atmosphere\",\n \"action-fx\",\n \"temporal\",\n \"sticky-note\",\n \"sub-workflow-input\",\n \"sub-workflow-output\",\n \"webhook-trigger\",\n \"schedule-trigger\",\n \"combine-text\",\n \"split-text\",\n \"save-to-storage\",\n \"webhook-output\",\n \"component\",\n])\n\n/**\n * Node types that count as an output even when something is wired to their\n * output handle (the legacy `presentationVisible` rule below).\n *\n * A hand-kept list, and one the platform has outgrown: it is unioned at the use\n * site with the producer vocabularies the canvas validators already maintain\n * (see `isMediaProducingType`), so a new media node is covered by the set it\n * must join anyway rather than by remembering to edit this one.\n */\nconst MEDIA_PRODUCING_TYPES = new Set([\n \"generate-image\",\n \"edit-image\",\n \"image-to-image\",\n \"image-to-video\",\n \"text-to-video\",\n \"video-to-video\",\n \"text-to-speech\",\n \"generate-music\",\n \"text-to-audio\",\n \"generate-script\",\n \"ai-writer\",\n \"llm-chat\",\n \"render-video\",\n \"video-composer\",\n \"after-effects\",\n \"lottie-overlay\",\n \"3d-title\",\n \"motion-graphics\",\n \"composite\",\n \"text-to-dialogue\",\n \"voice-changer\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n \"extend-video\",\n \"lip-sync\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n])\n\n// Output type categorizations — each the hand-written list ∪ the node units\n// that declare the same presentation (contract.presents, generated rows); a\n// type in both throws at load (composeUnitSet).\nconst IMAGE_OUTPUT_TYPES = composeUnitSet(\"IMAGE_OUTPUT_TYPES\", [\n \"generate-image\", \"edit-image\", \"image-to-image\",\n \"upload-image\",\n], unitsPresenting(\"image\"))\n\n/**\n * Video-output types NOT already declared by `VIDEO_PRODUCER_TYPES` — the two\n * are unioned in `getOutputType`, which is where the reading order (and the\n * reason the literal sets win) is documented.\n */\nconst VIDEO_OUTPUT_TYPES = composeUnitSet(\"VIDEO_OUTPUT_TYPES\", [\n \"image-to-video\", \"text-to-video\", \"video-to-video\", \"extend-video\",\n \"render-video\", \"video-composer\", \"after-effects\", \"lottie-overlay\",\n \"3d-title\", \"motion-graphics\", \"composite\",\n \"combine-videos\", \"merge-video-audio\", \"resize-video\", \"trim-video\",\n \"speed-ramp\", \"loop-video\", \"fade-video\", \"transcode-video\",\n \"upload-video\",\n \"lip-sync\", \"motion-transfer\", \"video-upscale\", \"video-depth\", \"add-captions\",\n \"social-media-format\",\n // A render (Apply EDL) renders an EDL into video OR audio. Its medium is\n // decided at run time (DYNAMIC_PRODUCER_TYPES), so getOutputType would answer\n // \"data\" and a published app would render the cut as a JSON blob. Declaring\n // every render here — as the voice-changer/dubbing precedent does for their\n // default medium — makes the classifier answer \"video\" (the common case; an\n // audio-only cut still plays in a video element). Asserted in\n // producer-types.test.ts.\n ...RENDER_NODE_TYPE_IDS,\n], unitsPresenting(\"video\"))\n\nconst AUDIO_OUTPUT_TYPES = composeUnitSet(\"AUDIO_OUTPUT_TYPES\", [\n \"text-to-speech\", \"generate-music\", \"text-to-audio\",\n \"text-to-dialogue\", \"voice-changer\", \"dubbing\", \"voice-remix\",\n \"voice-design\", \"mix-audio\", \"adjust-volume\", \"audio-fx\", \"pitch-tempo\", \"trim-audio\",\n \"audio-isolation\",\n \"audio-separation\",\n \"upload-audio\",\n], unitsPresenting(\"audio\"))\n\nconst TEXT_OUTPUT_TYPES = composeUnitSet(\"TEXT_OUTPUT_TYPES\", [\n \"generate-script\", \"ai-writer\", \"llm-chat\", \"transcribe\", \"image-to-text\", \"qa-check\",\n \"text-prompt\",\n // UGC Cards' output card is its Notes: a run hands it on as the node's text\n // (`output.text`, `generatedText` on the canvas).\n \"ugc-cards\",\n], unitsPresenting(\"text\"))\n\n// ---------------------------------------------------------------------------\n// Output type enum\n// ---------------------------------------------------------------------------\n\nexport type OutputType = \"image\" | \"video\" | \"audio\" | \"text\" | \"data\"\n\n// ---------------------------------------------------------------------------\n// Core functions\n// ---------------------------------------------------------------------------\n\n/** Get nodes that act as user inputs (text prompts, uploads, parameters). */\nexport function getInputNodes<T extends GenericNode>(nodes: T[], curatedOnly = true): T[] {\n return nodes.filter((n) => {\n if (!n.type || ALWAYS_EXCLUDED_TYPES.has(n.type)) return false\n if (n.hidden) return false\n if (curatedOnly) {\n // New explicit flag\n if (n.data.presentationInput === true) return true\n // Backwards compat: old flag on input-type nodes\n if (n.data.presentationVisible === true && INPUT_NODE_TYPES.has(n.type)) return true\n return false\n }\n return true\n })\n}\n\n/** Get leaf/media-producing nodes that represent workflow outputs. */\nexport function getOutputNodes<T extends GenericNode>(\n nodes: T[],\n edges: GenericEdge[],\n curatedOnly = true,\n): T[] {\n const nodesWithOutgoing = new Set(edges.map((e) => e.source))\n\n return nodes.filter((n) => {\n if (!n.type || ALWAYS_EXCLUDED_TYPES.has(n.type)) return false\n if (n.hidden) return false\n if (curatedOnly) {\n // New explicit flag\n if (n.data.presentationOutput === true) return true\n // Backwards compat: old flag on output-eligible nodes\n if (n.data.presentationVisible === true) {\n if (NON_OUTPUT_TYPES.has(n.type)) return false\n return !nodesWithOutgoing.has(n.id) || isMediaProducingType(n.type)\n }\n return false\n }\n return true\n })\n}\n\n/**\n * Map node type to its output media type.\n *\n * The four literal sets above are read FIRST and win: they are the presentation\n * classifier's own opinion, including for dual-mode nodes whose default medium\n * is not their handle set (voice-changer and dubbing are audio here even though\n * they can emit video).\n *\n * Anything they do not name falls through to the producer vocabularies the\n * canvas validators and the orchestrator already maintain\n * (`packages/shared/src/producer-types.ts`). Those sets are what a new media\n * node MUST join for its outputs to connect at all, so deriving the tail from\n * them is what stops this map from silently drifting behind the node catalogue\n * — which it had (3D Render Pro, Generate Video, Generate Video Pro and a dozen\n * ffmpeg nodes all read as `\"data\"`, so a published app rendered them as a JSON\n * blob and `/v1` app schemas declared the wrong output type).\n *\n * `DYNAMIC_PRODUCER_TYPES` is deliberately NOT consulted: a node whose medium\n * is decided at run time has no static answer, and `\"data\"` is the honest one.\n */\nexport function getOutputType(nodeType: string | undefined): OutputType {\n if (!nodeType) return \"data\"\n if (IMAGE_OUTPUT_TYPES.has(nodeType)) return \"image\"\n if (VIDEO_OUTPUT_TYPES.has(nodeType)) return \"video\"\n if (AUDIO_OUTPUT_TYPES.has(nodeType)) return \"audio\"\n if (TEXT_OUTPUT_TYPES.has(nodeType)) return \"text\"\n if (VIDEO_PRODUCER_TYPES.has(nodeType)) return \"video\"\n if (AUDIO_PRODUCER_TYPES.has(nodeType)) return \"audio\"\n return \"data\"\n}\n\n/**\n * Whether a node produces media of its own — the test the legacy\n * `presentationVisible` rule uses to keep a media node as an OUTPUT even when\n * it also feeds something downstream.\n *\n * Same union, same reason as `getOutputType`: the hand-kept list plus the\n * producer vocabularies. Text producers stay where the literal list put them\n * (`generate-script`, `ai-writer`, `llm-chat` are members; `transcribe` and\n * `qa-check` are not) — this is about media, not about every node with a value.\n */\nfunction isMediaProducingType(nodeType: string): boolean {\n if (MEDIA_PRODUCING_TYPES.has(nodeType)) return true\n const output = getOutputType(nodeType)\n return output === \"image\" || output === \"video\" || output === \"audio\"\n}\n\n/** Extract the result URL or text from a node's data. */\nexport function getNodeResult(\n nodeData: Record<string, unknown>,\n): { url?: string; text?: string } {\n // Preview node: extract first visible item from previewItems\n const previewItems = nodeData.previewItems as\n | Array<{ type: string; value: string; visible?: boolean }>\n | undefined\n if (previewItems && previewItems.length > 0) {\n const first = previewItems.find((item) => item.visible !== false) ?? previewItems[0]\n if (first) {\n if (first.type === \"image\" || first.type === \"video\" || first.type === \"audio\") {\n return { url: first.value }\n }\n return { text: first.value }\n }\n }\n\n const results = nodeData.generatedResults as\n | Array<Record<string, unknown>>\n | undefined\n\n if (results && results.length > 0) {\n const idx = (nodeData.activeResultIndex as number) ?? 0\n const active = results[idx] ?? results[0]\n const url = (active?.url ?? active?.imageUrl ?? active?.videoUrl ?? active?.audioUrl) as\n | string\n | undefined\n const text = (active?.text ?? active?.script) as string | undefined\n return { url, text }\n }\n\n // Fallback to individual generated fields\n const url = (nodeData.generatedImageUrl ??\n nodeData.generatedVideoUrl ??\n nodeData.generatedAudioUrl) as string | undefined\n const text = (nodeData.generatedScript ?? nodeData.generatedText) as\n | string\n | undefined\n\n return { url, text }\n}\n\n/** Human-readable label for a node. */\nexport function getNodeLabel(node: GenericNode): string {\n return (\n (node.data.label as string) ||\n node.type?.replace(/-/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase()) ||\n \"Node\"\n )\n}\n\n// ---------------------------------------------------------------------------\n// Input field schema (for API schema generation)\n// ---------------------------------------------------------------------------\n\nexport interface InputFieldSchema {\n key: string\n type: \"text\" | \"image-url\" | \"video-url\" | \"audio-url\" | \"select\" | \"number\"\n options?: string[]\n}\n\n// Override field per input-node type. The `key` for a parameter-picker MUST be\n// the field that `getParameterValue()` (parameter-node-value.ts) actually reads\n// — for multi-dimension pickers, its FIRST per-dimension field (the\n// \"representative key\"). A mismatch silently drops the curated app/MCP/SDK input\n// (the override lands on a field nothing reads). This map is the single source\n// of truth for app-input override fields (consumed by extract-app-inputs.ts,\n// api-tokens.ts, and the app-runner). Its parity with getParameterValue is\n// guarded by input-field-map-parity.test.ts so the two can't drift.\nexport const INPUT_FIELD_MAP: Record<string, InputFieldSchema> = {\n // --- Source / upload nodes (not parameter pickers) ---\n \"text-prompt\": { key: \"text\", type: \"text\" },\n \"upload-image\": { key: \"url\", type: \"image-url\" },\n \"upload-video\": { key: \"url\", type: \"video-url\" },\n \"upload-audio\": { key: \"url\", type: \"audio-url\" },\n \"reference-audio\": { key: \"extractedAudioUrl\", type: \"audio-url\" },\n // A LINK, not an upload (rule: `videoLinkInputProblem`, video-link.ts); still a `video-url` media input.\n \"youtube-video\": { key: \"youtubeUrl\", type: \"video-url\" },\n // --- Classic parameters ---\n \"provider\": { key: \"provider\", type: \"select\" },\n \"style-guide\": { key: \"text\", type: \"text\" }, // reads data.text (was wrongly \"styleGuide\")\n \"scene-count\": { key: \"count\", type: \"number\" },\n \"duration\": { key: \"seconds\", type: \"number\" }, // reads data.seconds (was wrongly \"duration\")\n \"aspect-ratio\": { key: \"ratio\", type: \"select\" }, // reads data.ratio (was wrongly \"aspectRatio\")\n // --- Single-field parameter pickers ---\n \"tone\": { key: \"tone\", type: \"select\" },\n \"motion\": { key: \"motion\", type: \"select\" },\n \"camera-motion\": { key: \"cameraMotion\", type: \"select\" },\n \"lens\": { key: \"lens\", type: \"select\" },\n \"camera-format\": { key: \"cameraFormat\", type: \"select\" },\n \"color-look\": { key: \"colorLook\", type: \"select\" },\n \"atmosphere\": { key: \"atmosphere\", type: \"select\" },\n \"style\": { key: \"style\", type: \"select\" },\n \"setting\": { key: \"setting\", type: \"select\" },\n \"mood\": { key: \"mood\", type: \"select\" },\n \"photographer\": { key: \"photographer\", type: \"select\" },\n \"aesthetic\": { key: \"aesthetic\", type: \"select\" },\n \"era\": { key: \"era\", type: \"select\" },\n \"material\": { key: \"material\", type: \"select\" },\n \"animal\": { key: \"animal\", type: \"select\" },\n \"vehicle\": { key: \"vehicle\", type: \"select\" },\n \"weapon\": { key: \"weapon\", type: \"select\" },\n \"furniture\": { key: \"furniture\", type: \"select\" },\n \"photo-genre\": { key: \"photoGenre\", type: \"select\" },\n \"backdrop\": { key: \"backdrop\", type: \"select\" },\n \"held-prop\": { key: \"heldProp\", type: \"select\" },\n \"render-quality\": { key: \"renderQuality\", type: \"select\" },\n \"composition-effects\": { key: \"compositionEffect\", type: \"select\" },\n \"post-process-effects\": { key: \"postProcess\", type: \"select\" },\n \"action-fx\": { key: \"actionFx\", type: \"select\" },\n \"character-fx\": { key: \"characterFx\", type: \"select\" },\n \"character-motion\": { key: \"characterMotion\", type: \"select\" },\n \"transition\": { key: \"transition\", type: \"select\" },\n \"loop-subject\": { key: \"loopSubject\", type: \"select\" },\n // --- Multi-dimension pickers: representative (first) field. Overriding only\n // sets that dimension; full hint composition runs in the executors. ---\n \"framing\": { key: \"shotSize\", type: \"select\" },\n \"lighting\": { key: \"timeOfDay\", type: \"select\" },\n \"temporal\": { key: \"temporalSpeed\", type: \"select\" },\n \"person\": { key: \"type\", type: \"select\" },\n \"pose\": { key: \"pose\", type: \"select\" },\n \"styling\": { key: \"makeup\", type: \"select\" },\n \"exposure-settings\": { key: \"aperture\", type: \"select\" },\n \"music-genre\": { key: \"subgenre\", type: \"select\" },\n \"music-mood\": { key: \"emotion\", type: \"select\" },\n \"instrumentation\": { key: \"production\", type: \"select\" },\n \"voice-character\": { key: \"timbre\", type: \"select\" },\n \"voice-delivery\": { key: \"archetype\", type: \"select\" },\n // --- UGC (Cloud) ---\n \"ugc-creator\": { key: \"source\", type: \"select\" },\n}\n\n/**\n * Extra API-settable keys for node types whose card writes more than one field\n * (INPUT_FIELD_MAP is one key per node type). Read by extract-app-inputs and the\n * app runner; every key here must be in UGC_OVERRIDABLE_FIELDS for a UGC type.\n */\nexport const INPUT_FIELD_EXTRA_KEYS: Readonly<Record<string, readonly InputFieldSchema[]>> = {\n \"ugc-creator\": [{ key: \"gender\", type: \"select\" }, { key: \"photoUrl\", type: \"image-url\" }],\n // The script's language: changes together with UGC_OVERRIDABLE_FIELDS[\"ugc-script\"] and UgcScriptData.language.\n \"ugc-script\": [{ key: \"language\", type: \"select\" }],\n}\n\n/** The extra override fields of a node type (none for most types). */\nexport function getInputFieldExtraKeys(nodeType: string): readonly InputFieldSchema[] {\n return Object.hasOwn(INPUT_FIELD_EXTRA_KEYS, nodeType) ? INPUT_FIELD_EXTRA_KEYS[nodeType]! : []\n}\n\n/** Get the overridable field schema for an input node type. */\nexport function getInputFieldSchema(nodeType: string): InputFieldSchema | undefined {\n return INPUT_FIELD_MAP[nodeType]\n}\n\nconst MEDIA_INPUT_FIELD_TYPES: ReadonlySet<InputFieldSchema[\"type\"]> = new Set([\n \"image-url\",\n \"video-url\",\n \"audio-url\",\n])\n\n/**\n * Shallow-merge run-time input overrides (a published app's inputs, an API-token\n * run, MCP `run_app` / `run_workflow` inputs, a wired component handle) over a\n * node's SAVED data — the one merge every such lane must use.\n *\n * `metadata` holds facts measured FROM the node's media (its length, its\n * dimensions). When an override swaps that media — the node's primary input\n * field is a media url (`INPUT_FIELD_MAP`) and the override changes it — the\n * snapshot's facts describe a file that is no longer there, so they are dropped\n * unless the override supplies its own. Left behind, a publisher's\n * `metadata.durationSeconds` outranks the run's own transcript as Edit Plan's\n * duration basis and under-buckets a caller's longer episode: an estimate that\n * passes the balance precheck for a run the reserve then refuses.\n *\n * Schema-driven on purpose: a new media input node is covered by its\n * `INPUT_FIELD_MAP` row, with no list to remember here.\n *\n * An override sent under a renamed exposed-field key (an app published before\n * the rename) lands on the node's current field — `canonicalizeOverrideKeys`.\n *\n * An override of `null` clears the field: the merged node has no such key.\n */\nexport function mergeNodeInputOverrides(\n nodeType: string | undefined,\n data: Record<string, unknown>,\n overrides: Record<string, unknown>,\n): Record<string, unknown> {\n const incoming = canonicalizeOverrideKeys(nodeType, overrides)\n // A Video URL node on a new link sheds what was fetched for the old one.\n const base = nodeType === \"youtube-video\" ? dropStaleVideoLinkFields(data, incoming) : data\n const merged: Record<string, unknown> = { ...base, ...incoming }\n // A null override CLEARS the field: the run has no value there, neither null nor the saved one. JSON cannot\n // carry `undefined`, so this is how a run says \"unset\" (an app card clearing a lever the chosen model lacks).\n for (const [key, value] of Object.entries(incoming)) {\n if (value === null) delete merged[key]\n }\n const schema = nodeType ? INPUT_FIELD_MAP[nodeType] : undefined\n if (\n schema &&\n MEDIA_INPUT_FIELD_TYPES.has(schema.type) &&\n schema.key in overrides &&\n overrides[schema.key] !== data[schema.key] &&\n !(\"metadata\" in overrides)\n ) {\n delete merged.metadata\n }\n return merged\n}\n\n// ---------------------------------------------------------------------------\n// Migration & validation helpers (PresentationItem)\n// ---------------------------------------------------------------------------\n\n/** Migrate a legacy string[] order to PresentationItem[]. */\nexport function migrateToItems(order: string[] | undefined): PresentationItem[] | undefined {\n if (!order) return undefined\n return order.map((nodeId) => ({ type: \"node\" as const, nodeId }))\n}\n\n/** Strip nested groups — groups may only contain non-group items. */\nexport function validateNoNestedGroups(items: PresentationItem[]): PresentationItem[] {\n return items.map((item) => {\n if (item.type === \"group\") {\n return { ...item, items: item.items.filter((child) => child.type !== \"group\") }\n }\n return item\n })\n}\n\n/** Recursively flatten all items, unwrapping groups. */\nexport function flattenItems(items: PresentationItem[]): PresentationItem[] {\n const result: PresentationItem[] = []\n for (const item of items) {\n if (item.type === \"group\") {\n result.push(...flattenItems(item.items))\n } else {\n result.push(item)\n }\n }\n return result\n}\n\n/** Get the sortable/unique ID for a PresentationItem. */\nexport function getItemSortId(item: PresentationItem): string {\n return item.type === \"node\" ? item.nodeId : item.id\n}\n\n/** Remove items whose nodeId no longer exists in the workflow. */\nexport function cleanOrphanedItems(\n items: PresentationItem[],\n nodeIds: Set<string>\n): PresentationItem[] {\n return items\n .filter((item) => {\n if (item.type === \"node\" || item.type === \"field\" || item.type === \"output\") return nodeIds.has(item.nodeId)\n return true\n })\n .map((item) => {\n if (item.type === \"group\") {\n return { ...item, items: cleanOrphanedItems(item.items, nodeIds) }\n }\n return item\n })\n}\n"]}
@@ -52,7 +52,6 @@ function detectVideoLinkPlatform(url) {
52
52
  var VIDEO_LINK_TOLERANT_CONSUMER_TYPES = /* @__PURE__ */ new Set([
53
53
  "suno-cover",
54
54
  "transcribe",
55
- "dubbing",
56
55
  "content-recipe"
57
56
  ]);
58
57
  var VIDEO_LINK_AUDIO_CONSUMER_TYPES = /* @__PURE__ */ new Set(["suno-cover", "transcribe"]);
@@ -64,6 +63,13 @@ function videoLinkNeedOf(consumerTypes) {
64
63
  }
65
64
  return audio ? "audio" : "none";
66
65
  }
66
+ var WIRE_SETTING_ASIDE_FIELDS = /* @__PURE__ */ new Map([["dubbing", "sourceUrl"]]);
67
+ function setsAsideWiredMedia(node) {
68
+ const field = node?.type === void 0 ? void 0 : WIRE_SETTING_ASIDE_FIELDS.get(node.type);
69
+ if (!field) return false;
70
+ const value = node?.data?.[field];
71
+ return typeof value === "string" && value.trim() !== "";
72
+ }
67
73
  function videoLinkRunNeeds(scopeIds, nodes, edges) {
68
74
  const byId = new Map(nodes.map((n) => [n.id, n]));
69
75
  const isSkipped = (id) => byId.get(id)?.data?.skipped === true;
@@ -87,10 +93,10 @@ function videoLinkRunNeeds(scopeIds, nodes, edges) {
87
93
  const consumers = /* @__PURE__ */ new Map();
88
94
  for (const edge of edges) {
89
95
  if (byId.get(edge.source)?.type !== "youtube-video" || !inRun.has(edge.target)) continue;
90
- const list = consumers.get(edge.source);
91
- const type = byId.get(edge.target)?.type ?? "";
92
- if (list) list.push(type);
93
- else consumers.set(edge.source, [type]);
96
+ const target = byId.get(edge.target);
97
+ const list = consumers.get(edge.source) ?? [];
98
+ consumers.set(edge.source, list);
99
+ if (!setsAsideWiredMedia(target)) list.push(target?.type ?? "");
94
100
  }
95
101
  const needs = /* @__PURE__ */ new Map();
96
102
  for (const [id, types] of consumers) needs.set(id, videoLinkNeedOf(types));
@@ -210,5 +216,5 @@ exports.videoLinkNeedOf = videoLinkNeedOf;
210
216
  exports.videoLinkNeedsDownload = videoLinkNeedsDownload;
211
217
  exports.videoLinkPageUrl = videoLinkPageUrl;
212
218
  exports.videoLinkRunNeeds = videoLinkRunNeeds;
213
- //# sourceMappingURL=chunk-ANMCMSGR.cjs.map
214
- //# sourceMappingURL=chunk-ANMCMSGR.cjs.map
219
+ //# sourceMappingURL=chunk-YTXP4VHD.cjs.map
220
+ //# sourceMappingURL=chunk-YTXP4VHD.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/video-link.ts"],"names":[],"mappings":";;;AAoBO,IAAM,kBAAA,GAAqB;AAAA,EAChC,aAAA;AAAA,EAAe,UAAA;AAAA,EACf,YAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EAAe,OAAA;AAAA,EACf,cAAA;AAAA,EAAgB,UAAA;AAAA,EAAY;AAC9B;AAGO,IAAM,aAAA,GAAgB,CAAC,aAAA,EAAe,UAAU;AAGhD,IAAM,eAAA,GAAkB,CAAC,eAAe;AAE/C,IAAM,YAAA,GAAe,CAAC,YAAY,CAAA;AAClC,IAAM,aAAA,GAAgB,CAAC,aAAA,EAAe,OAAO,CAAA;AAC7C,IAAM,cAAA,GAAiB,CAAC,cAAA,EAAgB,UAAA,EAAY,QAAQ,CAAA;AAQrD,SAAS,wBAAA,CAAyB,UAAkB,OAAA,EAAqC;AAC9F,EAAA,MAAM,IAAI,QAAA,CAAS,WAAA,EAAY,CAAE,OAAA,CAAQ,OAAO,EAAE,CAAA;AAClD,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,KAAM;AACzB,IAAA,MAAM,GAAA,GAAM,EAAE,WAAA,EAAY;AAC1B,IAAA,OAAO,CAAA,KAAM,GAAA,IAAO,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AAG,OAAO,IAAA;AACtE,EAAA,MAAM,GAAA,GAA+B,EAAE,GAAG,IAAA,EAAK;AAC/C,EAAA,KAAA,MAAW,GAAA,IAAO,yBAAA,EAA2B,OAAO,GAAA,CAAI,GAAG,CAAA;AAC3D,EAAA,OAAO,GAAA;AACT","file":"chunk-YTXP4VHD.cjs","sourcesContent":["/**\n * The Video URL node (`youtube-video`) and the social-video import path —\n * structural vocabulary shared by the canvas, the orchestrator and the\n * download routes. Host names and a node-output rule only; no prompt content.\n *\n * ONE list, three readers:\n * - the backend's yt-dlp routes (`lib/url-validator.ts` re-exports these),\n * where the list IS the SSRF gate — yt-dlp does its own DNS + HTTP, so\n * nothing but this exact-suffix match stands between a pasted link and an\n * internal address;\n * - the editor, which decides from the same list whether a pasted link is\n * one it should download (it must never offer a host the server refuses,\n * nor sit on one the server accepts);\n * - both workflow engines, which read a node's output through\n * `resolveVideoLinkOutput`.\n *\n * ⚠️ Adding a host here ADMITS it to a server-side fetch. It is a security\n * decision, not a UI one — only fixed, reputable domains whose DNS an attacker\n * cannot control.\n */\nexport const SOCIAL_VIDEO_HOSTS = [\n \"youtube.com\", \"youtu.be\",\n \"tiktok.com\",\n \"instagram.com\",\n \"twitter.com\", \"x.com\",\n \"facebook.com\", \"fb.watch\", \"fb.com\",\n] as const\n\n/** YouTube-only subset (the metadata probe and the client ladder are YouTube-only). */\nexport const YOUTUBE_HOSTS = [\"youtube.com\", \"youtu.be\"] as const\n\n/** Instagram-only subset (the download path's proxy failover is Instagram-scoped). */\nexport const INSTAGRAM_HOSTS = [\"instagram.com\"] as const\n\nconst TIKTOK_HOSTS = [\"tiktok.com\"] as const\nconst TWITTER_HOSTS = [\"twitter.com\", \"x.com\"] as const\nconst FACEBOOK_HOSTS = [\"facebook.com\", \"fb.watch\", \"fb.com\"] as const\n\n/**\n * Exact registrable-domain match against an allowlist: the domain itself or a\n * true subdomain (`www.youtube.com`, `m.youtu.be`). A host that merely\n * CONTAINS an allowlisted name (`evilyoutube.com`, `youtube.com.attacker.example`,\n * or `netflix.com` for `x.com`) does not match.\n */\nexport function hostnameMatchesAllowlist(hostname: string, domains: readonly string[]): boolean {\n const h = hostname.toLowerCase().replace(/\\.$/, \"\") // strip FQDN trailing dot\n return domains.some((d) => {\n const dom = d.toLowerCase()\n return h === dom || h.endsWith(\".\" + dom)\n })\n}\n\n/**\n * True when the RAW link carries a character that URL parsers read differently:\n * a backslash or an ASCII control character.\n *\n * Every check in this file parses the WHATWG way (Node, the browser), where a\n * backslash in an http(s) URL is a slash — `https://tiktok.com\\@10.0.0.1/x` has\n * host `tiktok.com`. A parser that ends the authority at `/` alone reads the\n * same string as a user name at host `10.0.0.1`. The download tools are handed\n * the raw string and do their own parsing, DNS and HTTP, so a link the two\n * readings can disagree on is refused outright rather than reasoned about. Tabs\n * and newlines are dropped silently by one parser and kept by another — same\n * answer. No real video link contains any of these.\n */\nexport function hasUrlParserHazard(url: string): boolean {\n for (let i = 0; i < url.length; i++) {\n const code = url.charCodeAt(i)\n if (code === 0x5c || code <= 0x1f || code === 0x7f) return true\n }\n return false\n}\n\n/** True for an http(s) URL whose host is on the allowlist. Never throws. */\nexport function isSocialVideoUrl(url: string, domains: readonly string[] = SOCIAL_VIDEO_HOSTS): boolean {\n if (hasUrlParserHazard(url)) return false\n try {\n const parsed = new URL(url)\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false\n return hostnameMatchesAllowlist(parsed.hostname, domains)\n } catch {\n return false\n }\n}\n\nexport type VideoLinkPlatform = \"youtube\" | \"facebook\" | \"tiktok\" | \"instagram\" | \"twitter\" | \"unknown\"\n\n/** Which supported platform a link belongs to — by exact host, never by substring. */\nexport function detectVideoLinkPlatform(url: string): VideoLinkPlatform {\n if (isSocialVideoUrl(url, YOUTUBE_HOSTS)) return \"youtube\"\n if (isSocialVideoUrl(url, FACEBOOK_HOSTS)) return \"facebook\"\n if (isSocialVideoUrl(url, TIKTOK_HOSTS)) return \"tiktok\"\n if (isSocialVideoUrl(url, INSTAGRAM_HOSTS)) return \"instagram\"\n if (isSocialVideoUrl(url, TWITTER_HOSTS)) return \"twitter\"\n return \"unknown\"\n}\n\n/**\n * Node types that can use a Video URL node WITHOUT its downloaded file, because\n * they never read the video: `suno-cover` and `transcribe` take the node's\n * separately-fetched audio track (`downloadedAudioUrl`), and `content-recipe`\n * cites the post's page link on its `link` input (`videoLinkPageUrl`, both\n * resolvers) — a Video URL can reach it on no other input. A run whose only\n * consumers of a link are these must not be made to download — or to choose a\n * part of — a video nobody will look at. Structural vocabulary: it mirrors\n * those server-side readers; add a type here only together with its reader.\n * Dubbing is not one: it dubs the file wired into it, and a page link wired in\n * place of the file is not something its service can read as one.\n */\nexport const VIDEO_LINK_TOLERANT_CONSUMER_TYPES: ReadonlySet<string> = new Set([\n \"suno-cover\",\n \"transcribe\",\n \"content-recipe\",\n])\n\n/**\n * The tolerant consumers that DO read something fetched from the link — the\n * separately-fetched audio track (`downloadedAudioUrl`): Transcribe and Suno\n * Cover. The rest of the tolerant set (Content Recipe) reads only the page\n * link and needs nothing fetched. A subset of the tolerant set by construction\n * (guard test).\n */\nexport const VIDEO_LINK_AUDIO_CONSUMER_TYPES: ReadonlySet<string> = new Set([\"suno-cover\", \"transcribe\"])\n\n/**\n * What a run must FETCH for a Video URL node holding a post link:\n * - `file`: some node in the run watches the video — download the video;\n * - `audio`: every reader is tolerant and at least one takes the audio track —\n * fetch the track only, never the video (and never ask for a part of it);\n * - `none`: every reader takes the page link alone — fetch nothing.\n */\nexport type VideoLinkNeed = \"file\" | \"audio\" | \"none\"\n\n/** The need of a node read by consumers of these types. No consumer reads nothing. */\nexport function videoLinkNeedOf(consumerTypes: Iterable<string>): VideoLinkNeed {\n let audio = false\n for (const type of consumerTypes) {\n if (!VIDEO_LINK_TOLERANT_CONSUMER_TYPES.has(type)) return \"file\"\n if (VIDEO_LINK_AUDIO_CONSUMER_TYPES.has(type)) audio = true\n }\n return audio ? \"audio\" : \"none\"\n}\n\n/**\n * Node types that set aside every wired media input while a field of their own\n * holds a link, and that field: a Dubbing node with a Source link dubs that\n * link (the dubbing service fetches it) and reads nothing wired into it. It\n * mirrors both engines' source precedence for the type (the payload builder\n * and the editor's runner).\n */\nconst WIRE_SETTING_ASIDE_FIELDS: ReadonlyMap<string, string> = new Map([[\"dubbing\", \"sourceUrl\"]])\n\n/** True when this node, as it stands, reads nothing wired into it (its own link field is filled). */\nfunction setsAsideWiredMedia(node: VideoLinkGraphNode | undefined): boolean {\n const field = node?.type === undefined ? undefined : WIRE_SETTING_ASIDE_FIELDS.get(node.type)\n if (!field) return false\n const value = (node?.data as Record<string, unknown> | undefined)?.[field]\n return typeof value === \"string\" && value.trim() !== \"\"\n}\n\n/** The node shape the graph readers need — open on purpose, both engines' nodes fit. */\nexport interface VideoLinkGraphNode {\n readonly id: string\n readonly type?: string\n readonly data?: unknown\n}\n\nexport interface VideoLinkGraphEdge {\n readonly source: string\n readonly target: string\n}\n\n/**\n * The need of every Video URL node that feeds the run, by node id — ONE reading\n * of the graph for the editor's pre-run gate, the app runner's card and the\n * server's pre-run fetch, so the three cannot disagree on what a run needs.\n *\n * `scopeIds` are the nodes about to run (`null` = every node: an app runs its\n * whole graph). The run is those nodes plus everything they read from, at any\n * depth; a link that feeds nothing in it is absent (a long video parked on the\n * canvas must never block an unrelated run). Skipped nodes are not part of the\n * run and pull nothing in.\n */\nexport function videoLinkRunNeeds(\n scopeIds: readonly string[] | null,\n nodes: readonly VideoLinkGraphNode[],\n edges: readonly VideoLinkGraphEdge[],\n): Map<string, VideoLinkNeed> {\n const byId = new Map(nodes.map((n) => [n.id, n] as const))\n const isSkipped = (id: string) => (byId.get(id)?.data as { skipped?: unknown } | undefined)?.skipped === true\n\n const sourcesOf = new Map<string, string[]>()\n for (const edge of edges) {\n const list = sourcesOf.get(edge.target)\n if (list) list.push(edge.source)\n else sourcesOf.set(edge.target, [edge.source])\n }\n\n // Everything the run touches: the nodes about to run plus all they read from.\n const inRun = new Set<string>()\n const queue = (scopeIds ?? nodes.map((n) => n.id)).filter((id) => !isSkipped(id))\n for (const id of queue) inRun.add(id)\n while (queue.length > 0) {\n const current = queue.pop()!\n for (const source of sourcesOf.get(current) ?? []) {\n if (inRun.has(source)) continue\n inRun.add(source)\n queue.push(source)\n }\n }\n\n const consumers = new Map<string, string[]>()\n for (const edge of edges) {\n if (byId.get(edge.source)?.type !== \"youtube-video\" || !inRun.has(edge.target)) continue\n const target = byId.get(edge.target)\n const list = consumers.get(edge.source) ?? []\n consumers.set(edge.source, list)\n // A reader that sets the wire aside (a Dubbing node with its own Source\n // link) reads nothing from the link: it asks nothing to be fetched, and a\n // link read by it alone needs nothing (the entry stays, with no reader).\n if (!setsAsideWiredMedia(target)) list.push(target?.type ?? \"\")\n }\n const needs = new Map<string, VideoLinkNeed>()\n for (const [id, types] of consumers) needs.set(id, videoLinkNeedOf(types))\n return needs\n}\n\n/**\n * The fields of a Video URL node's data that decide what it emits. Open-ended\n * on purpose: both engines hand over the node's whole `data` bag, and a closed\n * shape with only optional members would refuse it as having nothing in common.\n */\nexport interface VideoLinkNodeFields {\n readonly youtubeUrl?: unknown\n readonly downloadedVideoUrl?: unknown\n readonly downloadedFromUrl?: unknown\n readonly [key: string]: unknown\n}\n\nfunction trimmed(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined\n const t = value.trim()\n return t === \"\" ? undefined : t\n}\n\n/**\n * The stored file that belongs to the node's CURRENT link, or undefined.\n *\n * `downloadedFromUrl` binds a file to the link it came from. The editor clears\n * the file whenever the link is edited, but a link can also change where no\n * editor is looking — an agent or an import rewriting the workflow JSON — and\n * without the binding the node would go on emitting the PREVIOUS video, which\n * is worse than emitting none. A node saved before the field existed has no\n * binding and is trusted as it always was.\n */\nexport function videoLinkDownloadedFile(data: VideoLinkNodeFields): string | undefined {\n const file = trimmed(data.downloadedVideoUrl)\n if (!file) return undefined\n const from = trimmed(data.downloadedFromUrl)\n if (from && from !== trimmed(data.youtubeUrl)) return undefined\n return file\n}\n\n/**\n * What a Video URL node emits on its `video` handle: the downloaded file when\n * one matches the link, else the link itself. The fallback is load-bearing — a\n * DIRECT file link (`https://cdn…/clip.mp4`) is a legitimate value of the URL\n * field and is never downloaded, so it must pass through.\n */\nexport function resolveVideoLinkOutput(data: VideoLinkNodeFields): string | undefined {\n return videoLinkDownloadedFile(data) ?? trimmed(data.youtubeUrl)\n}\n\n/**\n * The page link a Video URL node was given (the post's own address), never\n * the downloaded file. Read by consumers that CITE a post rather than watch\n * it — Content Recipe's \"Source post\" input stores it as the recipe's source.\n */\nexport function videoLinkPageUrl(data: VideoLinkNodeFields): string | undefined {\n return trimmed(data.youtubeUrl)\n}\n\n/**\n * True when the node holds a social link with no file for it yet — the state\n * in which its output is a web PAGE, which no video consumer can read.\n */\nexport function videoLinkNeedsDownload(data: VideoLinkNodeFields): boolean {\n const url = trimmed(data.youtubeUrl)\n if (!url || !isSocialVideoUrl(url)) return false\n return videoLinkDownloadedFile(data) === undefined\n}\n\n// ---------------------------------------------------------------------------\n// The link as an APP INPUT (a published app, MCP `run_app`, the SDK)\n// ---------------------------------------------------------------------------\n\n/**\n * File extensions accepted as DIRECT video-file links (pathname suffix match).\n * Mirrors save-to-storage's video auto-detect set.\n */\nexport const DIRECT_VIDEO_EXTENSIONS = [\".mp4\", \".webm\", \".mov\", \".avi\"] as const\n\n/**\n * True for a DIRECT video-file link: http(s) whose PATHNAME ends in a video\n * extension — `https://cdn.nodaro.ai/uploads/videos/<id>.mp4` and any other\n * cdn-style link. Query and fragment are ignored (signed CDN links keep the\n * extension in the path); an extension that appears only in the query does\n * not qualify. Host-agnostic BY DESIGN, which is exactly why admission is not\n * sufficient on its own: the download route pre-resolves these hosts before it\n * fetches (`resolvesOnlyToPublicAddresses`), and every other reader goes\n * through the SSRF-guarded fetch.\n *\n * A link carrying a backslash or a control character is refused first\n * (`hasUrlParserHazard`): the route pre-resolves the WHATWG host, and the\n * download tool would fetch whatever host ITS parser reads.\n */\nexport function isDirectVideoFileUrl(url: string): boolean {\n if (hasUrlParserHazard(url)) return false\n try {\n const parsed = new URL(url)\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false\n const path = parsed.pathname.toLowerCase()\n return DIRECT_VIDEO_EXTENSIONS.some((ext) => path.endsWith(ext))\n } catch {\n return false\n }\n}\n\n/**\n * A YouTube video shorter than this downloads whole the moment the link lands;\n * a longer one (or one whose length could not be read) waits for a part to be\n * chosen. The same 4 minutes Recast and Studio use — a two-hour talk nobody\n * asked for never gets fetched by accident. One number for the canvas node, the\n * app runner's card and the server's pre-run fetch.\n */\nexport const AUTO_DOWNLOAD_MAX_SEC = 240\n\n/** YouTube's quality cap (\"up to N rows\"). Other hosts have no ladder worth capping. */\nexport const YOUTUBE_MAX_HEIGHT = 1080\n\n/** The longest link an app input accepts. A real video link is a few hundred characters. */\nexport const MAX_VIDEO_LINK_INPUT_CHARS = 2048\n\nexport type VideoLinkInputProblem = \"empty\" | \"invalid\"\n\n/**\n * The ONE rule for what a Video URL app input may hold — the canvas node's own\n * (decided 2026-10-08): a link to a supported social host (downloaded before\n * the nodes that need the file run), or any other http(s) link (passed through\n * as it is, never downloaded; the nodes that read it fetch it through the\n * SSRF-guarded fetch). The app runner's card, the run-request lock and MCP\n * `get_app_inputs` all read it, so a link the card accepts is a link the\n * server accepts, and the reverse.\n *\n * Structural only: the server layers its SSRF guard on top (`safeUrlSchema`),\n * and the card refuses a literal local / private host. A link carrying a\n * backslash or a control character is refused (`hasUrlParserHazard`).\n * `null` = fine; leading and trailing spaces are not a problem (the card trims\n * before it sends).\n */\nexport function videoLinkInputProblem(value: unknown): VideoLinkInputProblem | null {\n if (value === undefined || value === null) return \"empty\"\n if (typeof value !== \"string\") return \"invalid\"\n const link = value.trim()\n if (link === \"\") return \"empty\"\n if (link.length > MAX_VIDEO_LINK_INPUT_CHARS) return \"invalid\"\n return isSocialVideoUrl(link) || isHttpLink(link) ? null : \"invalid\"\n}\n\nfunction isHttpLink(link: string): boolean {\n if (hasUrlParserHazard(link)) return false\n try {\n const parsed = new URL(link)\n return (parsed.protocol === \"http:\" || parsed.protocol === \"https:\") && parsed.hostname !== \"\"\n } catch {\n return false\n }\n}\n\n/**\n * The fields of a Video URL node's data that belong to ONE link: the file and\n * audio track fetched from it, the progress of that fetch, and what was read\n * from the link (its id, title, picture, length). Every one of them describes\n * the link it was made for.\n *\n * A run-time override that swaps the link (`dropStaleVideoLinkFields`) drops\n * these first, because the creator's published node carries all of them and a\n * shallow merge would leave them standing under the caller's link — the audio\n * track in particular has no binding to its link (`downloadedAudioUrl` is read\n * straight off the node by Transcribe and Suno Cover), so a caller's episode\n * would be transcribed from the creator's sample. The editor's own\n * link-change reset (`CLEARED_DOWNLOAD` in `lib/video-link-ingest.ts`) is\n * guarded to be inside this list.\n */\nexport const VIDEO_LINK_DERIVED_FIELDS = [\n \"videoId\",\n \"title\",\n \"thumbnailUrl\",\n \"downloadedVideoUrl\",\n \"downloadedThumbnailUrl\",\n \"downloadedFromUrl\",\n \"downloadedSection\",\n \"downloadStatus\",\n \"downloadError\",\n \"downloadErrorCode\",\n \"downloadId\",\n \"downloadIdUrl\",\n \"downloadMode\",\n \"downloadAllowSilent\",\n \"downloadPercent\",\n \"downloadPhase\",\n \"sectionStartSec\",\n \"sectionEndSec\",\n \"needsRangeChoice\",\n \"videoDurationSec\",\n \"downloadedAudioUrl\",\n \"audioDownloadStatus\",\n \"audioDownloadError\",\n // The content rights confirmation a run's own fetch of the link is made\n // under: recorded for ONE link, so it never stands under another.\n \"rightsConfirmationId\",\n] as const\n\n/**\n * The saved Video URL node data without what belonged to its previous link,\n * when `incoming` (the run's override for the node) points it at a different\n * one. A field the override brings itself is kept (the merge applies it after\n * this). Returns the SAME object when the link is not being changed; never\n * mutates.\n */\nexport function dropStaleVideoLinkFields(\n data: Record<string, unknown>,\n incoming: Record<string, unknown>,\n): Record<string, unknown> {\n if (!(\"youtubeUrl\" in incoming)) return data\n if (trimmed(incoming.youtubeUrl) === trimmed(data.youtubeUrl)) return data\n const out: Record<string, unknown> = { ...data }\n for (const key of VIDEO_LINK_DERIVED_FIELDS) delete out[key]\n return out\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { UGC_PRIMARY_HANDLE } from './chunk-KMSEU6FK.js';
2
- import { dropStaleVideoLinkFields } from './chunk-IB5B3EBD.js';
2
+ import { dropStaleVideoLinkFields } from './chunk-JCNTNAZP.js';
3
3
  import { composeUnitSet, unitProducers, composeUnitRecord, unitFanOutEach, unitsPresenting } from './chunk-FVVD6XY2.js';
4
4
  import { SPEAKER_VIEW_CREDIT_IDS, speakerViewCreditId, applyEdlCreditId } from './chunk-5DVDHL7Y.js';
5
5
 
@@ -762,5 +762,5 @@ function cleanOrphanedItems(items, nodeIds) {
762
762
  }
763
763
 
764
764
  export { AUDIO_PRODUCER_TYPES, DYNAMIC_PRODUCER_TYPES, FAN_IN_TARGETS, FAN_OUT_ALL_OR_NOTHING_TYPES, FAN_OUT_EACH_HANDLES, FAN_OUT_EACH_TYPES, IMAGE_PRODUCER_TYPES, INPUT_FIELD_EXTRA_KEYS, INPUT_FIELD_MAP, INPUT_NODE_TYPES, LEGACY_EXPOSED_FIELD_KEYS, OWNER_ONLY_LISTING_RENDER_TYPES, OWN_LIST_NODE_TYPES, RENDER_JSON_HANDLE, RENDER_NODE_TYPES, RENDER_NODE_TYPE_IDS, VIDEO_PRODUCER_TYPES, canonicalExposedFieldKey, canonicalizeOverrideKeys, cleanOrphanedItems, defaultEdgeOutputMode, flattenItems, getInputFieldExtraKeys, getInputFieldSchema, getInputNodes, getItemSortId, getNodeLabel, getNodeResult, getOutputNodes, getOutputType, isFanInEdge, isFanInNodeType, isRenderDataHandle, isRenderNodeType, listResultsServeHandle, mergeNodeInputOverrides, migrateToItems, ownsItsList, renderNodeOf, renderSavedJsonOutputs, renderTranscriptOutputOf, rendersLatestBatch, rendersTranscriptJson, validateNoNestedGroups };
765
- //# sourceMappingURL=chunk-NMX6HQC3.js.map
766
- //# sourceMappingURL=chunk-NMX6HQC3.js.map
765
+ //# sourceMappingURL=chunk-ZAK276QF.js.map
766
+ //# sourceMappingURL=chunk-ZAK276QF.js.map