@nodaro/shared 3.33.0 → 3.36.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 (266) hide show
  1. package/dist/{chunk-CK3GK34R.js → chunk-2HIDE3QV.js} +9 -3
  2. package/dist/chunk-2HIDE3QV.js.map +1 -0
  3. package/dist/{chunk-WDIBOWAA.js → chunk-2HVFF5SS.js} +6 -6
  4. package/dist/chunk-2HVFF5SS.js.map +1 -0
  5. package/dist/{chunk-PVJBAPYJ.js → chunk-56VQ7V3V.js} +8 -5
  6. package/dist/chunk-56VQ7V3V.js.map +1 -0
  7. package/dist/{chunk-Z2OL5AJD.cjs → chunk-6F6GGX2W.cjs} +4 -3
  8. package/dist/chunk-6F6GGX2W.cjs.map +1 -0
  9. package/dist/{chunk-HKFMXNVQ.cjs → chunk-75ZMA34U.cjs} +11 -11
  10. package/dist/{chunk-HKFMXNVQ.cjs.map → chunk-75ZMA34U.cjs.map} +1 -1
  11. package/dist/{chunk-6WZ2VN7V.js → chunk-7AB3AE5L.js} +6 -6
  12. package/dist/{chunk-6WZ2VN7V.js.map → chunk-7AB3AE5L.js.map} +1 -1
  13. package/dist/{chunk-VXPLKQWY.cjs → chunk-7VQPHLZ5.cjs} +30 -40
  14. package/dist/chunk-7VQPHLZ5.cjs.map +1 -0
  15. package/dist/{chunk-BG5D5CZ6.js → chunk-ANOQWAMU.js} +23 -6
  16. package/dist/chunk-ANOQWAMU.js.map +1 -0
  17. package/dist/{chunk-PRYE7AZQ.cjs → chunk-AWWOQH46.cjs} +7 -7
  18. package/dist/chunk-AWWOQH46.cjs.map +1 -0
  19. package/dist/{chunk-PXFQVLBX.js → chunk-AXUW64ZY.js} +26 -36
  20. package/dist/chunk-AXUW64ZY.js.map +1 -0
  21. package/dist/{chunk-FT5CF6IA.js → chunk-AZBIXGM5.js} +3 -3
  22. package/dist/{chunk-FT5CF6IA.js.map → chunk-AZBIXGM5.js.map} +1 -1
  23. package/dist/{chunk-D6GNRSCV.cjs → chunk-BBLE4UTG.cjs} +23 -6
  24. package/dist/chunk-BBLE4UTG.cjs.map +1 -0
  25. package/dist/{chunk-HUR6ZJ7S.cjs → chunk-BSQCKTXH.cjs} +6 -6
  26. package/dist/{chunk-HUR6ZJ7S.cjs.map → chunk-BSQCKTXH.cjs.map} +1 -1
  27. package/dist/{chunk-HGC5JNVA.cjs → chunk-BVVKMQKR.cjs} +9 -2
  28. package/dist/chunk-BVVKMQKR.cjs.map +1 -0
  29. package/dist/{chunk-SAW5OK36.cjs → chunk-BYP62B7F.cjs} +6 -6
  30. package/dist/{chunk-SAW5OK36.cjs.map → chunk-BYP62B7F.cjs.map} +1 -1
  31. package/dist/{chunk-YYV35XOS.js → chunk-C4R7BTBQ.js} +4 -3
  32. package/dist/chunk-C4R7BTBQ.js.map +1 -0
  33. package/dist/{chunk-UCFWI6D4.js → chunk-CMH2ACOX.js} +3 -3
  34. package/dist/{chunk-UCFWI6D4.js.map → chunk-CMH2ACOX.js.map} +1 -1
  35. package/dist/{chunk-WD6HJRBG.cjs → chunk-DE3PEIIP.cjs} +21 -21
  36. package/dist/{chunk-WD6HJRBG.cjs.map → chunk-DE3PEIIP.cjs.map} +1 -1
  37. package/dist/{chunk-SFW3UB2P.js → chunk-DKTRVOU5.js} +4 -4
  38. package/dist/{chunk-SFW3UB2P.js.map → chunk-DKTRVOU5.js.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-OZSACQ2V.js → chunk-GW54ANCH.js} +3 -3
  44. package/dist/{chunk-OZSACQ2V.js.map → chunk-GW54ANCH.js.map} +1 -1
  45. package/dist/chunk-GZH2SIOF.cjs +99 -0
  46. package/dist/chunk-GZH2SIOF.cjs.map +1 -0
  47. package/dist/{chunk-M7GQBRZU.cjs → chunk-HABDAHZR.cjs} +153 -24
  48. package/dist/chunk-HABDAHZR.cjs.map +1 -0
  49. package/dist/{chunk-CUH22J4D.js → chunk-IIGKJYWL.js} +3 -3
  50. package/dist/{chunk-CUH22J4D.js.map → chunk-IIGKJYWL.js.map} +1 -1
  51. package/dist/{chunk-JL4C5VJ7.cjs → chunk-J65CAOUV.cjs} +14 -2
  52. package/dist/chunk-J65CAOUV.cjs.map +1 -0
  53. package/dist/{chunk-HRXEZ3SX.cjs → chunk-JABZNRXL.cjs} +4 -4
  54. package/dist/{chunk-HRXEZ3SX.cjs.map → chunk-JABZNRXL.cjs.map} +1 -1
  55. package/dist/{chunk-5RYLK3MQ.js → chunk-JMUHMLJP.js} +11 -6
  56. package/dist/chunk-JMUHMLJP.js.map +1 -0
  57. package/dist/{chunk-K3LLGRK7.cjs → chunk-KOP7UTQR.cjs} +72 -15
  58. package/dist/chunk-KOP7UTQR.cjs.map +1 -0
  59. package/dist/{chunk-HC7VKIV5.cjs → chunk-LT5IJO4Y.cjs} +49 -46
  60. package/dist/chunk-LT5IJO4Y.cjs.map +1 -0
  61. package/dist/{chunk-VA42637J.cjs → chunk-MSDECC3A.cjs} +46 -41
  62. package/dist/chunk-MSDECC3A.cjs.map +1 -0
  63. package/dist/{chunk-JFS3NWZ5.cjs → chunk-MSIIC6MY.cjs} +7 -4
  64. package/dist/chunk-MSIIC6MY.cjs.map +1 -0
  65. package/dist/{chunk-D26ENTN2.cjs → chunk-NITAUX3A.cjs} +80 -52
  66. package/dist/chunk-NITAUX3A.cjs.map +1 -0
  67. package/dist/{chunk-23FJQTEA.js → chunk-NTHRTRQK.js} +38 -15
  68. package/dist/chunk-NTHRTRQK.js.map +1 -0
  69. package/dist/{chunk-OTATNBMD.js → chunk-NYMOHNYV.js} +3 -3
  70. package/dist/{chunk-OTATNBMD.js.map → chunk-NYMOHNYV.js.map} +1 -1
  71. package/dist/{chunk-PQHS255G.js → chunk-OHSIVNJO.js} +3 -3
  72. package/dist/chunk-OHSIVNJO.js.map +1 -0
  73. package/dist/{chunk-7Z5LUTGU.js → chunk-QXTCIJP5.js} +6 -3
  74. package/dist/{chunk-JFS3NWZ5.cjs.map → chunk-QXTCIJP5.js.map} +1 -1
  75. package/dist/{chunk-5PC6JBGJ.cjs → chunk-R2VF5NQG.cjs} +3 -3
  76. package/dist/chunk-R2VF5NQG.cjs.map +1 -0
  77. package/dist/{chunk-UTQSSKSG.js → chunk-SPP6HQMM.js} +4 -4
  78. package/dist/{chunk-UTQSSKSG.js.map → chunk-SPP6HQMM.js.map} +1 -1
  79. package/dist/chunk-TCBHVIMD.js +89 -0
  80. package/dist/chunk-TCBHVIMD.js.map +1 -0
  81. package/dist/{chunk-SES6GDBQ.cjs → chunk-UJJUX6NW.cjs} +59 -8
  82. package/dist/chunk-UJJUX6NW.cjs.map +1 -0
  83. package/dist/{chunk-ZRL2UFTH.cjs → chunk-V3N56Z2S.cjs} +101 -22
  84. package/dist/chunk-V3N56Z2S.cjs.map +1 -0
  85. package/dist/{chunk-PHZ23DP3.js → chunk-VRLRPGO7.js} +125 -12
  86. package/dist/chunk-VRLRPGO7.js.map +1 -0
  87. package/dist/{chunk-WKOIGLQX.cjs → chunk-VRUN5TG2.cjs} +8 -8
  88. package/dist/{chunk-WKOIGLQX.cjs.map → chunk-VRUN5TG2.cjs.map} +1 -1
  89. package/dist/{chunk-QA3MVQ32.js → chunk-W4GABGRD.js} +6 -6
  90. package/dist/chunk-W4GABGRD.js.map +1 -0
  91. package/dist/{chunk-M36G6SRP.js → chunk-WXNQMJ67.js} +14 -3
  92. package/dist/chunk-WXNQMJ67.js.map +1 -0
  93. package/dist/chunk-XJ3HJSO5.cjs +25 -0
  94. package/dist/chunk-XJ3HJSO5.cjs.map +1 -0
  95. package/dist/{chunk-XGFTL5XY.js → chunk-YHCG3HOR.js} +3 -3
  96. package/dist/{chunk-XGFTL5XY.js.map → chunk-YHCG3HOR.js.map} +1 -1
  97. package/dist/{chunk-VNQRI2RO.cjs → chunk-YN6AXDN5.cjs} +16 -16
  98. package/dist/{chunk-VNQRI2RO.cjs.map → chunk-YN6AXDN5.cjs.map} +1 -1
  99. package/dist/{chunk-2NQLSLSN.cjs → chunk-YNJ44IAL.cjs} +5 -5
  100. package/dist/{chunk-2NQLSLSN.cjs.map → chunk-YNJ44IAL.cjs.map} +1 -1
  101. package/dist/{chunk-ZL7UM6PU.cjs → chunk-YSEM7JDE.cjs} +4 -4
  102. package/dist/{chunk-ZL7UM6PU.cjs.map → chunk-YSEM7JDE.cjs.map} +1 -1
  103. package/dist/{chunk-ZO5PBBFX.js → chunk-ZG4XSEZV.js} +72 -15
  104. package/dist/chunk-ZG4XSEZV.js.map +1 -0
  105. package/dist/entries/apps.cjs +43 -42
  106. package/dist/entries/apps.d.cts +2 -2
  107. package/dist/entries/apps.d.ts +2 -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 +153 -153
  112. package/dist/entries/credits.d.cts +1 -1
  113. package/dist/entries/credits.d.ts +1 -1
  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 +66 -66
  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 +8 -4
  149. package/dist/entries/pipeline.d.ts +8 -4
  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 +7 -18
  165. package/dist/entries/workflow.d.ts +7 -18
  166. package/dist/entries/workflow.js +2 -1
  167. package/dist/index.cjs +1708 -1567
  168. package/dist/index.d.cts +9 -9
  169. package/dist/index.d.ts +9 -9
  170. package/dist/index.js +26 -25
  171. package/dist/{model-catalog-V-ZNzRSd.d.ts → model-catalog-I48SvalA.d.cts} +25 -0
  172. package/dist/{model-catalog-V-ZNzRSd.d.cts → model-catalog-I48SvalA.d.ts} +25 -0
  173. package/dist/{presentation-utils-D0kxsWf9.d.cts → presentation-utils-A4i92SYo.d.cts} +1 -1
  174. package/dist/{presentation-utils-pZwlEAzo.d.ts → presentation-utils-DjdPtM9k.d.ts} +1 -1
  175. package/dist/{scene-node-types-C3kl_zyK.d.ts → scene-node-types-Cvbtf-0a.d.cts} +147 -6
  176. package/dist/{scene-node-types-C3kl_zyK.d.cts → scene-node-types-Cvbtf-0a.d.ts} +147 -6
  177. package/dist/{types-DffyGSy5.d.cts → types-CU6SQnMS.d.cts} +0 -5
  178. package/dist/{types-DffyGSy5.d.ts → types-CU6SQnMS.d.ts} +0 -5
  179. package/dist/{types-BRlFPEru.d.ts → types-DzUBR7yr.d.cts} +8 -1
  180. package/dist/{types-BRlFPEru.d.cts → 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__/node-preset-extract.test.ts +10 -0
  192. package/src/__tests__/preview-gate-use-case.test.ts +16 -1
  193. package/src/__tests__/producer-types.test.ts +19 -0
  194. package/src/__tests__/run-continuation.test.ts +4 -1
  195. package/src/__tests__/speaker-map-contract.test.ts +48 -0
  196. package/src/__tests__/unit-contract-compose.test.ts +129 -0
  197. package/src/__tests__/unit-contracts.test.ts +134 -0
  198. package/src/__tests__/use-case-types.test.ts +33 -0
  199. package/src/__tests__/video-catalog-totality.test.ts +15 -1
  200. package/src/__tests__/video-collapse-parity.test.ts +10 -0
  201. package/src/__tests__/video-frame-slot.test.ts +85 -0
  202. package/src/__tests__/video-mode-aliases.test.ts +1 -0
  203. package/src/__tests__/video-reference-only.test.ts +117 -0
  204. package/src/__tests__/vidu-q4-catalog.test.ts +230 -0
  205. package/src/camera-switch-contract.ts +36 -2
  206. package/src/credit-identifiers.ts +19 -6
  207. package/src/entity-asset-types.ts +13 -0
  208. package/src/entries/edl.ts +2 -0
  209. package/src/entries/llm-models.ts +5 -0
  210. package/src/entries/media.ts +1 -0
  211. package/src/entries/models.ts +25 -0
  212. package/src/entries/nodes.ts +5 -1
  213. package/src/fan-out-rows.ts +36 -3
  214. package/src/generate-mask.ts +40 -0
  215. package/src/generated/unit-contracts.ts +58 -0
  216. package/src/i18n/types.ts +13 -2
  217. package/src/json-kinds.ts +24 -4
  218. package/src/llm-models.ts +184 -31
  219. package/src/meta-ads-scrape.ts +16 -8
  220. package/src/model-catalog.ts +91 -13
  221. package/src/model-constants.ts +260 -5
  222. package/src/node-default-mappings.ts +3 -0
  223. package/src/node-preset-extract.ts +8 -0
  224. package/src/pipeline-types.ts +3 -0
  225. package/src/presentation-utils.ts +12 -12
  226. package/src/preview-gate.ts +4 -2
  227. package/src/producer-types.ts +19 -19
  228. package/src/run-continuation.ts +26 -4
  229. package/src/speaker-layouts.ts +8 -3
  230. package/src/speaker-map-contract.ts +77 -0
  231. package/src/unit-contract-compose.ts +55 -0
  232. package/src/use-case-types.ts +19 -0
  233. package/src/video-ui-defaults.ts +7 -5
  234. package/dist/chunk-23FJQTEA.js.map +0 -1
  235. package/dist/chunk-5PC6JBGJ.cjs.map +0 -1
  236. package/dist/chunk-5RYLK3MQ.js.map +0 -1
  237. package/dist/chunk-7Z5LUTGU.js.map +0 -1
  238. package/dist/chunk-BG5D5CZ6.js.map +0 -1
  239. package/dist/chunk-CK3GK34R.js.map +0 -1
  240. package/dist/chunk-D26ENTN2.cjs.map +0 -1
  241. package/dist/chunk-D6GNRSCV.cjs.map +0 -1
  242. package/dist/chunk-HC7VKIV5.cjs.map +0 -1
  243. package/dist/chunk-HGC5JNVA.cjs.map +0 -1
  244. package/dist/chunk-JL4C5VJ7.cjs.map +0 -1
  245. package/dist/chunk-K3LLGRK7.cjs.map +0 -1
  246. package/dist/chunk-M36G6SRP.js.map +0 -1
  247. package/dist/chunk-M7GQBRZU.cjs.map +0 -1
  248. package/dist/chunk-PHZ23DP3.js.map +0 -1
  249. package/dist/chunk-PQHS255G.js.map +0 -1
  250. package/dist/chunk-PRYE7AZQ.cjs.map +0 -1
  251. package/dist/chunk-PVJBAPYJ.js.map +0 -1
  252. package/dist/chunk-PXFQVLBX.js.map +0 -1
  253. package/dist/chunk-QA3MVQ32.js.map +0 -1
  254. package/dist/chunk-SES6GDBQ.cjs.map +0 -1
  255. package/dist/chunk-TU33KYKW.cjs +0 -25
  256. package/dist/chunk-TU33KYKW.cjs.map +0 -1
  257. package/dist/chunk-VA42637J.cjs.map +0 -1
  258. package/dist/chunk-VXPLKQWY.cjs.map +0 -1
  259. package/dist/chunk-WDIBOWAA.js.map +0 -1
  260. package/dist/chunk-YBPBK5KI.js.map +0 -1
  261. package/dist/chunk-YYV35XOS.js.map +0 -1
  262. package/dist/chunk-Z2OL5AJD.cjs.map +0 -1
  263. package/dist/chunk-ZDFHA2EC.js.map +0 -1
  264. package/dist/chunk-ZO5PBBFX.js.map +0 -1
  265. package/dist/chunk-ZRL2UFTH.cjs.map +0 -1
  266. package/src/__tests__/__snapshots__/prompt-builder-segments.test.ts.snap +0 -65
@@ -2,6 +2,7 @@ import {
2
2
  LLM_MODELS,
3
3
  LLM_MODEL_IDS,
4
4
  LLM_FEATURE_DEFAULTS,
5
+ DESCRIBE_TO_PICKER_FALLBACK_MODEL,
5
6
  LLM_FEATURE_DEFAULT_EFFORTS,
6
7
  defaultReasoningEffort,
7
8
  STRUCTURED_VISION_MODELS,
@@ -20,6 +21,9 @@ import {
20
21
  LLM_VENDOR_LABELS,
21
22
  groupLlmModelsByVendor,
22
23
  orderedLlmModels,
24
+ PICKABLE_LLM_MODELS,
25
+ pickableLlmModels,
26
+ isLlmModelRetired,
23
27
  REASONING_OUTPUT_FLOOR,
24
28
  reasoningOutputFloor,
25
29
  llmServesDirect,
@@ -48,6 +52,7 @@ const EXPECTED_MODEL_IDS = [
48
52
  "claude-sonnet-4.6",
49
53
  "gpt-5.2",
50
54
  "gemini-3.1-pro",
55
+ "gemini-4-argon",
51
56
  "claude-opus-4.7",
52
57
  "gpt-5.4",
53
58
  "gpt-5.5",
@@ -112,14 +117,14 @@ describe("LLM_MODELS data integrity", () => {
112
117
  expect(new Set(ids).size).toBe(ids.length)
113
118
  })
114
119
 
115
- it("has 8 economy, 7 standard, 13 premium models", () => {
120
+ it("has 9 economy, 7 standard, 14 premium models", () => {
116
121
  const tierCounts: Record<LlmTier, number> = { economy: 0, standard: 0, premium: 0 }
117
122
  for (const model of LLM_MODELS) {
118
123
  tierCounts[model.tier]++
119
124
  }
120
125
  expect(tierCounts.economy).toBe(9)
121
126
  expect(tierCounts.standard).toBe(7)
122
- expect(tierCounts.premium).toBe(13)
127
+ expect(tierCounts.premium).toBe(14)
123
128
  })
124
129
 
125
130
  it("all three kieFormats are represented", () => {
@@ -452,11 +457,24 @@ describe("LLM_FEATURE_DEFAULTS", () => {
452
457
  expect(getLlmTier(LLM_FEATURE_DEFAULTS["prompt-helper"])).toBe("economy")
453
458
  })
454
459
 
455
- it('"ai-writer" defaults to "claude-sonnet-4.6" (standard)', () => {
456
- expect(LLM_FEATURE_DEFAULTS["ai-writer"]).toBe("claude-sonnet-4.6")
460
+ it('"ai-writer" defaults to "claude-sonnet-5.5" (standard)', () => {
461
+ expect(LLM_FEATURE_DEFAULTS["ai-writer"]).toBe("claude-sonnet-5.5")
457
462
  expect(getLlmTier(LLM_FEATURE_DEFAULTS["ai-writer"])).toBe("standard")
458
463
  })
459
464
 
465
+ // Decided 2026-10-16: no feature defaults to Sonnet 4.6 any more (it stays
466
+ // pickable). The move keeps the standard tier, so no feature's credit rung
467
+ // changed: a default call with no effort still bills the bare feature id.
468
+ it("no feature defaults to claude-sonnet-4.6; the Sonnet 5.5 defaults bill the same rung", () => {
469
+ expect(Object.values(LLM_FEATURE_DEFAULTS)).not.toContain("claude-sonnet-4.6")
470
+ expect(getLlmModel("claude-sonnet-4.6")).toBeDefined()
471
+ for (const [feature, model] of Object.entries(LLM_FEATURE_DEFAULTS)) {
472
+ if (model !== "claude-sonnet-5.5") continue
473
+ expect(buildLlmCreditIdentifier(feature, model), feature).toBe(buildLlmCreditIdentifier(feature, "claude-sonnet-4.6"))
474
+ expect(buildLlmCreditIdentifier(feature, model), feature).toBe(feature)
475
+ }
476
+ })
477
+
460
478
  it('"describe-to-picker" defaults to "claude-opus-5.5" (premium vision)', () => {
461
479
  expect(LLM_FEATURE_DEFAULTS["describe-to-picker"]).toBe("claude-opus-5.5")
462
480
  expect(getLlmTier(LLM_FEATURE_DEFAULTS["describe-to-picker"])).toBe("premium")
@@ -464,6 +482,13 @@ describe("LLM_FEATURE_DEFAULTS", () => {
464
482
  expect(STRUCTURED_VISION_MODELS.map((m) => m.id)).toContain("claude-opus-5.5")
465
483
  })
466
484
 
485
+ it("the describe-to-picker fallback is an accepted analyzer from another vendor, billed on the cheapest rung", () => {
486
+ expect(DESCRIBE_TO_PICKER_FALLBACK_MODEL).toBe("gemini-3.8-flash")
487
+ expect(STRUCTURED_VISION_MODELS.map((m) => m.id)).toContain(DESCRIBE_TO_PICKER_FALLBACK_MODEL)
488
+ expect(getLlmModel(DESCRIBE_TO_PICKER_FALLBACK_MODEL)?.vendor).not.toBe("anthropic")
489
+ expect(buildLlmCreditIdentifier("describe-to-picker", DESCRIBE_TO_PICKER_FALLBACK_MODEL)).toBe("describe-to-picker:economy")
490
+ })
491
+
467
492
  it('"generate-script" defaults to "gemini-3.6-flash" (economy)', () => {
468
493
  expect(LLM_FEATURE_DEFAULTS["generate-script"]).toBe("gemini-3.6-flash")
469
494
  })
@@ -477,7 +502,7 @@ describe("LLM_FEATURE_DEFAULTS", () => {
477
502
  expect(LLM_FEATURE_DEFAULTS["translate"]).toBe("gemini-3.6-flash")
478
503
  })
479
504
 
480
- it("composition features default to claude-sonnet-4.6", () => {
505
+ it("composition features default to claude-sonnet-5.5", () => {
481
506
  const compositionFeatures: LlmFeature[] = [
482
507
  "scene-graph-ai",
483
508
  "after-effects",
@@ -487,7 +512,7 @@ describe("LLM_FEATURE_DEFAULTS", () => {
487
512
  "3d-title",
488
513
  ]
489
514
  for (const feature of compositionFeatures) {
490
- expect(LLM_FEATURE_DEFAULTS[feature]).toBe("claude-sonnet-4.6")
515
+ expect(LLM_FEATURE_DEFAULTS[feature]).toBe("claude-sonnet-5.5")
491
516
  }
492
517
  })
493
518
  })
@@ -597,6 +622,8 @@ describe("STRUCTURED_VISION_MODELS", () => {
597
622
  "claude-opus-5.5",
598
623
  "kimi-k3",
599
624
  "deepseek-v4.1-flash",
625
+ // directOnly; the direct lane enforced responseJsonSchema (2026-10-17).
626
+ "gemini-4-argon",
600
627
  ].sort(),
601
628
  )
602
629
  })
@@ -642,6 +669,7 @@ describe("reasoning effort registry", () => {
642
669
  expect(getLlmTier("gpt-5.6-sol")).toBe("premium")
643
670
  expect(getLlmTier("gpt-6-astra")).toBe("premium")
644
671
  expect(getLlmTier("gemini-3.8-flash")).toBe("economy")
672
+ expect(getLlmTier("gemini-4-argon")).toBe("premium")
645
673
  expect(getLlmTier("grok-4.6")).toBe("standard")
646
674
  expect(getLlmTier("claude-sonnet-5")).toBe("standard")
647
675
  expect(getLlmTier("claude-opus-4.8")).toBe("premium")
@@ -777,7 +805,8 @@ describe("gemini-3.7-flash exposure", () => {
777
805
  expect(m?.tier).toBe("economy")
778
806
  expect(m?.vendor).toBe("google")
779
807
  expect(m?.kieFormat).toBe("chat-completions")
780
- expect(m?.kieSlugOrModel).toBe("gemini-3-7-flash-openai")
808
+ // Its KIE lane is served by 3.8's endpoint (see the retirement block below).
809
+ expect(m?.kieSlugOrModel).toBe("gemini-3-8-flash-openai")
781
810
  // KIE-first on purpose (no preferDirect): the cheap lane serves Generate
782
811
  // Text; the direct lane is Advanced mode + the reliability fallback.
783
812
  expect(m?.preferDirect).toBeUndefined()
@@ -799,6 +828,81 @@ describe("gemini-3.7-flash exposure", () => {
799
828
  })
800
829
  })
801
830
 
831
+ // ---------------------------------------------------------------------------
832
+ // gemini-3.7-flash retirement (2026-10-19): the aggregator answers 3.7's own
833
+ // endpoint with 3.8, so the KIE lane says so explicitly, and the id leaves the
834
+ // pickers while every saved node / API call that names it keeps running.
835
+ // ---------------------------------------------------------------------------
836
+ describe("gemini-3.7-flash retirement", () => {
837
+ it("its KIE lane sends 3.8's slug and declares that 3.8 answers it", () => {
838
+ const m37 = getLlmModel("gemini-3.7-flash")
839
+ const m38 = getLlmModel("gemini-3.8-flash")
840
+ expect(m37?.kieSlugOrModel).toBe(m38?.kieSlugOrModel)
841
+ expect(m37?.kieServedAs).toBe("gemini-3.8-flash")
842
+ })
843
+
844
+ it("the direct Google lane is unchanged — real 3.7, Advanced mode included", () => {
845
+ const m = getLlmModel("gemini-3.7-flash")
846
+ expect(m?.directGeminiModel).toBe("gemini-3.7-flash")
847
+ expect(supportsAdvancedMode("gemini-3.7-flash")).toBe(true)
848
+ expect(llmServesDirect("gemini-3.7-flash", undefined, true)).toBe(true)
849
+ expect(availableReasoningEfforts("gemini-3.7-flash", true)).toEqual(["none", "low", "medium", "high"])
850
+ })
851
+
852
+ it("a lookup by 3.8's KIE slug resolves to 3.8, never to the retired id registered before it", () => {
853
+ expect(getLlmModel("gemini-3-8-flash-openai")?.id).toBe("gemini-3.8-flash")
854
+ })
855
+
856
+ it("3.7's old KIE slug still resolves to 3.7 (stored configs and job rows carry it)", () => {
857
+ expect(getLlmModel("gemini-3-7-flash-openai")?.id).toBe("gemini-3.7-flash")
858
+ })
859
+
860
+ it("is retired: still registered, accepted and resolvable, but never offered", () => {
861
+ expect(isLlmModelRetired("gemini-3.7-flash")).toBe(true)
862
+ expect(isLlmModelRetired("gemini-3.8-flash")).toBe(false)
863
+ expect(LLM_MODEL_IDS).toContain("gemini-3.7-flash")
864
+ // The structured-vision list doubles as a backend route gate.
865
+ expect(STRUCTURED_VISION_MODELS.map((m) => m.id)).toContain("gemini-3.7-flash")
866
+ expect(getLlmModel("gemini-3.7-flash")?.id).toBe("gemini-3.7-flash")
867
+ expect(PICKABLE_LLM_MODELS.map((m) => m.id)).not.toContain("gemini-3.7-flash")
868
+ expect(orderedLlmModels().map((m) => m.id)).not.toContain("gemini-3.7-flash")
869
+ expect(orderedLlmModels(STRUCTURED_VISION_MODELS).map((m) => m.id)).not.toContain("gemini-3.7-flash")
870
+ expect(groupLlmModelsByVendor(LLM_MODELS).flatMap((g) => g.models.map((m) => m.id))).not.toContain("gemini-3.7-flash")
871
+ })
872
+
873
+ it("bills exactly as before — same rung as 3.8, no credit-id change", () => {
874
+ expect(buildLlmCreditIdentifier("llm-chat", "gemini-3.7-flash")).toBe(buildLlmCreditIdentifier("llm-chat", "gemini-3.8-flash"))
875
+ })
876
+
877
+ it("a stored value keeps its slot in a picker that must show it selected", () => {
878
+ expect(pickableLlmModels("gemini-3.7-flash").map((m) => m.id)).toContain("gemini-3.7-flash")
879
+ expect(pickableLlmModels("gemini-3.8-flash").map((m) => m.id)).not.toContain("gemini-3.7-flash")
880
+ expect(pickableLlmModels().map((m) => m.id)).toEqual(PICKABLE_LLM_MODELS.map((m) => m.id))
881
+ })
882
+ })
883
+
884
+ describe("retired / KIE-redirect invariants", () => {
885
+ it("a KIE redirect names a registered, live model that owns the slug it borrows", () => {
886
+ for (const m of LLM_MODELS.filter((x) => x.kieServedAs)) {
887
+ const target = LLM_MODELS.find((x) => x.id === m.kieServedAs)
888
+ expect(target, `${m.id} → ${m.kieServedAs}`).toBeDefined()
889
+ expect(target!.kieSlugOrModel, m.id).toBe(m.kieSlugOrModel)
890
+ expect(target!.kieServedAs, m.id).toBeUndefined()
891
+ expect(target!.retired, m.id).toBeUndefined()
892
+ // Every lookup by the borrowed slug lands on its owner.
893
+ expect(getLlmModel(m.kieSlugOrModel)?.id, m.id).toBe(target!.id)
894
+ }
895
+ })
896
+
897
+ it("no default points at a retired model", () => {
898
+ const retired = new Set(LLM_MODELS.filter((m) => m.retired).map((m) => m.id))
899
+ for (const [feature, id] of Object.entries(LLM_FEATURE_DEFAULTS)) {
900
+ expect(retired.has(id), `LLM_FEATURE_DEFAULTS["${feature}"]`).toBe(false)
901
+ }
902
+ expect(retired.has(DESCRIBE_TO_PICKER_FALLBACK_MODEL)).toBe(false)
903
+ })
904
+ })
905
+
802
906
  // ---------------------------------------------------------------------------
803
907
  // gemini-3.8-flash exposure (KIE lane live-verified 2026-09-06: enforced
804
908
  // response_format json_schema, reasoning_tokens in usage, and a 20k max_tokens
@@ -847,6 +951,59 @@ describe("gemini-3.8-flash exposure", () => {
847
951
  })
848
952
  })
849
953
 
954
+ // ---------------------------------------------------------------------------
955
+ // gemini-4-argon exposure (2026-10-17: DIRECT-ONLY — its KIE lane failed the
956
+ // probe; the direct lane enforced responseJsonSchema and rejected MINIMAL)
957
+ // ---------------------------------------------------------------------------
958
+ describe("gemini-4-argon exposure", () => {
959
+ it("premium Gemini served only on Google's own API — no KIE lane, no lane preference", () => {
960
+ const m = getLlmModel("gemini-4-argon")
961
+ expect(m?.tier).toBe("premium")
962
+ expect(m?.vendor).toBe("google")
963
+ expect(m?.directGeminiModel).toBe("gemini-4-argon")
964
+ expect(m?.directOnly).toBe(true)
965
+ expect(m?.preferDirect).toBeUndefined()
966
+ // Kept for the record and a re-enable after a re-probe; nothing sends to it.
967
+ expect(m?.kieSlugOrModel).toBe("gemini-4-argon-openai")
968
+ expect(m?.structuredOutputMode).toBe("kie-response-format")
969
+ expect(m?.thinkingDefaultOn).toBe(true)
970
+ expect(supportsAdvancedMode("gemini-4-argon")).toBe(true)
971
+ })
972
+
973
+ it("offers the direct ladder on every call — never `none`, which Google 400s on this model", () => {
974
+ // Every call runs direct, so the ladder is the direct one with or without
975
+ // Advanced mode; `none` maps to MINIMAL in the direct client.
976
+ expect(availableReasoningEfforts("gemini-4-argon")).toEqual(["low", "medium", "high"])
977
+ expect(availableReasoningEfforts("gemini-4-argon", true)).toEqual(["low", "medium", "high"])
978
+ expect(getLlmModel("gemini-4-argon")?.directReasoningEfforts).toBeUndefined()
979
+ })
980
+
981
+ it("floors reasoning calls at the default 32768 — its one lane is Google's, whose cap that is", () => {
982
+ const m = getLlmModel("gemini-4-argon")!
983
+ expect(m.reasoningOutputFloor).toBeUndefined()
984
+ expect(reasoningOutputFloor(m)).toBe(REASONING_OUTPUT_FLOOR)
985
+ expect(m.maxOutputTokens).toBe(16384)
986
+ })
987
+
988
+ it("resolves by canonical id and by its KIE slug", () => {
989
+ expect(getLlmModel("gemini-4-argon")?.id).toBe("gemini-4-argon")
990
+ expect(getLlmModel("gemini-4-argon-openai")?.id).toBe("gemini-4-argon")
991
+ })
992
+
993
+ it("is the default of no feature (decided 2026-10-17)", () => {
994
+ expect(Object.values(LLM_FEATURE_DEFAULTS)).not.toContain("gemini-4-argon")
995
+ })
996
+
997
+ it("stays OUT of video-analysis — image-only modality caps by decision, not omission", () => {
998
+ // The model reads video and audio; full caps here would auto-enroll it in
999
+ // VIDEO_ANALYSIS_LLM_MODELS and force a VA tier + pricing decision that
1000
+ // waits on a Video Analysis bake-off. If this goes red, someone flipped the
1001
+ // caps — only valid TOGETHER with that decision.
1002
+ expect(getLlmModalityCaps("gemini-4-argon")).toEqual({ image: true, video: false, audio: false })
1003
+ expect(VIDEO_ANALYSIS_LLM_MODELS).not.toContain("gemini-4-argon")
1004
+ })
1005
+ })
1006
+
850
1007
  // ---------------------------------------------------------------------------
851
1008
  // gpt-6-astra exposure (KIE responses lane live-verified 2026-09-06 on the
852
1009
  // streaming path: enforced text.format json_schema with strict:true, the
@@ -961,7 +1118,9 @@ describe("buildLlmCreditIdentifier effort bump (xhigh/max only)", () => {
961
1118
  expect(buildLlmCreditIdentifier("llm-chat", "gemini-3.6-flash", "max")).toBe("llm-chat:economy")
962
1119
  })
963
1120
  it("back-compat: no effort arg → identical to today for every model", () => {
964
- for (const m of LLM_MODELS) {
1121
+ // A directOnly model runs direct on every call, so it bills its direct
1122
+ // rung even with no effort (pinned in "direct-vendor lane declarations").
1123
+ for (const m of LLM_MODELS.filter((x) => !x.directOnly)) {
965
1124
  const before = m.tier === "standard" ? "x" : `x:${m.tier}`
966
1125
  expect(buildLlmCreditIdentifier("x", m.id)).toBe(before)
967
1126
  }
@@ -972,6 +1131,27 @@ describe("buildLlmCreditIdentifier effort bump (xhigh/max only)", () => {
972
1131
  })
973
1132
 
974
1133
  describe("direct-vendor lane declarations", () => {
1134
+ it("directOnly sits on a Gemini direct lane, alone — never with preferDirect or preferKie", () => {
1135
+ // The router serves a directOnly model from `directGeminiModel` and builds
1136
+ // no KIE leg; a lane preference beside it would be dead config that reads
1137
+ // like a live fallback.
1138
+ const bad = LLM_MODELS.filter((m) => m.directOnly && (!m.directGeminiModel || m.preferDirect || m.preferKie)).map((m) => m.id)
1139
+ expect(bad).toEqual([])
1140
+ })
1141
+
1142
+ it("a directOnly model is served direct on every call — the bill follows (llmServesDirect)", () => {
1143
+ for (const m of LLM_MODELS.filter((x) => x.directOnly)) {
1144
+ for (const effort of [undefined, ...LLM_REASONING_EFFORTS]) {
1145
+ expect(llmServesDirect(m.id, effort, false), `${m.id} ${effort}`).toBe(true)
1146
+ }
1147
+ // A premium model's direct rung is premium-direct, Advanced or not.
1148
+ if (m.tier === "premium") {
1149
+ expect(buildLlmCreditIdentifier("llm-chat", m.id)).toBe("llm-chat:premium-direct")
1150
+ expect(buildLlmCreditIdentifier("llm-chat", m.id, "high", true)).toBe("llm-chat:premium-direct")
1151
+ }
1152
+ }
1153
+ })
1154
+
975
1155
  it("no model declares BOTH preferKie and preferDirect", () => {
976
1156
  // They are the two halves of one idea (which lane goes first). Declaring
977
1157
  // both is meaningless and would make routing depend on branch order in
@@ -1146,10 +1326,10 @@ describe("groupLlmModelsByVendor / orderedLlmModels", () => {
1146
1326
  }
1147
1327
  })
1148
1328
 
1149
- it("covers every model exactly once, in vendor order", () => {
1329
+ it("covers every model a picker may offer exactly once, in vendor order — retired ones never", () => {
1150
1330
  const groups = groupLlmModelsByVendor()
1151
1331
  const flattened = groups.flatMap((g) => g.models.map((m) => m.id))
1152
- expect(flattened.sort()).toEqual(LLM_MODELS.map((m) => m.id).sort())
1332
+ expect(flattened.sort()).toEqual(LLM_MODELS.filter((m) => !m.retired).map((m) => m.id).sort())
1153
1333
  expect(new Set(flattened).size).toBe(flattened.length)
1154
1334
  const groupVendors = groups.map((g) => g.vendor)
1155
1335
  expect(groupVendors).toEqual(LLM_VENDOR_ORDER.filter((v) => groupVendors.includes(v)))
@@ -1214,14 +1394,14 @@ describe("supportsForcedToolChoice / conversationBoundThinking", () => {
1214
1394
  expect(getLlmModel("grok-4.7")?.reasoningEfforts).not.toContain("none")
1215
1395
  })
1216
1396
 
1217
- // The film pipeline's callLLM (backend/src/ee/pipelines/llms/call-llm.ts) still
1218
- // sends a FORCED tool_choice on the raw Anthropic SDK, and it is reachable only
1219
- // through PIPELINE_PINNABLE_SCRIPT_LLMS. A model that 400s on forcing must not
1220
- // join that list until callLLM reads `supportsForcedToolChoice`.
1221
- it("no pipeline-pinnable script LLM rejects a forced tool choice", () => {
1222
- for (const id of PIPELINE_ACCEPTED_SCRIPT_LLMS) {
1223
- expect(getLlmModel(id)?.supportsForcedToolChoice, id).not.toBe(false)
1224
- }
1397
+ // The film pipeline's callLLM (backend/src/ee/pipelines/llms/call-llm.ts)
1398
+ // reads `supportsForcedToolChoice` and asks such a model with tool_choice auto
1399
+ // (pinned in call-llm.test.ts), so a model that 400s on forcing may be a pin.
1400
+ it("Claude Sonnet 5.5 is an offered Script LLM pin, though it refuses a forced tool choice", () => {
1401
+ expect(PIPELINE_PINNABLE_SCRIPT_LLMS).toContain("claude-sonnet-5-5")
1402
+ expect(getLlmModel("claude-sonnet-5-5")?.supportsForcedToolChoice).toBe(false)
1403
+ expect(PipelineConfigSchema.safeParse({ script_llm: "claude-sonnet-5-5" }).success).toBe(true)
1404
+ expect(PipelineConfigSchema.safeParse({ stage_models: { script_llm: "claude-sonnet-5-5" } }).success).toBe(true)
1225
1405
  })
1226
1406
 
1227
1407
  it("resolves the KIE / Anthropic dash-form ids of the new models", () => {
@@ -1249,8 +1429,8 @@ describe("llmServesDirect (decided 2026-10-08: priced on the lane it runs on)",
1249
1429
  // Haiku 5.5 has one, and KIE ignores it like every other Claude effort.
1250
1430
  expect(llmServesDirect("claude-haiku-5.5", "low")).toBe(true)
1251
1431
  })
1252
- it("no effort and no Advanced: every model runs on the aggregator", () => {
1253
- for (const m of LLM_MODELS) expect(llmServesDirect(m.id), m.id).toBe(false)
1432
+ it("no effort and no Advanced: every model runs on the aggregator — except one served nowhere else", () => {
1433
+ for (const m of LLM_MODELS) expect(llmServesDirect(m.id), m.id).toBe(m.directOnly === true)
1254
1434
  })
1255
1435
  it("every Claude model with an effort ladder declares effortRequiresDirect, and is KIE-first", () => {
1256
1436
  for (const m of LLM_MODELS.filter((x) => x.vendor === "anthropic")) {
@@ -132,6 +132,16 @@ describe("extractPresetData", () => {
132
132
  })
133
133
  })
134
134
 
135
+ describe("an audio-locked use-case node's memory is never a preset setting", () => {
136
+ it("a preset saved from an audio-locked Clip Pack or Tighten Episode carries no settingsBeforeAudio", () => {
137
+ const clipPack = extractPresetData({ label: "Clip Pack", count: 6, framing: null, captions: false, settingsBeforeAudio: { framing: { aspect: "16:9", layout: "grid" }, captions: true } }, "clip-pack")
138
+ expect(clipPack).toEqual({ count: 6, framing: null, captions: false })
139
+ const tighten = extractPresetData({ label: "T", output: "audio", captions: false, settingsBeforeAudio: { output: "video", captions: true } }, "tighten-episode")
140
+ expect(tighten).not.toHaveProperty("settingsBeforeAudio")
141
+ expect(PRESET_EXCLUDED_KEYS.has("settingsBeforeAudio")).toBe(true)
142
+ })
143
+ })
144
+
135
145
  describe("PRESET_EXCLUDED_KEYS ⊇ PRESET_APPLY_CLEAR_KEYS", () => {
136
146
  it("every clear-on-apply key is also capture-excluded (one source covers save + import + override)", () => {
137
147
  for (const k of PRESET_APPLY_CLEAR_KEYS) {
@@ -28,8 +28,11 @@ const edges = [
28
28
 
29
29
  describe("a review-on use-case node holds what follows it until its Render final", () => {
30
30
  it("is a preview-holding type without joining the render set", () => {
31
- expect([...REVIEW_HOLDING_USE_CASE_TYPES]).toEqual(["tighten-episode"])
31
+ expect(REVIEW_HOLDING_USE_CASE_TYPES.has("tighten-episode")).toBe(true)
32
32
  expect(isPreviewHoldingType("tighten-episode")).toBe(true)
33
+ expect(isPreviewHoldingType("episode-trailer")).toBe(true)
34
+ expect(isPreviewHoldingType("clip-pack")).toBe(true)
35
+ expect(PREVIEW_RENDER_NODE_TYPES.has("clip-pack")).toBe(false)
33
36
  expect(isPreviewHoldingType("apply-edl")).toBe(true)
34
37
  expect(isPreviewHoldingType("speaker-view")).toBe(true)
35
38
  expect(isPreviewHoldingType("social-media-format")).toBe(false)
@@ -60,6 +63,18 @@ describe("a review-on use-case node holds what follows it until its Render final
60
63
  expect(previewStops([rec, node, fmt, post], edges).gatedNodeIds.size).toBe(0)
61
64
  })
62
65
 
66
+ it("a review-on Trailer holds what follows it; its Render final override releases it", () => {
67
+ const tr = (data: Record<string, unknown>) => ({ id: "t1", type: "episode-trailer", data })
68
+ const held = previewStops([rec, tr({ reviewBeforeRender: true }), fmt, post], edges)
69
+ expect(held.previewRenderIds).toEqual(["t1"])
70
+ expect([...held.gatedNodeIds].sort()).toEqual(["fmt", "post"])
71
+ expect(previewStops([rec, tr({}), fmt, post], edges).gatedNodeIds.size).toBe(0)
72
+ const released = withRunOverrides([rec, tr({ reviewBeforeRender: true }), fmt, post], {
73
+ t1: { useCaseContinue: { mode: "render-final", jobId: "00000000-0000-4000-8000-000000000007" } },
74
+ })
75
+ expect(previewStops(released, edges).gatedNodeIds.size).toBe(0)
76
+ })
77
+
63
78
  it("the continuation set as a run override releases them too", () => {
64
79
  const graph = withRunOverrides([rec, t1({ reviewBeforeRender: true }), fmt, post], {
65
80
  t1: { useCaseContinue: { mode: "render-final", jobId: "job-1" } },
@@ -138,6 +138,25 @@ describe("defaultEdgeOutputMode / listResultsServeHandle", () => {
138
138
  expect(defaultEdgeOutputMode("ugc-clips", "transcript")).toBe("last")
139
139
  expect(listResultsServeHandle("ugc-clips", "plan-out")).toBe(false)
140
140
  })
141
+ it("Trailer: its deliveries (media, and no handle) are each; its plan is one value; a video producer", () => {
142
+ expect(FAN_OUT_EACH_HANDLES["episode-trailer"]).toEqual({ each: ["media"], primary: "media" })
143
+ expect(defaultEdgeOutputMode("episode-trailer", "media")).toBe("each")
144
+ expect(defaultEdgeOutputMode("episode-trailer", undefined)).toBe("each")
145
+ expect(defaultEdgeOutputMode("episode-trailer", "json")).toBe("last")
146
+ expect(listResultsServeHandle("episode-trailer", "media")).toBe(true)
147
+ expect(listResultsServeHandle("episode-trailer", "json")).toBe(false)
148
+ expect(VIDEO_PRODUCER_TYPES.has("episode-trailer")).toBe(true)
149
+ })
150
+ it("Clip Pack: its clips (clips, and no handle) are each; its plan is one value; video or audio, decided at run time", () => {
151
+ expect(FAN_OUT_EACH_HANDLES["clip-pack"]).toEqual({ each: ["clips"], primary: "clips" })
152
+ expect(defaultEdgeOutputMode("clip-pack", "clips")).toBe("each")
153
+ expect(defaultEdgeOutputMode("clip-pack", undefined)).toBe("each")
154
+ expect(defaultEdgeOutputMode("clip-pack", "json")).toBe("last")
155
+ expect(listResultsServeHandle("clip-pack", "clips")).toBe(true)
156
+ expect(listResultsServeHandle("clip-pack", "json")).toBe(false)
157
+ expect(DYNAMIC_PRODUCER_TYPES.has("clip-pack")).toBe(true)
158
+ expect(VIDEO_PRODUCER_TYPES.has("clip-pack")).toBe(false)
159
+ })
141
160
  it("only the each handles read the per-iteration results", () => {
142
161
  expect(listResultsServeHandle("camera-switch", "edl")).toBe(true)
143
162
  expect(listResultsServeHandle("camera-switch", undefined)).toBe(true)
@@ -3,6 +3,7 @@ import {
3
3
  CONTINUATION_NOT_COMPLETED,
4
4
  CONTINUATION_NOT_FAILED,
5
5
  CONTINUATION_NOT_FOUND,
6
+ CONTINUATION_PREVIEW_PENDING,
6
7
  CONTINUATION_SUBSET_REQUIRED,
7
8
  CONTINUATION_SUPERSEDED,
8
9
  CONTINUATION_VERSION_MISMATCH,
@@ -19,15 +20,17 @@ describe("run continuation refusal codes", () => {
19
20
  expect(CONTINUATION_SUBSET_REQUIRED).toBe("continuation_subset_required")
20
21
  expect(CONTINUATION_NOT_FAILED).toBe("continuation_not_failed")
21
22
  expect(CONTINUATION_SUPERSEDED).toBe("continuation_superseded")
23
+ expect(CONTINUATION_PREVIEW_PENDING).toBe("continuation_preview_pending")
22
24
  })
23
25
 
24
26
  it("lists every code once", () => {
25
- expect(new Set(RUN_CONTINUATION_CODES).size).toBe(7)
27
+ expect(new Set(RUN_CONTINUATION_CODES).size).toBe(8)
26
28
  expect([...RUN_CONTINUATION_CODES].sort()).toEqual(
27
29
  [
28
30
  CONTINUATION_NOT_COMPLETED,
29
31
  CONTINUATION_NOT_FAILED,
30
32
  CONTINUATION_NOT_FOUND,
33
+ CONTINUATION_PREVIEW_PENDING,
31
34
  CONTINUATION_SUBSET_REQUIRED,
32
35
  CONTINUATION_SUPERSEDED,
33
36
  CONTINUATION_VERSION_MISMATCH,
@@ -0,0 +1,48 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { SPEAKER_MAP_DEFAULT_MARGIN_DB, speakerMapByOrdinal, speakerMapResultOf } from "../speaker-map-contract.js"
3
+ import { transcriptSpeakerLabels } from "../camera-switch-contract.js"
4
+
5
+ const transcript = { words: [
6
+ { text: "hi", startMs: 0, endMs: 300, speaker: "speaker_1" },
7
+ { text: "yo", startMs: 400, endMs: 700, speaker: "speaker_0" },
8
+ ] }
9
+
10
+ describe("speakerMapResultOf", () => {
11
+ it("reads a result object or its JSON string; anything else is null", () => {
12
+ const r = { version: 1, speakerMap: { speaker_0: "cam-a", speaker_1: "" }, confidence: { speaker_0: { camera: "cam-a", marginDb: 6.2 }, speaker_1: { camera: "", marginDb: 0.8 } }, notes: [] }
13
+ expect(speakerMapResultOf(r)).toEqual(r)
14
+ expect(speakerMapResultOf(JSON.stringify(r))).toEqual(r)
15
+ expect(speakerMapResultOf({ speakerMap: "x" })).toBeNull()
16
+ expect(speakerMapResultOf("not json")).toBeNull()
17
+ expect(speakerMapResultOf({ version: 1, speakerMap: { a: 3 }, confidence: {}, notes: [] })).toBeNull()
18
+ })
19
+ it("every confidence entry and note must be well-typed, so a reader can trust them", () => {
20
+ const base = { version: 1, speakerMap: { s0: "a" }, confidence: { s0: { camera: "a", marginDb: 6.2 } }, notes: ["a note"] }
21
+ expect(speakerMapResultOf(base)).toEqual(base)
22
+ expect(speakerMapResultOf({ ...base, confidence: { s0: { camera: "", marginDb: null } } })).not.toBeNull()
23
+ for (const confidence of [{ s0: 3 }, { s0: null }, { s0: { camera: 1, marginDb: 2 } }, { s0: { marginDb: 2 } }, { s0: { camera: "a", marginDb: "6" } }, { s0: { camera: "a", marginDb: Number.NaN } }, { s0: { camera: "a", marginDb: Number.POSITIVE_INFINITY } }, { s0: { camera: "a" } }]) {
24
+ expect(speakerMapResultOf({ ...base, confidence })).toBeNull()
25
+ }
26
+ for (const notes of [[1], [null], ["ok", { text: "x" }]]) expect(speakerMapResultOf({ ...base, notes })).toBeNull()
27
+ })
28
+ it("the default margin is the spec's 3 dB", () => expect(SPEAKER_MAP_DEFAULT_MARGIN_DB).toBe(3))
29
+ })
30
+
31
+ describe("speakerMapByOrdinal (the override's keys, decided 2026-10-17)", () => {
32
+ it("ordinal 1 is the first voice heard, whatever its label", () => {
33
+ expect(speakerMapByOrdinal(transcriptSpeakerLabels(transcript), { "1": "cam-b", "2": "" })).toEqual({ speaker_1: "cam-b", speaker_0: "" })
34
+ })
35
+ it("an ordinal past the transcript's speakers maps nobody", () => {
36
+ expect(speakerMapByOrdinal(transcriptSpeakerLabels(transcript), { "3": "cam-a" })).toEqual({})
37
+ expect(speakerMapByOrdinal(transcriptSpeakerLabels(transcript), undefined)).toEqual({})
38
+ })
39
+ it("only a plainly written whole number from 1 is an ordinal", () => {
40
+ const labels = transcriptSpeakerLabels(transcript)
41
+ for (const key of [" 1", "1 ", "01", "1.0", "1e0", "0", "-1", "+1", "0x1", "", "one"]) expect(speakerMapByOrdinal(labels, { [key]: "cam-a" })).toEqual({})
42
+ expect(speakerMapByOrdinal(labels, { "2": "cam-a" })).toEqual({ speaker_0: "cam-a" })
43
+ })
44
+ it("an override that is not an object maps nobody (a hand-written workflow)", () => {
45
+ const labels = transcriptSpeakerLabels(transcript)
46
+ for (const bad of ["cam-b", ["cam-a", "cam-b"], null, 3]) expect(speakerMapByOrdinal(labels, bad as never)).toEqual({})
47
+ })
48
+ })
@@ -0,0 +1,129 @@
1
+ import { afterEach, describe, expect, it, vi } from "vitest"
2
+
3
+ /**
4
+ * The tables that compose the node units' generated rows (unit-contract-compose.ts):
5
+ * the presentation sets, JSON_OUTPUT_KINDS, NON_PROMPT_TEXT_LANES, the review
6
+ * holds, USE_CASE_NODE_TYPES and FAN_OUT_EACH_HANDLES. Each case loads the modules fresh over
7
+ * stand-in rows (the real units' rows left out) — a unit is added after the
8
+ * hand-written entries, and a type that is in both refuses to load. The
9
+ * use-case types and the review holds have no hand-written entries left.
10
+ */
11
+
12
+ type Rows = {
13
+ UNIT_CONTRACTS?: ReadonlyArray<readonly [string, string]>
14
+ UNIT_USE_CASE_TYPES?: readonly string[]
15
+ UNIT_JSON_PIPS?: ReadonlyArray<readonly [string, Record<string, string>]>
16
+ UNIT_NON_PROMPT_INPUTS?: ReadonlyArray<readonly [string, readonly string[]]>
17
+ UNIT_REVIEW_HOLDS?: readonly string[]
18
+ UNIT_PRESENTS?: ReadonlyArray<readonly [string, string]>
19
+ UNIT_FAN_OUT_EACH?: ReadonlyArray<readonly [string, { each: readonly string[]; primary: string }]>
20
+ }
21
+
22
+ function withRows(rows: Rows): void {
23
+ vi.resetModules()
24
+ vi.doMock("../generated/unit-contracts.js", () => ({
25
+ UNIT_CONTRACTS: [],
26
+ UNIT_USE_CASE_TYPES: [],
27
+ UNIT_JSON_PIPS: [],
28
+ UNIT_NON_PROMPT_INPUTS: [],
29
+ UNIT_REVIEW_HOLDS: [],
30
+ UNIT_PRESENTS: [],
31
+ UNIT_FAN_OUT_EACH: [],
32
+ ...rows,
33
+ }))
34
+ }
35
+
36
+ afterEach(() => {
37
+ vi.doUnmock("../generated/unit-contracts.js")
38
+ vi.resetModules()
39
+ })
40
+
41
+ describe("a node unit's contract rows join the published tables", () => {
42
+ it("each table gains the unit after its hand-written entries", async () => {
43
+ withRows({
44
+ UNIT_USE_CASE_TYPES: ["fixture-case"],
45
+ UNIT_JSON_PIPS: [["fixture-case", { json: "edl" }]],
46
+ UNIT_NON_PROMPT_INPUTS: [["fixture-case", ["music", "media", "negative"]]],
47
+ UNIT_REVIEW_HOLDS: ["fixture-case"],
48
+ UNIT_PRESENTS: [["fixture-case", "text"]],
49
+ UNIT_FAN_OUT_EACH: [["fixture-case", { each: ["media"], primary: "media" }]],
50
+ })
51
+ const { getOutputType } = await import("../presentation-utils.js")
52
+ const { declaredJsonOutput, declaredJsonOutputRows } = await import("../json-kinds.js")
53
+ const { NON_PROMPT_TEXT_LANES, fanOutTextFeedsPrompt } = await import("../fan-out-rows.js")
54
+ const { REVIEW_HOLDING_USE_CASE_TYPES, isPreviewHoldingType } = await import("../preview-gate.js")
55
+ const { USE_CASE_NODE_TYPES, isUseCaseNodeType } = await import("../use-case-types.js")
56
+
57
+ expect(getOutputType("fixture-case")).toBe("text")
58
+ expect(getOutputType("apply-edl")).toBe("video")
59
+
60
+ expect(declaredJsonOutput("fixture-case", "json")).toBe("edl")
61
+ // A unit has no primary pip: an edge with no sourceHandle reads no JSON.
62
+ expect(declaredJsonOutput("fixture-case", undefined)).toBeUndefined()
63
+ expect(declaredJsonOutputRows().at(-1)).toEqual(["fixture-case", "json", "edl"])
64
+
65
+ expect(NON_PROMPT_TEXT_LANES.negative).toBe("*")
66
+ // A handle no list named gets one, after every hand-written key.
67
+ expect(NON_PROMPT_TEXT_LANES.music).toEqual(["fixture-case"])
68
+ expect(NON_PROMPT_TEXT_LANES.media).toEqual(["fixture-case"])
69
+ expect(Object.keys(NON_PROMPT_TEXT_LANES).at(-1)).toBe("media")
70
+ expect(fanOutTextFeedsPrompt("fixture-case", "music")).toBe(false)
71
+ expect(fanOutTextFeedsPrompt("fixture-case", "prompt")).toBe(true)
72
+
73
+ expect([...REVIEW_HOLDING_USE_CASE_TYPES]).toEqual(["fixture-case"])
74
+ expect(isPreviewHoldingType("fixture-case")).toBe(true)
75
+
76
+ expect([...USE_CASE_NODE_TYPES]).toEqual(["fixture-case"])
77
+ expect(isUseCaseNodeType("fixture-case")).toBe(true)
78
+
79
+ const { FAN_OUT_EACH_HANDLES, defaultEdgeOutputMode, listResultsServeHandle } = await import("../producer-types.js")
80
+ expect(Object.keys(FAN_OUT_EACH_HANDLES).at(-1)).toBe("fixture-case")
81
+ expect(FAN_OUT_EACH_HANDLES["camera-switch"]).toEqual({ each: ["edl"], primary: "edl" })
82
+ expect(defaultEdgeOutputMode("fixture-case", "media")).toBe("each")
83
+ expect(defaultEdgeOutputMode("fixture-case", undefined)).toBe("each")
84
+ expect(defaultEdgeOutputMode("fixture-case", "json")).toBe("last")
85
+ expect(listResultsServeHandle("fixture-case", "json")).toBe(false)
86
+ })
87
+
88
+ it("with no rows every table is exactly its hand-written entries", async () => {
89
+ withRows({})
90
+ const { FAN_OUT_EACH_HANDLES } = await import("../producer-types.js")
91
+ expect(Object.keys(FAN_OUT_EACH_HANDLES)).toEqual(["camera-switch", "ugc-clips"])
92
+ const { NON_PROMPT_TEXT_LANES } = await import("../fan-out-rows.js")
93
+ const { REVIEW_HOLDING_USE_CASE_TYPES } = await import("../preview-gate.js")
94
+ expect(NON_PROMPT_TEXT_LANES.music).toBeUndefined()
95
+ expect(Object.keys(NON_PROMPT_TEXT_LANES).at(-1)).toBe("link")
96
+ expect([...REVIEW_HOLDING_USE_CASE_TYPES]).toEqual([])
97
+ })
98
+ })
99
+
100
+ describe("a type that is hand-written and a node unit refuses to load", () => {
101
+ const cases: ReadonlyArray<readonly [string, Rows, RegExp]> = [
102
+ ["../presentation-utils.js", { UNIT_PRESENTS: [["upload-image", "image"]] }, /IMAGE_OUTPUT_TYPES: upload-image is both hand-written and a node unit/],
103
+ ["../json-kinds.js", { UNIT_JSON_PIPS: [["transcribe", { json: "transcript" }]] }, /JSON_OUTPUT_KINDS: transcribe is both a legacy entry and a node unit/],
104
+ ["../fan-out-rows.js", { UNIT_NON_PROMPT_INPUTS: [["apply-edl", ["transcript"]]] }, /NON_PROMPT_TEXT_LANES: apply-edl is listed for "transcript" both by hand and as a node unit/],
105
+ ["../use-case-types.js", { UNIT_USE_CASE_TYPES: ["episode-chapters", "episode-chapters"] }, /USE_CASE_NODE_TYPES: .* lists a type twice/],
106
+ ["../producer-types.js", { UNIT_CONTRACTS: [["upload-video", "video"]] }, /VIDEO_PRODUCER_TYPES: upload-video is both hand-written and a node unit/],
107
+ ["../producer-types.js", { UNIT_FAN_OUT_EACH: [["camera-switch", { each: ["edl"], primary: "edl" }]] }, /FAN_OUT_EACH_HANDLES: camera-switch is both hand-written and a node unit/],
108
+ ]
109
+ for (const [mod, rows, message] of cases) {
110
+ it(mod, async () => {
111
+ withRows(rows)
112
+ await expect(import(/* @vite-ignore */ mod)).rejects.toThrow(message)
113
+ })
114
+ }
115
+ })
116
+
117
+ describe("a node unit with two fan-out rows refuses to load", () => {
118
+ it("../producer-types.js", async () => {
119
+ withRows({ UNIT_FAN_OUT_EACH: [["fixture-case", { each: ["media"], primary: "media" }], ["fixture-case", { each: ["json"], primary: "json" }]] })
120
+ await expect(import("../producer-types.js")).rejects.toThrow(/FAN_OUT_EACH_HANDLES: node unit fixture-case has more than one row/)
121
+ })
122
+ })
123
+
124
+ describe("a node unit's own row that names one handle twice refuses to load", () => {
125
+ it("../fan-out-rows.js", async () => {
126
+ withRows({ UNIT_NON_PROMPT_INPUTS: [["fixture-case", ["media", "media"]]] })
127
+ await expect(import("../fan-out-rows.js")).rejects.toThrow(/NON_PROMPT_TEXT_LANES: node unit fixture-case lists "media" twice in its contract\.nonPromptInputs/)
128
+ })
129
+ })