@nodaro/shared 3.20.0 → 3.23.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 (86) hide show
  1. package/dist/index.cjs +2287 -195
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +1938 -82
  4. package/dist/index.d.ts +1938 -82
  5. package/dist/index.js +2119 -196
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/__tests__/add-captions-plan.test.ts +33 -0
  9. package/src/__tests__/caption-plan-parse.test.ts +23 -0
  10. package/src/__tests__/caption-segment-schema.test.ts +30 -0
  11. package/src/__tests__/collections.test.ts +253 -0
  12. package/src/__tests__/default-tts-provider.test.ts +46 -0
  13. package/src/__tests__/dialogue-capabilities.test.ts +157 -0
  14. package/src/__tests__/edit-plan-review.test.ts +70 -0
  15. package/src/__tests__/edl-clocks.test.ts +97 -0
  16. package/src/__tests__/edl.test.ts +34 -0
  17. package/src/__tests__/execution-outcome.test.ts +44 -0
  18. package/src/__tests__/fan-out-meta.test.ts +23 -0
  19. package/src/__tests__/fan-out-rows.test.ts +36 -0
  20. package/src/__tests__/fan-out-url-item.test.ts +44 -0
  21. package/src/__tests__/fixtures/speaker-tracks.fixtures.json +622 -0
  22. package/src/__tests__/input-field-extra-keys.test.ts +34 -0
  23. package/src/__tests__/list-consumers-fan-in.test.ts +40 -0
  24. package/src/__tests__/model-tree.test.ts +7 -0
  25. package/src/__tests__/node-pass-through.test.ts +23 -0
  26. package/src/__tests__/node-runtime-keys.test.ts +1 -0
  27. package/src/__tests__/picker-restrictions.test.ts +36 -0
  28. package/src/__tests__/preview-gate.test.ts +305 -0
  29. package/src/__tests__/render-basis.test.ts +176 -0
  30. package/src/__tests__/render-nodes.test.ts +73 -0
  31. package/src/__tests__/render-output.test.ts +392 -0
  32. package/src/__tests__/run-continuation.test.ts +32 -0
  33. package/src/__tests__/speaker-tracks.test.ts +474 -0
  34. package/src/__tests__/speech-pricing.test.ts +69 -0
  35. package/src/__tests__/telegram-channel.test.ts +91 -0
  36. package/src/__tests__/tts-capabilities.test.ts +83 -5
  37. package/src/__tests__/tts-neighbour-text.test.ts +19 -0
  38. package/src/__tests__/ugc-call-body.test.ts +38 -0
  39. package/src/__tests__/ugc-run-state.test.ts +68 -0
  40. package/src/__tests__/video-character-refs.test.ts +213 -0
  41. package/src/__tests__/video-overlay-layer-plan.test.ts +94 -0
  42. package/src/add-captions-plan.ts +50 -0
  43. package/src/caption-plan.ts +45 -0
  44. package/src/caption-segment-schema.ts +82 -0
  45. package/src/collections.ts +462 -0
  46. package/src/competitors.ts +77 -0
  47. package/src/credit-estimators/index.ts +9 -0
  48. package/src/credit-estimators/speech.ts +51 -0
  49. package/src/dialogue-capabilities.ts +48 -0
  50. package/src/edit-plan-contract.ts +20 -9
  51. package/src/edit-plan-review.ts +40 -1
  52. package/src/edl.ts +27 -1
  53. package/src/execution-outcome.ts +41 -0
  54. package/src/fan-out-meta.ts +23 -0
  55. package/src/fan-out-rows.ts +74 -5
  56. package/src/gemini-omni-voices.ts +59 -0
  57. package/src/handle-aliases.ts +295 -0
  58. package/src/i18n/camera-motions.pt-BR.ts +14 -14
  59. package/src/i18n/transitions.pt-BR.ts +13 -13
  60. package/src/index.ts +180 -1
  61. package/src/model-catalog.ts +125 -15
  62. package/src/model-constants.ts +37 -4
  63. package/src/model-tree.ts +5 -1
  64. package/src/node-execution-state.ts +13 -0
  65. package/src/node-mappable-fields.ts +7 -1
  66. package/src/node-pass-through.ts +37 -0
  67. package/src/node-runtime-keys.ts +14 -0
  68. package/src/picker-restrictions.ts +49 -0
  69. package/src/presentation-types.ts +26 -2
  70. package/src/presentation-utils.ts +25 -7
  71. package/src/preview-gate.ts +279 -0
  72. package/src/producer-types.ts +58 -0
  73. package/src/render-final.ts +20 -0
  74. package/src/render-nodes.ts +92 -0
  75. package/src/render-output.ts +565 -0
  76. package/src/run-continuation.ts +39 -0
  77. package/src/speaker-tracks.ts +638 -0
  78. package/src/telegram-channel.ts +140 -0
  79. package/src/transcribe-preflight.ts +8 -4
  80. package/src/tts-capabilities.ts +19 -5
  81. package/src/tts-neighbour-text.ts +46 -0
  82. package/src/ugc-call-body.ts +86 -0
  83. package/src/ugc-run-state.ts +64 -0
  84. package/src/video-character-refs.ts +233 -0
  85. package/src/video-overlay.ts +78 -21
  86. package/src/voices.ts +11 -7
package/src/index.ts CHANGED
@@ -86,6 +86,9 @@ export {
86
86
  SEEDANCE_LIP_SYNC_PROVIDERS,
87
87
  MOTION_TRANSFER_PROVIDERS,
88
88
  TTS_PROVIDERS,
89
+ DEFAULT_TTS_PROVIDER,
90
+ DIALOGUE_PROVIDERS,
91
+ DEFAULT_DIALOGUE_PROVIDER,
89
92
  TEXT_TO_AUDIO_PROVIDERS,
90
93
  DEFAULT_TEXT_TO_AUDIO_PROVIDER,
91
94
  MUSIC_PROVIDERS,
@@ -221,6 +224,7 @@ export type {
221
224
  LipSyncProvider,
222
225
  MotionTransferProviderType,
223
226
  TtsProvider,
227
+ DialogueProvider,
224
228
  TextToAudioProvider,
225
229
  MusicProvider,
226
230
  TranscribeProvider,
@@ -247,6 +251,25 @@ export type {
247
251
  } from "./model-constants.js"
248
252
 
249
253
 
254
+ export {
255
+ VIDEO_CHARACTER_REFS_WIRE_MAX,
256
+ VIDEO_CHARACTER_DESCRIPTION_MAX,
257
+ VIDEO_CHARACTER_NAME_MAX,
258
+ videoCharacterRefCap,
259
+ videoCharacterRefProviders,
260
+ videoCharacterRefUnits,
261
+ videoCharacterRefProblem,
262
+ videoCharacterVoiceCap,
263
+ videoCharacterVoiceKey,
264
+ videoCharacterDistinctVoices,
265
+ videoCharacterVoiceProblem,
266
+ VIDEO_CHARACTER_VOICE_DESCRIPTION_MAX,
267
+ VIDEO_CHARACTER_VOICE_EXAMPLE_MAX,
268
+ } from "./video-character-refs.js"
269
+ export type { VideoCharacterReference, VideoCharacterVoice, VideoCharacterRefProblem } from "./video-character-refs.js"
270
+ export { GEMINI_OMNI_VOICE_PRESETS, GEMINI_OMNI_VOICE_PRESET_IDS } from "./gemini-omni-voices.js"
271
+ export type { GeminiOmniVoicePreset, GeminiOmniVoicePresetId } from "./gemini-omni-voices.js"
272
+
250
273
  export { describeMaskRegion } from "./inpaint-region.js"
251
274
  export type { MaskRegionDescriptor, PixelBox } from "./inpaint-region.js"
252
275
 
@@ -307,6 +330,8 @@ export {
307
330
  getNodeResult,
308
331
  getNodeLabel,
309
332
  getInputFieldSchema,
333
+ INPUT_FIELD_EXTRA_KEYS,
334
+ getInputFieldExtraKeys,
310
335
  mergeNodeInputOverrides,
311
336
  flattenItems,
312
337
  migrateToItems,
@@ -323,6 +348,8 @@ export {
323
348
  canonicalizeOverrideKeys,
324
349
  } from "./exposed-field-keys.js"
325
350
 
351
+ export { findRestrictedPickerValue, type PickerCardRestrictions } from "./picker-restrictions.js"
352
+
326
353
  export {
327
354
  ITER_CLONE_PATTERN,
328
355
  isExpandedClone,
@@ -461,14 +488,16 @@ export { REPEATABLE_NODE_TYPES, REPEAT_PLACEHOLDER, PROVIDER_PLACEHOLDER_PREFIX,
461
488
  export {
462
489
  NON_PROMPT_TEXT_LANES,
463
490
  fanOutTextFeedsPrompt,
491
+ fanOutUrlItemIsText,
464
492
  isFanOutUrlItem,
465
493
  compactWithRows,
494
+ pickHeldRow,
466
495
  liveRowColumn,
467
496
  resolveListFanOut,
468
497
  planFanOut,
469
498
  alignedFieldList,
470
499
  } from "./fan-out-rows.js"
471
- export type { FanOutCandidate, ListFanOut, FanOutPlan } from "./fan-out-rows.js"
500
+ export type { FanOutCandidate, ListFanOut, FanOutPlan, HeldRowPick } from "./fan-out-rows.js"
472
501
 
473
502
  export { settledWithLimit } from "./settled-with-limit.js"
474
503
 
@@ -722,6 +751,52 @@ export {
722
751
  } from "./telegram-account-send.js"
723
752
 
724
753
  export { buildFeedMaps, nodeFeedsAnything, type FeedNode, type FeedEdge, type FeedMaps } from "./trigger-feeds.js"
754
+ export {
755
+ RENDER_NODE_TYPES,
756
+ RENDER_NODE_TYPE_IDS,
757
+ OWNER_ONLY_LISTING_RENDER_TYPES,
758
+ renderNodeOf,
759
+ isRenderNodeType,
760
+ rendersLatestBatch,
761
+ rendersTranscriptJson,
762
+ type RenderNodeDescriptor,
763
+ type RenderClockSource,
764
+ type RenderJsonKind,
765
+ } from "./render-nodes.js"
766
+ export {
767
+ PREVIEW_RENDER_NODE_TYPES,
768
+ PREVIEW_REVIEW_REQUIRED,
769
+ PREVIEW_RENDER_NESTED,
770
+ RUN_OVERRIDE_CLEARED_FIELDS,
771
+ SAVED_RENDER_STAMPS,
772
+ NO_SAVED_RENDER_STAMPS,
773
+ rendersAsPreview,
774
+ previewStops,
775
+ previewGatedNodeIds,
776
+ holdsPreviewRender,
777
+ withRunOverrides,
778
+ type PreviewGateNode,
779
+ type PreviewGateEdge,
780
+ type PreviewGateRun,
781
+ type PreviewStops,
782
+ type SavedRenderQualityStamp,
783
+ type SavedRenderStampReader,
784
+ } from "./preview-gate.js"
785
+ export {
786
+ CONTINUATION_NOT_FOUND,
787
+ CONTINUATION_WORKFLOW_MISMATCH,
788
+ CONTINUATION_VERSION_MISMATCH,
789
+ CONTINUATION_NOT_COMPLETED,
790
+ CONTINUATION_SUBSET_REQUIRED,
791
+ RUN_CONTINUATION_CODES,
792
+ type RunContinuationCode,
793
+ } from "./run-continuation.js"
794
+ export {
795
+ RENDER_FINAL_NODE_NOT_FOUND,
796
+ RENDER_FINAL_NOT_A_RENDER,
797
+ RENDER_FINAL_CODES,
798
+ type RenderFinalCode,
799
+ } from "./render-final.js"
725
800
 
726
801
  export {
727
802
  SCHEDULE_RULE_KINDS,
@@ -922,6 +997,60 @@ export {
922
997
  type SavedPostsLookupResult,
923
998
  } from "./saved-posts.js"
924
999
 
1000
+ export {
1001
+ COLLECTION_NAME_MAX,
1002
+ COLLECTION_DESCRIPTION_MAX,
1003
+ COLLECTION_RECORD_TITLE_MAX,
1004
+ COLLECTION_RECORD_TEXT_MAX,
1005
+ COLLECTION_RECORD_URL_MAX,
1006
+ COLLECTION_RECORD_MEDIA_MAX,
1007
+ COLLECTION_RECORD_FIELDS_MAX,
1008
+ COLLECTION_RECORD_FIELDS_BYTES_MAX,
1009
+ COLLECTION_DEDUPE_KEY_MAX,
1010
+ COLLECTION_EVICT_MAX_PER_WRITE,
1011
+ COLLECTION_IDEMPOTENCY_KEY_MAX,
1012
+ COLLECTIONS_PAGE_MAX,
1013
+ COLLECTIONS_PAGE_DEFAULT,
1014
+ COLLECTION_HEADLINE_MAX,
1015
+ COLLECTION_MEDIA_TYPES,
1016
+ COLLECTION_TIER_CAPS,
1017
+ COLLECTION_DIGEST_SEPARATOR,
1018
+ COLLECTION_READ_WINDOW_HOURS_MAX,
1019
+ COLLECTION_READ_LIMIT_MAX,
1020
+ collectionReadSince,
1021
+ collectionCapsForTier,
1022
+ clampChars,
1023
+ normalizeDedupeKey,
1024
+ isCollectionUrl,
1025
+ isCollectionMedia,
1026
+ normalizeCollectionMedia,
1027
+ normalizeCollectionFields,
1028
+ collectionRecordHeadline,
1029
+ collectionRecordsDigest,
1030
+ ingestRecordFromJson,
1031
+ type CollectionMediaType,
1032
+ type CollectionMedia,
1033
+ type CollectionCaps,
1034
+ type CollectionLimits,
1035
+ type Collection,
1036
+ type CollectionRecordSource,
1037
+ type CollectionFieldValue,
1038
+ type CollectionRecord,
1039
+ type ListCollectionsResult,
1040
+ type CreateCollectionInput,
1041
+ type UpdateCollectionInput,
1042
+ type ListCollectionRecordsParams,
1043
+ type ListCollectionRecordsResult,
1044
+ type AddCollectionRecordInput,
1045
+ type CollectionWriteOutcome,
1046
+ type AddCollectionRecordResult,
1047
+ type CollectionExportFormat,
1048
+ type CollectionDigestFormat,
1049
+ type CollectionReadWindowUnit,
1050
+ type CollectionReadOrder,
1051
+ type IngestedRecord,
1052
+ } from "./collections.js"
1053
+
925
1054
  export {
926
1055
  COMPETITOR_ACCOUNT_KEYS,
927
1056
  COMPETITOR_ABOUT_PLATFORMS,
@@ -969,6 +1098,15 @@ export {
969
1098
  type CompetitorScanSummary,
970
1099
  type CompetitorScan,
971
1100
  type CompetitorDetail,
1101
+ type CompetitorListResult,
1102
+ type CompetitorHistory,
1103
+ type CompetitorHistoryPoint,
1104
+ type CompetitorHistoryPlatform,
1105
+ type CompetitorPeriod,
1106
+ type CompetitorPeriodPlatform,
1107
+ type CompetitorPeriodFollowers,
1108
+ type CompetitorCompareInput,
1109
+ type CompetitorCompareResult,
972
1110
  type CompetitorCardsResult,
973
1111
  type CompetitorLessonsResult,
974
1112
  type BrandLesson,
@@ -1090,6 +1228,7 @@ export { pickIds, togglePick } from "./multi-pick.js"
1090
1228
  export {
1091
1229
  MODEL_CATALOG,
1092
1230
  MODEL_RECOMMENDATIONS,
1231
+ SPEECH_UNIT_PRICE_NOTE,
1093
1232
  listModels,
1094
1233
  groupByFamily,
1095
1234
  groupByKindAndFamily,
@@ -1141,10 +1280,27 @@ export {
1141
1280
  getTtsCapabilities,
1142
1281
  ttsSupportsAudioTags,
1143
1282
  ttsSupportsSsmlBreaks,
1283
+ ttsSupportsStitching,
1144
1284
  ttsHasLever,
1145
1285
  ttsLanguageCodes,
1286
+ ttsSupportsTimestamps,
1146
1287
  } from "./tts-capabilities.js"
1147
1288
 
1289
+ // The neighbour-text rule (cap + normaliser) every Text to Speech sender and exit shares.
1290
+ export { TTS_NEIGHBOUR_TEXT_MAX_CHARS, normalizeTtsNeighbourText } from "./tts-neighbour-text.js"
1291
+ export type { TtsNeighbourText } from "./tts-neighbour-text.js"
1292
+
1293
+ // The dialogue lane's lookups: answer only for dialogue models; an unknown id
1294
+ // runs as DEFAULT_DIALOGUE_PROVIDER (v3 dialogue).
1295
+ export {
1296
+ findDialogueCapabilities,
1297
+ dialogueProviderOf,
1298
+ getDialogueCapabilities,
1299
+ dialogueHasLever,
1300
+ dialogueStabilityAccepted,
1301
+ dialogueSupportsTimestamps,
1302
+ } from "./dialogue-capabilities.js"
1303
+
1148
1304
  // Per-model safety-filter retry/fallback policy (derives from
1149
1305
  // `ModelCatalogEntry.safetyFilter` above).
1150
1306
  export { safetyRetryPolicy } from "./safety-retry-policy.js"
@@ -1171,6 +1327,10 @@ export {
1171
1327
  } from "./caption-styles.js"
1172
1328
  export type { StaticCaptionStyle, KineticCaptionStyle, CaptionStyle, CaptionLookId, CaptionLookLevers, KineticOnlyCaptionLeverKey } from "./caption-styles.js"
1173
1329
  export type { CaptionPlan, CaptionWordTiming } from "./caption-plan.js"
1330
+ export { parseCaptionPlan } from "./caption-plan.js"
1331
+ export * from "./caption-segment-schema.js"
1332
+ export * from "./add-captions-plan.js"
1333
+ export * from "./node-pass-through.js"
1174
1334
 
1175
1335
  export {
1176
1336
  transcribeWordTimestampsRefusal,
@@ -1360,8 +1520,10 @@ export {
1360
1520
  VIDEO_PRODUCER_TYPES,
1361
1521
  AUDIO_PRODUCER_TYPES,
1362
1522
  DYNAMIC_PRODUCER_TYPES,
1523
+ IMAGE_PRODUCER_TYPES,
1363
1524
  FAN_OUT_EACH_TYPES,
1364
1525
  FAN_OUT_EACH_HANDLES,
1526
+ FAN_OUT_ALL_OR_NOTHING_TYPES,
1365
1527
  OWN_LIST_NODE_TYPES,
1366
1528
  ownsItsList,
1367
1529
  defaultEdgeOutputMode,
@@ -1371,6 +1533,8 @@ export {
1371
1533
  isFanInEdge,
1372
1534
  } from "./producer-types.js"
1373
1535
 
1536
+ export * from "./fan-out-meta.js"
1537
+
1374
1538
  export { SUNO_TRACK_SOURCE_TYPES } from "./suno-track-sources.js"
1375
1539
 
1376
1540
  // --- Video URL node + social-video import (host allowlist, node output rule) ---
@@ -1408,7 +1572,10 @@ export {
1408
1572
  export type {
1409
1573
  NodeExecutionStatus,
1410
1574
  NodeExecutionStateWire,
1575
+ NodeSkipReason,
1411
1576
  } from "./node-execution-state.js"
1577
+ export { executionOutcome, countEmptyInputSkips } from "./execution-outcome.js"
1578
+ export type { ExecutionOutcome } from "./execution-outcome.js"
1412
1579
 
1413
1580
  export {
1414
1581
  MODEL_PARAM_NODE_TYPES,
@@ -1557,9 +1724,21 @@ export type { CharacterMotionMetadata } from "./character-motion-metadata.js"
1557
1724
  export * from "./edl.js"
1558
1725
  export * from "./speaker-layouts.js"
1559
1726
  export * from "./edl-multicam.js"
1727
+ // Speaker tracks: the face-tracking result (box body + the node's descriptor) and its validators.
1728
+ export * from "./speaker-tracks.js"
1560
1729
  export * from "./camera-switch-contract.js"
1561
1730
  export * from "./edit-plan-contract.js"
1731
+ // A render's saved output (one reader for both engines) and its result stamps.
1732
+ export * from "./render-output.js"
1562
1733
  // A person's review of an Edit Plan (`editedEdl`) and the one resolver that applies it.
1563
1734
  export * from "./edit-plan-review.js"
1564
1735
 
1565
1736
  export { VIDEO_DURATION_AUTO, isAutoVideoDuration } from "./video-duration-auto.js"
1737
+ // Legacy handle ids → the canonical id every reader rewires them to (editor load, MCP writes, Copilot).
1738
+ export * from "./handle-aliases.js"
1739
+ // Telegram Channel Feed: the post shape, the digest, and the cursor rule (where the feed stands after a run).
1740
+ export * from "./telegram-channel.js"
1741
+ // UGC run state: which node-data keys are a run's state (stripped on publish) and which a runner may override.
1742
+ export * from "./ugc-run-state.js"
1743
+ // UGC builder call → the REST body of the public route it dispatches to (the canvas and the app run the builder's calls through it).
1744
+ export * from "./ugc-call-body.js"
@@ -82,19 +82,27 @@ export interface PriceVariant {
82
82
  note?: string
83
83
  }
84
84
 
85
+ /**
86
+ * The note on every speech model's `<model>:per-100-chars` pricing row. The
87
+ * row is a rate: one started 100 characters of the text sent, at least 8 units
88
+ * per request (`credit-estimators/speech.ts`). An instance serves the row only
89
+ * while it prices speech by length; a client that does not see it quotes the
90
+ * flat row. (The ids are literals on the entries — this file cannot import
91
+ * the speech estimator without a cycle through tts-capabilities.ts; the
92
+ * pricing-coverage tests pin each literal to `speechUnitCreditId(id)`.)
93
+ */
94
+ export const SPEECH_UNIT_PRICE_NOTE = "per started 100 characters, at least 8 units — where length pricing is on"
95
+
85
96
  /** A voice-setting lever a speech model honours. */
86
97
  export type TtsSettingLever = "stability" | "similarity" | "style" | "speed" | "speakerBoost"
87
98
 
88
99
  /**
89
100
  * What a speech model (text-to-speech or dialogue) accepts. The ONE source for
90
- * every "does this model do X" decision on the text-to-speech lane — tag
91
- * stripping, which voice settings are sent and shown, the language picker, the
92
- * per-request character cap. Never compare a provider id by hand; read the sheet
93
- * through the helpers in `tts-capabilities.ts`.
94
- *
95
- * The dialogue model carries a sheet for its own lane too, but until that lane
96
- * is moved onto it only `maxChars` and `languages` of that sheet are read:
97
- * editing its other fields changes no dialogue request.
101
+ * every "does this model do X" decision — tag stripping, which voice settings
102
+ * are sent and shown, the language picker, the per-request character cap. Never
103
+ * compare a provider id by hand; read the sheet through the helpers in
104
+ * `tts-capabilities.ts` (the text-to-speech lane) or `dialogue-capabilities.ts`
105
+ * (the dialogue lane). Each lane's helpers answer only for its own models.
98
106
  */
99
107
  export interface TtsCapabilities {
100
108
  /** Inline `[audio tags]` are performed. false ⇒ strip them before sending (the model reads them aloud). */
@@ -103,8 +111,31 @@ export interface TtsCapabilities {
103
111
  ssmlBreaks: boolean
104
112
  /** Voice settings the model honours. A lever not listed is never sent and never shown. */
105
113
  levers: readonly TtsSettingLever[]
114
+ /**
115
+ * The stability values THIS PLATFORM accepts for the model, when it offers
116
+ * steps instead of a 0–1 range (ascending). Absent ⇒ any value from 0 to 1.
117
+ * A product choice, not a vendor limit: ElevenLabs takes other values too on
118
+ * some models; the steps are what our routes validate and our pickers offer.
119
+ */
120
+ stabilitySteps?: readonly number[]
106
121
  /** The request may carry a language code. false ⇒ the field is omitted. */
107
122
  languageCode: boolean
123
+ /**
124
+ * The model answers the `/with-timestamps` form of its endpoint with
125
+ * character timings (and, for dialogue, per-line `voice_segments`). When true
126
+ * the platform ALWAYS renders dialogue through it and the job output carries a
127
+ * `transcript` (decided 2026-10-06); when false the plain endpoint is used
128
+ * and the request is byte-identical to before the field existed.
129
+ */
130
+ timestamps: boolean
131
+ /**
132
+ * The model conditions a request on the text spoken before and after it
133
+ * (`previous_text` / `next_text`), for continuous intonation across clips
134
+ * produced separately. false ⇒ the fields are never sent: a model that does
135
+ * not take them rejects the request (eleven_v3: 400), which would fail a paid
136
+ * job. Values from live calls, never assumed (phase 6 plan, Task 0).
137
+ */
138
+ stitching: boolean
108
139
  /**
109
140
  * Per-request character cap (the total across lines for a dialogue model).
110
141
  * `getMaxTtsChars` reads it by exact id and answers {@link TTS_TEXT_MAX}'s 5,000 for
@@ -257,7 +288,7 @@ export const MODEL_RECOMMENDATIONS: readonly ModelRecommendation[] = [
257
288
  { 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
289
  { 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
290
  { 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." },
291
+ { 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
292
  { 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
293
  { 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
294
  { 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." },
@@ -2473,6 +2504,16 @@ const TTS_LANGS_V3 = [
2473
2504
  ] as const
2474
2505
  // Every lever the v2 families are sent today.
2475
2506
  const TTS_LEVERS_V2 = ["stability", "similarity", "style", "speed", "speakerBoost"] as const
2507
+ /**
2508
+ * ElevenLabs Dialogue v4's total-character cap across lines — ONE constant, so
2509
+ * the live probe's answer lands in one place. Rule (decided 2026-10-06): the
2510
+ * largest of 2,500 / 5,000 that returned 200, voiced its last line and finished
2511
+ * well inside the funnel's timeout in a live check of v4 dialogue above 2,000
2512
+ * characters; never above 5,000 (parity with v3 dialogue) without a separate
2513
+ * decision. Written at parity until that check reports; ElevenLabs recommends
2514
+ * ≤ 2,000 for quality on either model.
2515
+ */
2516
+ const DIALOGUE_V4_MAX_CHARS = 5000
2476
2517
 
2477
2518
  const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
2478
2519
  // ── ElevenLabs TTS ──
@@ -2486,13 +2527,18 @@ const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
2486
2527
  description: "Expressive ElevenLabs TTS — supports [audio tags] for emotion / pacing. Direct API.",
2487
2528
  useCases: ["tts", "voice-over", "narration", "expressive"],
2488
2529
  features: ["audio-tags", "voice-cloning"],
2489
- pricing: [{ identifier: "elevenlabs-v3", credits: 30 }],
2490
- featured: true,
2530
+ pricing: [
2531
+ { identifier: "elevenlabs-v3", credits: 30 },
2532
+ { identifier: "elevenlabs-v3:per-100-chars", credits: 4, note: SPEECH_UNIT_PRICE_NOTE },
2533
+ ],
2491
2534
  tts: {
2492
2535
  audioTags: true,
2493
2536
  ssmlBreaks: false,
2494
2537
  levers: ["stability"],
2495
2538
  languageCode: true,
2539
+ timestamps: true, // measured 2026-10-06: /with-timestamps answers 200 at the same character cost
2540
+ // Rejects previous_text / next_text with a 400 (probed 2026-10-04).
2541
+ stitching: false,
2496
2542
  maxChars: 5000, // official cap (probed: 5,200 chars accepted; keep the clamp)
2497
2543
  languages: TTS_LANGS_V3,
2498
2544
  },
@@ -2507,12 +2553,20 @@ const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
2507
2553
  description: "Newest ElevenLabs TTS — [audio tags], stability and similarity control, up to 10,000 characters per request. Direct API.",
2508
2554
  useCases: ["tts", "voice-over", "narration", "expressive", "long-form"],
2509
2555
  features: ["audio-tags", "voice-cloning"],
2510
- pricing: [{ identifier: "elevenlabs-v4", credits: 30 }],
2556
+ pricing: [
2557
+ { identifier: "elevenlabs-v4", credits: 30 },
2558
+ { identifier: "elevenlabs-v4:per-100-chars", credits: 4, note: SPEECH_UNIT_PRICE_NOTE },
2559
+ ],
2560
+ // The default speech model (DEFAULT_TTS_PROVIDER) carries the star.
2561
+ featured: true,
2511
2562
  tts: {
2512
2563
  audioTags: true,
2513
2564
  ssmlBreaks: false,
2514
2565
  levers: ["stability", "similarity"],
2515
2566
  languageCode: true,
2567
+ timestamps: true, // measured 2026-10-06: /with-timestamps answers 200 at the same character cost
2568
+ // Accepts previous_text / next_text (probed 2026-10-04).
2569
+ stitching: true,
2516
2570
  maxChars: 10000,
2517
2571
  // The curated picker, the same 46 as v3. The model itself lists 85
2518
2572
  // (it adds e.g. Cantonese, Maltese, Mongolian, Burmese, Uzbek); widening
@@ -2529,12 +2583,20 @@ const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
2529
2583
  series: "ElevenLabs",
2530
2584
  description: "Fast, cheap ElevenLabs TTS via the direct ElevenLabs API. Good for narration.",
2531
2585
  useCases: ["tts", "narration", "fast"],
2532
- pricing: [{ identifier: "elevenlabs-turbo", credits: 15, note: "per 1K chars" }],
2586
+ // The flat row carries no note (a "per 1K chars" note once described a
2587
+ // scaling that never existed; the minimum under length pricing is 8 units, 16).
2588
+ pricing: [
2589
+ { identifier: "elevenlabs-turbo", credits: 15 },
2590
+ { identifier: "elevenlabs-turbo:per-100-chars", credits: 2, note: SPEECH_UNIT_PRICE_NOTE },
2591
+ ],
2533
2592
  tts: {
2534
2593
  audioTags: false,
2535
2594
  ssmlBreaks: true,
2536
2595
  levers: TTS_LEVERS_V2,
2537
2596
  languageCode: true,
2597
+ timestamps: true, // measured 2026-10-06: /with-timestamps answers 200 at the same character cost
2598
+ // Measured 2026-10-06: the direct API accepts previous_text / next_text on this model (200).
2599
+ stitching: true,
2538
2600
  maxChars: 40000, // == eleven_flash_v2_5 (functionally equivalent)
2539
2601
  languages: TTS_LANGS_FLASH_V25,
2540
2602
  },
@@ -2548,13 +2610,20 @@ const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
2548
2610
  series: "ElevenLabs",
2549
2611
  description: "Multi-language ElevenLabs TTS via the direct ElevenLabs API.",
2550
2612
  useCases: ["tts", "multilingual"],
2551
- pricing: [{ identifier: "elevenlabs-multilingual", credits: 30, note: "per 1K chars" }],
2613
+ // The flat row carries no note (the old "per 1K chars" described a scaling that never existed).
2614
+ pricing: [
2615
+ { identifier: "elevenlabs-multilingual", credits: 30 },
2616
+ { identifier: "elevenlabs-multilingual:per-100-chars", credits: 4, note: SPEECH_UNIT_PRICE_NOTE },
2617
+ ],
2552
2618
  tts: {
2553
2619
  audioTags: false,
2554
2620
  ssmlBreaks: true,
2555
2621
  levers: TTS_LEVERS_V2,
2556
2622
  // The API reference: "This parameter is not supported for multilingual_v2 models."
2557
2623
  languageCode: false,
2624
+ timestamps: true, // measured 2026-10-06: /with-timestamps answers 200 at the same character cost
2625
+ // Measured 2026-10-06: the direct API accepts previous_text / next_text on this model (200).
2626
+ stitching: true,
2558
2627
  maxChars: 10000,
2559
2628
  languages: TTS_LANGS_MULTILINGUAL_V2,
2560
2629
  },
@@ -2572,18 +2641,59 @@ const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
2572
2641
  description: "Multi-speaker dialogue via the direct ElevenLabs API — give it a script, it voices each role (any voice: premade, library, or cloned).",
2573
2642
  useCases: ["tts", "dialogue", "multi-speaker"],
2574
2643
  features: ["audio-tags", "voice-cloning"],
2575
- pricing: [{ identifier: "elevenlabs-dialogue", credits: 25, note: "per 1K chars" }],
2644
+ // Flat per request, whatever the length (decided 2026-10-06: the old
2645
+ // "per 1K chars" note described a scaling that never existed).
2646
+ pricing: [
2647
+ { identifier: "elevenlabs-dialogue", credits: 25 },
2648
+ { identifier: "elevenlabs-dialogue:per-100-chars", credits: 4, note: SPEECH_UNIT_PRICE_NOTE },
2649
+ ],
2576
2650
  tts: {
2577
2651
  audioTags: true,
2578
2652
  ssmlBreaks: false,
2579
2653
  levers: ["stability"],
2654
+ // The dialogue route has offered exactly these three since it shipped
2655
+ // (routes/text-to-dialogue.ts). Kept as the platform's v3 dialogue contract.
2656
+ stabilitySteps: [0, 0.5, 1],
2580
2657
  languageCode: true,
2658
+ timestamps: true, // measured 2026-10-06: /with-timestamps answers 200 at the same character cost
2659
+ // The dialogue funnel does not read this field (its own lane; phase 2 declares
2660
+ // the v4 dialogue model's value). v3 underneath.
2661
+ stitching: false,
2581
2662
  // Total across lines. The documented 2,000 is a recommendation, not a
2582
2663
  // limit (2,500 and 5,000 both probed 200); capped like v3, the model underneath.
2583
2664
  maxChars: 5000,
2584
2665
  languages: TTS_LANGS_V3,
2585
2666
  },
2586
2667
  },
2668
+ "elevenlabs-dialogue-v4": {
2669
+ id: "elevenlabs-dialogue-v4",
2670
+ kind: "audio",
2671
+ // Its own mode, never "tts" — the same reason as v3 dialogue above.
2672
+ modes: ["dialogue"] as const,
2673
+ family: "ElevenLabs",
2674
+ label: "ElevenLabs Dialogue v4",
2675
+ series: "ElevenLabs",
2676
+ description: "Multi-speaker dialogue on ElevenLabs v4 — [audio tags], stability and similarity control. Direct API.",
2677
+ useCases: ["tts", "dialogue", "multi-speaker"],
2678
+ features: ["audio-tags", "voice-cloning"],
2679
+ // Flat per request, the same as v3 dialogue (decided 2026-10-06).
2680
+ pricing: [
2681
+ { identifier: "elevenlabs-dialogue-v4", credits: 25 },
2682
+ { identifier: "elevenlabs-dialogue-v4:per-100-chars", credits: 4, note: SPEECH_UNIT_PRICE_NOTE },
2683
+ ],
2684
+ tts: {
2685
+ audioTags: true,
2686
+ ssmlBreaks: false,
2687
+ levers: ["stability", "similarity"],
2688
+ languageCode: true,
2689
+ timestamps: true, // measured 2026-10-06: /with-timestamps answers 200 at the same character cost
2690
+ // Dialogue models never stitch neighbour text (the funnel does not read this).
2691
+ stitching: false,
2692
+ maxChars: DIALOGUE_V4_MAX_CHARS,
2693
+ // The curated picker, v3's 46 (v4 lists 85; widening is its own change).
2694
+ languages: TTS_LANGS_V3,
2695
+ },
2696
+ },
2587
2697
 
2588
2698
  // ── ElevenLabs voice utilities ──
2589
2699
  // (voice cloning was retired platform-wide on 2026-09-15 — no catalog entry,
@@ -1222,6 +1222,31 @@ export const TTS_PROVIDERS = [
1222
1222
  ] as const
1223
1223
  export type TtsProvider = typeof TTS_PROVIDERS[number]
1224
1224
 
1225
+ /**
1226
+ * Text-to-dialogue models (the `provider` of `/v1/text-to-dialogue` and of the
1227
+ * Text to Dialogue node). Each IS its catalog id and its credit identifier.
1228
+ * Never members of TTS_PROVIDERS: a dialogue model takes a script of lines, not
1229
+ * one text (`dialogue-capabilities.test.ts` pins both directions).
1230
+ */
1231
+ export const DIALOGUE_PROVIDERS = ["elevenlabs-dialogue", "elevenlabs-dialogue-v4"] as const
1232
+ export type DialogueProvider = typeof DIALOGUE_PROVIDERS[number]
1233
+
1234
+ /** The model a dialogue request runs on when its provider is missing or unknown: v3 dialogue (decided 2026-10-04 — v3 stays the default). */
1235
+ export const DEFAULT_DIALOGUE_PROVIDER: DialogueProvider = "elevenlabs-dialogue"
1236
+
1237
+ /**
1238
+ * The speech model a request runs on when it names none — ElevenLabs v4 since the
1239
+ * default flip (decided 2026-10-05; v3 stays selectable). The REST route's credit
1240
+ * guard and handler, the workflow engine's text-to-speech dispatch, the worker's
1241
+ * defensive default, the MCP `generate_speech` tool, the narration pipeline, the
1242
+ * video director and the editor's new-node default all read THIS, so they can never
1243
+ * disagree about which model ran and which one was billed. A request with no model
1244
+ * also follows a length rule: text longer than this model's cap runs on turbo instead.
1245
+ * The REST route, the workflow engine, the narration pipeline and the worker apply it
1246
+ * through one backend function; the MCP tool refuses such text with the number.
1247
+ */
1248
+ export const DEFAULT_TTS_PROVIDER: TtsProvider = "elevenlabs-v4"
1249
+
1225
1250
  /** Text-to-audio providers */
1226
1251
  export const TEXT_TO_AUDIO_PROVIDERS = [
1227
1252
  // Replicate disabled
@@ -2115,7 +2140,7 @@ export function findSeedance2AudioOverLimit(
2115
2140
  */
2116
2141
  export const VIDEO_REF_LIMITS_BY_PROVIDER: Record<
2117
2142
  string,
2118
- { images?: number; videos?: number; audio?: number } | undefined
2143
+ { images?: number; videos?: number; audio?: number; characters?: number; voices?: number } | undefined
2119
2144
  > = {
2120
2145
  // Seedance 2 — full multimodal caps.
2121
2146
  "seedance-2": { ...SEEDANCE_2_REF_LIMITS },
@@ -2135,10 +2160,16 @@ export const VIDEO_REF_LIMITS_BY_PROVIDER: Record<
2135
2160
  "wan-3": { images: 10, videos: 5, audio: 5 },
2136
2161
  "wan-3-prime": { images: 10, videos: 5, audio: 5 },
2137
2162
  // Multi-image reference providers.
2138
- "gemini-omni-video": { images: 7, videos: 1 },
2163
+ // `characters` = the dedicated identity input (KIE `character_ids`, max 3).
2164
+ // It is NOT an image-reference lane: it draws from the SAME 7-unit budget as
2165
+ // `images` (images + 2×videos + character units ≤ 7) — see
2166
+ // `video-character-refs.ts`, the one place that budget is computed.
2167
+ // `voices` = distinct audio personas per task (`audio_ids`, max 3). NOT part
2168
+ // of the 7-unit quota: audio ids are a separate input.
2169
+ "gemini-omni-video": { images: 7, videos: 1, characters: 3, voices: 3 },
2139
2170
  // Gemini Omni Flash 1.1 — identical quota to the pro sibling
2140
2171
  // (images + 2×videos + character_ids ≤ 7).
2141
- "gemini-omni-flash": { images: 7, videos: 1 },
2172
+ "gemini-omni-flash": { images: 7, videos: 1, characters: 3, voices: 3 },
2142
2173
  "kling-3-omni": { images: 7 }, // catalog/docs: "end frame + up to 7 reference images"
2143
2174
  "grok-i2v": { images: 7 }, // backend kie/models.ts maxRefImages: 7
2144
2175
  "happyhorse-ref2v": { images: 9 }, // backend kie/models.ts maxRefImages: 9
@@ -2531,7 +2562,9 @@ export const VIDEO_AUDIO_CAPABILITY: Record<string, VideoAudioCapability> = {
2531
2562
  // - NOT audio_driven either: "Uploading audio references is unsupported in
2532
2563
  // the current version of the API", and "any audio in a video reference is
2533
2564
  // ignored" — there is no reference-audio transport to be driven by, and
2534
- // runGeminiOmni never sends `audio_ids`.
2565
+ // runGeminiOmni sends `audio_ids` ONLY for a
2566
+ // character's pinned voice persona (a preset voice, never a recording), which
2567
+ // is not a reference-audio transport and leaves the mode `ambient`.
2535
2568
  // Audio is priced into the per-tier rate, so NOT cost-affecting.
2536
2569
  "gemini-omni-video": { mode: "ambient", alwaysOn: true },
2537
2570
  "gemini-omni-flash": { mode: "ambient", alwaysOn: true },
package/src/model-tree.ts CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  IMAGE_GEN_PROVIDERS, VIDEO_GEN_PROVIDERS, IMAGE_TO_VIDEO_PROVIDERS, TEXT_TO_VIDEO_PROVIDERS,
11
11
  UPSCALE_IMAGE_PROVIDERS, VIDEO_UPSCALE_PROVIDERS, MODIFY_IMAGE_PROVIDERS, IMAGE_EDIT_PROVIDERS,
12
12
  VIDEO_TO_VIDEO_PROVIDERS, EXTEND_VIDEO_PROVIDERS, MOTION_TRANSFER_PROVIDERS, LIP_SYNC_PROVIDERS,
13
- FACE_SWAP_PROVIDERS, TTS_PROVIDERS, TEXT_TO_AUDIO_PROVIDERS, TRANSCRIBE_PROVIDERS, MUSIC_PROVIDERS,
13
+ FACE_SWAP_PROVIDERS, TTS_PROVIDERS, DIALOGUE_PROVIDERS, TEXT_TO_AUDIO_PROVIDERS, TRANSCRIBE_PROVIDERS, MUSIC_PROVIDERS,
14
14
  } from "./model-constants.js"
15
15
 
16
16
  export interface ModelNodeTarget {
@@ -46,6 +46,10 @@ const ENUM_TARGETS: ReadonlyArray<readonly [readonly string[], string]> = [
46
46
  [LIP_SYNC_PROVIDERS, "lip-sync"],
47
47
  [FACE_SWAP_PROVIDERS, "face-swap"],
48
48
  [TTS_PROVIDERS, "text-to-speech"],
49
+ // A dialogue model's id is the node's `provider`: without this row the Models
50
+ // tab would create a BARE dialogue node, which runs as the default (v3) whatever
51
+ // the user picked.
52
+ [DIALOGUE_PROVIDERS, "text-to-dialogue"],
49
53
  [TEXT_TO_AUDIO_PROVIDERS, "text-to-audio"],
50
54
  [TRANSCRIBE_PROVIDERS, "transcribe"],
51
55
  [MUSIC_PROVIDERS, "suno-generate"],
@@ -34,6 +34,17 @@ export type NodeExecutionStatus =
34
34
  | "failed"
35
35
  | "skipped"
36
36
 
37
+ /**
38
+ * Why a node was skipped at run time, when the run itself decided it (never
39
+ * for a node the person froze with Skip, which is a saved-data seed):
40
+ * - `empty_input` — a text-requiring node whose wired text came from a node
41
+ * that, in this run, produced nothing (a feed that found no new posts). A
42
+ * completed run with one such skip reads as "nothing new"
43
+ * (execution-outcome.ts).
44
+ * A router-gated node carries no reason, as before.
45
+ */
46
+ export type NodeSkipReason = "empty_input"
47
+
37
48
  /**
38
49
  * The statuses whose node state MAY carry `output`.
39
50
  *
@@ -92,4 +103,6 @@ export interface NodeExecutionStateWire<TOutput = Record<string, unknown>> {
92
103
  /** The node's job is parked in `pending_review`; `status` stays "running". */
93
104
  awaitingReview?: boolean
94
105
  progress?: number
106
+ /** Present on a `skipped` node the RUN skipped (see {@link NodeSkipReason}); absent on a router-gated one. */
107
+ skipReason?: NodeSkipReason | (string & {})
95
108
  }