@nodaro/shared 3.48.0 → 3.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/{chunk-GFK4DZFC.js → chunk-26L7NHK4.js} +4 -4
  2. package/dist/{chunk-GFK4DZFC.js.map → chunk-26L7NHK4.js.map} +1 -1
  3. package/dist/{chunk-Y5DCFOLQ.js → chunk-27LQR7DO.js} +3 -3
  4. package/dist/{chunk-Y5DCFOLQ.js.map → chunk-27LQR7DO.js.map} +1 -1
  5. package/dist/{chunk-CRCQCK6X.cjs → chunk-2JUNYRMS.cjs} +26 -29
  6. package/dist/chunk-2JUNYRMS.cjs.map +1 -0
  7. package/dist/{chunk-A6HWGGU3.cjs → chunk-6GTTATPR.cjs} +6 -6
  8. package/dist/{chunk-A6HWGGU3.cjs.map → chunk-6GTTATPR.cjs.map} +1 -1
  9. package/dist/{chunk-VNB4BH36.js → chunk-6TL7JMVF.js} +5 -5
  10. package/dist/{chunk-VNB4BH36.js.map → chunk-6TL7JMVF.js.map} +1 -1
  11. package/dist/{chunk-ZHRU7HF3.js → chunk-77R3HYOE.js} +5 -5
  12. package/dist/{chunk-ZHRU7HF3.js.map → chunk-77R3HYOE.js.map} +1 -1
  13. package/dist/{chunk-H3HV4OZM.js → chunk-AENQLVQH.js} +4 -4
  14. package/dist/{chunk-H3HV4OZM.js.map → chunk-AENQLVQH.js.map} +1 -1
  15. package/dist/{chunk-EOY4G4GQ.cjs → chunk-BQSXEU3O.cjs} +4 -4
  16. package/dist/{chunk-EOY4G4GQ.cjs.map → chunk-BQSXEU3O.cjs.map} +1 -1
  17. package/dist/{chunk-ZEMK3FPF.cjs → chunk-DDTA6X2S.cjs} +8 -8
  18. package/dist/{chunk-ZEMK3FPF.cjs.map → chunk-DDTA6X2S.cjs.map} +1 -1
  19. package/dist/{chunk-BAUQVNG5.cjs → chunk-DPUIJHM7.cjs} +5 -5
  20. package/dist/{chunk-BAUQVNG5.cjs.map → chunk-DPUIJHM7.cjs.map} +1 -1
  21. package/dist/{chunk-FLC5KEYV.js → chunk-DZOCFLMK.js} +3 -3
  22. package/dist/{chunk-FLC5KEYV.js.map → chunk-DZOCFLMK.js.map} +1 -1
  23. package/dist/{chunk-FZFHP5SA.cjs → chunk-FEPSSBD5.cjs} +5 -5
  24. package/dist/{chunk-FZFHP5SA.cjs.map → chunk-FEPSSBD5.cjs.map} +1 -1
  25. package/dist/{chunk-AKXCJKWT.js → chunk-FV43YJ5I.js} +4 -4
  26. package/dist/{chunk-AKXCJKWT.js.map → chunk-FV43YJ5I.js.map} +1 -1
  27. package/dist/{chunk-3O6JBTJW.js → chunk-GIU37YMD.js} +8 -11
  28. package/dist/chunk-GIU37YMD.js.map +1 -0
  29. package/dist/{chunk-P3A3QVFA.js → chunk-HCZYIYKK.js} +4 -4
  30. package/dist/{chunk-P3A3QVFA.js.map → chunk-HCZYIYKK.js.map} +1 -1
  31. package/dist/{chunk-2JRAAOQD.js → chunk-HNBJP2IR.js} +3 -3
  32. package/dist/{chunk-2JRAAOQD.js.map → chunk-HNBJP2IR.js.map} +1 -1
  33. package/dist/{chunk-HS2IAUYM.cjs → chunk-HPT244UT.cjs} +6 -6
  34. package/dist/{chunk-HS2IAUYM.cjs.map → chunk-HPT244UT.cjs.map} +1 -1
  35. package/dist/{chunk-UTCOO6PQ.js → chunk-JGCGLHZL.js} +3 -3
  36. package/dist/{chunk-UTCOO6PQ.js.map → chunk-JGCGLHZL.js.map} +1 -1
  37. package/dist/{chunk-KV6MNZHI.js → chunk-KOVIMPZS.js} +3 -3
  38. package/dist/{chunk-KV6MNZHI.js.map → chunk-KOVIMPZS.js.map} +1 -1
  39. package/dist/{chunk-G7MSESCZ.js → chunk-ML7Q2LTB.js} +8 -16
  40. package/dist/chunk-ML7Q2LTB.js.map +1 -0
  41. package/dist/{chunk-TQH7DYZP.cjs → chunk-NGT2FYP2.cjs} +8 -16
  42. package/dist/chunk-NGT2FYP2.cjs.map +1 -0
  43. package/dist/{chunk-HP4X2XGD.cjs → chunk-NU6UR5RI.cjs} +8 -8
  44. package/dist/{chunk-HP4X2XGD.cjs.map → chunk-NU6UR5RI.cjs.map} +1 -1
  45. package/dist/{chunk-4ZNG2PHH.js → chunk-QBRTPVT6.js} +8 -8
  46. package/dist/{chunk-4ZNG2PHH.js.map → chunk-QBRTPVT6.js.map} +1 -1
  47. package/dist/chunk-QIXL2ZLX.cjs +27 -0
  48. package/dist/{chunk-UEXF2XQH.cjs.map → chunk-QIXL2ZLX.cjs.map} +1 -1
  49. package/dist/{chunk-2FYKQVMA.cjs → chunk-QZANEGZ3.cjs} +21 -21
  50. package/dist/{chunk-2FYKQVMA.cjs.map → chunk-QZANEGZ3.cjs.map} +1 -1
  51. package/dist/{chunk-PNYOLAD6.cjs → chunk-S5CRPOYD.cjs} +43 -43
  52. package/dist/{chunk-PNYOLAD6.cjs.map → chunk-S5CRPOYD.cjs.map} +1 -1
  53. package/dist/{chunk-GBB4VVVZ.cjs → chunk-TA5MZZKE.cjs} +45 -45
  54. package/dist/{chunk-GBB4VVVZ.cjs.map → chunk-TA5MZZKE.cjs.map} +1 -1
  55. package/dist/{chunk-FZQVONQ2.cjs → chunk-TMXFL6RC.cjs} +12 -12
  56. package/dist/{chunk-FZQVONQ2.cjs.map → chunk-TMXFL6RC.cjs.map} +1 -1
  57. package/dist/{chunk-FIWTGVGY.cjs → chunk-U6BDA2CX.cjs} +11 -11
  58. package/dist/{chunk-FIWTGVGY.cjs.map → chunk-U6BDA2CX.cjs.map} +1 -1
  59. package/dist/{chunk-HZMZLUU3.cjs → chunk-UDYFWB7D.cjs} +4 -4
  60. package/dist/{chunk-HZMZLUU3.cjs.map → chunk-UDYFWB7D.cjs.map} +1 -1
  61. package/dist/{chunk-6W4XHOR2.js → chunk-VCHWYREY.js} +3 -3
  62. package/dist/{chunk-6W4XHOR2.js.map → chunk-VCHWYREY.js.map} +1 -1
  63. package/dist/{chunk-BWXF34WW.js → chunk-WAUWKYLF.js} +3 -3
  64. package/dist/{chunk-BWXF34WW.js.map → chunk-WAUWKYLF.js.map} +1 -1
  65. package/dist/{chunk-44PLEHQS.js → chunk-X62EMX7Y.js} +4 -4
  66. package/dist/chunk-X62EMX7Y.js.map +1 -0
  67. package/dist/{chunk-XYUCAZS6.cjs → chunk-XQBBBQZH.cjs} +39 -39
  68. package/dist/chunk-XQBBBQZH.cjs.map +1 -0
  69. package/dist/entries/apps.cjs +42 -42
  70. package/dist/entries/apps.js +7 -7
  71. package/dist/entries/credits.cjs +150 -150
  72. package/dist/entries/credits.js +7 -7
  73. package/dist/entries/llm-models.d.cts +1 -1
  74. package/dist/entries/llm-models.d.ts +1 -1
  75. package/dist/entries/model-catalog.cjs +66 -66
  76. package/dist/entries/model-catalog.js +4 -4
  77. package/dist/entries/models.cjs +276 -276
  78. package/dist/entries/models.d.cts +6 -4
  79. package/dist/entries/models.d.ts +6 -4
  80. package/dist/entries/models.js +4 -4
  81. package/dist/entries/nodes.cjs +206 -206
  82. package/dist/entries/nodes.js +8 -8
  83. package/dist/entries/pipeline.cjs +149 -149
  84. package/dist/entries/pipeline.d.cts +1 -1
  85. package/dist/entries/pipeline.d.ts +1 -1
  86. package/dist/entries/pipeline.js +3 -3
  87. package/dist/entries/ugc.cjs +71 -71
  88. package/dist/entries/ugc.js +4 -4
  89. package/dist/entries/video.cjs +117 -117
  90. package/dist/entries/video.js +4 -4
  91. package/dist/index.cjs +1053 -1053
  92. package/dist/index.d.cts +1 -1
  93. package/dist/index.d.ts +1 -1
  94. package/dist/index.js +17 -17
  95. package/dist/{model-constants-BL-Ae0OU.d.ts → model-constants-DZUGVDOw.d.cts} +13 -3
  96. package/dist/{model-constants-BL-Ae0OU.d.cts → model-constants-DZUGVDOw.d.ts} +13 -3
  97. package/package.json +1 -1
  98. package/src/cast-swap-limits.ts +4 -2
  99. package/src/model-catalog.ts +6 -14
  100. package/src/model-constants.ts +16 -9
  101. package/dist/chunk-3O6JBTJW.js.map +0 -1
  102. package/dist/chunk-44PLEHQS.js.map +0 -1
  103. package/dist/chunk-CRCQCK6X.cjs.map +0 -1
  104. package/dist/chunk-G7MSESCZ.js.map +0 -1
  105. package/dist/chunk-TQH7DYZP.cjs.map +0 -1
  106. package/dist/chunk-UEXF2XQH.cjs +0 -27
  107. package/dist/chunk-XYUCAZS6.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
- import { UGC_PRIMARY_HANDLE } from './chunk-2JRAAOQD.js';
1
+ import { UGC_PRIMARY_HANDLE } from './chunk-HNBJP2IR.js';
2
2
  import { dropStaleVideoLinkFields } from './chunk-TZBIY5C3.js';
3
3
  import { composeUnitSet, unitProducers, composeUnitRecord, unitFanOutEach, unitsPresenting } from './chunk-CQJYKSXF.js';
4
- import { SPEAKER_VIEW_CREDIT_IDS, speakerViewCreditId, applyEdlCreditId } from './chunk-VNB4BH36.js';
4
+ import { SPEAKER_VIEW_CREDIT_IDS, speakerViewCreditId, applyEdlCreditId } from './chunk-6TL7JMVF.js';
5
5
 
6
6
  // src/producer-types.ts
7
7
  var VIDEO_PRODUCER_TYPES = composeUnitSet("VIDEO_PRODUCER_TYPES", [
@@ -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-H3HV4OZM.js.map
766
- //# sourceMappingURL=chunk-H3HV4OZM.js.map
765
+ //# sourceMappingURL=chunk-AENQLVQH.js.map
766
+ //# sourceMappingURL=chunk-AENQLVQH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/producer-types.ts","../src/exposed-field-keys.ts","../src/render-nodes.ts","../src/presentation-utils.ts"],"names":["url","text"],"mappings":";;;;;;AA2BO,IAAM,oBAAA,GAA4C,eAAe,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,EACA,aAAA;AAAA,EACA,cAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAA;AAAA;AAAA;AAAA,EAGA,cAAA;AAAA,EACA,cAAA;AAAA;AAAA;AAAA;AAAA,EAIA,WAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAA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,CAAM,IAAA,KAAS,OAAO,CAAA,EAAE;AAAA,IAChF;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA;AACH;AAGO,SAAS,aAAa,KAAA,EAA+C;AAC1E,EAAA,MAAM,SAA6B,EAAC;AACpC,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,IAAA,CAAK,SAAS,OAAA,EAAS;AACzB,MAAA,MAAA,CAAO,IAAA,CAAK,GAAG,YAAA,CAAa,IAAA,CAAK,KAAK,CAAC,CAAA;AAAA,IACzC,CAAA,MAAO;AACL,MAAA,MAAA,CAAO,KAAK,IAAI,CAAA;AAAA,IAClB;AAAA,EACF;AACA,EAAA,OAAO,MAAA;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-H3HV4OZM.js","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":["url","text"],"mappings":";;;;;;AA2BO,IAAM,oBAAA,GAA4C,eAAe,sBAAA,EAAwB;AAAA,EAC9F,gBAAA;AAAA,EACA,gB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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-AENQLVQH.js","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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkCRCQCK6X_cjs = require('./chunk-CRCQCK6X.cjs');
3
+ var chunk2JUNYRMS_cjs = require('./chunk-2JUNYRMS.cjs');
4
4
 
5
5
  // src/fan-out-meta.ts
6
6
  function fanOutItemMeta(output) {
@@ -441,7 +441,7 @@ function ugcCardsJobs(input) {
441
441
  if (typeof transcript !== "string") return { error: NEEDS_TRANSCRIPT };
442
442
  return {
443
443
  alignment: { path: "/v1/forced-alignment", body: { audioUrl: videoUrl, transcript } },
444
- transcribe: { path: "/v1/transcribe", body: { ...transcribeArgs, audioUrl: videoUrl, provider: chunkCRCQCK6X_cjs.DEFAULT_TRANSCRIBE_NODE_PROVIDER, wordTimestamps: true } },
444
+ transcribe: { path: "/v1/transcribe", body: { ...transcribeArgs, audioUrl: videoUrl, provider: chunk2JUNYRMS_cjs.DEFAULT_TRANSCRIBE_NODE_PROVIDER, wordTimestamps: true } },
445
445
  plan
446
446
  };
447
447
  }
@@ -522,5 +522,5 @@ exports.ugcRunWaitsForPick = ugcRunWaitsForPick;
522
522
  exports.ugcScriptBody = ugcScriptBody;
523
523
  exports.ugcScriptOutputs = ugcScriptOutputs;
524
524
  exports.ugcScriptResult = ugcScriptResult;
525
- //# sourceMappingURL=chunk-EOY4G4GQ.cjs.map
526
- //# sourceMappingURL=chunk-EOY4G4GQ.cjs.map
525
+ //# sourceMappingURL=chunk-BQSXEU3O.cjs.map
526
+ //# sourceMappingURL=chunk-BQSXEU3O.cjs.map