@nodaro/shared 3.33.0 → 3.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2NQLSLSN.cjs → chunk-24ZKPE33.cjs} +5 -5
- package/dist/{chunk-2NQLSLSN.cjs.map → chunk-24ZKPE33.cjs.map} +1 -1
- package/dist/{chunk-CK3GK34R.js → chunk-2HIDE3QV.js} +9 -3
- package/dist/chunk-2HIDE3QV.js.map +1 -0
- package/dist/{chunk-WDIBOWAA.js → chunk-2HVFF5SS.js} +6 -6
- package/dist/chunk-2HVFF5SS.js.map +1 -0
- package/dist/{chunk-FT5CF6IA.js → chunk-2QWNPYDG.js} +3 -3
- package/dist/{chunk-FT5CF6IA.js.map → chunk-2QWNPYDG.js.map} +1 -1
- package/dist/{chunk-M7GQBRZU.cjs → chunk-3YG3MYDE.cjs} +153 -24
- package/dist/chunk-3YG3MYDE.cjs.map +1 -0
- package/dist/{chunk-VNQRI2RO.cjs → chunk-5VNBQ4QK.cjs} +16 -16
- package/dist/{chunk-VNQRI2RO.cjs.map → chunk-5VNBQ4QK.cjs.map} +1 -1
- package/dist/{chunk-K3LLGRK7.cjs → chunk-5ZCXWA7J.cjs} +59 -15
- package/dist/chunk-5ZCXWA7J.cjs.map +1 -0
- package/dist/{chunk-Z2OL5AJD.cjs → chunk-6F6GGX2W.cjs} +4 -3
- package/dist/chunk-6F6GGX2W.cjs.map +1 -0
- package/dist/{chunk-D26ENTN2.cjs → chunk-72IFMNJE.cjs} +80 -52
- package/dist/chunk-72IFMNJE.cjs.map +1 -0
- package/dist/{chunk-SAW5OK36.cjs → chunk-A5Z3IMSJ.cjs} +6 -6
- package/dist/{chunk-SAW5OK36.cjs.map → chunk-A5Z3IMSJ.cjs.map} +1 -1
- package/dist/{chunk-VA42637J.cjs → chunk-AGEZY4LL.cjs} +46 -41
- package/dist/chunk-AGEZY4LL.cjs.map +1 -0
- package/dist/{chunk-BG5D5CZ6.js → chunk-ANOQWAMU.js} +23 -6
- package/dist/chunk-ANOQWAMU.js.map +1 -0
- package/dist/{chunk-PRYE7AZQ.cjs → chunk-AWWOQH46.cjs} +7 -7
- package/dist/chunk-AWWOQH46.cjs.map +1 -0
- package/dist/{chunk-JFS3NWZ5.cjs → chunk-B7WJJHJS.cjs} +7 -4
- package/dist/chunk-B7WJJHJS.cjs.map +1 -0
- package/dist/{chunk-D6GNRSCV.cjs → chunk-BBLE4UTG.cjs} +23 -6
- package/dist/chunk-BBLE4UTG.cjs.map +1 -0
- package/dist/{chunk-HGC5JNVA.cjs → chunk-BVVKMQKR.cjs} +9 -2
- package/dist/chunk-BVVKMQKR.cjs.map +1 -0
- package/dist/{chunk-YYV35XOS.js → chunk-C4R7BTBQ.js} +4 -3
- package/dist/chunk-C4R7BTBQ.js.map +1 -0
- package/dist/{chunk-PXFQVLBX.js → chunk-ETXUOETU.js} +26 -36
- package/dist/chunk-ETXUOETU.js.map +1 -0
- package/dist/{chunk-HKFMXNVQ.cjs → chunk-F4ZT5X2S.cjs} +11 -11
- package/dist/{chunk-HKFMXNVQ.cjs.map → chunk-F4ZT5X2S.cjs.map} +1 -1
- package/dist/{chunk-YBPBK5KI.js → chunk-FKQJYMCO.js} +97 -23
- package/dist/chunk-FKQJYMCO.js.map +1 -0
- package/dist/{chunk-ZDFHA2EC.js → chunk-FVKCNAEQ.js} +51 -7
- package/dist/chunk-FVKCNAEQ.js.map +1 -0
- package/dist/{chunk-ZL7UM6PU.cjs → chunk-GHBXS5RT.cjs} +4 -4
- package/dist/{chunk-ZL7UM6PU.cjs.map → chunk-GHBXS5RT.cjs.map} +1 -1
- package/dist/{chunk-ZO5PBBFX.js → chunk-GKJRNIP4.js} +59 -15
- package/dist/chunk-GKJRNIP4.js.map +1 -0
- package/dist/{chunk-UCFWI6D4.js → chunk-GRIMIJJ3.js} +3 -3
- package/dist/{chunk-UCFWI6D4.js.map → chunk-GRIMIJJ3.js.map} +1 -1
- package/dist/{chunk-5RYLK3MQ.js → chunk-GVHBHUFV.js} +11 -6
- package/dist/chunk-GVHBHUFV.js.map +1 -0
- package/dist/chunk-GZH2SIOF.cjs +99 -0
- package/dist/chunk-GZH2SIOF.cjs.map +1 -0
- package/dist/{chunk-SFW3UB2P.js → chunk-IJNQYMN7.js} +4 -4
- package/dist/{chunk-SFW3UB2P.js.map → chunk-IJNQYMN7.js.map} +1 -1
- package/dist/{chunk-HC7VKIV5.cjs → chunk-IRUPCNW2.cjs} +49 -46
- package/dist/chunk-IRUPCNW2.cjs.map +1 -0
- package/dist/{chunk-JL4C5VJ7.cjs → chunk-J65CAOUV.cjs} +14 -2
- package/dist/chunk-J65CAOUV.cjs.map +1 -0
- package/dist/{chunk-23FJQTEA.js → chunk-LJMNCSDG.js} +38 -15
- package/dist/chunk-LJMNCSDG.js.map +1 -0
- package/dist/{chunk-PVJBAPYJ.js → chunk-MEN7VLQ5.js} +8 -5
- package/dist/chunk-MEN7VLQ5.js.map +1 -0
- package/dist/{chunk-PHZ23DP3.js → chunk-MUA5L25B.js} +125 -12
- package/dist/chunk-MUA5L25B.js.map +1 -0
- package/dist/{chunk-WD6HJRBG.cjs → chunk-NWXB4F6D.cjs} +21 -21
- package/dist/{chunk-WD6HJRBG.cjs.map → chunk-NWXB4F6D.cjs.map} +1 -1
- package/dist/{chunk-PQHS255G.js → chunk-OHSIVNJO.js} +3 -3
- package/dist/chunk-OHSIVNJO.js.map +1 -0
- package/dist/{chunk-XGFTL5XY.js → chunk-PVVO23LZ.js} +3 -3
- package/dist/{chunk-XGFTL5XY.js.map → chunk-PVVO23LZ.js.map} +1 -1
- package/dist/{chunk-CUH22J4D.js → chunk-Q4ZXDDWA.js} +3 -3
- package/dist/{chunk-CUH22J4D.js.map → chunk-Q4ZXDDWA.js.map} +1 -1
- package/dist/{chunk-WKOIGLQX.cjs → chunk-QIIG2QDP.cjs} +8 -8
- package/dist/{chunk-WKOIGLQX.cjs.map → chunk-QIIG2QDP.cjs.map} +1 -1
- package/dist/{chunk-QA3MVQ32.js → chunk-QXW6O56Z.js} +6 -6
- package/dist/chunk-QXW6O56Z.js.map +1 -0
- package/dist/{chunk-5PC6JBGJ.cjs → chunk-R2VF5NQG.cjs} +3 -3
- package/dist/chunk-R2VF5NQG.cjs.map +1 -0
- package/dist/{chunk-7Z5LUTGU.js → chunk-RRI5YBUK.js} +6 -3
- package/dist/{chunk-JFS3NWZ5.cjs.map → chunk-RRI5YBUK.js.map} +1 -1
- package/dist/{chunk-HUR6ZJ7S.cjs → chunk-RUKFN3LJ.cjs} +6 -6
- package/dist/{chunk-HUR6ZJ7S.cjs.map → chunk-RUKFN3LJ.cjs.map} +1 -1
- package/dist/chunk-TCBHVIMD.js +89 -0
- package/dist/chunk-TCBHVIMD.js.map +1 -0
- package/dist/{chunk-SES6GDBQ.cjs → chunk-UJJUX6NW.cjs} +59 -8
- package/dist/chunk-UJJUX6NW.cjs.map +1 -0
- package/dist/{chunk-ZRL2UFTH.cjs → chunk-V3N56Z2S.cjs} +101 -22
- package/dist/chunk-V3N56Z2S.cjs.map +1 -0
- package/dist/{chunk-6WZ2VN7V.js → chunk-W36WCZS2.js} +6 -6
- package/dist/{chunk-6WZ2VN7V.js.map → chunk-W36WCZS2.js.map} +1 -1
- package/dist/{chunk-M36G6SRP.js → chunk-WXNQMJ67.js} +14 -3
- package/dist/chunk-WXNQMJ67.js.map +1 -0
- package/dist/{chunk-VXPLKQWY.cjs → chunk-XE5PE54B.cjs} +30 -40
- package/dist/chunk-XE5PE54B.cjs.map +1 -0
- package/dist/{chunk-OZSACQ2V.js → chunk-XJOBMAWW.js} +3 -3
- package/dist/{chunk-OZSACQ2V.js.map → chunk-XJOBMAWW.js.map} +1 -1
- package/dist/{chunk-OTATNBMD.js → chunk-XS7FI4JA.js} +3 -3
- package/dist/{chunk-OTATNBMD.js.map → chunk-XS7FI4JA.js.map} +1 -1
- package/dist/{chunk-HRXEZ3SX.cjs → chunk-YD3JA36S.cjs} +4 -4
- package/dist/{chunk-HRXEZ3SX.cjs.map → chunk-YD3JA36S.cjs.map} +1 -1
- package/dist/chunk-YYODFQEU.cjs +25 -0
- package/dist/chunk-YYODFQEU.cjs.map +1 -0
- package/dist/{chunk-UTQSSKSG.js → chunk-ZXBSARZX.js} +4 -4
- package/dist/{chunk-UTQSSKSG.js.map → chunk-ZXBSARZX.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -42
- package/dist/entries/apps.d.cts +2 -2
- package/dist/entries/apps.d.ts +2 -2
- package/dist/entries/apps.js +8 -7
- package/dist/entries/catalogs.d.cts +1 -1
- package/dist/entries/catalogs.d.ts +1 -1
- package/dist/entries/credits.cjs +153 -153
- package/dist/entries/credits.d.cts +1 -1
- package/dist/entries/credits.d.ts +1 -1
- package/dist/entries/credits.js +8 -8
- package/dist/entries/edl.cjs +130 -102
- package/dist/entries/edl.d.cts +74 -3
- package/dist/entries/edl.d.ts +74 -3
- package/dist/entries/edl.js +2 -2
- package/dist/entries/entities.cjs +126 -122
- package/dist/entries/entities.d.cts +2 -2
- package/dist/entries/entities.d.ts +2 -2
- package/dist/entries/entities.js +1 -1
- package/dist/entries/i18n.cjs +11 -11
- package/dist/entries/i18n.d.cts +2 -2
- package/dist/entries/i18n.d.ts +2 -2
- package/dist/entries/i18n.js +1 -1
- package/dist/entries/llm-models.cjs +63 -43
- package/dist/entries/llm-models.d.cts +71 -4
- package/dist/entries/llm-models.d.ts +71 -4
- package/dist/entries/llm-models.js +1 -1
- package/dist/entries/media.cjs +45 -41
- package/dist/entries/media.d.cts +39 -1
- package/dist/entries/media.d.ts +39 -1
- package/dist/entries/media.js +1 -1
- package/dist/entries/model-catalog.cjs +66 -66
- package/dist/entries/model-catalog.d.cts +2 -2
- package/dist/entries/model-catalog.d.ts +2 -2
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +274 -210
- package/dist/entries/models.d.cts +3 -3
- package/dist/entries/models.d.ts +3 -3
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +222 -201
- package/dist/entries/nodes.d.cts +48 -8
- package/dist/entries/nodes.d.ts +48 -8
- package/dist/entries/nodes.js +10 -9
- package/dist/entries/pipeline.cjs +149 -149
- package/dist/entries/pipeline.d.cts +8 -4
- package/dist/entries/pipeline.d.ts +8 -4
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +174 -174
- package/dist/entries/social.d.cts +13 -5
- package/dist/entries/social.d.ts +13 -5
- package/dist/entries/social.js +2 -2
- package/dist/entries/types.d.cts +1 -1
- package/dist/entries/types.d.ts +1 -1
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +115 -115
- package/dist/entries/video.d.cts +4 -3
- package/dist/entries/video.d.ts +4 -3
- package/dist/entries/video.js +4 -4
- package/dist/entries/workflow.cjs +96 -95
- package/dist/entries/workflow.d.cts +7 -18
- package/dist/entries/workflow.d.ts +7 -18
- package/dist/entries/workflow.js +2 -1
- package/dist/index.cjs +1708 -1567
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +26 -25
- package/dist/{model-catalog-V-ZNzRSd.d.ts → model-catalog-VIHGmQL2.d.cts} +22 -0
- package/dist/{model-catalog-V-ZNzRSd.d.cts → model-catalog-VIHGmQL2.d.ts} +22 -0
- package/dist/{presentation-utils-D0kxsWf9.d.cts → presentation-utils-A4i92SYo.d.cts} +1 -1
- package/dist/{presentation-utils-pZwlEAzo.d.ts → presentation-utils-DjdPtM9k.d.ts} +1 -1
- package/dist/{scene-node-types-C3kl_zyK.d.ts → scene-node-types-Cvbtf-0a.d.cts} +147 -6
- package/dist/{scene-node-types-C3kl_zyK.d.cts → scene-node-types-Cvbtf-0a.d.ts} +147 -6
- package/dist/{types-DffyGSy5.d.cts → types-CU6SQnMS.d.cts} +0 -5
- package/dist/{types-DffyGSy5.d.ts → types-CU6SQnMS.d.ts} +0 -5
- package/dist/{types-BRlFPEru.d.ts → types-DzUBR7yr.d.cts} +8 -1
- package/dist/{types-BRlFPEru.d.cts → types-DzUBR7yr.d.ts} +8 -1
- package/package.json +1 -1
- package/src/__tests__/camera-switch-contract.test.ts +33 -1
- package/src/__tests__/character-mention-slug.test.ts +0 -8
- package/src/__tests__/effective-tier.test.ts +3 -14
- package/src/__tests__/fixtures/camera-switch-speaker-map-parity.json +178 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +21 -0
- package/src/__tests__/fixtures/speaker-map-camera-ids.json +26 -0
- package/src/__tests__/gvp-supported-providers.test.ts +1 -0
- package/src/__tests__/i18n-locale-completeness.test.ts +38 -3
- package/src/__tests__/llm-models.test.ts +200 -20
- package/src/__tests__/node-preset-extract.test.ts +10 -0
- package/src/__tests__/preview-gate-use-case.test.ts +16 -1
- package/src/__tests__/producer-types.test.ts +19 -0
- package/src/__tests__/run-continuation.test.ts +4 -1
- package/src/__tests__/speaker-map-contract.test.ts +48 -0
- package/src/__tests__/unit-contract-compose.test.ts +129 -0
- package/src/__tests__/unit-contracts.test.ts +134 -0
- package/src/__tests__/use-case-types.test.ts +33 -0
- package/src/__tests__/video-collapse-parity.test.ts +10 -0
- package/src/__tests__/video-frame-slot.test.ts +85 -0
- package/src/__tests__/video-mode-aliases.test.ts +1 -0
- package/src/__tests__/video-reference-only.test.ts +117 -0
- package/src/__tests__/vidu-q4-catalog.test.ts +230 -0
- package/src/camera-switch-contract.ts +36 -2
- package/src/credit-identifiers.ts +19 -6
- package/src/entity-asset-types.ts +13 -0
- package/src/entries/edl.ts +2 -0
- package/src/entries/llm-models.ts +5 -0
- package/src/entries/media.ts +1 -0
- package/src/entries/models.ts +25 -0
- package/src/entries/nodes.ts +5 -1
- package/src/fan-out-rows.ts +36 -3
- package/src/generate-mask.ts +40 -0
- package/src/generated/unit-contracts.ts +58 -0
- package/src/i18n/types.ts +13 -2
- package/src/json-kinds.ts +24 -4
- package/src/llm-models.ts +184 -31
- package/src/meta-ads-scrape.ts +16 -8
- package/src/model-catalog.ts +78 -13
- package/src/model-constants.ts +260 -5
- package/src/node-default-mappings.ts +3 -0
- package/src/node-preset-extract.ts +8 -0
- package/src/pipeline-types.ts +3 -0
- package/src/presentation-utils.ts +12 -12
- package/src/preview-gate.ts +4 -2
- package/src/producer-types.ts +19 -19
- package/src/run-continuation.ts +26 -4
- package/src/speaker-layouts.ts +8 -3
- package/src/speaker-map-contract.ts +77 -0
- package/src/unit-contract-compose.ts +55 -0
- package/src/use-case-types.ts +19 -0
- package/src/video-ui-defaults.ts +7 -5
- package/dist/chunk-23FJQTEA.js.map +0 -1
- package/dist/chunk-5PC6JBGJ.cjs.map +0 -1
- package/dist/chunk-5RYLK3MQ.js.map +0 -1
- package/dist/chunk-7Z5LUTGU.js.map +0 -1
- package/dist/chunk-BG5D5CZ6.js.map +0 -1
- package/dist/chunk-CK3GK34R.js.map +0 -1
- package/dist/chunk-D26ENTN2.cjs.map +0 -1
- package/dist/chunk-D6GNRSCV.cjs.map +0 -1
- package/dist/chunk-HC7VKIV5.cjs.map +0 -1
- package/dist/chunk-HGC5JNVA.cjs.map +0 -1
- package/dist/chunk-JL4C5VJ7.cjs.map +0 -1
- package/dist/chunk-K3LLGRK7.cjs.map +0 -1
- package/dist/chunk-M36G6SRP.js.map +0 -1
- package/dist/chunk-M7GQBRZU.cjs.map +0 -1
- package/dist/chunk-PHZ23DP3.js.map +0 -1
- package/dist/chunk-PQHS255G.js.map +0 -1
- package/dist/chunk-PRYE7AZQ.cjs.map +0 -1
- package/dist/chunk-PVJBAPYJ.js.map +0 -1
- package/dist/chunk-PXFQVLBX.js.map +0 -1
- package/dist/chunk-QA3MVQ32.js.map +0 -1
- package/dist/chunk-SES6GDBQ.cjs.map +0 -1
- package/dist/chunk-TU33KYKW.cjs +0 -25
- package/dist/chunk-TU33KYKW.cjs.map +0 -1
- package/dist/chunk-VA42637J.cjs.map +0 -1
- package/dist/chunk-VXPLKQWY.cjs.map +0 -1
- package/dist/chunk-WDIBOWAA.js.map +0 -1
- package/dist/chunk-YBPBK5KI.js.map +0 -1
- package/dist/chunk-YYV35XOS.js.map +0 -1
- package/dist/chunk-Z2OL5AJD.cjs.map +0 -1
- package/dist/chunk-ZDFHA2EC.js.map +0 -1
- package/dist/chunk-ZO5PBBFX.js.map +0 -1
- package/dist/chunk-ZRL2UFTH.cjs.map +0 -1
- package/src/__tests__/__snapshots__/prompt-builder-segments.test.ts.snap +0 -65
|
@@ -9,6 +9,7 @@ import { AUDIO_PRODUCER_TYPES, VIDEO_PRODUCER_TYPES } from "./producer-types.js"
|
|
|
9
9
|
import { canonicalizeOverrideKeys } from "./exposed-field-keys.js"
|
|
10
10
|
import { RENDER_NODE_TYPE_IDS } from "./render-nodes.js"
|
|
11
11
|
import { dropStaleVideoLinkFields } from "./video-link.js"
|
|
12
|
+
import { composeUnitSet, unitsPresenting } from "./unit-contract-compose.js"
|
|
12
13
|
|
|
13
14
|
// ---------------------------------------------------------------------------
|
|
14
15
|
// Node type sets
|
|
@@ -130,18 +131,20 @@ const MEDIA_PRODUCING_TYPES = new Set([
|
|
|
130
131
|
"video-depth",
|
|
131
132
|
])
|
|
132
133
|
|
|
133
|
-
// Output type categorizations
|
|
134
|
-
|
|
134
|
+
// Output type categorizations — each the hand-written list ∪ the node units
|
|
135
|
+
// that declare the same presentation (contract.presents, generated rows); a
|
|
136
|
+
// type in both throws at load (composeUnitSet).
|
|
137
|
+
const IMAGE_OUTPUT_TYPES = composeUnitSet("IMAGE_OUTPUT_TYPES", [
|
|
135
138
|
"generate-image", "edit-image", "image-to-image",
|
|
136
139
|
"upload-image",
|
|
137
|
-
])
|
|
140
|
+
], unitsPresenting("image"))
|
|
138
141
|
|
|
139
142
|
/**
|
|
140
143
|
* Video-output types NOT already declared by `VIDEO_PRODUCER_TYPES` — the two
|
|
141
144
|
* are unioned in `getOutputType`, which is where the reading order (and the
|
|
142
145
|
* reason the literal sets win) is documented.
|
|
143
146
|
*/
|
|
144
|
-
const VIDEO_OUTPUT_TYPES =
|
|
147
|
+
const VIDEO_OUTPUT_TYPES = composeUnitSet("VIDEO_OUTPUT_TYPES", [
|
|
145
148
|
"image-to-video", "text-to-video", "video-to-video", "extend-video",
|
|
146
149
|
"render-video", "video-composer", "after-effects", "lottie-overlay",
|
|
147
150
|
"3d-title", "motion-graphics", "composite",
|
|
@@ -158,27 +161,24 @@ const VIDEO_OUTPUT_TYPES = new Set([
|
|
|
158
161
|
// audio-only cut still plays in a video element). Asserted in
|
|
159
162
|
// producer-types.test.ts.
|
|
160
163
|
...RENDER_NODE_TYPE_IDS,
|
|
161
|
-
|
|
162
|
-
// (it is not a render, so RENDER_NODE_TYPE_IDS does not bring it).
|
|
163
|
-
"tighten-episode",
|
|
164
|
-
])
|
|
164
|
+
], unitsPresenting("video"))
|
|
165
165
|
|
|
166
|
-
const AUDIO_OUTPUT_TYPES =
|
|
166
|
+
const AUDIO_OUTPUT_TYPES = composeUnitSet("AUDIO_OUTPUT_TYPES", [
|
|
167
167
|
"text-to-speech", "generate-music", "text-to-audio",
|
|
168
168
|
"text-to-dialogue", "voice-changer", "dubbing", "voice-remix",
|
|
169
169
|
"voice-design", "mix-audio", "adjust-volume", "audio-fx", "pitch-tempo", "trim-audio",
|
|
170
170
|
"audio-isolation",
|
|
171
171
|
"audio-separation",
|
|
172
172
|
"upload-audio",
|
|
173
|
-
])
|
|
173
|
+
], unitsPresenting("audio"))
|
|
174
174
|
|
|
175
|
-
const TEXT_OUTPUT_TYPES =
|
|
175
|
+
const TEXT_OUTPUT_TYPES = composeUnitSet("TEXT_OUTPUT_TYPES", [
|
|
176
176
|
"generate-script", "ai-writer", "llm-chat", "transcribe", "image-to-text", "qa-check",
|
|
177
177
|
"text-prompt",
|
|
178
178
|
// UGC Cards' output card is its Notes: a run hands it on as the node's text
|
|
179
179
|
// (`output.text`, `generatedText` on the canvas).
|
|
180
180
|
"ugc-cards",
|
|
181
|
-
])
|
|
181
|
+
], unitsPresenting("text"))
|
|
182
182
|
|
|
183
183
|
// ---------------------------------------------------------------------------
|
|
184
184
|
// Output type enum
|
package/src/preview-gate.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { buildFeedMaps } from "./trigger-feeds.js"
|
|
|
26
26
|
import { defaultEdgeOutputMode } from "./producer-types.js"
|
|
27
27
|
import { mergeNodeInputOverrides } from "./presentation-utils.js"
|
|
28
28
|
import { RENDER_NODE_TYPE_IDS } from "./render-nodes.js"
|
|
29
|
+
import { unitReviewHolds } from "./unit-contract-compose.js"
|
|
29
30
|
|
|
30
31
|
/** Render nodes a run can stop at: every render in the registry (SV18). */
|
|
31
32
|
export const PREVIEW_RENDER_NODE_TYPES: ReadonlySet<string> = new Set(RENDER_NODE_TYPE_IDS)
|
|
@@ -34,9 +35,10 @@ export const PREVIEW_RENDER_NODE_TYPES: ReadonlySet<string> = new Set(RENDER_NOD
|
|
|
34
35
|
* Use-case nodes whose review-on run ends at a Preview of their own: what
|
|
35
36
|
* follows them waits for their Render final, exactly as after a render at
|
|
36
37
|
* Preview. They are not render nodes (`PREVIEW_RENDER_NODE_TYPES` stays the
|
|
37
|
-
* renders), so they join the hold here
|
|
38
|
+
* renders), so they join the hold here: the node units that declare
|
|
39
|
+
* `contract.reviewHold` (generated/unit-contracts.ts).
|
|
38
40
|
*/
|
|
39
|
-
export const REVIEW_HOLDING_USE_CASE_TYPES: ReadonlySet<string> = new Set(
|
|
41
|
+
export const REVIEW_HOLDING_USE_CASE_TYPES: ReadonlySet<string> = new Set(unitReviewHolds())
|
|
40
42
|
|
|
41
43
|
/** A node whose take can be a Preview that holds what follows it. */
|
|
42
44
|
export function isPreviewHoldingType(type: string | null | undefined): boolean {
|
package/src/producer-types.ts
CHANGED
|
@@ -15,12 +15,17 @@
|
|
|
15
15
|
* execution time (the prior drift bug, see issue 1 of the Task 4.1 review).
|
|
16
16
|
*/
|
|
17
17
|
import { UGC_PRIMARY_HANDLE } from "./ugc-node-wires.js"
|
|
18
|
+
import { composeUnitRecord, composeUnitSet, unitFanOutEach, unitProducers } from "./unit-contract-compose.js"
|
|
19
|
+
|
|
20
|
+
// Each producer set below is its hand-written members ∪ the node units
|
|
21
|
+
// (tools/units/README.md) of that producer kind, from their generated contract
|
|
22
|
+
// rows, in that order — a type in both throws at load (composeUnitSet).
|
|
18
23
|
|
|
19
24
|
/**
|
|
20
25
|
* Source node types whose primary output is a video URL.
|
|
21
26
|
* Mirrors the backend execution-graph VIDEO_SOURCE_TYPES verbatim.
|
|
22
27
|
*/
|
|
23
|
-
export const VIDEO_PRODUCER_TYPES: ReadonlySet<string> =
|
|
28
|
+
export const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet("VIDEO_PRODUCER_TYPES", [
|
|
24
29
|
"image-to-video",
|
|
25
30
|
"video-to-video",
|
|
26
31
|
"switchx", // Beeble SwitchX relight/composite
|
|
@@ -79,8 +84,6 @@ export const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = new Set([
|
|
|
79
84
|
"mask-composite",
|
|
80
85
|
"transcode-video",
|
|
81
86
|
"manual-edit",
|
|
82
|
-
// Remove Audio: strips the audio track, emits a silent video.
|
|
83
|
-
"remove-audio",
|
|
84
87
|
// AI Avatar (HeyGen): avatar + voice/audio → video.
|
|
85
88
|
"ai-avatar",
|
|
86
89
|
// Cinematic Avatar (HeyGen cinematic_avatar): prompt + 1–3 avatar looks → video.
|
|
@@ -93,10 +96,6 @@ export const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = new Set([
|
|
|
93
96
|
// Slideshow: 2-100 stills + one optional audio track → MP4 (local FFmpeg,
|
|
94
97
|
// no provider). Same contract; images arrive via the image-collage lane.
|
|
95
98
|
"slideshow",
|
|
96
|
-
// GIF to Video: animated GIF → H.264 MP4 (local FFmpeg, no provider).
|
|
97
|
-
// Emits generatedVideoUrl so it connects to any downstream video consumer
|
|
98
|
-
// (e.g. a Seedance video-reference input) by an ordinary edge.
|
|
99
|
-
"gif-to-video",
|
|
100
99
|
// 3D Render Pro: authors a scene AND exports it in one operation, settling
|
|
101
100
|
// with the standard `videoUrl` field. It is a video producer as much as it
|
|
102
101
|
// is a composition producer — omitting it here is the "cannot connect the
|
|
@@ -111,7 +110,7 @@ export const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = new Set([
|
|
|
111
110
|
// UGC Finish: the video's clips, finished, as one ordered list — a registered producer, so a
|
|
112
111
|
// Bundle edge into Combine Videos routes each one as a video, in order.
|
|
113
112
|
"ugc-finish-clips",
|
|
114
|
-
])
|
|
113
|
+
], unitProducers("video"))
|
|
115
114
|
|
|
116
115
|
/**
|
|
117
116
|
* Source node types whose output media-type cannot be classified
|
|
@@ -139,7 +138,7 @@ export const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = new Set([
|
|
|
139
138
|
* that fail at execution. Users wanting trigger → media flows
|
|
140
139
|
* should wire through an upload node.
|
|
141
140
|
*/
|
|
142
|
-
export const DYNAMIC_PRODUCER_TYPES: ReadonlySet<string> =
|
|
141
|
+
export const DYNAMIC_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet("DYNAMIC_PRODUCER_TYPES", [
|
|
143
142
|
"list",
|
|
144
143
|
"sub-workflow",
|
|
145
144
|
"adjust-volume",
|
|
@@ -184,16 +183,13 @@ export const DYNAMIC_PRODUCER_TYPES: ReadonlySet<string> = new Set([
|
|
|
184
183
|
// voice-changer/dubbing precedent. Asserted in producer-types.test.ts (the
|
|
185
184
|
// suite does not fail on omission).
|
|
186
185
|
"apply-edl",
|
|
187
|
-
|
|
188
|
-
// its `output` setting (an audio recording forces audio) — runtime-decided.
|
|
189
|
-
"tighten-episode",
|
|
190
|
-
])
|
|
186
|
+
], unitProducers("dynamic"))
|
|
191
187
|
|
|
192
188
|
/**
|
|
193
189
|
* Source node types whose primary output is an audio URL.
|
|
194
190
|
* Mirrors the backend execution-graph AUDIO_SOURCE_TYPES verbatim.
|
|
195
191
|
*/
|
|
196
|
-
export const AUDIO_PRODUCER_TYPES: ReadonlySet<string> =
|
|
192
|
+
export const AUDIO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet("AUDIO_PRODUCER_TYPES", [
|
|
197
193
|
"text-to-speech",
|
|
198
194
|
"text-to-audio",
|
|
199
195
|
"generate-music",
|
|
@@ -227,7 +223,7 @@ export const AUDIO_PRODUCER_TYPES: ReadonlySet<string> = new Set([
|
|
|
227
223
|
"voice-design",
|
|
228
224
|
// Extract Audio: demuxes a video's audio track to a standalone MP3.
|
|
229
225
|
"extract-audio",
|
|
230
|
-
])
|
|
226
|
+
], unitProducers("audio"))
|
|
231
227
|
|
|
232
228
|
/**
|
|
233
229
|
* Source node types whose output is an IMAGE URL — what feeds a References
|
|
@@ -236,7 +232,7 @@ export const AUDIO_PRODUCER_TYPES: ReadonlySet<string> = new Set([
|
|
|
236
232
|
* handle migration and the MCP edge normalizer (`llm-chat`'s legacy `in`):
|
|
237
233
|
* they used to keep separate copies, and the backend's lagged by eight types.
|
|
238
234
|
*/
|
|
239
|
-
export const IMAGE_PRODUCER_TYPES: ReadonlySet<string> =
|
|
235
|
+
export const IMAGE_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet("IMAGE_PRODUCER_TYPES", [
|
|
240
236
|
"upload-image", "generate-image", "edit-image", "image-to-image", "modify-image", "upscale-image", "remove-background",
|
|
241
237
|
// extract-frame produces a single still image extracted from a video source.
|
|
242
238
|
"extract-frame",
|
|
@@ -265,7 +261,7 @@ export const IMAGE_PRODUCER_TYPES: ReadonlySet<string> = new Set([
|
|
|
265
261
|
// in IMAGE_SOURCE_TYPES on either engine: that set types the node's PRIMARY
|
|
266
262
|
// asset, and 3D Render Pro's is the MP4.
|
|
267
263
|
"pro-3d-render",
|
|
268
|
-
])
|
|
264
|
+
], unitProducers("image"))
|
|
269
265
|
|
|
270
266
|
/**
|
|
271
267
|
* Source node types whose primary output is a LIST that, by default, fans out
|
|
@@ -315,8 +311,11 @@ export const FAN_OUT_EACH_TYPES: ReadonlySet<string> = new Set([
|
|
|
315
311
|
* (`listResults`) — it exists only when the node itself ran once per item, so
|
|
316
312
|
* after a single run the edge degrades to the single value, exactly like a
|
|
317
313
|
* `FAN_OUT_EACH_TYPES` member with one item.
|
|
314
|
+
*
|
|
315
|
+
* Its hand-written rows ∪ the node units' rows (`contract.fanOutEach`,
|
|
316
|
+
* generated/unit-contracts.ts); a type in both refuses to load.
|
|
318
317
|
*/
|
|
319
|
-
export const FAN_OUT_EACH_HANDLES: Readonly<Record<string, { readonly each: readonly string[]; readonly primary: string }>> = {
|
|
318
|
+
export const FAN_OUT_EACH_HANDLES: Readonly<Record<string, { readonly each: readonly string[]; readonly primary: string }>> = composeUnitRecord("FAN_OUT_EACH_HANDLES", {
|
|
320
319
|
// Camera Switch run once per clip (Edit Plan in clips mode): each clip's
|
|
321
320
|
// switched EDL is its own Apply EDL render. Its transcript is the same for
|
|
322
321
|
// every clip (the master clock, renamed), so that handle stays one value
|
|
@@ -328,7 +327,8 @@ export const FAN_OUT_EACH_HANDLES: Readonly<Record<string, { readonly each: read
|
|
|
328
327
|
// its list (`listResults`, the editor's `__listResults`). The pip an edge
|
|
329
328
|
// with no handle reads is the UGC wires' own (UGC_PRIMARY_HANDLE).
|
|
330
329
|
"ugc-clips": { each: ["clips"], primary: UGC_PRIMARY_HANDLE["ugc-clips"]! },
|
|
331
|
-
|
|
330
|
+
// A node unit declares its row in unit.json (contract.fanOutEach); it is added after these.
|
|
331
|
+
}, unitFanOutEach())
|
|
332
332
|
|
|
333
333
|
/**
|
|
334
334
|
* Fan-out nodes whose iterations must ALL succeed: one failed item fails the
|
package/src/run-continuation.ts
CHANGED
|
@@ -27,14 +27,29 @@ export const CONTINUATION_NOT_COMPLETED = "continuation_not_completed"
|
|
|
27
27
|
* on the execution's output. */
|
|
28
28
|
export const CONTINUATION_SUBSET_REQUIRED = "continuation_subset_required"
|
|
29
29
|
|
|
30
|
-
/** A continue-from-failed run (use-case
|
|
31
|
-
* `failed`: a completed run has nothing to resume, a
|
|
30
|
+
/** A continue-from-failed run (a use-case node's, or a saved workflow's) needs
|
|
31
|
+
* an execution that ended `failed`: a completed run has nothing to resume, a
|
|
32
|
+
* running one is not over. */
|
|
32
33
|
export const CONTINUATION_NOT_FAILED = "continuation_not_failed"
|
|
33
34
|
|
|
34
|
-
/** A continue-from-failed
|
|
35
|
-
*
|
|
35
|
+
/** A continue-from-failed of a run a later continuation of it has superseded
|
|
36
|
+
* — that later one failed too: continue it instead. A saved workflow's run
|
|
37
|
+
* also answers it when a later continuation completed everything the run left
|
|
38
|
+
* (the work is done; its results are on that run). */
|
|
36
39
|
export const CONTINUATION_SUPERSEDED = "continuation_superseded"
|
|
37
40
|
|
|
41
|
+
/** A continue-from-failed of a saved workflow's run whose lineage's newest
|
|
42
|
+
* continuation COMPLETED by stopping at a Preview review — of an Apply EDL
|
|
43
|
+
* render, or of a use-case node with review on (Tighten Episode): continuing
|
|
44
|
+
* again would only stop at the same Preview. The answer names that execution
|
|
45
|
+
* (`executionId`), its renders (`renderNodeIds`) and its use-case nodes
|
|
46
|
+
* (`reviewNodeIds`), and the run that finishes them (`next`:
|
|
47
|
+
* `continueFromExecutionId`, `nodeIds`, `inputOverrides`, to send to `/run`):
|
|
48
|
+
* for one render, its Render final (`renderFinal` with
|
|
49
|
+
* `continueFromExecutionId` set to that execution) is the same run. A
|
|
50
|
+
* continue-from-failed after it builds on that run. */
|
|
51
|
+
export const CONTINUATION_PREVIEW_PENDING = "continuation_preview_pending"
|
|
52
|
+
|
|
38
53
|
/** A continue-from-failed (use-case nodes) of a failed run whose wrapper is not
|
|
39
54
|
* settled yet (its fee not yet refunded): ask again in a moment. A retry
|
|
40
55
|
* answer, not a refusal — outside `RUN_CONTINUATION_CODES`. */
|
|
@@ -46,6 +61,12 @@ export const CONTINUATION_SETTLING = "continuation_settling"
|
|
|
46
61
|
export const RENDER_FINAL_ALREADY_RENDERED = "render_final_already_rendered"
|
|
47
62
|
export const RENDER_FINAL_ALREADY_RENDERED_MESSAGE = "Already rendered with this edit."
|
|
48
63
|
|
|
64
|
+
/** A Render final (use-case nodes) of a clip pack whose review dropped every
|
|
65
|
+
* clip: there is nothing to render, so nothing runs and nothing is charged.
|
|
66
|
+
* A refusal of the request, outside `RUN_CONTINUATION_CODES`. */
|
|
67
|
+
export const USE_CASE_NOTHING_KEPT = "use_case_nothing_kept"
|
|
68
|
+
export const USE_CASE_NOTHING_KEPT_MESSAGE = "Every clip was dropped in the review: keep at least one clip to render the final."
|
|
69
|
+
|
|
49
70
|
/** Every continuation refusal code. */
|
|
50
71
|
export const RUN_CONTINUATION_CODES = [
|
|
51
72
|
CONTINUATION_NOT_FOUND,
|
|
@@ -55,6 +76,7 @@ export const RUN_CONTINUATION_CODES = [
|
|
|
55
76
|
CONTINUATION_SUBSET_REQUIRED,
|
|
56
77
|
CONTINUATION_NOT_FAILED,
|
|
57
78
|
CONTINUATION_SUPERSEDED,
|
|
79
|
+
CONTINUATION_PREVIEW_PENDING,
|
|
58
80
|
] as const
|
|
59
81
|
|
|
60
82
|
export type RunContinuationCode = (typeof RUN_CONTINUATION_CODES)[number]
|
package/src/speaker-layouts.ts
CHANGED
|
@@ -78,8 +78,13 @@ export function speakerSwitchOverlaps(type: string): boolean {
|
|
|
78
78
|
return typeof type === "string" && type.startsWith(XFADE_SWITCH_PREFIX)
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/** A Speaker View switch id: `cut`, `pan`, `zoom`, or `xfade:<combine transition id>`
|
|
82
|
+
* (one per real ffmpeg xfade transition — `SPEAKER_SWITCH_IDS` lists them). Every
|
|
83
|
+
* sheet below is built from one, so a new switch outside this shape fails to compile. */
|
|
84
|
+
export type SpeakerSwitchId = "cut" | "pan" | "zoom" | `${typeof XFADE_SWITCH_PREFIX}${string}`
|
|
85
|
+
|
|
81
86
|
export interface SpeakerSwitchSheet {
|
|
82
|
-
/** "cut" | "pan" | "zoom" | `xfade:${combine id}` */
|
|
87
|
+
/** "cut" | "pan" | "zoom" | `xfade:${combine id}` (a `SpeakerSwitchId`) */
|
|
83
88
|
readonly id: string
|
|
84
89
|
/** = `speakerSwitchOverlaps(id)`, derived, never hand-set. */
|
|
85
90
|
readonly overlaps: boolean
|
|
@@ -87,7 +92,7 @@ export interface SpeakerSwitchSheet {
|
|
|
87
92
|
readonly requiresSameSource: boolean
|
|
88
93
|
}
|
|
89
94
|
|
|
90
|
-
const switchSheet = (id:
|
|
95
|
+
const switchSheet = (id: SpeakerSwitchId, requiresSameSource: boolean): SpeakerSwitchSheet => ({
|
|
91
96
|
id,
|
|
92
97
|
overlaps: speakerSwitchOverlaps(id),
|
|
93
98
|
requiresSameSource,
|
|
@@ -101,7 +106,7 @@ export const SPEAKER_SWITCHES: readonly SpeakerSwitchSheet[] = [
|
|
|
101
106
|
switchSheet("cut", false),
|
|
102
107
|
switchSheet("pan", true),
|
|
103
108
|
switchSheet("zoom", false),
|
|
104
|
-
...COMBINE_TRANSITIONS.filter((t) => t.xfade !== null).map((t) => switchSheet(XFADE_SWITCH_PREFIX
|
|
109
|
+
...COMBINE_TRANSITIONS.filter((t) => t.xfade !== null).map((t) => switchSheet(`${XFADE_SWITCH_PREFIX}${t.id}`, false)),
|
|
105
110
|
]
|
|
106
111
|
|
|
107
112
|
export const SPEAKER_SWITCH_IDS: readonly string[] = SPEAKER_SWITCHES.map((s) => s.id)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* speaker-map (podcast use-case nodes, decided 2026-10-12/17) — which camera
|
|
3
|
+
* each speaker is on, worked out from the cameras' own microphones: the
|
|
4
|
+
* structural pieces every caller shares (the canvas engines, MCP, the SDK).
|
|
5
|
+
* HOW the levels are compared is the server's. Pure, no I/O.
|
|
6
|
+
*/
|
|
7
|
+
import type { Edl } from "./edl.js"
|
|
8
|
+
|
|
9
|
+
export const SPEAKER_MAP_VERSION = 1 as const
|
|
10
|
+
/** Recordings one run reads (cameras, plus the master when it also emits the edit). */
|
|
11
|
+
export const SPEAKER_MAP_MAX_SOURCES = 6
|
|
12
|
+
/** Candidate cameras a comparison needs. */
|
|
13
|
+
export const SPEAKER_MAP_MIN_CAMERAS = 2
|
|
14
|
+
/** How far the loudest camera must beat the next for the speaker to get it. */
|
|
15
|
+
export const SPEAKER_MAP_DEFAULT_MARGIN_DB = 3
|
|
16
|
+
|
|
17
|
+
export interface SpeakerMapConfidence {
|
|
18
|
+
/** The camera the speaker got; "" = none clear (shown on the wide shot). */
|
|
19
|
+
readonly camera: string
|
|
20
|
+
/** The loudest camera's lead over the next, in dB; null when there was nothing to compare. */
|
|
21
|
+
readonly marginDb: number | null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface SpeakerMapResult {
|
|
25
|
+
readonly version: typeof SPEAKER_MAP_VERSION
|
|
26
|
+
/** Transcript speaker label → camera source id; "" = no camera of their own. Feeds Camera Switch's `speakerMap`. */
|
|
27
|
+
readonly speakerMap: Readonly<Record<string, string>>
|
|
28
|
+
readonly confidence: Readonly<Record<string, SpeakerMapConfidence>>
|
|
29
|
+
readonly notes: readonly string[]
|
|
30
|
+
/** The recordings as one edit on the master clock (offsets applied, roles and speakers set, one segment). */
|
|
31
|
+
readonly edl?: Edl
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const parse = (raw: unknown): unknown => {
|
|
35
|
+
if (typeof raw !== "string") return raw
|
|
36
|
+
try { return JSON.parse(raw) } catch { return undefined }
|
|
37
|
+
}
|
|
38
|
+
const isRecord = (v: unknown): v is Record<string, unknown> => !!v && typeof v === "object" && !Array.isArray(v)
|
|
39
|
+
|
|
40
|
+
const isConfidence = (v: unknown): boolean =>
|
|
41
|
+
isRecord(v) && typeof v.camera === "string" && (v.marginDb === null || (typeof v.marginDb === "number" && Number.isFinite(v.marginDb)))
|
|
42
|
+
|
|
43
|
+
/** A Speaker Map result (an object or its JSON string), or null when it is not
|
|
44
|
+
* one: every map value and confidence camera a string, every margin a finite
|
|
45
|
+
* number or null, every note a string — so a reader can trust each field. */
|
|
46
|
+
export function speakerMapResultOf(raw: unknown): SpeakerMapResult | null {
|
|
47
|
+
const v = parse(raw)
|
|
48
|
+
if (!isRecord(v) || v.version !== SPEAKER_MAP_VERSION || !isRecord(v.speakerMap) || !isRecord(v.confidence) || !Array.isArray(v.notes)) return null
|
|
49
|
+
if (!Object.values(v.speakerMap).every((c) => typeof c === "string")) return null
|
|
50
|
+
if (!Object.values(v.confidence).every(isConfidence)) return null
|
|
51
|
+
if (!v.notes.every((n) => typeof n === "string")) return null
|
|
52
|
+
return v as unknown as SpeakerMapResult
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** An ordinal key: a whole number from 1, written plainly ("1", "12" — never " 1", "01", "1.0", "1e0"). */
|
|
56
|
+
const ORDINAL = /^[1-9]\d*$/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The override keyed by ordinal ("1" = the first voice heard) as a map keyed
|
|
60
|
+
* by the transcript's own labels. `labels` is the transcript's speakers in
|
|
61
|
+
* first-heard order — the caller passes `transcriptSpeakerLabels(transcript)`,
|
|
62
|
+
* so this module imports nothing from camera-switch-contract (one import
|
|
63
|
+
* direction: camera-switch-contract → speaker-map-contract, no cycle for the
|
|
64
|
+
* structure ratchet). An ordinal past the transcript's speakers maps nobody,
|
|
65
|
+
* and so do a key that is not a plain ordinal and an override that is not an
|
|
66
|
+
* object (a hand-written workflow).
|
|
67
|
+
*/
|
|
68
|
+
export function speakerMapByOrdinal(labels: readonly string[], byOrder: Readonly<Record<string, string>> | undefined): Record<string, string> {
|
|
69
|
+
if (!isRecord(byOrder)) return {}
|
|
70
|
+
const out: Record<string, string> = {}
|
|
71
|
+
for (const [ordinal, camera] of Object.entries(byOrder)) {
|
|
72
|
+
if (!ORDINAL.test(ordinal)) continue
|
|
73
|
+
const label = labels[Number(ordinal) - 1]
|
|
74
|
+
if (label !== undefined && typeof camera === "string") out[label] = camera
|
|
75
|
+
}
|
|
76
|
+
return out
|
|
77
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The node units' rows in @nodaro/shared (tools/units/README.md): the readers
|
|
3
|
+
* of `generated/unit-contracts.ts` and the one rule every table that composes
|
|
4
|
+
* them keeps — a type is hand-written or a node unit, never both. Internal:
|
|
5
|
+
* no entry exports this module, so it adds nothing to the published surface;
|
|
6
|
+
* the tables that compose its rows (producer-types, presentation-utils,
|
|
7
|
+
* json-kinds, fan-out-rows, preview-gate) are what consumers read.
|
|
8
|
+
*/
|
|
9
|
+
import { UNIT_CONTRACTS, UNIT_FAN_OUT_EACH, UNIT_JSON_PIPS, UNIT_NON_PROMPT_INPUTS, UNIT_PRESENTS, UNIT_REVIEW_HOLDS } from "./generated/unit-contracts.js"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `legacy ∪ units` as a set, `legacy` first, refusing a type that is in both —
|
|
13
|
+
* a type lives in one place (G1; the editor's and the server's composeSet keep
|
|
14
|
+
* the same rule). Throws at module load, so any import of the set fails.
|
|
15
|
+
*/
|
|
16
|
+
export function composeUnitSet(what: string, legacy: readonly string[], units: readonly string[]): ReadonlySet<string> {
|
|
17
|
+
const clash = units.filter((t) => legacy.includes(t))
|
|
18
|
+
if (clash.length > 0) throw new Error(`${what}: ${clash.join(", ")} is both hand-written and a node unit — a type lives in one place (tools/units/README.md)`)
|
|
19
|
+
return new Set([...legacy, ...units])
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `legacy` with each unit row added after it, refusing a type that is in both
|
|
24
|
+
* or a unit row given twice — the record twin of `composeUnitSet`. Throws at
|
|
25
|
+
* module load, so any import of the record fails.
|
|
26
|
+
*/
|
|
27
|
+
export function composeUnitRecord<V>(what: string, legacy: Readonly<Record<string, V>>, units: ReadonlyArray<readonly [string, V]>): Readonly<Record<string, V>> {
|
|
28
|
+
const out: Record<string, V> = { ...legacy }
|
|
29
|
+
for (const [type, value] of units) {
|
|
30
|
+
if (Object.hasOwn(legacy, type)) throw new Error(`${what}: ${type} is both hand-written and a node unit — a type lives in one place (tools/units/README.md)`)
|
|
31
|
+
if (Object.hasOwn(out, type)) throw new Error(`${what}: node unit ${type} has more than one row`)
|
|
32
|
+
out[type] = value
|
|
33
|
+
}
|
|
34
|
+
return out
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The node units of one producer kind (`contract.producer`), in generated order. */
|
|
38
|
+
export const unitProducers = (kind: "audio" | "video" | "image" | "dynamic"): string[] =>
|
|
39
|
+
UNIT_CONTRACTS.filter(([, producer]) => producer === kind).map(([type]) => type)
|
|
40
|
+
|
|
41
|
+
/** The node units a published app shows as `kind` (`contract.presents`). */
|
|
42
|
+
export const unitsPresenting = (kind: "image" | "video" | "audio" | "text"): string[] =>
|
|
43
|
+
UNIT_PRESENTS.filter(([, presents]) => presents === kind).map(([type]) => type)
|
|
44
|
+
|
|
45
|
+
/** What each node unit's JSON (look) output pips carry (`contract.jsonPips`). */
|
|
46
|
+
export const unitJsonPips = (): ReadonlyArray<readonly [string, Readonly<Record<string, "transcript" | "edl" | "other">>]> => UNIT_JSON_PIPS
|
|
47
|
+
|
|
48
|
+
/** Each node unit's input pips that are never a prompt lane (`contract.nonPromptInputs`). */
|
|
49
|
+
export const unitNonPromptInputs = (): ReadonlyArray<readonly [string, ReadonlyArray<string>]> => UNIT_NON_PROMPT_INPUTS
|
|
50
|
+
|
|
51
|
+
/** The use-case units whose review-on run ends at a Preview that holds what follows (`contract.reviewHold`). */
|
|
52
|
+
export const unitReviewHolds = (): readonly string[] => UNIT_REVIEW_HOLDS
|
|
53
|
+
|
|
54
|
+
/** Each node unit's fan-out "each" outputs and primary pip (`contract.fanOutEach`), in generated order. */
|
|
55
|
+
export const unitFanOutEach = (): ReadonlyArray<readonly [string, { readonly each: ReadonlyArray<string>; readonly primary: string }]> => UNIT_FAN_OUT_EACH
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UNIT_USE_CASE_TYPES } from "./generated/unit-contracts.js"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The use-case node types — each a route (`POST /v1/<type>`, `/estimate`,
|
|
5
|
+
* and `POST /v1/<type>/continue` to continue one of its runs): the node units
|
|
6
|
+
* whose execution.kind is "use-case" (generated/unit-contracts.ts), in their
|
|
7
|
+
* position order, the order every list of the types shows.
|
|
8
|
+
*/
|
|
9
|
+
export const USE_CASE_NODE_TYPES = UNIT_USE_CASE_TYPES
|
|
10
|
+
export type UseCaseNodeType = (typeof USE_CASE_NODE_TYPES)[number]
|
|
11
|
+
|
|
12
|
+
/** Is `type` a use-case node type? Anything that is not one of the strings above is not (an object key like "constructor" included). */
|
|
13
|
+
export function isUseCaseNodeType(type: unknown): type is UseCaseNodeType {
|
|
14
|
+
return typeof type === "string" && (USE_CASE_NODE_TYPES as readonly string[]).includes(type)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (new Set(USE_CASE_NODE_TYPES).size !== USE_CASE_NODE_TYPES.length) {
|
|
18
|
+
throw new Error(`USE_CASE_NODE_TYPES: ${USE_CASE_NODE_TYPES.join(", ")} lists a type twice — a type is one node unit`)
|
|
19
|
+
}
|
package/src/video-ui-defaults.ts
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* billing default differs from `resolutions[0]`; three surfaces then had to
|
|
16
16
|
* agree, so they live here.
|
|
17
17
|
*
|
|
18
|
-
* The resolution fill is per-family ON PURPOSE. Wan 3.0
|
|
18
|
+
* The resolution fill is per-family ON PURPOSE. Wan 3.0 (and Vidu Q4, whose
|
|
19
|
+
* ascending list starts at 540p) reads its DECLARED
|
|
19
20
|
* billing default (PRICING_DEFAULT_RESOLUTION = 720p) because its catalog list
|
|
20
21
|
* is ascending, so an index-0 fill would write 480p — a tier both `runWan3`
|
|
21
22
|
* (which renders 720P) and the credit identifier (which bills the 720p row)
|
|
@@ -32,6 +33,7 @@ import {
|
|
|
32
33
|
isSeedance2Provider,
|
|
33
34
|
isMinimaxH3Provider,
|
|
34
35
|
isWan3Provider,
|
|
36
|
+
isViduQ4Provider,
|
|
35
37
|
isGeminiOmniProvider,
|
|
36
38
|
} from "./model-constants.js"
|
|
37
39
|
import { MODEL_CATALOG } from "./model-catalog.js"
|
|
@@ -46,7 +48,7 @@ export function uiAspectRatioFill(provider: string): string | undefined {
|
|
|
46
48
|
/** See the file docstring — per-family on purpose; never a generic
|
|
47
49
|
* PRICING_DEFAULT_RESOLUTION read (that would reprice seedance-2-5). */
|
|
48
50
|
export function uiResolutionFill(provider: string): string | undefined {
|
|
49
|
-
if (isWan3Provider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]
|
|
51
|
+
if (isWan3Provider(provider) || isViduQ4Provider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]
|
|
50
52
|
if (isSeedance2Provider(provider)) return MODEL_CATALOG[provider]?.resolutions?.[0]
|
|
51
53
|
return undefined
|
|
52
54
|
}
|
|
@@ -55,12 +57,12 @@ export function uiResolutionFill(provider: string): string | undefined {
|
|
|
55
57
|
* Duration the node RENDERS and BILLS when `data.duration` is unset, for the
|
|
56
58
|
* families whose credit identifier declares a duration fallback that is NOT
|
|
57
59
|
* `durations[0]`. Wan 3.0's bare identifier is the 5s tier while its ladder
|
|
58
|
-
* starts at 2s;
|
|
59
|
-
* at 4s. Everyone else falls back to the first listed duration, so this returns
|
|
60
|
+
* starts at 2s; Vidu Q4's is the 5s tier while its ladder starts at 3s; the
|
|
61
|
+
* Gemini Omni family's is the 8s tier while its ladder starts at 4s. Everyone else falls back to the first listed duration, so this returns
|
|
60
62
|
* undefined and the caller keeps `durations[0]`.
|
|
61
63
|
*/
|
|
62
64
|
export function uiDurationFill(provider: string): number | undefined {
|
|
63
|
-
if (isWan3Provider(provider)) return 5
|
|
65
|
+
if (isWan3Provider(provider) || isViduQ4Provider(provider)) return 5
|
|
64
66
|
if (isGeminiOmniProvider(provider)) return 8
|
|
65
67
|
return undefined
|
|
66
68
|
}
|