@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,75 @@
1
+ /**
2
+ * Capability lookups for the text-to-speech lane.
3
+ *
4
+ * Every "does this model do X" decision on that lane reads the model's `tts`
5
+ * sheet in `MODEL_CATALOG` through these helpers — tag stripping, which voice
6
+ * settings are sent and shown, the language picker. Declare the sheet honestly
7
+ * on the catalog entry and a new model is covered everywhere; do not compare a
8
+ * provider id by hand.
9
+ *
10
+ * "The text-to-speech lane" means the models that list the `tts` mode. The
11
+ * dialogue model carries a sheet too, but a text-to-speech request that names it
12
+ * runs as the fallback model, so these helpers answer for the fallback there.
13
+ * (Today only the dialogue sheet's `maxChars` and `languages` are read, by
14
+ * `MAX_TTS_CHARS_BY_PROVIDER` and the language picker.)
15
+ */
16
+ import { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from "./model-catalog.js"
17
+
18
+ /** Legacy provider ids that are another model under an old name. They have no catalog entry of their own. */
19
+ export const TTS_PROVIDER_ALIASES: Readonly<Record<string, string>> = {
20
+ elevenlabs: "elevenlabs-turbo",
21
+ }
22
+
23
+ /** The model a request runs on when its provider id is missing or unknown. */
24
+ export const TTS_FALLBACK_PROVIDER = "elevenlabs-turbo"
25
+
26
+ /**
27
+ * Resolve a legacy alias to the catalog id it runs as. Any other id passes
28
+ * through unchanged. Own properties only: an id that happens to be the name of
29
+ * an inherited object member (`constructor`, `__proto__`, `toString`) is an
30
+ * unknown id like any other, never a function.
31
+ */
32
+ export function canonicalTtsProvider(provider: string): string {
33
+ return typeof provider === "string" && Object.hasOwn(TTS_PROVIDER_ALIASES, provider) ? TTS_PROVIDER_ALIASES[provider]! : provider
34
+ }
35
+
36
+ /** The capability sheet of a text-to-speech model, or `undefined` when the id is not one. */
37
+ export function findTtsCapabilities(provider: string | undefined): TtsCapabilities | undefined {
38
+ // `typeof`: node data can be written straight into workflow JSON, so the "string" is not guaranteed — and
39
+ // `Object.hasOwn` would coerce an array like ["elevenlabs-v3"] into that model's id. A non-string is an unknown id.
40
+ if (typeof provider !== "string" || !provider) return undefined
41
+ const id = canonicalTtsProvider(provider)
42
+ if (!Object.hasOwn(MODEL_CATALOG, id)) return undefined
43
+ const entry = MODEL_CATALOG[id]!
44
+ return entry.modes.includes("tts") ? entry.tts : undefined
45
+ }
46
+
47
+ /**
48
+ * The capability sheet a text-to-speech request will actually run under: a
49
+ * missing or unknown provider id runs as {@link TTS_FALLBACK_PROVIDER}, so it
50
+ * gets that sheet — including its `maxChars` (turbo's 40,000), where
51
+ * `getMaxTtsChars` keeps answering its 5,000 default for such ids.
52
+ */
53
+ export function getTtsCapabilities(provider: string | undefined): TtsCapabilities {
54
+ return findTtsCapabilities(provider) ?? MODEL_CATALOG[TTS_FALLBACK_PROVIDER]!.tts!
55
+ }
56
+
57
+ /** The model performs inline `[audio tags]`. false ⇒ strip them before sending. */
58
+ export function ttsSupportsAudioTags(provider: string | undefined): boolean {
59
+ return getTtsCapabilities(provider).audioTags
60
+ }
61
+
62
+ /** The model honours SSML `<break time="…"/>` tags. */
63
+ export function ttsSupportsSsmlBreaks(provider: string | undefined): boolean {
64
+ return getTtsCapabilities(provider).ssmlBreaks
65
+ }
66
+
67
+ /** The model honours this voice-setting lever. */
68
+ export function ttsHasLever(provider: string | undefined, lever: TtsSettingLever): boolean {
69
+ return getTtsCapabilities(provider).levers.includes(lever)
70
+ }
71
+
72
+ /** Language codes offered for the model, in catalog order. */
73
+ export function ttsLanguageCodes(provider: string | undefined): readonly string[] {
74
+ return getTtsCapabilities(provider).languages
75
+ }
@@ -33,9 +33,19 @@
33
33
  */
34
34
 
35
35
  export const VIDEO_ANALYSIS_DURATION_BUCKETS = [60, 180, 360, 600] as const
36
+ /** Pricing grace: a clip at most this far past a bucket edge is priced at that
37
+ * bucket. A part chosen as 1:00 in the Video URL chooser downloads at about
38
+ * 1:03 (the cut lands on keyframes), and must cost a minute, not three. Read
39
+ * by pickVideoAnalysisBucket — the ONE bucket picker every price reads (the
40
+ * editor estimate, the orchestrator reserve, the cloud routes). */
41
+ export const VIDEO_ANALYSIS_BUCKET_GRACE_SEC = 3
36
42
  /** Worker re-check grace: route metadata is integer-rounded, provider durations nominal;
37
- * ffprobe floats run 0.05–2 s over. Zero tolerance fails legit videos at 1:00/3:00/6:00/10:00. */
38
- export const VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC = 3
43
+ * ffprobe floats run 0.05–2 s over. Zero tolerance fails legit videos at 1:00/3:00/6:00/10:00.
44
+ * It sits ON TOP of the pricing grace: a clip the grace priced into a bucket
45
+ * (probe 63 s → 60 s) must still pass the worker gate (bucket + tolerance) at
46
+ * its float length (63.4 s). The cloud plugin reads this constant from the
47
+ * host app at run time, so its gate moves with it. */
48
+ export const VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC = VIDEO_ANALYSIS_BUCKET_GRACE_SEC + 3
39
49
  export const VIDEO_ANALYSIS_MAX_DURATION_SEC = 600
40
50
  const WINDOW_LEN = 150, WINDOW_STRIDE = 145, WINDOW_OVERLAP = 5
41
51
  export const VIDEO_ANALYSIS_WINDOW = { LEN: WINDOW_LEN, STRIDE: WINDOW_STRIDE, OVERLAP: WINDOW_OVERLAP, SINGLE_MAX: 180 } as const
@@ -113,13 +123,14 @@ export const VIDEO_ANALYSIS_WINDOW = { LEN: WINDOW_LEN, STRIDE: WINDOW_STRIDE, O
113
123
  // the legacy `gemini-3-flash` family moves too.
114
124
  // Output of the plugin's `scripts/gen-va-buckets.mjs`, pasted verbatim.
115
125
  export const VIDEO_ANALYSIS_BUCKET_CREDITS: Record<string, number> = {
116
- // Legacy fast-tier model (pre-2026-07) — kept for stored raw-id configs.
126
+ // Current fast tier (VIDEO_ANALYSIS_TIERS.fast; it was also the fast model
127
+ // before 2026-07).
117
128
  "video-analysis:gemini-3-flash:60s": 181,
118
129
  "video-analysis:gemini-3-flash:180s": 186,
119
130
  "video-analysis:gemini-3-flash:360s": 516,
120
131
  "video-analysis:gemini-3-flash:600s": 849,
121
- // Current fast tier — regenerated from the private formula for its backing
122
- // model; higher than the legacy fast schedule but still ≤ pro per bucket.
132
+ // Legacy fast-tier model (backed the fast tier 2026-07 → 2026-07-29) — kept
133
+ // for stored raw-id configs; still ≤ pro per bucket.
123
134
  "video-analysis:gemini-3.6-flash:60s": 205,
124
135
  "video-analysis:gemini-3.6-flash:180s": 219,
125
136
  "video-analysis:gemini-3.6-flash:360s": 603,
@@ -159,7 +170,7 @@ export function videoAnalysisCreditSegment(modelOrSentinel: string): string {
159
170
  }
160
171
 
161
172
  export function pickVideoAnalysisBucket(durationSec: number): number {
162
- for (const b of VIDEO_ANALYSIS_DURATION_BUCKETS) if (durationSec <= b) return b
173
+ for (const b of VIDEO_ANALYSIS_DURATION_BUCKETS) if (durationSec <= b + VIDEO_ANALYSIS_BUCKET_GRACE_SEC) return b
163
174
  return VIDEO_ANALYSIS_MAX_DURATION_SEC
164
175
  }
165
176
 
package/src/video-link.ts CHANGED
@@ -98,16 +98,19 @@ export function detectVideoLinkPlatform(url: string): VideoLinkPlatform {
98
98
  /**
99
99
  * Node types that can use a Video URL node WITHOUT its downloaded file, because
100
100
  * they never read the video: `suno-cover` and `transcribe` take the node's
101
- * separately-fetched audio track (`downloadedAudioUrl`), and `dubbing` hands the
102
- * page link to a provider that fetches it itself. A run whose only consumers of
103
- * a link are these must not be made to download — or to choose a part of — a
104
- * video nobody will look at. Structural vocabulary: it mirrors those three
101
+ * separately-fetched audio track (`downloadedAudioUrl`), `dubbing` hands the
102
+ * page link to a provider that fetches it itself, and `content-recipe` cites the
103
+ * post's page link on its `link` input (`videoLinkPageUrl`, both resolvers) —
104
+ * a Video URL can reach it on no other input. A run whose only consumers of a
105
+ * link are these must not be made to download — or to choose a part of — a
106
+ * video nobody will look at. Structural vocabulary: it mirrors those
105
107
  * server-side readers; add a type here only together with its reader.
106
108
  */
107
109
  export const VIDEO_LINK_TOLERANT_CONSUMER_TYPES: ReadonlySet<string> = new Set([
108
110
  "suno-cover",
109
111
  "transcribe",
110
112
  "dubbing",
113
+ "content-recipe",
111
114
  ])
112
115
 
113
116
  /**
@@ -156,6 +159,15 @@ export function resolveVideoLinkOutput(data: VideoLinkNodeFields): string | unde
156
159
  return videoLinkDownloadedFile(data) ?? trimmed(data.youtubeUrl)
157
160
  }
158
161
 
162
+ /**
163
+ * The page link a Video URL node was given (the post's own address), never
164
+ * the downloaded file. Read by consumers that CITE a post rather than watch
165
+ * it — Content Recipe's "Source post" input stores it as the recipe's source.
166
+ */
167
+ export function videoLinkPageUrl(data: VideoLinkNodeFields): string | undefined {
168
+ return trimmed(data.youtubeUrl)
169
+ }
170
+
159
171
  /**
160
172
  * True when the node holds a social link with no file for it yet — the state
161
173
  * in which its output is a web PAGE, which no video consumer can read.
@@ -197,6 +197,8 @@ const NODE_EXTRA_FIELDS: Record<string, string[]> = {
197
197
  // (a schedule starts paused), and the rules themselves are config that
198
198
  // travels.
199
199
  "schedule-trigger": ["active"],
200
+ // Same for a Telegram Account Trigger: listening is the importer's to start.
201
+ "telegram-account-trigger": ["isActive"],
200
202
  character: ["expressions", "poses", "lightingVariations", "angles", "customVariations"],
201
203
  object: ["angles", "materials", "variations", "customVariations"],
202
204
  creature: ["angles", "poses", "variations", "customVariations"],
@@ -232,6 +234,11 @@ const NODE_EXTRA_FIELDS: Record<string, string[]> = {
232
234
  */
233
235
  const UNOWNED_REF_FIELDS: Record<string, readonly string[]> = {
234
236
  "webhook-output": ["credentialId"],
237
+ // The exporter's connected Telegram account and its chats (a Saved Messages
238
+ // chat id IS the exporter's Telegram user id) — the importer picks their own.
239
+ "telegram-account-trigger": ["accountId", "chatIds", "chatTitles", "senderIds"],
240
+ // Telegram Reply: the exporter's account and their bot.
241
+ "telegram-account-send": ["accountId", "connectionId"],
235
242
  ...Object.fromEntries([...SOCIAL_POST_NODE_TYPES].map((type) => [type, ["connectionId"]])),
236
243
  }
237
244