@nodaro/shared 3.58.0 → 3.59.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 (141) hide show
  1. package/dist/{chunk-VVGSIWNL.js → chunk-2S7YYCRT.js} +4 -4
  2. package/dist/{chunk-VVGSIWNL.js.map → chunk-2S7YYCRT.js.map} +1 -1
  3. package/dist/{chunk-6CYS7VRH.js → chunk-2VQHPILW.js} +2 -21
  4. package/dist/chunk-2VQHPILW.js.map +1 -0
  5. package/dist/{chunk-6TFWFYYI.js → chunk-3R2KVYXN.js} +3 -3
  6. package/dist/{chunk-6TFWFYYI.js.map → chunk-3R2KVYXN.js.map} +1 -1
  7. package/dist/{chunk-OWNPYQSH.cjs → chunk-4GGLKRYI.cjs} +16 -3
  8. package/dist/chunk-4GGLKRYI.cjs.map +1 -0
  9. package/dist/{chunk-PK4ZR2SK.cjs → chunk-62RC6K62.cjs} +4 -4
  10. package/dist/{chunk-PK4ZR2SK.cjs.map → chunk-62RC6K62.cjs.map} +1 -1
  11. package/dist/chunk-6VXDW2U3.cjs +27 -0
  12. package/dist/{chunk-QCW6J6BQ.cjs.map → chunk-6VXDW2U3.cjs.map} +1 -1
  13. package/dist/{chunk-S7FCFQ6X.js → chunk-CF4S4N5X.js} +16 -4
  14. package/dist/chunk-CF4S4N5X.js.map +1 -0
  15. package/dist/{chunk-ZX6RRM6R.cjs → chunk-D574HZ35.cjs} +43 -43
  16. package/dist/{chunk-ZX6RRM6R.cjs.map → chunk-D574HZ35.cjs.map} +1 -1
  17. package/dist/{chunk-IKOKRJDI.cjs → chunk-DKZGLIFW.cjs} +4 -4
  18. package/dist/{chunk-IKOKRJDI.cjs.map → chunk-DKZGLIFW.cjs.map} +1 -1
  19. package/dist/{chunk-DC2QPACA.js → chunk-EO4W4MA3.js} +4 -4
  20. package/dist/{chunk-DC2QPACA.js.map → chunk-EO4W4MA3.js.map} +1 -1
  21. package/dist/{chunk-L26G7B27.js → chunk-FHCMYGBV.js} +3 -3
  22. package/dist/{chunk-L26G7B27.js.map → chunk-FHCMYGBV.js.map} +1 -1
  23. package/dist/{chunk-JUEFRVHZ.js → chunk-FJCRWDU5.js} +4 -4
  24. package/dist/{chunk-JUEFRVHZ.js.map → chunk-FJCRWDU5.js.map} +1 -1
  25. package/dist/{chunk-FVKCNAEQ.js → chunk-HP3YIWNJ.js} +9 -4
  26. package/dist/chunk-HP3YIWNJ.js.map +1 -0
  27. package/dist/{chunk-UJJUX6NW.cjs → chunk-HW6TLOK4.cjs} +9 -3
  28. package/dist/chunk-HW6TLOK4.cjs.map +1 -0
  29. package/dist/{chunk-CNSRCZYY.js → chunk-IP7QOHWQ.js} +5 -5
  30. package/dist/{chunk-CNSRCZYY.js.map → chunk-IP7QOHWQ.js.map} +1 -1
  31. package/dist/{chunk-I7NG2D6X.cjs → chunk-K4L4G76I.cjs} +21 -21
  32. package/dist/{chunk-I7NG2D6X.cjs.map → chunk-K4L4G76I.cjs.map} +1 -1
  33. package/dist/{chunk-ZMH56CLL.js → chunk-MTXVODG3.js} +3 -3
  34. package/dist/{chunk-ZMH56CLL.js.map → chunk-MTXVODG3.js.map} +1 -1
  35. package/dist/{chunk-KYHDKKUJ.cjs → chunk-NHZWVKGV.cjs} +8 -8
  36. package/dist/{chunk-KYHDKKUJ.cjs.map → chunk-NHZWVKGV.cjs.map} +1 -1
  37. package/dist/{chunk-QPBBIRLF.cjs → chunk-NSZTHJZJ.cjs} +39 -39
  38. package/dist/{chunk-QPBBIRLF.cjs.map → chunk-NSZTHJZJ.cjs.map} +1 -1
  39. package/dist/{chunk-S5VBJJUT.cjs → chunk-OFL4UH6L.cjs} +46 -46
  40. package/dist/{chunk-S5VBJJUT.cjs.map → chunk-OFL4UH6L.cjs.map} +1 -1
  41. package/dist/{chunk-M7SMSAOU.js → chunk-ORJ5HQAB.js} +4 -4
  42. package/dist/{chunk-M7SMSAOU.js.map → chunk-ORJ5HQAB.js.map} +1 -1
  43. package/dist/{chunk-DCP7JFSE.cjs → chunk-P7KSB5T6.cjs} +5 -5
  44. package/dist/{chunk-DCP7JFSE.cjs.map → chunk-P7KSB5T6.cjs.map} +1 -1
  45. package/dist/{chunk-WBERPAXE.cjs → chunk-PEATSEAD.cjs} +6 -6
  46. package/dist/{chunk-WBERPAXE.cjs.map → chunk-PEATSEAD.cjs.map} +1 -1
  47. package/dist/{chunk-IQBIH3AE.js → chunk-PIEMWFSJ.js} +3 -3
  48. package/dist/{chunk-IQBIH3AE.js.map → chunk-PIEMWFSJ.js.map} +1 -1
  49. package/dist/{chunk-HEUWAIXG.js → chunk-PIX4OCCQ.js} +5 -5
  50. package/dist/{chunk-HEUWAIXG.js.map → chunk-PIX4OCCQ.js.map} +1 -1
  51. package/dist/{chunk-5PJC4ZWO.cjs → chunk-QE7W4YIK.cjs} +6 -6
  52. package/dist/{chunk-5PJC4ZWO.cjs.map → chunk-QE7W4YIK.cjs.map} +1 -1
  53. package/dist/{chunk-QVPIO2NU.cjs → chunk-QLLR7GUY.cjs} +5 -5
  54. package/dist/{chunk-QVPIO2NU.cjs.map → chunk-QLLR7GUY.cjs.map} +1 -1
  55. package/dist/{chunk-A5ESI2NY.js → chunk-RGBNOCIO.js} +8 -8
  56. package/dist/{chunk-A5ESI2NY.js.map → chunk-RGBNOCIO.js.map} +1 -1
  57. package/dist/{chunk-WLFT5UVV.cjs → chunk-RSXQOFM7.cjs} +8 -8
  58. package/dist/{chunk-WLFT5UVV.cjs.map → chunk-RSXQOFM7.cjs.map} +1 -1
  59. package/dist/{chunk-ODTZV3BW.js → chunk-TA7ODVYJ.js} +4 -4
  60. package/dist/{chunk-ODTZV3BW.js.map → chunk-TA7ODVYJ.js.map} +1 -1
  61. package/dist/{chunk-4UUX62S3.cjs → chunk-UPD7W2KJ.cjs} +12 -12
  62. package/dist/{chunk-4UUX62S3.cjs.map → chunk-UPD7W2KJ.cjs.map} +1 -1
  63. package/dist/{chunk-4ZZ6SVIQ.cjs → chunk-V3NONYLA.cjs} +2 -21
  64. package/dist/chunk-V3NONYLA.cjs.map +1 -0
  65. package/dist/{chunk-VZXRDSWA.cjs → chunk-VLQW4CVW.cjs} +23 -21
  66. package/dist/chunk-VLQW4CVW.cjs.map +1 -0
  67. package/dist/{chunk-BSENM6HM.js → chunk-VOZI5F7V.js} +3 -3
  68. package/dist/{chunk-BSENM6HM.js.map → chunk-VOZI5F7V.js.map} +1 -1
  69. package/dist/{chunk-5UVBFY2G.cjs → chunk-YE4EDT57.cjs} +11 -11
  70. package/dist/{chunk-5UVBFY2G.cjs.map → chunk-YE4EDT57.cjs.map} +1 -1
  71. package/dist/{chunk-K6UMB37V.js → chunk-YSEJOJNQ.js} +3 -3
  72. package/dist/{chunk-K6UMB37V.js.map → chunk-YSEJOJNQ.js.map} +1 -1
  73. package/dist/{chunk-SEQ5L72K.js → chunk-ZU56AMFK.js} +5 -4
  74. package/dist/chunk-ZU56AMFK.js.map +1 -0
  75. package/dist/{chunk-OMUYZKRB.js → chunk-ZVUVSD5X.js} +3 -3
  76. package/dist/{chunk-OMUYZKRB.js.map → chunk-ZVUVSD5X.js.map} +1 -1
  77. package/dist/entries/apps.cjs +42 -42
  78. package/dist/entries/apps.js +7 -7
  79. package/dist/entries/credits.cjs +150 -150
  80. package/dist/entries/credits.d.cts +1 -1
  81. package/dist/entries/credits.d.ts +1 -1
  82. package/dist/entries/credits.js +7 -7
  83. package/dist/entries/edl.cjs +63 -59
  84. package/dist/entries/edl.d.cts +15 -1
  85. package/dist/entries/edl.d.ts +15 -1
  86. package/dist/entries/edl.js +1 -1
  87. package/dist/entries/llm-models.d.cts +1 -1
  88. package/dist/entries/llm-models.d.ts +1 -1
  89. package/dist/entries/model-catalog.cjs +70 -70
  90. package/dist/entries/model-catalog.d.cts +2 -2
  91. package/dist/entries/model-catalog.d.ts +2 -2
  92. package/dist/entries/model-catalog.js +4 -4
  93. package/dist/entries/models.cjs +292 -288
  94. package/dist/entries/models.d.cts +3 -3
  95. package/dist/entries/models.d.ts +3 -3
  96. package/dist/entries/models.js +4 -4
  97. package/dist/entries/nodes.cjs +206 -206
  98. package/dist/entries/nodes.d.cts +1 -1
  99. package/dist/entries/nodes.d.ts +1 -1
  100. package/dist/entries/nodes.js +8 -8
  101. package/dist/entries/pipeline.cjs +152 -152
  102. package/dist/entries/pipeline.d.cts +1 -1
  103. package/dist/entries/pipeline.d.ts +1 -1
  104. package/dist/entries/pipeline.js +3 -3
  105. package/dist/entries/runtime-config.cjs +32 -28
  106. package/dist/entries/runtime-config.d.cts +24 -2
  107. package/dist/entries/runtime-config.d.ts +24 -2
  108. package/dist/entries/runtime-config.js +1 -1
  109. package/dist/entries/ugc.cjs +71 -71
  110. package/dist/entries/ugc.js +4 -4
  111. package/dist/entries/video.cjs +117 -117
  112. package/dist/entries/video.js +4 -4
  113. package/dist/index.cjs +1171 -1159
  114. package/dist/index.d.cts +4 -4
  115. package/dist/index.d.ts +4 -4
  116. package/dist/index.js +19 -19
  117. package/dist/{model-catalog-CCsA1isC.d.ts → model-catalog-QJ_AO9l0.d.cts} +3 -1
  118. package/dist/{model-catalog-CCsA1isC.d.cts → model-catalog-QJ_AO9l0.d.ts} +3 -1
  119. package/dist/{model-constants-BtXkUsX3.d.ts → model-constants-BwBdh6Rn.d.cts} +7 -1
  120. package/dist/{model-constants-BtXkUsX3.d.cts → model-constants-BwBdh6Rn.d.ts} +7 -1
  121. package/package.json +1 -1
  122. package/src/__tests__/camera-switch-contract.test.ts +12 -3
  123. package/src/__tests__/credit-identifiers.test.ts +18 -9
  124. package/src/__tests__/gpt-image-2-size-rules.test.ts +80 -0
  125. package/src/__tests__/normalize-model-input.test.ts +10 -10
  126. package/src/__tests__/runtime-config.test.ts +28 -0
  127. package/src/camera-switch-contract.ts +13 -1
  128. package/src/entries/models.ts +1 -0
  129. package/src/entries/runtime-config.ts +1 -0
  130. package/src/model-catalog.ts +14 -27
  131. package/src/model-constants.ts +7 -0
  132. package/src/runtime-config/contract.ts +34 -0
  133. package/dist/chunk-4ZZ6SVIQ.cjs.map +0 -1
  134. package/dist/chunk-6CYS7VRH.js.map +0 -1
  135. package/dist/chunk-FVKCNAEQ.js.map +0 -1
  136. package/dist/chunk-OWNPYQSH.cjs.map +0 -1
  137. package/dist/chunk-QCW6J6BQ.cjs +0 -27
  138. package/dist/chunk-S7FCFQ6X.js.map +0 -1
  139. package/dist/chunk-SEQ5L72K.js.map +0 -1
  140. package/dist/chunk-UJJUX6NW.cjs.map +0 -1
  141. package/dist/chunk-VZXRDSWA.cjs.map +0 -1
@@ -173,6 +173,24 @@ describe("parseRuntimeConfig — typed, lenient, never throws", () => {
173
173
  expect(parseRuntimeConfig(raw)).toEqual({})
174
174
  })
175
175
 
176
+ it("keeps legacyUiHosts as the host names it lists, and nothing else", () => {
177
+ expect(parseRuntimeConfig({ legacyUiHosts: ["app.example.com", "", 7, "Bad Host", "next.app.example.com"] })).toEqual({ legacyUiHosts: ["app.example.com", "next.app.example.com"] })
178
+ expect("legacyUiHosts" in parseRuntimeConfig({ legacyUiHosts: [] })).toBe(false)
179
+ expect("legacyUiHosts" in parseRuntimeConfig({ legacyUiHosts: "app.example.com" })).toBe(false)
180
+ })
181
+
182
+ it("keeps flowUiOrigin and linkOrigin only when each is an https origin", () => {
183
+ expect(parseRuntimeConfig({ apiUrl: "/", flowUiOrigin: "https://flow.example.com", linkOrigin: "https://app.example.com" })).toEqual({
184
+ apiUrl: "/",
185
+ flowUiOrigin: "https://flow.example.com",
186
+ linkOrigin: "https://app.example.com",
187
+ })
188
+ for (const malformed of ["http://flow.example.com", "https://flow.example.com/", "nope", ""]) {
189
+ expect(parseRuntimeConfig({ flowUiOrigin: malformed, linkOrigin: malformed })).toEqual({})
190
+ }
191
+ expect("flowUiOrigin" in parseRuntimeConfig({ apiUrl: "/" })).toBe(false)
192
+ })
193
+
176
194
  it("keeps mediaOrigin only when it is an https origin", () => {
177
195
  expect(parseRuntimeConfig({ apiUrl: "/", mediaOrigin: "https://media.example.com" })).toEqual({ apiUrl: "/", mediaOrigin: "https://media.example.com" })
178
196
  for (const malformed of ["http://media.example.com", "https://media.example.com/", "https://media.example.com/bucket", "media.example.com", "", " ", 7, null, ["https://media.example.com"]]) {
@@ -396,3 +414,13 @@ describe("the UI-string key manifest", () => {
396
414
  expect(JSON.stringify(manifest)).not.toContain("left of")
397
415
  })
398
416
  })
417
+
418
+ describe("isLegacyUiHost: the one rule for a host the app's pages move away from", () => {
419
+ it("is a bare host name, lower case, nothing around it", async () => {
420
+ const { isLegacyUiHost } = await import("../runtime-config/contract.js")
421
+ for (const host of ["app.example.com", "next.app.example.com", "localhost"]) expect(isLegacyUiHost(host), host).toBe(true)
422
+ for (const bad of ["app.example.com\n", "https://app.example.com", "app.example.com:443", "app.example.com/", "a.test\tb.test", "App.example.com", "", " app.example.com", 42, null]) {
423
+ expect(isLegacyUiHost(bad), JSON.stringify(bad)).toBe(false)
424
+ }
425
+ })
426
+ })
@@ -13,6 +13,9 @@ export const CAMERA_SWITCH_DEFAULTS = Object.freeze({
13
13
  minShotMs: 2_500,
14
14
  /** Cut this long before the new speaker starts. */
15
15
  leadMs: 200,
16
+ /** Delay each cut by this long — `leadMs`'s counterpart. A route setting
17
+ * only: no node carries it (`CAMERA_SWITCH_NODE_SETTINGS`). */
18
+ lagMs: 0,
16
19
  /** With a `wide` camera: break to it after this long on one camera. */
17
20
  maxShotMs: 20_000,
18
21
  /** With a `wide` camera: every N-th cut goes to the wide (0 = off). */
@@ -60,6 +63,7 @@ export function cameraSwitchCameras(edl: unknown): Array<{ id: string; role?: st
60
63
  export const CAMERA_SWITCH_BOUNDS = Object.freeze({
61
64
  minShotMs: Object.freeze({ min: 500, max: 60_000 }),
62
65
  leadMs: Object.freeze({ min: 0, max: 5_000 }),
66
+ lagMs: Object.freeze({ min: 0, max: 5_000 }),
63
67
  maxShotMs: Object.freeze({ min: 0, max: 600_000 }),
64
68
  wideEvery: Object.freeze({ min: 0, max: 20 }),
65
69
  })
@@ -69,6 +73,14 @@ export const CAMERA_SWITCH_NAME_MAX = 80
69
73
 
70
74
  export type CameraSwitchNumericSetting = keyof typeof CAMERA_SWITCH_BOUNDS
71
75
 
76
+ /**
77
+ * The numeric settings a Camera Switch NODE carries (its data, which the
78
+ * canvas and the server's executor send through `cameraSwitchSettingsPayload`).
79
+ * `lagMs` is a setting of the route alone — the API, the SDK and the CLI send
80
+ * it; no node does — so it is not one of them.
81
+ */
82
+ export const CAMERA_SWITCH_NODE_SETTINGS = Object.freeze(["minShotMs", "leadMs", "maxShotMs", "wideEvery"] as const satisfies readonly CameraSwitchNumericSetting[])
83
+
72
84
  /** A setting as a whole number inside its range; undefined when unset. */
73
85
  export function clampCameraSwitchSetting(key: CameraSwitchNumericSetting, value: unknown): number | undefined {
74
86
  if (typeof value !== "number" || !Number.isFinite(value)) return undefined
@@ -195,7 +207,7 @@ export function cameraSwitchSettingsPayload(
195
207
  speakerNames: cleanSpeakerNames(data.speakerNames),
196
208
  layoutHints: data.layoutHints === true,
197
209
  }
198
- for (const key of Object.keys(CAMERA_SWITCH_BOUNDS) as CameraSwitchNumericSetting[]) {
210
+ for (const key of CAMERA_SWITCH_NODE_SETTINGS) {
199
211
  const v = clampCameraSwitchSetting(key, data[key])
200
212
  if (v !== undefined) out[key] = v
201
213
  }
@@ -73,6 +73,7 @@ export {
73
73
  SEEDANCE_VIDEO_EDIT_PROVIDERS,
74
74
  isSeedanceVideoEditProvider,
75
75
  VIDEO_TO_VIDEO_NODE_PROVIDERS,
76
+ DEFAULT_VIDEO_TO_VIDEO_PROVIDER,
76
77
  SEEDANCE_VIDEO_EDIT_SHAPE,
77
78
  FACE_SWAP_PROVIDERS,
78
79
  VIDEO_UPSCALE_PROVIDERS,
@@ -26,6 +26,7 @@ export {
26
26
  isBrandLogoRef,
27
27
  isSameSitePath,
28
28
  isHttpsOrigin,
29
+ isLegacyUiHost,
29
30
  resolveRuntimeApiBase,
30
31
  resolveRuntimeSupabaseUrl,
31
32
  parseRuntimeSurface,
@@ -500,6 +500,12 @@ const FLUX_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3"] as const
500
500
  const KONTEXT_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "21:9"] as const
501
501
  const GROK_RATIOS = ["1:1", "16:9", "9:16", "3:2", "2:3"] as const
502
502
  const GPT_IMAGE_RATIOS = ["1:1", "3:2", "2:3"] as const
503
+ // GPT Image 2 (text-to-image and image-to-image) renders every one of these
504
+ // ratios at 1K, 2K and 4K, "auto" and 1:1 included (checked 2026-11-10: 1:1 at
505
+ // 4K came back 2880x2880, "auto" at 2K 2048x2048, and an edit at "auto" and 2K
506
+ // kept a 768x1024 photo's shape at 1536x2048), so it declares no
507
+ // `resolutionsByAspectRatio`. The provider's docs limit 2K and 4K only at ratios
508
+ // it does not offer here (5:4, 4:5, 3:1, 1:3, 9:21).
503
509
  const GPT_IMAGE_2_RATIOS = ["auto", "1:1", "16:9", "9:16", "4:3", "3:4"] as const
504
510
  // GPT Image 2.5 (Flare + Sunburst) widen the set to thirteen — the GPT Image 2
505
511
  // six plus 3:2/2:3, ultra-wide 21:9/27:16, ultra-tall 16:27 and near-square
@@ -4183,7 +4189,9 @@ export function resolutionAtAspectRatio(
4183
4189
  * shape; the first listed ratio would reframe every source of another shape.
4184
4190
  * - Value outside the model's allow-list → snap to the model's default
4185
4191
  * (`defaultResolutionFor`) or the first valid option.
4186
- * - Then apply cross-field constraints that only hold for certain models.
4192
+ * - Then apply the cross-field constraints the catalog declares: a size the
4193
+ * ratio does not render (`resolutionsByAspectRatio`), and the size a
4194
+ * background setting renders at (`transparentResolution`).
4187
4195
  *
4188
4196
  * Unknown model ids pass through untouched — the route's Zod model enum is the
4189
4197
  * right gate for those, exactly as in `validateModelInput`.
@@ -4275,9 +4283,11 @@ export function normalizeModelInput(
4275
4283
  ? input.duration
4276
4284
  : snap("duration", input.duration, m.durations)
4277
4285
 
4278
- // A size the chosen ratio does not render (`resolutionsByAspectRatio`) moves
4279
- // to the largest one it does at or below it. Before the background rules
4280
- // below, which read the size this leaves, and before any price is built.
4286
+ // A size the chosen ratio does not render (`resolutionsByAspectRatio`: GPT
4287
+ // Image 2.5's four 1K-only ratios) moves to the largest one it does at or
4288
+ // below it. After the snaps above, so it sees the
4289
+ // ratio and size as they will be sent; before the background rules below,
4290
+ // which read the size this leaves, and before any price is built.
4281
4291
  const sized = resolutionAtAspectRatio(modelId, out.aspectRatio, out.resolution)
4282
4292
  if (out.resolution !== undefined && sized !== undefined && sized !== out.resolution) {
4283
4293
  const offered = resolutionsAtAspectRatio(modelId, out.aspectRatio) ?? [sized]
@@ -4290,29 +4300,6 @@ export function normalizeModelInput(
4290
4300
  out.resolution = sized
4291
4301
  }
4292
4302
 
4293
- // Cross-field constraints — a pair that is individually valid but jointly
4294
- // rejected upstream. GPT Image 2 (per docs.kie.ai): `auto` requires 1K, and
4295
- // 1:1 cannot go to 4K. Applied last so it sees the already-snapped values.
4296
- if (modelId === "gpt-image-2" || modelId === "gpt-image-2-i2i") {
4297
- if (out.aspectRatio === "auto" && out.resolution !== undefined && out.resolution !== "1K") {
4298
- adjustments.push({
4299
- field: "resolution",
4300
- from: out.resolution,
4301
- to: "1K",
4302
- reason: `${m.label} only renders 1K at the "auto" aspect ratio.`,
4303
- })
4304
- out.resolution = "1K"
4305
- } else if (out.aspectRatio === "1:1" && out.resolution === "4K") {
4306
- adjustments.push({
4307
- field: "resolution",
4308
- from: "4K",
4309
- to: "2K",
4310
- reason: `${m.label} cannot render 4K at a 1:1 aspect ratio.`,
4311
- })
4312
- out.resolution = "2K"
4313
- }
4314
- }
4315
-
4316
4303
  // A transparent background only renders at the size the provider allows it.
4317
4304
  // Priced after this, so the run pays for the size it renders.
4318
4305
  if (
@@ -1325,6 +1325,13 @@ export function isSeedanceVideoEditProvider(provider: string | undefined): provi
1325
1325
  export const VIDEO_TO_VIDEO_NODE_PROVIDERS = [...VIDEO_TO_VIDEO_PROVIDERS, ...SEEDANCE_VIDEO_EDIT_PROVIDERS] as const
1326
1326
  export type VideoToVideoNodeProvider = typeof VIDEO_TO_VIDEO_NODE_PROVIDERS[number]
1327
1327
 
1328
+ /**
1329
+ * The model a Video to Video request or node that names none runs on: the
1330
+ * route's and the worker's default, and what the node's model menu shows for an
1331
+ * unset model. One constant, so the server and the editor cannot disagree.
1332
+ */
1333
+ export const DEFAULT_VIDEO_TO_VIDEO_PROVIDER: VideoToVideoNodeProvider = "wan"
1334
+
1328
1335
  /**
1329
1336
  * The request shape Seedance edit mode requires, sent UP FRONT by the Video to
1330
1337
  * Video node: the output takes the source clip's own ratio and length
@@ -29,6 +29,9 @@ export const RUNTIME_CONFIG_KEYS = Object.freeze([
29
29
  "moderation",
30
30
  "previewStopRule",
31
31
  "mediaOrigin",
32
+ "flowUiOrigin",
33
+ "legacyUiHosts",
34
+ "linkOrigin",
32
35
  ] as const)
33
36
  export type RuntimeConfigKey = (typeof RUNTIME_CONFIG_KEYS)[number]
34
37
 
@@ -138,6 +141,20 @@ export interface NodaroRuntimeConfig {
138
141
  * beyond its own site.
139
142
  */
140
143
  readonly mediaOrigin?: string
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.
148
+ */
149
+ 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. */
151
+ readonly legacyUiHosts?: readonly string[]
152
+ /**
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.
156
+ */
157
+ readonly linkOrigin?: string
141
158
  }
142
159
 
143
160
  // ── Rules shared by the platform and its readers ─────────────────────────────
@@ -262,6 +279,17 @@ export function surfaceUnitLabel(labels: Readonly<Record<string, string>> | unde
262
279
  return typeof word === "string" && word.length > 0 ? word : single
263
280
  }
264
281
 
282
+ /**
283
+ * A host the app's pages move away from, on a deployment that moved them to a
284
+ * host of their own (`LEGACY_UI_HOSTS`, `legacyUiHosts`): a bare host name in
285
+ * lower case, with no scheme, port, path or space. The one rule for it: the
286
+ * server refuses to start on an entry that is not one, and a reader of
287
+ * /config.js drops it.
288
+ */
289
+ export function isLegacyUiHost(value: unknown): value is string {
290
+ return typeof value === "string" && /^[a-z0-9.-]+$/.test(value)
291
+ }
292
+
265
293
  /**
266
294
  * An https origin, spelled exactly as a browser spells one
267
295
  * (`https://media.example.com`, a port only when it is not 443): what
@@ -479,6 +507,12 @@ export function parseRuntimeConfig(raw: unknown): NodaroRuntimeConfig {
479
507
  if (isRecord(raw.moderation) && raw.moderation.uploadImage === true) out.moderation = { uploadImage: true }
480
508
  if (raw.previewStopRule === true) out.previewStopRule = true
481
509
  if (isHttpsOrigin(raw.mediaOrigin)) out.mediaOrigin = raw.mediaOrigin
510
+ if (isHttpsOrigin(raw.flowUiOrigin)) out.flowUiOrigin = raw.flowUiOrigin
511
+ if (Array.isArray(raw.legacyUiHosts)) {
512
+ const hosts = raw.legacyUiHosts.filter(isLegacyUiHost)
513
+ if (hosts.length > 0) out.legacyUiHosts = hosts
514
+ }
515
+ if (isHttpsOrigin(raw.linkOrigin)) out.linkOrigin = raw.linkOrigin
482
516
  return out
483
517
  }
484
518