@nodaro/shared 3.14.0 → 3.18.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 (153) hide show
  1. package/dist/index.cjs +1679 -81
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +1822 -49
  4. package/dist/index.d.ts +1822 -49
  5. package/dist/index.js +1491 -82
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/__tests__/apply-edl-credit-id.test.ts +25 -0
  9. package/src/__tests__/camera-switch-contract.test.ts +98 -0
  10. package/src/__tests__/competitors.test.ts +49 -0
  11. package/src/__tests__/content-recipe-ideas.test.ts +96 -0
  12. package/src/__tests__/edl-multicam.test.ts +192 -0
  13. package/src/__tests__/exposed-field-keys.test.ts +78 -0
  14. package/src/__tests__/instagram-scrape.test.ts +62 -0
  15. package/src/__tests__/llm-models.test.ts +5 -2
  16. package/src/__tests__/music-provider.test.ts +17 -0
  17. package/src/__tests__/node-runtime-keys.test.ts +11 -0
  18. package/src/__tests__/parameter-node-value.test.ts +2 -1
  19. package/src/__tests__/per-unit-video-pricing.test.ts +97 -0
  20. package/src/__tests__/producer-types.test.ts +35 -0
  21. package/src/__tests__/saved-posts.test.ts +37 -0
  22. package/src/__tests__/script-settings.test.ts +61 -0
  23. package/src/__tests__/settings-input.test.ts +252 -0
  24. package/src/__tests__/social-search.test.ts +243 -0
  25. package/src/__tests__/studio-sequence-owner.test.ts +356 -0
  26. package/src/__tests__/studio-take-voice.test.ts +200 -0
  27. package/src/__tests__/studio-transient.test.ts +71 -0
  28. package/src/__tests__/sub-gates.test.ts +21 -0
  29. package/src/__tests__/telegram-account-trigger.test.ts +120 -0
  30. package/src/__tests__/text-to-audio-pricing.test.ts +71 -0
  31. package/src/__tests__/tts-capabilities.test.ts +237 -0
  32. package/src/__tests__/video-analysis-pricing.test.ts +27 -13
  33. package/src/__tests__/video-link.test.ts +2 -2
  34. package/src/__tests__/video-utils.test.ts +89 -83
  35. package/src/__tests__/workflow-export-strip.test.ts +37 -0
  36. package/src/camera-switch-contract.ts +166 -0
  37. package/src/catalog-projection.ts +7 -0
  38. package/src/competitors.ts +430 -0
  39. package/src/content-recipe-ideas.ts +69 -0
  40. package/src/credit-estimators/index.ts +21 -0
  41. package/src/credit-estimators/ltx-extend.ts +33 -0
  42. package/src/credit-estimators/ltx-retake.ts +30 -0
  43. package/src/credit-estimators/text-to-audio.ts +58 -0
  44. package/src/credit-estimators/video-sfx.ts +41 -0
  45. package/src/credit-estimators/video-utils.ts +38 -24
  46. package/src/credit-identifiers.ts +22 -0
  47. package/src/edl-multicam.ts +220 -0
  48. package/src/exposed-field-keys.ts +49 -0
  49. package/src/fan-out-rows.ts +7 -2
  50. package/src/i18n/action-fx.ko.ts +18 -18
  51. package/src/i18n/action-fx.pt-BR.ts +66 -66
  52. package/src/i18n/aesthetic.ko.ts +49 -49
  53. package/src/i18n/aesthetic.pt-BR.ts +14 -14
  54. package/src/i18n/animals.ko.ts +126 -126
  55. package/src/i18n/animals.pt-BR.ts +33 -33
  56. package/src/i18n/atmosphere.ko.ts +37 -37
  57. package/src/i18n/atmosphere.pt-BR.ts +29 -29
  58. package/src/i18n/backdrop.ko.ts +40 -40
  59. package/src/i18n/backdrop.pt-BR.ts +38 -38
  60. package/src/i18n/camera-format.ko.ts +31 -31
  61. package/src/i18n/camera-format.pt-BR.ts +12 -12
  62. package/src/i18n/camera-motions.ko.ts +66 -66
  63. package/src/i18n/camera-motions.pt-BR.ts +51 -51
  64. package/src/i18n/character-fx.ko.ts +19 -19
  65. package/src/i18n/character-fx.pt-BR.ts +64 -52
  66. package/src/i18n/character-motion.ko.ts +164 -164
  67. package/src/i18n/character-motion.pt-BR.ts +867 -858
  68. package/src/i18n/color-look.ko.ts +41 -41
  69. package/src/i18n/color-look.pt-BR.ts +23 -23
  70. package/src/i18n/composition-effects.ko.ts +18 -18
  71. package/src/i18n/composition-effects.pt-BR.ts +17 -17
  72. package/src/i18n/era.ko.ts +28 -28
  73. package/src/i18n/era.pt-BR.ts +20 -20
  74. package/src/i18n/exposure-settings.ko.ts +20 -20
  75. package/src/i18n/exposure-settings.pt-BR.ts +3 -3
  76. package/src/i18n/framing.ko.ts +66 -66
  77. package/src/i18n/framing.pt-BR.ts +50 -50
  78. package/src/i18n/furniture.ko.ts +78 -78
  79. package/src/i18n/furniture.pt-BR.ts +46 -46
  80. package/src/i18n/held-prop.ko.ts +60 -60
  81. package/src/i18n/held-prop.pt-BR.ts +30 -30
  82. package/src/i18n/instrumentation.ko.ts +62 -62
  83. package/src/i18n/instrumentation.pt-BR.ts +64 -64
  84. package/src/i18n/lens.ko.ts +16 -16
  85. package/src/i18n/lens.pt-BR.ts +5 -5
  86. package/src/i18n/lighting.ko.ts +68 -68
  87. package/src/i18n/lighting.pt-BR.ts +43 -43
  88. package/src/i18n/loop-subject.ko.ts +1 -1
  89. package/src/i18n/loop-subject.pt-BR.ts +31 -31
  90. package/src/i18n/materials.ko.ts +66 -66
  91. package/src/i18n/materials.pt-BR.ts +22 -22
  92. package/src/i18n/mood.ko.ts +50 -50
  93. package/src/i18n/mood.pt-BR.ts +12 -12
  94. package/src/i18n/music-genre.ko.ts +28 -28
  95. package/src/i18n/music-genre.pt-BR.ts +50 -50
  96. package/src/i18n/music-mood.ko.ts +27 -27
  97. package/src/i18n/music-mood.pt-BR.ts +20 -20
  98. package/src/i18n/person.ko.ts +396 -396
  99. package/src/i18n/person.pt-BR.ts +237 -237
  100. package/src/i18n/photo-genre.ko.ts +46 -46
  101. package/src/i18n/photo-genre.pt-BR.ts +32 -32
  102. package/src/i18n/photographer.ko.ts +63 -63
  103. package/src/i18n/photographer.pt-BR.ts +15 -15
  104. package/src/i18n/pose.ko.ts +81 -81
  105. package/src/i18n/pose.pt-BR.ts +65 -65
  106. package/src/i18n/post-process-effects.ko.ts +18 -18
  107. package/src/i18n/post-process-effects.pt-BR.ts +18 -18
  108. package/src/i18n/render-quality.ko.ts +24 -24
  109. package/src/i18n/render-quality.pt-BR.ts +12 -12
  110. package/src/i18n/setting.ko.ts +64 -64
  111. package/src/i18n/setting.pt-BR.ts +41 -41
  112. package/src/i18n/style.ko.ts +49 -49
  113. package/src/i18n/style.pt-BR.ts +19 -19
  114. package/src/i18n/styling.ko.ts +265 -265
  115. package/src/i18n/styling.pt-BR.ts +141 -141
  116. package/src/i18n/temporal.ko.ts +18 -18
  117. package/src/i18n/temporal.pt-BR.ts +12 -12
  118. package/src/i18n/transitions.ko.ts +14 -14
  119. package/src/i18n/transitions.pt-BR.ts +83 -71
  120. package/src/i18n/vehicles.ko.ts +107 -107
  121. package/src/i18n/vehicles.pt-BR.ts +55 -55
  122. package/src/i18n/voice-character.ko.ts +19 -19
  123. package/src/i18n/voice-character.pt-BR.ts +19 -19
  124. package/src/i18n/voice-delivery.ko.ts +22 -22
  125. package/src/i18n/voice-delivery.pt-BR.ts +22 -22
  126. package/src/i18n/weapons.ko.ts +85 -85
  127. package/src/i18n/weapons.pt-BR.ts +46 -46
  128. package/src/index.ts +236 -1
  129. package/src/instagram-scrape.ts +91 -16
  130. package/src/llm-models.ts +11 -0
  131. package/src/model-catalog.ts +151 -16
  132. package/src/model-constants.ts +54 -16
  133. package/src/node-mappable-fields.ts +21 -5
  134. package/src/node-runtime-keys.ts +45 -0
  135. package/src/oauth-scopes.ts +28 -0
  136. package/src/parameter-node-value.ts +13 -5
  137. package/src/pipeline-defaults.ts +14 -0
  138. package/src/pipeline-state-types.ts +14 -0
  139. package/src/presentation-utils.ts +5 -1
  140. package/src/producer-types.ts +85 -0
  141. package/src/recast-segment-packs.ts +13 -0
  142. package/src/resolve-field-mappings.ts +15 -5
  143. package/src/saved-posts.ts +106 -0
  144. package/src/script-settings.ts +70 -0
  145. package/src/settings-input.ts +366 -0
  146. package/src/social-search.ts +467 -0
  147. package/src/studio-transient.ts +479 -7
  148. package/src/telegram-account-send.ts +32 -0
  149. package/src/telegram-account-trigger.ts +108 -0
  150. package/src/tts-capabilities.ts +75 -0
  151. package/src/video-analysis-pricing.ts +17 -6
  152. package/src/video-link.ts +16 -4
  153. package/src/workflow-export.ts +7 -0
@@ -0,0 +1,237 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { MODEL_CATALOG } from "../model-catalog.js"
3
+ import { TTS_PROVIDERS, MAX_TTS_CHARS_BY_PROVIDER, getMaxTtsChars, TTS_TEXT_MAX } from "../model-constants.js"
4
+ import {
5
+ TTS_PROVIDER_ALIASES,
6
+ TTS_FALLBACK_PROVIDER,
7
+ canonicalTtsProvider,
8
+ findTtsCapabilities,
9
+ getTtsCapabilities,
10
+ ttsSupportsAudioTags,
11
+ ttsSupportsSsmlBreaks,
12
+ ttsHasLever,
13
+ ttsLanguageCodes,
14
+ } from "../tts-capabilities.js"
15
+
16
+ describe("speech-model capability sheets — totality", () => {
17
+ it("every text-to-speech provider id resolves to a catalog model with a sheet and a price", () => {
18
+ for (const id of TTS_PROVIDERS) {
19
+ const entry = MODEL_CATALOG[canonicalTtsProvider(id)]
20
+ expect(entry, `${id} has no catalog entry`).toBeDefined()
21
+ expect(entry!.tts, `${id} has no capability sheet`).toBeDefined()
22
+ expect(entry!.pricing.length, `${id} has no pricing row`).toBeGreaterThan(0)
23
+ }
24
+ })
25
+
26
+ it("every catalog model that speaks (tts or dialogue mode) carries a sheet, and nothing else does", () => {
27
+ for (const m of Object.values(MODEL_CATALOG)) {
28
+ const speaks = m.modes.includes("tts") || m.modes.includes("dialogue")
29
+ expect(m.tts !== undefined, `${m.id}: sheet presence must match its modes`).toBe(speaks)
30
+ }
31
+ })
32
+
33
+ it("every non-alias provider id IS a catalog id, and every alias points at a real speech model", () => {
34
+ for (const id of TTS_PROVIDERS) {
35
+ if (id in TTS_PROVIDER_ALIASES) continue
36
+ expect(MODEL_CATALOG[id]?.modes).toContain("tts")
37
+ }
38
+ for (const [alias, target] of Object.entries(TTS_PROVIDER_ALIASES)) {
39
+ expect(MODEL_CATALOG[alias], `${alias} is an alias and must not have its own entry`).toBeUndefined()
40
+ expect(MODEL_CATALOG[target]?.tts).toBeDefined()
41
+ }
42
+ expect(MODEL_CATALOG[TTS_FALLBACK_PROVIDER]?.tts).toBeDefined()
43
+ })
44
+
45
+ it("each sheet is internally consistent", () => {
46
+ for (const m of Object.values(MODEL_CATALOG)) {
47
+ if (!m.tts) continue
48
+ expect(Number.isInteger(m.tts.maxChars) && m.tts.maxChars > 0, `${m.id} maxChars`).toBe(true)
49
+ expect(m.tts.levers, `${m.id} must honour stability`).toContain("stability")
50
+ expect(new Set(m.tts.levers).size, `${m.id} duplicate lever`).toBe(m.tts.levers.length)
51
+ expect(m.tts.languages.length, `${m.id} languages`).toBeGreaterThan(0)
52
+ expect(new Set(m.tts.languages).size, `${m.id} duplicate language`).toBe(m.tts.languages.length)
53
+ // The `features` flag other packages already read must agree with the sheet.
54
+ expect(m.features?.includes("audio-tags") ?? false, `${m.id} audio-tags feature`).toBe(m.tts.audioTags)
55
+ }
56
+ })
57
+ })
58
+
59
+ describe("speech-model capability sheets — what each model does today", () => {
60
+ it("v3: tags, no SSML, stability only, 5,000 characters, 46 languages", () => {
61
+ const c = getTtsCapabilities("elevenlabs-v3")
62
+ expect(c.audioTags).toBe(true)
63
+ expect(c.ssmlBreaks).toBe(false)
64
+ expect(c.levers).toEqual(["stability"])
65
+ expect(c.languageCode).toBe(true)
66
+ expect(c.maxChars).toBe(5000)
67
+ expect(c.languages).toHaveLength(46)
68
+ expect(c.languages).toContain("he")
69
+ })
70
+
71
+ it("turbo: no tags, SSML, all five levers, 40,000 characters, 32 languages", () => {
72
+ const c = getTtsCapabilities("elevenlabs-turbo")
73
+ expect(c.audioTags).toBe(false)
74
+ expect(c.ssmlBreaks).toBe(true)
75
+ expect(c.levers).toEqual(["stability", "similarity", "style", "speed", "speakerBoost"])
76
+ expect(c.languageCode).toBe(true)
77
+ expect(c.maxChars).toBe(40000)
78
+ expect(c.languages).toHaveLength(32)
79
+ expect(c.languages).not.toContain("he")
80
+ })
81
+
82
+ it("multilingual: no tags, SSML, all five levers, no language code, 10,000 characters, 29 languages", () => {
83
+ const c = getTtsCapabilities("elevenlabs-multilingual")
84
+ expect(c.audioTags).toBe(false)
85
+ expect(c.ssmlBreaks).toBe(true)
86
+ expect(c.levers).toEqual(["stability", "similarity", "style", "speed", "speakerBoost"])
87
+ expect(c.languageCode).toBe(false)
88
+ expect(c.maxChars).toBe(10000)
89
+ expect(c.languages).toHaveLength(29)
90
+ })
91
+
92
+ it("dialogue (read from its catalog entry — its own lane): tags, stability only, 5,000 characters in total", () => {
93
+ const c = MODEL_CATALOG["elevenlabs-dialogue"]!.tts!
94
+ expect(c.audioTags).toBe(true)
95
+ expect(c.levers).toEqual(["stability"])
96
+ expect(c.maxChars).toBe(5000)
97
+ })
98
+ })
99
+
100
+ describe("speech-model capability lookups", () => {
101
+ it("the legacy alias reads as the model it runs on", () => {
102
+ expect(canonicalTtsProvider("elevenlabs")).toBe("elevenlabs-turbo")
103
+ expect(canonicalTtsProvider("elevenlabs-v3")).toBe("elevenlabs-v3")
104
+ expect(findTtsCapabilities("elevenlabs")).toBe(getTtsCapabilities("elevenlabs-turbo"))
105
+ })
106
+
107
+ it("a missing or unknown id gets the fallback model's sheet, and `find` says it is unknown", () => {
108
+ expect(findTtsCapabilities(undefined)).toBeUndefined()
109
+ expect(findTtsCapabilities("")).toBeUndefined()
110
+ expect(findTtsCapabilities("not-a-model")).toBeUndefined()
111
+ expect(findTtsCapabilities("nano-banana-pro")).toBeUndefined() // a real model, not a speech model
112
+ expect(getTtsCapabilities(undefined)).toBe(getTtsCapabilities("elevenlabs-turbo"))
113
+ expect(getTtsCapabilities("not-a-model")).toBe(getTtsCapabilities("elevenlabs-turbo"))
114
+ })
115
+
116
+ it("an id that is the name of an inherited object member is an unknown id, never a function", () => {
117
+ for (const id of ["constructor", "__proto__", "toString", "hasOwnProperty", "valueOf"]) {
118
+ expect(canonicalTtsProvider(id), id).toBe(id)
119
+ expect(findTtsCapabilities(id), id).toBeUndefined()
120
+ expect(getTtsCapabilities(id), id).toBe(getTtsCapabilities("elevenlabs-turbo"))
121
+ expect(ttsSupportsAudioTags(id), id).toBe(false)
122
+ expect(getMaxTtsChars(id), id).toBe(TTS_TEXT_MAX)
123
+ }
124
+ })
125
+
126
+ it("a non-string id (node data can be written straight into workflow JSON) is an unknown id — an array is not coerced into the model it spells", () => {
127
+ for (const id of [["elevenlabs-v3"], ["elevenlabs-multilingual"], ["elevenlabs"], 3, {}, true, null] as unknown as string[]) {
128
+ expect(findTtsCapabilities(id), JSON.stringify(id)).toBeUndefined()
129
+ expect(getTtsCapabilities(id), JSON.stringify(id)).toBe(getTtsCapabilities("elevenlabs-turbo"))
130
+ expect(ttsSupportsAudioTags(id), JSON.stringify(id)).toBe(false)
131
+ expect(ttsHasLever(id, "style"), JSON.stringify(id)).toBe(true)
132
+ expect(canonicalTtsProvider(id), JSON.stringify(id)).toBe(id)
133
+ }
134
+ })
135
+
136
+ it("the dialogue model has a sheet for its own lane but is not a text-to-speech model: a speech request naming it runs as the fallback", () => {
137
+ expect(MODEL_CATALOG["elevenlabs-dialogue"]!.tts).toBeDefined()
138
+ expect(findTtsCapabilities("elevenlabs-dialogue")).toBeUndefined()
139
+ expect(getTtsCapabilities("elevenlabs-dialogue")).toBe(getTtsCapabilities("elevenlabs-turbo"))
140
+ expect(ttsSupportsAudioTags("elevenlabs-dialogue")).toBe(false)
141
+ expect(ttsHasLever("elevenlabs-dialogue", "style")).toBe(true)
142
+ })
143
+
144
+ it("audio tags: kept on v3, stripped everywhere else (alias, unknown and missing included)", () => {
145
+ expect(ttsSupportsAudioTags("elevenlabs-v3")).toBe(true)
146
+ expect(ttsSupportsAudioTags("elevenlabs-turbo")).toBe(false)
147
+ expect(ttsSupportsAudioTags("elevenlabs-multilingual")).toBe(false)
148
+ expect(ttsSupportsAudioTags("elevenlabs")).toBe(false)
149
+ expect(ttsSupportsAudioTags(undefined)).toBe(false)
150
+ expect(ttsSupportsAudioTags("not-a-model")).toBe(false)
151
+ })
152
+
153
+ it("SSML breaks are the mirror image", () => {
154
+ expect(ttsSupportsSsmlBreaks("elevenlabs-turbo")).toBe(true)
155
+ expect(ttsSupportsSsmlBreaks("elevenlabs-multilingual")).toBe(true)
156
+ expect(ttsSupportsSsmlBreaks("elevenlabs-v3")).toBe(false)
157
+ })
158
+
159
+ it("levers", () => {
160
+ expect(ttsHasLever("elevenlabs-v3", "stability")).toBe(true)
161
+ expect(ttsHasLever("elevenlabs-v3", "similarity")).toBe(false)
162
+ expect(ttsHasLever("elevenlabs-v3", "speed")).toBe(false)
163
+ expect(ttsHasLever("elevenlabs-turbo", "similarity")).toBe(true)
164
+ expect(ttsHasLever("elevenlabs-turbo", "speed")).toBe(true)
165
+ expect(ttsHasLever("elevenlabs-turbo", "speakerBoost")).toBe(true)
166
+ })
167
+
168
+ it("languages nest: multilingual ⊂ turbo ⊂ v3", () => {
169
+ const multi = ttsLanguageCodes("elevenlabs-multilingual")
170
+ const turbo = ttsLanguageCodes("elevenlabs-turbo")
171
+ const v3 = ttsLanguageCodes("elevenlabs-v3")
172
+ expect(multi.every((c) => turbo.includes(c))).toBe(true)
173
+ expect(turbo.every((c) => v3.includes(c))).toBe(true)
174
+ expect(turbo.filter((c) => !multi.includes(c))).toEqual(["hu", "no", "vi"])
175
+ })
176
+ })
177
+
178
+ describe("character caps derive from the sheets", () => {
179
+ it("MAX_TTS_CHARS_BY_PROVIDER has exactly the catalog's speech models", () => {
180
+ const speaking = Object.values(MODEL_CATALOG).filter((m) => m.tts).map((m) => m.id).sort()
181
+ expect(Object.keys(MAX_TTS_CHARS_BY_PROVIDER).sort()).toEqual(speaking)
182
+ })
183
+
184
+ it("keeps every cap it had before the sheets existed; the alias and unknown ids keep the default", () => {
185
+ expect(getMaxTtsChars("elevenlabs-turbo")).toBe(40000)
186
+ expect(getMaxTtsChars("elevenlabs-multilingual")).toBe(10000)
187
+ expect(getMaxTtsChars("elevenlabs-v3")).toBe(5000)
188
+ expect(getMaxTtsChars("elevenlabs-dialogue")).toBe(5000)
189
+ expect(getMaxTtsChars("elevenlabs")).toBe(TTS_TEXT_MAX)
190
+ expect(getMaxTtsChars(undefined)).toBe(TTS_TEXT_MAX)
191
+ })
192
+ })
193
+
194
+ describe("elevenlabs-v4 — added beside v3", () => {
195
+ it("is a text-to-speech provider, in the catalog, with the sheet below", () => {
196
+ expect(TTS_PROVIDERS).toContain("elevenlabs-v4")
197
+ expect(MODEL_CATALOG["elevenlabs-v4"]?.modes).toContain("tts")
198
+ })
199
+
200
+ it("tags, no SSML, stability + similarity, 10,000 characters, the same 46 languages as v3", () => {
201
+ const c = getTtsCapabilities("elevenlabs-v4")
202
+ expect(c.audioTags).toBe(true)
203
+ expect(c.ssmlBreaks).toBe(false)
204
+ expect(c.levers).toEqual(["stability", "similarity"])
205
+ expect(c.languageCode).toBe(true)
206
+ expect(c.maxChars).toBe(10000)
207
+ expect(c.languages).toEqual(getTtsCapabilities("elevenlabs-v3").languages)
208
+ })
209
+
210
+ it("keeps [audio tags] and has no SSML breaks", () => {
211
+ expect(ttsSupportsAudioTags("elevenlabs-v4")).toBe(true)
212
+ expect(ttsSupportsSsmlBreaks("elevenlabs-v4")).toBe(false)
213
+ })
214
+
215
+ it("honours similarity but not speed, style or speaker boost", () => {
216
+ expect(ttsHasLever("elevenlabs-v4", "similarity")).toBe(true)
217
+ expect(ttsHasLever("elevenlabs-v4", "speed")).toBe(false)
218
+ expect(ttsHasLever("elevenlabs-v4", "style")).toBe(false)
219
+ expect(ttsHasLever("elevenlabs-v4", "speakerBoost")).toBe(false)
220
+ })
221
+
222
+ it("is capped at 10,000 characters; v3 stays at 5,000", () => {
223
+ expect(getMaxTtsChars("elevenlabs-v4")).toBe(10000)
224
+ expect(getMaxTtsChars("elevenlabs-v3")).toBe(5000)
225
+ })
226
+
227
+ it("costs a flat 30 credits with no per-length note, and is not the featured model — v3 stays the default", () => {
228
+ const v4 = MODEL_CATALOG["elevenlabs-v4"]!
229
+ expect(v4.pricing).toEqual([{ identifier: "elevenlabs-v4", credits: 30 }])
230
+ expect(v4.featured).toBeUndefined()
231
+ expect(MODEL_CATALOG["elevenlabs-v3"]!.featured).toBe(true)
232
+ })
233
+
234
+ it("does not call v3 the latest model any more", () => {
235
+ expect(MODEL_CATALOG["elevenlabs-v3"]!.description).not.toMatch(/latest/i)
236
+ })
237
+ })
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from "vitest"
2
2
  import {
3
- VIDEO_ANALYSIS_DURATION_BUCKETS, VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC,
3
+ VIDEO_ANALYSIS_DURATION_BUCKETS, VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC, VIDEO_ANALYSIS_BUCKET_GRACE_SEC,
4
4
  VIDEO_ANALYSIS_BUCKET_CREDITS,
5
5
  pickVideoAnalysisBucket, buildVideoAnalysisCreditId, bucketSecondsFromCreditId,
6
6
  videoAnalysisNumWindows,
@@ -25,7 +25,14 @@ describe("video-analysis-pricing", () => {
25
25
  it("buckets and ids", () => {
26
26
  expect(VIDEO_ANALYSIS_DURATION_BUCKETS).toEqual([60, 180, 360, 600])
27
27
  expect(pickVideoAnalysisBucket(59.6)).toBe(60)
28
- expect(pickVideoAnalysisBucket(60.4)).toBe(180)
28
+ // A part chosen as 1:00 downloads at about 1:03 (cut on keyframes): the
29
+ // bucket grace prices it as a minute. Past the grace, the next bucket.
30
+ expect(pickVideoAnalysisBucket(60.4)).toBe(60)
31
+ expect(pickVideoAnalysisBucket(63)).toBe(60)
32
+ expect(pickVideoAnalysisBucket(63.5)).toBe(180)
33
+ expect(pickVideoAnalysisBucket(183)).toBe(180)
34
+ expect(pickVideoAnalysisBucket(184)).toBe(360)
35
+ expect(buildVideoAnalysisCreditId("gemini-3.1-pro", 63)).toBe("video-analysis:gemini-3.1-pro:60s")
29
36
  expect(buildVideoAnalysisCreditId("gemini-3-flash", 170)).toBe("video-analysis:gemini-3-flash:180s")
30
37
  expect(buildVideoAnalysisCreditId("gemini-3.1-pro")).toBe("video-analysis:gemini-3.1-pro:600s") // unknown → ceiling
31
38
  expect(bucketSecondsFromCreditId("video-analysis:gemini-3-flash:180s")).toBe(180)
@@ -38,8 +45,18 @@ describe("video-analysis-pricing", () => {
38
45
  expect(videoAnalysisNumWindows(600)).toBe(5)
39
46
  })
40
47
 
41
- it("tolerance constant is exported for the worker re-check", () => {
42
- expect(VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC).toBe(3)
48
+ it("the worker re-check tolerates the pricing grace PLUS float drift on top of it", () => {
49
+ expect(VIDEO_ANALYSIS_BUCKET_GRACE_SEC).toBe(3)
50
+ // A clip priced into a bucket by the grace (probe says 63 s → 60 s bucket)
51
+ // must not then fail the worker gate on ffprobe float drift (63.4 s): the
52
+ // worker allows bucket + tolerance, so the tolerance must exceed the grace.
53
+ expect(VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC).toBe(6)
54
+ expect(VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC - VIDEO_ANALYSIS_BUCKET_GRACE_SEC).toBeGreaterThanOrEqual(3)
55
+ for (const bucket of VIDEO_ANALYSIS_DURATION_BUCKETS) {
56
+ const pricedAt = bucket + VIDEO_ANALYSIS_BUCKET_GRACE_SEC
57
+ expect(pickVideoAnalysisBucket(pricedAt)).toBe(bucket)
58
+ expect(pricedAt + 2 <= bucket + VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC).toBe(true)
59
+ }
43
60
  })
44
61
 
45
62
  it("model SSOT is capability-derived and Gemini-only today", () => {
@@ -154,17 +171,14 @@ describe("video-audit-pricing", () => {
154
171
  expect(buildVideoAuditCreditId({ analysisProvided: true, durationSec: 360 })).toBe("video-audit:360s")
155
172
  expect(buildVideoAuditCreditId({ analysisProvided: true, durationSec: 600 })).toBe("video-audit:600s")
156
173
 
157
- // Tolerance/boundary edges: 60 stays in the 60s bucket (inclusive upper
158
- // bound); 61/63/64 all bump straight to the next bucket (180s) — the
159
- // builder has NO grace period of its own (identical cliff behavior to
160
- // pickVideoAnalysisBucket / buildVideoAnalysisCreditId; any tolerance
161
- // grace is a WORKER re-check concern, private to the plugin, never baked
162
- // into this pure id builder).
174
+ // Boundary edges: the same bucket grace as pickVideoAnalysisBucket /
175
+ // buildVideoAnalysisCreditId (one ladder, one rule) — up to 63 s stays in
176
+ // the 60s bucket; 64 s moves to the next one.
163
177
  expect(buildVideoAuditCreditId({ analysisProvided: true, durationSec: 60 })).toBe("video-audit:60s")
164
- expect(buildVideoAuditCreditId({ analysisProvided: true, durationSec: 61 })).toBe("video-audit:180s")
165
- expect(buildVideoAuditCreditId({ analysisProvided: true, durationSec: 63 })).toBe("video-audit:180s")
178
+ expect(buildVideoAuditCreditId({ analysisProvided: true, durationSec: 61 })).toBe("video-audit:60s")
179
+ expect(buildVideoAuditCreditId({ analysisProvided: true, durationSec: 63 })).toBe("video-audit:60s")
166
180
  expect(buildVideoAuditCreditId({ analysisProvided: true, durationSec: 64 })).toBe("video-audit:180s")
167
- expect(buildVideoAuditCreditId({ analysisProvided: false, durationSec: 61 })).toBe("video-audit:auto:180s")
181
+ expect(buildVideoAuditCreditId({ analysisProvided: false, durationSec: 61 })).toBe("video-audit:auto:60s")
168
182
 
169
183
  // No / invalid duration → 600s ceiling composite, both families — the
170
184
  // ONLY silent-ceiling path, matching buildVideoAnalysisCreditId.
@@ -68,8 +68,8 @@ describe("links that URL parsers read differently", () => {
68
68
  })
69
69
 
70
70
  describe("consumers that do not need the video file", () => {
71
- it("names exactly the three readers that take the audio track or the page link", () => {
72
- expect([...VIDEO_LINK_TOLERANT_CONSUMER_TYPES].sort()).toEqual(["dubbing", "suno-cover", "transcribe"])
71
+ it("names exactly the readers that take the audio track or the page link", () => {
72
+ expect([...VIDEO_LINK_TOLERANT_CONSUMER_TYPES].sort()).toEqual(["content-recipe", "dubbing", "suno-cover", "transcribe"])
73
73
  })
74
74
  })
75
75