@nodaro/shared 3.64.0 → 3.66.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 (208) hide show
  1. package/dist/{chunk-J6B7J73J.cjs → chunk-23IKLMRL.cjs} +49 -49
  2. package/dist/{chunk-J6B7J73J.cjs.map → chunk-23IKLMRL.cjs.map} +1 -1
  3. package/dist/chunk-27HA6YOL.cjs +377 -0
  4. package/dist/chunk-27HA6YOL.cjs.map +1 -0
  5. package/dist/{chunk-OOZW2MM6.cjs → chunk-37ZSFS6A.cjs} +9 -9
  6. package/dist/{chunk-OOZW2MM6.cjs.map → chunk-37ZSFS6A.cjs.map} +1 -1
  7. package/dist/{chunk-AZNZ5WNZ.cjs → chunk-3L7GMQ4M.cjs} +142 -45
  8. package/dist/chunk-3L7GMQ4M.cjs.map +1 -0
  9. package/dist/{chunk-SXHHLZ22.js → chunk-3QJ3UR5Z.js} +9 -9
  10. package/dist/{chunk-SXHHLZ22.js.map → chunk-3QJ3UR5Z.js.map} +1 -1
  11. package/dist/chunk-3YWZ5SOZ.js +164 -0
  12. package/dist/chunk-3YWZ5SOZ.js.map +1 -0
  13. package/dist/{chunk-TTGZ2L3O.js → chunk-5GG4CG4Y.js} +3 -3
  14. package/dist/{chunk-TTGZ2L3O.js.map → chunk-5GG4CG4Y.js.map} +1 -1
  15. package/dist/{chunk-3KTWYYCN.js → chunk-5IZHECUP.js} +3 -3
  16. package/dist/{chunk-3KTWYYCN.js.map → chunk-5IZHECUP.js.map} +1 -1
  17. package/dist/{chunk-Q2Y4JHF7.js → chunk-5J2LIQYU.js} +5 -5
  18. package/dist/{chunk-Q2Y4JHF7.js.map → chunk-5J2LIQYU.js.map} +1 -1
  19. package/dist/{chunk-SHH2T4CR.js → chunk-5LWYX4GV.js} +3 -3
  20. package/dist/{chunk-SHH2T4CR.js.map → chunk-5LWYX4GV.js.map} +1 -1
  21. package/dist/{chunk-7AJGUI7L.cjs → chunk-5NVGKXJV.cjs} +34 -17
  22. package/dist/chunk-5NVGKXJV.cjs.map +1 -0
  23. package/dist/{chunk-D4KWNDPH.cjs → chunk-66QSUUB4.cjs} +12 -12
  24. package/dist/{chunk-D4KWNDPH.cjs.map → chunk-66QSUUB4.cjs.map} +1 -1
  25. package/dist/{chunk-KHH54GRP.cjs → chunk-6ET3KDO4.cjs} +15 -338
  26. package/dist/chunk-6ET3KDO4.cjs.map +1 -0
  27. package/dist/{chunk-ZI3QDUHO.js → chunk-AT53ZQUC.js} +3 -3
  28. package/dist/{chunk-ZI3QDUHO.js.map → chunk-AT53ZQUC.js.map} +1 -1
  29. package/dist/chunk-BMDOPJBP.cjs +185 -0
  30. package/dist/chunk-BMDOPJBP.cjs.map +1 -0
  31. package/dist/{chunk-PJJAZQVZ.js → chunk-BNR5FKL5.js} +3 -3
  32. package/dist/{chunk-PJJAZQVZ.js.map → chunk-BNR5FKL5.js.map} +1 -1
  33. package/dist/{chunk-5OBTGNUQ.cjs → chunk-E62W5I6A.cjs} +298 -2
  34. package/dist/chunk-E62W5I6A.cjs.map +1 -0
  35. package/dist/{chunk-GTWUS6MQ.cjs → chunk-EFYWV2V5.cjs} +61 -61
  36. package/dist/{chunk-GTWUS6MQ.cjs.map → chunk-EFYWV2V5.cjs.map} +1 -1
  37. package/dist/chunk-F6XIH3TZ.cjs +168 -0
  38. package/dist/chunk-F6XIH3TZ.cjs.map +1 -0
  39. package/dist/{chunk-NIAFR5EE.js → chunk-FGBGKBML.js} +32 -3
  40. package/dist/chunk-FGBGKBML.js.map +1 -0
  41. package/dist/{chunk-YQV53HRR.cjs → chunk-G2G7XGFU.cjs} +7 -7
  42. package/dist/{chunk-YQV53HRR.cjs.map → chunk-G2G7XGFU.cjs.map} +1 -1
  43. package/dist/{chunk-7KQ6W5DS.js → chunk-GF7ZA26H.js} +4 -4
  44. package/dist/{chunk-7KQ6W5DS.js.map → chunk-GF7ZA26H.js.map} +1 -1
  45. package/dist/{chunk-SPAHI7DY.cjs → chunk-GNLA5NTT.cjs} +4 -4
  46. package/dist/{chunk-SPAHI7DY.cjs.map → chunk-GNLA5NTT.cjs.map} +1 -1
  47. package/dist/{chunk-VPTA4Z7G.js → chunk-GTBW2KAY.js} +5 -5
  48. package/dist/{chunk-VPTA4Z7G.js.map → chunk-GTBW2KAY.js.map} +1 -1
  49. package/dist/{chunk-CHS2SIP6.cjs → chunk-HTDKEYMY.cjs} +90 -76
  50. package/dist/chunk-HTDKEYMY.cjs.map +1 -0
  51. package/dist/{chunk-EXEVT6D2.cjs → chunk-IWUW3YPM.cjs} +5 -5
  52. package/dist/{chunk-EXEVT6D2.cjs.map → chunk-IWUW3YPM.cjs.map} +1 -1
  53. package/dist/{chunk-ACZZHHFZ.cjs → chunk-JTYCJ5OL.cjs} +44 -22
  54. package/dist/chunk-JTYCJ5OL.cjs.map +1 -0
  55. package/dist/{chunk-HDPJNNMF.cjs → chunk-M5QY464F.cjs} +21 -21
  56. package/dist/{chunk-HDPJNNMF.cjs.map → chunk-M5QY464F.cjs.map} +1 -1
  57. package/dist/{chunk-DZ4IOP3Q.js → chunk-MVXZP6VB.js} +281 -3
  58. package/dist/chunk-MVXZP6VB.js.map +1 -0
  59. package/dist/{chunk-Y4GCJJPF.cjs → chunk-NYZQOIXJ.cjs} +35 -2
  60. package/dist/chunk-NYZQOIXJ.cjs.map +1 -0
  61. package/dist/{chunk-KB2SQAR3.js → chunk-OFQ6CU6S.js} +3 -3
  62. package/dist/{chunk-KB2SQAR3.js.map → chunk-OFQ6CU6S.js.map} +1 -1
  63. package/dist/{chunk-36VWLB4J.js → chunk-OXBU5AGH.js} +3 -3
  64. package/dist/{chunk-36VWLB4J.js.map → chunk-OXBU5AGH.js.map} +1 -1
  65. package/dist/{chunk-CHTZZRAL.cjs → chunk-OXTF4Y3P.cjs} +6 -6
  66. package/dist/{chunk-CHTZZRAL.cjs.map → chunk-OXTF4Y3P.cjs.map} +1 -1
  67. package/dist/{chunk-3AYM47GW.js → chunk-PAUWEWTY.js} +99 -9
  68. package/dist/chunk-PAUWEWTY.js.map +1 -0
  69. package/dist/{chunk-FHGRKQVZ.cjs → chunk-PGDR7CO3.cjs} +8 -8
  70. package/dist/{chunk-FHGRKQVZ.cjs.map → chunk-PGDR7CO3.cjs.map} +1 -1
  71. package/dist/{chunk-W6VJAUGM.cjs → chunk-PJAJCFLP.cjs} +94 -37
  72. package/dist/chunk-PJAJCFLP.cjs.map +1 -0
  73. package/dist/{chunk-IYSOVS7O.js → chunk-RVQW623D.js} +31 -13
  74. package/dist/chunk-RVQW623D.js.map +1 -0
  75. package/dist/{chunk-TPQJKS7D.js → chunk-SCDE676D.js} +21 -7
  76. package/dist/{chunk-CHS2SIP6.cjs.map → chunk-SCDE676D.js.map} +1 -1
  77. package/dist/chunk-SW5ZD7BO.js +143 -0
  78. package/dist/chunk-SW5ZD7BO.js.map +1 -0
  79. package/dist/{chunk-T2OVDF2M.cjs → chunk-T4GIHHXY.cjs} +6 -6
  80. package/dist/{chunk-T2OVDF2M.cjs.map → chunk-T4GIHHXY.cjs.map} +1 -1
  81. package/dist/{chunk-QYU7J5EQ.js → chunk-V6OXSXIX.js} +29 -18
  82. package/dist/chunk-V6OXSXIX.js.map +1 -0
  83. package/dist/{chunk-W7KHHNZR.js → chunk-VBP4DH37.js} +61 -9
  84. package/dist/chunk-VBP4DH37.js.map +1 -0
  85. package/dist/{chunk-67CMMTLN.cjs → chunk-WZG6GZIL.cjs} +4 -4
  86. package/dist/{chunk-67CMMTLN.cjs.map → chunk-WZG6GZIL.cjs.map} +1 -1
  87. package/dist/{chunk-O4RPXBDZ.cjs → chunk-X2YHKP4D.cjs} +8 -8
  88. package/dist/{chunk-O4RPXBDZ.cjs.map → chunk-X2YHKP4D.cjs.map} +1 -1
  89. package/dist/{chunk-OBOOHG3N.js → chunk-XEPKONJC.js} +3 -3
  90. package/dist/{chunk-OBOOHG3N.js.map → chunk-XEPKONJC.js.map} +1 -1
  91. package/dist/{chunk-O7RZRUMZ.js → chunk-XJWED257.js} +14 -309
  92. package/dist/chunk-XJWED257.js.map +1 -0
  93. package/dist/chunk-XSSLNINL.js +346 -0
  94. package/dist/chunk-XSSLNINL.js.map +1 -0
  95. package/dist/{chunk-4IUE2JB7.js → chunk-Z77M7Q2R.js} +3 -3
  96. package/dist/{chunk-4IUE2JB7.js.map → chunk-Z77M7Q2R.js.map} +1 -1
  97. package/dist/entries/apps.cjs +42 -42
  98. package/dist/entries/apps.js +7 -7
  99. package/dist/entries/captions.d.cts +1 -1
  100. package/dist/entries/captions.d.ts +1 -1
  101. package/dist/entries/credits.cjs +230 -214
  102. package/dist/entries/credits.d.cts +51 -14
  103. package/dist/entries/credits.d.ts +51 -14
  104. package/dist/entries/credits.js +10 -10
  105. package/dist/entries/entities.cjs +202 -193
  106. package/dist/entries/entities.d.cts +44 -9
  107. package/dist/entries/entities.d.ts +44 -9
  108. package/dist/entries/entities.js +2 -1
  109. package/dist/entries/llm-models.cjs +86 -62
  110. package/dist/entries/llm-models.d.cts +46 -15
  111. package/dist/entries/llm-models.d.ts +46 -15
  112. package/dist/entries/llm-models.js +2 -2
  113. package/dist/entries/media.cjs +79 -63
  114. package/dist/entries/media.d.cts +154 -1
  115. package/dist/entries/media.d.ts +154 -1
  116. package/dist/entries/media.js +1 -1
  117. package/dist/entries/model-catalog.cjs +175 -119
  118. package/dist/entries/model-catalog.d.cts +4 -54
  119. package/dist/entries/model-catalog.d.ts +4 -54
  120. package/dist/entries/model-catalog.js +4 -4
  121. package/dist/entries/models.cjs +503 -358
  122. package/dist/entries/models.d.cts +86 -7
  123. package/dist/entries/models.d.ts +86 -7
  124. package/dist/entries/models.js +6 -5
  125. package/dist/entries/nodes.cjs +212 -212
  126. package/dist/entries/nodes.d.cts +1 -1
  127. package/dist/entries/nodes.d.ts +1 -1
  128. package/dist/entries/nodes.js +8 -8
  129. package/dist/entries/pipeline.cjs +153 -153
  130. package/dist/entries/pipeline.d.cts +3 -3
  131. package/dist/entries/pipeline.d.ts +3 -3
  132. package/dist/entries/pipeline.js +3 -3
  133. package/dist/entries/social.cjs +177 -177
  134. package/dist/entries/social.js +2 -2
  135. package/dist/entries/ugc.cjs +71 -71
  136. package/dist/entries/ugc.js +4 -4
  137. package/dist/entries/video.cjs +174 -145
  138. package/dist/entries/video.d.cts +119 -2
  139. package/dist/entries/video.d.ts +119 -2
  140. package/dist/entries/video.js +7 -6
  141. package/dist/entries/workflow.d.cts +1 -1
  142. package/dist/entries/workflow.d.ts +1 -1
  143. package/dist/index.cjs +2086 -1793
  144. package/dist/index.d.cts +10 -9
  145. package/dist/index.d.ts +10 -9
  146. package/dist/index.js +24 -23
  147. package/dist/{model-catalog-Cf9fkEUp.d.ts → model-catalog-B-aQnUS8.d.cts} +186 -2
  148. package/dist/{model-catalog-Cf9fkEUp.d.cts → model-catalog-B-aQnUS8.d.ts} +186 -2
  149. package/dist/{model-constants-C_Nyft_i.d.cts → model-constants-BstsUup6.d.cts} +105 -6
  150. package/dist/{model-constants-BxjiWVQ9.d.ts → model-constants-DZ3tPGFO.d.ts} +105 -6
  151. package/dist/tts-capabilities-BJ4N8MIB.d.ts +133 -0
  152. package/dist/tts-capabilities-Cf_4nu1Z.d.cts +133 -0
  153. package/package.json +1 -1
  154. package/src/__tests__/dialogue-capabilities.test.ts +167 -6
  155. package/src/__tests__/extend-providers.test.ts +87 -0
  156. package/src/__tests__/flux-3-klein.test.ts +51 -3
  157. package/src/__tests__/image-run-limit.test.ts +96 -0
  158. package/src/__tests__/kling4-catalog.test.ts +1 -1
  159. package/src/__tests__/llm-models.test.ts +41 -4
  160. package/src/__tests__/seedream-5-5.test.ts +17 -0
  161. package/src/__tests__/speech-pricing.test.ts +62 -1
  162. package/src/__tests__/tts-capabilities.test.ts +160 -4
  163. package/src/__tests__/video-analysis-pricing.test.ts +13 -1
  164. package/src/__tests__/video-subjects.test.ts +209 -0
  165. package/src/__tests__/wired-character-names.test.ts +142 -0
  166. package/src/credit-estimators/index.ts +4 -0
  167. package/src/credit-estimators/speech.ts +57 -9
  168. package/src/credit-identifiers.ts +48 -13
  169. package/src/dialogue-capabilities.ts +220 -3
  170. package/src/dubbing-structure.ts +186 -0
  171. package/src/entries/entities.ts +2 -0
  172. package/src/entries/llm-models.ts +7 -0
  173. package/src/entries/media.ts +3 -1
  174. package/src/entries/model-catalog.ts +17 -0
  175. package/src/entries/models.ts +43 -0
  176. package/src/entries/video.ts +8 -1
  177. package/src/gemini-tts.ts +144 -0
  178. package/src/llm-models.ts +71 -21
  179. package/src/model-catalog.ts +283 -2
  180. package/src/model-constants.ts +167 -8
  181. package/src/tts-capabilities.ts +193 -1
  182. package/src/video-analysis-pricing.ts +11 -0
  183. package/src/video-character-refs.ts +165 -3
  184. package/src/wired-character-names.ts +134 -18
  185. package/src/wired-character-video-subjects.ts +63 -0
  186. package/dist/chunk-3AYM47GW.js.map +0 -1
  187. package/dist/chunk-5OBTGNUQ.cjs.map +0 -1
  188. package/dist/chunk-6YIV37V7.js +0 -31
  189. package/dist/chunk-6YIV37V7.js.map +0 -1
  190. package/dist/chunk-7AJGUI7L.cjs.map +0 -1
  191. package/dist/chunk-ACZZHHFZ.cjs.map +0 -1
  192. package/dist/chunk-AZNZ5WNZ.cjs.map +0 -1
  193. package/dist/chunk-DZ4IOP3Q.js.map +0 -1
  194. package/dist/chunk-IYSOVS7O.js.map +0 -1
  195. package/dist/chunk-KHH54GRP.cjs.map +0 -1
  196. package/dist/chunk-NIAFR5EE.js.map +0 -1
  197. package/dist/chunk-O7RZRUMZ.js.map +0 -1
  198. package/dist/chunk-QYU7J5EQ.js.map +0 -1
  199. package/dist/chunk-S3UGLZSF.js +0 -42
  200. package/dist/chunk-S3UGLZSF.js.map +0 -1
  201. package/dist/chunk-TPQJKS7D.js.map +0 -1
  202. package/dist/chunk-TQW3R44P.cjs +0 -38
  203. package/dist/chunk-TQW3R44P.cjs.map +0 -1
  204. package/dist/chunk-VZ6TE23U.cjs +0 -54
  205. package/dist/chunk-VZ6TE23U.cjs.map +0 -1
  206. package/dist/chunk-W6VJAUGM.cjs.map +0 -1
  207. package/dist/chunk-W7KHHNZR.js.map +0 -1
  208. package/dist/chunk-Y4GCJJPF.cjs.map +0 -1
@@ -12,6 +12,7 @@ import {
12
12
  getMaxImagePromptChars,
13
13
  getMinImagePromptChars,
14
14
  imageReferenceLimit,
15
+ refusesImagesOverLimit,
15
16
  requestImageLimit,
16
17
  } from "../model-constants.js"
17
18
  import { isPricedPerInputImage, priceReadsInputImages, pricedEstimatedImages, pricedSentImages } from "../input-image-pricing.js"
@@ -49,11 +50,14 @@ describe("FLUX 3 Klein in the catalog", () => {
49
50
  expect(isFlux3KleinI2i(I2I)).toBe(true)
50
51
  })
51
52
 
52
- it("takes 1K, 2K and 4K, 1K when none is named", () => {
53
+ it("takes 1K, 2K and 4K, 1K when none is named, declared rather than read from the list's order", () => {
53
54
  for (const id of [T2I, I2I]) {
54
55
  expect(MODEL_CATALOG[id]!.resolutions).toEqual(["1K", "2K", "4K"])
55
- expect(MODEL_CATALOG[id]!.defaultResolution).toBeUndefined()
56
- expect(defaultResolutionFor(id)).toBeUndefined()
56
+ expect(MODEL_CATALOG[id]!.defaultResolution).toBe("1K")
57
+ expect(MODEL_CATALOG[id]!.defaultResolution).toBe(FLUX_3_KLEIN_DEFAULT_RESOLUTION)
58
+ expect(defaultResolutionFor(id)).toBe("1K")
59
+ // A size it does not list snaps to the declared default.
60
+ expect(normalizeModelInput(id, { resolution: "8K" }).resolution).toBe("1K")
57
61
  }
58
62
  expect(FLUX_3_KLEIN_DEFAULT_RESOLUTION).toBe("1K")
59
63
  expect(flux3KleinResolution(undefined)).toBe("1K")
@@ -186,6 +190,50 @@ describe("FLUX 3 Klein's place in the shared lists", () => {
186
190
  expect(requestImageLimit("flux-2-klein")).toBe(14)
187
191
  })
188
192
 
193
+ it("refuses a run over its 10 images rather than having one left out (decided 2026-11-12)", () => {
194
+ expect(refusesImagesOverLimit(T2I)).toBe(true)
195
+ expect(refusesImagesOverLimit(I2I)).toBe(true)
196
+ expect(MODEL_CATALOG[T2I]!.refusesImagesOverLimit).toBe(true)
197
+ expect(MODEL_CATALOG[I2I]!.refusesImagesOverLimit).toBe(true)
198
+ expect(refusesImagesOverLimit("flux-2-klein")).toBe(false)
199
+ expect(refusesImagesOverLimit(undefined)).toBe(false)
200
+ expect(refusesImagesOverLimit("not-a-model")).toBe(false)
201
+ })
202
+ })
203
+
204
+ describe("a model that refuses images over its limit (`refusesImagesOverLimit`)", () => {
205
+ const flagged = Object.values(MODEL_CATALOG).filter((m) => m.refusesImagesOverLimit === true)
206
+ const t2iOf = (i2i: string) => Object.keys(T2I_TO_I2I_VARIANT).filter((t2i) => T2I_TO_I2I_VARIANT[t2i] === i2i)
207
+
208
+ it("is FLUX 3 Klein alone today: every other model keeps its trim", () => {
209
+ expect(flagged.map((m) => m.id).sort()).toEqual([T2I, I2I])
210
+ })
211
+
212
+ it("is an image model that takes reference images", () => {
213
+ for (const m of flagged) {
214
+ expect(m.kind, m.id).toBe("image")
215
+ expect(imageReferenceLimit(m.id), m.id).toBeGreaterThan(0)
216
+ }
217
+ })
218
+
219
+ it("is flagged on both ids, so the id picked and the edit it moves onto refuse alike", () => {
220
+ for (const m of flagged) {
221
+ const edit = T2I_TO_I2I_VARIANT[m.id]
222
+ if (edit !== undefined) expect(refusesImagesOverLimit(edit), `${m.id} → ${edit}`).toBe(true)
223
+ for (const t2i of t2iOf(m.id)) expect(refusesImagesOverLimit(t2i), `${t2i} → ${m.id}`).toBe(true)
224
+ }
225
+ })
226
+
227
+ it("is refused at the same count the canvas and the assembler stop at", () => {
228
+ // The routes refuse past `requestImageLimit`; the canvas handles and a
229
+ // moodboard's free seats read `imageReferenceLimit`. A flagged model that
230
+ // let them differ would offer seats a run is then refused for.
231
+ for (const m of flagged) expect(imageReferenceLimit(m.id), m.id).toBe(requestImageLimit(m.id))
232
+ })
233
+ })
234
+
235
+ describe("FLUX 3 Klein's prompts and quality levels", () => {
236
+
189
237
  it("prompts of 1 to 5000 characters: the default cap, no minimum", () => {
190
238
  expect(getMaxImagePromptChars(T2I)).toBe(5000)
191
239
  expect(getMaxImagePromptChars(I2I)).toBe(5000)
@@ -0,0 +1,96 @@
1
+ /**
2
+ * What happens to images past a model's limit, by how the run was asked for
3
+ * (`refusesImagesOverLimitOn`, decided 2026-11-14):
4
+ *
5
+ * - a request (the API, MCP, the editor's Run of one node) is refused on every
6
+ * model with a request image limit of its own, saying how many to remove;
7
+ * - a workflow run is refused only on a model whose catalog entry carries
8
+ * `refusesImagesOverLimit` (FLUX 3 Klein), and every other model's workflow
9
+ * run keeps its documented trim, so a saved graph keeps running;
10
+ * - a model held to the default request limit is trimmed on both, as before.
11
+ *
12
+ * Read from the data (`requestImageLimit`'s table and the catalog flag), never
13
+ * from a list of ids, so a model that gains a request limit is covered.
14
+ */
15
+ import { describe, expect, it } from "vitest"
16
+ import { MODEL_CATALOG } from "../model-catalog.js"
17
+ import {
18
+ DEFAULT_REQUEST_IMAGE_LIMIT,
19
+ hasOwnRequestImageLimit,
20
+ imageReferenceLimit,
21
+ refusesImagesOverLimit,
22
+ refusesImagesOverLimitOn,
23
+ requestImageLimit,
24
+ } from "../model-constants.js"
25
+
26
+ /** Request-limited models whose workflow runs keep their trim: both ids each. */
27
+ const TRIMMED_IN_WORKFLOWS = [
28
+ "seedream-5-5",
29
+ "seedream-5-5-i2i",
30
+ "gpt-image-2-6-flare",
31
+ "gpt-image-2-6-flare-i2i",
32
+ "gpt-image-2-6-sunburst",
33
+ "gpt-image-2-6-sunburst-i2i",
34
+ "minimax-h3-image",
35
+ "minimax-h3-image-i2i",
36
+ ]
37
+ const REFUSED_EVERYWHERE = ["flux-3-klein", "flux-3-klein-i2i"]
38
+ /** Held to the default request limit: trimmed at their reference limit on every run. */
39
+ const UNCHANGED = ["nano-banana-pro", "flux-2-pro", "gpt-image-2-6-economy-i2i", "seedream-5-flash-i2i"]
40
+
41
+ const imageModels = Object.values(MODEL_CATALOG).filter((m) => m.kind === "image")
42
+
43
+ describe("a request over a model's image limit", () => {
44
+ it.each(TRIMMED_IN_WORKFLOWS)("%s refuses a request and keeps a workflow run's trim", (id) => {
45
+ expect(hasOwnRequestImageLimit(id)).toBe(true)
46
+ expect(refusesImagesOverLimitOn(id, "request")).toBe(true)
47
+ expect(refusesImagesOverLimitOn(id, "workflow")).toBe(false)
48
+ })
49
+
50
+ it.each(REFUSED_EVERYWHERE)("%s refuses a request and a workflow run alike", (id) => {
51
+ expect(refusesImagesOverLimitOn(id, "request")).toBe(true)
52
+ expect(refusesImagesOverLimitOn(id, "workflow")).toBe(true)
53
+ })
54
+
55
+ it.each(UNCHANGED)("%s, with no request limit of its own, is refused on neither", (id) => {
56
+ expect(hasOwnRequestImageLimit(id)).toBe(false)
57
+ expect(requestImageLimit(id)).toBe(DEFAULT_REQUEST_IMAGE_LIMIT)
58
+ expect(refusesImagesOverLimitOn(id, "request")).toBe(false)
59
+ expect(refusesImagesOverLimitOn(id, "workflow")).toBe(false)
60
+ })
61
+
62
+ it("names no model it does not know", () => {
63
+ expect(hasOwnRequestImageLimit(undefined)).toBe(false)
64
+ expect(hasOwnRequestImageLimit("not-a-model")).toBe(false)
65
+ expect(refusesImagesOverLimitOn(undefined, "request")).toBe(false)
66
+ })
67
+ })
68
+
69
+ describe("the rule, read from the data for every image model", () => {
70
+ it("a request is refused exactly where the model has a request limit of its own or the catalog flag", () => {
71
+ for (const m of imageModels) {
72
+ expect(refusesImagesOverLimitOn(m.id, "request"), m.id).toBe(hasOwnRequestImageLimit(m.id) || refusesImagesOverLimit(m.id))
73
+ }
74
+ })
75
+
76
+ it("a workflow run is refused exactly where the catalog carries the flag", () => {
77
+ for (const m of imageModels) {
78
+ expect(refusesImagesOverLimitOn(m.id, "workflow"), m.id).toBe(m.refusesImagesOverLimit === true)
79
+ }
80
+ })
81
+
82
+ it("a flagged model has a request limit of its own, so a workflow run and a request refuse the same count", () => {
83
+ for (const m of imageModels.filter((x) => x.refusesImagesOverLimit === true)) {
84
+ expect(hasOwnRequestImageLimit(m.id), m.id).toBe(true)
85
+ }
86
+ })
87
+
88
+ it("a request-limited model's reference limit is its request limit, so a workflow run's trim stops at the count a request may send", () => {
89
+ // The assembler trims a workflow run's references at `imageReferenceLimit`;
90
+ // a request is refused past `requestImageLimit`. Were they to differ, a
91
+ // workflow run would send a different number than a request may.
92
+ const limited = imageModels.filter((m) => hasOwnRequestImageLimit(m.id))
93
+ expect(limited.map((m) => m.id)).toEqual(expect.arrayContaining([...TRIMMED_IN_WORKFLOWS, ...REFUSED_EVERYWHERE]))
94
+ for (const m of limited) expect(imageReferenceLimit(m.id), m.id).toBe(requestImageLimit(m.id))
95
+ })
96
+ })
@@ -39,7 +39,7 @@ describe("kling-4 / kling-4-keyframes catalog", () => {
39
39
  })
40
40
 
41
41
  it("reference: subjects, voices and reference videos; keyframes: in-between frames on their own channel", () => {
42
- expect(VIDEO_REF_LIMITS_BY_PROVIDER["kling-4"]).toEqual({ images: 10, videos: 5, audio: 3, characters: 7, materials: 15 })
42
+ expect(VIDEO_REF_LIMITS_BY_PROVIDER["kling-4"]).toEqual({ images: 10, videos: 5, audio: 3, characters: 7, materials: 15, videoCharacters: 3 })
43
43
  expect(VIDEO_REF_VIDEO_DURATION_LIMITS["kling-4"]).toEqual({ minSec: 2, maxSec: 30, maxTotalSec: 30 })
44
44
  expect(hasFeature("kling-4", "character-subjects")).toBe(true)
45
45
  expect(VIDEO_REF_LIMITS_BY_PROVIDER["kling-4-keyframes"]).toEqual({ images: 8 })
@@ -15,6 +15,7 @@ import {
15
15
  getLlmModalityCaps,
16
16
  VIDEO_ANALYSIS_LLM_MODELS,
17
17
  VIDEO_ANALYSIS_TIERS,
18
+ resolveVideoAnalysisModel,
18
19
  buildLlmCreditIdentifier,
19
20
  resolveLlmCreditId,
20
21
  motionGraphicsFeature,
@@ -33,6 +34,13 @@ import {
33
34
  llmServesDirect,
34
35
  llmTierCreditIds,
35
36
  LLM_CREDIT_RUNGS,
37
+ LLM_MODALITY_CAPS,
38
+ LLM_FILE_MODELS,
39
+ LLM_REFERENCE_FILES_MAX,
40
+ LLM_REFERENCE_FILES_MAX_TOTAL_BYTES,
41
+ LLM_REFERENCE_FILES_MAX_PAGES,
42
+ LLM_REFERENCE_FILE_MIME_TYPES,
43
+ llmAcceptsFiles,
36
44
  } from "../llm-models.js"
37
45
  import type { LlmModelDef, LlmTier, LlmFeature } from "../llm-models.js"
38
46
  import { PIPELINE_ACCEPTED_SCRIPT_LLMS, PIPELINE_LEGACY_PINNED_SCRIPT_LLMS, PIPELINE_PINNABLE_SCRIPT_LLMS, PipelineConfigSchema } from "../pipeline-types.js"
@@ -1118,9 +1126,13 @@ describe("gemini-4-carbon exposure", () => {
1118
1126
  expect(Object.values(LLM_FEATURE_DEFAULTS)).not.toContain("gemini-4-carbon")
1119
1127
  })
1120
1128
 
1121
- it("stays OUT of video-analysis — image-only caps until its video + audio change", () => {
1122
- expect(getLlmModalityCaps("gemini-4-carbon")).toEqual({ image: true, video: false, audio: false })
1123
- expect(VIDEO_ANALYSIS_LLM_MODELS).not.toContain("gemini-4-carbon")
1129
+ it("reads video + audio and backs the video-analysis `ultra` tier (decided 2026-11-13)", () => {
1130
+ // Full caps are what enrol it in VIDEO_ANALYSIS_LLM_MODELS; the `ultra`
1131
+ // tier is the decision that comes with them.
1132
+ expect(getLlmModalityCaps("gemini-4-carbon")).toEqual({ image: true, video: true, audio: true })
1133
+ expect(VIDEO_ANALYSIS_LLM_MODELS).toContain("gemini-4-carbon")
1134
+ expect(VIDEO_ANALYSIS_TIERS.ultra).toBe("gemini-4-carbon")
1135
+ expect(resolveVideoAnalysisModel("ultra")).toBe("gemini-4-carbon")
1124
1136
  })
1125
1137
  })
1126
1138
 
@@ -1136,7 +1148,8 @@ describe("gpt-6.1-terra exposure", () => {
1136
1148
  expect(m.supportsTemperature).toBe(false)
1137
1149
  expect(m.kieCollapseStream).toBeUndefined()
1138
1150
  expect(supportsAdvancedMode("gpt-6.1-terra")).toBe(false)
1139
- expect(getLlmModalityCaps("gpt-6.1-terra")).toEqual({ image: true, video: false, audio: false })
1151
+ // Reads documents (PDF): the one model whose caps say `file` (2026-11-13).
1152
+ expect(getLlmModalityCaps("gpt-6.1-terra")).toEqual({ image: true, video: false, audio: false, file: true })
1140
1153
  })
1141
1154
 
1142
1155
  it("offers low…max but never `none`: a `none` request clamps to Auto (nothing sent)", () => {
@@ -1155,6 +1168,30 @@ describe("gpt-6.1-terra exposure", () => {
1155
1168
  })
1156
1169
  })
1157
1170
 
1171
+ describe("the `file` modality cap (documents, decided 2026-11-13)", () => {
1172
+ it("is declared on GPT-6.1 Terra alone, and never derived for another model", () => {
1173
+ expect(LLM_FILE_MODELS.map((m) => m.id)).toEqual(["gpt-6.1-terra"])
1174
+ expect(Object.entries(LLM_MODALITY_CAPS).filter(([, c]) => c.file).map(([id]) => id)).toEqual(["gpt-6.1-terra"])
1175
+ for (const m of LLM_MODELS) expect(llmAcceptsFiles(m.id), m.id).toBe(m.id === "gpt-6.1-terra")
1176
+ expect(llmAcceptsFiles(undefined)).toBe(false)
1177
+ expect(llmAcceptsFiles("no-such-model")).toBe(false)
1178
+ // Its siblings on the same endpoint do not read files here.
1179
+ expect(llmAcceptsFiles("gpt-6.1-sol")).toBe(false)
1180
+ expect(llmAcceptsFiles("gpt-5.6-terra")).toBe(false)
1181
+ })
1182
+
1183
+ it("PDF only, up to 5 files, 6 MB in all and 100 pages in all", () => {
1184
+ expect(LLM_REFERENCE_FILE_MIME_TYPES).toEqual(["application/pdf"])
1185
+ expect(LLM_REFERENCE_FILES_MAX).toBe(5)
1186
+ expect(LLM_REFERENCE_FILES_MAX_TOTAL_BYTES).toBe(6 * 1024 * 1024)
1187
+ expect(LLM_REFERENCE_FILES_MAX_PAGES).toBe(100)
1188
+ })
1189
+
1190
+ it("a document never enrolls a model in video analysis", () => {
1191
+ expect(VIDEO_ANALYSIS_LLM_MODELS).not.toContain("gpt-6.1-terra")
1192
+ })
1193
+ })
1194
+
1158
1195
  describe("kimi-k3.1-pro exposure", () => {
1159
1196
  it("premium Kimi on the openai responses wire with an enforced schema, KIE only", () => {
1160
1197
  const m = getLlmModel("kimi-k3.1-pro")!
@@ -4,7 +4,10 @@ import { resolveNormalizedImageGen } from "../credit-identifiers.js"
4
4
  import {
5
5
  IMAGE_RESOLUTION_VALUES,
6
6
  getMinImagePromptChars,
7
+ hasOwnRequestImageLimit,
7
8
  imageReferenceLimit,
9
+ refusesImagesOverLimit,
10
+ refusesImagesOverLimitOn,
8
11
  requestImageLimit,
9
12
  T2I_TO_I2I_VARIANT,
10
13
  } from "../model-constants.js"
@@ -82,6 +85,20 @@ describe("Seedream 5.5 input images", () => {
82
85
  expect(requestImageLimit("gpt-image-2-6-flare-i2i")).toBe(16)
83
86
  })
84
87
 
88
+ it("keeps its own rule past 10: a request with more is refused, a workflow run sends the first 10", () => {
89
+ // Its rule, since it shipped (decided 2026-11-14 for every model with a
90
+ // request limit of its own): nothing trims a request, so it is refused,
91
+ // saying how many to remove; a workflow run sends the first 10, so a saved
92
+ // graph keeps running. FLUX 3 Klein's refusal in a workflow run too is a
93
+ // catalog flag (`refusesImagesOverLimit`) Seedream 5.5 does not carry.
94
+ for (const id of ["seedream-5-5", "seedream-5-5-i2i"]) {
95
+ expect(hasOwnRequestImageLimit(id), id).toBe(true)
96
+ expect(refusesImagesOverLimitOn(id, "request"), id).toBe(true)
97
+ expect(refusesImagesOverLimitOn(id, "workflow"), id).toBe(false)
98
+ expect(refusesImagesOverLimit(id), id).toBe(false)
99
+ }
100
+ })
101
+
85
102
  it("is priced per input image, and counted as GPT Image 2.6 is", () => {
86
103
  expect(isPricedPerInputImage("seedream-5-5")).toBe(true)
87
104
  expect(isPricedPerInputImageEdit("seedream-5-5-i2i")).toBe(true)
@@ -3,10 +3,19 @@ import {
3
3
  SPEECH_PRICE_UNIT_CHARS,
4
4
  SPEECH_FLOOR_UNITS,
5
5
  SPEECH_UNIT_CREDIT_SUFFIX,
6
+ SPEECH_PER_1K_CREDIT_SUFFIX,
6
7
  speechUnitCreditId,
7
8
  speechPriceUnits,
8
9
  speechCredits,
10
+ speechCreditsFor,
11
+ speechRowCredits,
12
+ speechRowUnits,
13
+ speechQuoteCreditId,
14
+ parseSpeechQuoteCreditId,
15
+ isSpeechLengthPriceId,
16
+ speechLengthPriceModel,
9
17
  } from "../credit-estimators/speech.js"
18
+ import { getTtsCapabilities } from "../tts-capabilities.js"
10
19
  import { TTS_PROVIDERS, TTS_PROVIDER_ALIASES, canonicalTtsProvider } from "../index.js"
11
20
 
12
21
  describe("speech pricing — the unit", () => {
@@ -50,7 +59,7 @@ describe("speech pricing — the unit row id", () => {
50
59
  expect(SPEECH_UNIT_CREDIT_SUFFIX).toBe(":per-100-chars")
51
60
  for (const id of TTS_PROVIDERS) {
52
61
  if (id in TTS_PROVIDER_ALIASES) continue
53
- expect(speechUnitCreditId(id)).toBe(`${id}:per-100-chars`)
62
+ expect(speechUnitCreditId(id)).toBe(getTtsCapabilities(id).ratePer1kChars ? `${id}:per-1k-chars` : `${id}:per-100-chars`)
54
63
  }
55
64
  expect(speechUnitCreditId("elevenlabs-dialogue")).toBe("elevenlabs-dialogue:per-100-chars")
56
65
  })
@@ -67,3 +76,55 @@ describe("speech pricing — the unit row id", () => {
67
76
  expect(id.startsWith("elevenlabs-v4:")).toBe(true)
68
77
  })
69
78
  })
79
+
80
+ describe("speech pricing — a rate quoted per 1,000 characters (decided 2026-11-12)", () => {
81
+ it("names the per-1K row for a model whose sheet says so; the count stays started hundreds", () => {
82
+ expect(SPEECH_PER_1K_CREDIT_SUFFIX).toBe(":per-1k-chars")
83
+ expect(speechUnitCreditId("gemini-3-8-flash-lite-tts")).toBe("gemini-3-8-flash-lite-tts:per-1k-chars")
84
+ expect(speechRowUnits("gemini-2-5-pro-tts")).toBe(10)
85
+ expect(speechRowUnits("elevenlabs-v4")).toBe(1)
86
+ expect(speechRowUnits("elevenlabs")).toBe(1)
87
+ expect(speechRowUnits("not-a-model")).toBe(1)
88
+ })
89
+
90
+ // The worked examples in docs/nodes/ai-audio/text-to-speech.md (Gemini rows) are these — change both together.
91
+ it.each([
92
+ // [model, chars, row, base credits]
93
+ ["gemini-3-8-flash-lite-tts", 100, 4, 4], // 8 units × 4 ÷ 10 = 3.2 → 4
94
+ ["gemini-3-8-flash-lite-tts", 1000, 4, 4],
95
+ ["gemini-3-8-flash-tts", 800, 6, 5], // 4.8 → 5
96
+ ["gemini-3-8-flash-tts", 2050, 6, 13], // 21 × 6 ÷ 10 = 12.6 → 13
97
+ ["gemini-3-1-flash-tts", 1000, 13, 13],
98
+ ["gemini-3-1-flash-tts", 100, 13, 11], // 10.4 → 11
99
+ ["gemini-2-5-pro-tts", 10000, 16, 160],
100
+ ["gemini-2-5-pro-tts", 2050, 16, 34], // 33.6 → 34
101
+ ] as const)("%s, %i characters at %i per 1,000 → %i base credits", (model, chars, row, base) => {
102
+ expect(speechCreditsFor(model, chars, row)).toBe(base)
103
+ })
104
+
105
+ it("on a per-100 row it is exactly speechCredits", () => {
106
+ for (const chars of [0, 100, 801, 5000]) expect(speechCreditsFor("elevenlabs-v4", chars, 4)).toBe(speechCredits(chars, 4))
107
+ expect(speechRowCredits(9, 4)).toBe(36)
108
+ expect(speechRowCredits(9, 4, 10)).toBe(4)
109
+ })
110
+
111
+ it("the request quote keeps one id shape for every model, and reads back with its row and how many hundreds the row prices", () => {
112
+ expect(speechQuoteCreditId("gemini-3-1-flash-tts", 21)).toBe("gemini-3-1-flash-tts:per-100-chars:21u")
113
+ expect(parseSpeechQuoteCreditId("gemini-3-1-flash-tts:per-100-chars:21u")).toEqual({
114
+ model: "gemini-3-1-flash-tts",
115
+ unitId: "gemini-3-1-flash-tts:per-1k-chars",
116
+ units: 21,
117
+ rowUnits: 10,
118
+ })
119
+ expect(parseSpeechQuoteCreditId("elevenlabs-v4:per-100-chars:9u")).toMatchObject({ unitId: "elevenlabs-v4:per-100-chars", rowUnits: 1 })
120
+ // Its cap in started hundreds bounds N, as for every model.
121
+ expect(parseSpeechQuoteCreditId("gemini-3-1-flash-tts:per-100-chars:101u")).toBeUndefined()
122
+ })
123
+
124
+ it("a per-1K row is a length price, priced for its model", () => {
125
+ expect(isSpeechLengthPriceId("gemini-2-5-pro-tts:per-1k-chars")).toBe(true)
126
+ expect(speechLengthPriceModel("gemini-2-5-pro-tts:per-1k-chars")).toBe("gemini-2-5-pro-tts")
127
+ expect(isSpeechLengthPriceId("gemini-2-5-pro-tts:per-1k-chars:3u")).toBe(false)
128
+ expect(isSpeechLengthPriceId("gemini-2-5-pro-tts")).toBe(false)
129
+ })
130
+ })
@@ -1,6 +1,7 @@
1
+ import { replicaConsentProblem, replicaModels, replicaOf, ttsReplicaProblem, ttsTakesReplica } from "../tts-capabilities.js"
1
2
  import { describe, it, expect } from "vitest"
2
3
  import { MODEL_CATALOG, SPEECH_UNIT_PRICE_NOTE } from "../model-catalog.js"
3
- import { TTS_PROVIDERS, MAX_TTS_CHARS_BY_PROVIDER, getMaxTtsChars, TTS_TEXT_MAX } from "../model-constants.js"
4
+ import { TTS_PROVIDERS, MAX_TTS_CHARS_BY_PROVIDER, getMaxTtsChars, TTS_TEXT_MAX, DEFAULT_TTS_PROVIDER } from "../model-constants.js"
4
5
  import {
5
6
  TTS_PROVIDER_ALIASES,
6
7
  TTS_FALLBACK_PROVIDER,
@@ -13,6 +14,14 @@ import {
13
14
  ttsHasLever,
14
15
  ttsLanguageCodes,
15
16
  ttsSupportsTimestamps,
17
+ ttsNamedVoices,
18
+ ttsAcceptsVoice,
19
+ ttsNamedVoiceFor,
20
+ ttsAngleTags,
21
+ ttsDirection,
22
+ ttsDirectionFor,
23
+ ttsDirectionProblem,
24
+ ttsVoiceForModel,
16
25
  } from "../tts-capabilities.js"
17
26
 
18
27
  describe("speech-model capability sheets — totality", () => {
@@ -48,9 +57,12 @@ describe("speech-model capability sheets — totality", () => {
48
57
  for (const m of Object.values(MODEL_CATALOG)) {
49
58
  if (!m.tts) continue
50
59
  expect(Number.isInteger(m.tts.maxChars) && m.tts.maxChars > 0, `${m.id} maxChars`).toBe(true)
51
- expect(m.tts.levers, `${m.id} must honour stability`).toContain("stability")
60
+ // An ElevenLabs model honours stability; a named-voice model (Gemini) takes no ElevenLabs setting at all.
61
+ if (m.tts.voices) expect(m.tts.levers, `${m.id} takes no ElevenLabs lever`).toEqual([])
62
+ else expect(m.tts.levers, `${m.id} must honour stability`).toContain("stability")
52
63
  expect(new Set(m.tts.levers).size, `${m.id} duplicate lever`).toBe(m.tts.levers.length)
53
- expect(m.tts.languages.length, `${m.id} languages`).toBeGreaterThan(0)
64
+ // No language picker only where no language is ever sent (the text decides).
65
+ if (m.tts.languageCode) expect(m.tts.languages.length, `${m.id} languages`).toBeGreaterThan(0)
54
66
  expect(new Set(m.tts.languages).size, `${m.id} duplicate language`).toBe(m.tts.languages.length)
55
67
  // The `features` flag other packages already read must agree with the sheet.
56
68
  expect(m.features?.includes("audio-tags") ?? false, `${m.id} audio-tags feature`).toBe(m.tts.audioTags)
@@ -313,7 +325,7 @@ describe("elevenlabs-v4-turbo — the fast v4, added beside v4 (decided 2026-10-
313
325
  expect(getTtsCapabilities("elevenlabs-v3").maxChars).toBe(5000)
314
326
  expect(getTtsCapabilities("elevenlabs-turbo").maxChars).toBe(40000)
315
327
  expect(getTtsCapabilities("elevenlabs-multilingual").maxChars).toBe(10000)
316
- expect(TTS_PROVIDERS.filter((id) => id !== "elevenlabs-v4-turbo")).toEqual(["elevenlabs-v3", "elevenlabs-v4", "elevenlabs-turbo", "elevenlabs-multilingual", "elevenlabs"])
328
+ expect(TTS_PROVIDERS.filter((id) => id !== "elevenlabs-v4-turbo" && !id.startsWith("gemini-"))).toEqual(["elevenlabs-v3", "elevenlabs-v4", "elevenlabs-turbo", "elevenlabs-multilingual", "elevenlabs"])
317
329
  })
318
330
 
319
331
  it("the narration recommendation keeps v4 first and places v4 Turbo after v3, before Turbo v2.5", async () => {
@@ -373,3 +385,147 @@ describe("field mappings — the neighbour text fields are mappable", () => {
373
385
  expect(NODE_MAPPABLE_FIELDS["text-to-speech"]).toEqual(["directText", "previousText", "nextText"])
374
386
  })
375
387
  })
388
+
389
+ describe("Gemini speech — four models beside ElevenLabs (decided 2026-11-12)", () => {
390
+ const GEMINI_3_8 = ["gemini-3-8-flash-lite-tts", "gemini-3-8-flash-tts"]
391
+ const GEMINI_3_1 = ["gemini-3-1-flash-tts", "gemini-2-5-pro-tts"]
392
+
393
+ it("each is a text-to-speech model of Google's, priced per 1,000 characters; ElevenLabs v4 stays the default", () => {
394
+ for (const id of [...GEMINI_3_8, ...GEMINI_3_1]) {
395
+ expect(TTS_PROVIDERS as readonly string[]).toContain(id)
396
+ expect(MODEL_CATALOG[id]?.maker).toBe("google")
397
+ expect(MODEL_CATALOG[id]?.modes).toEqual(["tts", "dialogue"]) // one id for one speaker and two: dialogue priced on the one-speaker row by construction
398
+ expect(getTtsCapabilities(id).ratePer1kChars).toBe(true)
399
+ expect(MODEL_CATALOG[id]!.pricing.map((p) => p.identifier)).toEqual([id, `${id}:per-1k-chars`])
400
+ }
401
+ expect(DEFAULT_TTS_PROVIDER).toBe("elevenlabs-v4")
402
+ })
403
+
404
+ it("named voices only: 70 grouped by use on 3.8, the same 30 on 3.1 and 2.5; a voice of one list is not a voice of the other", () => {
405
+ for (const id of GEMINI_3_8) {
406
+ const voices = ttsNamedVoices(id)!
407
+ expect(voices).toHaveLength(70)
408
+ expect(voices.every((v) => v.group !== undefined)).toBe(true)
409
+ expect(new Set(voices.map((v) => v.id)).size).toBe(70)
410
+ expect(getTtsCapabilities(id).defaultVoice).toBe("Fola")
411
+ expect(ttsAcceptsVoice(id, "Fola")).toBe(true)
412
+ }
413
+ for (const id of GEMINI_3_1) {
414
+ expect(ttsNamedVoices(id)).toHaveLength(30)
415
+ expect(getTtsCapabilities(id).defaultVoice).toBe("Kore")
416
+ expect(ttsAcceptsVoice(id, "Fola")).toBe(false) // a 3.8 voice (KIE refuses it: 422)
417
+ expect(ttsAcceptsVoice(id, "Kore")).toBe(true)
418
+ }
419
+ // Every default is on its own list, and an ElevenLabs model takes any voice id (its own checks apply).
420
+ for (const id of [...GEMINI_3_8, ...GEMINI_3_1]) expect(ttsAcceptsVoice(id, getTtsCapabilities(id).defaultVoice!)).toBe(true)
421
+ expect(ttsNamedVoices("elevenlabs-v4")).toBeUndefined()
422
+ expect(ttsAcceptsVoice("elevenlabs-v4", "Rachel")).toBe(true)
423
+ })
424
+
425
+ it("ttsNamedVoiceFor: the voice asked for when the model speaks it, else the model's default; nothing on ElevenLabs", () => {
426
+ expect(ttsNamedVoiceFor("gemini-3-8-flash-tts", "Zephyr")).toBe("Zephyr")
427
+ expect(ttsNamedVoiceFor("gemini-3-8-flash-tts", "Rachel")).toBe("Fola")
428
+ expect(ttsNamedVoiceFor("gemini-3-1-flash-tts", undefined)).toBe("Kore")
429
+ expect(ttsNamedVoiceFor("elevenlabs-v4", "Rachel")).toBeUndefined()
430
+ })
431
+
432
+ it("no ElevenLabs lever, no language field, no timings, no neighbour text, a 10,000-character cap", () => {
433
+ for (const id of [...GEMINI_3_8, ...GEMINI_3_1]) {
434
+ const c = getTtsCapabilities(id)
435
+ expect(c).toMatchObject({ levers: [], languageCode: false, languages: [], timestamps: false, stitching: false, ssmlBreaks: false, maxChars: 10000, audioTags: true })
436
+ expect(getMaxTtsChars(id)).toBe(10000)
437
+ }
438
+ })
439
+
440
+ it("tags: 3.8 writes its own <angle> tags from a closed list; 3.1 / 2.5 take [square] tags as written", () => {
441
+ for (const id of GEMINI_3_8) {
442
+ expect(ttsAngleTags(id)).toContain("laugh")
443
+ expect(ttsAngleTags(id)).toContain("short pause")
444
+ expect(ttsAngleTags(id)).toHaveLength(40)
445
+ }
446
+ for (const id of [...GEMINI_3_1, "elevenlabs-v4"]) expect(ttsAngleTags(id)).toBeUndefined()
447
+ })
448
+
449
+ it("direction: free text per line on 3.8; style, pace, accent and audio profile on 3.1 / 2.5; none on ElevenLabs", () => {
450
+ for (const id of GEMINI_3_8) expect(ttsDirection(id)).toEqual({ styleMaxChars: 1000 })
451
+ for (const id of GEMINI_3_1) {
452
+ const d = ttsDirection(id)!
453
+ expect(d.styles).toContain("Deadpan")
454
+ expect(d.paces).toContain("Staccato")
455
+ expect(d.accents).toContain("British (RP)")
456
+ expect(d.audioProfileMaxChars).toBe(1000)
457
+ expect(d.styleMaxChars).toBeUndefined()
458
+ }
459
+ expect(ttsDirection("elevenlabs-v4")).toBeUndefined()
460
+ })
461
+
462
+ it("ttsDirectionFor keeps only what the model takes, trimmed; ttsDirectionProblem judges only that", () => {
463
+ const all = { styleDirection: " slow and dry ", pace: "Staccato", accent: "Australian", audioProfile: "A narrator" }
464
+ expect(ttsDirectionFor("gemini-3-8-flash-lite-tts", all)).toEqual({ styleDirection: "slow and dry" })
465
+ expect(ttsDirectionFor("gemini-3-1-flash-tts", { ...all, styleDirection: "Deadpan" })).toEqual({ styleDirection: "Deadpan", pace: "Staccato", accent: "Australian", audioProfile: "A narrator" })
466
+ expect(ttsDirectionFor("gemini-3-1-flash-tts", all)).toEqual({ pace: "Staccato", accent: "Australian", audioProfile: "A narrator" })
467
+ expect(ttsDirectionFor("elevenlabs-v4", all)).toEqual({})
468
+ expect(ttsDirectionProblem("gemini-3-8-flash-tts", all)).toBeUndefined()
469
+ expect(ttsDirectionProblem("gemini-3-8-flash-tts", { styleDirection: "x".repeat(1001) })).toMatchObject({ field: "styleDirection" })
470
+ expect(ttsDirectionProblem("gemini-3-1-flash-tts", all)).toMatchObject({ field: "styleDirection" })
471
+ expect(ttsDirectionProblem("gemini-3-1-flash-tts", { pace: "Slow" })).toMatchObject({ field: "pace" })
472
+ expect(ttsDirectionProblem("gemini-2-5-pro-tts", { accent: "" })).toBeUndefined()
473
+ expect(ttsDirectionProblem("elevenlabs-v4", { pace: "Slow" })).toBeUndefined()
474
+ })
475
+ })
476
+
477
+ describe("ttsVoiceForModel — the editor's model-switch rule where the editor is not there (decided 2026-11-13)", () => {
478
+ it("an ElevenLabs voice on a Gemini model becomes the model's default; a voice of its own list stays", () => {
479
+ expect(ttsVoiceForModel("gemini-3-8-flash-tts", "Rachel")).toBe("Fola")
480
+ expect(ttsVoiceForModel("gemini-3-1-flash-tts", "Fola")).toBe("Kore") // a 3.8 voice is not on 3.1's list
481
+ expect(ttsVoiceForModel("gemini-3-8-flash-tts", "Zephyr")).toBe("Zephyr")
482
+ expect(ttsVoiceForModel("gemini-2-5-pro-tts", "")).toBeUndefined()
483
+ expect(ttsVoiceForModel("gemini-2-5-pro-tts", undefined)).toBeUndefined()
484
+ })
485
+
486
+ it("a Gemini voice on an ElevenLabs model becomes no voice (the deployment's default); an ElevenLabs voice stays", () => {
487
+ expect(ttsVoiceForModel("elevenlabs-v4", "Fola")).toBeUndefined()
488
+ expect(ttsVoiceForModel("elevenlabs-turbo", "Kore")).toBeUndefined()
489
+ expect(ttsVoiceForModel("elevenlabs-v4", "Rachel")).toBe("Rachel")
490
+ expect(ttsVoiceForModel("elevenlabs-v4", "21m00Tcm4TlvDq8ikWAM")).toBe("21m00Tcm4TlvDq8ikWAM")
491
+ expect(ttsVoiceForModel(undefined, "Puck")).toBeUndefined() // no model: the fallback model, ElevenLabs
492
+ })
493
+
494
+ it("no Gemini voice name is also an ElevenLabs premade name", () => {
495
+ const premade = ["Rachel", "Aria", "Roger", "Sarah", "Laura", "Charlie", "George", "Callum", "River", "Liam", "Charlotte", "Alice", "Matilda", "Will", "Jessica", "Eric", "Chris", "Brian", "Daniel", "Lily", "Bill"]
496
+ for (const id of ["gemini-3-8-flash-tts", "gemini-3-1-flash-tts"]) {
497
+ for (const v of ttsNamedVoices(id)!) expect(premade, v.id).not.toContain(v.id)
498
+ }
499
+ })
500
+ })
501
+
502
+ describe("a one-off clone (replica, decided 2026-11-13)", () => {
503
+ it("3.8 Flash takes it; 3.8 Flash-Lite (KIE refuses it), 3.1, 2.5 and every ElevenLabs model do not", () => {
504
+ expect(ttsTakesReplica("gemini-3-8-flash-tts")).toBe(true)
505
+ for (const id of ["gemini-3-8-flash-lite-tts", "gemini-3-1-flash-tts", "gemini-2-5-pro-tts", "elevenlabs-v4", undefined]) expect(ttsTakesReplica(id), String(id)).toBe(false)
506
+ expect(replicaModels()).toEqual(["gemini-3-8-flash-tts"])
507
+ })
508
+
509
+ it("replicaOf reads two https links; ttsReplicaProblem refuses one on a model that does not clone, and a malformed one", () => {
510
+ const ok = { sourceAudioUrl: "https://a.example/s.wav", consentAudioUrl: "https://a.example/c.wav" }
511
+ expect(replicaOf(ok)).toEqual(ok)
512
+ expect(replicaOf({ ...ok, sourceAudioUrl: "http://a.example/s.wav" })).toBeUndefined()
513
+ expect(replicaOf({ sourceAudioUrl: "https://a" })).toBeUndefined()
514
+ expect(ttsReplicaProblem("gemini-3-8-flash-tts", ok)).toBeUndefined()
515
+ expect(ttsReplicaProblem("gemini-3-8-flash-tts", undefined)).toBeUndefined()
516
+ expect(ttsReplicaProblem("gemini-3-8-flash-lite-tts", ok)).toBe("gemini-3-8-flash-lite-tts does not clone a voice; a one-off clone runs on gemini-3-8-flash-tts")
517
+ expect(ttsReplicaProblem("gemini-3-8-flash-tts", { sourceAudioUrl: "file:///etc/passwd", consentAudioUrl: ok.consentAudioUrl })).toMatch(/https link/)
518
+ })
519
+ })
520
+
521
+ describe("a one-off clone's consent on the API and MCP (decided 2026-11-13)", () => {
522
+ it("a clone must say consent: true; none asked is no problem", () => {
523
+ const links = { sourceAudioUrl: "https://a.example/s.wav", consentAudioUrl: "https://a.example/c.wav" }
524
+ expect(replicaConsentProblem(undefined)).toBeUndefined()
525
+ expect(replicaConsentProblem({ ...links, consent: true })).toBeUndefined()
526
+ for (const replica of [links, { ...links, consent: false }, { ...links, consent: "yes" }]) {
527
+ expect(replicaConsentProblem(replica)).toMatch(/^replica\.consent must be true: it confirms "I confirm the voice in these recordings is my own/)
528
+ }
529
+ })
530
+ })
531
+
@@ -60,7 +60,7 @@ describe("video-analysis-pricing", () => {
60
60
  })
61
61
 
62
62
  it("model SSOT is capability-derived and Gemini-only today", () => {
63
- expect(VIDEO_ANALYSIS_LLM_MODELS).toEqual(["gemini-3-flash", "gemini-3.6-flash", "gemini-3.8-flash", "gemini-3.1-pro"])
63
+ expect(VIDEO_ANALYSIS_LLM_MODELS).toEqual(["gemini-3-flash", "gemini-3.6-flash", "gemini-3.8-flash", "gemini-3.1-pro", "gemini-4-carbon"])
64
64
  })
65
65
 
66
66
  it("tier layer: every model-backed tier maps to a real model AND every model is tier-reachable or explicitly legacy (no vendor leak)", () => {
@@ -107,6 +107,8 @@ describe("video-analysis-pricing", () => {
107
107
  // channel (2026-11-13); gemini-3-flash is now a legacy fast backing.
108
108
  expect(resolveVideoAnalysisModel("fast")).toBe("gemini-3.8-flash")
109
109
  expect(VIDEO_ANALYSIS_LEGACY_MODELS["gemini-3-flash"]).toBe("fast")
110
+ // `ultra` (2026-11-13) is model-backed like fast and pro.
111
+ expect(resolveVideoAnalysisModel("ultra")).toBe("gemini-4-carbon")
110
112
  expect(resolveVideoAnalysisModel("mixed")).toBe("mixed") // roll-plan sentinel passthrough
111
113
  expect(resolveVideoAnalysisModel("mixed-fast")).toBe("mixed-fast")
112
114
  // `smart` is a sentinel too — it names an engine plan, never a model id, so the
@@ -121,6 +123,16 @@ describe("video-analysis-pricing", () => {
121
123
  expect(resolveVideoAnalysisModel("nonsense")).toBe("gemini-3.1-pro") // unknown → default, never throws
122
124
  })
123
125
 
126
+ it("ultra prices under its own model's family, above mixed and below smart in every bucket", () => {
127
+ for (const bucketSec of VIDEO_ANALYSIS_DURATION_BUCKETS) {
128
+ const id = buildVideoAnalysisCreditId(resolveVideoAnalysisModel("ultra"), bucketSec)
129
+ expect(id).toBe(`video-analysis:gemini-4-carbon:${bucketSec}s`)
130
+ const ultra = VIDEO_ANALYSIS_BUCKET_CREDITS[id]!
131
+ expect(ultra, `ultra <= mixed at ${bucketSec}s`).toBeGreaterThan(VIDEO_ANALYSIS_BUCKET_CREDITS[`video-analysis:mixed:${bucketSec}s`]!)
132
+ expect(ultra, `ultra >= smart at ${bucketSec}s`).toBeLessThan(VIDEO_ANALYSIS_BUCKET_CREDITS[`video-analysis:smart:${bucketSec}s`]!)
133
+ }
134
+ })
135
+
124
136
  it("mixed tiers price under ONE shared credit family (video-analysis:mixed:*)", () => {
125
137
  // Both variants are the identical compute plan — a per-variant price split
126
138
  // would be a phantom distinction and double the admin surface.