@nodaro/shared 3.62.0 → 3.64.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-C7POAYFE.js → chunk-36VWLB4J.js} +3 -3
- package/dist/{chunk-C7POAYFE.js.map → chunk-36VWLB4J.js.map} +1 -1
- package/dist/{chunk-S24ZBUB4.js → chunk-3AYM47GW.js} +6 -32
- package/dist/chunk-3AYM47GW.js.map +1 -0
- package/dist/{chunk-YCXRSWCQ.js → chunk-3KTWYYCN.js} +8 -5
- package/dist/chunk-3KTWYYCN.js.map +1 -0
- package/dist/{chunk-ZES6EZC4.js → chunk-4IUE2JB7.js} +3 -3
- package/dist/{chunk-ZES6EZC4.js.map → chunk-4IUE2JB7.js.map} +1 -1
- package/dist/{chunk-MYJQELFN.cjs → chunk-5OBTGNUQ.cjs} +547 -29
- package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
- package/dist/{chunk-TWF2OSH4.cjs → chunk-67CMMTLN.cjs} +4 -4
- package/dist/{chunk-TWF2OSH4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
- package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
- package/dist/chunk-6BRWPJPP.cjs.map +1 -0
- package/dist/{chunk-S5TMRJMX.js → chunk-6YIV37V7.js} +4 -4
- package/dist/{chunk-S5TMRJMX.js.map → chunk-6YIV37V7.js.map} +1 -1
- package/dist/{chunk-3M4BNKFJ.cjs → chunk-7AJGUI7L.cjs} +202 -16
- package/dist/chunk-7AJGUI7L.cjs.map +1 -0
- package/dist/{chunk-JZGZ26YB.js → chunk-7KQ6W5DS.js} +4 -4
- package/dist/{chunk-JZGZ26YB.js.map → chunk-7KQ6W5DS.js.map} +1 -1
- package/dist/{chunk-IWWVPR3W.cjs → chunk-ACZZHHFZ.cjs} +149 -34
- package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
- package/dist/{chunk-2W745U4A.cjs → chunk-AZNZ5WNZ.cjs} +42 -70
- package/dist/chunk-AZNZ5WNZ.cjs.map +1 -0
- package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
- package/dist/chunk-BQYCZLMF.js.map +1 -0
- package/dist/chunk-CHS2SIP6.cjs +504 -0
- package/dist/chunk-CHS2SIP6.cjs.map +1 -0
- package/dist/{chunk-CIPPPT7E.cjs → chunk-CHTZZRAL.cjs} +6 -6
- package/dist/{chunk-CIPPPT7E.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
- package/dist/{chunk-AOJ6B7K4.cjs → chunk-D4KWNDPH.cjs} +12 -12
- package/dist/chunk-D4KWNDPH.cjs.map +1 -0
- package/dist/{chunk-5YYN5X57.js → chunk-DZ4IOP3Q.js} +536 -30
- package/dist/chunk-DZ4IOP3Q.js.map +1 -0
- package/dist/{chunk-VACPZPUA.cjs → chunk-EXEVT6D2.cjs} +15 -5
- package/dist/chunk-EXEVT6D2.cjs.map +1 -0
- package/dist/{chunk-5M43XMRB.cjs → chunk-FHGRKQVZ.cjs} +8 -8
- package/dist/{chunk-5M43XMRB.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
- package/dist/{chunk-KJSRPHJ2.cjs → chunk-GTWUS6MQ.cjs} +165 -54
- package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
- package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
- package/dist/chunk-H5KHWTAE.js.map +1 -0
- package/dist/{chunk-G3KVK7OU.cjs → chunk-HDPJNNMF.cjs} +21 -21
- package/dist/{chunk-G3KVK7OU.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
- package/dist/{chunk-3OYO3XCC.js → chunk-IYSOVS7O.js} +118 -24
- package/dist/chunk-IYSOVS7O.js.map +1 -0
- package/dist/{chunk-AFYTX4AI.cjs → chunk-J6B7J73J.cjs} +110 -50
- package/dist/chunk-J6B7J73J.cjs.map +1 -0
- package/dist/{chunk-I2RQB7VG.js → chunk-KB2SQAR3.js} +3 -3
- package/dist/{chunk-I2RQB7VG.js.map → chunk-KB2SQAR3.js.map} +1 -1
- package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
- package/dist/chunk-KSHAAPQF.cjs.map +1 -0
- package/dist/{chunk-6G7NN4S4.js → chunk-NIAFR5EE.js} +2 -2
- package/dist/chunk-NIAFR5EE.js.map +1 -0
- package/dist/{chunk-CF4S4N5X.js → chunk-O2QOBA6Q.js} +2 -2
- package/dist/{chunk-CF4S4N5X.js.map → chunk-O2QOBA6Q.js.map} +1 -1
- package/dist/{chunk-IDTKF5EX.cjs → chunk-O4RPXBDZ.cjs} +12 -8
- package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
- package/dist/{chunk-4GGLKRYI.cjs → chunk-O6TBB4IF.cjs} +2 -2
- package/dist/{chunk-4GGLKRYI.cjs.map → chunk-O6TBB4IF.cjs.map} +1 -1
- package/dist/{chunk-PTD6EDUU.js → chunk-OBOOHG3N.js} +13 -4
- package/dist/chunk-OBOOHG3N.js.map +1 -0
- package/dist/{chunk-2D5LQFV4.cjs → chunk-OOZW2MM6.cjs} +9 -9
- package/dist/{chunk-2D5LQFV4.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
- package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
- package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
- package/dist/{chunk-G4U3HW6W.js → chunk-PJJAZQVZ.js} +3 -3
- package/dist/{chunk-G4U3HW6W.js.map → chunk-PJJAZQVZ.js.map} +1 -1
- package/dist/{chunk-E2HZTGYX.js → chunk-Q2Y4JHF7.js} +7 -7
- package/dist/chunk-Q2Y4JHF7.js.map +1 -0
- package/dist/{chunk-FVII3KHN.js → chunk-QYU7J5EQ.js} +198 -17
- package/dist/chunk-QYU7J5EQ.js.map +1 -0
- package/dist/{chunk-JJNNM23P.js → chunk-S3UGLZSF.js} +3 -3
- package/dist/{chunk-JJNNM23P.js.map → chunk-S3UGLZSF.js.map} +1 -1
- package/dist/{chunk-CC4V2B7S.js → chunk-SHH2T4CR.js} +3 -3
- package/dist/{chunk-CC4V2B7S.js.map → chunk-SHH2T4CR.js.map} +1 -1
- package/dist/{chunk-4ZEFP2FQ.cjs → chunk-SPAHI7DY.cjs} +4 -4
- package/dist/{chunk-4ZEFP2FQ.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
- package/dist/{chunk-Y6X7UJSD.js → chunk-SXHHLZ22.js} +122 -15
- package/dist/chunk-SXHHLZ22.js.map +1 -0
- package/dist/{chunk-HRY7KGAE.cjs → chunk-T2OVDF2M.cjs} +6 -6
- package/dist/{chunk-HRY7KGAE.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
- package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
- package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
- package/dist/{chunk-NGKKNSK6.js → chunk-TPQJKS7D.js} +139 -16
- package/dist/chunk-TPQJKS7D.js.map +1 -0
- package/dist/{chunk-N7OUQK7E.cjs → chunk-TQW3R44P.cjs} +8 -8
- package/dist/{chunk-N7OUQK7E.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
- package/dist/{chunk-GSFB537T.js → chunk-TTGZ2L3O.js} +23 -4
- package/dist/chunk-TTGZ2L3O.js.map +1 -0
- package/dist/{chunk-SYWR5G3T.js → chunk-VPTA4Z7G.js} +54 -7
- package/dist/chunk-VPTA4Z7G.js.map +1 -0
- package/dist/{chunk-2HZGDZZN.cjs → chunk-VZ6TE23U.cjs} +6 -6
- package/dist/{chunk-2HZGDZZN.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
- package/dist/{chunk-TRVWMKNE.cjs → chunk-W6VJAUGM.cjs} +285 -64
- package/dist/chunk-W6VJAUGM.cjs.map +1 -0
- package/dist/{chunk-UDDVDQMF.js → chunk-W7KHHNZR.js} +235 -37
- package/dist/chunk-W7KHHNZR.js.map +1 -0
- package/dist/{chunk-KYMHFVAZ.cjs → chunk-Y4GCJJPF.cjs} +2 -2
- package/dist/chunk-Y4GCJJPF.cjs.map +1 -0
- package/dist/{chunk-6CSXMWL4.cjs → chunk-YQV53HRR.cjs} +27 -4
- package/dist/chunk-YQV53HRR.cjs.map +1 -0
- package/dist/{chunk-7FCTCWHD.js → chunk-ZI3QDUHO.js} +3 -3
- package/dist/{chunk-7FCTCWHD.js.map → chunk-ZI3QDUHO.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -42
- package/dist/entries/apps.js +8 -7
- package/dist/entries/captions.cjs +38 -30
- package/dist/entries/captions.d.cts +47 -1
- package/dist/entries/captions.d.ts +47 -1
- package/dist/entries/captions.js +1 -1
- package/dist/entries/credits.cjs +354 -174
- package/dist/entries/credits.d.cts +378 -27
- package/dist/entries/credits.d.ts +378 -27
- package/dist/entries/credits.js +11 -11
- package/dist/entries/llm-models.cjs +77 -57
- package/dist/entries/llm-models.d.cts +108 -7
- package/dist/entries/llm-models.d.ts +108 -7
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/media.cjs +63 -63
- package/dist/entries/media.d.cts +8 -0
- package/dist/entries/media.d.ts +8 -0
- package/dist/entries/media.js +1 -1
- package/dist/entries/model-catalog.cjs +161 -105
- package/dist/entries/model-catalog.d.cts +109 -22
- package/dist/entries/model-catalog.d.ts +109 -22
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +466 -322
- package/dist/entries/models.d.cts +71 -5
- package/dist/entries/models.d.ts +71 -5
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +226 -209
- package/dist/entries/nodes.d.cts +66 -7
- package/dist/entries/nodes.d.ts +66 -7
- package/dist/entries/nodes.js +10 -9
- package/dist/entries/pipeline.cjs +156 -152
- package/dist/entries/pipeline.d.cts +14 -4
- package/dist/entries/pipeline.d.ts +14 -4
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/runtime-config.cjs +29 -29
- package/dist/entries/runtime-config.d.cts +10 -7
- package/dist/entries/runtime-config.d.ts +10 -7
- package/dist/entries/runtime-config.js +1 -1
- package/dist/entries/social.cjs +177 -177
- package/dist/entries/social.js +2 -2
- package/dist/entries/types.d.cts +8 -0
- package/dist/entries/types.d.ts +8 -0
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +154 -150
- package/dist/entries/video.d.cts +11 -2
- package/dist/entries/video.d.ts +11 -2
- package/dist/entries/video.js +6 -6
- package/dist/entries/workflow.cjs +150 -150
- package/dist/entries/workflow.d.cts +1 -1
- package/dist/entries/workflow.d.ts +1 -1
- package/dist/entries/workflow.js +2 -2
- package/dist/index.cjs +2136 -1704
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +27 -27
- package/dist/{model-catalog-CCEcv08q.d.ts → model-catalog-Cf9fkEUp.d.cts} +45 -2
- package/dist/{model-catalog-CCEcv08q.d.cts → model-catalog-Cf9fkEUp.d.ts} +45 -2
- package/dist/{model-constants-B88p6XR0.d.ts → model-constants-BxjiWVQ9.d.ts} +215 -32
- package/dist/{model-constants-Cf3zaITt.d.cts → model-constants-C_Nyft_i.d.cts} +215 -32
- package/package.json +1 -1
- package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
- package/src/__tests__/credit-identifiers.test.ts +29 -0
- package/src/__tests__/extend-providers.test.ts +359 -39
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
- package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
- package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
- package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
- package/src/__tests__/flux-3-klein.test.ts +203 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
- package/src/__tests__/gvp-supported-providers.test.ts +27 -2
- package/src/__tests__/lip-sync-audio-rate.test.ts +74 -0
- package/src/__tests__/lip-sync-levers.test.ts +31 -0
- package/src/__tests__/llm-models.test.ts +139 -12
- package/src/__tests__/llm-price-key.test.ts +164 -1
- package/src/__tests__/model-makers.test.ts +3 -0
- package/src/__tests__/nemotron-transcribe-pricing.test.ts +61 -0
- package/src/__tests__/node-runtime-keys.test.ts +7 -0
- package/src/__tests__/normalize-node-params.test.ts +172 -1
- package/src/__tests__/pixverse-v6-max-catalog.test.ts +271 -0
- package/src/__tests__/prompt-length-limits.test.ts +4 -0
- package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
- package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
- package/src/__tests__/seedance-task-type.test.ts +13 -3
- package/src/__tests__/sequence-execution.test.ts +22 -1
- package/src/__tests__/suno-credit-type.test.ts +21 -2
- package/src/__tests__/transcribe-capabilities.test.ts +41 -2
- package/src/__tests__/transcribe-preflight.test.ts +50 -1
- package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
- package/src/__tests__/video-analysis-pricing.test.ts +10 -9
- package/src/__tests__/video-audio-capability.test.ts +35 -6
- package/src/__tests__/video-resolution-billed-as-named.test.ts +30 -0
- package/src/__tests__/video-upscale-params.test.ts +62 -0
- package/src/caption-styles.ts +62 -0
- package/src/catalog-projection.ts +8 -0
- package/src/credit-estimators/add-captions-nemotron.ts +73 -0
- package/src/credit-estimators/index.ts +20 -0
- package/src/credit-estimators/nemotron-transcribe.ts +87 -0
- package/src/credit-identifiers.ts +351 -41
- package/src/entries/captions.ts +2 -0
- package/src/entries/credits.ts +37 -2
- package/src/entries/llm-models.ts +6 -0
- package/src/entries/model-catalog.ts +22 -0
- package/src/entries/models.ts +50 -0
- package/src/entries/nodes.ts +4 -0
- package/src/entries/pipeline.ts +1 -1
- package/src/entries/video.ts +1 -1
- package/src/flux-3-klein.ts +69 -0
- package/src/freecut-protocol.ts +8 -0
- package/src/input-image-pricing.ts +23 -6
- package/src/lip-sync-levers.ts +56 -0
- package/src/lip-sync-pricing.ts +91 -1
- package/src/llm-models.ts +305 -16
- package/src/model-catalog.ts +529 -28
- package/src/model-constants.ts +417 -41
- package/src/model-tree.ts +2 -1
- package/src/nodaro-video-upscale.ts +48 -0
- package/src/node-default-mappings.ts +6 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/normalize-node-params.ts +172 -3
- package/src/runtime-config/contract.ts +10 -7
- package/src/seedance-draft.ts +2 -1
- package/src/seedance-extend-rate.ts +116 -0
- package/src/sequence-execution.ts +24 -0
- package/src/transcribe-preflight.ts +81 -7
- package/src/video-analysis-pricing.ts +28 -15
- package/src/video-duration.ts +9 -0
- package/src/video-ui-defaults.ts +5 -3
- package/src/video-upscale-params.ts +67 -0
- package/dist/chunk-2W745U4A.cjs.map +0 -1
- package/dist/chunk-3M4BNKFJ.cjs.map +0 -1
- package/dist/chunk-3OYO3XCC.js.map +0 -1
- package/dist/chunk-5YYN5X57.js.map +0 -1
- package/dist/chunk-6CSXMWL4.cjs.map +0 -1
- package/dist/chunk-6G7NN4S4.js.map +0 -1
- package/dist/chunk-AFYTX4AI.cjs.map +0 -1
- package/dist/chunk-AOJ6B7K4.cjs.map +0 -1
- package/dist/chunk-BLJUCPMV.cjs.map +0 -1
- package/dist/chunk-E2HZTGYX.js.map +0 -1
- package/dist/chunk-FVII3KHN.js.map +0 -1
- package/dist/chunk-GSFB537T.js.map +0 -1
- package/dist/chunk-HSHCCBIV.js.map +0 -1
- package/dist/chunk-IDTKF5EX.cjs.map +0 -1
- package/dist/chunk-IWWVPR3W.cjs.map +0 -1
- package/dist/chunk-KJSRPHJ2.cjs.map +0 -1
- package/dist/chunk-KYMHFVAZ.cjs.map +0 -1
- package/dist/chunk-MYJQELFN.cjs.map +0 -1
- package/dist/chunk-NGKKNSK6.js.map +0 -1
- package/dist/chunk-PTD6EDUU.js.map +0 -1
- package/dist/chunk-Q6IES3U2.js.map +0 -1
- package/dist/chunk-QWYFHQYK.cjs +0 -357
- package/dist/chunk-QWYFHQYK.cjs.map +0 -1
- package/dist/chunk-S24ZBUB4.js.map +0 -1
- package/dist/chunk-SYWR5G3T.js.map +0 -1
- package/dist/chunk-TRVWMKNE.cjs.map +0 -1
- package/dist/chunk-UDDVDQMF.js.map +0 -1
- package/dist/chunk-VACPZPUA.cjs.map +0 -1
- package/dist/chunk-WRSWH7US.cjs.map +0 -1
- package/dist/chunk-Y6X7UJSD.js.map +0 -1
- package/dist/chunk-YCXRSWCQ.js.map +0 -1
package/src/model-tree.ts
CHANGED
|
@@ -74,7 +74,8 @@ const MODE_TO_NODE: Readonly<Partial<Record<ModelMode, string>>> = {
|
|
|
74
74
|
|
|
75
75
|
export function modelToNodeTarget(modelId: string): ModelNodeTarget | null {
|
|
76
76
|
const entry = MODEL_CATALOG[modelId]
|
|
77
|
-
|
|
77
|
+
// A model the platform runs on its own creates no node (`pickerHidden`).
|
|
78
|
+
if (!entry || entry.pickerHidden === true) return null
|
|
78
79
|
// Resolve the target node: a valid provider-enum value wins, else the catalog's modes.
|
|
79
80
|
const enumMatch = ENUM_TARGETS.find(([providers]) => providers.includes(modelId))
|
|
80
81
|
const nodeType = enumMatch?.[1] ?? entry.modes.map((m) => MODE_TO_NODE[m]).find(Boolean)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nodaro Video Upscale — the Video Upscale node's `nodaro-video-upscale`
|
|
3
|
+
* provider (decided 2026-11-11): what a caller may ask for and what the
|
|
4
|
+
* platform accepts. The pricing rule lives in `@nodaro/render-rules`
|
|
5
|
+
* (`nodaro-video-upscale-pricing.ts`). It is offered under the deployment's
|
|
6
|
+
* own label (`ownLabel` in the catalog), and only where the deployment serves
|
|
7
|
+
* it (the backend's house-model seam).
|
|
8
|
+
*
|
|
9
|
+
* A tier is an output BOX, not a short side: the clip is fitted into
|
|
10
|
+
* 1920×1080, 2560×1440 or 3840×2160 (the box turned for a portrait clip),
|
|
11
|
+
* never cropped, at its own frame rate, length and audio. It has no frame-rate
|
|
12
|
+
* setting and no 720p tier — Topaz has both.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const NODARO_VIDEO_UPSCALE_PROVIDER = "nodaro-video-upscale" as const
|
|
16
|
+
|
|
17
|
+
/** The output tiers, cheapest first. */
|
|
18
|
+
export const NODARO_VIDEO_UPSCALE_TIERS = ["1080p", "2k", "4k"] as const
|
|
19
|
+
export type NodaroVideoUpscaleTier = (typeof NODARO_VIDEO_UPSCALE_TIERS)[number]
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The tier a request that names none runs at — the cheapest, as Topaz's
|
|
23
|
+
* default is its 1080p (decided 2026-11-11 by the build; the catalog entry's
|
|
24
|
+
* `defaultResolution` says the same, so the normalizer snaps to it).
|
|
25
|
+
*/
|
|
26
|
+
export const NODARO_VIDEO_UPSCALE_DEFAULT_TIER: NodaroVideoUpscaleTier = "1080p"
|
|
27
|
+
|
|
28
|
+
/** The landscape output box of each tier (a portrait clip gets it turned). */
|
|
29
|
+
export const NODARO_VIDEO_UPSCALE_BOX: Readonly<Record<NodaroVideoUpscaleTier, { readonly width: number; readonly height: number }>> = {
|
|
30
|
+
"1080p": { width: 1920, height: 1080 },
|
|
31
|
+
"2k": { width: 2560, height: 1440 },
|
|
32
|
+
"4k": { width: 3840, height: 2160 },
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The longest clip accepted, in seconds. A longer one is refused before anything is held. */
|
|
36
|
+
export const NODARO_VIDEO_UPSCALE_MAX_SEC = 60
|
|
37
|
+
|
|
38
|
+
/** The largest clip accepted, in bytes (50 MB, decimal). A larger one is refused before anything is held. */
|
|
39
|
+
export const NODARO_VIDEO_UPSCALE_MAX_BYTES = 50_000_000
|
|
40
|
+
|
|
41
|
+
export function isNodaroVideoUpscaleTier(v: unknown): v is NodaroVideoUpscaleTier {
|
|
42
|
+
return typeof v === "string" && (NODARO_VIDEO_UPSCALE_TIERS as readonly string[]).includes(v)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Is this Video Upscale `provider` value the Nodaro Video Upscale provider? */
|
|
46
|
+
export function isNodaroVideoUpscaleProvider(provider: unknown): provider is typeof NODARO_VIDEO_UPSCALE_PROVIDER {
|
|
47
|
+
return provider === NODARO_VIDEO_UPSCALE_PROVIDER
|
|
48
|
+
}
|
|
@@ -196,6 +196,9 @@ const QUALITY_MAP: Record<string, QualityMapping> = {
|
|
|
196
196
|
// low the cheapest, 1K (1.5K costs the same, and is the panel's to pick).
|
|
197
197
|
"seedream-5-5": { field: "resolution", values: { low: "1K", mid: SEEDREAM_5_5_DEFAULT_RESOLUTION, high: "2K" } },
|
|
198
198
|
"seedream-5-5-i2i": { field: "resolution", values: { low: "1K", mid: SEEDREAM_5_5_DEFAULT_RESOLUTION, high: "2K" } },
|
|
199
|
+
// FLUX 3 Klein: three sizes, 1K its default and cheapest (as GPT Image 2).
|
|
200
|
+
"flux-3-klein": { field: "resolution", values: { low: "1K", mid: "2K", high: "4K" } },
|
|
201
|
+
"flux-3-klein-i2i": { field: "resolution", values: { low: "1K", mid: "2K", high: "4K" } },
|
|
199
202
|
// Video gen — resolution-style (720p/1080p)
|
|
200
203
|
"veo3": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
|
|
201
204
|
"veo3.1": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
|
|
@@ -236,6 +239,9 @@ const QUALITY_MAP: Record<string, QualityMapping> = {
|
|
|
236
239
|
"gemini-omni-flash-1-2": { field: "resolution", values: { low: "720p", mid: "1080p", high: "4k" } },
|
|
237
240
|
// Grok Imagine Video 1.5 — 480p / 720p / 1080p, each quality rung its own tier.
|
|
238
241
|
"grok-imagine-video-1.5": { field: "resolution", values: { low: "480p", mid: "720p", high: "1080p" } },
|
|
242
|
+
// PixVerse V6 Max — four tiers; "low" stops at 540p (360p is a preview tier,
|
|
243
|
+
// as on Gemini Omni Flash 1.2) and "mid" is its declared 720p default.
|
|
244
|
+
"pixverse-v6-max": { field: "resolution", values: { low: "540p", mid: "720p", high: "1080p" } },
|
|
239
245
|
// Replicate Flux 2 family — MP-based resolution (matching IMAGE_RESOLUTION_OPTIONS["flux-2-*"]).
|
|
240
246
|
// `field: "resolution"` is mandatory — see Provider Enum Sync pitfall 4.
|
|
241
247
|
// mid = provider default: 1 MP for Klein, 2 MP for Pro/Max.
|
package/src/node-runtime-keys.ts
CHANGED
|
@@ -55,6 +55,9 @@ export const EXECUTION_DATA_KEYS: ReadonlySet<string> = new Set([
|
|
|
55
55
|
"generatedResults",
|
|
56
56
|
"activeResultIndex",
|
|
57
57
|
"sourceImageUrl",
|
|
58
|
+
// An Extend / Upscale Video node's own run's output task — what a VEO or
|
|
59
|
+
// Runway extend after it continues (its `kieTaskId` is the task it works on).
|
|
60
|
+
"outputKieTaskId",
|
|
58
61
|
"__listTotal",
|
|
59
62
|
"__listCompleted",
|
|
60
63
|
"__listResults",
|
|
@@ -18,10 +18,23 @@
|
|
|
18
18
|
* rejecting it, so the user sees a valid value on the canvas rather than a
|
|
19
19
|
* failed run. It reads exclusively from `MODEL_CATALOG`, so a model added later
|
|
20
20
|
* is covered without touching this file.
|
|
21
|
+
*
|
|
22
|
+
* Besides the image trio below, it holds three single levers: a Video Upscale
|
|
23
|
+
* node's `targetResolution`, a Motion Transfer node's `resolution`, and a
|
|
24
|
+
* video node's stored Seedance reference task type (`referenceTaskType`,
|
|
25
|
+
* removed where no model the node runs lists it).
|
|
21
26
|
*/
|
|
22
27
|
|
|
23
|
-
import { autoAspectNeedsSourceImage, normalizeModelInput, type ModelInputAdjustment } from "./model-catalog.js"
|
|
24
|
-
import { imageGenAutoAspectNeedsSourceImage } from "./credit-identifiers.js"
|
|
28
|
+
import { autoAspectNeedsSourceImage, MODEL_CATALOG, normalizeModelInput, type ModelInputAdjustment, type ModelInputAdjustmentField } from "./model-catalog.js"
|
|
29
|
+
import { imageGenAutoAspectNeedsSourceImage, motionTransferResolution } from "./credit-identifiers.js"
|
|
30
|
+
import { normalizeVideoUpscaleResolution, VIDEO_UPSCALE_RESOLUTIONS, videoUpscaleResolutionsFor } from "./video-upscale-params.js"
|
|
31
|
+
import {
|
|
32
|
+
applyDefaultVideoSelection,
|
|
33
|
+
DEFAULT_VIDEO_TO_VIDEO_PROVIDER,
|
|
34
|
+
LEGACY_VIDEO_NODE_DEFAULT_PROVIDER,
|
|
35
|
+
listedSeedanceTaskType,
|
|
36
|
+
resolveVideoProviderForMode,
|
|
37
|
+
} from "./model-constants.js"
|
|
25
38
|
|
|
26
39
|
/**
|
|
27
40
|
* Node types whose `data` carries catalog-governed model parameters under the
|
|
@@ -104,7 +117,9 @@ export function nodeAspectRatio(nodeType: string | undefined, aspectRatio: unkno
|
|
|
104
117
|
return nodeType !== undefined && PHOTO_AUTO_ASPECT_NODE_TYPES.has(nodeType) ? "auto" : undefined
|
|
105
118
|
}
|
|
106
119
|
|
|
107
|
-
export interface NodeParamAdjustment extends ModelInputAdjustment {
|
|
120
|
+
export interface NodeParamAdjustment extends Omit<ModelInputAdjustment, "field"> {
|
|
121
|
+
/** A catalog-governed parameter, or a video node's stored `referenceTaskType` (always removed: `to` is undefined). */
|
|
122
|
+
field: ModelInputAdjustmentField | "referenceTaskType"
|
|
108
123
|
nodeId: string
|
|
109
124
|
provider: string
|
|
110
125
|
}
|
|
@@ -140,6 +155,10 @@ export function normalizeNodeModelParams<T extends NodeLike>(
|
|
|
140
155
|
const adjustments: NodeParamAdjustment[] = []
|
|
141
156
|
const out = nodes.map((node) => {
|
|
142
157
|
const type = typeof node.type === "string" ? node.type : ""
|
|
158
|
+
if (type === "video-upscale") return normalizeVideoUpscaleNode(node, adjustments)
|
|
159
|
+
if (type === "motion-transfer") return normalizeMotionTransferNode(node, adjustments)
|
|
160
|
+
// The stored reference task type: the one rule every workflow write runs.
|
|
161
|
+
if (REFERENCE_TASK_TYPE_NODE_MODES.has(type)) return withListedReferenceTaskTypes([node], adjustments)[0]!
|
|
143
162
|
if (!MODEL_PARAM_NODE_TYPES.has(type)) return node
|
|
144
163
|
|
|
145
164
|
const data = node.data
|
|
@@ -199,6 +218,156 @@ export function normalizeNodeModelParams<T extends NodeLike>(
|
|
|
199
218
|
return { nodes: out, adjustments }
|
|
200
219
|
}
|
|
201
220
|
|
|
221
|
+
/**
|
|
222
|
+
* A Video Upscale node: its `targetResolution` held to what its provider takes,
|
|
223
|
+
* only for a provider whose catalog entry declares its resolutions
|
|
224
|
+
* (`normalizeVideoUpscaleResolution`; today Nodaro Video Upscale's 1080p / 2K /
|
|
225
|
+
* 4K). Every other provider's node — Topaz's, VEO's, Seedance HD's — is
|
|
226
|
+
* returned as it came: its run reads the field by its own rules. Only that one
|
|
227
|
+
* key is rewritten, and only when it holds a value some Video Upscale provider
|
|
228
|
+
* takes (`VIDEO_UPSCALE_RESOLUTIONS`, spelled any way); an unset value and any
|
|
229
|
+
* other value are left alone.
|
|
230
|
+
*/
|
|
231
|
+
function normalizeVideoUpscaleNode<T extends NodeLike>(node: T, adjustments: NodeParamAdjustment[]): T {
|
|
232
|
+
const data = node.data
|
|
233
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return node
|
|
234
|
+
const d = data as Record<string, unknown>
|
|
235
|
+
if (typeof d.targetResolution !== "string" || d.targetResolution === "") return node
|
|
236
|
+
const provider = typeof d.provider === "string" && d.provider !== "" ? d.provider : "topaz"
|
|
237
|
+
if (videoUpscaleResolutionsFor(provider).length === 0) return node
|
|
238
|
+
const asked = d.targetResolution.trim().toLowerCase()
|
|
239
|
+
if (!(VIDEO_UPSCALE_RESOLUTIONS as readonly string[]).includes(asked)) return node
|
|
240
|
+
const normalized = normalizeVideoUpscaleResolution(provider, d.targetResolution)
|
|
241
|
+
if (normalized.targetResolution === d.targetResolution) return node
|
|
242
|
+
const nodeId = typeof node.id === "string" ? node.id : "(unknown node)"
|
|
243
|
+
if (normalized.adjustment) adjustments.push({ ...normalized.adjustment, nodeId, provider })
|
|
244
|
+
return { ...node, data: { ...d, targetResolution: normalized.targetResolution } }
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* A Motion Transfer node: its `resolution` held to the size its model runs at
|
|
249
|
+
* (`motionTransferResolution`: a Wan Animate node at 1080p runs as 720p), the
|
|
250
|
+
* same rule its run is sent and charged by. Only that key is rewritten, and
|
|
251
|
+
* only when the rule moves it; an unset size is left for the run's default.
|
|
252
|
+
*/
|
|
253
|
+
function normalizeMotionTransferNode<T extends NodeLike>(node: T, adjustments: NodeParamAdjustment[]): T {
|
|
254
|
+
const data = node.data
|
|
255
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return node
|
|
256
|
+
const d = data as Record<string, unknown>
|
|
257
|
+
if (typeof d.resolution !== "string" || d.resolution === "") return node
|
|
258
|
+
const provider = typeof d.provider === "string" && d.provider !== "" ? d.provider : "kling"
|
|
259
|
+
const sized = motionTransferResolution(provider, d.resolution)
|
|
260
|
+
if (sized.resolution === d.resolution) return node
|
|
261
|
+
const nodeId = typeof node.id === "string" ? node.id : "(unknown node)"
|
|
262
|
+
for (const adj of sized.adjustments) adjustments.push({ ...adj, nodeId, provider })
|
|
263
|
+
return { ...node, data: { ...d, resolution: sized.resolution } }
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** A video run's mode: the twin of an aliased model it sends to (`resolveVideoProviderForMode`). */
|
|
267
|
+
type VideoRunMode = "image-to-video" | "text-to-video"
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* The video node types that store a Seedance reference task type
|
|
271
|
+
* (`referenceTaskType`, "Use the reference video as"), each with the modes its
|
|
272
|
+
* run sends a model in: Generate Video either (the wiring picks), Image to
|
|
273
|
+
* Video and Text to Video their own, Video to Video none (its model's own id;
|
|
274
|
+
* its run is an edit whatever is stored).
|
|
275
|
+
*/
|
|
276
|
+
const REFERENCE_TASK_TYPE_NODE_MODES: ReadonlyMap<string, readonly VideoRunMode[]> = new Map([
|
|
277
|
+
["generate-video", ["image-to-video", "text-to-video"]],
|
|
278
|
+
["image-to-video", ["image-to-video"]],
|
|
279
|
+
["text-to-video", ["text-to-video"]],
|
|
280
|
+
["video-to-video", []],
|
|
281
|
+
])
|
|
282
|
+
|
|
283
|
+
const namedModel = (v: unknown): string | undefined => (typeof v === "string" && v !== "" ? v : undefined)
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* The models a video node's run uses: each entry of a Provider list
|
|
287
|
+
* (`data.providers`, two or more, each run on its own), else its one model —
|
|
288
|
+
* the run's own default when it names none (Generate Video's
|
|
289
|
+
* `applyDefaultVideoSelection`, the legacy Image / Text to Video default, Video
|
|
290
|
+
* to Video's).
|
|
291
|
+
*/
|
|
292
|
+
function videoRunModels(type: string, d: Record<string, unknown>): string[] {
|
|
293
|
+
const list = Array.isArray(d.providers) ? d.providers.flatMap((p) => namedModel(p) ?? []) : []
|
|
294
|
+
if (list.length >= 2) return list
|
|
295
|
+
const named = namedModel(d.provider)
|
|
296
|
+
if (type === "generate-video") return [applyDefaultVideoSelection({ provider: named }).provider]
|
|
297
|
+
return [named ?? (type === "video-to-video" ? DEFAULT_VIDEO_TO_VIDEO_PROVIDER : LEGACY_VIDEO_NODE_DEFAULT_PROVIDER)]
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* A video node's stored reference task type (decided 2026-11-13): kept, the
|
|
302
|
+
* node returned as it came, while a model its run sends to lists the value
|
|
303
|
+
* (`listedSeedanceTaskType`, the one membership test the run itself asks —
|
|
304
|
+
* matched exactly, read from `MODEL_CATALOG[id].referenceTaskTypes`);
|
|
305
|
+
* otherwise the key is REMOVED (absent is Auto, the setting's own meaning).
|
|
306
|
+
* A run already ignores such a value, so nothing a run sends or is charged
|
|
307
|
+
* changes; what changes is that it can no longer ride hidden on a model that
|
|
308
|
+
* ignores it and come back when the node is later switched to one that reads
|
|
309
|
+
* it. `auto`, a wrong case, a number and every value no model lists are
|
|
310
|
+
* removed on every model. A node storing no value is returned as it came.
|
|
311
|
+
*/
|
|
312
|
+
function normalizeReferenceTaskTypeNode<T extends NodeLike>(node: T, type: string, adjustments: NodeParamAdjustment[]): T {
|
|
313
|
+
const data = node.data
|
|
314
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return node
|
|
315
|
+
const d = data as Record<string, unknown>
|
|
316
|
+
const value = d.referenceTaskType
|
|
317
|
+
// Unset (absent, or an in-memory `undefined` the editor writes for Auto): nothing to judge.
|
|
318
|
+
if (value === undefined) return node
|
|
319
|
+
const modes = REFERENCE_TASK_TYPE_NODE_MODES.get(type) ?? []
|
|
320
|
+
const models = videoRunModels(type, d)
|
|
321
|
+
const sentTo = models.flatMap((m) => [m, ...modes.map((mode) => resolveVideoProviderForMode(m, mode))])
|
|
322
|
+
if (sentTo.some((m) => listedSeedanceTaskType(m, value) !== undefined)) return node
|
|
323
|
+
|
|
324
|
+
const listedAnywhere = Object.values(MODEL_CATALOG).some((m) => m.referenceTaskTypes?.some((t) => t === value))
|
|
325
|
+
const label = MODEL_CATALOG[models[0]!]?.label ?? models[0]!
|
|
326
|
+
const reason = listedAnywhere
|
|
327
|
+
? `${label} does not take the reference task type "${String(value)}": removed, so the run declares none (Auto).`
|
|
328
|
+
: `"${String(value)}" is not a reference task type a model takes (reference, edit or extend): removed — Auto is the setting left unset.`
|
|
329
|
+
const nodeId = typeof node.id === "string" ? node.id : "(unknown node)"
|
|
330
|
+
adjustments.push({ field: "referenceTaskType", from: typeof value === "number" ? value : String(value), to: undefined, reason, nodeId, provider: models[0]! })
|
|
331
|
+
const { referenceTaskType: _removed, ...rest } = d
|
|
332
|
+
return { ...node, data: rest }
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* A workflow graph's nodes with every stored Seedance reference task type held
|
|
337
|
+
* to the models its node runs (decided 2026-11-13) — the ONE rule for that
|
|
338
|
+
* field, which {@link normalizeNodeModelParams} runs too: on a Generate Video,
|
|
339
|
+
* Image to Video, Text to Video or Video to Video node, a `referenceTaskType`
|
|
340
|
+
* no model the node runs lists (and `auto`, or any value no model lists) is
|
|
341
|
+
* removed; nothing else on any node is touched.
|
|
342
|
+
*
|
|
343
|
+
* Every path that stores a workflow graph runs it: the editor's saves, the
|
|
344
|
+
* REST and MCP writes, imports, copies, template clones and the published
|
|
345
|
+
* snapshots. So a value can never sit unused on a model that ignores it and
|
|
346
|
+
* take effect when the node is later switched to one that reads it.
|
|
347
|
+
*
|
|
348
|
+
* Takes the stored value as it comes (`nodes` may be any JSON): anything that
|
|
349
|
+
* is not an array is returned as it came. The SAME array is returned when no
|
|
350
|
+
* node changes, and an unchanged node keeps its reference, so a graph without
|
|
351
|
+
* such a value is written byte for byte as before.
|
|
352
|
+
*
|
|
353
|
+
* @param adjustments told each removal (what `normalizeNodeModelParams` reports).
|
|
354
|
+
*/
|
|
355
|
+
export function withListedReferenceTaskTypes<N>(nodes: N, adjustments?: NodeParamAdjustment[]): N {
|
|
356
|
+
if (!Array.isArray(nodes)) return nodes
|
|
357
|
+
const sink = adjustments ?? []
|
|
358
|
+
let changed = false
|
|
359
|
+
const out = (nodes as unknown[]).map((node) => {
|
|
360
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) return node
|
|
361
|
+
const n = node as NodeLike
|
|
362
|
+
const type = typeof n.type === "string" ? n.type : ""
|
|
363
|
+
if (!REFERENCE_TASK_TYPE_NODE_MODES.has(type)) return node
|
|
364
|
+
const next = normalizeReferenceTaskTypeNode(n, type, sink)
|
|
365
|
+
if (next !== n) changed = true
|
|
366
|
+
return next
|
|
367
|
+
})
|
|
368
|
+
return (changed ? out : nodes) as N
|
|
369
|
+
}
|
|
370
|
+
|
|
202
371
|
/** One-line-per-change summary, for surfacing back to an agent or a log. */
|
|
203
372
|
export function describeNodeAdjustments(adjustments: readonly NodeParamAdjustment[]): string[] {
|
|
204
373
|
return adjustments.map(
|
|
@@ -142,17 +142,20 @@ export interface NodaroRuntimeConfig {
|
|
|
142
142
|
*/
|
|
143
143
|
readonly mediaOrigin?: string
|
|
144
144
|
/**
|
|
145
|
-
* The https origin the app's
|
|
146
|
-
* them
|
|
147
|
-
*
|
|
145
|
+
* The https origin of the app's pages' own host, when this deployment gives
|
|
146
|
+
* them one. Alone (with `linkOrigin`), every host keeps serving the pages
|
|
147
|
+
* and only a browser's saved settings carry over to it. With
|
|
148
|
+
* `legacyUiHosts` too, the pages have moved there, and a page on it calls
|
|
149
|
+
* the API same-origin. Absent: the deployment has one host.
|
|
148
150
|
*/
|
|
149
151
|
readonly flowUiOrigin?: string
|
|
150
|
-
/** The hosts the app's pages moved away from (with `flowUiOrigin`): a navigation on one goes to the page's home. */
|
|
152
|
+
/** The hosts the app's pages moved away from (with `flowUiOrigin`): a navigation on one goes to the page's home. Absent: nothing moved. */
|
|
151
153
|
readonly legacyUiHosts?: readonly string[]
|
|
152
154
|
/**
|
|
153
|
-
* The https origin
|
|
154
|
-
*
|
|
155
|
-
*
|
|
155
|
+
* The https origin the API keeps, with `flowUiOrigin`: where a browser's
|
|
156
|
+
* saved settings are carried over from and, once the pages have moved
|
|
157
|
+
* (`legacyUiHosts`), the origin developer-facing links name (published
|
|
158
|
+
* apps, embeds, API examples). Absent: the page's own origin, as ever.
|
|
156
159
|
*/
|
|
157
160
|
readonly linkOrigin?: string
|
|
158
161
|
}
|
package/src/seedance-draft.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* Every surface (generation routes, the workflow engine, MCP, the editor's
|
|
14
14
|
* toggle) gates on {@link isSeedanceDraftCapable}; never hand-list the model.
|
|
15
15
|
*/
|
|
16
|
+
import { CONTAINER_OVERHANG_SEC } from "./video-duration.js"
|
|
16
17
|
|
|
17
18
|
/** Models that accept the draft flag. */
|
|
18
19
|
export const SEEDANCE_DRAFT_MODELS = ["seedance-2-5"] as const
|
|
@@ -43,7 +44,7 @@ export const SEEDANCE_DRAFT_FINALIZE_MAX_SEC = 30
|
|
|
43
44
|
* auto-duration settlement uses — and land on the seeded ladder (4–30 s).
|
|
44
45
|
*/
|
|
45
46
|
export function seedanceDraftFinalizeBillableSec(measuredSec: number): number {
|
|
46
|
-
const whole = Math.max(1, Math.ceil(measuredSec -
|
|
47
|
+
const whole = Math.max(1, Math.ceil(measuredSec - CONTAINER_OVERHANG_SEC))
|
|
47
48
|
return Math.min(SEEDANCE_DRAFT_FINALIZE_MAX_SEC, Math.max(SEEDANCE_DRAFT_FINALIZE_MIN_SEC, whole))
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seedance 2.5 Extend's price rows — part of the public credit-id contract:
|
|
3
|
+
* the rows a run is charged a multiple of, and so the ids a client names to
|
|
4
|
+
* ask what a run costs (`tailExtendCreditId`, `credit-identifiers.ts`).
|
|
5
|
+
*
|
|
6
|
+
* A Seedance 2.5 Extend run sends the source's last
|
|
7
|
+
* {@link SEEDANCE_EXTEND_CONTEXT_MAX_SEC} seconds (all of a shorter source)
|
|
8
|
+
* and is charged per second sent and added. A per-second price is not a
|
|
9
|
+
* whole credit, so each resolution's row is the price of
|
|
10
|
+
* {@link SEEDANCE_EXTEND_RATE_SECONDS} seconds, and a run is that row × (seconds
|
|
11
|
+
* sent + seconds added) ÷ 2, rounded up once.
|
|
12
|
+
*
|
|
13
|
+
* The seconds rule lives here too (decided 2026-11-13), so a client prices a
|
|
14
|
+
* run on a known source by the same rule the server charges it by
|
|
15
|
+
* (`seedanceExtendSourceCreditId`, credit-identifiers.ts): how many seconds of
|
|
16
|
+
* the source are sent ({@link seedanceExtendSentSec}, a picture's length read
|
|
17
|
+
* by the container-overhang rule), how many are added
|
|
18
|
+
* ({@link seedanceExtendAddedSec}) and the units of a rate row they make
|
|
19
|
+
* ({@link seedanceExtendUnits}). `@nodaro/render-rules`
|
|
20
|
+
* (`seedance-extend-pricing.ts`) and the backend read them from here.
|
|
21
|
+
*/
|
|
22
|
+
import { MODEL_CATALOG } from "./model-catalog.js"
|
|
23
|
+
import { pricedOutputDurationSec, SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC, type SeedanceExtendProvider, type TailExtendProvider } from "./model-constants.js"
|
|
24
|
+
import { CONTAINER_OVERHANG_SEC } from "./video-duration.js"
|
|
25
|
+
|
|
26
|
+
/** The Extend Video provider priced by the seconds it sends. */
|
|
27
|
+
export const SEEDANCE_EXTEND_SENT_PRICED_PROVIDER = "seedance-2-5-extend" satisfies SeedanceExtendProvider
|
|
28
|
+
|
|
29
|
+
/** The Extend Video provider priced by the seconds it sends. */
|
|
30
|
+
export type SentPricedSeedanceExtendProvider = typeof SEEDANCE_EXTEND_SENT_PRICED_PROVIDER
|
|
31
|
+
|
|
32
|
+
/** The most of the source's end a run sends as `@video_1`, in seconds. */
|
|
33
|
+
export const SEEDANCE_EXTEND_CONTEXT_MAX_SEC = 10
|
|
34
|
+
|
|
35
|
+
/** The seconds one rate row prices. */
|
|
36
|
+
export const SEEDANCE_EXTEND_RATE_SECONDS = 2
|
|
37
|
+
|
|
38
|
+
/** The rate row of each resolution: the price of {@link SEEDANCE_EXTEND_RATE_SECONDS} seconds. */
|
|
39
|
+
export const SEEDANCE_EXTEND_RATE_CREDIT_IDS: Readonly<Record<"480p" | "720p" | "1080p", string>> = {
|
|
40
|
+
"480p": "seedance-2-5-extend:480p:per-2s",
|
|
41
|
+
"720p": "seedance-2-5-extend:720p:per-2s",
|
|
42
|
+
"1080p": "seedance-2-5-extend:1080p:per-2s",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Is `provider` the Extend Video provider priced by the seconds it sends? A retired id answers false: pass it through `canonicalVideoProvider` first. */
|
|
46
|
+
export function isSeedanceExtendPricedBySecondsSent(provider: unknown): provider is SentPricedSeedanceExtendProvider {
|
|
47
|
+
return provider === SEEDANCE_EXTEND_SENT_PRICED_PROVIDER
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Is `id` one of the rate rows? */
|
|
51
|
+
export function isSeedanceExtendRateCreditId(id: unknown): boolean {
|
|
52
|
+
return typeof id === "string" && (Object.values(SEEDANCE_EXTEND_RATE_CREDIT_IDS) as string[]).includes(id)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The seconds a tail-recipe extend run (Seedance 2.5 / 2.0, Kling 4) adds for a requested `duration`: the
|
|
57
|
+
* seconds its price counts (`pricedOutputDurationSec`, the provider's catalog
|
|
58
|
+
* default when unset or unreadable), held in the provider's catalog window.
|
|
59
|
+
* The one reading of the length: the route queues it, the worker generates
|
|
60
|
+
* it, and every price and quote counts it.
|
|
61
|
+
*/
|
|
62
|
+
export function seedanceExtendAddedSec(provider: TailExtendProvider, duration: unknown): number {
|
|
63
|
+
const requested = typeof duration === "number" || typeof duration === "string" ? duration : undefined
|
|
64
|
+
const offered = MODEL_CATALOG[provider]?.durations ?? []
|
|
65
|
+
const min = offered.length > 0 ? Math.min(...offered) : 1
|
|
66
|
+
const max = offered.length > 0 ? Math.max(...offered) : Number.POSITIVE_INFINITY
|
|
67
|
+
return Math.min(max, Math.max(min, Math.round(pricedOutputDurationSec(provider, requested))))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A length the source gives, when it is one: finite and above 0. */
|
|
71
|
+
function knownSec(sec: number | null | undefined): number | undefined {
|
|
72
|
+
return typeof sec === "number" && Number.isFinite(sec) && sec > 0 ? sec : undefined
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A picture's measured length as the seconds it is charged as — the
|
|
77
|
+
* platform's container-overhang rule: at most `CONTAINER_OVERHANG_SEC` (a
|
|
78
|
+
* quarter second) past a whole second is that whole second (8.04 s is 8 s,
|
|
79
|
+
* 8.25 s is 8 s); anything else is exactly as measured (8.3 s is 8.3 s).
|
|
80
|
+
* Under a second there is no whole second to read it as.
|
|
81
|
+
*/
|
|
82
|
+
export function seedanceExtendSourceSec(pictureSec: number): number {
|
|
83
|
+
const whole = Math.floor(pictureSec)
|
|
84
|
+
return whole >= 1 && pictureSec - whole <= CONTAINER_OVERHANG_SEC ? whole : pictureSec
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The seconds of the source a run is charged for sending: its last
|
|
89
|
+
* {@link SEEDANCE_EXTEND_CONTEXT_MAX_SEC}, or all of a shorter source, its
|
|
90
|
+
* picture's length read by the container-overhang rule
|
|
91
|
+
* ({@link seedanceExtendSourceSec}). A source whose length is not known (a
|
|
92
|
+
* quote before the upstream video exists, or a length that is not a positive
|
|
93
|
+
* finite number) counts the whole window: the most a run sends.
|
|
94
|
+
*/
|
|
95
|
+
export function seedanceExtendSentSec(sourcePictureSec: number | null | undefined): number {
|
|
96
|
+
const known = knownSec(sourcePictureSec)
|
|
97
|
+
return known === undefined ? SEEDANCE_EXTEND_CONTEXT_MAX_SEC : Math.min(SEEDANCE_EXTEND_CONTEXT_MAX_SEC, seedanceExtendSourceSec(known))
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Whether a Seedance Extend run refuses a source of this measured picture
|
|
102
|
+
* length: a known length (positive, finite) under the shortest source the
|
|
103
|
+
* extend takes, `SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC`, compared as measured, as
|
|
104
|
+
* the route refuses it before anything is reserved and the worker before it
|
|
105
|
+
* generates. A length that is not known is never refused here (the run
|
|
106
|
+
* measures the source itself).
|
|
107
|
+
*/
|
|
108
|
+
export function seedanceExtendRefusesSource(sourcePictureSec: number | null | undefined): boolean {
|
|
109
|
+
const known = knownSec(sourcePictureSec)
|
|
110
|
+
return known !== undefined && known < SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The units of a rate row a run that sends `sentSec` and adds `addedSec` is charged. */
|
|
114
|
+
export function seedanceExtendUnits(sentSec: number, addedSec: number): number {
|
|
115
|
+
return (sentSec + addedSec) / SEEDANCE_EXTEND_RATE_SECONDS
|
|
116
|
+
}
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
/** Public workflow capability marker; creative planning stays in the Studio codec. */
|
|
2
2
|
export const STUDIO_DEPENDENT_FRAMES_CAPABILITY = "studio-dependent-frames-v1"
|
|
3
3
|
|
|
4
|
+
const record = (value: unknown): Record<string, unknown> =>
|
|
5
|
+
value && typeof value === "object" && !Array.isArray(value) ? (value as Record<string, unknown>) : {}
|
|
6
|
+
const declaresDependentFrames = (data: Record<string, unknown>): boolean =>
|
|
7
|
+
Array.isArray(data.requiredCapabilities) && data.requiredCapabilities.includes(STUDIO_DEPENDENT_FRAMES_CAPABILITY)
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Whether a workflow document is one a server codec owns (Studio): the TS
|
|
11
|
+
* mirror of the database's `workflow_requires_compatible_writer`, whose write
|
|
12
|
+
* guard refuses any change to such a document by any writer but the codec's.
|
|
13
|
+
* Recognized even when a writer omitted the declaration: a Studio settings
|
|
14
|
+
* block holding keyframes, sequences or settled jobs, or declaring dependent
|
|
15
|
+
* frames, or any node carrying `keyframeId`, `sequenceBinding` or that
|
|
16
|
+
* declaration. The one predicate the server's routes and the editor ask.
|
|
17
|
+
*/
|
|
18
|
+
export function isCodecOwnedDocument(nodes: unknown, settings: unknown): boolean {
|
|
19
|
+
const studio = record(record(settings).studio)
|
|
20
|
+
return ["keyframes", "sequences", "settledJobIds"].some((key) => Object.hasOwn(studio, key))
|
|
21
|
+
|| declaresDependentFrames(studio)
|
|
22
|
+
|| (Array.isArray(nodes) && nodes.some((node) => {
|
|
23
|
+
const data = record(record(node).data)
|
|
24
|
+
return Object.hasOwn(data, "keyframeId") || Object.hasOwn(data, "sequenceBinding") || declaresDependentFrames(data)
|
|
25
|
+
}))
|
|
26
|
+
}
|
|
27
|
+
|
|
4
28
|
export class SequenceExecutionRequiredError extends Error {
|
|
5
29
|
readonly code = "sequence_execution_required"
|
|
6
30
|
readonly statusCode = 400
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_TRANSCRIBE_NODE_PROVIDER,
|
|
3
|
+
TRANSCRIBE_TARGET_LANGUAGES,
|
|
4
|
+
transcribeLaneSupportsTranslation,
|
|
3
5
|
transcribeLaneSupportsWordTimestamps,
|
|
6
|
+
transcribeProvidersWithTranslation,
|
|
4
7
|
transcribeProvidersWithWordTimestamps,
|
|
5
8
|
} from "./model-constants.js"
|
|
6
9
|
import { renderTranscriptOutputOf } from "./render-nodes.js"
|
|
@@ -16,12 +19,57 @@ import { renderTranscriptOutputOf } from "./render-nodes.js"
|
|
|
16
19
|
* Pure: no I/O, no framework types — callers pass plain nodes/edges.
|
|
17
20
|
*/
|
|
18
21
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
/** A transcription's target language as data carries it: a non-empty string, else `undefined` (no translation). */
|
|
23
|
+
export function transcribeTargetLanguageOf(value: unknown): string | undefined {
|
|
24
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The refusal for a request that can't return word timings; `null` when it can.
|
|
28
|
+
* An absent provider resolves to the transcribe NODE default. A translation
|
|
29
|
+
* (`targetLanguage`) never carries word timings, whatever the engine: KIE
|
|
30
|
+
* refuses Nemotron's `target_language` together with `timestamps`. */
|
|
31
|
+
export function transcribeWordTimestampsRefusal(
|
|
32
|
+
provider: string | null | undefined,
|
|
33
|
+
targetLanguage?: unknown,
|
|
34
|
+
): string | null {
|
|
22
35
|
const lane = provider || DEFAULT_TRANSCRIBE_NODE_PROVIDER
|
|
23
|
-
if (transcribeLaneSupportsWordTimestamps(lane))
|
|
24
|
-
|
|
36
|
+
if (!transcribeLaneSupportsWordTimestamps(lane)) {
|
|
37
|
+
return `the "${lane}" engine does not return word timings — pick ${transcribeProvidersWithWordTimestamps().join(" or ")}`
|
|
38
|
+
}
|
|
39
|
+
if (transcribeTargetLanguageOf(targetLanguage) !== undefined) {
|
|
40
|
+
return "a translation carries no word timings — clear the target language to get a transcript with word timings"
|
|
41
|
+
}
|
|
42
|
+
return null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The refusal for a translation request (`targetLanguage`) that cannot run;
|
|
47
|
+
* `null` when there is none to refuse (no target language, or a valid one on
|
|
48
|
+
* an engine that translates, without word timings). One message for every run
|
|
49
|
+
* surface: the route, the workflow run, the editor's Run and MCP.
|
|
50
|
+
* - only Nemotron 3.5 Transcribe translates;
|
|
51
|
+
* - only into a language KIE lists (`TRANSCRIBE_TARGET_LANGUAGES`);
|
|
52
|
+
* - never together with word timings (KIE refuses the pair).
|
|
53
|
+
* An absent provider resolves to the transcribe NODE default.
|
|
54
|
+
*/
|
|
55
|
+
export function transcribeTranslationRefusal(
|
|
56
|
+
provider: string | null | undefined,
|
|
57
|
+
targetLanguage: unknown,
|
|
58
|
+
wordTimestamps?: boolean,
|
|
59
|
+
): string | null {
|
|
60
|
+
const target = transcribeTargetLanguageOf(targetLanguage)
|
|
61
|
+
if (target === undefined) return null
|
|
62
|
+
const lane = provider || DEFAULT_TRANSCRIBE_NODE_PROVIDER
|
|
63
|
+
if (!transcribeLaneSupportsTranslation(lane)) {
|
|
64
|
+
return `the "${lane}" engine does not translate — pick ${transcribeProvidersWithTranslation().join(" or ")} to translate, or clear the target language`
|
|
65
|
+
}
|
|
66
|
+
if (!(TRANSCRIBE_TARGET_LANGUAGES as readonly string[]).includes(target)) {
|
|
67
|
+
return `"${target}" is not a language the "${lane}" engine translates into — pick one of ${TRANSCRIBE_TARGET_LANGUAGES.join(", ")}`
|
|
68
|
+
}
|
|
69
|
+
if (wordTimestamps === true) {
|
|
70
|
+
return "word timings and a translation cannot be asked for together — turn word timings off, or clear the target language"
|
|
71
|
+
}
|
|
72
|
+
return null
|
|
25
73
|
}
|
|
26
74
|
|
|
27
75
|
export interface PreflightGraphNode {
|
|
@@ -44,12 +92,36 @@ export interface WordlessTranscriptFeed {
|
|
|
44
92
|
readonly message: string
|
|
45
93
|
}
|
|
46
94
|
|
|
95
|
+
/** Lanes that return word timings whatever the flag (ElevenLabs Scribe is word-level). */
|
|
96
|
+
const ALWAYS_WORD_LEVEL_LANES: ReadonlySet<string> = new Set(["elevenlabs-stt"])
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Whether a Transcribe node's run returns WORD timings, as its data and the
|
|
100
|
+
* graph say — what a caption render downstream can take as its words (the run's
|
|
101
|
+
* resolver hands an Add Captions node a Transcribe node's words only when there
|
|
102
|
+
* are some). Never while it translates, never on a lane that cannot give them;
|
|
103
|
+
* a word-level lane always; any other capable lane only when they are asked
|
|
104
|
+
* for: `wordTimestamps: true`, or its `json` output wired (`jsonWired`: the
|
|
105
|
+
* workflow run turns the flag on then). A price that reads this errs high when
|
|
106
|
+
* it is wrong: an unknown lane answers false.
|
|
107
|
+
*/
|
|
108
|
+
export function transcribeNodeReturnsWords(
|
|
109
|
+
data: { readonly provider?: unknown; readonly wordTimestamps?: unknown; readonly targetLanguage?: unknown } | null | undefined,
|
|
110
|
+
jsonWired: boolean,
|
|
111
|
+
): boolean {
|
|
112
|
+
const provider = (typeof data?.provider === "string" && data.provider) || DEFAULT_TRANSCRIBE_NODE_PROVIDER
|
|
113
|
+
if (transcribeTargetLanguageOf(data?.targetLanguage) !== undefined) return false
|
|
114
|
+
if (!transcribeLaneSupportsWordTimestamps(provider)) return false
|
|
115
|
+
return ALWAYS_WORD_LEVEL_LANES.has(provider) || data?.wordTimestamps === true || jsonWired
|
|
116
|
+
}
|
|
117
|
+
|
|
47
118
|
// Handle ids (generated map: backend/src/lib/mcp/generated/node-handles.ts).
|
|
48
119
|
const TRANSCRIBE_JSON_OUT = "json"
|
|
49
120
|
const TRANSCRIPT_IN = "transcript"
|
|
50
121
|
|
|
51
122
|
/**
|
|
52
|
-
* Every transcribe node on a word-INCAPABLE lane
|
|
123
|
+
* Every transcribe node on a word-INCAPABLE lane (or one set to translate, whose
|
|
124
|
+
* transcript is a translation with no word timings) whose `json` output reaches an
|
|
53
125
|
* add-captions `transcript` input — directly, or through apply-edl, which remaps
|
|
54
126
|
* the transcript and re-emits it on its own `json` handle (or any render, by
|
|
55
127
|
* its registry `transcriptOutput`: Speaker View's `transcript`). add-captions rejects a
|
|
@@ -72,7 +144,9 @@ export function findWordlessTranscriptFeeds(
|
|
|
72
144
|
for (const node of nodes) {
|
|
73
145
|
if (node.type !== "transcribe" || isSkipped(node)) continue
|
|
74
146
|
const provider = (typeof node.data?.provider === "string" && node.data.provider) || DEFAULT_TRANSCRIBE_NODE_PROVIDER
|
|
75
|
-
|
|
147
|
+
// A translating node is as wordless as an incapable lane: its transcript is
|
|
148
|
+
// the translation, with no word timings.
|
|
149
|
+
const refusal = transcribeWordTimestampsRefusal(provider, node.data?.targetLanguage)
|
|
76
150
|
if (!refusal) continue
|
|
77
151
|
|
|
78
152
|
// Walk the transcript's path: transcribe.json → [render.transcript → its transcript output]* → add-captions.transcript,
|