@nodaro/shared 3.62.0 → 3.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/{chunk-6CSXMWL4.cjs → chunk-2PU3AGGS.cjs} +27 -4
  2. package/dist/chunk-2PU3AGGS.cjs.map +1 -0
  3. package/dist/{chunk-CC4V2B7S.js → chunk-34QLPTSA.js} +3 -3
  4. package/dist/{chunk-CC4V2B7S.js.map → chunk-34QLPTSA.js.map} +1 -1
  5. package/dist/{chunk-G4U3HW6W.js → chunk-3K24DWOH.js} +3 -3
  6. package/dist/{chunk-G4U3HW6W.js.map → chunk-3K24DWOH.js.map} +1 -1
  7. package/dist/{chunk-GSFB537T.js → chunk-4DVWXEB6.js} +23 -4
  8. package/dist/chunk-4DVWXEB6.js.map +1 -0
  9. package/dist/{chunk-ZES6EZC4.js → chunk-4MMZD63H.js} +3 -3
  10. package/dist/{chunk-ZES6EZC4.js.map → chunk-4MMZD63H.js.map} +1 -1
  11. package/dist/{chunk-N7OUQK7E.cjs → chunk-63H4C56Q.cjs} +8 -8
  12. package/dist/{chunk-N7OUQK7E.cjs.map → chunk-63H4C56Q.cjs.map} +1 -1
  13. package/dist/{chunk-2D5LQFV4.cjs → chunk-6BZC2ZHC.cjs} +9 -9
  14. package/dist/{chunk-2D5LQFV4.cjs.map → chunk-6BZC2ZHC.cjs.map} +1 -1
  15. package/dist/{chunk-3OYO3XCC.js → chunk-6M563QE6.js} +71 -9
  16. package/dist/chunk-6M563QE6.js.map +1 -0
  17. package/dist/{chunk-IDTKF5EX.cjs → chunk-6TGB7ECA.cjs} +7 -7
  18. package/dist/{chunk-IDTKF5EX.cjs.map → chunk-6TGB7ECA.cjs.map} +1 -1
  19. package/dist/{chunk-2HZGDZZN.cjs → chunk-6XUG4L7X.cjs} +6 -6
  20. package/dist/{chunk-2HZGDZZN.cjs.map → chunk-6XUG4L7X.cjs.map} +1 -1
  21. package/dist/{chunk-CIPPPT7E.cjs → chunk-77WU3V3J.cjs} +6 -6
  22. package/dist/{chunk-CIPPPT7E.cjs.map → chunk-77WU3V3J.cjs.map} +1 -1
  23. package/dist/{chunk-C7POAYFE.js → chunk-AE3AAJ4O.js} +3 -3
  24. package/dist/{chunk-C7POAYFE.js.map → chunk-AE3AAJ4O.js.map} +1 -1
  25. package/dist/{chunk-NGKKNSK6.js → chunk-BMJVKYVB.js} +36 -15
  26. package/dist/chunk-BMJVKYVB.js.map +1 -0
  27. package/dist/{chunk-YCXRSWCQ.js → chunk-CZ5IQB3L.js} +3 -3
  28. package/dist/{chunk-YCXRSWCQ.js.map → chunk-CZ5IQB3L.js.map} +1 -1
  29. package/dist/{chunk-E2HZTGYX.js → chunk-EPXGG27L.js} +7 -7
  30. package/dist/chunk-EPXGG27L.js.map +1 -0
  31. package/dist/{chunk-3M4BNKFJ.cjs → chunk-F6WGGYQW.cjs} +167 -3
  32. package/dist/chunk-F6WGGYQW.cjs.map +1 -0
  33. package/dist/{chunk-7FCTCWHD.js → chunk-FXGNRYQQ.js} +3 -3
  34. package/dist/{chunk-7FCTCWHD.js.map → chunk-FXGNRYQQ.js.map} +1 -1
  35. package/dist/{chunk-QWYFHQYK.cjs → chunk-GMBDLNLD.cjs} +86 -62
  36. package/dist/chunk-GMBDLNLD.cjs.map +1 -0
  37. package/dist/{chunk-KJSRPHJ2.cjs → chunk-GSKLPI3J.cjs} +100 -46
  38. package/dist/chunk-GSKLPI3J.cjs.map +1 -0
  39. package/dist/{chunk-S5TMRJMX.js → chunk-HBXF6RUU.js} +4 -4
  40. package/dist/{chunk-S5TMRJMX.js.map → chunk-HBXF6RUU.js.map} +1 -1
  41. package/dist/{chunk-S24ZBUB4.js → chunk-HWQ2SYNA.js} +6 -32
  42. package/dist/chunk-HWQ2SYNA.js.map +1 -0
  43. package/dist/{chunk-JJNNM23P.js → chunk-IY3Y462W.js} +3 -3
  44. package/dist/{chunk-JJNNM23P.js.map → chunk-IY3Y462W.js.map} +1 -1
  45. package/dist/{chunk-JZGZ26YB.js → chunk-KCZHQH2O.js} +4 -4
  46. package/dist/{chunk-JZGZ26YB.js.map → chunk-KCZHQH2O.js.map} +1 -1
  47. package/dist/{chunk-FVII3KHN.js → chunk-KMGCHV6O.js} +163 -4
  48. package/dist/chunk-KMGCHV6O.js.map +1 -0
  49. package/dist/{chunk-4ZEFP2FQ.cjs → chunk-L2TVY6XN.cjs} +4 -4
  50. package/dist/{chunk-4ZEFP2FQ.cjs.map → chunk-L2TVY6XN.cjs.map} +1 -1
  51. package/dist/{chunk-TRVWMKNE.cjs → chunk-LH72PQO2.cjs} +204 -52
  52. package/dist/chunk-LH72PQO2.cjs.map +1 -0
  53. package/dist/{chunk-HRY7KGAE.cjs → chunk-LMAQUR55.cjs} +6 -6
  54. package/dist/{chunk-HRY7KGAE.cjs.map → chunk-LMAQUR55.cjs.map} +1 -1
  55. package/dist/{chunk-MYJQELFN.cjs → chunk-M5OCFGHF.cjs} +254 -7
  56. package/dist/chunk-M5OCFGHF.cjs.map +1 -0
  57. package/dist/{chunk-I2RQB7VG.js → chunk-MD4XHED4.js} +3 -3
  58. package/dist/{chunk-I2RQB7VG.js.map → chunk-MD4XHED4.js.map} +1 -1
  59. package/dist/{chunk-6G7NN4S4.js → chunk-NIAFR5EE.js} +2 -2
  60. package/dist/chunk-NIAFR5EE.js.map +1 -0
  61. package/dist/{chunk-CF4S4N5X.js → chunk-O2QOBA6Q.js} +2 -2
  62. package/dist/{chunk-CF4S4N5X.js.map → chunk-O2QOBA6Q.js.map} +1 -1
  63. package/dist/{chunk-4GGLKRYI.cjs → chunk-O6TBB4IF.cjs} +2 -2
  64. package/dist/{chunk-4GGLKRYI.cjs.map → chunk-O6TBB4IF.cjs.map} +1 -1
  65. package/dist/{chunk-UDDVDQMF.js → chunk-OV3JTKBY.js} +166 -25
  66. package/dist/chunk-OV3JTKBY.js.map +1 -0
  67. package/dist/{chunk-5YYN5X57.js → chunk-PSKZKLDG.js} +252 -8
  68. package/dist/chunk-PSKZKLDG.js.map +1 -0
  69. package/dist/{chunk-IWWVPR3W.cjs → chunk-TM5JYSJF.cjs} +95 -19
  70. package/dist/chunk-TM5JYSJF.cjs.map +1 -0
  71. package/dist/{chunk-G3KVK7OU.cjs → chunk-V5EEQR2U.cjs} +21 -21
  72. package/dist/{chunk-G3KVK7OU.cjs.map → chunk-V5EEQR2U.cjs.map} +1 -1
  73. package/dist/{chunk-AOJ6B7K4.cjs → chunk-WZVIBAKN.cjs} +12 -12
  74. package/dist/chunk-WZVIBAKN.cjs.map +1 -0
  75. package/dist/{chunk-5M43XMRB.cjs → chunk-X5BAFW3Q.cjs} +8 -8
  76. package/dist/{chunk-5M43XMRB.cjs.map → chunk-X5BAFW3Q.cjs.map} +1 -1
  77. package/dist/{chunk-SYWR5G3T.js → chunk-XBTYGQ6Z.js} +51 -7
  78. package/dist/chunk-XBTYGQ6Z.js.map +1 -0
  79. package/dist/{chunk-AFYTX4AI.cjs → chunk-XGGZWA4A.cjs} +107 -50
  80. package/dist/chunk-XGGZWA4A.cjs.map +1 -0
  81. package/dist/{chunk-VACPZPUA.cjs → chunk-XGVJGNZW.cjs} +5 -5
  82. package/dist/{chunk-VACPZPUA.cjs.map → chunk-XGVJGNZW.cjs.map} +1 -1
  83. package/dist/{chunk-2W745U4A.cjs → chunk-Y35JQPT6.cjs} +42 -70
  84. package/dist/chunk-Y35JQPT6.cjs.map +1 -0
  85. package/dist/{chunk-KYMHFVAZ.cjs → chunk-Y4GCJJPF.cjs} +2 -2
  86. package/dist/chunk-Y4GCJJPF.cjs.map +1 -0
  87. package/dist/{chunk-PTD6EDUU.js → chunk-YUER7TJG.js} +3 -3
  88. package/dist/{chunk-PTD6EDUU.js.map → chunk-YUER7TJG.js.map} +1 -1
  89. package/dist/{chunk-Y6X7UJSD.js → chunk-YX6TFX7H.js} +66 -14
  90. package/dist/chunk-YX6TFX7H.js.map +1 -0
  91. package/dist/{chunk-TWF2OSH4.cjs → chunk-ZPE2ZTJ4.cjs} +4 -4
  92. package/dist/{chunk-TWF2OSH4.cjs.map → chunk-ZPE2ZTJ4.cjs.map} +1 -1
  93. package/dist/entries/apps.cjs +42 -42
  94. package/dist/entries/apps.js +7 -7
  95. package/dist/entries/credits.cjs +237 -169
  96. package/dist/entries/credits.d.cts +163 -16
  97. package/dist/entries/credits.d.ts +163 -16
  98. package/dist/entries/credits.js +10 -10
  99. package/dist/entries/llm-models.cjs +77 -57
  100. package/dist/entries/llm-models.d.cts +85 -6
  101. package/dist/entries/llm-models.d.ts +85 -6
  102. package/dist/entries/llm-models.js +2 -2
  103. package/dist/entries/media.cjs +63 -63
  104. package/dist/entries/media.d.cts +8 -0
  105. package/dist/entries/media.d.ts +8 -0
  106. package/dist/entries/media.js +1 -1
  107. package/dist/entries/model-catalog.cjs +121 -105
  108. package/dist/entries/model-catalog.d.cts +48 -18
  109. package/dist/entries/model-catalog.d.ts +48 -18
  110. package/dist/entries/model-catalog.js +4 -4
  111. package/dist/entries/models.cjs +418 -322
  112. package/dist/entries/models.d.cts +71 -5
  113. package/dist/entries/models.d.ts +71 -5
  114. package/dist/entries/models.js +5 -5
  115. package/dist/entries/nodes.cjs +216 -208
  116. package/dist/entries/nodes.d.cts +22 -6
  117. package/dist/entries/nodes.d.ts +22 -6
  118. package/dist/entries/nodes.js +8 -8
  119. package/dist/entries/pipeline.cjs +152 -152
  120. package/dist/entries/pipeline.d.cts +3 -3
  121. package/dist/entries/pipeline.d.ts +3 -3
  122. package/dist/entries/pipeline.js +3 -3
  123. package/dist/entries/runtime-config.cjs +29 -29
  124. package/dist/entries/runtime-config.d.cts +10 -7
  125. package/dist/entries/runtime-config.d.ts +10 -7
  126. package/dist/entries/runtime-config.js +1 -1
  127. package/dist/entries/social.cjs +177 -177
  128. package/dist/entries/social.js +2 -2
  129. package/dist/entries/types.d.cts +8 -0
  130. package/dist/entries/types.d.ts +8 -0
  131. package/dist/entries/ugc.cjs +71 -71
  132. package/dist/entries/ugc.js +4 -4
  133. package/dist/entries/video.cjs +154 -150
  134. package/dist/entries/video.d.cts +11 -2
  135. package/dist/entries/video.d.ts +11 -2
  136. package/dist/entries/video.js +6 -6
  137. package/dist/entries/workflow.d.cts +1 -1
  138. package/dist/entries/workflow.d.ts +1 -1
  139. package/dist/index.cjs +1727 -1515
  140. package/dist/index.d.cts +8 -8
  141. package/dist/index.d.ts +8 -8
  142. package/dist/index.js +23 -23
  143. package/dist/{model-catalog-CCEcv08q.d.cts → model-catalog-C_Eo35tL.d.cts} +30 -0
  144. package/dist/{model-catalog-CCEcv08q.d.ts → model-catalog-C_Eo35tL.d.ts} +30 -0
  145. package/dist/{model-constants-Cf3zaITt.d.cts → model-constants-Bg4ccSQb.d.ts} +138 -25
  146. package/dist/{model-constants-B88p6XR0.d.ts → model-constants-DWcxOmaY.d.cts} +138 -25
  147. package/package.json +1 -1
  148. package/src/__tests__/credit-identifiers.test.ts +29 -0
  149. package/src/__tests__/extend-providers.test.ts +106 -26
  150. package/src/__tests__/gvp-supported-providers.test.ts +27 -2
  151. package/src/__tests__/lip-sync-audio-rate.test.ts +74 -0
  152. package/src/__tests__/lip-sync-levers.test.ts +31 -0
  153. package/src/__tests__/llm-models.test.ts +132 -3
  154. package/src/__tests__/llm-price-key.test.ts +152 -1
  155. package/src/__tests__/nemotron-transcribe-pricing.test.ts +61 -0
  156. package/src/__tests__/normalize-node-params.test.ts +25 -0
  157. package/src/__tests__/pixverse-v6-max-catalog.test.ts +271 -0
  158. package/src/__tests__/prompt-length-limits.test.ts +4 -0
  159. package/src/__tests__/seedance-task-type.test.ts +13 -3
  160. package/src/__tests__/transcribe-capabilities.test.ts +39 -2
  161. package/src/__tests__/transcribe-preflight.test.ts +50 -1
  162. package/src/__tests__/video-audio-capability.test.ts +35 -6
  163. package/src/__tests__/video-resolution-billed-as-named.test.ts +30 -0
  164. package/src/__tests__/video-upscale-params.test.ts +62 -0
  165. package/src/catalog-projection.ts +8 -0
  166. package/src/credit-estimators/index.ts +10 -0
  167. package/src/credit-estimators/nemotron-transcribe.ts +87 -0
  168. package/src/credit-identifiers.ts +109 -35
  169. package/src/entries/credits.ts +12 -1
  170. package/src/entries/llm-models.ts +6 -0
  171. package/src/entries/model-catalog.ts +9 -0
  172. package/src/entries/models.ts +35 -0
  173. package/src/entries/nodes.ts +2 -0
  174. package/src/entries/video.ts +1 -1
  175. package/src/freecut-protocol.ts +8 -0
  176. package/src/lip-sync-levers.ts +56 -0
  177. package/src/lip-sync-pricing.ts +91 -1
  178. package/src/llm-models.ts +249 -4
  179. package/src/model-catalog.ts +250 -4
  180. package/src/model-constants.ts +277 -30
  181. package/src/model-tree.ts +2 -1
  182. package/src/nodaro-video-upscale.ts +48 -0
  183. package/src/node-default-mappings.ts +3 -0
  184. package/src/normalize-node-params.ts +49 -1
  185. package/src/runtime-config/contract.ts +10 -7
  186. package/src/seedance-draft.ts +2 -1
  187. package/src/transcribe-preflight.ts +58 -7
  188. package/src/video-duration.ts +9 -0
  189. package/src/video-ui-defaults.ts +5 -3
  190. package/src/video-upscale-params.ts +67 -0
  191. package/dist/chunk-2W745U4A.cjs.map +0 -1
  192. package/dist/chunk-3M4BNKFJ.cjs.map +0 -1
  193. package/dist/chunk-3OYO3XCC.js.map +0 -1
  194. package/dist/chunk-5YYN5X57.js.map +0 -1
  195. package/dist/chunk-6CSXMWL4.cjs.map +0 -1
  196. package/dist/chunk-6G7NN4S4.js.map +0 -1
  197. package/dist/chunk-AFYTX4AI.cjs.map +0 -1
  198. package/dist/chunk-AOJ6B7K4.cjs.map +0 -1
  199. package/dist/chunk-E2HZTGYX.js.map +0 -1
  200. package/dist/chunk-FVII3KHN.js.map +0 -1
  201. package/dist/chunk-GSFB537T.js.map +0 -1
  202. package/dist/chunk-IWWVPR3W.cjs.map +0 -1
  203. package/dist/chunk-KJSRPHJ2.cjs.map +0 -1
  204. package/dist/chunk-KYMHFVAZ.cjs.map +0 -1
  205. package/dist/chunk-MYJQELFN.cjs.map +0 -1
  206. package/dist/chunk-NGKKNSK6.js.map +0 -1
  207. package/dist/chunk-QWYFHQYK.cjs.map +0 -1
  208. package/dist/chunk-S24ZBUB4.js.map +0 -1
  209. package/dist/chunk-SYWR5G3T.js.map +0 -1
  210. package/dist/chunk-TRVWMKNE.cjs.map +0 -1
  211. package/dist/chunk-UDDVDQMF.js.map +0 -1
  212. package/dist/chunk-Y6X7UJSD.js.map +0 -1
@@ -21,7 +21,8 @@
21
21
  */
22
22
 
23
23
  import { autoAspectNeedsSourceImage, normalizeModelInput, type ModelInputAdjustment } from "./model-catalog.js"
24
- import { imageGenAutoAspectNeedsSourceImage } from "./credit-identifiers.js"
24
+ import { imageGenAutoAspectNeedsSourceImage, motionTransferResolution } from "./credit-identifiers.js"
25
+ import { normalizeVideoUpscaleResolution, VIDEO_UPSCALE_RESOLUTIONS, videoUpscaleResolutionsFor } from "./video-upscale-params.js"
25
26
 
26
27
  /**
27
28
  * Node types whose `data` carries catalog-governed model parameters under the
@@ -140,6 +141,8 @@ export function normalizeNodeModelParams<T extends NodeLike>(
140
141
  const adjustments: NodeParamAdjustment[] = []
141
142
  const out = nodes.map((node) => {
142
143
  const type = typeof node.type === "string" ? node.type : ""
144
+ if (type === "video-upscale") return normalizeVideoUpscaleNode(node, adjustments)
145
+ if (type === "motion-transfer") return normalizeMotionTransferNode(node, adjustments)
143
146
  if (!MODEL_PARAM_NODE_TYPES.has(type)) return node
144
147
 
145
148
  const data = node.data
@@ -199,6 +202,51 @@ export function normalizeNodeModelParams<T extends NodeLike>(
199
202
  return { nodes: out, adjustments }
200
203
  }
201
204
 
205
+ /**
206
+ * A Video Upscale node: its `targetResolution` held to what its provider takes,
207
+ * only for a provider whose catalog entry declares its resolutions
208
+ * (`normalizeVideoUpscaleResolution`; today Nodaro Video Upscale's 1080p / 2K /
209
+ * 4K). Every other provider's node — Topaz's, VEO's, Seedance HD's — is
210
+ * returned as it came: its run reads the field by its own rules. Only that one
211
+ * key is rewritten, and only when it holds a value some Video Upscale provider
212
+ * takes (`VIDEO_UPSCALE_RESOLUTIONS`, spelled any way); an unset value and any
213
+ * other value are left alone.
214
+ */
215
+ function normalizeVideoUpscaleNode<T extends NodeLike>(node: T, adjustments: NodeParamAdjustment[]): T {
216
+ const data = node.data
217
+ if (!data || typeof data !== "object" || Array.isArray(data)) return node
218
+ const d = data as Record<string, unknown>
219
+ if (typeof d.targetResolution !== "string" || d.targetResolution === "") return node
220
+ const provider = typeof d.provider === "string" && d.provider !== "" ? d.provider : "topaz"
221
+ if (videoUpscaleResolutionsFor(provider).length === 0) return node
222
+ const asked = d.targetResolution.trim().toLowerCase()
223
+ if (!(VIDEO_UPSCALE_RESOLUTIONS as readonly string[]).includes(asked)) return node
224
+ const normalized = normalizeVideoUpscaleResolution(provider, d.targetResolution)
225
+ if (normalized.targetResolution === d.targetResolution) return node
226
+ const nodeId = typeof node.id === "string" ? node.id : "(unknown node)"
227
+ if (normalized.adjustment) adjustments.push({ ...normalized.adjustment, nodeId, provider })
228
+ return { ...node, data: { ...d, targetResolution: normalized.targetResolution } }
229
+ }
230
+
231
+ /**
232
+ * A Motion Transfer node: its `resolution` held to the size its model runs at
233
+ * (`motionTransferResolution`: a Wan Animate node at 1080p runs as 720p), the
234
+ * same rule its run is sent and charged by. Only that key is rewritten, and
235
+ * only when the rule moves it; an unset size is left for the run's default.
236
+ */
237
+ function normalizeMotionTransferNode<T extends NodeLike>(node: T, adjustments: NodeParamAdjustment[]): T {
238
+ const data = node.data
239
+ if (!data || typeof data !== "object" || Array.isArray(data)) return node
240
+ const d = data as Record<string, unknown>
241
+ if (typeof d.resolution !== "string" || d.resolution === "") return node
242
+ const provider = typeof d.provider === "string" && d.provider !== "" ? d.provider : "kling"
243
+ const sized = motionTransferResolution(provider, d.resolution)
244
+ if (sized.resolution === d.resolution) return node
245
+ const nodeId = typeof node.id === "string" ? node.id : "(unknown node)"
246
+ for (const adj of sized.adjustments) adjustments.push({ ...adj, nodeId, provider })
247
+ return { ...node, data: { ...d, resolution: sized.resolution } }
248
+ }
249
+
202
250
  /** One-line-per-change summary, for surfacing back to an agent or a log. */
203
251
  export function describeNodeAdjustments(adjustments: readonly NodeParamAdjustment[]): string[] {
204
252
  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 own pages live on, when this deployment moved
146
- * them to a host of their own. A page on it calls the API same-origin.
147
- * Absent: the deployment has one host.
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 developer-facing links name (published apps, embeds, API
154
- * examples) when the app's pages live elsewhere. Absent: the page's own
155
- * origin, as ever.
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
  }
@@ -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 - 0.25))
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
 
@@ -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
- /** The refusal for a lane that can't return word timings; `null` when it can.
20
- * An absent provider resolves to the transcribe NODE default. */
21
- export function transcribeWordTimestampsRefusal(provider: string | null | undefined): string | null {
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 {
35
+ const lane = provider || DEFAULT_TRANSCRIBE_NODE_PROVIDER
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
22
62
  const lane = provider || DEFAULT_TRANSCRIBE_NODE_PROVIDER
23
- if (transcribeLaneSupportsWordTimestamps(lane)) return null
24
- return `the "${lane}" engine does not return word timings — pick ${transcribeProvidersWithWordTimestamps().join(" or ")}`
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 {
@@ -49,7 +97,8 @@ const TRANSCRIBE_JSON_OUT = "json"
49
97
  const TRANSCRIPT_IN = "transcript"
50
98
 
51
99
  /**
52
- * Every transcribe node on a word-INCAPABLE lane whose `json` output reaches an
100
+ * Every transcribe node on a word-INCAPABLE lane (or one set to translate, whose
101
+ * transcript is a translation with no word timings) whose `json` output reaches an
53
102
  * add-captions `transcript` input — directly, or through apply-edl, which remaps
54
103
  * the transcript and re-emits it on its own `json` handle (or any render, by
55
104
  * its registry `transcriptOutput`: Speaker View's `transcript`). add-captions rejects a
@@ -72,7 +121,9 @@ export function findWordlessTranscriptFeeds(
72
121
  for (const node of nodes) {
73
122
  if (node.type !== "transcribe" || isSkipped(node)) continue
74
123
  const provider = (typeof node.data?.provider === "string" && node.data.provider) || DEFAULT_TRANSCRIBE_NODE_PROVIDER
75
- const refusal = transcribeWordTimestampsRefusal(provider)
124
+ // A translating node is as wordless as an incapable lane: its transcript is
125
+ // the translation, with no word timings.
126
+ const refusal = transcribeWordTimestampsRefusal(provider, node.data?.targetLanguage)
76
127
  if (!refusal) continue
77
128
 
78
129
  // Walk the transcript's path: transcribe.json → [render.transcript → its transcript output]* → add-captions.transcript,
@@ -1,3 +1,12 @@
1
+ /**
2
+ * How far past a whole second a delivered clip's container may read without
3
+ * counting as longer: a quarter second (8.04 s for an 8 s clip). Read by the
4
+ * rules that turn a delivered clip's measured length into the length it is
5
+ * charged as, or compare one with a length held for it. (Clip-priced steps
6
+ * that measure their own input use a smaller grace of their own.)
7
+ */
8
+ export const CONTAINER_OVERHANG_SEC = 0.25
9
+
1
10
  /** Read a video node's duration (in seconds) from its data shape.
2
11
  * Tries `generatedResults[activeResultIndex].duration` (post-execution
3
12
  * metadata) first, then `data.duration` (configured at design time on
@@ -37,6 +37,7 @@ import {
37
37
  isKling4RunnerProvider,
38
38
  isGeminiOmniProvider,
39
39
  isGeminiOmniPerSecondProvider,
40
+ isPixverseV6MaxProvider,
40
41
  } from "./model-constants.js"
41
42
  import { MODEL_CATALOG } from "./model-catalog.js"
42
43
 
@@ -54,7 +55,7 @@ export function uiAspectRatioFill(provider: string): string | undefined {
54
55
  /** See the file docstring — per-family on purpose; never a generic
55
56
  * PRICING_DEFAULT_RESOLUTION read (that would reprice seedance-2-5). */
56
57
  export function uiResolutionFill(provider: string): string | undefined {
57
- if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider) || isGeminiOmniPerSecondProvider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]
58
+ if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider) || isGeminiOmniPerSecondProvider(provider) || isPixverseV6MaxProvider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]
58
59
  if (isSeedance2Provider(provider)) return MODEL_CATALOG[provider]?.resolutions?.[0]
59
60
  return undefined
60
61
  }
@@ -63,12 +64,13 @@ export function uiResolutionFill(provider: string): string | undefined {
63
64
  * Duration the node RENDERS and BILLS when `data.duration` is unset, for the
64
65
  * families whose credit identifier declares a duration fallback that is NOT
65
66
  * `durations[0]`. Wan 3.0's bare identifier is the 5s tier while its ladder
66
- * starts at 2s; Vidu Q4's is the 5s tier while its ladder starts at 3s; the
67
+ * starts at 2s; Vidu Q4's is the 5s tier while its ladder starts at 3s;
68
+ * PixVerse V6 Max's is the 5s tier while its ladder starts at 1s; the
67
69
  * 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
68
70
  * undefined and the caller keeps `durations[0]`.
69
71
  */
70
72
  export function uiDurationFill(provider: string): number | undefined {
71
- if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider)) return 5
73
+ if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider) || isPixverseV6MaxProvider(provider)) return 5
72
74
  if (isGeminiOmniProvider(provider)) return 8
73
75
  return undefined
74
76
  }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The Video Upscale node's target resolution, per provider, from the catalog.
3
+ *
4
+ * The node stores one `targetResolution` for every provider, and the providers
5
+ * take different sets: Topaz 720p / 1080p / 4K (a short side, its own list in
6
+ * `topaz-video.ts`), Nodaro Video Upscale 1080p / 2K / 4K (an output box), the
7
+ * VEO and Seedance HD upscales none. For a provider whose catalog entry
8
+ * declares its resolutions (`resolutions`, `defaultResolution`; today Nodaro
9
+ * Video Upscale), this is the one coercion every lane applies — a node written
10
+ * straight into workflow JSON, a request to the API and an MCP call never pass
11
+ * through the editor's menus: a value it does not take becomes its default. A
12
+ * provider whose entry declares none (Topaz included) is left alone: its run
13
+ * reads the field by its own rules.
14
+ */
15
+ import { MODEL_CATALOG, normalizeModelInput, type ModelInputAdjustment } from "./model-catalog.js"
16
+
17
+ /**
18
+ * Every target resolution some Video Upscale provider takes — Nodaro Video
19
+ * Upscale's route schema and the MCP verb's enum. Which ones a provider takes:
20
+ * its catalog entry's `resolutions` where it declares them
21
+ * ({@link normalizeVideoUpscaleResolution}), else its own list (Topaz's).
22
+ */
23
+ export const VIDEO_UPSCALE_RESOLUTIONS = ["720p", "1080p", "2k", "4k"] as const
24
+ export type VideoUpscaleResolution = (typeof VIDEO_UPSCALE_RESOLUTIONS)[number]
25
+
26
+ /** The provider a Video Upscale node runs when it names none. */
27
+ const DEFAULT_VIDEO_UPSCALE_PROVIDER = "topaz"
28
+
29
+ /**
30
+ * Video Upscale's `provider` value as the catalog model it runs: its "topaz"
31
+ * is the catalog's `topaz-video`; every other value is its own id.
32
+ */
33
+ export function videoUpscaleModelOf(provider: string): string {
34
+ return provider === "topaz" ? "topaz-video" : provider
35
+ }
36
+
37
+ /** The resolutions a Video Upscale provider's catalog entry declares, in its order; empty when it declares none (Topaz keeps its own list). */
38
+ export function videoUpscaleResolutionsFor(provider: string | undefined): readonly string[] {
39
+ const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER)
40
+ return MODEL_CATALOG[id]?.resolutions ?? []
41
+ }
42
+
43
+ export interface NormalizedVideoUpscaleResolution {
44
+ /** The value to store and send: the one asked for, its canonical spelling, or the provider's default. */
45
+ readonly targetResolution: string | undefined
46
+ /** What changed, when anything did. */
47
+ readonly adjustment?: ModelInputAdjustment
48
+ }
49
+
50
+ /**
51
+ * `targetResolution` coerced to one `provider` takes. Unset stays unset (each
52
+ * run applies its own default). A value the provider does not list becomes the
53
+ * provider's `defaultResolution`, a spelling variant ("2K") its canonical form.
54
+ * A provider with no resolution setting gets the value back unchanged; a value
55
+ * that is not a string, or an empty one, reads as unset.
56
+ */
57
+ export function normalizeVideoUpscaleResolution(
58
+ provider: string | undefined,
59
+ targetResolution: unknown,
60
+ ): NormalizedVideoUpscaleResolution {
61
+ if (typeof targetResolution !== "string" || targetResolution === "") return { targetResolution: undefined }
62
+ const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER)
63
+ if ((MODEL_CATALOG[id]?.resolutions ?? []).length === 0) return { targetResolution }
64
+ const normalized = normalizeModelInput(id, { resolution: targetResolution })
65
+ const adjustment = normalized.adjustments.find((a) => a.field === "resolution")
66
+ return adjustment ? { targetResolution: normalized.resolution, adjustment } : { targetResolution: normalized.resolution }
67
+ }