@nodaro/shared 3.32.0 → 3.35.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 (274) hide show
  1. package/dist/{chunk-VWGNPMJZ.cjs → chunk-24ZKPE33.cjs} +5 -5
  2. package/dist/{chunk-VWGNPMJZ.cjs.map → chunk-24ZKPE33.cjs.map} +1 -1
  3. package/dist/{chunk-CK3GK34R.js → chunk-2HIDE3QV.js} +9 -3
  4. package/dist/chunk-2HIDE3QV.js.map +1 -0
  5. package/dist/{chunk-WDIBOWAA.js → chunk-2HVFF5SS.js} +6 -6
  6. package/dist/chunk-2HVFF5SS.js.map +1 -0
  7. package/dist/{chunk-KHCBJ7KD.js → chunk-2QWNPYDG.js} +3 -3
  8. package/dist/{chunk-KHCBJ7KD.js.map → chunk-2QWNPYDG.js.map} +1 -1
  9. package/dist/{chunk-J6KHW2E5.cjs → chunk-3YG3MYDE.cjs} +153 -24
  10. package/dist/chunk-3YG3MYDE.cjs.map +1 -0
  11. package/dist/{chunk-ULXI7A6Q.cjs → chunk-5VNBQ4QK.cjs} +16 -16
  12. package/dist/{chunk-ULXI7A6Q.cjs.map → chunk-5VNBQ4QK.cjs.map} +1 -1
  13. package/dist/{chunk-5AUSSJIM.cjs → chunk-5ZCXWA7J.cjs} +232 -15
  14. package/dist/chunk-5ZCXWA7J.cjs.map +1 -0
  15. package/dist/{chunk-Z2OL5AJD.cjs → chunk-6F6GGX2W.cjs} +4 -3
  16. package/dist/chunk-6F6GGX2W.cjs.map +1 -0
  17. package/dist/{chunk-E2TGXG6X.cjs → chunk-72IFMNJE.cjs} +80 -52
  18. package/dist/chunk-72IFMNJE.cjs.map +1 -0
  19. package/dist/{chunk-NB72XWXQ.cjs → chunk-A5Z3IMSJ.cjs} +6 -6
  20. package/dist/{chunk-NB72XWXQ.cjs.map → chunk-A5Z3IMSJ.cjs.map} +1 -1
  21. package/dist/{chunk-NT6IJH4L.cjs → chunk-AGEZY4LL.cjs} +66 -47
  22. package/dist/chunk-AGEZY4LL.cjs.map +1 -0
  23. package/dist/{chunk-3CUFITU7.js → chunk-ANOQWAMU.js} +88 -54
  24. package/dist/chunk-ANOQWAMU.js.map +1 -0
  25. package/dist/{chunk-PRYE7AZQ.cjs → chunk-AWWOQH46.cjs} +7 -7
  26. package/dist/chunk-AWWOQH46.cjs.map +1 -0
  27. package/dist/{chunk-QELDJGDK.cjs → chunk-B7WJJHJS.cjs} +7 -4
  28. package/dist/chunk-B7WJJHJS.cjs.map +1 -0
  29. package/dist/{chunk-AVQK77G6.cjs → chunk-BBLE4UTG.cjs} +88 -54
  30. package/dist/chunk-BBLE4UTG.cjs.map +1 -0
  31. package/dist/{chunk-HGC5JNVA.cjs → chunk-BVVKMQKR.cjs} +9 -2
  32. package/dist/chunk-BVVKMQKR.cjs.map +1 -0
  33. package/dist/{chunk-YYV35XOS.js → chunk-C4R7BTBQ.js} +4 -3
  34. package/dist/chunk-C4R7BTBQ.js.map +1 -0
  35. package/dist/{chunk-AROWPFO2.js → chunk-ETXUOETU.js} +29 -36
  36. package/dist/chunk-ETXUOETU.js.map +1 -0
  37. package/dist/{chunk-S5DMKUWK.cjs → chunk-F4ZT5X2S.cjs} +11 -11
  38. package/dist/{chunk-S5DMKUWK.cjs.map → chunk-F4ZT5X2S.cjs.map} +1 -1
  39. package/dist/{chunk-YBPBK5KI.js → chunk-FKQJYMCO.js} +97 -23
  40. package/dist/chunk-FKQJYMCO.js.map +1 -0
  41. package/dist/{chunk-ZDFHA2EC.js → chunk-FVKCNAEQ.js} +51 -7
  42. package/dist/chunk-FVKCNAEQ.js.map +1 -0
  43. package/dist/{chunk-JSNV5O2F.cjs → chunk-GHBXS5RT.cjs} +4 -4
  44. package/dist/{chunk-JSNV5O2F.cjs.map → chunk-GHBXS5RT.cjs.map} +1 -1
  45. package/dist/{chunk-C57NEO3X.js → chunk-GKJRNIP4.js} +230 -16
  46. package/dist/chunk-GKJRNIP4.js.map +1 -0
  47. package/dist/{chunk-QNGNOU4Z.js → chunk-GRIMIJJ3.js} +3 -3
  48. package/dist/{chunk-QNGNOU4Z.js.map → chunk-GRIMIJJ3.js.map} +1 -1
  49. package/dist/{chunk-IEBZHTPE.js → chunk-GVHBHUFV.js} +34 -16
  50. package/dist/chunk-GVHBHUFV.js.map +1 -0
  51. package/dist/chunk-GZH2SIOF.cjs +99 -0
  52. package/dist/chunk-GZH2SIOF.cjs.map +1 -0
  53. package/dist/{chunk-YHRG7UOC.js → chunk-IJNQYMN7.js} +4 -4
  54. package/dist/{chunk-YHRG7UOC.js.map → chunk-IJNQYMN7.js.map} +1 -1
  55. package/dist/{chunk-JX5YZ4DH.cjs → chunk-IRUPCNW2.cjs} +49 -46
  56. package/dist/chunk-IRUPCNW2.cjs.map +1 -0
  57. package/dist/{chunk-JL4C5VJ7.cjs → chunk-J65CAOUV.cjs} +14 -2
  58. package/dist/chunk-J65CAOUV.cjs.map +1 -0
  59. package/dist/{chunk-ISJDAFKS.js → chunk-LJMNCSDG.js} +38 -15
  60. package/dist/chunk-LJMNCSDG.js.map +1 -0
  61. package/dist/{chunk-ZT77RY6R.js → chunk-MEN7VLQ5.js} +8 -5
  62. package/dist/chunk-MEN7VLQ5.js.map +1 -0
  63. package/dist/{chunk-VIWSWVAW.js → chunk-MUA5L25B.js} +125 -12
  64. package/dist/chunk-MUA5L25B.js.map +1 -0
  65. package/dist/{chunk-6IJOPRZP.cjs → chunk-NWXB4F6D.cjs} +21 -21
  66. package/dist/{chunk-6IJOPRZP.cjs.map → chunk-NWXB4F6D.cjs.map} +1 -1
  67. package/dist/{chunk-PQHS255G.js → chunk-OHSIVNJO.js} +3 -3
  68. package/dist/chunk-OHSIVNJO.js.map +1 -0
  69. package/dist/{chunk-LKAIXWK3.js → chunk-PVVO23LZ.js} +3 -3
  70. package/dist/{chunk-LKAIXWK3.js.map → chunk-PVVO23LZ.js.map} +1 -1
  71. package/dist/{chunk-XAMC4S53.js → chunk-Q4ZXDDWA.js} +3 -3
  72. package/dist/{chunk-XAMC4S53.js.map → chunk-Q4ZXDDWA.js.map} +1 -1
  73. package/dist/{chunk-EK362Q45.cjs → chunk-QIIG2QDP.cjs} +8 -8
  74. package/dist/{chunk-EK362Q45.cjs.map → chunk-QIIG2QDP.cjs.map} +1 -1
  75. package/dist/{chunk-Q4CDQ2KO.js → chunk-QXW6O56Z.js} +6 -6
  76. package/dist/chunk-QXW6O56Z.js.map +1 -0
  77. package/dist/{chunk-5PC6JBGJ.cjs → chunk-R2VF5NQG.cjs} +3 -3
  78. package/dist/chunk-R2VF5NQG.cjs.map +1 -0
  79. package/dist/{chunk-6DKDOWBL.js → chunk-RRI5YBUK.js} +6 -3
  80. package/dist/{chunk-QELDJGDK.cjs.map → chunk-RRI5YBUK.js.map} +1 -1
  81. package/dist/{chunk-RJL7RCEM.cjs → chunk-RUKFN3LJ.cjs} +6 -6
  82. package/dist/chunk-RUKFN3LJ.cjs.map +1 -0
  83. package/dist/chunk-TCBHVIMD.js +89 -0
  84. package/dist/chunk-TCBHVIMD.js.map +1 -0
  85. package/dist/{chunk-SES6GDBQ.cjs → chunk-UJJUX6NW.cjs} +59 -8
  86. package/dist/chunk-UJJUX6NW.cjs.map +1 -0
  87. package/dist/{chunk-ZRL2UFTH.cjs → chunk-V3N56Z2S.cjs} +101 -22
  88. package/dist/chunk-V3N56Z2S.cjs.map +1 -0
  89. package/dist/{chunk-Z4AZW6FY.js → chunk-W36WCZS2.js} +6 -6
  90. package/dist/{chunk-Z4AZW6FY.js.map → chunk-W36WCZS2.js.map} +1 -1
  91. package/dist/{chunk-M36G6SRP.js → chunk-WXNQMJ67.js} +14 -3
  92. package/dist/chunk-WXNQMJ67.js.map +1 -0
  93. package/dist/{chunk-O7PUQLJ3.cjs → chunk-XE5PE54B.cjs} +33 -40
  94. package/dist/chunk-XE5PE54B.cjs.map +1 -0
  95. package/dist/{chunk-LPW3XNC2.js → chunk-XJOBMAWW.js} +3 -3
  96. package/dist/{chunk-LPW3XNC2.js.map → chunk-XJOBMAWW.js.map} +1 -1
  97. package/dist/{chunk-5U7VLG43.js → chunk-XS7FI4JA.js} +3 -3
  98. package/dist/chunk-XS7FI4JA.js.map +1 -0
  99. package/dist/{chunk-O5MP52U2.cjs → chunk-YD3JA36S.cjs} +4 -4
  100. package/dist/{chunk-O5MP52U2.cjs.map → chunk-YD3JA36S.cjs.map} +1 -1
  101. package/dist/chunk-YYODFQEU.cjs +25 -0
  102. package/dist/chunk-YYODFQEU.cjs.map +1 -0
  103. package/dist/{chunk-RN3RMBJZ.js → chunk-ZXBSARZX.js} +4 -4
  104. package/dist/{chunk-RN3RMBJZ.js.map → chunk-ZXBSARZX.js.map} +1 -1
  105. package/dist/entries/apps.cjs +43 -42
  106. package/dist/entries/apps.d.cts +11 -2
  107. package/dist/entries/apps.d.ts +11 -2
  108. package/dist/entries/apps.js +8 -7
  109. package/dist/entries/catalogs.d.cts +1 -1
  110. package/dist/entries/catalogs.d.ts +1 -1
  111. package/dist/entries/credits.cjs +156 -152
  112. package/dist/entries/credits.d.cts +41 -10
  113. package/dist/entries/credits.d.ts +41 -10
  114. package/dist/entries/credits.js +8 -8
  115. package/dist/entries/edl.cjs +130 -102
  116. package/dist/entries/edl.d.cts +74 -3
  117. package/dist/entries/edl.d.ts +74 -3
  118. package/dist/entries/edl.js +2 -2
  119. package/dist/entries/entities.cjs +126 -122
  120. package/dist/entries/entities.d.cts +2 -2
  121. package/dist/entries/entities.d.ts +2 -2
  122. package/dist/entries/entities.js +1 -1
  123. package/dist/entries/i18n.cjs +11 -11
  124. package/dist/entries/i18n.d.cts +2 -2
  125. package/dist/entries/i18n.d.ts +2 -2
  126. package/dist/entries/i18n.js +1 -1
  127. package/dist/entries/llm-models.cjs +63 -43
  128. package/dist/entries/llm-models.d.cts +71 -4
  129. package/dist/entries/llm-models.d.ts +71 -4
  130. package/dist/entries/llm-models.js +1 -1
  131. package/dist/entries/media.cjs +45 -41
  132. package/dist/entries/media.d.cts +39 -1
  133. package/dist/entries/media.d.ts +39 -1
  134. package/dist/entries/media.js +1 -1
  135. package/dist/entries/model-catalog.cjs +75 -63
  136. package/dist/entries/model-catalog.d.cts +2 -2
  137. package/dist/entries/model-catalog.d.ts +2 -2
  138. package/dist/entries/model-catalog.js +4 -4
  139. package/dist/entries/models.cjs +274 -210
  140. package/dist/entries/models.d.cts +3 -3
  141. package/dist/entries/models.d.ts +3 -3
  142. package/dist/entries/models.js +5 -5
  143. package/dist/entries/nodes.cjs +222 -201
  144. package/dist/entries/nodes.d.cts +48 -8
  145. package/dist/entries/nodes.d.ts +48 -8
  146. package/dist/entries/nodes.js +10 -9
  147. package/dist/entries/pipeline.cjs +149 -149
  148. package/dist/entries/pipeline.d.cts +12 -8
  149. package/dist/entries/pipeline.d.ts +12 -8
  150. package/dist/entries/pipeline.js +3 -3
  151. package/dist/entries/social.cjs +174 -174
  152. package/dist/entries/social.d.cts +13 -5
  153. package/dist/entries/social.d.ts +13 -5
  154. package/dist/entries/social.js +2 -2
  155. package/dist/entries/types.d.cts +1 -1
  156. package/dist/entries/types.d.ts +1 -1
  157. package/dist/entries/ugc.cjs +71 -71
  158. package/dist/entries/ugc.js +4 -4
  159. package/dist/entries/video.cjs +115 -115
  160. package/dist/entries/video.d.cts +4 -3
  161. package/dist/entries/video.d.ts +4 -3
  162. package/dist/entries/video.js +4 -4
  163. package/dist/entries/workflow.cjs +96 -95
  164. package/dist/entries/workflow.d.cts +19 -20
  165. package/dist/entries/workflow.d.ts +19 -20
  166. package/dist/entries/workflow.js +2 -1
  167. package/dist/index.cjs +1720 -1563
  168. package/dist/index.d.cts +10 -10
  169. package/dist/index.d.ts +10 -10
  170. package/dist/index.js +26 -25
  171. package/dist/{model-catalog-flJYaa-g.d.ts → model-catalog-VIHGmQL2.d.cts} +113 -1
  172. package/dist/{model-catalog-flJYaa-g.d.cts → model-catalog-VIHGmQL2.d.ts} +113 -1
  173. package/dist/{presentation-utils-BIqiCzSA.d.cts → presentation-utils-A4i92SYo.d.cts} +3 -1
  174. package/dist/{presentation-utils-BdiObtwq.d.ts → presentation-utils-DjdPtM9k.d.ts} +3 -1
  175. package/dist/{scene-node-types-DjenYFLO.d.ts → scene-node-types-Cvbtf-0a.d.cts} +147 -6
  176. package/dist/{scene-node-types-DjenYFLO.d.cts → scene-node-types-Cvbtf-0a.d.ts} +147 -6
  177. package/dist/{types-DffyGSy5.d.ts → types-CU6SQnMS.d.cts} +0 -5
  178. package/dist/{types-DffyGSy5.d.cts → types-CU6SQnMS.d.ts} +0 -5
  179. package/dist/{types-BRlFPEru.d.cts → types-DzUBR7yr.d.cts} +8 -1
  180. package/dist/{types-BRlFPEru.d.ts → types-DzUBR7yr.d.ts} +8 -1
  181. package/package.json +1 -1
  182. package/src/__tests__/camera-switch-contract.test.ts +33 -1
  183. package/src/__tests__/character-mention-slug.test.ts +0 -8
  184. package/src/__tests__/effective-tier.test.ts +3 -14
  185. package/src/__tests__/fixtures/camera-switch-speaker-map-parity.json +178 -0
  186. package/src/__tests__/fixtures/root-exports.baseline.json +21 -0
  187. package/src/__tests__/fixtures/speaker-map-camera-ids.json +26 -0
  188. package/src/__tests__/gvp-supported-providers.test.ts +1 -0
  189. package/src/__tests__/i18n-locale-completeness.test.ts +38 -3
  190. package/src/__tests__/llm-models.test.ts +200 -20
  191. package/src/__tests__/model-makers.test.ts +76 -0
  192. package/src/__tests__/node-preset-extract.test.ts +10 -0
  193. package/src/__tests__/presentation-utils.test.ts +15 -0
  194. package/src/__tests__/preview-gate-use-case.test.ts +16 -1
  195. package/src/__tests__/private-host.test.ts +53 -0
  196. package/src/__tests__/producer-types.test.ts +19 -0
  197. package/src/__tests__/run-continuation.test.ts +4 -1
  198. package/src/__tests__/speaker-map-contract.test.ts +48 -0
  199. package/src/__tests__/unit-contract-compose.test.ts +129 -0
  200. package/src/__tests__/unit-contracts.test.ts +134 -0
  201. package/src/__tests__/use-case-types.test.ts +33 -0
  202. package/src/__tests__/video-collapse-parity.test.ts +10 -0
  203. package/src/__tests__/video-frame-slot.test.ts +85 -0
  204. package/src/__tests__/video-mode-aliases.test.ts +1 -0
  205. package/src/__tests__/video-reference-only.test.ts +117 -0
  206. package/src/__tests__/vidu-q4-catalog.test.ts +230 -0
  207. package/src/camera-switch-contract.ts +36 -2
  208. package/src/component-types.ts +9 -0
  209. package/src/credit-identifiers.ts +81 -23
  210. package/src/entity-asset-types.ts +13 -0
  211. package/src/entries/credits.ts +1 -0
  212. package/src/entries/edl.ts +2 -0
  213. package/src/entries/llm-models.ts +5 -0
  214. package/src/entries/media.ts +1 -0
  215. package/src/entries/model-catalog.ts +6 -0
  216. package/src/entries/models.ts +25 -0
  217. package/src/entries/nodes.ts +5 -1
  218. package/src/fan-out-rows.ts +36 -3
  219. package/src/generate-mask.ts +40 -0
  220. package/src/generated/unit-contracts.ts +58 -0
  221. package/src/i18n/types.ts +13 -2
  222. package/src/json-kinds.ts +24 -4
  223. package/src/llm-models.ts +184 -31
  224. package/src/meta-ads-scrape.ts +16 -8
  225. package/src/model-catalog.ts +285 -13
  226. package/src/model-constants.ts +260 -5
  227. package/src/node-default-mappings.ts +3 -0
  228. package/src/node-preset-extract.ts +8 -0
  229. package/src/pipeline-types.ts +3 -0
  230. package/src/presentation-utils.ts +19 -12
  231. package/src/preview-gate.ts +4 -2
  232. package/src/private-host.ts +89 -59
  233. package/src/producer-types.ts +19 -19
  234. package/src/run-continuation.ts +26 -4
  235. package/src/speaker-layouts.ts +8 -3
  236. package/src/speaker-map-contract.ts +77 -0
  237. package/src/unit-contract-compose.ts +55 -0
  238. package/src/use-case-types.ts +19 -0
  239. package/src/video-ui-defaults.ts +7 -5
  240. package/dist/chunk-3CUFITU7.js.map +0 -1
  241. package/dist/chunk-5AUSSJIM.cjs.map +0 -1
  242. package/dist/chunk-5PC6JBGJ.cjs.map +0 -1
  243. package/dist/chunk-5U7VLG43.js.map +0 -1
  244. package/dist/chunk-6DKDOWBL.js.map +0 -1
  245. package/dist/chunk-AROWPFO2.js.map +0 -1
  246. package/dist/chunk-AVQK77G6.cjs.map +0 -1
  247. package/dist/chunk-C57NEO3X.js.map +0 -1
  248. package/dist/chunk-CK3GK34R.js.map +0 -1
  249. package/dist/chunk-E2TGXG6X.cjs.map +0 -1
  250. package/dist/chunk-HGC5JNVA.cjs.map +0 -1
  251. package/dist/chunk-IEBZHTPE.js.map +0 -1
  252. package/dist/chunk-ISJDAFKS.js.map +0 -1
  253. package/dist/chunk-J6KHW2E5.cjs.map +0 -1
  254. package/dist/chunk-JL4C5VJ7.cjs.map +0 -1
  255. package/dist/chunk-JX5YZ4DH.cjs.map +0 -1
  256. package/dist/chunk-M36G6SRP.js.map +0 -1
  257. package/dist/chunk-NT6IJH4L.cjs.map +0 -1
  258. package/dist/chunk-O7PUQLJ3.cjs.map +0 -1
  259. package/dist/chunk-PQHS255G.js.map +0 -1
  260. package/dist/chunk-PRYE7AZQ.cjs.map +0 -1
  261. package/dist/chunk-Q4CDQ2KO.js.map +0 -1
  262. package/dist/chunk-RJL7RCEM.cjs.map +0 -1
  263. package/dist/chunk-SES6GDBQ.cjs.map +0 -1
  264. package/dist/chunk-VIWSWVAW.js.map +0 -1
  265. package/dist/chunk-WDIBOWAA.js.map +0 -1
  266. package/dist/chunk-WNG7HRVA.cjs +0 -25
  267. package/dist/chunk-WNG7HRVA.cjs.map +0 -1
  268. package/dist/chunk-YBPBK5KI.js.map +0 -1
  269. package/dist/chunk-YYV35XOS.js.map +0 -1
  270. package/dist/chunk-Z2OL5AJD.cjs.map +0 -1
  271. package/dist/chunk-ZDFHA2EC.js.map +0 -1
  272. package/dist/chunk-ZRL2UFTH.cjs.map +0 -1
  273. package/dist/chunk-ZT77RY6R.js.map +0 -1
  274. package/src/__tests__/__snapshots__/prompt-builder-segments.test.ts.snap +0 -65
@@ -18,6 +18,7 @@
18
18
  import { evaluateJsonPath, stringifyPathResults } from "./json-path.js"
19
19
  import { expandItemsWithRepeat } from "./repeat-types.js"
20
20
  import { isDefaultSelectorConfig, resolveIndex, selectListItems, type SelectorFields } from "./selector.js"
21
+ import { unitNonPromptInputs } from "./unit-contract-compose.js"
21
22
 
22
23
  /**
23
24
  * The text LANES the input resolvers route somewhere OTHER than the prompt slot
@@ -37,7 +38,7 @@ import { isDefaultSelectorConfig, resolveIndex, selectListItems, type SelectorFi
37
38
  * unlisted lane keeps the old behavior (the item is the prompt), so a miss can
38
39
  * only ever reproduce the old bug on that one lane, never a new one.
39
40
  */
40
- export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly string[]>> = {
41
+ const LEGACY_NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly string[]>> = {
41
42
  negative: "*",
42
43
  "system-prompt": "*",
43
44
  script: ["ai-avatar"],
@@ -47,6 +48,8 @@ export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly strin
47
48
  tracks: ["speaker-view"],
48
49
  silence: ["edit-plan"],
49
50
  offsets: ["edit-plan"],
51
+ // Camera Switch's speaker map (a Speaker Map result): who is on which camera, never a prompt.
52
+ speakerMap: ["camera-switch"],
50
53
  qrText: ["image-overlay"],
51
54
  layerPlan: ["video-overlay"],
52
55
  captionPlan: ["add-captions"],
@@ -55,8 +58,38 @@ export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly strin
55
58
  // the material it analyzes — a list of links fanned through it must not be
56
59
  // written into the material too.
57
60
  link: ["content-recipe"],
58
- // Tighten Episode's `music` is the bed's address (inputs.useCaseMusic), never a prompt.
59
- music: ["tighten-episode"],
61
+ }
62
+
63
+ /**
64
+ * The hand-written lanes ∪ the node units' `contract.nonPromptInputs` rows
65
+ * (generated/unit-contracts.ts): each unit type joins the list of every handle
66
+ * it names (a handle no list names yet gets one). A `"*"` lane already covers
67
+ * every type, so it stays as it is. A type listed twice for one handle throws
68
+ * at load — a type is hand-written or a node unit, never both.
69
+ */
70
+ export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly string[]>> = composeNonPromptLanes(LEGACY_NON_PROMPT_TEXT_LANES, unitNonPromptInputs())
71
+
72
+ function composeNonPromptLanes(
73
+ legacy: Readonly<Record<string, "*" | readonly string[]>>,
74
+ rows: ReadonlyArray<readonly [string, ReadonlyArray<string>]>,
75
+ ): Record<string, "*" | readonly string[]> {
76
+ const out: Record<string, "*" | readonly string[]> = { ...legacy }
77
+ for (const [type, handles] of rows) {
78
+ const own = new Set<string>()
79
+ for (const handle of handles) {
80
+ // A unit naming one handle twice in its own row is its own mistake, not a clash with the hand-written lanes.
81
+ if (own.has(handle)) throw new Error(`NON_PROMPT_TEXT_LANES: node unit ${type} lists "${handle}" twice in its contract.nonPromptInputs`)
82
+ own.add(handle)
83
+ const scope = Object.hasOwn(out, handle) ? out[handle] : []
84
+ if (scope === "*") continue
85
+ // Only the same handle clashes here: a unit hand-listed under a DIFFERENT
86
+ // handle is a string literal of a unit's id outside its folders, which
87
+ // G2 fails (frontend/src/__tests__/node-units-structure.test.ts).
88
+ if (scope.includes(type)) throw new Error(`NON_PROMPT_TEXT_LANES: ${type} is listed for "${handle}" both by hand and as a node unit — a type lives in one place`)
89
+ out[handle] = [...scope, type]
90
+ }
91
+ }
92
+ return out
60
93
  }
61
94
 
62
95
  /** Does a TEXT list wired to `targetHandle` of a `nodeType` node feed its prompt slot? */
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Generate Mask — text-prompted IMAGE segmentation (Grounded SAM). The wire
3
+ * contract of `POST /v1/generate-mask`, the `generate_mask` MCP verb, the SDK's
4
+ * `nodes.run("generate-mask", …)` and `nodaro media generate-mask`, defined ONCE:
5
+ * every bound the route schema and the SDK/CLI read.
6
+ *
7
+ * The finished job's output is `{ maskUrl, imageUrl }`: `maskUrl` is the
8
+ * black-and-white mask PNG (white = the subject), `imageUrl` is the SOURCE
9
+ * image passed through unchanged, so an inpainting step can take the pair.
10
+ *
11
+ * Wire contract only — no I/O.
12
+ */
13
+
14
+ export const GENERATE_MASK_LIMITS = {
15
+ /** Subject description length cap. */
16
+ PROMPT_MAX_LENGTH: 500,
17
+ /** Segmentation confidence bounds. */
18
+ THRESHOLD_MIN: 0,
19
+ THRESHOLD_MAX: 1,
20
+ /** Default segmentation confidence. Lower selects more (and less precise) regions. */
21
+ THRESHOLD_DEFAULT: 0.3,
22
+ } as const
23
+
24
+ /** `POST /v1/generate-mask` request body. */
25
+ export interface GenerateMaskRequest {
26
+ /** The image to segment. */
27
+ readonly imageUrl: string
28
+ /** What to select, in plain words (e.g. "the person", "sky and clouds"). 1–500 characters. */
29
+ readonly prompt: string
30
+ /** Segmentation confidence, `GENERATE_MASK_LIMITS.THRESHOLD_MIN`–`THRESHOLD_MAX` (default 0.3). */
31
+ readonly threshold?: number
32
+ }
33
+
34
+ /** A completed Generate Mask job's `output_data`. */
35
+ export interface GenerateMaskOutput {
36
+ /** The mask: a black-and-white PNG, white = the subject. */
37
+ readonly maskUrl: string
38
+ /** The source image, passed through unchanged. */
39
+ readonly imageUrl: string
40
+ }
@@ -0,0 +1,58 @@
1
+ // GENERATED by tools/units/gen.mjs — do not edit; run npm run gen:units
2
+ // The unit contract published in @nodaro/shared (decided 2026-10-16, widened 2026-10-18): node type
3
+ // ids with closed vocabularies — each unit's producer kind, the use-case types, what each JSON pip
4
+ // carries, the input pips that are never a prompt lane, the review holds, how a published app
5
+ // presents the result and which outputs fan out item by item. Never a price, credit id, number,
6
+ // prompt or doctrine string. Each block feeds a published table that composes its rows with the
7
+ // hand-written ones (unit-contract-compose.ts); every row is an irrevocable Apache grant.
8
+
9
+ export const UNIT_CONTRACTS: ReadonlyArray<readonly [type: string, producer: "audio" | "video" | "image" | "dynamic"]> = [
10
+ ["tighten-episode", "dynamic"], // unit:tighten-episode
11
+ ["episode-trailer", "video"], // unit:episode-trailer
12
+ ["clip-pack", "dynamic"], // unit:clip-pack
13
+ ["remove-audio", "video"], // unit:remove-audio
14
+ ["gif-to-video", "video"], // unit:gif-to-video
15
+ ]
16
+
17
+ // The use-case node units (execution.kind "use-case"), in position order — each a route POST /v1/<type> (+ /estimate, /continue).
18
+ export const UNIT_USE_CASE_TYPES = [
19
+ "tighten-episode", // unit:tighten-episode
20
+ "episode-chapters", // unit:episode-chapters
21
+ "episode-trailer", // unit:episode-trailer
22
+ "clip-pack", // unit:clip-pack
23
+ ] as const
24
+
25
+ // What each JSON (look) output pip carries (contract.jsonPips) — json-kinds.ts composes these.
26
+ export const UNIT_JSON_PIPS: ReadonlyArray<readonly [type: string, pips: Readonly<Record<string, "transcript" | "edl" | "other">>]> = [
27
+ ["tighten-episode", { "json": "edl" }], // unit:tighten-episode
28
+ ["episode-chapters", { "json": "other" }], // unit:episode-chapters
29
+ ["episode-trailer", { "json": "edl" }], // unit:episode-trailer
30
+ ["clip-pack", { "json": "edl" }], // unit:clip-pack
31
+ ["speaker-map", { "edl": "edl", "json": "other" }], // unit:speaker-map
32
+ ]
33
+
34
+ // Input pips that are never a prompt lane (contract.nonPromptInputs) — fan-out-rows.ts composes these.
35
+ export const UNIT_NON_PROMPT_INPUTS: ReadonlyArray<readonly [type: string, handles: ReadonlyArray<string>]> = [
36
+ ["tighten-episode", ["music"]], // unit:tighten-episode
37
+ ["episode-trailer", ["introCard"]], // unit:episode-trailer
38
+ ]
39
+
40
+ // Use-case units whose review-on run ends at a Preview that holds what follows (contract.reviewHold) — preview-gate.ts.
41
+ export const UNIT_REVIEW_HOLDS: ReadonlyArray<string> = [
42
+ "tighten-episode", // unit:tighten-episode
43
+ "episode-trailer", // unit:episode-trailer
44
+ "clip-pack", // unit:clip-pack
45
+ ]
46
+
47
+ // How a published app shows each unit's result where the producer sets do not decide it (contract.presents) — presentation-utils.ts.
48
+ export const UNIT_PRESENTS: ReadonlyArray<readonly [type: string, presents: "image" | "video" | "audio" | "text"]> = [
49
+ ["tighten-episode", "video"], // unit:tighten-episode
50
+ ["episode-chapters", "text"], // unit:episode-chapters
51
+ ["clip-pack", "video"], // unit:clip-pack
52
+ ]
53
+
54
+ // The outputs an "each" edge reads item by item when the unit ran once per item, and the pip an edge naming none reads (contract.fanOutEach) — producer-types.ts.
55
+ export const UNIT_FAN_OUT_EACH: ReadonlyArray<readonly [type: string, handles: { readonly each: ReadonlyArray<string>; readonly primary: string }]> = [
56
+ ["episode-trailer", { "each": ["media"], "primary": "media" }], // unit:episode-trailer
57
+ ["clip-pack", { "each": ["clips"], "primary": "clips" }], // unit:clip-pack
58
+ ]
package/src/i18n/types.ts CHANGED
@@ -59,7 +59,7 @@ export interface LanguageDefinition {
59
59
  * dropdown. English first as canonical default, then mainstream LTR
60
60
  * languages, then RTL languages last.
61
61
  */
62
- export const LANGUAGES: ReadonlyArray<LanguageDefinition> = [
62
+ const LANGUAGE_TABLE = [
63
63
  { id: "en", englishName: "English", nativeName: "English", shortCode: "EN", dir: "ltr" },
64
64
  { id: "es", englishName: "Spanish", nativeName: "Español", shortCode: "ES", dir: "ltr" },
65
65
  { id: "fr", englishName: "French", nativeName: "Français", shortCode: "FR", dir: "ltr" },
@@ -72,7 +72,18 @@ export const LANGUAGES: ReadonlyArray<LanguageDefinition> = [
72
72
  { id: "zh-CN", englishName: "Chinese (Simplified)", nativeName: "简体中文", shortCode: "ZH", dir: "ltr" },
73
73
  { id: "he", englishName: "Hebrew", nativeName: "עברית", shortCode: "HE", dir: "rtl" },
74
74
  { id: "ar", englishName: "Arabic", nativeName: "العربية", shortCode: "AR", dir: "rtl" },
75
- ] as const
75
+ ] as const satisfies ReadonlyArray<LanguageDefinition>
76
+
77
+ export const LANGUAGES: ReadonlyArray<LanguageDefinition> = LANGUAGE_TABLE
78
+
79
+ // Compile-time: the registry's ids are exactly the LocaleId union. `satisfies`
80
+ // above rejects an id that is not a LocaleId; this rejects a LocaleId with no
81
+ // LANGUAGES entry (the error names the missing ids). Types only: nothing is
82
+ // emitted or exported.
83
+ type LocaleIdsWithoutALanguage = Exclude<LocaleId, (typeof LANGUAGE_TABLE)[number]["id"]>
84
+ type MustBeNever<T extends never> = T
85
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
86
+ type EveryLocaleIdHasALanguage = MustBeNever<LocaleIdsWithoutALanguage>
76
87
 
77
88
  export const LOCALE_IDS: ReadonlyArray<LocaleId> = LANGUAGES.map((l) => l.id)
78
89
  export const NON_EN_LOCALE_IDS: ReadonlyArray<Exclude<LocaleId, "en">> = LANGUAGES
package/src/json-kinds.ts CHANGED
@@ -29,6 +29,7 @@
29
29
  */
30
30
  import { RENDER_JSON_HANDLE, RENDER_NODE_TYPES, type RenderNodeDescriptor } from "./render-nodes.js"
31
31
  import { UGC_PRIMARY_HANDLE } from "./ugc-node-wires.js"
32
+ import { unitJsonPips } from "./unit-contract-compose.js"
32
33
 
33
34
  /** The two JSON shapes the platform's handle vocabulary tells apart. */
34
35
  export type JsonKind = "transcript" | "edl"
@@ -46,8 +47,8 @@ interface JsonOutputs {
46
47
  readonly pips: Readonly<Record<string, JsonOutputDeclaration>>
47
48
  }
48
49
 
49
- /** JSON outputs of the nodes that are not renders: pip id → what it carries. */
50
- const JSON_OUTPUT_KINDS: Readonly<Record<string, JsonOutputs>> = Object.freeze({
50
+ /** JSON outputs of the hand-written nodes that are not renders: pip id → what it carries. */
51
+ const LEGACY_JSON_OUTPUT_KINDS: Readonly<Record<string, JsonOutputs>> = Object.freeze({
51
52
  // Edit Plan: the plan on `edl` — a Tighten EDL, a clip set (`Edl[]`) or a chapter list.
52
53
  "edit-plan": { primary: "edl", pips: { edl: "edl" } },
53
54
  // Transcribe: its json is the normalized Transcript (its `text` pip is plain text, no kind).
@@ -59,8 +60,6 @@ const JSON_OUTPUT_KINDS: Readonly<Record<string, JsonOutputs>> = Object.freeze({
59
60
  "speaker-frames": { primary: "tracks", pips: { tracks: "other" } },
60
61
  // Text to Dialogue: the Transcript built from the model's own word timings (its default read is the audio).
61
62
  "text-to-dialogue": { pips: { json: "transcript" } },
62
- // Tighten Episode: its json is the plan's EDL (dropped[] included); its default read is the media.
63
- "tighten-episode": { pips: { json: "edl" } },
64
63
 
65
64
  // ── JSON that is neither a Transcript nor an EDL (decided 2026-10-08) ──
66
65
  // Forced Alignment: `{ alignment: [{ word, start, end }] }` in seconds — a word list, not a Transcript.
@@ -98,6 +97,27 @@ const JSON_OUTPUT_KINDS: Readonly<Record<string, JsonOutputs>> = Object.freeze({
98
97
  "ugc-cards": { primary: UGC_PRIMARY_HANDLE["ugc-cards"], pips: { layerPlan: "other", captionPlan: "other" } },
99
98
  })
100
99
 
100
+ /**
101
+ * The JSON outputs of the nodes that are not renders: the hand-written table ∪
102
+ * the node units' `contract.jsonPips` rows (generated/unit-contracts.ts). A unit
103
+ * declares every one of its JSON pips (the validator's twin of the guard test)
104
+ * and has no `primary`: an edge with no `sourceHandle` from a unit reads no JSON.
105
+ */
106
+ const JSON_OUTPUT_KINDS: Readonly<Record<string, JsonOutputs>> = Object.freeze(composeJsonOutputs(LEGACY_JSON_OUTPUT_KINDS, unitJsonPips()))
107
+
108
+ /** `legacy` with each unit row added as `{ pips }`, refusing a type that is in both (throws at load). */
109
+ function composeJsonOutputs(
110
+ legacy: Readonly<Record<string, JsonOutputs>>,
111
+ rows: ReadonlyArray<readonly [string, Readonly<Record<string, JsonOutputDeclaration>>]>,
112
+ ): Record<string, JsonOutputs> {
113
+ const out: Record<string, JsonOutputs> = { ...legacy }
114
+ for (const [type, pips] of rows) {
115
+ if (Object.hasOwn(out, type)) throw new Error(`JSON_OUTPUT_KINDS: ${type} is both a legacy entry and a node unit`)
116
+ out[type] = { pips }
117
+ }
118
+ return out
119
+ }
120
+
101
121
  /** The input pips whose kind is fixed by the handle vocabulary. */
102
122
  const JSON_INPUT_KINDS: Readonly<Record<string, JsonKind>> = Object.freeze({
103
123
  transcript: "transcript",
package/src/llm-models.ts CHANGED
@@ -33,6 +33,24 @@ export interface LlmModelDef {
33
33
  * For messages: the model id sent in the body (e.g. "claude-haiku-4-5-v1messages").
34
34
  * For responses: the model id sent in the body (e.g. "gpt-5-4"). */
35
35
  kieSlugOrModel: string
36
+ /**
37
+ * The registry id of the model the aggregator ACTUALLY answers this id's KIE
38
+ * lane with, when that is a different model. Set together with borrowing
39
+ * that model's `kieSlugOrModel`, so the wire names what really runs. Only
40
+ * the KIE lane is affected: the direct lane still serves `directGeminiModel`.
41
+ * The KIE lane is costed on that model's KIE rate row. A lookup by the
42
+ * borrowed slug ({@link getLlmModel}) always resolves to its owner, never
43
+ * to the borrower. Absent = KIE serves this id as itself.
44
+ */
45
+ kieServedAs?: string
46
+ /**
47
+ * true = no longer offered: every model menu and advertised list leaves it
48
+ * out ({@link PICKABLE_LLM_MODELS}, {@link groupLlmModelsByVendor}), while
49
+ * the id stays in {@link LLM_MODEL_IDS}, so a saved node or API call that
50
+ * names it keeps validating, resolving and running exactly as before. No
51
+ * default may point at a retired model (registry test).
52
+ */
53
+ retired?: true
36
54
  vendor: LlmVendor
37
55
  supportsImages: boolean
38
56
  maxOutputTokens: number
@@ -77,6 +95,20 @@ export interface LlmModelDef {
77
95
  * idea. Guarded by a registry test so the two can't both be set.
78
96
  */
79
97
  preferDirect?: true
98
+ /**
99
+ * true = served ONLY on the vendor's own API (`directGeminiModel`): KIE is
100
+ * never called for this model — not as the primary lane, not as a failure
101
+ * or exhausted-account fallback, not on a pin. `kieSlugOrModel` still names
102
+ * the aggregator's endpoint, for the record and for a later re-enable after
103
+ * a re-probe; nothing sends to it.
104
+ *
105
+ * Every call therefore runs direct, so {@link llmServesDirect} is true for it
106
+ * and it bills on the direct rung by default, Advanced mode or not. Without a
107
+ * direct key the call fails as provider-unavailable rather than reaching KIE.
108
+ * Stronger than `preferDirect` (which keeps KIE as the fallback); the two are
109
+ * mutually exclusive, as are `directOnly` and `preferKie` (registry test).
110
+ */
111
+ directOnly?: true
80
112
  /** Effort levels this model accepts (ascending). Absent/empty = no effort lever, picker hidden. */
81
113
  reasoningEfforts?: readonly LlmReasoningEffort[]
82
114
  /**
@@ -265,10 +297,14 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
265
297
  desc: "Fast Gemini, agentic-tuned",
266
298
  tier: "economy",
267
299
  kieFormat: "chat-completions",
268
- // KIE serves it on the OpenAI-compatible dialect under this slug
269
- // (docs.kie.ai/market/gemini/gemini-3-7-flash-openai.md) — same
270
- // chat-completions path shape as gemini-3.6-flash.
271
- kieSlugOrModel: "gemini-3-7-flash-openai",
300
+ // Retired 2026-10-19: the aggregator answers this model's own endpoint
301
+ // (`gemini-3-7-flash-openai`) with 3.8, so the KIE lane now names 3.8's
302
+ // endpoint outright and says so. The direct Google lane below still serves
303
+ // real 3.7, Advanced mode included. The entry leaves every picker; saved
304
+ // nodes and API callers that name the id keep running unchanged.
305
+ kieSlugOrModel: "gemini-3-8-flash-openai",
306
+ kieServedAs: "gemini-3.8-flash",
307
+ retired: true,
272
308
  vendor: "google",
273
309
  structuredOutputMode: "kie-response-format",
274
310
  supportsImages: true,
@@ -462,6 +498,55 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
462
498
  thinkingDefaultOn: true,
463
499
  reasoningOutputFloor: 16384,
464
500
  },
501
+ {
502
+ id: "gemini-4-argon",
503
+ displayName: "Gemini 4 Argon",
504
+ desc: "Newest premium Gemini, 1M context",
505
+ tier: "premium",
506
+ kieFormat: "chat-completions",
507
+ // DIRECT-ONLY (decided 2026-10-17): KIE serves it on the OpenAI-compatible
508
+ // dialect under this slug (docs.kie.ai/market/gemini/gemini-4-argon-openai.md,
509
+ // byte-identical to the 3.8 Flash spec apart from the name), but that lane
510
+ // failed its probe the same day — of 15 completed calls, 6 came back HTTP 200
511
+ // `finish_reason: stop` with an EMPTY reply (both image calls among them,
512
+ // each still charged), `completion_tokens` was NEGATIVE on reasoning calls
513
+ // (-33, -38), replies leaked code-execution fences (```python?code_reference),
514
+ // `response_format` json_schema left an enum field holding prose, and an
515
+ // off-enum `reasoning_effort: medium` was an empty 200 rather than an error.
516
+ // So no call reaches KIE (`directOnly`); the slug is kept for the record.
517
+ // Re-enable it only after a re-probe of that lane comes back clean.
518
+ // KIE also flags the page "Chat only — not yet adapted for agent use", like
519
+ // kimi-k3 / deepseek below: it may not back a tool-loop feature. No registry
520
+ // gate enforces that today — the only tool loops (Workflow Copilot, the
521
+ // pipeline stage calls) are Claude-only by construction.
522
+ kieSlugOrModel: "gemini-4-argon-openai",
523
+ vendor: "google",
524
+ // The direct lane enforces `responseJsonSchema` (an enum field came back
525
+ // in-enum, 2026-10-17). This mode is what turns that schema on there.
526
+ structuredOutputMode: "kie-response-format",
527
+ supportsImages: true,
528
+ // The registry's usual 16384 default. Google's own cap is 32,768
529
+ // (models.list); every call is floored to that (`thinkingDefaultOn`, below).
530
+ maxOutputTokens: 16384,
531
+ directGeminiModel: "gemini-4-argon",
532
+ directOnly: true,
533
+ // The direct lane's ladder, and the only one: every call runs there.
534
+ // Google rejects thinkingLevel MINIMAL on this model with a 400 ("not
535
+ // supported for this model") and accepts LOW / MEDIUM / HIGH (probed
536
+ // 2026-10-17) — 3.1 Pro's shape, not the flash one. `none` maps to MINIMAL
537
+ // in the direct client, so it is not offered; a `none` request clamps to
538
+ // Auto.
539
+ reasoningEfforts: ["low", "medium", "high"],
540
+ // Gemini's documented default (dynamic thinking with no param sent). The no-param
541
+ // call reported no thought tokens on a two-part puzzle (HIGH reported 452),
542
+ // so this is the vendor default rather than a measurement — kept because it
543
+ // only raises the output ceiling. No `reasoningOutputFloor`: its one lane
544
+ // is Google's, whose cap IS the default 32768 (models.list), and calls sent
545
+ // maxOutputTokens 32768 / 65536 were served, not refused (2026-10-17). How
546
+ // much output it gives at that cap is unmeasured — both long-output probes
547
+ // ended early (one declined the task, one stopped on RECITATION).
548
+ thinkingDefaultOn: true,
549
+ },
465
550
  {
466
551
  id: "claude-opus-4.7",
467
552
  displayName: "Claude Opus 4.7",
@@ -948,6 +1033,24 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
948
1033
 
949
1034
  export const LLM_MODEL_IDS = LLM_MODELS.map((m) => m.id)
950
1035
 
1036
+ /** True when the model is registered but retired (see `LlmModelDef.retired`). */
1037
+ export function isLlmModelRetired(id: string): boolean {
1038
+ return getLlmModel(id)?.retired === true
1039
+ }
1040
+
1041
+ /** The models a picker may OFFER: the registry minus retired entries. The
1042
+ * accepted set is still {@link LLM_MODEL_IDS}. */
1043
+ export const PICKABLE_LLM_MODELS: readonly LlmModelDef[] = LLM_MODELS.filter((m) => !m.retired)
1044
+
1045
+ /**
1046
+ * {@link PICKABLE_LLM_MODELS}, plus `currentId`'s own entry when it is a
1047
+ * retired model — for a plain select that has to keep showing a saved node's
1048
+ * value as selected. Registry order either way.
1049
+ */
1050
+ export function pickableLlmModels(currentId?: string): LlmModelDef[] {
1051
+ return LLM_MODELS.filter((m) => !m.retired || m.id === currentId)
1052
+ }
1053
+
951
1054
  /** Vision models that can return GUARANTEED structured output — the
952
1055
  * describe-to-picker analyzer forces a schema over an image, so its model
953
1056
  * pickers AND the backend route gate offer exactly these: Anthropic (forced
@@ -991,12 +1094,14 @@ export interface LlmModelGroup {
991
1094
  * A flat registry-order dump was genuinely hard to scan at 17 models — every
992
1095
  * picker (config panel, quick strips, quick toolbar) derives from this so the
993
1096
  * menus can't drift apart. Groups with no models (after `filter`) are omitted.
1097
+ * Retired models are never listed, whatever list is passed in: a menu offers
1098
+ * only what can be picked (a saved retired value is labelled by the caller).
994
1099
  */
995
1100
  export function groupLlmModelsByVendor(models: readonly LlmModelDef[] = LLM_MODELS): LlmModelGroup[] {
996
1101
  const groups: LlmModelGroup[] = []
997
1102
  for (const vendor of LLM_VENDOR_ORDER) {
998
1103
  const members = models
999
- .filter((m) => m.vendor === vendor)
1104
+ .filter((m) => m.vendor === vendor && !m.retired)
1000
1105
  .sort((a, b) => TIER_RANK[a.tier] - TIER_RANK[b.tier])
1001
1106
  if (members.length > 0) groups.push({ vendor, label: LLM_VENDOR_LABELS[vendor], models: members })
1002
1107
  }
@@ -1057,17 +1162,17 @@ export function motionGraphicsFeature(engine?: string): LlmFeature {
1057
1162
 
1058
1163
  /** Feature → default model when user hasn't selected one */
1059
1164
  export const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {
1060
- "ai-writer": "claude-sonnet-4.6",
1165
+ "ai-writer": "claude-sonnet-5.5",
1061
1166
  "llm-chat": "gemini-3.6-flash",
1062
1167
  "prompt-helper": "gemini-3.6-flash",
1063
- "scene-graph-ai": "claude-sonnet-4.6",
1064
- "after-effects": "claude-sonnet-4.6",
1065
- "motion-graphics": "claude-sonnet-4.6",
1066
- "motion-graphics-lottie": "claude-sonnet-4.6",
1067
- "lottie-overlay": "claude-sonnet-4.6",
1068
- "3d-title": "claude-sonnet-4.6",
1069
- "3d-scene": "claude-sonnet-4.6",
1070
- "image-to-text": "claude-sonnet-4.6",
1168
+ "scene-graph-ai": "claude-sonnet-5.5",
1169
+ "after-effects": "claude-sonnet-5.5",
1170
+ "motion-graphics": "claude-sonnet-5.5",
1171
+ "motion-graphics-lottie": "claude-sonnet-5.5",
1172
+ "lottie-overlay": "claude-sonnet-5.5",
1173
+ "3d-title": "claude-sonnet-5.5",
1174
+ "3d-scene": "claude-sonnet-5.5",
1175
+ "image-to-text": "claude-sonnet-5.5",
1071
1176
  // Economy on purpose: the analysis reads ONE frame + the copy per ad and
1072
1177
  // runs once per returned ad — volume, not depth. Must stay an image-capable
1073
1178
  // structured-output model (STRUCTURED_VISION_MODELS); a registry test pins it.
@@ -1078,8 +1183,8 @@ export const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {
1078
1183
  "qa-check": "gemini-3.6-flash",
1079
1184
  "generate-script": "gemini-3.6-flash",
1080
1185
  "translate": "gemini-3.6-flash",
1081
- "image-critic": "claude-sonnet-4.6",
1082
- "pick-best-llm": "claude-sonnet-4.6",
1186
+ "image-critic": "claude-sonnet-5.5",
1187
+ "pick-best-llm": "claude-sonnet-5.5",
1083
1188
  "workflow-copilot": "claude-sonnet-5",
1084
1189
  // Both economy on purpose — measured: ten ideas in Hebrew took ~1 min here
1085
1190
  // and ~3.5 min (two calls) on claude-sonnet-4.6. The private plugin keeps
@@ -1088,6 +1193,21 @@ export const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {
1088
1193
  "content-ideas": "gemini-3.6-flash",
1089
1194
  }
1090
1195
 
1196
+ /**
1197
+ * The model describe-to-picker re-asks ONCE when a Claude analyzer could not
1198
+ * answer for a platform-side reason: its direct lane down or the platform's
1199
+ * account refused, and the KIE retry of the same Claude model failing too,
1200
+ * answering with nothing valid, or answering empty. KIE's Claude endpoint
1201
+ * drops images when tools are sent, so that retry is the weak leg; see
1202
+ * backend/src/lib/llm/kie-lane.ts.
1203
+ *
1204
+ * Gemini because a Claude outage does not touch it: another vendor, on its
1205
+ * own lanes. Must stay an image-capable structured-output model
1206
+ * (STRUCTURED_VISION_MODELS — a registry test pins it); the route charges an
1207
+ * answer from it at this model's own credit price.
1208
+ */
1209
+ export const DESCRIBE_TO_PICKER_FALLBACK_MODEL = "gemini-3.8-flash"
1210
+
1091
1211
  /**
1092
1212
  * Feature → the reasoning effort its DEFAULT model runs at when the caller
1093
1213
  * sends none. Read it through {@link defaultReasoningEffort}, never directly:
@@ -1152,6 +1272,12 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1152
1272
  // with that VA-side decision.
1153
1273
  "gemini-3.8-flash": { image: true, video: false, audio: false },
1154
1274
  "gemini-3.1-pro": { image: true, video: true, audio: true },
1275
+ // gemini-4-argon is IMAGE-ONLY by DECISION, not omission (decided 2026-10-17):
1276
+ // the model DOES read video and audio, but full caps would
1277
+ // auto-enroll it in VIDEO_ANALYSIS_LLM_MODELS (derived below) and force a
1278
+ // video-analysis tier + pricing decision. That waits on a Video Analysis
1279
+ // bake-off; flip these two flags ONLY together with its outcome.
1280
+ "gemini-4-argon": { image: true, video: false, audio: false },
1155
1281
  "claude-haiku-4.5": { image: true, video: false, audio: false },
1156
1282
  "claude-haiku-5.5": { image: true, video: false, audio: false },
1157
1283
  "claude-sonnet-4.6": { image: true, video: false, audio: false },
@@ -1199,6 +1325,15 @@ function dashAliasToCanonical(id: string): string {
1199
1325
  return id.replace(/-(\d+)-(\d+)$/, "-$1.$2")
1200
1326
  }
1201
1327
 
1328
+ /**
1329
+ * Retired provider slugs that still name a registered model — a model whose KIE
1330
+ * lane moved to another model's endpoint (`kieServedAs`) no longer carries its
1331
+ * old slug, but stored configs and job rows may.
1332
+ */
1333
+ const LEGACY_PROVIDER_SLUGS: Readonly<Record<string, string>> = {
1334
+ "gemini-3-7-flash-openai": "gemini-3.7-flash",
1335
+ }
1336
+
1202
1337
  export function getLlmModel(id: string): LlmModelDef | undefined {
1203
1338
  const exact = LLM_MODELS.find((m) => m.id === id)
1204
1339
  if (exact) return exact
@@ -1207,11 +1342,18 @@ export function getLlmModel(id: string): LlmModelDef | undefined {
1207
1342
  const aliased = LLM_MODELS.find((m) => m.id === canonical)
1208
1343
  if (aliased) return aliased
1209
1344
  }
1345
+ const legacy = LEGACY_PROVIDER_SLUGS[id]
1346
+ if (legacy) return LLM_MODELS.find((m) => m.id === legacy)
1210
1347
  // Last resort: provider slugs double as historical aliases (e.g. the
1211
1348
  // dated Anthropic slugs, the `-preview`-suffixed Google ids) — accept any
1212
- // model whose slug matches exactly, on either lane.
1349
+ // model whose slug matches exactly, on either lane. A KIE slug borrowed
1350
+ // through `kieServedAs` belongs to the model that answers it, so the
1351
+ // borrower never matches on it — whatever the registry order.
1213
1352
  return LLM_MODELS.find(
1214
- (m) => m.kieSlugOrModel === id || m.directFallbackModel === id || m.directGeminiModel === id,
1353
+ (m) =>
1354
+ (m.kieSlugOrModel === id && !m.kieServedAs) ||
1355
+ m.directFallbackModel === id ||
1356
+ m.directGeminiModel === id,
1215
1357
  )
1216
1358
  }
1217
1359
 
@@ -1342,9 +1484,10 @@ export const ADVANCED_MODE_UNAVAILABLE_REASON =
1342
1484
  * Is this call served on the vendor's own API — and therefore billed as such?
1343
1485
  *
1344
1486
  * The rule (decided 2026-10-08): a call is priced on the lane it runs on.
1345
- * It runs direct when Advanced mode is on, or when it carries a reasoning
1346
- * effort on a model whose effort only works there (`effortRequiresDirect` —
1347
- * the Claude family). Everything else runs on the aggregator at its price,
1487
+ * It runs direct when Advanced mode is on, when the model is served nowhere
1488
+ * else (`directOnly`), or when it carries a reasoning effort on a model whose
1489
+ * effort only works there (`effortRequiresDirect` — the Claude family).
1490
+ * Everything else runs on the aggregator at its price,
1348
1491
  * falling back to the vendor's API only if the aggregator fails (at no extra
1349
1492
  * charge).
1350
1493
  *
@@ -1358,7 +1501,7 @@ export function llmServesDirect(
1358
1501
  advancedMode?: boolean,
1359
1502
  ): boolean {
1360
1503
  if (!supportsAdvancedMode(modelId)) return false
1361
- if (advancedMode) return true
1504
+ if (advancedMode || getLlmModel(modelId!)?.directOnly) return true
1362
1505
  return Boolean(
1363
1506
  getLlmModel(modelId!)?.effortRequiresDirect && effectiveReasoningEffort(modelId, reasoningEffort) !== undefined,
1364
1507
  )
@@ -1390,18 +1533,28 @@ export function buildLlmCreditIdentifier(
1390
1533
  advancedMode?: boolean,
1391
1534
  ): string {
1392
1535
  if (!modelId) return feature
1536
+ return llmCreditIdForRung(feature, llmCreditRung(modelId, reasoningEffort, advancedMode))
1537
+ }
1538
+
1539
+ /**
1540
+ * The rung a call on `modelId` bills on — the half of
1541
+ * {@link buildLlmCreditIdentifier} a feature with its own id shape reads (the
1542
+ * social scrapers' per-post analysis), so its rung cannot drift from the LLM
1543
+ * features'.
1544
+ */
1545
+ export function llmCreditRung(modelId: string, reasoningEffort?: string, advancedMode?: boolean): LlmCreditRung {
1393
1546
  let tier = getLlmTier(modelId)
1394
1547
  const eff = effectiveReasoningEffort(modelId, reasoningEffort)
1395
1548
  if (eff !== undefined && EFFORT_TIER_BUMP.has(eff)) tier = bumpTier(tier)
1396
- // A call served on the vendor's own API (Advanced mode, or an effort on a
1397
- // model whose effort only works there — llmServesDirect) bills materially
1398
- // more per token than the aggregator. It bumps INDEPENDENTLY of the effort
1399
- // bump — the two are separate cost levers and genuinely stack, so a
1400
- // max-effort advanced economy call lands at premium — and on the four-rung
1401
- // ladder, so a premium model served direct lands at `premium-direct`. A stale
1402
- // flag on a model with no direct lane never inflates a bill.
1403
- const rung: LlmCreditRung = llmServesDirect(modelId, reasoningEffort, advancedMode) ? bumpToDirectRung(tier) : tier
1404
- return llmCreditIdForRung(feature, rung)
1549
+ // A call served on the vendor's own API (Advanced mode, a directOnly model,
1550
+ // or an effort on a model whose effort only works there — llmServesDirect)
1551
+ // bills materially more per token than the aggregator. It bumps
1552
+ // INDEPENDENTLY of the effort bump — the two are separate cost levers and
1553
+ // genuinely stack, so a max-effort advanced economy call lands at premium —
1554
+ // and on the four-rung ladder, so a premium model served direct lands at
1555
+ // `premium-direct`. A stale flag on a model with no direct lane never
1556
+ // inflates a bill.
1557
+ return llmServesDirect(modelId, reasoningEffort, advancedMode) ? bumpToDirectRung(tier) : tier
1405
1558
  }
1406
1559
 
1407
1560
  /** One rung up the four-rung ladder — the direct-lane bump. */
@@ -18,7 +18,7 @@
18
18
  * can never land outside the tier set — an identifier missing from
19
19
  * `model_pricing` is a 503 `price_not_configured`, never a silent fallback.
20
20
  */
21
- import { LLM_FEATURE_DEFAULTS, getLlmTier } from "./llm-models.js"
21
+ import { LLM_CREDIT_RUNGS, LLM_FEATURE_DEFAULTS, llmCreditRung } from "./llm-models.js"
22
22
 
23
23
  export const META_ADS_SCRAPE_NODE_TYPE = "meta-ads-scrape" as const
24
24
 
@@ -197,14 +197,22 @@ export type MetaAdsScrapeTier = (typeof META_ADS_SCRAPE_TIERS)[number]
197
197
  * meta-ads-scrape:<tier>:analysis tier × (1 + 3) standard models
198
198
  * meta-ads-scrape:<tier>:analysis:economy tier × (1 + 1)
199
199
  * meta-ads-scrape:<tier>:analysis:premium tier × (1 + 4)
200
+ * meta-ads-scrape:<tier>:analysis:premium-direct tier × (1 + 10)
200
201
  *
201
- * The per-ad SKUs (`meta-ads-analysis[:economy|:premium]`) price the
202
- * SETTLEMENT: a run commits tier + per-ad × ads actually analysed and
203
- * refunds the rest (an ad the model failed on, or one the deadline skipped).
202
+ * The per-ad SKUs (`meta-ads-analysis[:economy|:premium|:premium-direct]`)
203
+ * price the SETTLEMENT: a run commits tier + per-ad × ads actually analysed
204
+ * and refunds the rest (an ad the model failed on, or one the deadline skipped).
205
+ *
206
+ * The tiers are the LLM credit rungs, read through `llmCreditRung` exactly as
207
+ * the LLM features read them: a model served on its vendor's own API (today
208
+ * only a `directOnly` one — the routes send no effort and no Advanced flag)
209
+ * moves one rung up, so a premium one bills `premium-direct`. Its per-ad price
210
+ * is the premium one × the LLM direct multiplier, rounded up — the rule every
211
+ * LLM feature's direct rung follows (held to it by a backend billing test).
204
212
  */
205
- export const META_ADS_ANALYSIS_TIERS = ["economy", "standard", "premium"] as const
213
+ export const META_ADS_ANALYSIS_TIERS = LLM_CREDIT_RUNGS
206
214
  export type MetaAdsAnalysisTier = (typeof META_ADS_ANALYSIS_TIERS)[number]
207
- export const META_ADS_ANALYSIS_CREDITS_PER_AD: Record<MetaAdsAnalysisTier, number> = { economy: 1, standard: 3, premium: 4 }
215
+ export const META_ADS_ANALYSIS_CREDITS_PER_AD: Record<MetaAdsAnalysisTier, number> = { economy: 1, standard: 3, premium: 4, "premium-direct": 10 }
208
216
  export const META_ADS_ANALYSIS_CREDIT_ID = "meta-ads-analysis" as const
209
217
  /** The user's optional analyst focus, appended to the fixed prompt. */
210
218
  export const META_ADS_ANALYSIS_FOCUS_MAX = 500
@@ -214,10 +222,10 @@ export function metaAdsAnalysisCreditId(tier: MetaAdsAnalysisTier): string {
214
222
  return tier === "standard" ? META_ADS_ANALYSIS_CREDIT_ID : `${META_ADS_ANALYSIS_CREDIT_ID}:${tier}`
215
223
  }
216
224
 
217
- /** The analysing model's tier; an absent model is the feature default. */
225
+ /** The analysing model's credit rung; an absent model is the feature default. */
218
226
  export function metaAdsAnalysisTier(modelId?: unknown): MetaAdsAnalysisTier {
219
227
  const id = typeof modelId === "string" && modelId ? modelId : LLM_FEATURE_DEFAULTS["meta-ads-analysis"]
220
- return getLlmTier(id)
228
+ return llmCreditRung(id)
221
229
  }
222
230
 
223
231
  /** What one analysed ad carries (`ad.analysis`); fixed fields + string lists only — never a map (Gemini via KIE drops map fields). */