@nodaro/shared 3.41.0 → 3.44.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 (143) hide show
  1. package/dist/{chunk-FVZMFDRO.js → chunk-2JJTZCZ5.js} +4 -4
  2. package/dist/{chunk-FVZMFDRO.js.map → chunk-2JJTZCZ5.js.map} +1 -1
  3. package/dist/{chunk-BWQRAQUD.cjs → chunk-4EEPHWWF.cjs} +43 -43
  4. package/dist/{chunk-BWQRAQUD.cjs.map → chunk-4EEPHWWF.cjs.map} +1 -1
  5. package/dist/{chunk-GXTWKAJF.js → chunk-5RBJBUIR.js} +3 -3
  6. package/dist/{chunk-GXTWKAJF.js.map → chunk-5RBJBUIR.js.map} +1 -1
  7. package/dist/{chunk-4IWVZR44.cjs → chunk-6BVYKKSF.cjs} +5 -5
  8. package/dist/{chunk-4IWVZR44.cjs.map → chunk-6BVYKKSF.cjs.map} +1 -1
  9. package/dist/{chunk-ZXIP5T5V.js → chunk-6KAEQ3GU.js} +3 -3
  10. package/dist/{chunk-ZXIP5T5V.js.map → chunk-6KAEQ3GU.js.map} +1 -1
  11. package/dist/{chunk-ZAOBNW6Y.cjs → chunk-6SFJOTRF.cjs} +12 -20
  12. package/dist/chunk-6SFJOTRF.cjs.map +1 -0
  13. package/dist/{chunk-IKCFSNNH.cjs → chunk-ASB4U75K.cjs} +21 -21
  14. package/dist/{chunk-IKCFSNNH.cjs.map → chunk-ASB4U75K.cjs.map} +1 -1
  15. package/dist/{chunk-X7IRSO4L.js → chunk-B4FQY5P7.js} +3 -3
  16. package/dist/{chunk-X7IRSO4L.js.map → chunk-B4FQY5P7.js.map} +1 -1
  17. package/dist/{chunk-ADYPAGQF.cjs → chunk-BHL6P3O5.cjs} +9 -26
  18. package/dist/chunk-BHL6P3O5.cjs.map +1 -0
  19. package/dist/{chunk-5CKTBGB6.js → chunk-GBKDNDEM.js} +9 -26
  20. package/dist/chunk-GBKDNDEM.js.map +1 -0
  21. package/dist/{chunk-BOUEGYGI.cjs → chunk-II2LEEDH.cjs} +33 -37
  22. package/dist/chunk-II2LEEDH.cjs.map +1 -0
  23. package/dist/{chunk-LOTL72UI.js → chunk-KLKWAVQO.js} +4 -5
  24. package/dist/chunk-KLKWAVQO.js.map +1 -0
  25. package/dist/{chunk-LOWOJN65.js → chunk-KZGGUDAB.js} +45 -7
  26. package/dist/chunk-KZGGUDAB.js.map +1 -0
  27. package/dist/{chunk-A4NDZBSJ.js → chunk-MVJX7N6H.js} +14 -20
  28. package/dist/chunk-MVJX7N6H.js.map +1 -0
  29. package/dist/{chunk-2BJADMEX.js → chunk-O5XJDHAL.js} +3 -3
  30. package/dist/{chunk-2BJADMEX.js.map → chunk-O5XJDHAL.js.map} +1 -1
  31. package/dist/{chunk-YEET2QGF.cjs → chunk-OVLY5XO4.cjs} +4 -4
  32. package/dist/{chunk-YEET2QGF.cjs.map → chunk-OVLY5XO4.cjs.map} +1 -1
  33. package/dist/{chunk-GNY2S63W.js → chunk-PEVJKGGC.js} +4 -4
  34. package/dist/{chunk-GNY2S63W.js.map → chunk-PEVJKGGC.js.map} +1 -1
  35. package/dist/{chunk-YEZ2YUKK.js → chunk-QG6UYOLZ.js} +3 -3
  36. package/dist/{chunk-YEZ2YUKK.js.map → chunk-QG6UYOLZ.js.map} +1 -1
  37. package/dist/{chunk-TGZJXCLL.cjs → chunk-QHODM5TS.cjs} +46 -6
  38. package/dist/chunk-QHODM5TS.cjs.map +1 -0
  39. package/dist/{chunk-YX5FW7ON.js → chunk-R6MULOGA.js} +4 -12
  40. package/dist/chunk-R6MULOGA.js.map +1 -0
  41. package/dist/{chunk-RLVZ3RLE.cjs → chunk-RPS35CNO.cjs} +8 -8
  42. package/dist/{chunk-RLVZ3RLE.cjs.map → chunk-RPS35CNO.cjs.map} +1 -1
  43. package/dist/{chunk-MLB6YNLS.js → chunk-RQKSILMF.js} +4 -4
  44. package/dist/{chunk-MLB6YNLS.js.map → chunk-RQKSILMF.js.map} +1 -1
  45. package/dist/{chunk-VNC5DNIQ.cjs → chunk-RYDJ5BLT.cjs} +11 -13
  46. package/dist/chunk-RYDJ5BLT.cjs.map +1 -0
  47. package/dist/{chunk-VSDJCJKP.cjs → chunk-S32Z2JMC.cjs} +46 -45
  48. package/dist/chunk-S32Z2JMC.cjs.map +1 -0
  49. package/dist/{chunk-TUUEQ2WR.cjs → chunk-SHWZPCZU.cjs} +8 -8
  50. package/dist/{chunk-TUUEQ2WR.cjs.map → chunk-SHWZPCZU.cjs.map} +1 -1
  51. package/dist/{chunk-PYDZ7ZGH.js → chunk-U2CCL5YF.js} +3 -3
  52. package/dist/{chunk-PYDZ7ZGH.js.map → chunk-U2CCL5YF.js.map} +1 -1
  53. package/dist/{chunk-4LKEOIOT.cjs → chunk-UYGTZJGT.cjs} +6 -6
  54. package/dist/{chunk-4LKEOIOT.cjs.map → chunk-UYGTZJGT.cjs.map} +1 -1
  55. package/dist/{chunk-CWQC6IGE.js → chunk-V5TSXS5A.js} +100 -6
  56. package/dist/chunk-V5TSXS5A.js.map +1 -0
  57. package/dist/{chunk-E4MLBJKG.js → chunk-VNAMNWRX.js} +8 -8
  58. package/dist/{chunk-E4MLBJKG.js.map → chunk-VNAMNWRX.js.map} +1 -1
  59. package/dist/{chunk-5J5L26IZ.js → chunk-WE5ZENCO.js} +5 -7
  60. package/dist/chunk-WE5ZENCO.js.map +1 -0
  61. package/dist/{chunk-N2KG5AMQ.cjs → chunk-WXMLMN5Y.cjs} +4 -4
  62. package/dist/{chunk-N2KG5AMQ.cjs.map → chunk-WXMLMN5Y.cjs.map} +1 -1
  63. package/dist/{chunk-SYUY7GNT.js → chunk-XANN72AJ.js} +7 -6
  64. package/dist/chunk-XANN72AJ.js.map +1 -0
  65. package/dist/{chunk-JN3V33AN.cjs → chunk-XKLFXNE7.cjs} +6 -6
  66. package/dist/{chunk-JN3V33AN.cjs.map → chunk-XKLFXNE7.cjs.map} +1 -1
  67. package/dist/{chunk-DC5EYYVX.cjs → chunk-XUBZO6QA.cjs} +154 -39
  68. package/dist/chunk-XUBZO6QA.cjs.map +1 -0
  69. package/dist/chunk-Y4JG3ZAA.cjs +27 -0
  70. package/dist/{chunk-XOZIHGR5.cjs.map → chunk-Y4JG3ZAA.cjs.map} +1 -1
  71. package/dist/{chunk-DJIRIBKX.cjs → chunk-Z5W7W24Z.cjs} +5 -6
  72. package/dist/chunk-Z5W7W24Z.cjs.map +1 -0
  73. package/dist/entries/apps.cjs +42 -42
  74. package/dist/entries/apps.js +7 -7
  75. package/dist/entries/credits.cjs +150 -150
  76. package/dist/entries/credits.d.cts +1 -1
  77. package/dist/entries/credits.d.ts +1 -1
  78. package/dist/entries/credits.js +7 -7
  79. package/dist/entries/llm-models.d.cts +1 -1
  80. package/dist/entries/llm-models.d.ts +1 -1
  81. package/dist/entries/media.cjs +56 -48
  82. package/dist/entries/media.d.cts +65 -3
  83. package/dist/entries/media.d.ts +65 -3
  84. package/dist/entries/media.js +1 -1
  85. package/dist/entries/model-catalog.cjs +66 -66
  86. package/dist/entries/model-catalog.js +4 -4
  87. package/dist/entries/models.cjs +336 -244
  88. package/dist/entries/models.d.cts +125 -8
  89. package/dist/entries/models.d.ts +125 -8
  90. package/dist/entries/models.js +4 -4
  91. package/dist/entries/nodes.cjs +206 -206
  92. package/dist/entries/nodes.js +8 -8
  93. package/dist/entries/pipeline.cjs +149 -149
  94. package/dist/entries/pipeline.d.cts +10 -14
  95. package/dist/entries/pipeline.d.ts +10 -14
  96. package/dist/entries/pipeline.js +3 -3
  97. package/dist/entries/ugc.cjs +71 -71
  98. package/dist/entries/ugc.js +4 -4
  99. package/dist/entries/video.cjs +117 -117
  100. package/dist/entries/video.js +4 -4
  101. package/dist/index.cjs +1169 -1069
  102. package/dist/index.d.cts +3 -3
  103. package/dist/index.d.ts +3 -3
  104. package/dist/index.js +18 -18
  105. package/dist/{model-constants-B5ka4TQr.d.cts → model-constants-BL-Ae0OU.d.cts} +24 -7
  106. package/dist/{model-constants-B5ka4TQr.d.ts → model-constants-BL-Ae0OU.d.ts} +24 -7
  107. package/package.json +1 -1
  108. package/src/__tests__/cast-swap-limits.test.ts +43 -0
  109. package/src/__tests__/credit-identifiers.test.ts +13 -32
  110. package/src/__tests__/pricing-default-duration.test.ts +0 -2
  111. package/src/__tests__/retired-video-provider.test.ts +42 -0
  112. package/src/__tests__/topaz-video.test.ts +72 -0
  113. package/src/__tests__/video-audio-capability.test.ts +4 -13
  114. package/src/__tests__/video-mask.test.ts +31 -0
  115. package/src/__tests__/video-mode-aliases.test.ts +10 -1
  116. package/src/cast-swap-limits.ts +74 -0
  117. package/src/credit-identifiers.ts +4 -1
  118. package/src/entries/models.ts +33 -1
  119. package/src/film-pricing.ts +0 -1
  120. package/src/model-catalog.ts +7 -24
  121. package/src/model-constants.ts +29 -15
  122. package/src/pipeline-types.ts +4 -2
  123. package/src/provider-directive-defaults.ts +0 -1
  124. package/src/topaz-video.ts +141 -0
  125. package/src/video-mask.ts +69 -2
  126. package/src/video-output-canvas.ts +0 -8
  127. package/dist/chunk-5CKTBGB6.js.map +0 -1
  128. package/dist/chunk-5J5L26IZ.js.map +0 -1
  129. package/dist/chunk-A4NDZBSJ.js.map +0 -1
  130. package/dist/chunk-ADYPAGQF.cjs.map +0 -1
  131. package/dist/chunk-BOUEGYGI.cjs.map +0 -1
  132. package/dist/chunk-CWQC6IGE.js.map +0 -1
  133. package/dist/chunk-DC5EYYVX.cjs.map +0 -1
  134. package/dist/chunk-DJIRIBKX.cjs.map +0 -1
  135. package/dist/chunk-LOTL72UI.js.map +0 -1
  136. package/dist/chunk-LOWOJN65.js.map +0 -1
  137. package/dist/chunk-SYUY7GNT.js.map +0 -1
  138. package/dist/chunk-TGZJXCLL.cjs.map +0 -1
  139. package/dist/chunk-VNC5DNIQ.cjs.map +0 -1
  140. package/dist/chunk-VSDJCJKP.cjs.map +0 -1
  141. package/dist/chunk-XOZIHGR5.cjs +0 -27
  142. package/dist/chunk-YX5FW7ON.js.map +0 -1
  143. package/dist/chunk-ZAOBNW6Y.cjs.map +0 -1
@@ -133,6 +133,8 @@ export {
133
133
  videoProviderRequiresImage,
134
134
  videoProviderFoldsLoneEndFrame,
135
135
  VIDEO_MODE_ALIASES,
136
+ RETIRED_VIDEO_PROVIDERS,
137
+ canonicalVideoProvider,
136
138
  VIDEO_GEN_COLLAPSED_T2V_IDS,
137
139
  resolveVideoProviderForMode,
138
140
  resolveVideoModeForInputs,
@@ -210,15 +212,24 @@ export {
210
212
  TREND_PROMPT_LIMITS,
211
213
  CAST_SWAP_FACE_MASKING_BOUNDS,
212
214
  CAST_SWAP_FACE_MASKING_DEFAULTS,
215
+ CAST_SWAP_FACE_MASK_TARGETS,
213
216
  CAST_SWAP_ENGINES,
214
217
  CAST_SWAP_ENGINE_WHEN_OMITTED,
215
218
  CAST_SWAP_RESOLUTIONS_BY_ENGINE,
216
219
  castSwapEngineHasDraft,
220
+ NODARO_MOTION_ENGINES,
221
+ NODARO_MOTION_ENGINE_NAMES,
222
+ CAST_SWAP_ENGINE_OF_NODARO_MOTION,
223
+ NODARO_MOTION_ENGINE_OF_CAST_SWAP,
224
+ CAST_SWAP_ENGINE_IDS_ACCEPTED,
225
+ nodaroMotionEngineOf,
226
+ nodaroMotionEngineName,
227
+ castSwapEngineFrom,
217
228
  CAST_SWAP_KLING_LENGTHS,
218
229
  CAST_SWAP_KLING_LENGTH_WHEN_OMITTED,
219
230
  CAST_SWAP_KLING_MAX_IMAGES,
220
231
  } from "../cast-swap-limits.js"
221
- export type { CastSwapEngine, CastSwapKlingLength } from "../cast-swap-limits.js"
232
+ export type { CastSwapEngine, CastSwapFaceMaskTarget, CastSwapKlingLength, NodaroMotionEngine } from "../cast-swap-limits.js"
222
233
  export type {
223
234
  ImageAspectRatio,
224
235
  ImageResolution,
@@ -330,3 +341,24 @@ export {
330
341
  export type { VoiceChangerModel } from "../voice-changer-models.js"
331
342
  // --- Model tree (derive node targets + product-line grouping for the Models tab) ---
332
343
  export * from "../model-tree.js"
344
+ // --- Topaz video upscale target (resolution + fps; the legacy factor mapped forward) ---
345
+ export {
346
+ TOPAZ_VIDEO_RESOLUTIONS,
347
+ TOPAZ_VIDEO_DEFAULT_RESOLUTION,
348
+ TOPAZ_VIDEO_SHORT_SIDE,
349
+ TOPAZ_VIDEO_FPS_MIN,
350
+ TOPAZ_VIDEO_FPS_MAX,
351
+ TOPAZ_VIDEO_FPS_CHOICES,
352
+ TOPAZ_VIDEO_FALLBACK_FPS,
353
+ isTopazVideoResolution,
354
+ topazVideoResolutionNearest,
355
+ clampTopazVideoFps,
356
+ resolveTopazVideoTarget,
357
+ topazVideoOutputSize,
358
+ } from "../topaz-video.js"
359
+ export type {
360
+ TopazVideoResolution,
361
+ TopazVideoSource,
362
+ TopazVideoTargetInput,
363
+ TopazVideoTarget,
364
+ } from "../topaz-video.js"
@@ -52,7 +52,6 @@ export const VIDEO_CLIP_CREDITS: Record<string, VideoClipCost> = {
52
52
  "kling-turbo": { credits: 11, clipSeconds: 5 }, // kling-turbo:5s
53
53
  "kling": { credits: 14, clipSeconds: 5 }, // kling:5s
54
54
  "kling-3.0": { credits: 31, clipSeconds: 5 },
55
- "seedance": { credits: 7, clipSeconds: 8 }, // seedance:8s
56
55
  "seedance-2": { credits: 50, clipSeconds: 8 }, // seedance-2:8s:720p-ref
57
56
  "seedance-2-fast": { credits: 40, clipSeconds: 8 }, // seedance-2-fast:8s:720p-ref
58
57
  "seedance-2-mini": { credits: 25, clipSeconds: 8 }, // seedance-2-mini:8s:720p-ref
@@ -1913,28 +1913,9 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1913
1913
  },
1914
1914
 
1915
1915
  // ── Bytedance Seedance ──
1916
- "seedance": {
1917
- id: "seedance",
1918
- kind: "video",
1919
- modes: ["i2v", "t2v"] as const,
1920
- family: "Bytedance",
1921
- maker: "bytedance",
1922
- label: "Seedance 1.5 Pro",
1923
- series: "Seedance",
1924
- description: "Bytedance Seedance 1.5 Pro — flexible duration (4/8/12s) with end-frame support.",
1925
- useCases: ["motion", "narrative"],
1926
- features: ["end-frame"],
1927
- durations: [4, 8, 12],
1928
- defaultDuration: 8,
1929
- resolutions: ["480p", "720p", "1080p"],
1930
- pricing: [
1931
- { identifier: "seedance", credits: 250, note: "8s default" },
1932
- { identifier: "seedance:4s", credits: 40 },
1933
- { identifier: "seedance:8s", credits: 70 },
1934
- { identifier: "seedance:12s", credits: 150 },
1935
- ],
1936
- mcpHidden: true,
1937
- },
1916
+ // `seedance` (Seedance 1.5 Pro) was retired upstream 2026-10-25 — KIE answers
1917
+ // 410. No entry: a stored or sent "seedance" runs as Seedance 2 Mini through
1918
+ // RETIRED_VIDEO_PROVIDERS (model-constants).
1938
1919
  "seedance-2": {
1939
1920
  id: "seedance-2",
1940
1921
  kind: "video",
@@ -2663,9 +2644,11 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
2663
2644
  maker: "topaz-labs",
2664
2645
  label: "Topaz Video Upscale",
2665
2646
  series: "Topaz",
2666
- description: "High-quality video upscale and enhancement.",
2647
+ description: "High-quality video upscale and enhancement to 720p, 1080p or 4K at 15–60 fps (frames are interpolated). Metered: the price is per Topaz unit, and a run uses a few units per output gigapixel.",
2667
2648
  useCases: ["upscale", "premium"],
2668
- pricing: [{ identifier: "topaz-video", credits: 190, note: "~5s clip" }],
2649
+ // Metered: a run holds its output-gigapixel ceiling and is charged the
2650
+ // Topaz units the provider reports, never above the hold.
2651
+ pricing: [{ identifier: "topaz-video:per-unit", credits: 40, note: "per Topaz unit (metered)" }],
2669
2652
  },
2670
2653
 
2671
2654
  // ── Motion transfer ──
@@ -262,7 +262,6 @@ export const MAX_VIDEO_PROMPT_CHARS_BY_PROVIDER: Record<string, number> = {
262
262
  "hailuo-standard": 1500,
263
263
  "hailuo-2.3-pro": 1500, // t2v 1500 / i2v 5000 → smaller, safe for both modes
264
264
  "hailuo-2.3": 5000,
265
- "seedance": 2500, // Seedance 1.5 Pro
266
265
  "wan": 5000,
267
266
  "wan-i2v": 5000,
268
267
  "wan-turbo": 5000,
@@ -886,7 +885,6 @@ export const IMAGE_TO_VIDEO_PROVIDERS = [
886
885
  "kling-turbo",
887
886
  "kling-3.0",
888
887
  "kling-master",
889
- "seedance",
890
888
  "seedance-2",
891
889
  "seedance-2-fast",
892
890
  "seedance-2-mini",
@@ -944,7 +942,6 @@ export const TEXT_TO_VIDEO_PROVIDERS = [
944
942
  "kling-turbo",
945
943
  "kling-3.0",
946
944
  "grok",
947
- "seedance",
948
945
  "seedance-2",
949
946
  "seedance-2-fast",
950
947
  "seedance-2-mini",
@@ -1040,17 +1037,43 @@ export const VIDEO_MODE_ALIASES: readonly VideoModeAlias[] = [
1040
1037
  { base: "happyhorse-i2v", i2v: "happyhorse-i2v", t2v: "happyhorse" },
1041
1038
  ] as const
1042
1039
 
1040
+ /**
1041
+ * Video model ids the provider retired, each with the model it now runs as.
1042
+ * They have no catalog entry and are in no provider list: every boundary that
1043
+ * receives a stored or sent id (editor load, a run's payload and its estimate,
1044
+ * a request body, the video worker, a pipeline pin, the MCP model choice, the
1045
+ * credit id) passes it through {@link canonicalVideoProvider} first,
1046
+ * so a saved node, an app run or an API call naming one keeps working and is
1047
+ * priced as the model it runs as.
1048
+ *
1049
+ * - `seedance` (Seedance 1.5 Pro, KIE `bytedance/seedance-1.5-pro`): retired
1050
+ * upstream 2026-10-25 (KIE answers 410). Runs as Seedance 2 Mini, the
1051
+ * cheapest Seedance left (owner's decision 2026-10-25).
1052
+ */
1053
+ export const RETIRED_VIDEO_PROVIDERS: Readonly<Record<string, string>> = {
1054
+ seedance: "seedance-2-mini",
1055
+ }
1056
+
1057
+ /** A retired video model id becomes the id it runs as; any other value passes through unchanged. Own properties only. */
1058
+ export function canonicalVideoProvider<T>(provider: T): T | string {
1059
+ return typeof provider === "string" && Object.hasOwn(RETIRED_VIDEO_PROVIDERS, provider)
1060
+ ? RETIRED_VIDEO_PROVIDERS[provider]!
1061
+ : provider
1062
+ }
1063
+
1043
1064
  /**
1044
1065
  * Resolve a (possibly base / cross-mode) video provider id to the concrete KIE
1045
1066
  * id for the given execution mode. Accepts any member id of an alias group
1046
1067
  * (base, i2v, or t2v) so existing workflows that stored either mode's id keep
1047
- * working. Non-aliased providers (single-id models, VEO, Replicate, etc.) pass
1068
+ * working, and a retired id ({@link RETIRED_VIDEO_PROVIDERS}) as the model it
1069
+ * runs as. Non-aliased providers (single-id models, VEO, Replicate, etc.) pass
1048
1070
  * through unchanged.
1049
1071
  */
1050
1072
  export function resolveVideoProviderForMode(
1051
- provider: string,
1073
+ rawProvider: string,
1052
1074
  mode: "image-to-video" | "text-to-video",
1053
1075
  ): string {
1076
+ const provider = canonicalVideoProvider(rawProvider)
1054
1077
  for (const g of VIDEO_MODE_ALIASES) {
1055
1078
  if (provider === g.base || provider === g.i2v || provider === g.t2v) {
1056
1079
  return mode === "image-to-video" ? g.i2v : g.t2v
@@ -1747,7 +1770,6 @@ export const DURATION_PRICED_PROVIDERS = new Set([
1747
1770
  "hailuo-2.3-pro",
1748
1771
  "hailuo-2.3",
1749
1772
  "hailuo-standard",
1750
- "seedance",
1751
1773
  "seedance-2",
1752
1774
  "seedance-2-fast",
1753
1775
  "seedance-2-mini",
@@ -2890,8 +2912,6 @@ export const VIDEO_AUDIO_CAPABILITY: Record<string, VideoAudioCapability> = {
2890
2912
  // provider config → defaultOn); audio is priced into the flat per-duration
2891
2913
  // rate, so NOT cost-affecting (no :audio composite).
2892
2914
  "kling-3-omni": { mode: "native_speech", field: "generateAudio", defaultOn: true },
2893
- // Seedance 1.x — optional ambient audio (generate_audio); not dialogue.
2894
- seedance: { mode: "ambient", field: "generateAudio" },
2895
2915
  // Seedance 2.0 — multimodal; lip-syncs to a supplied reference-audio track.
2896
2916
  "seedance-2": { mode: "audio_driven", field: "generateAudio" },
2897
2917
  "seedance-2-fast": { mode: "audio_driven", field: "generateAudio" },
@@ -3076,7 +3096,6 @@ export const VIDEO_VARIABLE_PRICING: Record<string, "duration" | "duration+audio
3076
3096
  "hailuo-2.3-pro": "duration",
3077
3097
  "hailuo-2.3": "duration",
3078
3098
  "hailuo-standard": "duration",
3079
- "seedance": "duration",
3080
3099
  "seedance-2": "duration+resolution+ref",
3081
3100
  "seedance-2-fast": "duration+resolution+ref",
3082
3101
  "seedance-2-mini": "duration+resolution+ref",
@@ -3324,11 +3343,6 @@ export const VIDEO_DURATION_TIERS: Record<string, Array<{ maxSeconds: number; su
3324
3343
  { maxSeconds: 6, suffix: "6s" },
3325
3344
  { maxSeconds: 10, suffix: "10s" },
3326
3345
  ],
3327
- "seedance": [
3328
- { maxSeconds: 4, suffix: "4s" },
3329
- { maxSeconds: 8, suffix: "8s" },
3330
- { maxSeconds: 12, suffix: "12s" },
3331
- ],
3332
3346
  "seedance-2": [
3333
3347
  { maxSeconds: 4, suffix: "4s" },
3334
3348
  { maxSeconds: 8, suffix: "8s" },
@@ -3494,7 +3508,7 @@ export const OBJECT_MOTION_PROVIDERS = [
3494
3508
  "minimax", // 5s, end-frame support
3495
3509
  "hailuo-2.3", // 6/10s
3496
3510
  "wan-i2v", // 5/10/15s
3497
- "seedance", // 4/8/12s
3511
+ "seedance-2-mini", // 4-15s, 480p/720p
3498
3512
  "bytedance-lite", // 5/10s
3499
3513
  ] as const
3500
3514
  export type ObjectMotionProvider = (typeof OBJECT_MOTION_PROVIDERS)[number]
@@ -7,6 +7,7 @@ import {
7
7
  VIDEO_CRITIC_FRAME_MODES,
8
8
  } from "./pipeline-defaults.js"
9
9
  import { SceneMetadataSchema } from "./scene-node-types.js"
10
+ import { canonicalVideoProvider } from "./model-constants.js"
10
11
 
11
12
  // ─── Input schema (POST /v1/pipelines body) ───────────────────────────────────
12
13
 
@@ -74,7 +75,6 @@ export const PIPELINE_PINNABLE_VIDEO_MODELS = [
74
75
  "kling-turbo",
75
76
  "kling",
76
77
  "kling-3.0",
77
- "seedance",
78
78
  "seedance-2",
79
79
  "seedance-2-fast",
80
80
  "seedance-2-mini",
@@ -119,7 +119,9 @@ export const PIPELINE_ACCEPTED_SCRIPT_LLMS = [
119
119
  export type PipelinePinnableScriptLlm = (typeof PIPELINE_ACCEPTED_SCRIPT_LLMS)[number]
120
120
 
121
121
  const ImageModelEnum = z.enum(PIPELINE_ACCEPTED_IMAGE_MODELS)
122
- const VideoModelEnum = z.enum(PIPELINE_PINNABLE_VIDEO_MODELS)
122
+ // A saved pipeline pinned to a retired video model (RETIRED_VIDEO_PROVIDERS)
123
+ // reads as the model it now runs as, never as an invalid config.
124
+ const VideoModelEnum = z.preprocess(canonicalVideoProvider, z.enum(PIPELINE_PINNABLE_VIDEO_MODELS))
123
125
  const ScriptLlmEnum = z.enum(PIPELINE_ACCEPTED_SCRIPT_LLMS)
124
126
 
125
127
  // Per-stage override map. Each stage key maps to a model id valid for its
@@ -13,7 +13,6 @@ import type { ShotSpec } from "./scene-node-types.js"
13
13
  * route validation + payload building.
14
14
  */
15
15
  export const PROVIDER_DIRECTIVE_DEFAULTS = {
16
- seedance: { multishot: true, disable_internal_music: true, allow_sfx: true },
17
16
  "seedance-2": { multishot: true, disable_internal_music: true, allow_sfx: true },
18
17
  veo3: { reference_count: "auto" as const },
19
18
  "veo3.1": { reference_count: "auto" as const },
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Topaz video upscale — the lever a caller sets and the target it resolves to.
3
+ *
4
+ * Topaz takes an absolute TARGET, never a factor: a resolution (720p, 1080p or
5
+ * 4K — the short side of the frame; a portrait clip keeps its orientation) and
6
+ * an output frame rate (15–60 fps; frames it has to invent are interpolated).
7
+ * The editor used to send a 1×/2×/4× factor, which saved workflows, older API
8
+ * callers and private plugins still do, so a factor is still accepted and is
9
+ * mapped onto the target here: factor × the source's short side, snapped to
10
+ * the nearest target.
11
+ *
12
+ * One resolver for every lane (route, workflow run, plugin toolkit), so the
13
+ * target a run is priced at is the one sent.
14
+ */
15
+
16
+ export const TOPAZ_VIDEO_RESOLUTIONS = ["720p", "1080p", "4k"] as const
17
+ export type TopazVideoResolution = (typeof TOPAZ_VIDEO_RESOLUTIONS)[number]
18
+
19
+ export const TOPAZ_VIDEO_DEFAULT_RESOLUTION: TopazVideoResolution = "1080p"
20
+
21
+ /** The short side, in pixels, of each target resolution. */
22
+ export const TOPAZ_VIDEO_SHORT_SIDE: Readonly<Record<TopazVideoResolution, number>> = {
23
+ "720p": 720,
24
+ "1080p": 1080,
25
+ "4k": 2160,
26
+ }
27
+
28
+ export const TOPAZ_VIDEO_FPS_MIN = 15
29
+ export const TOPAZ_VIDEO_FPS_MAX = 60
30
+ /** The frame rates the editor offers beside "same as source". */
31
+ export const TOPAZ_VIDEO_FPS_CHOICES = [24, 25, 30, 50, 60] as const
32
+ /** The rate used when neither the caller nor the source names one. */
33
+ export const TOPAZ_VIDEO_FALLBACK_FPS = 30
34
+
35
+ export function isTopazVideoResolution(v: unknown): v is TopazVideoResolution {
36
+ return typeof v === "string" && (TOPAZ_VIDEO_RESOLUTIONS as readonly string[]).includes(v)
37
+ }
38
+
39
+ /**
40
+ * The target whose short side is nearest `shortSide` px (4K above it, 720p
41
+ * below; a tie takes the larger). A legacy factor lands here: a 720p clip at
42
+ * 2× (1440 px) renders at 1080p, a 1080p clip at 2× at 4K.
43
+ */
44
+ export function topazVideoResolutionNearest(shortSide: number): TopazVideoResolution {
45
+ let best: TopazVideoResolution = TOPAZ_VIDEO_RESOLUTIONS[0]
46
+ for (const r of TOPAZ_VIDEO_RESOLUTIONS) {
47
+ if (Math.abs(TOPAZ_VIDEO_SHORT_SIDE[r] - shortSide) <= Math.abs(TOPAZ_VIDEO_SHORT_SIDE[best] - shortSide)) best = r
48
+ }
49
+ return best
50
+ }
51
+
52
+ export function clampTopazVideoFps(fps: number): number {
53
+ return Math.min(TOPAZ_VIDEO_FPS_MAX, Math.max(TOPAZ_VIDEO_FPS_MIN, Math.round(fps)))
54
+ }
55
+
56
+ export interface TopazVideoSource {
57
+ width: number
58
+ height: number
59
+ /** The source's own frame rate; absent when it has none (variable or unreadable). */
60
+ fps?: number
61
+ }
62
+
63
+ export interface TopazVideoTargetInput {
64
+ targetResolution?: string | null
65
+ /** Output frame rate; absent (or "source") = the source's own rate. */
66
+ targetFps?: number | string | null
67
+ /** Legacy relative lever ("1" | "2" | "4"): read only when no `targetResolution` is set. */
68
+ upscaleFactor?: string | null
69
+ source?: TopazVideoSource
70
+ }
71
+
72
+ export interface TopazVideoTarget {
73
+ resolution: TopazVideoResolution
74
+ fps: number
75
+ /** What was read in place of what was asked, for the job log. Empty when the request was taken as sent. */
76
+ adjustments: string[]
77
+ }
78
+
79
+ const LEGACY_FACTORS: Readonly<Record<string, number>> = { "1": 1, "2": 2, "4": 4 }
80
+
81
+ /**
82
+ * The target a Topaz video upscale renders at. `targetResolution` wins; else a
83
+ * legacy factor over the source's short side; else 1080p. `targetFps` is
84
+ * clamped to 15–60; absent, the source's rate (clamped), else 30.
85
+ */
86
+ export function resolveTopazVideoTarget(input: TopazVideoTargetInput): TopazVideoTarget {
87
+ const adjustments: string[] = []
88
+ const shortSide = input.source ? Math.min(input.source.width, input.source.height) : undefined
89
+
90
+ let resolution: TopazVideoResolution
91
+ if (isTopazVideoResolution(input.targetResolution)) {
92
+ resolution = input.targetResolution
93
+ } else {
94
+ if (input.targetResolution != null && input.targetResolution !== "") {
95
+ adjustments.push(`targetResolution "${input.targetResolution}" is not one of ${TOPAZ_VIDEO_RESOLUTIONS.join(", ")}`)
96
+ }
97
+ const factor = typeof input.upscaleFactor === "string" ? LEGACY_FACTORS[input.upscaleFactor.trim()] : undefined
98
+ if (factor !== undefined && shortSide !== undefined) {
99
+ resolution = topazVideoResolutionNearest(shortSide * factor)
100
+ adjustments.push(`upscaleFactor ${factor}× of a ${shortSide}px short side → ${resolution}`)
101
+ } else {
102
+ resolution = TOPAZ_VIDEO_DEFAULT_RESOLUTION
103
+ if (factor !== undefined) adjustments.push(`upscaleFactor ${factor}× with no readable source size → ${resolution}`)
104
+ }
105
+ }
106
+
107
+ const asked = typeof input.targetFps === "number"
108
+ ? input.targetFps
109
+ : typeof input.targetFps === "string" && input.targetFps.trim() !== "" && input.targetFps !== "source"
110
+ ? Number(input.targetFps)
111
+ : undefined
112
+ let fps: number
113
+ if (asked !== undefined && Number.isFinite(asked)) {
114
+ fps = clampTopazVideoFps(asked)
115
+ if (fps !== asked) adjustments.push(`targetFps ${asked} → ${fps}`)
116
+ } else if (input.source?.fps !== undefined && Number.isFinite(input.source.fps) && input.source.fps > 0) {
117
+ fps = clampTopazVideoFps(input.source.fps)
118
+ } else {
119
+ fps = TOPAZ_VIDEO_FALLBACK_FPS
120
+ }
121
+
122
+ return { resolution, fps, adjustments }
123
+ }
124
+
125
+ /**
126
+ * The output frame size a target renders a source at: the short side at the
127
+ * target, the long side scaled by the source's aspect, both even. Without a
128
+ * source, a 16:9 frame.
129
+ */
130
+ export function topazVideoOutputSize(
131
+ resolution: TopazVideoResolution,
132
+ source?: Pick<TopazVideoSource, "width" | "height">,
133
+ ): { width: number; height: number } {
134
+ const short = TOPAZ_VIDEO_SHORT_SIDE[resolution]
135
+ const ratio = source && source.width > 0 && source.height > 0
136
+ ? Math.max(source.width, source.height) / Math.min(source.width, source.height)
137
+ : 16 / 9
138
+ const long = Math.round((short * ratio) / 2) * 2
139
+ const portrait = source ? source.height > source.width : false
140
+ return portrait ? { width: short, height: long } : { width: long, height: short }
141
+ }
package/src/video-mask.ts CHANGED
@@ -52,10 +52,20 @@ export const VIDEO_MASK_DEFAULTS = {
52
52
  * Off: one pass over the whole clip. On: the clip's scene cuts are found
53
53
  * first and each shot is segmented on its own — the model starts afresh
54
54
  * after every cut (finding the new shot's subjects), and `holdLastMask`
55
- * never carries a mask across a cut. A clip with no cut (a flash is not
56
- * one) is one shot: the same mask, fitted to the clip's exact frame count.
55
+ * never carries a mask across a cut. A clip with no cut (a flash is
56
+ * usually not one) is one shot: the same mask, fitted to the clip's exact
57
+ * frame count.
57
58
  */
58
59
  perShot: false,
60
+ /**
61
+ * 0 = off: a new detection only where a request starts anyway (the clip's
62
+ * start, every 1,800 frames, and every cut with `perShot`). Above 0: the
63
+ * model is also sent a new request every this many seconds of footage, so a
64
+ * subject that first appears mid-shot is found within that time (see
65
+ * `REDETECT_EVERY_SEC_*`). These boundaries are not cuts: `holdLastMask`
66
+ * keeps holding across them.
67
+ */
68
+ redetectEverySec: 0,
59
69
  } as const
60
70
 
61
71
  export const VIDEO_MASK_LIMITS = {
@@ -78,6 +88,14 @@ export const VIDEO_MASK_LIMITS = {
78
88
  * instead. Frames before the first detection stay as they are.
79
89
  */
80
90
  HOLD_EMPTY_BELOW_FRACTION: 0.00002,
91
+ /**
92
+ * `holdLastMask`: the longest a mask is held, in seconds of frames (at the
93
+ * clip's rate). The hold is for a subject hidden for a moment; a run of
94
+ * empty frames longer than this shows the held mask for its first second
95
+ * and then nothing, until the model finds the subject again — a mask held
96
+ * on for longer sits where the subject no longer is.
97
+ */
98
+ HOLD_MAX_SEC: 1,
81
99
  /**
82
100
  * `minSubjectHeightPct`: drop every connected white region (8-connected)
83
101
  * whose bounding box is shorter than this % of the frame height — extras'
@@ -106,8 +124,38 @@ export const VIDEO_MASK_LIMITS = {
106
124
  */
107
125
  ZONE_MARGIN_PCT_MIN: 0,
108
126
  ZONE_MARGIN_PCT_MAX: 49,
127
+ /**
128
+ * `redetectEverySec`: 0 (off) or `REDETECT_EVERY_SEC_MIN`–`MAX` seconds. The
129
+ * model picks up its subjects near the start of each request; a face that
130
+ * turns to the camera, or a person who walks in, partway through a request is
131
+ * never masked. On, the clip (each shot, with `perShot`) is cut into requests
132
+ * of at most this many seconds of frames — counted from the shot's start, a
133
+ * last piece shorter than `VIDEO_MASK_MIN_SHOT_FRAMES` joining the one before
134
+ * — so the subjects are detected again at every such boundary. Each request
135
+ * adds wall time (they run three at a time); the price follows the clip's
136
+ * length and does not change.
137
+ */
138
+ REDETECT_EVERY_SEC_MIN: 1,
139
+ REDETECT_EVERY_SEC_MAX: 10,
140
+ /** The panel's step (the API takes any value in range). */
141
+ REDETECT_EVERY_SEC_STEP: 1,
109
142
  } as const
110
143
 
144
+ /**
145
+ * The version of what a Video Mask run's mask looks like for a given clip and
146
+ * settings: every finished `video-mask` job reports it as `output_data.recipe`.
147
+ * A mask stored ahead of time and reused (a trend's approved face mask) is
148
+ * held to it, and reads as out of date once it changes.
149
+ *
150
+ * BUMP IT (to the date of the change) whenever the algorithm changes the mask
151
+ * a run produces from the same clip and settings: the cut rule (`perShot`),
152
+ * the hold (`holdLastMask`, `HOLD_*`), the size and zone filters, the
153
+ * rendering. Never for a change that leaves every mask the same (pricing,
154
+ * limits on what is accepted, messages). `"2026-10-25"`: the lone-spike cut
155
+ * rule and the 1 s hold cap.
156
+ */
157
+ export const VIDEO_MASK_RECIPE = "2026-10-25"
158
+
111
159
  const VIDEO_MASK_BUCKETS_SEC = [5, 10, 15, 30, 60, 90, 120, 180, 240, 300] as const
112
160
 
113
161
  /** Every price row a provider can be charged from, smallest first. */
@@ -165,6 +213,19 @@ export function resolveVideoMaskZone(value: unknown): VideoMaskZone | null {
165
213
  return zone.leftPct > 0 || zone.rightPct > 0 || zone.topPct > 0 || zone.bottomPct > 0 ? zone : null
166
214
  }
167
215
 
216
+ /**
217
+ * `redetectEverySec` as a run reads it: a finite number above 0 clamped to
218
+ * `REDETECT_EVERY_SEC_MIN`–`MAX` (a value between 0 and the minimum snaps up
219
+ * to it — it asked for re-detection); anything else (absent, 0, negative,
220
+ * not a number) is 0 = off. The one reading shared by the worker, a workflow
221
+ * run's payload, the node's own run and its panel (the route refuses a value
222
+ * out of range instead).
223
+ */
224
+ export function resolveVideoMaskRedetectSec(value: unknown): number {
225
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return 0
226
+ return Math.min(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MAX, Math.max(VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN, value))
227
+ }
228
+
168
229
  /** `POST /v1/video-mask` request body. */
169
230
  export interface VideoMaskRequest {
170
231
  /** The clip to segment. */
@@ -190,4 +251,10 @@ export interface VideoMaskRequest {
190
251
  * first and the subjects are detected again in every shot; `holdLastMask` never
191
252
  * carries a mask across a cut. The output then carries `shots`. */
192
253
  readonly perShot?: boolean
254
+ /** Detect the subjects again every this many seconds (0 = off, the default, or
255
+ * `VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN`–`MAX`): the clip — each shot, with
256
+ * `perShot` — is sent to the model in pieces of at most that length, so a subject
257
+ * that first appears mid-shot is masked from the next boundary on. Not a cut:
258
+ * `holdLastMask` holds across these boundaries. Slower (more requests); same price. */
259
+ readonly redetectEverySec?: number
193
260
  }
@@ -73,14 +73,6 @@ export const VIDEO_OUTPUT_CANVAS: Readonly<
73
73
  "768p": { "9:16": [768, 1344] },
74
74
  "2k": { "16:9": [2560, 1440], "9:16": [1440, 2560] },
75
75
  },
76
- seedance: {
77
- "1080p": {
78
- "16:9": [1920, 1080],
79
- "9:16": [1080, 1920],
80
- "1:1": [1440, 1440],
81
- "3:4": [1248, 1664],
82
- },
83
- },
84
76
  }
85
77
 
86
78
  /**