@nodaro/shared 3.20.0 → 3.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodaro/shared",
3
- "version": "3.20.0",
3
+ "version": "3.21.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",
@@ -0,0 +1,46 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import {
3
+ DEFAULT_TTS_PROVIDER,
4
+ TTS_PROVIDERS,
5
+ MODEL_CATALOG,
6
+ MODEL_RECOMMENDATIONS,
7
+ getTtsCapabilities,
8
+ getMaxTtsChars,
9
+ } from "../index.js"
10
+
11
+ /**
12
+ * The speech model a request runs on when it names none. Every lane reads this one
13
+ * constant — the REST route's credit guard and handler, the workflow engine's
14
+ * text-to-speech dispatch, the worker's defensive default, the MCP `generate_speech`
15
+ * tool, the narration pipeline, the video director and the editor's new-node default —
16
+ * so none of them can run one model and bill another.
17
+ *
18
+ * This file is the ONE place the literal is pinned; every other test asserts against
19
+ * the constant.
20
+ */
21
+ describe("DEFAULT_TTS_PROVIDER", () => {
22
+ it("is ElevenLabs v4 (the default flip, decided 2026-10-05)", () => {
23
+ expect(DEFAULT_TTS_PROVIDER).toBe("elevenlabs-v4")
24
+ })
25
+
26
+ it("is a real text-to-speech model: listed, priced, with a complete capability sheet", () => {
27
+ expect(TTS_PROVIDERS).toContain(DEFAULT_TTS_PROVIDER)
28
+ const entry = MODEL_CATALOG[DEFAULT_TTS_PROVIDER]
29
+ expect(entry?.modes as readonly string[] | undefined).toContain("tts")
30
+ expect(entry?.pricing.map((p) => p.identifier)).toContain(DEFAULT_TTS_PROVIDER)
31
+ expect(getTtsCapabilities(DEFAULT_TTS_PROVIDER).maxChars).toBe(getMaxTtsChars(DEFAULT_TTS_PROVIDER))
32
+ })
33
+
34
+ it("is not the legacy `elevenlabs` alias (that id runs, and is billed, as turbo)", () => {
35
+ expect(DEFAULT_TTS_PROVIDER).not.toBe("elevenlabs")
36
+ })
37
+
38
+ it("is the one featured speech model, and leads the narration recommendation", () => {
39
+ const featuredTts = Object.values(MODEL_CATALOG)
40
+ .filter((m) => (m.modes as readonly string[]).includes("tts") && m.featured === true)
41
+ .map((m) => m.id)
42
+ expect(featuredTts).toEqual([DEFAULT_TTS_PROVIDER])
43
+ const narration = MODEL_RECOMMENDATIONS.find((r) => r.intent === "voice over / narration")
44
+ expect(narration?.modelIds[0]).toBe(DEFAULT_TTS_PROVIDER)
45
+ })
46
+ })
@@ -224,11 +224,12 @@ describe("elevenlabs-v4 — added beside v3", () => {
224
224
  expect(getMaxTtsChars("elevenlabs-v3")).toBe(5000)
225
225
  })
226
226
 
227
- it("costs a flat 30 credits with no per-length note, and is not the featured model — v3 stays the default", () => {
227
+ it("costs a flat 30 credits with no per-length note — the same as v3 — and, as the default, is the featured model", () => {
228
228
  const v4 = MODEL_CATALOG["elevenlabs-v4"]!
229
229
  expect(v4.pricing).toEqual([{ identifier: "elevenlabs-v4", credits: 30 }])
230
- expect(v4.featured).toBeUndefined()
231
- expect(MODEL_CATALOG["elevenlabs-v3"]!.featured).toBe(true)
230
+ expect(MODEL_CATALOG["elevenlabs-v3"]!.pricing).toEqual([{ identifier: "elevenlabs-v3", credits: 30 }])
231
+ expect(v4.featured).toBe(true)
232
+ expect(MODEL_CATALOG["elevenlabs-v3"]!.featured).toBeUndefined()
232
233
  })
233
234
 
234
235
  it("does not call v3 the latest model any more", () => {
package/src/index.ts CHANGED
@@ -86,6 +86,7 @@ export {
86
86
  SEEDANCE_LIP_SYNC_PROVIDERS,
87
87
  MOTION_TRANSFER_PROVIDERS,
88
88
  TTS_PROVIDERS,
89
+ DEFAULT_TTS_PROVIDER,
89
90
  TEXT_TO_AUDIO_PROVIDERS,
90
91
  DEFAULT_TEXT_TO_AUDIO_PROVIDER,
91
92
  MUSIC_PROVIDERS,
@@ -257,7 +257,7 @@ export const MODEL_RECOMMENDATIONS: readonly ModelRecommendation[] = [
257
257
  { intent: "cheap batch video clips", modelIds: ["veo3.1", "wan-turbo", "bytedance-lite"], note: "VEO 3.1 Fast is the best price/quality balance with native audio." },
258
258
  { intent: "video with start + end frame", modelIds: ["veo3", "veo3.1", "kling-turbo", "minimax", "hailuo-standard", "seedance-2"], note: "All listed support an end frame; VEO uses imageUrls[start, end]." },
259
259
  { intent: "music / song generation", modelIds: ["suno-v6", "suno-v6_wild", "suno-v6_mini", "suno-v5_5"], note: "V6 is the default flagship; V6 Wild for bolder, less predictable results; V6 Mini when speed matters; v5.5 / v5 / v4 keep their own character. Same price." },
260
- { intent: "voice over / narration", modelIds: ["elevenlabs-v3", "elevenlabs-turbo"], note: "v3 supports [audio tags] for emotion; Turbo is cheaper for plain narration." },
260
+ { intent: "voice over / narration", modelIds: ["elevenlabs-v4", "elevenlabs-v3", "elevenlabs-turbo"], note: "v4 is the default: [audio tags] for emotion and up to 10,000 characters per request. v3 is the previous expressive model, still selectable. Turbo is cheaper for plain narration." },
261
261
  { intent: "lip-sync a portrait to audio", modelIds: ["kling-avatar-pro", "kling-avatar", "infinitalk"], note: "Pro for best mouth shape; InfiniTalk for resolution control." },
262
262
  { intent: "transcription / captions", modelIds: ["elevenlabs-stt", "incredibly-fast-whisper", "whisper"], note: "Captions need WORD timestamps: ElevenLabs STT (always) or Incredibly Fast Whisper. Plain Whisper returns phrase segments only." },
263
263
  { intent: "motion transfer (drive a subject by another video)", modelIds: ["motion-transfer", "kling-3.0-motion"], note: "Kling 2.6 base is cheap; Kling 3.0 is premium." },
@@ -2487,7 +2487,6 @@ const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
2487
2487
  useCases: ["tts", "voice-over", "narration", "expressive"],
2488
2488
  features: ["audio-tags", "voice-cloning"],
2489
2489
  pricing: [{ identifier: "elevenlabs-v3", credits: 30 }],
2490
- featured: true,
2491
2490
  tts: {
2492
2491
  audioTags: true,
2493
2492
  ssmlBreaks: false,
@@ -2508,6 +2507,8 @@ const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
2508
2507
  useCases: ["tts", "voice-over", "narration", "expressive", "long-form"],
2509
2508
  features: ["audio-tags", "voice-cloning"],
2510
2509
  pricing: [{ identifier: "elevenlabs-v4", credits: 30 }],
2510
+ // The default speech model (DEFAULT_TTS_PROVIDER) carries the star.
2511
+ featured: true,
2511
2512
  tts: {
2512
2513
  audioTags: true,
2513
2514
  ssmlBreaks: false,
@@ -1222,6 +1222,19 @@ export const TTS_PROVIDERS = [
1222
1222
  ] as const
1223
1223
  export type TtsProvider = typeof TTS_PROVIDERS[number]
1224
1224
 
1225
+ /**
1226
+ * The speech model a request runs on when it names none — ElevenLabs v4 since the
1227
+ * default flip (decided 2026-10-05; v3 stays selectable). The REST route's credit
1228
+ * guard and handler, the workflow engine's text-to-speech dispatch, the worker's
1229
+ * defensive default, the MCP `generate_speech` tool, the narration pipeline, the
1230
+ * video director and the editor's new-node default all read THIS, so they can never
1231
+ * disagree about which model ran and which one was billed. A request with no model
1232
+ * also follows a length rule: text longer than this model's cap runs on turbo instead.
1233
+ * The REST route, the workflow engine, the narration pipeline and the worker apply it
1234
+ * through one backend function; the MCP tool refuses such text with the number.
1235
+ */
1236
+ export const DEFAULT_TTS_PROVIDER: TtsProvider = "elevenlabs-v4"
1237
+
1225
1238
  /** Text-to-audio providers */
1226
1239
  export const TEXT_TO_AUDIO_PROVIDERS = [
1227
1240
  // Replicate disabled
package/src/voices.ts CHANGED
@@ -24,19 +24,23 @@ export interface Voice {
24
24
  export interface SharedVoice extends Voice {
25
25
  /**
26
26
  * The best of our TTS providers whose underlying ElevenLabs model the
27
- * voice lists in `verified_languages` (v3 preferred when verified — it's
28
- * the fully-multilingual default and renders any voice unmodified —
29
- * else the cheapest v2 model: turbo preferred, else multilingual).
27
+ * voice lists in `verified_languages` (v4 preferred when verified, then v3,
28
+ * which renders any voice unmodified, then the cheapest v2 model: turbo
29
+ * preferred, else multilingual). Only the base model id `eleven_v4` counts
30
+ * toward v4; its `eleven_v4_…` variants do not. Models the deployment does
31
+ * not offer are never recommended.
30
32
  * Clients without a provider picker should send it as the `provider` on
31
33
  * text-to-speech so generation uses a model the voice is actually verified
32
34
  * for — rendering a voice on an unverified model is what makes output drift
33
- * audibly from its preview. Absent when the entry has no model metadata.
35
+ * audibly from its preview. Absent when the entry has no model metadata, or
36
+ * when none of the models it is verified for is offered by the deployment.
34
37
  */
35
38
  recommendedProvider?: TtsProvider
36
39
  /**
37
- * Every TTS provider the voice is verified on (subset of `elevenlabs-v3` /
38
- * `elevenlabs-turbo` / `elevenlabs-multilingual`, v3 first when present,
39
- * then turbo). Clients WITH a provider picker should only snap the
40
+ * Every TTS provider the voice is verified on and the deployment offers
41
+ * (subset of `elevenlabs-v4` / `elevenlabs-v3` / `elevenlabs-turbo` /
42
+ * `elevenlabs-multilingual`, v4 first when present, then v3, turbo,
43
+ * multilingual); absent whenever `recommendedProvider` is. Clients WITH a provider picker should only snap the
40
44
  * provider when the current choice is NOT in this set — most voices verify
41
45
  * more than one, and an explicit user choice within the set must win.
42
46
  */