@nodaro/shared 3.63.0 → 3.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/dist/{chunk-3K24DWOH.js → chunk-222QM7CO.js} +3 -3
  2. package/dist/{chunk-3K24DWOH.js.map → chunk-222QM7CO.js.map} +1 -1
  3. package/dist/chunk-27HA6YOL.cjs +377 -0
  4. package/dist/chunk-27HA6YOL.cjs.map +1 -0
  5. package/dist/{chunk-4DVWXEB6.js → chunk-2NKF476Z.js} +3 -3
  6. package/dist/{chunk-4DVWXEB6.js.map → chunk-2NKF476Z.js.map} +1 -1
  7. package/dist/chunk-3AU52TSW.js +143 -0
  8. package/dist/chunk-3AU52TSW.js.map +1 -0
  9. package/dist/{chunk-F6WGGYQW.cjs → chunk-5NVGKXJV.cjs} +68 -29
  10. package/dist/chunk-5NVGKXJV.cjs.map +1 -0
  11. package/dist/{chunk-HWQ2SYNA.js → chunk-5SSMPYE5.js} +99 -9
  12. package/dist/chunk-5SSMPYE5.js.map +1 -0
  13. package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
  14. package/dist/chunk-6BRWPJPP.cjs.map +1 -0
  15. package/dist/{chunk-KHH54GRP.cjs → chunk-6ET3KDO4.cjs} +15 -338
  16. package/dist/chunk-6ET3KDO4.cjs.map +1 -0
  17. package/dist/{chunk-TM5JYSJF.cjs → chunk-6OSIOVF7.cjs} +98 -37
  18. package/dist/chunk-6OSIOVF7.cjs.map +1 -0
  19. package/dist/{chunk-YUER7TJG.js → chunk-6X5PBAC4.js} +13 -4
  20. package/dist/chunk-6X5PBAC4.js.map +1 -0
  21. package/dist/chunk-7BN4EDIC.cjs +185 -0
  22. package/dist/chunk-7BN4EDIC.cjs.map +1 -0
  23. package/dist/{chunk-6M563QE6.js → chunk-7OWXHW7Z.js} +78 -28
  24. package/dist/chunk-7OWXHW7Z.js.map +1 -0
  25. package/dist/{chunk-FXGNRYQQ.js → chunk-AT53ZQUC.js} +3 -3
  26. package/dist/{chunk-FXGNRYQQ.js.map → chunk-AT53ZQUC.js.map} +1 -1
  27. package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
  28. package/dist/chunk-BQYCZLMF.js.map +1 -0
  29. package/dist/{chunk-34QLPTSA.js → chunk-BSTAAGLY.js} +3 -3
  30. package/dist/{chunk-34QLPTSA.js.map → chunk-BSTAAGLY.js.map} +1 -1
  31. package/dist/{chunk-PSKZKLDG.js → chunk-CW6MMQNO.js} +562 -26
  32. package/dist/chunk-CW6MMQNO.js.map +1 -0
  33. package/dist/{chunk-EPXGG27L.js → chunk-D5Y3EYRM.js} +5 -5
  34. package/dist/{chunk-EPXGG27L.js.map → chunk-D5Y3EYRM.js.map} +1 -1
  35. package/dist/{chunk-XGVJGNZW.cjs → chunk-DQ2PARNH.cjs} +15 -5
  36. package/dist/chunk-DQ2PARNH.cjs.map +1 -0
  37. package/dist/{chunk-6BZC2ZHC.cjs → chunk-E66HSC2E.cjs} +9 -9
  38. package/dist/{chunk-6BZC2ZHC.cjs.map → chunk-E66HSC2E.cjs.map} +1 -1
  39. package/dist/{chunk-NIAFR5EE.js → chunk-FGBGKBML.js} +32 -3
  40. package/dist/chunk-FGBGKBML.js.map +1 -0
  41. package/dist/{chunk-M5OCFGHF.cjs → chunk-FI3HJZWM.cjs} +588 -25
  42. package/dist/chunk-FI3HJZWM.cjs.map +1 -0
  43. package/dist/{chunk-L2TVY6XN.cjs → chunk-FJZTQTF4.cjs} +4 -4
  44. package/dist/{chunk-L2TVY6XN.cjs.map → chunk-FJZTQTF4.cjs.map} +1 -1
  45. package/dist/{chunk-XGGZWA4A.cjs → chunk-GJ3D5X4X.cjs} +52 -49
  46. package/dist/chunk-GJ3D5X4X.cjs.map +1 -0
  47. package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
  48. package/dist/chunk-H5KHWTAE.js.map +1 -0
  49. package/dist/{chunk-MD4XHED4.js → chunk-H745DQ6V.js} +3 -3
  50. package/dist/{chunk-MD4XHED4.js.map → chunk-H745DQ6V.js.map} +1 -1
  51. package/dist/{chunk-KCZHQH2O.js → chunk-HAH2F7LT.js} +4 -4
  52. package/dist/{chunk-KCZHQH2O.js.map → chunk-HAH2F7LT.js.map} +1 -1
  53. package/dist/{chunk-V5EEQR2U.cjs → chunk-JQMFJAYU.cjs} +21 -21
  54. package/dist/{chunk-V5EEQR2U.cjs.map → chunk-JQMFJAYU.cjs.map} +1 -1
  55. package/dist/{chunk-WZVIBAKN.cjs → chunk-JYU5EIRM.cjs} +12 -12
  56. package/dist/{chunk-WZVIBAKN.cjs.map → chunk-JYU5EIRM.cjs.map} +1 -1
  57. package/dist/{chunk-Y35JQPT6.cjs → chunk-K6RIN3LW.cjs} +142 -45
  58. package/dist/chunk-K6RIN3LW.cjs.map +1 -0
  59. package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
  60. package/dist/chunk-KSHAAPQF.cjs.map +1 -0
  61. package/dist/{chunk-2PU3AGGS.cjs → chunk-KTCEKGBJ.cjs} +7 -7
  62. package/dist/{chunk-2PU3AGGS.cjs.map → chunk-KTCEKGBJ.cjs.map} +1 -1
  63. package/dist/{chunk-LH72PQO2.cjs → chunk-KWYS4IIM.cjs} +165 -50
  64. package/dist/chunk-KWYS4IIM.cjs.map +1 -0
  65. package/dist/{chunk-GSKLPI3J.cjs → chunk-MIT2USTS.cjs} +118 -61
  66. package/dist/chunk-MIT2USTS.cjs.map +1 -0
  67. package/dist/{chunk-Y4GCJJPF.cjs → chunk-NYZQOIXJ.cjs} +35 -2
  68. package/dist/chunk-NYZQOIXJ.cjs.map +1 -0
  69. package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
  70. package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
  71. package/dist/{chunk-X5BAFW3Q.cjs → chunk-PGDR7CO3.cjs} +8 -8
  72. package/dist/{chunk-X5BAFW3Q.cjs.map → chunk-PGDR7CO3.cjs.map} +1 -1
  73. package/dist/{chunk-OV3JTKBY.js → chunk-PL7AQQV7.js} +123 -22
  74. package/dist/chunk-PL7AQQV7.js.map +1 -0
  75. package/dist/chunk-Q4YOLT4M.js +164 -0
  76. package/dist/chunk-Q4YOLT4M.js.map +1 -0
  77. package/dist/{chunk-GMBDLNLD.cjs → chunk-R5ILCNCC.cjs} +197 -60
  78. package/dist/chunk-R5ILCNCC.cjs.map +1 -0
  79. package/dist/chunk-RP4KQUNU.cjs +168 -0
  80. package/dist/chunk-RP4KQUNU.cjs.map +1 -0
  81. package/dist/{chunk-77WU3V3J.cjs → chunk-SPU7MUWE.cjs} +6 -6
  82. package/dist/{chunk-77WU3V3J.cjs.map → chunk-SPU7MUWE.cjs.map} +1 -1
  83. package/dist/{chunk-XBTYGQ6Z.js → chunk-ST7OBB5J.js} +8 -5
  84. package/dist/chunk-ST7OBB5J.js.map +1 -0
  85. package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
  86. package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
  87. package/dist/{chunk-BMJVKYVB.js → chunk-V5NLQ4L5.js} +123 -7
  88. package/dist/chunk-V5NLQ4L5.js.map +1 -0
  89. package/dist/{chunk-KMGCHV6O.js → chunk-V6OXSXIX.js} +63 -30
  90. package/dist/chunk-V6OXSXIX.js.map +1 -0
  91. package/dist/{chunk-LMAQUR55.cjs → chunk-WQMPIURW.cjs} +6 -6
  92. package/dist/{chunk-LMAQUR55.cjs.map → chunk-WQMPIURW.cjs.map} +1 -1
  93. package/dist/{chunk-ZPE2ZTJ4.cjs → chunk-WZG6GZIL.cjs} +4 -4
  94. package/dist/{chunk-ZPE2ZTJ4.cjs.map → chunk-WZG6GZIL.cjs.map} +1 -1
  95. package/dist/{chunk-AE3AAJ4O.js → chunk-XJANKTIL.js} +3 -3
  96. package/dist/{chunk-AE3AAJ4O.js.map → chunk-XJANKTIL.js.map} +1 -1
  97. package/dist/{chunk-O7RZRUMZ.js → chunk-XJWED257.js} +14 -309
  98. package/dist/chunk-XJWED257.js.map +1 -0
  99. package/dist/chunk-XSSLNINL.js +346 -0
  100. package/dist/chunk-XSSLNINL.js.map +1 -0
  101. package/dist/{chunk-6TGB7ECA.cjs → chunk-YD4XY74W.cjs} +12 -8
  102. package/dist/chunk-YD4XY74W.cjs.map +1 -0
  103. package/dist/{chunk-YX6TFX7H.js → chunk-YMZUE2IX.js} +66 -11
  104. package/dist/chunk-YMZUE2IX.js.map +1 -0
  105. package/dist/{chunk-4MMZD63H.js → chunk-Z77M7Q2R.js} +3 -3
  106. package/dist/{chunk-4MMZD63H.js.map → chunk-Z77M7Q2R.js.map} +1 -1
  107. package/dist/{chunk-CZ5IQB3L.js → chunk-ZSRXY5YT.js} +8 -5
  108. package/dist/chunk-ZSRXY5YT.js.map +1 -0
  109. package/dist/entries/apps.cjs +43 -42
  110. package/dist/entries/apps.js +8 -7
  111. package/dist/entries/captions.cjs +38 -30
  112. package/dist/entries/captions.d.cts +48 -2
  113. package/dist/entries/captions.d.ts +48 -2
  114. package/dist/entries/captions.js +1 -1
  115. package/dist/entries/credits.cjs +319 -191
  116. package/dist/entries/credits.d.cts +260 -19
  117. package/dist/entries/credits.d.ts +260 -19
  118. package/dist/entries/credits.js +11 -11
  119. package/dist/entries/entities.cjs +202 -193
  120. package/dist/entries/entities.d.cts +44 -9
  121. package/dist/entries/entities.d.ts +44 -9
  122. package/dist/entries/entities.js +2 -1
  123. package/dist/entries/llm-models.cjs +86 -62
  124. package/dist/entries/llm-models.d.cts +73 -20
  125. package/dist/entries/llm-models.d.ts +73 -20
  126. package/dist/entries/llm-models.js +2 -2
  127. package/dist/entries/media.cjs +79 -63
  128. package/dist/entries/media.d.cts +154 -1
  129. package/dist/entries/media.d.ts +154 -1
  130. package/dist/entries/media.js +1 -1
  131. package/dist/entries/model-catalog.cjs +205 -109
  132. package/dist/entries/model-catalog.d.cts +65 -58
  133. package/dist/entries/model-catalog.d.ts +65 -58
  134. package/dist/entries/model-catalog.js +4 -4
  135. package/dist/entries/models.cjs +527 -346
  136. package/dist/entries/models.d.cts +86 -7
  137. package/dist/entries/models.d.ts +86 -7
  138. package/dist/entries/models.js +6 -5
  139. package/dist/entries/nodes.cjs +220 -211
  140. package/dist/entries/nodes.d.cts +46 -3
  141. package/dist/entries/nodes.d.ts +46 -3
  142. package/dist/entries/nodes.js +10 -9
  143. package/dist/entries/pipeline.cjs +156 -152
  144. package/dist/entries/pipeline.d.cts +14 -4
  145. package/dist/entries/pipeline.d.ts +14 -4
  146. package/dist/entries/pipeline.js +3 -3
  147. package/dist/entries/social.cjs +177 -177
  148. package/dist/entries/social.js +2 -2
  149. package/dist/entries/ugc.cjs +71 -71
  150. package/dist/entries/ugc.js +4 -4
  151. package/dist/entries/video.cjs +174 -145
  152. package/dist/entries/video.d.cts +114 -2
  153. package/dist/entries/video.d.ts +114 -2
  154. package/dist/entries/video.js +7 -6
  155. package/dist/entries/workflow.cjs +150 -150
  156. package/dist/entries/workflow.d.cts +1 -1
  157. package/dist/entries/workflow.d.ts +1 -1
  158. package/dist/entries/workflow.js +2 -2
  159. package/dist/index.cjs +2430 -1929
  160. package/dist/index.d.cts +13 -12
  161. package/dist/index.d.ts +13 -12
  162. package/dist/index.js +28 -27
  163. package/dist/{model-catalog-C_Eo35tL.d.cts → model-catalog-BoUKGFNl.d.cts} +182 -3
  164. package/dist/{model-catalog-C_Eo35tL.d.ts → model-catalog-BoUKGFNl.d.ts} +182 -3
  165. package/dist/{model-constants-DWcxOmaY.d.cts → model-constants-BElS3AeE.d.ts} +142 -23
  166. package/dist/{model-constants-Bg4ccSQb.d.ts → model-constants-CpQz1bGa.d.cts} +142 -23
  167. package/dist/tts-capabilities-BtnDWK9K.d.ts +133 -0
  168. package/dist/tts-capabilities-C52UccTI.d.cts +133 -0
  169. package/package.json +1 -1
  170. package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
  171. package/src/__tests__/dialogue-capabilities.test.ts +167 -6
  172. package/src/__tests__/extend-providers.test.ts +353 -26
  173. package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
  174. package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
  175. package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
  176. package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
  177. package/src/__tests__/flux-3-klein.test.ts +203 -0
  178. package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
  179. package/src/__tests__/kling4-catalog.test.ts +1 -1
  180. package/src/__tests__/llm-models.test.ts +48 -13
  181. package/src/__tests__/llm-price-key.test.ts +12 -0
  182. package/src/__tests__/model-makers.test.ts +3 -0
  183. package/src/__tests__/node-runtime-keys.test.ts +7 -0
  184. package/src/__tests__/normalize-node-params.test.ts +147 -1
  185. package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
  186. package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
  187. package/src/__tests__/sequence-execution.test.ts +22 -1
  188. package/src/__tests__/speech-pricing.test.ts +62 -1
  189. package/src/__tests__/suno-credit-type.test.ts +21 -2
  190. package/src/__tests__/transcribe-capabilities.test.ts +4 -2
  191. package/src/__tests__/tts-capabilities.test.ts +160 -4
  192. package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
  193. package/src/__tests__/video-analysis-pricing.test.ts +22 -9
  194. package/src/__tests__/video-subjects.test.ts +192 -0
  195. package/src/__tests__/wired-character-names.test.ts +142 -0
  196. package/src/caption-styles.ts +62 -0
  197. package/src/credit-estimators/add-captions-nemotron.ts +73 -0
  198. package/src/credit-estimators/index.ts +14 -0
  199. package/src/credit-estimators/speech.ts +57 -9
  200. package/src/credit-identifiers.ts +284 -13
  201. package/src/dialogue-capabilities.ts +220 -3
  202. package/src/dubbing-structure.ts +186 -0
  203. package/src/entries/captions.ts +2 -0
  204. package/src/entries/credits.ts +25 -1
  205. package/src/entries/entities.ts +2 -0
  206. package/src/entries/llm-models.ts +7 -0
  207. package/src/entries/media.ts +3 -1
  208. package/src/entries/model-catalog.ts +30 -0
  209. package/src/entries/models.ts +54 -0
  210. package/src/entries/nodes.ts +2 -0
  211. package/src/entries/pipeline.ts +1 -1
  212. package/src/entries/video.ts +8 -1
  213. package/src/flux-3-klein.ts +69 -0
  214. package/src/gemini-tts.ts +144 -0
  215. package/src/input-image-pricing.ts +23 -6
  216. package/src/llm-models.ts +130 -36
  217. package/src/model-catalog.ts +539 -25
  218. package/src/model-constants.ts +247 -25
  219. package/src/node-default-mappings.ts +3 -0
  220. package/src/node-runtime-keys.ts +3 -0
  221. package/src/normalize-node-params.ts +123 -2
  222. package/src/seedance-extend-rate.ts +116 -0
  223. package/src/sequence-execution.ts +24 -0
  224. package/src/transcribe-preflight.ts +23 -0
  225. package/src/tts-capabilities.ts +193 -1
  226. package/src/video-analysis-pricing.ts +39 -15
  227. package/src/video-character-refs.ts +160 -3
  228. package/src/wired-character-names.ts +134 -18
  229. package/src/wired-character-video-subjects.ts +63 -0
  230. package/dist/chunk-63H4C56Q.cjs +0 -38
  231. package/dist/chunk-63H4C56Q.cjs.map +0 -1
  232. package/dist/chunk-6M563QE6.js.map +0 -1
  233. package/dist/chunk-6TGB7ECA.cjs.map +0 -1
  234. package/dist/chunk-6XUG4L7X.cjs +0 -54
  235. package/dist/chunk-6XUG4L7X.cjs.map +0 -1
  236. package/dist/chunk-BLJUCPMV.cjs.map +0 -1
  237. package/dist/chunk-BMJVKYVB.js.map +0 -1
  238. package/dist/chunk-CZ5IQB3L.js.map +0 -1
  239. package/dist/chunk-F6WGGYQW.cjs.map +0 -1
  240. package/dist/chunk-GMBDLNLD.cjs.map +0 -1
  241. package/dist/chunk-GSKLPI3J.cjs.map +0 -1
  242. package/dist/chunk-HBXF6RUU.js +0 -31
  243. package/dist/chunk-HBXF6RUU.js.map +0 -1
  244. package/dist/chunk-HSHCCBIV.js.map +0 -1
  245. package/dist/chunk-HWQ2SYNA.js.map +0 -1
  246. package/dist/chunk-IY3Y462W.js +0 -42
  247. package/dist/chunk-IY3Y462W.js.map +0 -1
  248. package/dist/chunk-KHH54GRP.cjs.map +0 -1
  249. package/dist/chunk-KMGCHV6O.js.map +0 -1
  250. package/dist/chunk-LH72PQO2.cjs.map +0 -1
  251. package/dist/chunk-M5OCFGHF.cjs.map +0 -1
  252. package/dist/chunk-NIAFR5EE.js.map +0 -1
  253. package/dist/chunk-O7RZRUMZ.js.map +0 -1
  254. package/dist/chunk-OV3JTKBY.js.map +0 -1
  255. package/dist/chunk-PSKZKLDG.js.map +0 -1
  256. package/dist/chunk-Q6IES3U2.js.map +0 -1
  257. package/dist/chunk-TM5JYSJF.cjs.map +0 -1
  258. package/dist/chunk-WRSWH7US.cjs.map +0 -1
  259. package/dist/chunk-XBTYGQ6Z.js.map +0 -1
  260. package/dist/chunk-XGGZWA4A.cjs.map +0 -1
  261. package/dist/chunk-XGVJGNZW.cjs.map +0 -1
  262. package/dist/chunk-Y35JQPT6.cjs.map +0 -1
  263. package/dist/chunk-Y4GCJJPF.cjs.map +0 -1
  264. package/dist/chunk-YUER7TJG.js.map +0 -1
  265. package/dist/chunk-YX6TFX7H.js.map +0 -1
@@ -73,45 +73,109 @@ export interface WiredCharacterName {
73
73
  * unnamed ones: "Character 1", "Character 2", …, skipping a number whose
74
74
  * name (by slug) another wired character already has. Unnamed nodes are
75
75
  * never merged.
76
- * - A typed name the slug cannot spell ("マヤ", "מאיה", "마야" — no Latin
77
- * letter or digit) is a real name: the model reads it as typed, and the node
78
- * takes the next number of the same sequence as its key (`character-N`), so
79
- * it is included on every path and no two keys collide.
76
+ * - A typed name with a letter of another script ("マヤ", "מאיה", "마야",
77
+ * and a mixed one such as "マヤ1" or "マヤ A") is a real name: the model
78
+ * reads it as typed. Which character it is goes by the WHOLE name
79
+ * ({@link scriptNameKey}), never by the Latin part the slug can spell, so
80
+ * "マヤ1" and "レオ1" are two characters and "マヤ A" is not "A" (decided
81
+ * 2026-11-13). Two nodes with the same such name are ONE character, as two
82
+ * "Maya" nodes are (decided 2026-11-12).
83
+ * - Its mention key: the name's own slug when the name has one and no other
84
+ * wired character claims it ("マヤ A" alone stays `@a`); else — no slug
85
+ * ("マヤ"), or a slug another character also claims — the next number of
86
+ * the unnamed sequence (`character-N`), taken once per character, so it is
87
+ * included on every path and no two keys collide.
88
+ * - A name whose letters are all Latin is keyed by its slug, exactly as before
89
+ * ("Maya", "maya" and "MAYA" are one character).
80
90
  *
81
91
  * `sources` are the consuming node's incoming wires in edge-array order.
82
92
  */
83
93
  export function wiredCharacterNames(sources: readonly WiredCharacterSource[]): Map<string, WiredCharacterName> {
84
- const order: Array<{ key: string; own: string }> = []
94
+ const order: Array<{ key: string; own: string; identity: string; ownSlug: string }> = []
85
95
  const seen = new Set<string>()
86
96
  for (const s of sources) {
87
97
  if (seen.has(s.key) || resolveEffectiveSourceType(s.type, s.sourceHandle) !== "character") continue
88
98
  seen.add(s.key)
89
- order.push({ key: s.key, own: characterOwnName(s.data) })
99
+ const own = characterOwnName(s.data)
100
+ order.push({ key: s.key, own, identity: characterIdentity(own) ?? `node:${s.key}`, ownSlug: characterMentionSlug(own) })
90
101
  }
91
- const taken = new Set<string>()
92
- for (const { own } of order) {
93
- const slug = characterMentionSlug(own)
94
- if (slug) taken.add(slug)
102
+ // Every character that would go by each slug: a Latin name always keeps its
103
+ // own; another name keeps it only when it is the one character claiming it.
104
+ const claims = new Map<string, Set<string>>()
105
+ for (const { identity, ownSlug } of order) {
106
+ if (!ownSlug) continue
107
+ const set = claims.get(ownSlug) ?? new Set<string>()
108
+ set.add(identity)
109
+ claims.set(ownSlug, set)
95
110
  }
111
+ const keepsOwnSlug = (identity: string, ownSlug: string): boolean =>
112
+ !!ownSlug && (identity.startsWith(LATIN_IDENTITY) || claims.get(ownSlug)?.size === 1)
113
+ const taken = new Set<string>()
114
+ for (const { identity, ownSlug } of order) if (keepsOwnSlug(identity, ownSlug)) taken.add(ownSlug)
96
115
  const out = new Map<string, WiredCharacterName>()
116
+ /** A character (by identity) → the `character-N` its first node took. */
117
+ const numberedOf = new Map<string, string>()
97
118
  let next = 1
98
- for (const { key, own } of order) {
99
- const ownSlug = characterMentionSlug(own)
100
- if (ownSlug) {
119
+ for (const { key, own, identity, ownSlug } of order) {
120
+ if (keepsOwnSlug(identity, ownSlug)) {
101
121
  out.set(key, { name: own, slug: ownSlug, unnamed: false })
102
122
  continue
103
123
  }
124
+ const same = numberedOf.get(identity)
125
+ if (same) {
126
+ out.set(key, { name: own, slug: same, unnamed: false })
127
+ continue
128
+ }
104
129
  while (taken.has(numberedSlug(next))) next++
105
130
  const slug = numberedSlug(next)
106
131
  taken.add(slug)
132
+ numberedOf.set(identity, slug)
107
133
  out.set(key, own ? { name: own, slug, unnamed: false } : { name: `${UNNAMED_CHARACTER_NAME_PREFIX} ${next}`, slug, unnamed: true })
108
134
  next++
109
135
  }
110
136
  return out
111
137
  }
112
138
 
139
+ const LATIN_IDENTITY = "latin:"
140
+
141
+ /** A letter of a script other than Latin (accented Latin letters are Latin). */
142
+ const OTHER_SCRIPT_LETTER = /(?=\p{L})\P{Script=Latin}/u
143
+
144
+ /**
145
+ * Which character a typed name is — two names with the same identity are one
146
+ * character. A name whose letters are all Latin: its slug, exactly as before.
147
+ * Any other name with a letter or digit: the whole name ({@link scriptNameKey}).
148
+ * Undefined for no name, or one with no letter or digit at all ("!!!"): such a
149
+ * node is a character of its own.
150
+ */
151
+ function characterIdentity(name: string): string | undefined {
152
+ const slug = characterMentionSlug(name)
153
+ if (slug && !OTHER_SCRIPT_LETTER.test(name)) return `${LATIN_IDENTITY}${slug}`
154
+ const key = scriptNameKey(name)
155
+ return key ? `script:${key}` : undefined
156
+ }
157
+
113
158
  const numberedSlug = (n: number): string => characterMentionSlug(`${UNNAMED_CHARACTER_NAME_PREFIX} ${n}`)
114
159
 
160
+ /**
161
+ * When two typed names the slug cannot spell are the same name: the rule
162
+ * {@link characterMentionSlug} applies to a Latin name ("Maya", "maya" and
163
+ * "MAYA" are one; so are "Maya Lee" and "maya-lee"), over every script.
164
+ * Unicode NFKC (half-width "マヤ" is "マヤ", a decomposed Hangul syllable is the
165
+ * composed one), then case folded (Cyrillic "Мая" is "мая"), then every run of
166
+ * characters that are no letter, digit or combining mark is one separator.
167
+ * Marks stay: "ガ" is not "カ". "" for a name with no letter or digit at all
168
+ * ("!!!"), which never matches another.
169
+ */
170
+ function scriptNameKey(name: string): string {
171
+ return name
172
+ .normalize("NFKC")
173
+ .toUpperCase()
174
+ .toLowerCase()
175
+ .replace(/[^\p{L}\p{N}\p{M}]+/gu, "-")
176
+ .replace(/^-+|-+$/g, "")
177
+ }
178
+
115
179
  /**
116
180
  * The slugs an unnamed character's mentions were written with before it was
117
181
  * numbered: its default label's ("Character Asset") and the retired default's
@@ -175,20 +239,49 @@ export function wiredCharacterNamesOf(
175
239
  return wiredCharacterNames(sources)
176
240
  }
177
241
 
242
+ /**
243
+ * The slug a Character node goes by for the node it feeds: its slug in
244
+ * `names`; else — a node wired only by its plain `image` pip, which `names`
245
+ * leaves out — the slug of the wired character that is the same name (the
246
+ * same whole name is the same character, in any script); else a Latin name's
247
+ * own slug, when no wired character of another identity goes by it; else "".
248
+ */
249
+ export function wiredCharacterSlug(
250
+ names: ReadonlyMap<string, WiredCharacterName>,
251
+ nodeId: string,
252
+ data: unknown,
253
+ ): string {
254
+ const wired = names.get(nodeId)?.slug
255
+ if (wired) return wired
256
+ const own = characterOwnName(data)
257
+ const identity = characterIdentity(own)
258
+ if (!identity) return ""
259
+ // The wired character that IS this name (the same identity, in any script).
260
+ for (const n of names.values()) {
261
+ if (!n.unnamed && characterIdentity(n.name) === identity) return n.slug
262
+ }
263
+ // None: a Latin name still goes by its own slug — unless a wired character
264
+ // of ANOTHER identity goes by it ("A" beside a wired "マヤ A", decided
265
+ // 2026-11-13), which it must never be filed under.
266
+ if (!identity.startsWith(LATIN_IDENTITY)) return ""
267
+ const slug = characterMentionSlug(own)
268
+ for (const n of names.values()) if (n.slug === slug) return ""
269
+ return slug
270
+ }
271
+
178
272
  /**
179
273
  * The key a Character node's OWN elements (held prop, styling, …) are filed
180
274
  * under for the node it feeds, so they land on that character's identity
181
- * bullet: its slug in `names`; else — a node wired only by its plain `image`
182
- * pip, which `names` leaves out — its own name's slug (the same typed name is
183
- * the same character); else a key of its own that no character carries, so an
184
- * unnamed node's elements are never merged into another character's.
275
+ * bullet: the slug it goes by ({@link wiredCharacterSlug}); else a key of its
276
+ * own that no character carries, so an unnamed node's elements are never
277
+ * merged into another character's.
185
278
  */
186
279
  export function wiredCharacterKey(
187
280
  names: ReadonlyMap<string, WiredCharacterName>,
188
281
  nodeId: string,
189
282
  data: unknown,
190
283
  ): string {
191
- return names.get(nodeId)?.slug || characterMentionSlug(characterOwnName(data)) || `node:${nodeId}`
284
+ return wiredCharacterSlug(names, nodeId, data) || `node:${nodeId}`
192
285
  }
193
286
 
194
287
  /** The wired character whose slug is `slug`, if any (first in wire order). */
@@ -200,3 +293,26 @@ export function wiredCharacterBySlug(
200
293
  for (const [key, named] of names) if (named.slug === slug) return { key, named }
201
294
  return undefined
202
295
  }
296
+
297
+ /**
298
+ * The clip each Character node wired into `consumerId` carries as its VIDEO
299
+ * subject (its `subjectVideoUrl`, a short single-shot clip of the character),
300
+ * by the slug the node goes by ({@link wiredCharacterNamesOf}) — the key
301
+ * `characterReferencesFromWired` groups a character by. Two nodes that are one
302
+ * character (the same typed name) take the first node's clip, in wire order. A
303
+ * node wired only by its plain `image` pip is no character and gives none.
304
+ * Read it only for a model that takes video subjects.
305
+ */
306
+ export function wiredCharacterVideoUrls(
307
+ consumerId: string,
308
+ nodes: ReadonlyArray<{ readonly id: string; readonly type?: string | null; readonly data?: unknown }>,
309
+ edges: ReadonlyArray<{ readonly source: string; readonly target: string; readonly sourceHandle?: string | null }>,
310
+ ): Map<string, string> {
311
+ const byId = new Map(nodes.map((n) => [n.id, n] as const))
312
+ const out = new Map<string, string>()
313
+ for (const [id, named] of wiredCharacterNamesOf(consumerId, nodes, edges)) {
314
+ const clip = (byId.get(id)?.data as { subjectVideoUrl?: unknown } | undefined)?.subjectVideoUrl
315
+ if (typeof clip === "string" && clip.trim() && !out.has(named.slug)) out.set(named.slug, clip.trim())
316
+ }
317
+ return out
318
+ }
@@ -0,0 +1,63 @@
1
+ import { hasFeature } from "./model-catalog.js"
2
+ import { characterMentionSlug } from "./character-mention-slug.js"
3
+ import { characterMentionableAssetArrays } from "./character-variant-assets.js"
4
+ import { entityImageUrl } from "./entity-image-url.js"
5
+ import { videoCharacterRefCap, videoCharacterVideoCap } from "./video-character-refs.js"
6
+ import { wiredCharacterNamesOf, wiredCharacterVideoUrls } from "./wired-character-names.js"
7
+
8
+ type GraphNode = { readonly id: string; readonly type?: string | null; readonly data?: unknown }
9
+ type GraphEdge = { readonly source: string; readonly target: string; readonly sourceHandle?: string | null }
10
+
11
+ /**
12
+ * Whether a Character node gives its wired character a reference image: its
13
+ * portrait (`entityImageUrl`), or any named image of its mentionable asset
14
+ * buckets. The rule a run's character expansion follows (`expandWiredCharacterRefs`
15
+ * in the workflow payload builder, its editor twin): a node with none yields
16
+ * no reference, so `characterReferencesFromWired` makes no character of it.
17
+ */
18
+ function characterGivesAnImage(data: unknown): boolean {
19
+ if (entityImageUrl(data)) return true
20
+ const arrays = characterMentionableAssetArrays((data ?? {}) as Record<string, unknown>)
21
+ return Object.values(arrays).some((items) => items.some((item) => !!item?.url && !!characterMentionSlug(item.name ?? "")))
22
+ }
23
+
24
+ /**
25
+ * The clips a Generate Video run on `provider` sends as its characters' video
26
+ * subjects (decided 2026-11-13), in the order the run seats them — read off the
27
+ * graph without building the run, for an estimate that must price exactly what
28
+ * the run sends:
29
+ *
30
+ * - none on a model that takes no video subjects (or no named subjects at all);
31
+ * - the characters as the run groups them (`characterReferencesFromWired`): one
32
+ * per wired character by the slug it goes by, in wire order of its first node
33
+ * that gives an image — a node with no image at all makes no character, so
34
+ * its clip is not sent;
35
+ * - only the first `videoCharacterRefCap(provider)` characters (the run's slice);
36
+ * - each character's clip as `wiredCharacterVideoUrls` gives it (its first
37
+ * node's, in wire order).
38
+ *
39
+ * The workflow run itself builds the same list through
40
+ * `characterReferencesFromWired(expandWiredCharacterRefs(…), clips).slice(…)`;
41
+ * a parity test holds the two together. Only Generate Video carries video
42
+ * subjects — the older Image to Video / Text to Video nodes never do.
43
+ */
44
+ export function wiredCharacterSubjectClips(
45
+ consumerId: string,
46
+ nodes: ReadonlyArray<GraphNode>,
47
+ edges: ReadonlyArray<GraphEdge>,
48
+ provider: string,
49
+ ): string[] {
50
+ if (videoCharacterVideoCap(provider) === 0 || !hasFeature(provider, "character-subjects")) return []
51
+ const clips = wiredCharacterVideoUrls(consumerId, nodes, edges)
52
+ if (clips.size === 0) return []
53
+ const byId = new Map(nodes.map((n) => [n.id, n] as const))
54
+ const subjects: string[] = []
55
+ for (const [id, named] of wiredCharacterNamesOf(consumerId, nodes, edges)) {
56
+ if (subjects.includes(named.slug)) continue
57
+ if (characterGivesAnImage(byId.get(id)?.data)) subjects.push(named.slug)
58
+ }
59
+ return subjects.slice(0, videoCharacterRefCap(provider)).flatMap((slug) => {
60
+ const clip = clips.get(slug)
61
+ return clip ? [clip] : []
62
+ })
63
+ }
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkLH72PQO2_cjs = require('./chunk-LH72PQO2.cjs');
4
- var chunkM5OCFGHF_cjs = require('./chunk-M5OCFGHF.cjs');
5
-
6
- // src/dialogue-capabilities.ts
7
- function findDialogueCapabilities(provider) {
8
- if (typeof provider !== "string" || !provider) return void 0;
9
- if (!Object.hasOwn(chunkM5OCFGHF_cjs.MODEL_CATALOG, provider)) return void 0;
10
- const entry = chunkM5OCFGHF_cjs.MODEL_CATALOG[provider];
11
- return entry.modes.includes("dialogue") ? entry.tts : void 0;
12
- }
13
- function dialogueProviderOf(provider) {
14
- return findDialogueCapabilities(provider) ? provider : chunkLH72PQO2_cjs.DEFAULT_DIALOGUE_PROVIDER;
15
- }
16
- function getDialogueCapabilities(provider) {
17
- return chunkM5OCFGHF_cjs.MODEL_CATALOG[dialogueProviderOf(provider)].tts;
18
- }
19
- function dialogueHasLever(provider, lever) {
20
- return getDialogueCapabilities(provider).levers.includes(lever);
21
- }
22
- function dialogueSupportsTimestamps(provider) {
23
- return getDialogueCapabilities(provider).timestamps;
24
- }
25
- function dialogueStabilityAccepted(provider, value) {
26
- if (!Number.isFinite(value) || value < 0 || value > 1) return false;
27
- const steps = getDialogueCapabilities(provider).stabilitySteps;
28
- return steps ? steps.includes(value) : true;
29
- }
30
-
31
- exports.dialogueHasLever = dialogueHasLever;
32
- exports.dialogueProviderOf = dialogueProviderOf;
33
- exports.dialogueStabilityAccepted = dialogueStabilityAccepted;
34
- exports.dialogueSupportsTimestamps = dialogueSupportsTimestamps;
35
- exports.findDialogueCapabilities = findDialogueCapabilities;
36
- exports.getDialogueCapabilities = getDialogueCapabilities;
37
- //# sourceMappingURL=chunk-63H4C56Q.cjs.map
38
- //# sourceMappingURL=chunk-63H4C56Q.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/dialogue-capabilities.ts"],"names":["MODEL_CATALOG","DEFAULT_DIALOGUE_PROVIDER"],"mappings":";;;;;;AAeO,SAAS,yBAAyB,QAAA,EAAgD;AACvF,EAAA,IAAI,OAAO,QAAA,KAAa,QAAA,IAAY,CAAC,UAAU,OAAO,MAAA;AACtD,EAAA,IAAI,CAAC,MAAA,CAAO,MAAA,CAAOA,+BAAA,EAAe,QAAQ,GAAG,OAAO,MAAA;AACpD,EAAA,MAAM,KAAA,GAAQA,gCAAc,QAAQ,CAAA;AACpC,EAAA,OAAO,MAAM,KAAA,CAAM,QAAA,CAAS,UAAU,CAAA,GAAI,MAAM,GAAA,GAAM,MAAA;AACxD;AAGO,SAAS,mBAAmB,QAAA,EAAqC;AACtE,EAAA,OAAO,wBAAA,CAAyB,QAAQ,CAAA,GAAK,QAAA,GAAgCC,2CAAA;AAC/E;AAGO,SAAS,wBAAwB,QAAA,EAAoC;AAC1E,EAAA,OAAOD,+BAAA,CAAc,kBAAA,CAAmB,QAAQ,CAAC,CAAA,CAAG,GAAA;AACtD;AAGO,SAAS,gBAAA,CAAiB,UAAmB,KAAA,EAAiC;AACnF,EAAA,OAAO,uBAAA,CAAwB,QAAQ,CAAA,CAAE,MAAA,CAAO,SAAS,KAAK,CAAA;AAChE;AAGO,SAAS,2BAA2B,QAAA,EAA4B;AACrE,EAAA,OAAO,uBAAA,CAAwB,QAAQ,CAAA,CAAE,UAAA;AAC3C;AAGO,SAAS,yBAAA,CAA0B,UAAmB,KAAA,EAAwB;AACnF,EAAA,IAAI,CAAC,OAAO,QAAA,CAAS,KAAK,KAAK,KAAA,GAAQ,CAAA,IAAK,KAAA,GAAQ,CAAA,EAAG,OAAO,KAAA;AAC9D,EAAA,MAAM,KAAA,GAAQ,uBAAA,CAAwB,QAAQ,CAAA,CAAE,cAAA;AAChD,EAAA,OAAO,KAAA,GAAQ,KAAA,CAAM,QAAA,CAAS,KAAK,CAAA,GAAI,IAAA;AACzC","file":"chunk-63H4C56Q.cjs","sourcesContent":["/**\n * Capability lookups for the DIALOGUE lane (`/v1/text-to-dialogue`, the Text to\n * Dialogue node, the voiced-video multi-speaker track).\n *\n * The dialogue models carry a `tts` sheet in `MODEL_CATALOG` like the\n * text-to-speech models, but each lane answers only for its own models: the\n * text-to-speech lookups (`tts-capabilities.ts`) treat a dialogue id as unknown,\n * and these treat a text-to-speech id as unknown. An unknown id here runs as\n * {@link DEFAULT_DIALOGUE_PROVIDER} (v3 dialogue) — not as the text-to-speech\n * fallback (turbo), which has no dialogue form.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from \"./model-catalog.js\"\nimport { DEFAULT_DIALOGUE_PROVIDER, type DialogueProvider } from \"./model-constants.js\"\n\n/** The sheet of a dialogue model, or `undefined` when the id is not one. Own properties only; a non-string is unknown. */\nexport function findDialogueCapabilities(provider: unknown): TtsCapabilities | undefined {\n if (typeof provider !== \"string\" || !provider) return undefined\n if (!Object.hasOwn(MODEL_CATALOG, provider)) return undefined\n const entry = MODEL_CATALOG[provider]!\n return entry.modes.includes(\"dialogue\") ? entry.tts : undefined\n}\n\n/** The dialogue model a request naming `provider` runs on (and is billed as). */\nexport function dialogueProviderOf(provider: unknown): DialogueProvider {\n return findDialogueCapabilities(provider) ? (provider as DialogueProvider) : DEFAULT_DIALOGUE_PROVIDER\n}\n\n/** The sheet a dialogue request runs under. */\nexport function getDialogueCapabilities(provider: unknown): TtsCapabilities {\n return MODEL_CATALOG[dialogueProviderOf(provider)]!.tts!\n}\n\n/** The dialogue model honours this voice-setting lever. */\nexport function dialogueHasLever(provider: unknown, lever: TtsSettingLever): boolean {\n return getDialogueCapabilities(provider).levers.includes(lever)\n}\n\n/** The dialogue model answers `/v1/text-to-dialogue/with-timestamps` (character timings + per-line voice segments). */\nexport function dialogueSupportsTimestamps(provider: unknown): boolean {\n return getDialogueCapabilities(provider).timestamps\n}\n\n/** `value` is a stability this platform accepts for the dialogue model: one of its steps, or any finite 0–1 when it has none. */\nexport function dialogueStabilityAccepted(provider: unknown, value: number): boolean {\n if (!Number.isFinite(value) || value < 0 || value > 1) return false\n const steps = getDialogueCapabilities(provider).stabilitySteps\n return steps ? steps.includes(value) : true\n}\n"]}