@nodaro/shared 3.64.0 → 3.65.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 (205) hide show
  1. package/dist/{chunk-PJJAZQVZ.js → chunk-222QM7CO.js} +3 -3
  2. package/dist/{chunk-PJJAZQVZ.js.map → chunk-222QM7CO.js.map} +1 -1
  3. package/dist/chunk-27HA6YOL.cjs +377 -0
  4. package/dist/chunk-27HA6YOL.cjs.map +1 -0
  5. package/dist/{chunk-TTGZ2L3O.js → chunk-2NKF476Z.js} +3 -3
  6. package/dist/{chunk-TTGZ2L3O.js.map → chunk-2NKF476Z.js.map} +1 -1
  7. package/dist/chunk-3AU52TSW.js +143 -0
  8. package/dist/chunk-3AU52TSW.js.map +1 -0
  9. package/dist/{chunk-7AJGUI7L.cjs → chunk-5NVGKXJV.cjs} +34 -17
  10. package/dist/chunk-5NVGKXJV.cjs.map +1 -0
  11. package/dist/{chunk-3AYM47GW.js → chunk-5SSMPYE5.js} +99 -9
  12. package/dist/chunk-5SSMPYE5.js.map +1 -0
  13. package/dist/{chunk-KHH54GRP.cjs → chunk-6ET3KDO4.cjs} +15 -338
  14. package/dist/chunk-6ET3KDO4.cjs.map +1 -0
  15. package/dist/{chunk-ACZZHHFZ.cjs → chunk-6OSIOVF7.cjs} +44 -22
  16. package/dist/chunk-6OSIOVF7.cjs.map +1 -0
  17. package/dist/{chunk-OBOOHG3N.js → chunk-6X5PBAC4.js} +3 -3
  18. package/dist/{chunk-OBOOHG3N.js.map → chunk-6X5PBAC4.js.map} +1 -1
  19. package/dist/chunk-7BN4EDIC.cjs +185 -0
  20. package/dist/chunk-7BN4EDIC.cjs.map +1 -0
  21. package/dist/{chunk-IYSOVS7O.js → chunk-7OWXHW7Z.js} +31 -13
  22. package/dist/chunk-7OWXHW7Z.js.map +1 -0
  23. package/dist/{chunk-ZI3QDUHO.js → chunk-AT53ZQUC.js} +3 -3
  24. package/dist/{chunk-ZI3QDUHO.js.map → chunk-AT53ZQUC.js.map} +1 -1
  25. package/dist/{chunk-SHH2T4CR.js → chunk-BSTAAGLY.js} +3 -3
  26. package/dist/{chunk-SHH2T4CR.js.map → chunk-BSTAAGLY.js.map} +1 -1
  27. package/dist/{chunk-DZ4IOP3Q.js → chunk-CW6MMQNO.js} +277 -3
  28. package/dist/chunk-CW6MMQNO.js.map +1 -0
  29. package/dist/{chunk-Q2Y4JHF7.js → chunk-D5Y3EYRM.js} +5 -5
  30. package/dist/{chunk-Q2Y4JHF7.js.map → chunk-D5Y3EYRM.js.map} +1 -1
  31. package/dist/{chunk-EXEVT6D2.cjs → chunk-DQ2PARNH.cjs} +5 -5
  32. package/dist/{chunk-EXEVT6D2.cjs.map → chunk-DQ2PARNH.cjs.map} +1 -1
  33. package/dist/{chunk-OOZW2MM6.cjs → chunk-E66HSC2E.cjs} +9 -9
  34. package/dist/{chunk-OOZW2MM6.cjs.map → chunk-E66HSC2E.cjs.map} +1 -1
  35. package/dist/{chunk-NIAFR5EE.js → chunk-FGBGKBML.js} +32 -3
  36. package/dist/chunk-FGBGKBML.js.map +1 -0
  37. package/dist/{chunk-5OBTGNUQ.cjs → chunk-FI3HJZWM.cjs} +294 -2
  38. package/dist/chunk-FI3HJZWM.cjs.map +1 -0
  39. package/dist/{chunk-SPAHI7DY.cjs → chunk-FJZTQTF4.cjs} +4 -4
  40. package/dist/{chunk-SPAHI7DY.cjs.map → chunk-FJZTQTF4.cjs.map} +1 -1
  41. package/dist/{chunk-J6B7J73J.cjs → chunk-GJ3D5X4X.cjs} +49 -49
  42. package/dist/{chunk-J6B7J73J.cjs.map → chunk-GJ3D5X4X.cjs.map} +1 -1
  43. package/dist/{chunk-KB2SQAR3.js → chunk-H745DQ6V.js} +3 -3
  44. package/dist/{chunk-KB2SQAR3.js.map → chunk-H745DQ6V.js.map} +1 -1
  45. package/dist/{chunk-7KQ6W5DS.js → chunk-HAH2F7LT.js} +4 -4
  46. package/dist/{chunk-7KQ6W5DS.js.map → chunk-HAH2F7LT.js.map} +1 -1
  47. package/dist/{chunk-HDPJNNMF.cjs → chunk-JQMFJAYU.cjs} +21 -21
  48. package/dist/{chunk-HDPJNNMF.cjs.map → chunk-JQMFJAYU.cjs.map} +1 -1
  49. package/dist/{chunk-D4KWNDPH.cjs → chunk-JYU5EIRM.cjs} +12 -12
  50. package/dist/{chunk-D4KWNDPH.cjs.map → chunk-JYU5EIRM.cjs.map} +1 -1
  51. package/dist/{chunk-AZNZ5WNZ.cjs → chunk-K6RIN3LW.cjs} +142 -45
  52. package/dist/chunk-K6RIN3LW.cjs.map +1 -0
  53. package/dist/{chunk-YQV53HRR.cjs → chunk-KTCEKGBJ.cjs} +7 -7
  54. package/dist/{chunk-YQV53HRR.cjs.map → chunk-KTCEKGBJ.cjs.map} +1 -1
  55. package/dist/{chunk-W6VJAUGM.cjs → chunk-KWYS4IIM.cjs} +83 -37
  56. package/dist/chunk-KWYS4IIM.cjs.map +1 -0
  57. package/dist/{chunk-GTWUS6MQ.cjs → chunk-MIT2USTS.cjs} +61 -61
  58. package/dist/{chunk-GTWUS6MQ.cjs.map → chunk-MIT2USTS.cjs.map} +1 -1
  59. package/dist/{chunk-Y4GCJJPF.cjs → chunk-NYZQOIXJ.cjs} +35 -2
  60. package/dist/chunk-NYZQOIXJ.cjs.map +1 -0
  61. package/dist/{chunk-FHGRKQVZ.cjs → chunk-PGDR7CO3.cjs} +8 -8
  62. package/dist/{chunk-FHGRKQVZ.cjs.map → chunk-PGDR7CO3.cjs.map} +1 -1
  63. package/dist/{chunk-W7KHHNZR.js → chunk-PL7AQQV7.js} +53 -9
  64. package/dist/chunk-PL7AQQV7.js.map +1 -0
  65. package/dist/chunk-Q4YOLT4M.js +164 -0
  66. package/dist/chunk-Q4YOLT4M.js.map +1 -0
  67. package/dist/{chunk-CHS2SIP6.cjs → chunk-R5ILCNCC.cjs} +90 -76
  68. package/dist/chunk-R5ILCNCC.cjs.map +1 -0
  69. package/dist/chunk-RP4KQUNU.cjs +168 -0
  70. package/dist/chunk-RP4KQUNU.cjs.map +1 -0
  71. package/dist/{chunk-CHTZZRAL.cjs → chunk-SPU7MUWE.cjs} +6 -6
  72. package/dist/{chunk-CHTZZRAL.cjs.map → chunk-SPU7MUWE.cjs.map} +1 -1
  73. package/dist/{chunk-VPTA4Z7G.js → chunk-ST7OBB5J.js} +5 -5
  74. package/dist/{chunk-VPTA4Z7G.js.map → chunk-ST7OBB5J.js.map} +1 -1
  75. package/dist/{chunk-TPQJKS7D.js → chunk-V5NLQ4L5.js} +21 -7
  76. package/dist/{chunk-CHS2SIP6.cjs.map → chunk-V5NLQ4L5.js.map} +1 -1
  77. package/dist/{chunk-QYU7J5EQ.js → chunk-V6OXSXIX.js} +29 -18
  78. package/dist/chunk-V6OXSXIX.js.map +1 -0
  79. package/dist/{chunk-T2OVDF2M.cjs → chunk-WQMPIURW.cjs} +6 -6
  80. package/dist/{chunk-T2OVDF2M.cjs.map → chunk-WQMPIURW.cjs.map} +1 -1
  81. package/dist/{chunk-67CMMTLN.cjs → chunk-WZG6GZIL.cjs} +4 -4
  82. package/dist/{chunk-67CMMTLN.cjs.map → chunk-WZG6GZIL.cjs.map} +1 -1
  83. package/dist/{chunk-36VWLB4J.js → chunk-XJANKTIL.js} +3 -3
  84. package/dist/{chunk-36VWLB4J.js.map → chunk-XJANKTIL.js.map} +1 -1
  85. package/dist/{chunk-O7RZRUMZ.js → chunk-XJWED257.js} +14 -309
  86. package/dist/chunk-XJWED257.js.map +1 -0
  87. package/dist/chunk-XSSLNINL.js +346 -0
  88. package/dist/chunk-XSSLNINL.js.map +1 -0
  89. package/dist/{chunk-O4RPXBDZ.cjs → chunk-YD4XY74W.cjs} +8 -8
  90. package/dist/{chunk-O4RPXBDZ.cjs.map → chunk-YD4XY74W.cjs.map} +1 -1
  91. package/dist/{chunk-SXHHLZ22.js → chunk-YMZUE2IX.js} +9 -9
  92. package/dist/{chunk-SXHHLZ22.js.map → chunk-YMZUE2IX.js.map} +1 -1
  93. package/dist/{chunk-4IUE2JB7.js → chunk-Z77M7Q2R.js} +3 -3
  94. package/dist/{chunk-4IUE2JB7.js.map → chunk-Z77M7Q2R.js.map} +1 -1
  95. package/dist/{chunk-3KTWYYCN.js → chunk-ZSRXY5YT.js} +3 -3
  96. package/dist/{chunk-3KTWYYCN.js.map → chunk-ZSRXY5YT.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 +491 -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 +114 -2
  139. package/dist/entries/video.d.ts +114 -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 +2074 -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-BoUKGFNl.d.cts} +167 -1
  148. package/dist/{model-catalog-Cf9fkEUp.d.cts → model-catalog-BoUKGFNl.d.ts} +167 -1
  149. package/dist/{model-constants-BxjiWVQ9.d.ts → model-constants-BElS3AeE.d.ts} +55 -6
  150. package/dist/{model-constants-C_Nyft_i.d.cts → model-constants-CpQz1bGa.d.cts} +55 -6
  151. package/dist/tts-capabilities-BtnDWK9K.d.ts +133 -0
  152. package/dist/tts-capabilities-C52UccTI.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__/kling4-catalog.test.ts +1 -1
  157. package/src/__tests__/llm-models.test.ts +41 -4
  158. package/src/__tests__/speech-pricing.test.ts +62 -1
  159. package/src/__tests__/tts-capabilities.test.ts +160 -4
  160. package/src/__tests__/video-analysis-pricing.test.ts +13 -1
  161. package/src/__tests__/video-subjects.test.ts +192 -0
  162. package/src/__tests__/wired-character-names.test.ts +142 -0
  163. package/src/credit-estimators/index.ts +4 -0
  164. package/src/credit-estimators/speech.ts +57 -9
  165. package/src/credit-identifiers.ts +48 -13
  166. package/src/dialogue-capabilities.ts +220 -3
  167. package/src/dubbing-structure.ts +186 -0
  168. package/src/entries/entities.ts +2 -0
  169. package/src/entries/llm-models.ts +7 -0
  170. package/src/entries/media.ts +3 -1
  171. package/src/entries/model-catalog.ts +17 -0
  172. package/src/entries/models.ts +39 -0
  173. package/src/entries/video.ts +8 -1
  174. package/src/gemini-tts.ts +144 -0
  175. package/src/llm-models.ts +71 -21
  176. package/src/model-catalog.ts +259 -0
  177. package/src/model-constants.ts +101 -8
  178. package/src/tts-capabilities.ts +193 -1
  179. package/src/video-analysis-pricing.ts +11 -0
  180. package/src/video-character-refs.ts +160 -3
  181. package/src/wired-character-names.ts +134 -18
  182. package/src/wired-character-video-subjects.ts +63 -0
  183. package/dist/chunk-3AYM47GW.js.map +0 -1
  184. package/dist/chunk-5OBTGNUQ.cjs.map +0 -1
  185. package/dist/chunk-6YIV37V7.js +0 -31
  186. package/dist/chunk-6YIV37V7.js.map +0 -1
  187. package/dist/chunk-7AJGUI7L.cjs.map +0 -1
  188. package/dist/chunk-ACZZHHFZ.cjs.map +0 -1
  189. package/dist/chunk-AZNZ5WNZ.cjs.map +0 -1
  190. package/dist/chunk-DZ4IOP3Q.js.map +0 -1
  191. package/dist/chunk-IYSOVS7O.js.map +0 -1
  192. package/dist/chunk-KHH54GRP.cjs.map +0 -1
  193. package/dist/chunk-NIAFR5EE.js.map +0 -1
  194. package/dist/chunk-O7RZRUMZ.js.map +0 -1
  195. package/dist/chunk-QYU7J5EQ.js.map +0 -1
  196. package/dist/chunk-S3UGLZSF.js +0 -42
  197. package/dist/chunk-S3UGLZSF.js.map +0 -1
  198. package/dist/chunk-TPQJKS7D.js.map +0 -1
  199. package/dist/chunk-TQW3R44P.cjs +0 -38
  200. package/dist/chunk-TQW3R44P.cjs.map +0 -1
  201. package/dist/chunk-VZ6TE23U.cjs +0 -54
  202. package/dist/chunk-VZ6TE23U.cjs.map +0 -1
  203. package/dist/chunk-W6VJAUGM.cjs.map +0 -1
  204. package/dist/chunk-W7KHHNZR.js.map +0 -1
  205. package/dist/chunk-Y4GCJJPF.cjs.map +0 -1
@@ -0,0 +1,133 @@
1
+ import { a0 as TtsReplica, Z as TtsCapabilities, _ as TtsDirectionSheet, a2 as TtsSettingLever, $ as TtsNamedVoice } from './model-catalog-BoUKGFNl.cjs';
2
+
3
+ /**
4
+ * Capability lookups for the text-to-speech lane.
5
+ *
6
+ * Every "does this model do X" decision on that lane reads the model's `tts`
7
+ * sheet in `MODEL_CATALOG` through these helpers — tag stripping, which voice
8
+ * settings are sent and shown, the language picker, whether neighbouring text
9
+ * is sent. Declare the sheet honestly
10
+ * on the catalog entry and a new model is covered everywhere; do not compare a
11
+ * provider id by hand.
12
+ *
13
+ * "The text-to-speech lane" means the models that list the `tts` mode. The
14
+ * dialogue models carry a sheet too, read by `dialogue-capabilities.ts`; a
15
+ * text-to-speech request that names one runs as the fallback model, so these
16
+ * helpers answer for the fallback there.
17
+ */
18
+
19
+ /** Legacy provider ids that are another model under an old name. They have no catalog entry of their own. */
20
+ declare const TTS_PROVIDER_ALIASES: Readonly<Record<string, string>>;
21
+ /** The model a request runs on when its provider id is missing or unknown. */
22
+ declare const TTS_FALLBACK_PROVIDER = "elevenlabs-turbo";
23
+ /**
24
+ * Resolve a legacy alias to the catalog id it runs as. Any other id passes
25
+ * through unchanged. Own properties only: an id that happens to be the name of
26
+ * an inherited object member (`constructor`, `__proto__`, `toString`) is an
27
+ * unknown id like any other, never a function.
28
+ */
29
+ declare function canonicalTtsProvider(provider: string): string;
30
+ /**
31
+ * The capability sheet a text-to-speech request will actually run under: a
32
+ * missing or unknown provider id runs as {@link TTS_FALLBACK_PROVIDER}, so it
33
+ * gets that sheet — including its `maxChars` (turbo's 40,000), where
34
+ * `getMaxTtsChars` keeps answering its 5,000 default for such ids.
35
+ */
36
+ declare function getTtsCapabilities(provider: string | undefined): TtsCapabilities;
37
+ /** The model performs inline `[audio tags]`. false ⇒ strip them before sending. */
38
+ declare function ttsSupportsAudioTags(provider: string | undefined): boolean;
39
+ /** The model honours SSML `<break time="…"/>` tags. */
40
+ declare function ttsSupportsSsmlBreaks(provider: string | undefined): boolean;
41
+ /**
42
+ * The model conditions on neighbouring text (`previous_text` / `next_text`).
43
+ * false ⇒ the provider funnel never puts the fields on the wire, whatever the
44
+ * request carries — the model would reject them.
45
+ */
46
+ declare function ttsSupportsStitching(provider: string | undefined): boolean;
47
+ /** The model honours this voice-setting lever. */
48
+ declare function ttsHasLever(provider: string | undefined, lever: TtsSettingLever): boolean;
49
+ /** The model answers `/v1/text-to-speech/{voice}/with-timestamps` (character timings). */
50
+ declare function ttsSupportsTimestamps(provider: string | undefined): boolean;
51
+ /** Language codes offered for the model, in catalog order. */
52
+ declare function ttsLanguageCodes(provider: string | undefined): readonly string[];
53
+ /**
54
+ * The named voices the model speaks, or `undefined` when it speaks the
55
+ * ElevenLabs voices (premade, library, clones). See `TtsCapabilities.voices`.
56
+ */
57
+ declare function ttsNamedVoices(provider: string | undefined): readonly TtsNamedVoice[] | undefined;
58
+ /**
59
+ * Whether `voice` is one the model can speak: on a model with named voices,
60
+ * one of them by its exact wire name; on any other model, any id (the
61
+ * ElevenLabs voice checks apply there, as before).
62
+ */
63
+ declare function ttsAcceptsVoice(provider: string | undefined, voice: string): boolean;
64
+ /**
65
+ * The voice a request on a named-voice model runs with: the one it names when
66
+ * the model speaks it, else the model's default. `undefined` on an ElevenLabs
67
+ * model (its own default applies downstream).
68
+ */
69
+ declare function ttsNamedVoiceFor(provider: string | undefined, voice: unknown): string | undefined;
70
+ /** The style direction the model takes (`TtsCapabilities.direction`), or `undefined` when it takes none. */
71
+ declare function ttsDirection(provider: string | undefined): TtsDirectionSheet | undefined;
72
+ /** The model writes its tone tags `<in angle brackets>` from a closed list (`TtsCapabilities.tagSyntax`). */
73
+ declare function ttsAngleTags(provider: string | undefined): readonly string[] | undefined;
74
+ /**
75
+ * The style direction of a request, as the model takes it: each field kept
76
+ * only when the model's sheet names it and the value is one it accepts (a
77
+ * listed choice, or free text within its cap — trimmed, an empty one
78
+ * dropped). What the provider funnel sends and the workflow engine passes on;
79
+ * the REST route rejects instead of dropping (`ttsDirectionProblem`).
80
+ */
81
+ interface TtsDirectionValues {
82
+ styleDirection?: string;
83
+ pace?: string;
84
+ accent?: string;
85
+ audioProfile?: string;
86
+ }
87
+ declare function ttsDirectionFor(provider: string | undefined, values: Readonly<Record<string, unknown>>): TtsDirectionValues;
88
+ /**
89
+ * Why a request's style direction cannot run on the model, or `undefined`
90
+ * when it can. Only the fields the model takes are judged; on a model that
91
+ * takes none, or a field it does not take, the value is never sent (as the
92
+ * neighbour text on a model that does not stitch), so it is no problem.
93
+ */
94
+ declare function ttsDirectionProblem(provider: string | undefined, values: Readonly<Record<string, unknown>>): {
95
+ field: keyof TtsDirectionValues;
96
+ message: string;
97
+ } | undefined;
98
+ /**
99
+ * The voice a text-to-speech run on `provider` speaks, when the model and the
100
+ * voice may have been chosen apart — a published app's Model card, a field
101
+ * mapping onto the model, an upstream Character's voice, a preset's voice with
102
+ * a model the caller named (decided 2026-11-13: the editor's model-switch rule,
103
+ * applied wherever the editor is not there to apply it):
104
+ * - a model with named voices (Gemini): the voice when it is one of them, its
105
+ * default voice for any other voice, and none (its default) for none;
106
+ * - an ElevenLabs model: none (the deployment's default) for a voice that only
107
+ * a named-voice model speaks (`Fola`, `Kore`…), else the voice as given.
108
+ * Returns `undefined` for "no voice named"; never a voice the model refuses.
109
+ */
110
+ declare function ttsVoiceForModel(provider: string | undefined, voice: unknown): string | undefined;
111
+ /** The model clones a speaker's voice for one request (`TtsCapabilities.replica`: Gemini 3.8 Flash). */
112
+ declare function ttsTakesReplica(provider: string | undefined): boolean;
113
+ /** Every model that takes a one-off clone, in catalog order (for a refusal's sentence). */
114
+ declare function replicaModels(): string[];
115
+ /** A request's one-off clone as the platform reads it: two https links, or undefined when absent or not that shape. */
116
+ declare function replicaOf(value: unknown): TtsReplica | undefined;
117
+ /**
118
+ * Why a request's one-off clone (`replica`) cannot run on the model, or
119
+ * undefined (none asked, or one it takes). Refused, never dropped: a clone
120
+ * that is not sent is someone else's voice. The recordings themselves (WAV,
121
+ * size, length) are judged where they are fetched (backend
122
+ * `lib/voice-replica.ts`).
123
+ */
124
+ declare function ttsReplicaProblem(provider: string | undefined, value: unknown): string | undefined;
125
+ /**
126
+ * Why an API or MCP clone lacks its consent, or undefined: a `replica` asked
127
+ * must say `consent: true` — the caller's confirmation of
128
+ * `REPLICA_CONSENT_ATTESTATION`, what the editor's checkbox says (decided
129
+ * 2026-11-13). Refused before anything is read or held.
130
+ */
131
+ declare function replicaConsentProblem(value: unknown): string | undefined;
132
+
133
+ export { TTS_FALLBACK_PROVIDER as T, TTS_PROVIDER_ALIASES as a, type TtsDirectionValues as b, canonicalTtsProvider as c, replicaModels as d, replicaOf as e, ttsAngleTags as f, getTtsCapabilities as g, ttsDirection as h, ttsDirectionFor as i, ttsDirectionProblem as j, ttsHasLever as k, ttsLanguageCodes as l, ttsNamedVoiceFor as m, ttsNamedVoices as n, ttsReplicaProblem as o, ttsSupportsAudioTags as p, ttsSupportsSsmlBreaks as q, replicaConsentProblem as r, ttsSupportsStitching as s, ttsAcceptsVoice as t, ttsSupportsTimestamps as u, ttsTakesReplica as v, ttsVoiceForModel as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodaro/shared",
3
- "version": "3.64.0",
3
+ "version": "3.65.0",
4
4
  "description": "Shared types, model catalog, wire contracts, and structural vocabularies for the Nodaro platform and SDK.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -8,6 +8,20 @@ import {
8
8
  dialogueHasLever,
9
9
  dialogueStabilityAccepted,
10
10
  dialogueSupportsTimestamps,
11
+ dialogueMaxSpeakers,
12
+ dialogueTakesFillerWords,
13
+ dialogueVoicesForModel,
14
+ ELEVENLABS_DIALOGUE_MAX_VOICES,
15
+ dialogueLineStyleMaxChars,
16
+ dialogueLineStyleFor,
17
+ dialogueTakesSpeakerDirection,
18
+ dialogueSpeakerDirectionFor,
19
+ dialogueVoicesOf,
20
+ dialogueProblem,
21
+ dialogueOutputFormats,
22
+ dialogueOutputFormatFor,
23
+ dialogueReplicaVoices,
24
+ dialogueReplicaOf,
11
25
  } from "../dialogue-capabilities.js"
12
26
  import { findTtsCapabilities } from "../tts-capabilities.js"
13
27
 
@@ -24,7 +38,7 @@ describe("dialogue lane — totality", () => {
24
38
  const entry = MODEL_CATALOG[id]!
25
39
  expect(entry.tts, `${id} sheet`).toBeDefined()
26
40
  expect(entry.pricing[0]?.identifier, `${id} price identifier`).toBe(id)
27
- expect(entry.series, `${id} series`).toBe("ElevenLabs")
41
+ expect(entry.series, `${id} series`).toBe(id.startsWith("gemini-") ? "Gemini" : "ElevenLabs")
28
42
  }
29
43
  })
30
44
 
@@ -33,8 +47,11 @@ describe("dialogue lane — totality", () => {
33
47
  expect(DIALOGUE_PROVIDERS).toContain(DEFAULT_DIALOGUE_PROVIDER)
34
48
  })
35
49
 
36
- it("no id is both a text-to-speech provider and a dialogue provider", () => {
37
- for (const id of DIALOGUE_PROVIDERS) expect(TTS_PROVIDERS as readonly string[], id).not.toContain(id)
50
+ it("an id in both lanes is exactly a model that takes one speaker and a script under one id (Gemini: priced on its one-speaker row by construction); the ElevenLabs dialogue ids are dialogue only", () => {
51
+ const both = DIALOGUE_PROVIDERS.filter((id) => (TTS_PROVIDERS as readonly string[]).includes(id))
52
+ expect(both).toEqual(["gemini-3-8-flash-lite-tts", "gemini-3-8-flash-tts", "gemini-3-1-flash-tts", "gemini-2-5-pro-tts"])
53
+ for (const id of both) expect(MODEL_CATALOG[id]!.modes).toEqual(["tts", "dialogue"])
54
+ for (const id of DIALOGUE_PROVIDERS.filter((d) => d.startsWith("elevenlabs-"))) expect(TTS_PROVIDERS as readonly string[], id).not.toContain(id)
38
55
  })
39
56
 
40
57
  it("stabilitySteps, when declared, are unique, ascending values within 0..1 — and no text-to-speech model declares any", () => {
@@ -73,12 +90,14 @@ describe("dialogue lane — lookups", () => {
73
90
  }
74
91
  })
75
92
 
76
- it("a text-to-speech id is not a dialogue model — and a dialogue id is not a text-to-speech model", () => {
77
- for (const id of TTS_PROVIDERS) {
93
+ it("a text-to-speech-only id is not a dialogue model — and an ElevenLabs dialogue id is not a text-to-speech model", () => {
94
+ for (const id of TTS_PROVIDERS.filter((t) => !(DIALOGUE_PROVIDERS as readonly string[]).includes(t))) {
78
95
  expect(findDialogueCapabilities(id), id).toBeUndefined()
79
96
  expect(dialogueProviderOf(id), id).toBe(DEFAULT_DIALOGUE_PROVIDER)
80
97
  }
81
- for (const id of DIALOGUE_PROVIDERS) expect(findTtsCapabilities(id), id).toBeUndefined()
98
+ for (const id of DIALOGUE_PROVIDERS.filter((d) => !(TTS_PROVIDERS as readonly string[]).includes(d))) expect(findTtsCapabilities(id), id).toBeUndefined()
99
+ // A model in both lanes has ONE sheet, the same in each.
100
+ expect(findDialogueCapabilities("gemini-3-8-flash-tts")).toBe(findTtsCapabilities("gemini-3-8-flash-tts"))
82
101
  })
83
102
 
84
103
  it("a real dialogue id runs as itself", () => {
@@ -147,6 +166,148 @@ describe("elevenlabs-dialogue-v4 — added beside v3 dialogue", () => {
147
166
  })
148
167
  })
149
168
 
169
+ describe("Gemini dialogue — two speakers on all four (decided 2026-11-12)", () => {
170
+ const GEMINI = ["gemini-3-8-flash-lite-tts", "gemini-3-8-flash-tts", "gemini-3-1-flash-tts", "gemini-2-5-pro-tts"]
171
+
172
+ it("two speakers at most, no ElevenLabs lever, no timings; filler words on 3.8 only; v3 dialogue stays the default", () => {
173
+ for (const id of GEMINI) {
174
+ expect(dialogueMaxSpeakers(id), id).toBe(2)
175
+ expect(dialogueSupportsTimestamps(id), id).toBe(false)
176
+ expect(getDialogueCapabilities(id).levers, id).toEqual([])
177
+ // Priced on the same row as one speaker: its one per-1,000-characters row.
178
+ expect(MODEL_CATALOG[id]!.pricing.map((p) => p.identifier)).toEqual([id, `${id}:per-1k-chars`])
179
+ }
180
+ expect(dialogueTakesFillerWords("gemini-3-8-flash-lite-tts")).toBe(true)
181
+ expect(dialogueTakesFillerWords("gemini-3-8-flash-tts")).toBe(true)
182
+ expect(dialogueTakesFillerWords("gemini-3-1-flash-tts")).toBe(false)
183
+ expect(dialogueTakesFillerWords("elevenlabs-dialogue")).toBe(false)
184
+ expect(dialogueMaxSpeakers("elevenlabs-dialogue")).toBe(ELEVENLABS_DIALOGUE_MAX_VOICES)
185
+ expect(DEFAULT_DIALOGUE_PROVIDER).toBe("elevenlabs-dialogue")
186
+ })
187
+
188
+ it("dialogueVoicesForModel: a voice the model speaks stays; others move onto its voices the script does not use, default first, so two speakers stay two", () => {
189
+ expect(dialogueVoicesForModel("gemini-3-8-flash-tts", ["Zephyr", "Puck", "Zephyr"])).toEqual(["Zephyr", "Puck", "Zephyr"])
190
+ // Two ElevenLabs voices → the default, then the first unused voice of the list.
191
+ const moved = dialogueVoicesForModel("gemini-3-8-flash-tts", ["Rachel", "George", "Rachel"])
192
+ expect(moved[0]).toBe("Fola")
193
+ expect(moved[2]).toBe("Fola")
194
+ expect(moved[1]).not.toBe("Fola")
195
+ expect(getDialogueCapabilities("gemini-3-8-flash-tts").voices!.some((v) => v.id === moved[1])).toBe(true)
196
+ // A kept voice is never reused for a moved one.
197
+ expect(dialogueVoicesForModel("gemini-3-1-flash-tts", ["Kore", "Rachel"])).toEqual(["Kore", "Achernar"])
198
+ // On an ElevenLabs dialogue model a Gemini voice becomes "" (the deployment's default); its own voices stay.
199
+ expect(dialogueVoicesForModel("elevenlabs-dialogue", ["Fola", "Rachel"])).toEqual(["", "Rachel"])
200
+ })
201
+ })
202
+
203
+ describe("Gemini dialogue — direction and the one validation rule", () => {
204
+ it("3.8 takes a style per line; 3.1 / 2.5 a style, pace, accent and profile per speaker; ElevenLabs neither", () => {
205
+ expect(dialogueLineStyleMaxChars("gemini-3-8-flash-tts")).toBe(1000)
206
+ expect(dialogueLineStyleMaxChars("gemini-3-1-flash-tts")).toBeUndefined()
207
+ expect(dialogueLineStyleMaxChars("elevenlabs-dialogue")).toBeUndefined()
208
+ expect(dialogueTakesSpeakerDirection("gemini-3-8-flash-lite-tts")).toBe(false)
209
+ expect(dialogueTakesSpeakerDirection("gemini-2-5-pro-tts")).toBe(true)
210
+ expect(dialogueTakesSpeakerDirection("elevenlabs-dialogue-v4")).toBe(false)
211
+ expect(dialogueLineStyleFor("gemini-3-8-flash-tts", " calm ")).toBe("calm")
212
+ expect(dialogueLineStyleFor("gemini-3-1-flash-tts", "calm")).toBeUndefined()
213
+ expect(dialogueSpeakerDirectionFor("gemini-3-1-flash-tts", { styleDirection: "Whisper", pace: "Natural", accent: "nope", audioProfile: " a host " }))
214
+ .toEqual({ styleDirection: "Whisper", pace: "Natural", audioProfile: "a host" })
215
+ expect(dialogueSpeakerDirectionFor("gemini-3-8-flash-tts", { styleDirection: "calm" })).toEqual({})
216
+ })
217
+
218
+ it("dialogueVoicesOf: the distinct voices in the order they first speak", () => {
219
+ expect(dialogueVoicesOf([{ voice: "B" }, { voice: "A" }, { voice: "B" }, { text: "x" }, null])).toEqual(["B", "A"])
220
+ expect(dialogueVoicesOf("nope")).toEqual([])
221
+ })
222
+
223
+ it("dialogueProblem: two voices at most on Gemini, each of its own; ten on ElevenLabs", () => {
224
+ const line = (voice: string) => ({ text: "hi", voice })
225
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue: [line("Fola"), line("Puck"), line("Fola")] })).toBeUndefined()
226
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue: [line("Fola")] })).toBeUndefined()
227
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue: [line("Fola"), line("Puck"), line("Kore")] })?.message)
228
+ .toBe("A dialogue can use at most 2 unique voices — reuse voices across lines or split the script into two nodes")
229
+ const off = dialogueProblem("gemini-3-1-flash-tts", { dialogue: [line("Kore"), line("Rachel")] })
230
+ expect(off?.path).toEqual(["dialogue", 1, "voice"])
231
+ expect(off?.message).toMatch(/^Rachel is not a voice of gemini-3-1-flash-tts\. Its voices: /)
232
+ // ElevenLabs: any id, up to ten distinct.
233
+ const ten = Array.from({ length: 10 }, (_, i) => line(`v${i}`))
234
+ expect(dialogueProblem("elevenlabs-dialogue", { dialogue: ten })).toBeUndefined()
235
+ expect(dialogueProblem("elevenlabs-dialogue", { dialogue: [...ten, line("v10")] })?.message).toMatch(/at most 10 unique voices/)
236
+ })
237
+
238
+ it("dialogueProblem refuses a speaker listed twice (which entry applies would be chance)", () => {
239
+ const problem = dialogueProblem("gemini-3-1-flash-tts", { dialogue: [{ text: "hi", voice: "Kore" }], speakers: [{ voice: "Kore", pace: "Natural" }, { voice: "Kore", pace: "Staccato" }] })
240
+ expect(problem).toEqual({ path: ["speakers", 1, "voice"], message: 'speakers lists the voice "Kore" more than once; give each speaker one entry' })
241
+ })
242
+
243
+ it("dialogueProblem: a line's style on 3.8 within 1,000 characters; a speaker's direction on 3.1 within its choices; untaken fields are no problem", () => {
244
+ const d = [{ text: "hi", voice: "Fola", styleDirection: "x".repeat(1001) }]
245
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue: d })).toEqual({ path: ["dialogue", 0, "styleDirection"], message: "styleDirection must be at most 1000 characters" })
246
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue: [{ text: "hi", voice: "Fola", styleDirection: 3 }] })?.message).toBe("styleDirection must be a string")
247
+ // 3.8 takes no direction per speaker: never sent, no problem.
248
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue: [{ text: "hi", voice: "Fola" }], speakers: [{ voice: "Fola", pace: "Warp" }] })).toBeUndefined()
249
+ const bad = dialogueProblem("gemini-3-1-flash-tts", { dialogue: [{ text: "hi", voice: "Kore" }], speakers: [{ voice: "Kore", pace: "Warp" }] })
250
+ expect(bad?.path).toEqual(["speakers", 0, "pace"])
251
+ expect(bad?.message).toMatch(/^pace must be one of: /)
252
+ // 3.1 takes no style per line: never sent, no problem.
253
+ expect(dialogueProblem("gemini-3-1-flash-tts", { dialogue: [{ text: "hi", voice: "Kore", styleDirection: "x".repeat(2000) }] })).toBeUndefined()
254
+ })
255
+ })
256
+
257
+ describe("a dialogue's file (decided 2026-11-13)", () => {
258
+ it("a Gemini model delivers every speech file format; an ElevenLabs dialogue model the default MP3 only", () => {
259
+ for (const id of ["gemini-3-8-flash-lite-tts", "gemini-3-8-flash-tts", "gemini-3-1-flash-tts", "gemini-2-5-pro-tts"]) {
260
+ expect(dialogueOutputFormats(id), id).toEqual(["mp3_44100_128", "mp3_44100_192", "wav_24000"])
261
+ }
262
+ expect(dialogueOutputFormats("elevenlabs-dialogue")).toEqual(["mp3_44100_128"])
263
+ expect(dialogueOutputFormats("elevenlabs-dialogue-v4")).toEqual(["mp3_44100_128"])
264
+ expect(dialogueOutputFormatFor("gemini-3-1-flash-tts", "wav_24000")).toBe("wav_24000")
265
+ expect(dialogueOutputFormatFor("elevenlabs-dialogue", "wav_24000")).toBeUndefined()
266
+ expect(dialogueOutputFormatFor("gemini-3-1-flash-tts", "flac")).toBeUndefined()
267
+ })
268
+
269
+ it("dialogueProblem refuses a file the model does not deliver, with its list", () => {
270
+ const dialogue = [{ text: "hi", voice: "Rachel" }]
271
+ expect(dialogueProblem("elevenlabs-dialogue", { dialogue, outputFormat: "wav_24000" }))
272
+ .toEqual({ path: ["outputFormat"], message: "outputFormat on elevenlabs-dialogue must be one of: mp3_44100_128" })
273
+ expect(dialogueProblem("elevenlabs-dialogue", { dialogue, outputFormat: "mp3_44100_128" })).toBeUndefined()
274
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue: [{ text: "hi", voice: "Fola" }], outputFormat: "wav_24000" })).toBeUndefined()
275
+ })
276
+ })
277
+
278
+ describe("a one-off clone in a dialogue (decided 2026-11-13)", () => {
279
+ const replica = { sourceAudioUrl: "https://cdn.example/a.wav", consentAudioUrl: "https://cdn.example/b.wav" }
280
+
281
+ it("dialogueReplicaVoices: the labels with a replica, on 3.8 Flash only", () => {
282
+ const speakers = [{ voice: "Me", replica }, { voice: "Puck" }, { voice: "Bad", replica: { sourceAudioUrl: "http://x/a.wav", consentAudioUrl: "https://x/b.wav" } }]
283
+ expect([...dialogueReplicaVoices("gemini-3-8-flash-tts", speakers)]).toEqual(["Me"])
284
+ expect(dialogueReplicaVoices("gemini-3-8-flash-lite-tts", speakers).size).toBe(0)
285
+ expect(dialogueReplicaVoices("gemini-3-1-flash-tts", speakers).size).toBe(0)
286
+ expect(dialogueReplicaOf("gemini-3-8-flash-tts", speakers, "Me")).toEqual(replica)
287
+ expect(dialogueReplicaOf("gemini-3-8-flash-tts", speakers, "Puck")).toBeUndefined()
288
+ })
289
+
290
+ it("dialogueVoicesForModel keeps a cloned speaker on 3.8 Flash and moves it like any foreign voice elsewhere", () => {
291
+ const speakers = [{ voice: "Me", replica }]
292
+ expect(dialogueVoicesForModel("gemini-3-8-flash-tts", ["Me", "Puck"], speakers)).toEqual(["Me", "Puck"])
293
+ expect(dialogueVoicesForModel("gemini-3-8-flash-lite-tts", ["Me", "Puck"], speakers)).toEqual(["Fola", "Puck"])
294
+ expect(dialogueVoicesForModel("elevenlabs-dialogue", ["Me", "Rachel"], speakers)).toEqual(["Me", "Rachel"])
295
+ })
296
+
297
+ it("dialogueProblem: a clone's label is a voice on 3.8 Flash; a replica on a model that does not clone is refused, never dropped", () => {
298
+ const dialogue = [{ text: "hi", voice: "Me" }, { text: "yo", voice: "Puck" }]
299
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue, speakers: [{ voice: "Me", replica }] })).toBeUndefined()
300
+ const lite = dialogueProblem("gemini-3-8-flash-lite-tts", { dialogue, speakers: [{ voice: "Me", replica }] })
301
+ expect(lite?.path).toEqual(["speakers", 0, "replica"])
302
+ expect(lite?.message).toBe("gemini-3-8-flash-lite-tts does not clone a voice; a one-off clone runs on gemini-3-8-flash-tts")
303
+ expect(dialogueProblem("elevenlabs-dialogue", { dialogue: [{ text: "hi", voice: "Rachel" }], speakers: [{ voice: "Rachel", replica }] })?.path).toEqual(["speakers", 0, "replica"])
304
+ // A malformed replica on 3.8 Flash is refused with the shape it needs.
305
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue, speakers: [{ voice: "Me", replica: { sourceAudioUrl: "ftp://x" } }] })?.message).toMatch(/needs sourceAudioUrl and consentAudioUrl/)
306
+ // Clones count as speakers: two at most.
307
+ expect(dialogueProblem("gemini-3-8-flash-tts", { dialogue: [...dialogue, { text: "x", voice: "Fola" }], speakers: [{ voice: "Me", replica }] })?.message).toMatch(/at most 2 unique voices/)
308
+ })
309
+ })
310
+
150
311
  describe("dialogueSupportsTimestamps", () => {
151
312
  it("both dialogue models return timings (measured 2026-10-06); an unknown id runs as v3 dialogue, so it does too", () => {
152
313
  expect(dialogueSupportsTimestamps("elevenlabs-dialogue-v4")).toBe(true)
@@ -431,4 +431,91 @@ describe("Grok Extend Video provider", () => {
431
431
  expect(grokExtendWiredSourceResolution("ext", [ext], [])).toBe("720p")
432
432
  expect(grokExtendWiredSourceResolution("ext", [ext, video("grok-i2v", "480p")], wire("prompt"))).toBe("720p")
433
433
  })
434
+
435
+ // The charge reads the resolution the SOURCE's job recorded (`input_data.resolution`; none: the
436
+ // KIE config's pin, else Grok's own 480p default). Every lane that lands a take records the task
437
+ // that made it and that recorded resolution on the result row, so the quote reads the same fact,
438
+ // off the take the node's task names (the clip the run extends): `480p` → the 480p row; anything
439
+ // else, or none → the 720p row, never below the charge.
440
+ describe("a Grok node that already made a clip: quoted from the resolution its job recorded, not from its setting", () => {
441
+ const ext = { id: "ext", type: "extend-video", data: { provider: "grok-extend" } }
442
+ const wire = [{ source: "src", target: "ext", targetHandle: "video" }]
443
+ type Row = { task?: string; recorded?: string; width?: number; height?: number }
444
+ /** A Grok Imagine node holding task `t-latest`, set to `resolution`; its results newest first. */
445
+ const ran = (rows: readonly Row[], resolution?: string, extra: Record<string, unknown> = {}) => ({
446
+ id: "src",
447
+ type: "generate-video",
448
+ data: {
449
+ provider: "grok-i2v",
450
+ ...(resolution !== undefined ? { resolution } : {}),
451
+ kieTaskId: "t-latest",
452
+ generatedResults: rows.map((r, i) => ({
453
+ url: `https://cdn.example/${i}.mp4`, jobId: `j${i}`,
454
+ ...(r.task !== undefined ? { kieTaskId: r.task } : {}),
455
+ ...(r.recorded !== undefined ? { recordedResolution: r.recorded } : {}),
456
+ ...(r.width !== undefined ? { width: r.width, height: r.height } : {}),
457
+ })),
458
+ ...extra,
459
+ },
460
+ })
461
+ const quote = (node: ReturnType<typeof ran>, rerunIds?: ReadonlySet<string>) => grokExtendWiredSourceResolution("ext", [ext, node], wire, rerunIds)
462
+
463
+ it("the take the task names recorded 480p: 480p, whatever the node is set to now", () => {
464
+ for (const resolution of ["480p", "720p", undefined]) {
465
+ expect(quote(ran([{ task: "t-latest", recorded: "480p" }], resolution)), String(resolution)).toBe("480p")
466
+ }
467
+ // Case-insensitive, as the charge reads it.
468
+ expect(quote(ran([{ task: "t-latest", recorded: "480P" }]))).toBe("480p")
469
+ })
470
+
471
+ it("recorded 720p (a node set to 480p since): 720p", () => {
472
+ expect(quote(ran([{ task: "t-latest", recorded: "720p" }], "480p"))).toBe("720p")
473
+ })
474
+
475
+ it("the take names the task but recorded no resolution: 720p", () => {
476
+ expect(quote(ran([{ task: "t-latest" }], "480p"))).toBe("720p")
477
+ })
478
+
479
+ it("the file's pixel size is never read: a 480p-sized file whose job recorded 720p is 720p (and a 720p-sized one recording 480p is 480p)", () => {
480
+ expect(quote(ran([{ task: "t-latest", recorded: "720p", width: 854, height: 480 }], "480p"))).toBe("720p")
481
+ expect(quote(ran([{ task: "t-latest", recorded: "480p", width: 1280, height: 720 }], "720p"))).toBe("480p")
482
+ expect(quote(ran([{ task: "t-latest", width: 854, height: 480 }], "480p"))).toBe("720p")
483
+ })
484
+
485
+ it("no result names the node's task — its result deleted, results from before they recorded their task, or none at all: 720p", () => {
486
+ for (const resolution of ["480p", "720p", undefined]) {
487
+ // The newest (720p) result deleted; the node still holds its task.
488
+ expect(quote(ran([{ task: "t-older", recorded: "480p" }], resolution)), String(resolution)).toBe("720p")
489
+ // Results that recorded no task.
490
+ expect(quote(ran([{ recorded: "480p" }, { width: 854, height: 480 }], resolution)), String(resolution)).toBe("720p")
491
+ // A task with no result.
492
+ expect(quote(ran([], resolution)), String(resolution)).toBe("720p")
493
+ }
494
+ })
495
+
496
+ it("reads the take the task names — never the one only shown, nor the newest", () => {
497
+ const node = ran([{ task: "t-older", recorded: "720p" }, { task: "t-latest", recorded: "480p" }], "720p", { activeResultIndex: 0 })
498
+ expect(quote(node)).toBe("480p")
499
+ // An edit landed after it (a result with no task of its own).
500
+ expect(quote(ran([{ recorded: "720p" }, { task: "t-latest", recorded: "480p" }], "720p"))).toBe("480p")
501
+ })
502
+
503
+ it("a node that has not run quotes its setting: 480p as set, else 720p", () => {
504
+ const fresh = (resolution?: string) => ({ id: "src", type: "generate-video", data: { provider: "grok", ...(resolution !== undefined ? { resolution } : {}) } })
505
+ expect(grokExtendWiredSourceResolution("ext", [ext, fresh("480p")], wire)).toBe("480p")
506
+ expect(grokExtendWiredSourceResolution("ext", [ext, fresh()], wire)).toBe("720p")
507
+ expect(grokExtendWiredSourceResolution("ext", [ext, fresh("720p")], wire)).toBe("720p")
508
+ })
509
+
510
+ it("a node that makes a new clip in the quoted run is quoted at its setting (the clip it will make)", () => {
511
+ // Recorded 480p, now set to 720p, and it runs again: the run extends the new 720p clip.
512
+ expect(quote(ran([{ task: "t-latest", recorded: "480p" }], "720p"), new Set(["src", "ext"]))).toBe("720p")
513
+ // Recorded 720p, now set to 480p, and it runs again: the new clip is 480p.
514
+ expect(quote(ran([{ task: "t-latest", recorded: "720p" }], "480p"), new Set(["src", "ext"]))).toBe("480p")
515
+ // A frozen node does not run again: it hands on the clip it holds.
516
+ expect(quote(ran([{ task: "t-latest", recorded: "720p" }], "480p", { skipped: true }), new Set(["src", "ext"]))).toBe("720p")
517
+ // Outside the run's nodes (Run from here on the extension): the clip it holds.
518
+ expect(quote(ran([{ task: "t-latest", recorded: "720p" }], "480p"), new Set(["ext"]))).toBe("720p")
519
+ })
520
+ })
434
521
  })
@@ -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, videoCharactersBillAsReferenceVideo: true })
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")!
@@ -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
+ })