@koda-sl/baker-cli 0.384.0-dev.4699b7308 → 0.384.0-dev.557795bef

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 (964) hide show
  1. package/README.md +1098 -217
  2. package/canvas/tiktok-captions-composition/index.html +5 -6
  3. package/canvas/tiktok-captions-composition/meta.json +5 -0
  4. package/dist/account-4UEZAY5T.js +49 -0
  5. package/dist/account-4UEZAY5T.js.map +1 -0
  6. package/dist/account-OINZG6UP.js +80 -0
  7. package/dist/account-OINZG6UP.js.map +1 -0
  8. package/dist/account-QMDCUUSG.js +79 -0
  9. package/dist/account-QMDCUUSG.js.map +1 -0
  10. package/dist/account-reads-ZKKDYHK5.js +218 -0
  11. package/dist/account-reads-ZKKDYHK5.js.map +1 -0
  12. package/dist/account-writes-N4JDIDRB.js +66 -0
  13. package/dist/account-writes-N4JDIDRB.js.map +1 -0
  14. package/dist/accounts-AEBQFCNH.js +114 -0
  15. package/dist/accounts-AEBQFCNH.js.map +1 -0
  16. package/dist/accounts-EBGJ2YO7.js +611 -0
  17. package/dist/accounts-EBGJ2YO7.js.map +1 -0
  18. package/dist/accounts-HP4BLKK5.js +75 -0
  19. package/dist/accounts-HP4BLKK5.js.map +1 -0
  20. package/dist/accounts-YE2SQ3UQ.js +77 -0
  21. package/dist/accounts-YE2SQ3UQ.js.map +1 -0
  22. package/dist/accounts-Z4CLGQXJ.js +115 -0
  23. package/dist/accounts-Z4CLGQXJ.js.map +1 -0
  24. package/dist/actions-ADRIEQZX.js +55 -0
  25. package/dist/actions-ADRIEQZX.js.map +1 -0
  26. package/dist/active-entities-YB46ADQN.js +103 -0
  27. package/dist/active-entities-YB46ADQN.js.map +1 -0
  28. package/dist/activities-DUAIQJLN.js +74 -0
  29. package/dist/activities-DUAIQJLN.js.map +1 -0
  30. package/dist/ad-group-writes-HL3EZ3BT.js +170 -0
  31. package/dist/ad-group-writes-HL3EZ3BT.js.map +1 -0
  32. package/dist/ad-groups-FGS5JJGN.js +68 -0
  33. package/dist/ad-groups-FGS5JJGN.js.map +1 -0
  34. package/dist/ad-writes-LX4ACUHB.js +174 -0
  35. package/dist/ad-writes-LX4ACUHB.js.map +1 -0
  36. package/dist/add-5CUXNOUM.js +97 -0
  37. package/dist/add-5CUXNOUM.js.map +1 -0
  38. package/dist/add-6OXOQNET.js +302 -0
  39. package/dist/add-6OXOQNET.js.map +1 -0
  40. package/dist/add-E66HBIZV.js +105 -0
  41. package/dist/add-E66HBIZV.js.map +1 -0
  42. package/dist/add-ROK3ETQC.js +104 -0
  43. package/dist/add-ROK3ETQC.js.map +1 -0
  44. package/dist/add-accounts-YME5SCXD.js +91 -0
  45. package/dist/add-accounts-YME5SCXD.js.map +1 -0
  46. package/dist/ads-65R3WMDU.js +128 -0
  47. package/dist/ads-65R3WMDU.js.map +1 -0
  48. package/dist/ads-O63J7BDF.js +113 -0
  49. package/dist/ads-O63J7BDF.js.map +1 -0
  50. package/dist/ads-TFZ5PXKS.js +77 -0
  51. package/dist/ads-TFZ5PXKS.js.map +1 -0
  52. package/dist/ads-XSVRH45E.js +40 -0
  53. package/dist/ads-XSVRH45E.js.map +1 -0
  54. package/dist/adsets-Y62JOOTV.js +176 -0
  55. package/dist/adsets-Y62JOOTV.js.map +1 -0
  56. package/dist/advertisers-AIC4QPEK.js +120 -0
  57. package/dist/advertisers-AIC4QPEK.js.map +1 -0
  58. package/dist/advertisers-LJ2HKJ4W.js +125 -0
  59. package/dist/advertisers-LJ2HKJ4W.js.map +1 -0
  60. package/dist/analytics-N4PGXXEQ.js +1976 -0
  61. package/dist/analytics-N4PGXXEQ.js.map +1 -0
  62. package/dist/analytics-X3DR3UVG.js +433 -0
  63. package/dist/analytics-X3DR3UVG.js.map +1 -0
  64. package/dist/animate-E3SKQ6SI.js +480 -0
  65. package/dist/animate-E3SKQ6SI.js.map +1 -0
  66. package/dist/assign-Y7HGSQVJ.js +77 -0
  67. package/dist/assign-Y7HGSQVJ.js.map +1 -0
  68. package/dist/audience-size-SWX5YJQF.js +94 -0
  69. package/dist/audience-size-SWX5YJQF.js.map +1 -0
  70. package/dist/audiences-5A6BCWSA.js +268 -0
  71. package/dist/audiences-5A6BCWSA.js.map +1 -0
  72. package/dist/audiences-6QOCASVV.js +78 -0
  73. package/dist/audiences-6QOCASVV.js.map +1 -0
  74. package/dist/audiences-O67NGIP5.js +85 -0
  75. package/dist/audiences-O67NGIP5.js.map +1 -0
  76. package/dist/audit-2KVLWSAI.js +151 -0
  77. package/dist/audit-2KVLWSAI.js.map +1 -0
  78. package/dist/audit-HWK24VXI.js +88 -0
  79. package/dist/audit-HWK24VXI.js.map +1 -0
  80. package/dist/autocomplete-JJSGC5WU.js +111 -0
  81. package/dist/autocomplete-JJSGC5WU.js.map +1 -0
  82. package/dist/avatars-XIEKQ77J.js +38 -0
  83. package/dist/avatars-XIEKQ77J.js.map +1 -0
  84. package/dist/bid-pricing-D2HGRWZL.js +99 -0
  85. package/dist/bid-pricing-D2HGRWZL.js.map +1 -0
  86. package/dist/brand-AYYWRGIE.js +22 -0
  87. package/dist/brand-AYYWRGIE.js.map +1 -0
  88. package/dist/brief-3HUIDK5F.js +490 -0
  89. package/dist/brief-3HUIDK5F.js.map +1 -0
  90. package/dist/businesses-65EWTK5E.js +53 -0
  91. package/dist/businesses-65EWTK5E.js.map +1 -0
  92. package/dist/campaign-groups-6HCYR2JX.js +95 -0
  93. package/dist/campaign-groups-6HCYR2JX.js.map +1 -0
  94. package/dist/campaign-writes-M6JLF5AC.js +170 -0
  95. package/dist/campaign-writes-M6JLF5AC.js.map +1 -0
  96. package/dist/campaign-writes-Y6QPRQ4E.js +165 -0
  97. package/dist/campaign-writes-Y6QPRQ4E.js.map +1 -0
  98. package/dist/campaigns-6SM2ZSIH.js +76 -0
  99. package/dist/campaigns-6SM2ZSIH.js.map +1 -0
  100. package/dist/campaigns-7RKJZRY2.js +107 -0
  101. package/dist/campaigns-7RKJZRY2.js.map +1 -0
  102. package/dist/campaigns-KRI25JDZ.js +109 -0
  103. package/dist/campaigns-KRI25JDZ.js.map +1 -0
  104. package/dist/campaigns-TD7ZB5DG.js +110 -0
  105. package/dist/campaigns-TD7ZB5DG.js.map +1 -0
  106. package/dist/canvas-DMYY2DWI.js +46 -0
  107. package/dist/canvas-DMYY2DWI.js.map +1 -0
  108. package/dist/capabilities-3WJTXS2O.js +144 -0
  109. package/dist/capabilities-3WJTXS2O.js.map +1 -0
  110. package/dist/cards-7HRC4UQQ.js +85 -0
  111. package/dist/cards-7HRC4UQQ.js.map +1 -0
  112. package/dist/catalog-N6MDMIVL.js +64 -0
  113. package/dist/catalog-N6MDMIVL.js.map +1 -0
  114. package/dist/catalogs-PB46L7FH.js +128 -0
  115. package/dist/catalogs-PB46L7FH.js.map +1 -0
  116. package/dist/changes-SASUQK62.js +135 -0
  117. package/dist/changes-SASUQK62.js.map +1 -0
  118. package/dist/chatgpt-JKBSAG25.js +47 -0
  119. package/dist/chatgpt-JKBSAG25.js.map +1 -0
  120. package/dist/chats-WRVSQQB2.js +262 -0
  121. package/dist/chats-WRVSQQB2.js.map +1 -0
  122. package/dist/chunk-2FGKJY63.js +455 -0
  123. package/dist/chunk-2FGKJY63.js.map +1 -0
  124. package/dist/chunk-2GVXNKAE.js +42 -0
  125. package/dist/chunk-2GVXNKAE.js.map +1 -0
  126. package/dist/chunk-2J3PTIQB.js +479 -0
  127. package/dist/chunk-2J3PTIQB.js.map +1 -0
  128. package/dist/chunk-2J7XC2NO.js +346 -0
  129. package/dist/chunk-2J7XC2NO.js.map +1 -0
  130. package/dist/{chunk-VLUGGVJL.js → chunk-2UFRHW3T.js} +12 -4
  131. package/dist/chunk-2UFRHW3T.js.map +1 -0
  132. package/dist/chunk-2Y5V23PU.js +29 -0
  133. package/dist/chunk-2Y5V23PU.js.map +1 -0
  134. package/dist/chunk-3ACMDRSE.js +39 -0
  135. package/dist/chunk-3ACMDRSE.js.map +1 -0
  136. package/dist/chunk-3EWF7VII.js +1079 -0
  137. package/dist/chunk-3EWF7VII.js.map +1 -0
  138. package/dist/chunk-3LYMIKKN.js +625 -0
  139. package/dist/chunk-3LYMIKKN.js.map +1 -0
  140. package/dist/chunk-3M6RNCDD.js +26 -0
  141. package/dist/chunk-3M6RNCDD.js.map +1 -0
  142. package/dist/chunk-3MDO4RR2.js +310 -0
  143. package/dist/chunk-3MDO4RR2.js.map +1 -0
  144. package/dist/chunk-3NPOIHSX.js +6667 -0
  145. package/dist/chunk-3NPOIHSX.js.map +1 -0
  146. package/dist/chunk-3SK7TWGP.js +103 -0
  147. package/dist/chunk-3SK7TWGP.js.map +1 -0
  148. package/dist/chunk-3VXQYDJN.js +1743 -0
  149. package/dist/chunk-3VXQYDJN.js.map +1 -0
  150. package/dist/chunk-44VXKO65.js +106 -0
  151. package/dist/chunk-44VXKO65.js.map +1 -0
  152. package/dist/chunk-4NZ47VXO.js +137 -0
  153. package/dist/chunk-4NZ47VXO.js.map +1 -0
  154. package/dist/chunk-4X3UR372.js +225 -0
  155. package/dist/chunk-4X3UR372.js.map +1 -0
  156. package/dist/chunk-553XSIFW.js +304 -0
  157. package/dist/chunk-553XSIFW.js.map +1 -0
  158. package/dist/chunk-5FEBUCJU.js +25 -0
  159. package/dist/chunk-5FEBUCJU.js.map +1 -0
  160. package/dist/chunk-5HYSKH77.js +315 -0
  161. package/dist/chunk-5HYSKH77.js.map +1 -0
  162. package/dist/chunk-5MBPIONY.js +29 -0
  163. package/dist/chunk-5MBPIONY.js.map +1 -0
  164. package/dist/chunk-5UCP4EEQ.js +111 -0
  165. package/dist/chunk-5UCP4EEQ.js.map +1 -0
  166. package/dist/chunk-5VPJNNJL.js +494 -0
  167. package/dist/chunk-5VPJNNJL.js.map +1 -0
  168. package/dist/{chunk-VZEDAFAR.js → chunk-6YYSUISH.js} +47 -8
  169. package/dist/chunk-6YYSUISH.js.map +1 -0
  170. package/dist/chunk-7OHWEF3I.js +98 -0
  171. package/dist/chunk-7OHWEF3I.js.map +1 -0
  172. package/dist/chunk-A636XRD7.js +159 -0
  173. package/dist/chunk-A636XRD7.js.map +1 -0
  174. package/dist/chunk-A76FRBSF.js +297 -0
  175. package/dist/chunk-A76FRBSF.js.map +1 -0
  176. package/dist/chunk-AADVCEL4.js +817 -0
  177. package/dist/chunk-AADVCEL4.js.map +1 -0
  178. package/dist/chunk-AG62YO7C.js +96 -0
  179. package/dist/chunk-AG62YO7C.js.map +1 -0
  180. package/dist/chunk-AIRIT4GF.js +75 -0
  181. package/dist/chunk-AIRIT4GF.js.map +1 -0
  182. package/dist/chunk-AMCY5YCB.js +206 -0
  183. package/dist/chunk-AMCY5YCB.js.map +1 -0
  184. package/dist/chunk-AP3TP6VG.js +139 -0
  185. package/dist/chunk-AP3TP6VG.js.map +1 -0
  186. package/dist/chunk-APP475IQ.js +474 -0
  187. package/dist/chunk-APP475IQ.js.map +1 -0
  188. package/dist/chunk-AR7PU7BB.js +76 -0
  189. package/dist/chunk-AR7PU7BB.js.map +1 -0
  190. package/dist/chunk-B4S72KSS.js +172 -0
  191. package/dist/chunk-B4S72KSS.js.map +1 -0
  192. package/dist/chunk-BIPIL4QA.js +486 -0
  193. package/dist/chunk-BIPIL4QA.js.map +1 -0
  194. package/dist/chunk-BPUSL5Y2.js +58 -0
  195. package/dist/chunk-BPUSL5Y2.js.map +1 -0
  196. package/dist/chunk-BR32GHYD.js +65 -0
  197. package/dist/chunk-BR32GHYD.js.map +1 -0
  198. package/dist/chunk-CAMX6OHF.js +3182 -0
  199. package/dist/chunk-CAMX6OHF.js.map +1 -0
  200. package/dist/{chunk-MF7YA62W.js → chunk-CUL3VB4L.js} +10 -5
  201. package/dist/chunk-CUL3VB4L.js.map +1 -0
  202. package/dist/chunk-CVEY353K.js +66 -0
  203. package/dist/chunk-CVEY353K.js.map +1 -0
  204. package/dist/chunk-CWXADUKL.js +1599 -0
  205. package/dist/chunk-CWXADUKL.js.map +1 -0
  206. package/dist/chunk-D5FY4FAK.js +24 -0
  207. package/dist/chunk-D5FY4FAK.js.map +1 -0
  208. package/dist/chunk-DGCUPJZD.js +39 -0
  209. package/dist/chunk-DGCUPJZD.js.map +1 -0
  210. package/dist/chunk-DNCLWSHO.js +41 -0
  211. package/dist/chunk-DNCLWSHO.js.map +1 -0
  212. package/dist/chunk-DUPURL26.js +97 -0
  213. package/dist/chunk-DUPURL26.js.map +1 -0
  214. package/dist/chunk-E2ZOSNF5.js +96 -0
  215. package/dist/chunk-E2ZOSNF5.js.map +1 -0
  216. package/dist/chunk-E3HYHT7C.js +274 -0
  217. package/dist/chunk-E3HYHT7C.js.map +1 -0
  218. package/dist/chunk-EDLZGTGN.js +216 -0
  219. package/dist/chunk-EDLZGTGN.js.map +1 -0
  220. package/dist/chunk-EI5QN4UO.js +363 -0
  221. package/dist/chunk-EI5QN4UO.js.map +1 -0
  222. package/dist/{chunk-XHC4LMK4.js → chunk-EIGXX6KI.js} +16 -8
  223. package/dist/chunk-EIGXX6KI.js.map +1 -0
  224. package/dist/chunk-EPDE7ZRU.js +174 -0
  225. package/dist/chunk-EPDE7ZRU.js.map +1 -0
  226. package/dist/chunk-ERSX3MKH.js +34 -0
  227. package/dist/chunk-ERSX3MKH.js.map +1 -0
  228. package/dist/chunk-EVDRF4CI.js +509 -0
  229. package/dist/chunk-EVDRF4CI.js.map +1 -0
  230. package/dist/chunk-F4IEILTR.js +382 -0
  231. package/dist/chunk-F4IEILTR.js.map +1 -0
  232. package/dist/chunk-F7HRLPR5.js +67 -0
  233. package/dist/chunk-F7HRLPR5.js.map +1 -0
  234. package/dist/chunk-FEG6MN4H.js +84 -0
  235. package/dist/chunk-FEG6MN4H.js.map +1 -0
  236. package/dist/chunk-FKOECEVC.js +126 -0
  237. package/dist/chunk-FKOECEVC.js.map +1 -0
  238. package/dist/chunk-FMGW2NZI.js +106 -0
  239. package/dist/chunk-FMGW2NZI.js.map +1 -0
  240. package/dist/chunk-FPZKKNDK.js +98 -0
  241. package/dist/chunk-FPZKKNDK.js.map +1 -0
  242. package/dist/chunk-FUVCY63N.js +169 -0
  243. package/dist/chunk-FUVCY63N.js.map +1 -0
  244. package/dist/chunk-GBNJQNDS.js +19 -0
  245. package/dist/chunk-GBNJQNDS.js.map +1 -0
  246. package/dist/chunk-GIWHHCD6.js +145 -0
  247. package/dist/chunk-GIWHHCD6.js.map +1 -0
  248. package/dist/chunk-GOJXKIFQ.js +1605 -0
  249. package/dist/chunk-GOJXKIFQ.js.map +1 -0
  250. package/dist/chunk-GRQ2AXDX.js +9 -0
  251. package/dist/chunk-GRQ2AXDX.js.map +1 -0
  252. package/dist/chunk-GXDLWBOY.js +73 -0
  253. package/dist/chunk-GXDLWBOY.js.map +1 -0
  254. package/dist/chunk-HAE4WWFQ.js +455 -0
  255. package/dist/chunk-HAE4WWFQ.js.map +1 -0
  256. package/dist/chunk-I2DNBEV6.js +4227 -0
  257. package/dist/chunk-I2DNBEV6.js.map +1 -0
  258. package/dist/chunk-I4FTS5EE.js +455 -0
  259. package/dist/chunk-I4FTS5EE.js.map +1 -0
  260. package/dist/chunk-IELPT4K2.js +74 -0
  261. package/dist/chunk-IELPT4K2.js.map +1 -0
  262. package/dist/chunk-IJMWEO4P.js +57 -0
  263. package/dist/chunk-IJMWEO4P.js.map +1 -0
  264. package/dist/chunk-IREMSVKW.js +175 -0
  265. package/dist/chunk-IREMSVKW.js.map +1 -0
  266. package/dist/chunk-IVIJJXXT.js +62 -0
  267. package/dist/chunk-IVIJJXXT.js.map +1 -0
  268. package/dist/chunk-JD3W3ON7.js +188 -0
  269. package/dist/chunk-JD3W3ON7.js.map +1 -0
  270. package/dist/chunk-JLWBK3VC.js +5187 -0
  271. package/dist/chunk-JLWBK3VC.js.map +1 -0
  272. package/dist/chunk-JPK34QPS.js +134 -0
  273. package/dist/chunk-JPK34QPS.js.map +1 -0
  274. package/dist/chunk-JUY47NZ2.js +183 -0
  275. package/dist/chunk-JUY47NZ2.js.map +1 -0
  276. package/dist/chunk-JXMZEOHV.js +333 -0
  277. package/dist/chunk-JXMZEOHV.js.map +1 -0
  278. package/dist/chunk-K37K447U.js +51 -0
  279. package/dist/chunk-K37K447U.js.map +1 -0
  280. package/dist/chunk-K6TDB2KV.js +1442 -0
  281. package/dist/chunk-K6TDB2KV.js.map +1 -0
  282. package/dist/chunk-KIGGMKAE.js +66 -0
  283. package/dist/chunk-KIGGMKAE.js.map +1 -0
  284. package/dist/chunk-KKJ4KJCW.js +29 -0
  285. package/dist/chunk-KKJ4KJCW.js.map +1 -0
  286. package/dist/chunk-KONA5PSR.js +55 -0
  287. package/dist/chunk-KONA5PSR.js.map +1 -0
  288. package/dist/chunk-KVHRW7KO.js +60 -0
  289. package/dist/chunk-KVHRW7KO.js.map +1 -0
  290. package/dist/chunk-LA6PPSNA.js +65 -0
  291. package/dist/chunk-LA6PPSNA.js.map +1 -0
  292. package/dist/chunk-LKPJADL2.js +74 -0
  293. package/dist/chunk-LKPJADL2.js.map +1 -0
  294. package/dist/chunk-LWAEHLKV.js +74 -0
  295. package/dist/chunk-LWAEHLKV.js.map +1 -0
  296. package/dist/chunk-M6UNISGO.js +66 -0
  297. package/dist/chunk-M6UNISGO.js.map +1 -0
  298. package/dist/chunk-MIJAGBEP.js +23992 -0
  299. package/dist/chunk-MIJAGBEP.js.map +1 -0
  300. package/dist/chunk-MP4EXZ45.js +3151 -0
  301. package/dist/chunk-MP4EXZ45.js.map +1 -0
  302. package/dist/chunk-MYTDK3AL.js +2102 -0
  303. package/dist/chunk-MYTDK3AL.js.map +1 -0
  304. package/dist/chunk-MZQ5DX6S.js +125 -0
  305. package/dist/chunk-MZQ5DX6S.js.map +1 -0
  306. package/dist/chunk-NFSLRRIE.js +77 -0
  307. package/dist/chunk-NFSLRRIE.js.map +1 -0
  308. package/dist/chunk-NOK7MSVJ.js +533 -0
  309. package/dist/chunk-NOK7MSVJ.js.map +1 -0
  310. package/dist/chunk-NR5RZDAW.js +592 -0
  311. package/dist/chunk-NR5RZDAW.js.map +1 -0
  312. package/dist/chunk-O2EVJALZ.js +133 -0
  313. package/dist/chunk-O2EVJALZ.js.map +1 -0
  314. package/dist/chunk-O6UM5WWH.js +275 -0
  315. package/dist/chunk-O6UM5WWH.js.map +1 -0
  316. package/dist/chunk-O6XZIQXZ.js +6212 -0
  317. package/dist/chunk-O6XZIQXZ.js.map +1 -0
  318. package/dist/chunk-OIL6PU5W.js +35 -0
  319. package/dist/chunk-OIL6PU5W.js.map +1 -0
  320. package/dist/chunk-P4NSJS54.js +20 -0
  321. package/dist/chunk-P4NSJS54.js.map +1 -0
  322. package/dist/chunk-P5T7OZKV.js +26 -0
  323. package/dist/chunk-P5T7OZKV.js.map +1 -0
  324. package/dist/chunk-PFBQERWX.js +10 -0
  325. package/dist/chunk-PFBQERWX.js.map +1 -0
  326. package/dist/chunk-PSWVSLJU.js +56 -0
  327. package/dist/chunk-PSWVSLJU.js.map +1 -0
  328. package/dist/chunk-PY2NJ6XZ.js +191 -0
  329. package/dist/chunk-PY2NJ6XZ.js.map +1 -0
  330. package/dist/chunk-PZ4OM2LK.js +45 -0
  331. package/dist/chunk-PZ4OM2LK.js.map +1 -0
  332. package/dist/chunk-PZNOJ76W.js +541 -0
  333. package/dist/chunk-PZNOJ76W.js.map +1 -0
  334. package/dist/chunk-Q6ULQMWG.js +41 -0
  335. package/dist/chunk-Q6ULQMWG.js.map +1 -0
  336. package/dist/chunk-QKFD6PPX.js +57 -0
  337. package/dist/chunk-QKFD6PPX.js.map +1 -0
  338. package/dist/chunk-QMLGJ5OW.js +2891 -0
  339. package/dist/chunk-QMLGJ5OW.js.map +1 -0
  340. package/dist/chunk-R4TPDVBD.js +207 -0
  341. package/dist/chunk-R4TPDVBD.js.map +1 -0
  342. package/dist/chunk-R7QV5N2S.js +846 -0
  343. package/dist/chunk-R7QV5N2S.js.map +1 -0
  344. package/dist/chunk-RR3KT2E7.js +665 -0
  345. package/dist/chunk-RR3KT2E7.js.map +1 -0
  346. package/dist/chunk-SEPPFM5S.js +228 -0
  347. package/dist/chunk-SEPPFM5S.js.map +1 -0
  348. package/dist/chunk-SQ7DRYCC.js +150 -0
  349. package/dist/chunk-SQ7DRYCC.js.map +1 -0
  350. package/dist/chunk-SYULM665.js +610 -0
  351. package/dist/chunk-SYULM665.js.map +1 -0
  352. package/dist/chunk-TKT3OHZ6.js +170 -0
  353. package/dist/chunk-TKT3OHZ6.js.map +1 -0
  354. package/dist/chunk-TNOSX3PJ.js +136 -0
  355. package/dist/chunk-TNOSX3PJ.js.map +1 -0
  356. package/dist/chunk-TTVKI54A.js +160 -0
  357. package/dist/chunk-TTVKI54A.js.map +1 -0
  358. package/dist/chunk-U7ZVXFS3.js +23 -0
  359. package/dist/chunk-U7ZVXFS3.js.map +1 -0
  360. package/dist/chunk-UI6BKYQD.js +225 -0
  361. package/dist/chunk-UI6BKYQD.js.map +1 -0
  362. package/dist/chunk-UKLDW4UW.js +46 -0
  363. package/dist/chunk-UKLDW4UW.js.map +1 -0
  364. package/dist/chunk-V6XXXEXZ.js +76 -0
  365. package/dist/chunk-V6XXXEXZ.js.map +1 -0
  366. package/dist/chunk-V7BW2CIQ.js +92 -0
  367. package/dist/chunk-V7BW2CIQ.js.map +1 -0
  368. package/dist/chunk-VSU5R34H.js +76 -0
  369. package/dist/chunk-VSU5R34H.js.map +1 -0
  370. package/dist/chunk-W4SA4CMR.js +296 -0
  371. package/dist/chunk-W4SA4CMR.js.map +1 -0
  372. package/dist/chunk-WFUMNDCE.js +111 -0
  373. package/dist/chunk-WFUMNDCE.js.map +1 -0
  374. package/dist/chunk-WHWNXLTD.js +166 -0
  375. package/dist/chunk-WHWNXLTD.js.map +1 -0
  376. package/dist/chunk-WN4KX7GE.js +25 -0
  377. package/dist/chunk-WN4KX7GE.js.map +1 -0
  378. package/dist/chunk-XIY7P54H.js +84 -0
  379. package/dist/chunk-XIY7P54H.js.map +1 -0
  380. package/dist/chunk-YFPLNMPZ.js +337 -0
  381. package/dist/chunk-YFPLNMPZ.js.map +1 -0
  382. package/dist/chunk-YMBB4JBD.js +1830 -0
  383. package/dist/chunk-YMBB4JBD.js.map +1 -0
  384. package/dist/chunk-YQFM2P5W.js +197 -0
  385. package/dist/chunk-YQFM2P5W.js.map +1 -0
  386. package/dist/chunk-YQSBHWOI.js +41 -0
  387. package/dist/chunk-YTF3IVMF.js +149 -0
  388. package/dist/chunk-YTF3IVMF.js.map +1 -0
  389. package/dist/chunk-Z3ENMCFE.js +94 -0
  390. package/dist/chunk-Z3ENMCFE.js.map +1 -0
  391. package/dist/chunk-Z7MWSXLG.js +94 -0
  392. package/dist/chunk-Z7MWSXLG.js.map +1 -0
  393. package/dist/chunk-ZIXHS6AM.js +42 -0
  394. package/dist/chunk-ZIXHS6AM.js.map +1 -0
  395. package/dist/chunk-ZJ7TQUCU.js +4410 -0
  396. package/dist/chunk-ZJ7TQUCU.js.map +1 -0
  397. package/dist/chunk-ZNQRDLSS.js +52 -0
  398. package/dist/chunk-ZNQRDLSS.js.map +1 -0
  399. package/dist/claim-ROWH6JVB.js +197 -0
  400. package/dist/claim-ROWH6JVB.js.map +1 -0
  401. package/dist/cli.js +104 -69986
  402. package/dist/cli.js.map +1 -1
  403. package/dist/client-EURRWXPW.js +19 -0
  404. package/dist/code-FKQW7V7N.js +76 -0
  405. package/dist/code-FKQW7V7N.js.map +1 -0
  406. package/dist/companies-MD2MZKU6.js +195 -0
  407. package/dist/companies-MD2MZKU6.js.map +1 -0
  408. package/dist/complete-FCAJM6Z4.js +81 -0
  409. package/dist/complete-FCAJM6Z4.js.map +1 -0
  410. package/dist/config-OZOHIAOJ.js +88 -0
  411. package/dist/config-OZOHIAOJ.js.map +1 -0
  412. package/dist/connect-4YXFMXYX.js +42 -0
  413. package/dist/content-PCGSX2QU.js +85 -0
  414. package/dist/content-PCGSX2QU.js.map +1 -0
  415. package/dist/conversation-UX5NZ3IO.js +93 -0
  416. package/dist/conversation-UX5NZ3IO.js.map +1 -0
  417. package/dist/conversion-report-7QSWB2FY.js +125 -0
  418. package/dist/conversion-report-7QSWB2FY.js.map +1 -0
  419. package/dist/conversion-upload-command-XESIAQPU.js +438 -0
  420. package/dist/conversion-upload-command-XESIAQPU.js.map +1 -0
  421. package/dist/conversion-writes-BGOVLBS5.js +120 -0
  422. package/dist/conversion-writes-BGOVLBS5.js.map +1 -0
  423. package/dist/conversions-IYIWW4O7.js +76 -0
  424. package/dist/conversions-IYIWW4O7.js.map +1 -0
  425. package/dist/conversions-RLIJAE7E.js +135 -0
  426. package/dist/conversions-RLIJAE7E.js.map +1 -0
  427. package/dist/countries-5OBUVLLD.js +82 -0
  428. package/dist/countries-5OBUVLLD.js.map +1 -0
  429. package/dist/create-CUJLJUAQ.js +138 -0
  430. package/dist/create-CUJLJUAQ.js.map +1 -0
  431. package/dist/create-FENOT6DX.js +236 -0
  432. package/dist/create-FENOT6DX.js.map +1 -0
  433. package/dist/create-OFZQMOWO.js +59 -0
  434. package/dist/create-OFZQMOWO.js.map +1 -0
  435. package/dist/create-Z5SS2AWB.js +207 -0
  436. package/dist/create-Z5SS2AWB.js.map +1 -0
  437. package/dist/creatives-UJW2QBLH.js +182 -0
  438. package/dist/creatives-UJW2QBLH.js.map +1 -0
  439. package/dist/creatives-XI2DGQUZ.js +87 -0
  440. package/dist/creatives-XI2DGQUZ.js.map +1 -0
  441. package/dist/creatives-YLXQSROD.js +51 -0
  442. package/dist/creatives-YLXQSROD.js.map +1 -0
  443. package/dist/credentials-CH73QMD2.js +287 -0
  444. package/dist/credentials-CH73QMD2.js.map +1 -0
  445. package/dist/critique-C4WRQ4AJ.js +1449 -0
  446. package/dist/critique-C4WRQ4AJ.js.map +1 -0
  447. package/dist/critique-ZBNJ6MQ3.js +213 -0
  448. package/dist/critique-ZBNJ6MQ3.js.map +1 -0
  449. package/dist/crm-MJTT6GOJ.js +224 -0
  450. package/dist/crm-MJTT6GOJ.js.map +1 -0
  451. package/dist/crm-ZXHSEFYI.js +318 -0
  452. package/dist/crm-ZXHSEFYI.js.map +1 -0
  453. package/dist/crop-B52KIQ4O.js +113 -0
  454. package/dist/crop-B52KIQ4O.js.map +1 -0
  455. package/dist/currency-GGWF5DMU.js +88 -0
  456. package/dist/currency-GGWF5DMU.js.map +1 -0
  457. package/dist/custom-conversions-7WDBTC4X.js +125 -0
  458. package/dist/custom-conversions-7WDBTC4X.js.map +1 -0
  459. package/dist/customers-7E4HBSEY.js +56 -0
  460. package/dist/decide-PK7WNSQ2.js +199 -0
  461. package/dist/decide-PK7WNSQ2.js.map +1 -0
  462. package/dist/delete-56LKNEGA.js +71 -0
  463. package/dist/delete-56LKNEGA.js.map +1 -0
  464. package/dist/delete-DQY4ZSFN.js +54 -0
  465. package/dist/delete-DQY4ZSFN.js.map +1 -0
  466. package/dist/delete-EZ7HHOOD.js +69 -0
  467. package/dist/delete-EZ7HHOOD.js.map +1 -0
  468. package/dist/delete-JV4KAA6Y.js +66 -0
  469. package/dist/delete-JV4KAA6Y.js.map +1 -0
  470. package/dist/delete-YONJW4UZ.js +63 -0
  471. package/dist/delete-YONJW4UZ.js.map +1 -0
  472. package/dist/delete-YSYVFL6W.js +71 -0
  473. package/dist/delete-YSYVFL6W.js.map +1 -0
  474. package/dist/demographics-6N3TTYWC.js +138 -0
  475. package/dist/demographics-6N3TTYWC.js.map +1 -0
  476. package/dist/describe-AAVYIFE3.js +97 -0
  477. package/dist/describe-AAVYIFE3.js.map +1 -0
  478. package/dist/describe-UQFLWVFR.js +97 -0
  479. package/dist/describe-UQFLWVFR.js.map +1 -0
  480. package/dist/dimensions-QDXBG2XC.js +101 -0
  481. package/dist/dimensions-QDXBG2XC.js.map +1 -0
  482. package/dist/discard-S3NGGUSK.js +66 -0
  483. package/dist/discard-S3NGGUSK.js.map +1 -0
  484. package/dist/discover-6TEBPVNC.js +93 -0
  485. package/dist/discover-6TEBPVNC.js.map +1 -0
  486. package/dist/discover-SBZPB7T2.js +172 -0
  487. package/dist/discover-SBZPB7T2.js.map +1 -0
  488. package/dist/domain-AMAR76PB.js +98 -0
  489. package/dist/domain-AMAR76PB.js.map +1 -0
  490. package/dist/download-LV3GPOWV.js +299 -0
  491. package/dist/download-LV3GPOWV.js.map +1 -0
  492. package/dist/draft-6QZ7WMWM.js +217 -0
  493. package/dist/draft-6QZ7WMWM.js.map +1 -0
  494. package/dist/draft-DDFFTZ43.js +233 -0
  495. package/dist/draft-DDFFTZ43.js.map +1 -0
  496. package/dist/draft-FIKJXNIQ.js +281 -0
  497. package/dist/draft-FIKJXNIQ.js.map +1 -0
  498. package/dist/draft-GYGWTMBU.js +307 -0
  499. package/dist/draft-GYGWTMBU.js.map +1 -0
  500. package/dist/draft-KXL62WFS.js +328 -0
  501. package/dist/draft-KXL62WFS.js.map +1 -0
  502. package/dist/draft-N4LFPKTA.js +100 -0
  503. package/dist/draft-N4LFPKTA.js.map +1 -0
  504. package/dist/draft-POSLJCWG.js +306 -0
  505. package/dist/draft-POSLJCWG.js.map +1 -0
  506. package/dist/draft-XPO5RWST.js +103 -0
  507. package/dist/draft-XPO5RWST.js.map +1 -0
  508. package/dist/engine/index.d.ts +213 -127
  509. package/dist/engine/index.js +18 -4
  510. package/dist/{env-4P5HOGNA.js → env-TQ2XS2KY.js} +12 -2
  511. package/dist/env-TQ2XS2KY.js.map +1 -0
  512. package/dist/experiment-FQNKMORZ.js +1397 -0
  513. package/dist/experiment-FQNKMORZ.js.map +1 -0
  514. package/dist/export-4IZQZAPF.js +168 -0
  515. package/dist/export-4IZQZAPF.js.map +1 -0
  516. package/dist/extract-DZMGVQ7D.js +113 -0
  517. package/dist/extract-DZMGVQ7D.js.map +1 -0
  518. package/dist/facets-223V5P47.js +114 -0
  519. package/dist/facets-223V5P47.js.map +1 -0
  520. package/dist/favorites-DD2LNSTG.js +178 -0
  521. package/dist/favorites-DD2LNSTG.js.map +1 -0
  522. package/dist/feed-TUVFNX2U.js +177 -0
  523. package/dist/feed-TUVFNX2U.js.map +1 -0
  524. package/dist/feedback-MIW23MI2.js +66 -0
  525. package/dist/feedback-MIW23MI2.js.map +1 -0
  526. package/dist/feedback-record-RGKRKPGZ.js +175 -0
  527. package/dist/feedback-record-RGKRKPGZ.js.map +1 -0
  528. package/dist/fetch-O6UHNXWB.js +139 -0
  529. package/dist/fetch-O6UHNXWB.js.map +1 -0
  530. package/dist/fetch-TZ4UCMJK.js +176 -0
  531. package/dist/fetch-TZ4UCMJK.js.map +1 -0
  532. package/dist/find-4XKIBF4D.js +134 -0
  533. package/dist/find-4XKIBF4D.js.map +1 -0
  534. package/dist/fit-ODVVXV2Q.js +45 -0
  535. package/dist/fit-ODVVXV2Q.js.map +1 -0
  536. package/dist/flows-HVWBFZ7T.js +247 -0
  537. package/dist/flows-HVWBFZ7T.js.map +1 -0
  538. package/dist/follow-RCOXTZGY.js +94 -0
  539. package/dist/follow-RCOXTZGY.js.map +1 -0
  540. package/dist/follow-competitors-SQ5XBFTK.js +112 -0
  541. package/dist/follow-competitors-SQ5XBFTK.js.map +1 -0
  542. package/dist/following-VDU3BHC4.js +113 -0
  543. package/dist/following-VDU3BHC4.js.map +1 -0
  544. package/dist/fonts-NBIQAVQN.js +34 -0
  545. package/dist/fonts-NBIQAVQN.js.map +1 -0
  546. package/dist/forecast-2GJKBNBM.js +168 -0
  547. package/dist/forecast-2GJKBNBM.js.map +1 -0
  548. package/dist/forecast-76MUJBPO.js +104 -0
  549. package/dist/forecast-76MUJBPO.js.map +1 -0
  550. package/dist/funding-HTFVZLLG.js +85 -0
  551. package/dist/funding-HTFVZLLG.js.map +1 -0
  552. package/dist/funnel-FE2HIRVQ.js +394 -0
  553. package/dist/funnel-FE2HIRVQ.js.map +1 -0
  554. package/dist/ga4-2RC4EH7V.js +55 -0
  555. package/dist/ga4-2RC4EH7V.js.map +1 -0
  556. package/dist/generate-TPDOBCKQ.js +262 -0
  557. package/dist/generate-TPDOBCKQ.js.map +1 -0
  558. package/dist/get-6JNOVI27.js +56 -0
  559. package/dist/get-6JNOVI27.js.map +1 -0
  560. package/dist/get-FH2LIEYL.js +63 -0
  561. package/dist/get-FH2LIEYL.js.map +1 -0
  562. package/dist/get-GZLCDXXW.js +61 -0
  563. package/dist/get-GZLCDXXW.js.map +1 -0
  564. package/dist/get-KVAOPAQW.js +78 -0
  565. package/dist/get-KVAOPAQW.js.map +1 -0
  566. package/dist/get-TSPQYEKC.js +59 -0
  567. package/dist/get-TSPQYEKC.js.map +1 -0
  568. package/dist/get-TY3RXYNZ.js +63 -0
  569. package/dist/get-TY3RXYNZ.js.map +1 -0
  570. package/dist/get-VPW33XTN.js +92 -0
  571. package/dist/get-VPW33XTN.js.map +1 -0
  572. package/dist/gif-JFEYPFFI.js +94 -0
  573. package/dist/gif-JFEYPFFI.js.map +1 -0
  574. package/dist/google-R6RD4L6Z.js +136 -0
  575. package/dist/google-R6RD4L6Z.js.map +1 -0
  576. package/dist/google-VPQNRVIB.js +3190 -0
  577. package/dist/google-VPQNRVIB.js.map +1 -0
  578. package/dist/google-ads-JEQMNNMN.js +195 -0
  579. package/dist/google-ads-JEQMNNMN.js.map +1 -0
  580. package/dist/group-7AV6UL26.js +43 -0
  581. package/dist/group-7AV6UL26.js.map +1 -0
  582. package/dist/group-BVQZEZIC.js +43 -0
  583. package/dist/group-BVQZEZIC.js.map +1 -0
  584. package/dist/gsc-SQ42WAQE.js +30 -0
  585. package/dist/gsc-SQ42WAQE.js.map +1 -0
  586. package/dist/history-BNNHFURR.js +67 -0
  587. package/dist/history-BNNHFURR.js.map +1 -0
  588. package/dist/history-EHUQG4CE.js +133 -0
  589. package/dist/history-EHUQG4CE.js.map +1 -0
  590. package/dist/hubspot-JABE4USC.js +779 -0
  591. package/dist/hubspot-JABE4USC.js.map +1 -0
  592. package/dist/icon-OYTTSNSL.js +137 -0
  593. package/dist/icon-OYTTSNSL.js.map +1 -0
  594. package/dist/ideas-OD76WOQ3.js +32 -0
  595. package/dist/ideas-OD76WOQ3.js.map +1 -0
  596. package/dist/images-LY7AWWBK.js +90 -0
  597. package/dist/images-LY7AWWBK.js.map +1 -0
  598. package/dist/improve-W6GZNT2A.js +86 -0
  599. package/dist/improve-W6GZNT2A.js.map +1 -0
  600. package/dist/ingest-47WON6HT.js +23 -0
  601. package/dist/ingest-47WON6HT.js.map +1 -0
  602. package/dist/ingest-HDGGHBSJ.js +107 -0
  603. package/dist/ingest-HDGGHBSJ.js.map +1 -0
  604. package/dist/insights-IW7LGAWU.js +423 -0
  605. package/dist/insights-IW7LGAWU.js.map +1 -0
  606. package/dist/insights-QH54F56A.js +122 -0
  607. package/dist/insights-QH54F56A.js.map +1 -0
  608. package/dist/inspect-AJLG2HGL.js +189 -0
  609. package/dist/inspect-AJLG2HGL.js.map +1 -0
  610. package/dist/inspiration-RDQ3Y3N3.js +53 -0
  611. package/dist/inspiration-RDQ3Y3N3.js.map +1 -0
  612. package/dist/intent-5GSSCFZ2.js +95 -0
  613. package/dist/intent-5GSSCFZ2.js.map +1 -0
  614. package/dist/job-URVXJP75.js +202 -0
  615. package/dist/job-URVXJP75.js.map +1 -0
  616. package/dist/job-create-S4SECUVF.js +109 -0
  617. package/dist/job-create-S4SECUVF.js.map +1 -0
  618. package/dist/job-status-253SUCTJ.js +74 -0
  619. package/dist/job-status-253SUCTJ.js.map +1 -0
  620. package/dist/keep-GPSYDIGJ.js +78 -0
  621. package/dist/keep-GPSYDIGJ.js.map +1 -0
  622. package/dist/keyword-gap-NTFDX43B.js +130 -0
  623. package/dist/keyword-gap-NTFDX43B.js.map +1 -0
  624. package/dist/keyword-metrics-XSFLMBZX.js +197 -0
  625. package/dist/keyword-metrics-XSFLMBZX.js.map +1 -0
  626. package/dist/keywords-for-site-U4JLYXVE.js +128 -0
  627. package/dist/keywords-for-site-U4JLYXVE.js.map +1 -0
  628. package/dist/landing-AO72EGJ6.js +28 -0
  629. package/dist/landing-AO72EGJ6.js.map +1 -0
  630. package/dist/landings-NEF4PQL2.js +151 -0
  631. package/dist/landings-NEF4PQL2.js.map +1 -0
  632. package/dist/languages-3RDPPPTE.js +55 -0
  633. package/dist/languages-3RDPPPTE.js.map +1 -0
  634. package/dist/languages-CQX3YOIT.js +40 -0
  635. package/dist/languages-CQX3YOIT.js.map +1 -0
  636. package/dist/launches-GBHLJH5S.js +19 -0
  637. package/dist/launches-GBHLJH5S.js.map +1 -0
  638. package/dist/layerize-Q56C6LFG.js +190 -0
  639. package/dist/layerize-Q56C6LFG.js.map +1 -0
  640. package/dist/leads-JHUM6FYR.js +293 -0
  641. package/dist/leads-JHUM6FYR.js.map +1 -0
  642. package/dist/leads-UYZM2XQX.js +90 -0
  643. package/dist/leads-UYZM2XQX.js.map +1 -0
  644. package/dist/learn-D2KBGJHZ.js +203 -0
  645. package/dist/learn-D2KBGJHZ.js.map +1 -0
  646. package/dist/library-6VUFHTEK.js +109 -0
  647. package/dist/library-6VUFHTEK.js.map +1 -0
  648. package/dist/lighthouse-57U2GMPV.js +75 -0
  649. package/dist/lighthouse-57U2GMPV.js.map +1 -0
  650. package/dist/line-item-writes-R5GO6GTL.js +208 -0
  651. package/dist/line-item-writes-R5GO6GTL.js.map +1 -0
  652. package/dist/line-items-RBMH6YBZ.js +103 -0
  653. package/dist/line-items-RBMH6YBZ.js.map +1 -0
  654. package/dist/link-WS2RMCOP.js +64 -0
  655. package/dist/link-WS2RMCOP.js.map +1 -0
  656. package/dist/linkedin-FSIALZTS.js +1008 -0
  657. package/dist/linkedin-FSIALZTS.js.map +1 -0
  658. package/dist/list-2AE2Q4ZD.js +151 -0
  659. package/dist/list-2AE2Q4ZD.js.map +1 -0
  660. package/dist/list-E635Y6M4.js +303 -0
  661. package/dist/list-E635Y6M4.js.map +1 -0
  662. package/dist/list-G57ZO4PG.js +50 -0
  663. package/dist/list-G57ZO4PG.js.map +1 -0
  664. package/dist/list-JCSWZWDI.js +57 -0
  665. package/dist/list-JCSWZWDI.js.map +1 -0
  666. package/dist/list-KT6NXVLV.js +63 -0
  667. package/dist/list-KT6NXVLV.js.map +1 -0
  668. package/dist/list-RINCJOAC.js +76 -0
  669. package/dist/list-RINCJOAC.js.map +1 -0
  670. package/dist/list-SRNXHS6L.js +51 -0
  671. package/dist/list-SRNXHS6L.js.map +1 -0
  672. package/dist/list-YJSO4M5Q.js +65 -0
  673. package/dist/list-YJSO4M5Q.js.map +1 -0
  674. package/dist/locations-HW2Y5OJO.js +67 -0
  675. package/dist/locations-HW2Y5OJO.js.map +1 -0
  676. package/dist/locations-XOHI3VWI.js +40 -0
  677. package/dist/locations-XOHI3VWI.js.map +1 -0
  678. package/dist/log-3HX5BIO6.js +92 -0
  679. package/dist/log-3HX5BIO6.js.map +1 -0
  680. package/dist/logo-KXTGIYBI.js +18 -0
  681. package/dist/logo-KXTGIYBI.js.map +1 -0
  682. package/dist/lookup-X6O5UNJH.js +22 -0
  683. package/dist/lookup-X6O5UNJH.js.map +1 -0
  684. package/dist/make-QH77XOWM.js +633 -0
  685. package/dist/make-QH77XOWM.js.map +1 -0
  686. package/dist/map-QABBPYZM.js +404 -0
  687. package/dist/map-QABBPYZM.js.map +1 -0
  688. package/dist/mcp-HSD3W3OB.js +463 -0
  689. package/dist/mcp-HSD3W3OB.js.map +1 -0
  690. package/dist/media-MI4EE7L4.js +89 -0
  691. package/dist/media-MI4EE7L4.js.map +1 -0
  692. package/dist/media-QUTQOBA7.js +15 -0
  693. package/dist/media-QUTQOBA7.js.map +1 -0
  694. package/dist/media-sources-HO4DXRX5.js +32 -0
  695. package/dist/media-sources-HO4DXRX5.js.map +1 -0
  696. package/dist/members-YEYYJGY6.js +44 -0
  697. package/dist/members-YEYYJGY6.js.map +1 -0
  698. package/dist/meta-E3JOUOSS.js +69 -0
  699. package/dist/meta-E3JOUOSS.js.map +1 -0
  700. package/dist/metrics-HQ7XJAYQ.js +152 -0
  701. package/dist/metrics-HQ7XJAYQ.js.map +1 -0
  702. package/dist/models-PGX3FBHU.js +155 -0
  703. package/dist/models-PGX3FBHU.js.map +1 -0
  704. package/dist/normalize-FPJ6GSOY.js +806 -0
  705. package/dist/normalize-FPJ6GSOY.js.map +1 -0
  706. package/dist/normalize-GSQWN77S.js +141 -0
  707. package/dist/normalize-GSQWN77S.js.map +1 -0
  708. package/dist/options-F5XZMQLK.js +121 -0
  709. package/dist/options-F5XZMQLK.js.map +1 -0
  710. package/dist/output-GQFJ2T5B.js +24 -0
  711. package/dist/output-GQFJ2T5B.js.map +1 -0
  712. package/dist/page-VTTSBC6Y.js +105 -0
  713. package/dist/page-VTTSBC6Y.js.map +1 -0
  714. package/dist/pages-PMZVNVQM.js +66 -0
  715. package/dist/pages-PMZVNVQM.js.map +1 -0
  716. package/dist/performance-G67JQE5J.js +24 -0
  717. package/dist/performance-G67JQE5J.js.map +1 -0
  718. package/dist/pinterest-UDNGOWDM.js +96 -0
  719. package/dist/pinterest-UDNGOWDM.js.map +1 -0
  720. package/dist/pixels-OYZDGCH3.js +108 -0
  721. package/dist/pixels-OYZDGCH3.js.map +1 -0
  722. package/dist/pixels-XKGNTCFX.js +60 -0
  723. package/dist/pixels-XKGNTCFX.js.map +1 -0
  724. package/dist/plan-DZS3TVIJ.js +207 -0
  725. package/dist/plan-DZS3TVIJ.js.map +1 -0
  726. package/dist/preview-DR6MXOGI.js +169 -0
  727. package/dist/preview-DR6MXOGI.js.map +1 -0
  728. package/dist/profile-VOVZG44G.js +159 -0
  729. package/dist/profile-VOVZG44G.js.map +1 -0
  730. package/dist/promoted-tweet-writes-VCK2ADVJ.js +180 -0
  731. package/dist/promoted-tweet-writes-VCK2ADVJ.js.map +1 -0
  732. package/dist/promoted-tweets-4ACBP2RV.js +119 -0
  733. package/dist/promoted-tweets-4ACBP2RV.js.map +1 -0
  734. package/dist/properties-MKVF7MUK.js +101 -0
  735. package/dist/properties-MKVF7MUK.js.map +1 -0
  736. package/dist/publish-6XVA35T6.js +322 -0
  737. package/dist/publish-6XVA35T6.js.map +1 -0
  738. package/dist/query-CNWQ6STR.js +61 -0
  739. package/dist/query-CNWQ6STR.js.map +1 -0
  740. package/dist/query-DBSBZ73C.js +247 -0
  741. package/dist/query-DBSBZ73C.js.map +1 -0
  742. package/dist/query-QK4U4TEL.js +236 -0
  743. package/dist/query-QK4U4TEL.js.map +1 -0
  744. package/dist/questionnaire-OVJWNUVV.js +93 -0
  745. package/dist/questionnaire-OVJWNUVV.js.map +1 -0
  746. package/dist/read-L2QIVJTL.js +141 -0
  747. package/dist/read-L2QIVJTL.js.map +1 -0
  748. package/dist/reddit-SCEB2JQL.js +26 -0
  749. package/dist/reddit-SCEB2JQL.js.map +1 -0
  750. package/dist/refresh-TIH5Y3NP.js +94 -0
  751. package/dist/refresh-TIH5Y3NP.js.map +1 -0
  752. package/dist/release-LKMUKVXM.js +60 -0
  753. package/dist/release-LKMUKVXM.js.map +1 -0
  754. package/dist/relevant-pages-CRI2NLWG.js +99 -0
  755. package/dist/relevant-pages-CRI2NLWG.js.map +1 -0
  756. package/dist/remove-6ABOB7TZ.js +50 -0
  757. package/dist/remove-6ABOB7TZ.js.map +1 -0
  758. package/dist/remove-JKSCGKQG.js +48 -0
  759. package/dist/remove-JKSCGKQG.js.map +1 -0
  760. package/dist/reopen-27TDNXFP.js +63 -0
  761. package/dist/reopen-27TDNXFP.js.map +1 -0
  762. package/dist/rerun-XHECBJD5.js +84 -0
  763. package/dist/rerun-XHECBJD5.js.map +1 -0
  764. package/dist/research-4MOXIMDX.js +62 -0
  765. package/dist/research-4MOXIMDX.js.map +1 -0
  766. package/dist/research-XYXP7D4R.js +262 -0
  767. package/dist/research-XYXP7D4R.js.map +1 -0
  768. package/dist/reset-NLYEBPLX.js +54 -0
  769. package/dist/reset-NLYEBPLX.js.map +1 -0
  770. package/dist/reset-RDQOYBXX.js +54 -0
  771. package/dist/reset-RDQOYBXX.js.map +1 -0
  772. package/dist/resolve-VHKWC5KW.js +121 -0
  773. package/dist/resolve-VHKWC5KW.js.map +1 -0
  774. package/dist/retry-MTQSHXKH.js +60 -0
  775. package/dist/retry-MTQSHXKH.js.map +1 -0
  776. package/dist/retry-ZI5ECSFD.js +62 -0
  777. package/dist/retry-ZI5ECSFD.js.map +1 -0
  778. package/dist/retry-failed-2OYMCB55.js +45 -0
  779. package/dist/retry-failed-2OYMCB55.js.map +1 -0
  780. package/dist/run-BMJJRJL2.js +65 -0
  781. package/dist/run-BMJJRJL2.js.map +1 -0
  782. package/dist/run-IHXS6F5V.js +59 -0
  783. package/dist/run-IHXS6F5V.js.map +1 -0
  784. package/dist/scaffold-ad-QEADKYPL.js +1548 -0
  785. package/dist/scaffold-ad-QEADKYPL.js.map +1 -0
  786. package/dist/scaffold-static-ad-PTJ73ZNF.js +971 -0
  787. package/dist/scaffold-static-ad-PTJ73ZNF.js.map +1 -0
  788. package/dist/scaffold-video-ZQEZRVD6.js +872 -0
  789. package/dist/scaffold-video-ZQEZRVD6.js.map +1 -0
  790. package/dist/schedule-JD2EQJCT.js +61 -0
  791. package/dist/schedule-JD2EQJCT.js.map +1 -0
  792. package/dist/schedule-TLYT5UXM.js +66 -0
  793. package/dist/schedule-TLYT5UXM.js.map +1 -0
  794. package/dist/scheduled-agents-GIVKWTXX.js +49 -0
  795. package/dist/scheduled-agents-GIVKWTXX.js.map +1 -0
  796. package/dist/schema-MZTVCNP4.js +63 -0
  797. package/dist/schema-MZTVCNP4.js.map +1 -0
  798. package/dist/schema-RYTVKPLZ.js +132 -0
  799. package/dist/schema-RYTVKPLZ.js.map +1 -0
  800. package/dist/scrape-T3DA7ER7.js +2241 -0
  801. package/dist/scrape-T3DA7ER7.js.map +1 -0
  802. package/dist/screenshot-EIGC6SZB.js +102 -0
  803. package/dist/screenshot-EIGC6SZB.js.map +1 -0
  804. package/dist/search-2SVUDZIX.js +224 -0
  805. package/dist/search-2SVUDZIX.js.map +1 -0
  806. package/dist/search-34NFJ5F6.js +26 -0
  807. package/dist/search-34NFJ5F6.js.map +1 -0
  808. package/dist/search-AOFAN5NB.js +174 -0
  809. package/dist/search-AOFAN5NB.js.map +1 -0
  810. package/dist/search-BWE3OPOY.js +91 -0
  811. package/dist/search-BWE3OPOY.js.map +1 -0
  812. package/dist/search-EYYAOZND.js +92 -0
  813. package/dist/search-EYYAOZND.js.map +1 -0
  814. package/dist/search-copy-VKQ2OOBM.js +168 -0
  815. package/dist/search-copy-VKQ2OOBM.js.map +1 -0
  816. package/dist/seeds-HQYSVFIX.js +101 -0
  817. package/dist/seeds-HQYSVFIX.js.map +1 -0
  818. package/dist/select-HJMOAWAU.js +94 -0
  819. package/dist/select-HJMOAWAU.js.map +1 -0
  820. package/dist/sends-I7VQFE4S.js +309 -0
  821. package/dist/sends-I7VQFE4S.js.map +1 -0
  822. package/dist/sequences-JHSEJJGN.js +146 -0
  823. package/dist/sequences-JHSEJJGN.js.map +1 -0
  824. package/dist/set-prompt-TSS33JQZ.js +185 -0
  825. package/dist/set-prompt-TSS33JQZ.js.map +1 -0
  826. package/dist/setup-links-IW4BUANK.js +141 -0
  827. package/dist/setup-links-IW4BUANK.js.map +1 -0
  828. package/dist/{shared-J7DQZ2ED.js → shared-AT3FXPAG.js} +8 -6
  829. package/dist/shared-AT3FXPAG.js.map +1 -0
  830. package/dist/shopify-RQKO5TMR.js +3819 -0
  831. package/dist/shopify-RQKO5TMR.js.map +1 -0
  832. package/dist/site-3NU2BDAR.js +177 -0
  833. package/dist/site-3NU2BDAR.js.map +1 -0
  834. package/dist/sitemaps-FG37N5EB.js +87 -0
  835. package/dist/sitemaps-FG37N5EB.js.map +1 -0
  836. package/dist/sites-FIXK4Y3O.js +101 -0
  837. package/dist/sites-FIXK4Y3O.js.map +1 -0
  838. package/dist/skills-OKVCVQVD.js +47 -0
  839. package/dist/skills-OKVCVQVD.js.map +1 -0
  840. package/dist/sources-SEODRUIC.js +30 -0
  841. package/dist/sources-SEODRUIC.js.map +1 -0
  842. package/dist/sources-Z6BGTBGO.js +421 -0
  843. package/dist/sources-Z6BGTBGO.js.map +1 -0
  844. package/dist/stale-SWPDWXG7.js +63 -0
  845. package/dist/stale-SWPDWXG7.js.map +1 -0
  846. package/dist/stats-ZWZ7BAHV.js +34 -0
  847. package/dist/stats-ZWZ7BAHV.js.map +1 -0
  848. package/dist/status-7Y7UNSO6.js +62 -0
  849. package/dist/status-7Y7UNSO6.js.map +1 -0
  850. package/dist/sticker-FLRZM3BI.js +94 -0
  851. package/dist/sticker-FLRZM3BI.js.map +1 -0
  852. package/dist/stock-2CSMWRWV.js +179 -0
  853. package/dist/stock-2CSMWRWV.js.map +1 -0
  854. package/dist/studio-TTTR6N7D.js +49 -0
  855. package/dist/studio-TTTR6N7D.js.map +1 -0
  856. package/dist/sync-FH773IFH.js +54 -0
  857. package/dist/sync-FH773IFH.js.map +1 -0
  858. package/dist/sync-G5CS2RYV.js +54 -0
  859. package/dist/sync-G5CS2RYV.js.map +1 -0
  860. package/dist/sync-UADA6M33.js +265 -0
  861. package/dist/sync-UADA6M33.js.map +1 -0
  862. package/dist/sync-definition-77KLGPMA.js +52 -0
  863. package/dist/sync-definition-77KLGPMA.js.map +1 -0
  864. package/dist/tag-manager-NK3ZHSJB.js +43 -0
  865. package/dist/tag-manager-NK3ZHSJB.js.map +1 -0
  866. package/dist/tags-ANGHHLAC.js +20 -0
  867. package/dist/tags-ANGHHLAC.js.map +1 -0
  868. package/dist/tags-DKPUSQTJ.js +20 -0
  869. package/dist/tags-DKPUSQTJ.js.map +1 -0
  870. package/dist/tags-HSCV4ZAQ.js +20 -0
  871. package/dist/tags-HSCV4ZAQ.js.map +1 -0
  872. package/dist/tags-J3RMQEQM.js +26 -0
  873. package/dist/tags-J3RMQEQM.js.map +1 -0
  874. package/dist/tags-VZGTR3VJ.js +224 -0
  875. package/dist/tags-VZGTR3VJ.js.map +1 -0
  876. package/dist/targeting-constants-ZGBX3VWU.js +118 -0
  877. package/dist/targeting-constants-ZGBX3VWU.js.map +1 -0
  878. package/dist/targeting-criteria-BSG3CLHU.js +113 -0
  879. package/dist/targeting-criteria-BSG3CLHU.js.map +1 -0
  880. package/dist/targets-DVOAFYZQ.js +102 -0
  881. package/dist/targets-DVOAFYZQ.js.map +1 -0
  882. package/dist/templates-KJ5O44FF.js +178 -0
  883. package/dist/templates-KJ5O44FF.js.map +1 -0
  884. package/dist/testimonials-NB7V3DUO.js +32 -0
  885. package/dist/testimonials-NB7V3DUO.js.map +1 -0
  886. package/dist/themes-3RV3HNNE.js +94 -0
  887. package/dist/themes-3RV3HNNE.js.map +1 -0
  888. package/dist/top-companies-KRB3OZOT.js +108 -0
  889. package/dist/top-companies-KRB3OZOT.js.map +1 -0
  890. package/dist/translate-5FP32BIA.js +598 -0
  891. package/dist/translate-5FP32BIA.js.map +1 -0
  892. package/dist/triggers-EURHTCYC.js +141 -0
  893. package/dist/triggers-EURHTCYC.js.map +1 -0
  894. package/dist/tweets-X64YDEAA.js +123 -0
  895. package/dist/tweets-X64YDEAA.js.map +1 -0
  896. package/dist/unfollow-PIONCSBL.js +46 -0
  897. package/dist/unfollow-PIONCSBL.js.map +1 -0
  898. package/dist/unlink-HVVTZ3MB.js +67 -0
  899. package/dist/unlink-HVVTZ3MB.js.map +1 -0
  900. package/dist/unstage-BJJ5M7MK.js +95 -0
  901. package/dist/unstage-BJJ5M7MK.js.map +1 -0
  902. package/dist/unstage-Y7ZE3NUJ.js +84 -0
  903. package/dist/unstage-Y7ZE3NUJ.js.map +1 -0
  904. package/dist/update-3IP7FB6Y.js +98 -0
  905. package/dist/update-3IP7FB6Y.js.map +1 -0
  906. package/dist/update-CSDSK5NO.js +63 -0
  907. package/dist/update-CSDSK5NO.js.map +1 -0
  908. package/dist/update-FGJXVDB7.js +142 -0
  909. package/dist/update-FGJXVDB7.js.map +1 -0
  910. package/dist/update-MF7LY2OT.js +155 -0
  911. package/dist/update-MF7LY2OT.js.map +1 -0
  912. package/dist/upload-DDPI7KJV.js +126 -0
  913. package/dist/upload-DDPI7KJV.js.map +1 -0
  914. package/dist/upload-IWFYKD7A.js +150 -0
  915. package/dist/upload-IWFYKD7A.js.map +1 -0
  916. package/dist/upscale-EYCEYRWE.js +109 -0
  917. package/dist/upscale-EYCEYRWE.js.map +1 -0
  918. package/dist/url-options-RA3XISLN.js +130 -0
  919. package/dist/url-options-RA3XISLN.js.map +1 -0
  920. package/dist/url-params-SN4APXCK.js +98 -0
  921. package/dist/url-params-SN4APXCK.js.map +1 -0
  922. package/dist/use-E2TA2K6J.js +95 -0
  923. package/dist/use-E2TA2K6J.js.map +1 -0
  924. package/dist/validate-W52JOEXI.js +88 -0
  925. package/dist/validate-W52JOEXI.js.map +1 -0
  926. package/dist/variant-ETHB6XUM.js +338 -0
  927. package/dist/variant-ETHB6XUM.js.map +1 -0
  928. package/dist/videos-653WAFPG.js +39 -0
  929. package/dist/videos-653WAFPG.js.map +1 -0
  930. package/dist/view-BVEZRRV2.js +121 -0
  931. package/dist/view-BVEZRRV2.js.map +1 -0
  932. package/dist/viewer-check-W4ICSBHO.js +68 -0
  933. package/dist/viewer-check-W4ICSBHO.js.map +1 -0
  934. package/dist/web-JWIGFGIU.js +140 -0
  935. package/dist/web-JWIGFGIU.js.map +1 -0
  936. package/dist/winners-MJDKCGEZ.js +113 -0
  937. package/dist/winners-MJDKCGEZ.js.map +1 -0
  938. package/dist/winning-ads-O3IMUGGO.js +84 -0
  939. package/dist/winning-ads-O3IMUGGO.js.map +1 -0
  940. package/dist/write-commands-DA6FIFAO.js +737 -0
  941. package/dist/write-commands-DA6FIFAO.js.map +1 -0
  942. package/dist/write-commands-EMN2WENA.js +1015 -0
  943. package/dist/write-commands-EMN2WENA.js.map +1 -0
  944. package/dist/write-commands-KTPISQRE.js +206 -0
  945. package/dist/write-commands-KTPISQRE.js.map +1 -0
  946. package/dist/write-commands-QBGIWU27.js +713 -0
  947. package/dist/write-commands-QBGIWU27.js.map +1 -0
  948. package/dist/x-BT3SNCTU.js +47 -0
  949. package/dist/x-BT3SNCTU.js.map +1 -0
  950. package/package.json +9 -2
  951. package/dist/chunk-CHJOTJTZ.js +0 -9989
  952. package/dist/chunk-CHJOTJTZ.js.map +0 -1
  953. package/dist/chunk-HJEMOSPH.js +0 -1292
  954. package/dist/chunk-HJEMOSPH.js.map +0 -1
  955. package/dist/chunk-MF7YA62W.js.map +0 -1
  956. package/dist/chunk-VLUGGVJL.js.map +0 -1
  957. package/dist/chunk-VZEDAFAR.js.map +0 -1
  958. package/dist/chunk-XHC4LMK4.js.map +0 -1
  959. package/dist/client-GR6YL3YX.js +0 -17
  960. package/dist/output-NMQXZF3Z.js +0 -18
  961. /package/dist/{client-GR6YL3YX.js.map → chunk-YQSBHWOI.js.map} +0 -0
  962. /package/dist/{env-4P5HOGNA.js.map → client-EURRWXPW.js.map} +0 -0
  963. /package/dist/{output-NMQXZF3Z.js.map → connect-4YXFMXYX.js.map} +0 -0
  964. /package/dist/{shared-J7DQZ2ED.js.map → customers-7E4HBSEY.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engine/nodes/local/lib/render-review.ts"],"sourcesContent":["import { execFile } from \"node:child_process\";\nimport { mkdtemp, readdir, readFile, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { z } from \"zod\";\nimport { hasOpenRouterKey, openRouterKey } from \"../../../../env.ts\";\n\n/**\n * Somebody looks at the finished video.\n *\n * Until this existed, nothing in the pipeline ever saw a generated clip. The\n * frame-vision pass (`hyperframe-check.ts`) reads the HTML composition — captions,\n * overlay, legibility — and stops there; what the video model actually returned was\n * never opened by anything. The gap is not theoretical. A finished 28-second ad\n * shipped with:\n *\n * • two fitters mounting a solar panel lying across the roof tiles with no rails\n * under it, one of them drilling into the face of the module;\n * • a bracket base and a phone floating unattached in shot;\n * • a worker missing a leg;\n * • four different men playing what the script treats as one customer;\n * • no brand mark in any frame, and no closing card — it ends on a man shuffling\n * blank paper, four seconds after the last caption.\n *\n * Every one is obvious to anyone watching and invisible to every check the run\n * already had. Reviewing the render is not a nicety layered on top: it is the first\n * time anything in the system looks at the thing it sold.\n *\n * Reported, never blocking. The render is already paid for by the time this runs, so\n * discarding it would burn the credits twice; the findings come back as the work to\n * do on the next pass.\n */\n\n/**\n * The dense model, not the fast one — measured, not assumed.\n *\n * Asked about the frame holding the panel with no rails under it, `gemini-flash-latest`\n * answered \"nothing wrong\" at 512px, at 1024px, and alone on a single frame. The same\n * frame and the same question on `gemini-pro-latest` came back with the missing rails,\n * the hovering bracket and a worker's missing leg. A cheap reviewer that always says\n * clean is worse than none: it launders an unwatched render as a checked one.\n *\n * `~google/…` is the floating alias: OpenRouter resolves it per request, so the pass\n * follows the current Pro tier instead of a version somebody has to remember to bump.\n * Safe to float here in a way it was not before — the price now comes back with the\n * answer, so a model swap underneath cannot put a stale rate in the ledger.\n */\nexport const RENDER_REVIEW_MODEL = \"~google/gemini-pro-latest\";\n\n/** How many frames the reviewer sees. */\nexport const RENDER_REVIEW_FRAMES = 12;\n\n/** Widest edge of a sampled frame, in pixels. */\nexport const RENDER_REVIEW_WIDTH = 1024;\n\n/**\n * The model that WATCHES the finished ad, as opposed to the one that reads stills.\n *\n * A flash tier on purpose: this pass uploads the whole video, so it is the expensive one\n * to run, and the questions it answers (is this the right accent, does the voice fit the\n * mouth, do the cuts hold) are judgements a flash model makes as well as a pro one.\n *\n * Floating, like the stills model above, and for the same reason. Measured 2026-09-17,\n * the alias resolves to `google/gemini-3.8-flash` — which a pinned `gemini-3.7-flash`\n * would have kept us off for no reason anybody had decided.\n */\nexport const RENDER_WATCH_MODEL = \"~google/gemini-flash-latest\";\n\n/**\n * What one review call spent, as the GATEWAY reports it.\n *\n * `usage.cost` is OpenRouter's own charge for the call, in dollars, returned with the\n * answer because the request opts in with `usage: { include: true }` — the same thing\n * every other provider call on this platform does. So there is no price list to keep:\n * the sandbox relays the provider's number instead of computing one, and `reportCost`\n * records it exactly as it records a canvas node's.\n *\n * This pass used to call Gemini directly, on the stated grounds that the video goes up\n * inline and OpenRouter had no route that takes one. It does: a `video_url` content part\n * accepts a base64 data URL, verified end to end against this account — HTTP 200, 128\n * video tokens counted, the model describing the clip it was sent. The direct route cost\n * a hand-maintained price table, a second credential in every Runtime, and a model id\n * that had to stay pinned so the table's key would not drift out from under it.\n *\n * Tokens are still carried, because they are what a human reads when asking why a review\n * cost what it did. The dollars are what the ledger uses.\n */\nexport type ReviewUsage = { model: string; inputTokens: number; outputTokens: number; costUsd: number };\n\ntype UsageSink = (usage: ReviewUsage) => void;\n\n/**\n * The gateway's own accounting, as returned. Absent on a failed call, which costs nothing.\n *\n * The cost is the first STRICTLY POSITIVE of `usage.cost` and\n * `cost_details.upstream_inference_cost`, which is the rule `extractCostUsd` already\n * states in `convex/lib/canvasOpenRouter.ts`: on a BYOK, cached or free-tier route\n * OpenRouter charges 0 while the upstream figure is what the company actually owes, and\n * picking the first DEFINED value instead reports that call as free. Duplicated rather\n * than imported because the backend is not on this side of the wire; if the two ever\n * have to disagree, that is the bug.\n */\nexport function usageFrom(model: string, body: unknown): ReviewUsage | null {\n const usage = (\n body as {\n usage?: {\n prompt_tokens?: number;\n completion_tokens?: number;\n cost?: number;\n cost_details?: { upstream_inference_cost?: number };\n };\n }\n )?.usage;\n if (!usage) return null;\n const positive = (value: number | undefined): number | null =>\n typeof value === \"number\" && Number.isFinite(value) && value > 0 ? value : null;\n return {\n model,\n inputTokens: usage.prompt_tokens ?? 0,\n outputTokens: usage.completion_tokens ?? 0,\n costUsd: positive(usage.cost) ?? positive(usage.cost_details?.upstream_inference_cost) ?? 0,\n };\n}\n\n/** Above this the video is not watched at all, rather than watched in part. */\nexport const WATCH_MAX_BYTES = 60 * 1024 * 1024;\n\n/** The items of the static review prompt (`static-review.ts` `buildStaticReviewPrompt`), as the model names the one a finding answers. */\nexport const STATIC_REVIEW_ITEMS = [\n \"text\",\n \"logo\",\n \"layout\",\n \"safe_zone\",\n \"picture\",\n \"subject\",\n \"person\",\n \"people\",\n \"one_idea\",\n \"thumbnail\",\n \"concept\",\n \"viewer\",\n \"proof\",\n \"sizes\",\n \"native\",\n \"other\",\n] as const;\n/** What on the ad a finding is about: its own words, its button, its logo, words printed on something in the scene, or the picture. */\nexport const FINDING_ELEMENTS = [\"copy\", \"button\", \"logo\", \"scene_text\", \"picture\", \"other\"] as const;\n/** What is wrong with it: cut by the frame, not there, too blurred to read, or anything else. */\nexport const FINDING_DEFECTS = [\"cut\", \"missing\", \"unreadable\", \"other\"] as const;\nexport const FRAME_EDGES = [\"top\", \"bottom\", \"left\", \"right\"] as const;\n\n/**\n * What the static review model says a finding is, in typed fields it fills beside its words, so the\n * code that grades and corrects the ad never matches the words themselves.\n */\nexport type FindingKind = {\n item: (typeof STATIC_REVIEW_ITEMS)[number];\n element: (typeof FINDING_ELEMENTS)[number];\n defect: (typeof FINDING_DEFECTS)[number];\n /** For an element the frame cuts, the edges it is cut at; none otherwise. */\n edges: Array<(typeof FRAME_EDGES)[number]>;\n};\n\nexport type RenderFinding = {\n severity: \"blocking\" | \"warning\";\n /** What is wrong, in the words the agent has to act on. */\n what: string;\n /** The scene file to edit to fix it, when the finding belongs to one shot. */\n scene?: string;\n /** What the static review model said it is (`FindingKind`); none for a finding the code measured. Never sent to the run record. */\n kind?: FindingKind;\n};\n\n/** One shot's slot on the finished timeline, and the file that describes it. */\nexport type SceneWindow = { file: string; startS: number; endS: number };\n\n/**\n * The scene a moment belongs to.\n *\n * A finding that says \"at 18.36s a worker stands on a solar panel\" is only half an\n * instruction: somebody still has to work out which of six shot briefs produced that\n * second. The blueprint already knows — every scene file carries `start_s`/`end_s` —\n * so the finding can name the file to edit instead of leaving that as homework. Re-run\n * after editing and the cache regenerates only the beat that changed.\n */\nexport function sceneAt(windows: SceneWindow[], atS: number): string | undefined {\n return windows.find((w) => atS >= w.startS && atS < w.endS)?.file;\n}\n\n/**\n * The frames to look at, spread across the whole runtime.\n *\n * Evenly spaced rather than sampled at a fixed rate: a rate that catches a 4-second\n * defect in a 20s ad misses it in a 60s one, and the frame count is what costs. The\n * last frame is taken explicitly — the closing card is exactly what a spread sample\n * lands just short of, and a dead ending was one of the defects that shipped.\n */\nexport function reviewFrameTimes(durationS: number, frames: number): number[] {\n const n = Math.max(2, frames);\n const last = Math.max(0, durationS - 0.15);\n const step = last / (n - 1);\n return Array.from({ length: n }, (_, i) => Math.round(i * step * 100) / 100);\n}\n\n/** ffmpeg args that pull one frame at `atS`. */\nexport function buildFrameGrabArgs(video: string, atS: number, out: string): string[] {\n return [\n \"-v\",\n \"error\",\n \"-ss\",\n String(atS),\n \"-i\",\n video,\n \"-frames:v\",\n \"1\",\n \"-vf\",\n `scale=${RENDER_REVIEW_WIDTH}:-2`,\n out,\n \"-y\",\n ];\n}\n\nconst FrameReview = z.object({\n /** Something in shot that could not happen, or is being done wrong. */\n impossible: z.array(z.string()).default([]),\n /** Objects present in frame that belong to no part of the scene. */\n strays: z.array(z.string()).default([]),\n});\n\nconst ReelReview = z.object({\n /** Whether the people the script treats as one person stay one person. */\n cast_is_consistent: z.boolean().default(true),\n cast_note: z.string().default(\"\"),\n /** Whether the advertiser's mark is visible anywhere. */\n brand_mark_visible: z.boolean().default(false),\n /** Whether the last frames close the ad rather than trailing off. */\n ends_on_a_close: z.boolean().default(false),\n ending_note: z.string().default(\"\"),\n /** Whether the ad ever cuts away from the presenter to show anything. */\n shows_more_than_a_face: z.boolean().default(true),\n shows_note: z.string().default(\"\"),\n});\n\n/**\n * What is wrong with ONE frame.\n *\n * Asked per frame rather than over the batch, because the batch answers like a\n * summary. Given all twelve at once the model reported the single worst thing it\n * saw; given the rooftop frame alone it reported the missing rails, the hovering\n * bracket and the missing leg. The questions are closed and each names a defect that\n * reached a finished ad — an open \"review this\" comes back as praise.\n */\nexport function buildFrameReviewPrompt(opts: { subject?: string }): string {\n const subject = opts.subject ? ` The advertiser is ${opts.subject}.` : \"\";\n return (\n `This is ONE frame from a video advertisement.${subject}\\n\\n` +\n `Answer only about what is visible in THIS frame. Do not judge whether the ad is good, ` +\n `and do not comment on style, mood or lighting.\\n\\n` +\n `1. IMPOSSIBLE OR WRONG. Is anything shown that could not physically happen, or that ` +\n `shows the job being done incorrectly? Judge the PROCEDURE, not only the physics: ` +\n `equipment resting where it would never rest, a component fitted to nothing, someone ` +\n `handling a part in a way that would damage it, an object at the wrong scale beside a ` +\n `person, a body with a limb missing or duplicated.\\n` +\n `2. STRAYS. Is any object present that belongs to no part of the scene — floating, ` +\n `unattached, or cut off from whatever should hold it?\\n\\n` +\n `Report only what you can actually see. An empty list is the right answer for a clean ` +\n `frame. Keep each item under twelve words.\\n\\n` +\n `Reply with only this JSON: {\"impossible\":[],\"strays\":[]}`\n );\n}\n\n/**\n * What is wrong with the reel as a whole.\n *\n * These three cannot be asked of one frame: whether the customer is the same person\n * throughout, whether the mark appears anywhere at all, and whether the last shot\n * closes the ad. All three shipped broken in the same render.\n */\nexport function buildReelReviewPrompt(opts: { subject?: string; script?: string }): string {\n const subject = opts.subject ? ` The advertiser is ${opts.subject}.` : \"\";\n const script = opts.script ? `\\n\\nThe voiceover says, in order:\\n${opts.script}` : \"\";\n return (\n `These frames are sampled in order from one video advertisement.${subject}` +\n script +\n `\\n\\nAnswer only about what is visible.\\n\\n` +\n `1. CAST. Do the people stay the same people? If the script speaks about one customer ` +\n `and the frames show different faces in that role, say so and count them.\\n` +\n `2. BRAND. Is the advertiser's logo or wordmark visible in ANY frame? Answer yes only if ` +\n `you can actually see a mark — a colour is not a mark.\\n` +\n `3. ENDING. Do the final frames close the advertisement — a call to action, a mark, a ` +\n `card — or does the picture simply carry on and stop?\\n` +\n `4. WHAT IT SHOWS. Does the advertisement ever cut away from the person to show the ` +\n `thing it is selling, or its result? Answer false if every frame is the same person ` +\n `with only the framing changed, and nothing is ever shown.\\n\\n` +\n `Reply with only this JSON:\\n` +\n `{\"cast_is_consistent\":true,\"cast_note\":\"\",\"brand_mark_visible\":false,` +\n `\"ends_on_a_close\":false,\"ending_note\":\"\",\"shows_more_than_a_face\":true,\"shows_note\":\"\"}`\n );\n}\n\n/** The model's reply, as JSON, however it wrapped it. */\nexport function parseReviewJson(raw: string): unknown {\n const fenced = raw.match(/```(?:json)?\\s*([\\s\\S]*?)```/);\n const body = (fenced?.[1] ?? raw).trim();\n const start = body.indexOf(\"{\");\n const end = body.lastIndexOf(\"}\");\n if (start === -1 || end === -1 || end < start) return null;\n try {\n return JSON.parse(body.slice(start, end + 1));\n } catch {\n return null;\n }\n}\n\n/** Same complaint, different words — enough to collapse repeats of one defect. */\nconst normalise = (s: string) =>\n s\n .toLowerCase()\n .replace(/[^a-z0-9 ]/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n\n/**\n * Per-frame answers, collapsed into one list of findings.\n *\n * A defect that persists across a shot is reported by every frame of it, so the same\n * complaint arrives up to a dozen times. Deduplicated on the wording and stamped with\n * where it was seen, which is also what tells the agent WHICH beat to re-render.\n */\nconst ANATOMY = /\\b(finger|fingers|hand|hands|thumb|limb|leg|legs|arm|arms|foot|feet|anatomy)\\b/i;\n\n/** Each distinct complaint, with every frame time that reported it. */\nfunction collapseRepeats(frames: { at: number; json: unknown }[]): { what: string; at: number[] }[] {\n const seen = new Map<string, { what: string; at: number[] }>();\n for (const frame of frames) {\n const parsed = FrameReview.safeParse(frame.json);\n if (!parsed.success) continue;\n for (const item of [...parsed.data.impossible, ...parsed.data.strays]) {\n const text = item.trim();\n const key = normalise(text);\n if (!key) continue;\n const hit = seen.get(key);\n if (hit) hit.at.push(frame.at);\n else seen.set(key, { what: text, at: [frame.at] });\n }\n }\n return [...seen.values()];\n}\n\nexport function classifyFrameFindings(\n frames: { at: number; json: unknown }[],\n windows: SceneWindow[] = [],\n): RenderFinding[] {\n const seen = collapseRepeats(frames);\n // Mangled hands are the signature failure of every video model, so they arrive\n // once per frame in slightly different words and bury everything else. Rolled up\n // into one finding about the render, which is also the honest reading: anatomy\n // broken in most frames is not a note, it is a reason not to ship the take.\n const anatomy = seen.filter((f) => ANATOMY.test(f.what));\n const rest = seen.filter((f) => !ANATOMY.test(f.what));\n const findings = rest.map((f) => {\n const scene = sceneAt(windows, f.at[0] as number);\n return {\n severity: \"blocking\" as const,\n what: `At ${f.at.map((s) => `${s}s`).join(\", \")}${scene ? ` (${scene})` : \"\"}: ${f.what}`,\n ...(scene ? { scene } : {}),\n };\n });\n if (anatomy.length > 0) {\n const at = [...new Set(anatomy.flatMap((f) => f.at))].sort((a, b) => a - b);\n findings.push({\n severity: \"blocking\",\n what:\n `Malformed hands or limbs in ${at.length} of ${frames.length} sampled frames ` +\n `(${at.map((s) => `${s}s${sceneAt(windows, s) ? ` → ${sceneAt(windows, s)}` : \"\"}`).join(\", \")}): ` +\n `${anatomy.map((f) => f.what).join(\" \")} ` +\n \"Re-render those beats — keep hands out of frame, or away from the object being held.\",\n });\n }\n return findings;\n}\n\n/** The whole-reel answer, as findings. */\n/**\n * The watch pass's question sheet.\n *\n * Deliberately narrow: only what a still cannot answer. The frame passes already cover\n * anatomy, legibility, the mark and the ending, and asking twice costs a second upload of\n * the whole video for an answer already in hand.\n *\n * The accent question asks for EVIDENCE, not just a verdict. Measured against a native\n * speaker's judgement on three ads, the model said \"peninsular\" where the ear heard Latin\n * American — so this under-reports, and a bare boolean would read as an all-clear it has\n * not earned. Quoting what it heard lets a human check the claim instead of trusting it.\n */\nexport function buildWatchReviewPrompt(opts: { market?: string; script?: string }): string {\n const market = opts.market?.trim();\n return (\n \"Watch and LISTEN to this advertisement, then answer about the things that only exist \" +\n \"in motion and in sound.\\n\" +\n `1. SPOKEN VARIETY. ${market ? `The ad is set in ${market}. ` : \"\"}Does the speaker's accent belong there? ` +\n \"Quote the words you heard that show it — a phonetic marker beats an impression.\\n\" +\n \"2. VOICE AND MOUTH. Does the voice belong to the mouth on screen, in timing and in person?\\n\" +\n \"3. CUTS. Do the shot changes hold, or does something jump, repeat or stutter between them?\\n\" +\n \"4. DEFECTS. List anything else wrong, each with the exact timestamp where it happens — a \" +\n \"moment maps to the shot that produced it, and a defect without one is a complaint rather \" +\n \"than an instruction.\\n\" +\n 'Answer JSON only: {\"spoken_variety_matches\":true|false,\"variety_note\":\"...\",' +\n '\"voice_matches_mouth\":true|false,\"mouth_note\":\"...\",' +\n '\"cuts_are_clean\":true|false,\"cuts_note\":\"...\",' +\n '\"defects\":[{\"at\":\"MM:SS.s\",\"kind\":\"cut|lipsync|audio|visual\",\"what\":\"...\"}]}'\n );\n}\n\n/**\n * What the WATCH pass answers — the questions a still cannot be asked.\n *\n * The frame passes are twelve stills, so everything between them is invisible and the\n * audio is not there at all. Three ads shipped in Latin American Spanish for a market of\n * Spain and the review said nothing, because an accent is not visible in a photograph; the\n * user heard it before the system did. Same for a voice that drifts off the lips, and for a\n * cut that only exists between two sampled moments.\n */\nconst WatchReview = z.object({\n spoken_variety_matches: z.boolean(),\n variety_note: z.string().default(\"\"),\n voice_matches_mouth: z.boolean(),\n mouth_note: z.string().default(\"\"),\n cuts_are_clean: z.boolean(),\n cuts_note: z.string().default(\"\"),\n});\n\n/**\n * The timed defects the watch pass reports, each one placed on the timeline.\n *\n * Asked for with a timestamp because a moment maps to a shot: \"abrupt jump cut at 00:06.8\"\n * becomes \"edit `scenes/s02.json`\", which is the difference between a complaint and an\n * instruction. Measured on a real ad the model returned five cuts and an English audio\n * fragment in a Spanish read, each with its second — none of which twelve stills could have\n * carried, and one of which nobody had noticed at all.\n *\n * No agentic processing involved: the timestamps come from asking for them.\n */\nconst WatchDefects = z.object({\n defects: z\n .array(\n z.object({\n at: z.string().default(\"\"),\n kind: z.string().default(\"\"),\n what: z.string().default(\"\"),\n }),\n )\n .default([]),\n});\n\n/** `MM:SS.s` or plain seconds → seconds, or null when it is neither. */\nexport function parseMoment(at: string): number | null {\n const trimmed = at.trim();\n const clock = /^(\\d+):(\\d+(?:\\.\\d+)?)$/.exec(trimmed);\n if (clock) return Number(clock[1]) * 60 + Number(clock[2]);\n const plain = Number(trimmed.replace(/s$/i, \"\"));\n return Number.isFinite(plain) ? plain : null;\n}\n\nexport function classifyWatchDefects(json: unknown, windows: SceneWindow[]): RenderFinding[] {\n const parsed = WatchDefects.safeParse(json);\n if (!parsed.success) return [];\n return parsed.data.defects\n .filter((d) => d.what.trim())\n .map((d) => {\n const at = parseMoment(d.at);\n const scene = at === null ? undefined : sceneAt(windows, at);\n const when = d.at.trim() ? ` at ${d.at.trim()}` : \"\";\n return {\n severity: \"warning\" as const,\n what: `${d.what.trim()}${when}${d.kind.trim() ? ` (${d.kind.trim()})` : \"\"}.`,\n ...(scene ? { scene } : {}),\n };\n });\n}\n\n/**\n * Whether the finished ad is the one that was ASKED for.\n *\n * Every other pass here grades the render against the spec, and that cannot answer this\n * question: both sides of that comparison came from the same reading of the request, so an\n * ad that executes a misread brief perfectly comes back clean. Four did, in a row, while\n * the person who asked caught a Latin American voice, a mouth dubbed over, a stand-in logo\n * and a customer repairing the panel she was there to praise.\n *\n * So this pass is given the request in the words it was made in, and nothing else about how\n * it was interpreted. Blocking, because an ad that is not what was asked for is not a\n * quality problem — it is the wrong ad, however well it is made.\n */\nconst FidelityReview = z.object({\n delivers_the_ask: z.boolean(),\n missing: z.array(z.string()).default([]),\n contradicted: z.array(z.string()).default([]),\n});\n\n/** The request, in the words it was made in, against what the video actually is. */\nexport function buildFidelityPrompt(brief: string): string {\n return (\n \"Someone asked for an advertisement in these words:\\n\\n\" +\n `\"\"\"${brief.trim()}\"\"\"\\n\\n` +\n \"Watch and LISTEN to the video, then answer only this: does it deliver what they asked \" +\n \"for? Judge the request as it was written — not what would make a good ad, and not what \" +\n \"you would have made. Two lists: what they asked for that is NOT in the video, and what \" +\n \"the video does that CONTRADICTS what they asked for. Quote their own words in each \" +\n \"entry so the answer can be checked. Empty lists when it delivers.\\n\" +\n 'Answer JSON only: {\"delivers_the_ask\":true|false,\"missing\":[\"...\"],\"contradicted\":[\"...\"]}'\n );\n}\n\nexport function classifyFidelityFindings(json: unknown): RenderFinding[] {\n const parsed = FidelityReview.safeParse(json);\n if (!parsed.success) return [];\n const r = parsed.data;\n if (r.delivers_the_ask) return [];\n return [...r.missing, ...r.contradicted]\n .map((entry) => entry.trim())\n .filter(Boolean)\n .map((what) => ({ severity: \"blocking\" as const, what: `Not what was asked for: ${what}.` }));\n}\n\n/** Turn the watch pass's answer into findings. Unreadable answers report nothing. */\nexport function classifyWatchFindings(json: unknown): RenderFinding[] {\n const parsed = WatchReview.safeParse(json);\n if (!parsed.success) return [];\n const r = parsed.data;\n const findings: RenderFinding[] = [];\n if (!r.spoken_variety_matches) {\n findings.push({\n severity: \"blocking\",\n what:\n `The voice speaks the wrong variety of the language${r.variety_note.trim() ? `: ${r.variety_note.trim()}` : \"\"}. ` +\n \"A pinned voice cannot fix this — the re-voicing is speech-to-speech and carries the accent \" +\n \"across, so state the market on the ad and let the clip prompt name the accent.\",\n });\n }\n if (!r.voice_matches_mouth) {\n findings.push({\n severity: \"blocking\",\n what:\n `The voice does not match the mouth${r.mouth_note.trim() ? `: ${r.mouth_note.trim()}` : \"\"}. ` +\n \"A person visibly speaking under a track that is not theirs reads as bad dubbing.\",\n });\n }\n if (!r.cuts_are_clean) {\n findings.push({\n severity: \"warning\",\n what: `The cuts do not hold${r.cuts_note.trim() ? `: ${r.cuts_note.trim()}` : \"\"}.`,\n });\n }\n return findings;\n}\n\nexport function classifyReelFindings(json: unknown): RenderFinding[] {\n const parsed = ReelReview.safeParse(json);\n if (!parsed.success) return [];\n const r = parsed.data;\n const findings: RenderFinding[] = [];\n if (!r.cast_is_consistent) {\n findings.push({\n severity: \"blocking\",\n what:\n `The cast changes between shots${r.cast_note.trim() ? `: ${r.cast_note.trim()}` : \"\"}. ` +\n \"One customer played by several faces reads as stock footage. Ground the frames on one \" +\n \"identity (`baker avatars`) or write the beats so the subject is never the same person twice.\",\n });\n }\n if (!r.brand_mark_visible) {\n findings.push({\n severity: \"warning\",\n what:\n \"No brand mark is visible in any frame. THIS IS NOT A RE-RENDER: the mark is drawn by the \" +\n \"caption composition as an ordinary `<img>`, never generated as a picture — so fix the mark \" +\n \"itself (a bad path, or an SVG whose geometry clips its own wordmark) or the `.brand-mark` / \" +\n \"`.endcard-logo` rules in `<composition>/index.html`, then re-run. Every clip comes back from \" +\n \"the cache and only the composition pass renders again, so it costs seconds and no generation.\",\n });\n }\n if (!r.shows_more_than_a_face) {\n findings.push({\n severity: \"blocking\",\n what:\n `The ad never shows what it is selling${r.shows_note.trim() ? `: ${r.shows_note.trim()}` : \"\"} — every frame is ` +\n \"the same person with only the framing changed. Give the middle beats their own picture (the bill, the roof, \" +\n \"the install, the house) and set `cast: false` on them.\",\n });\n }\n if (!r.ends_on_a_close) {\n findings.push({\n severity: \"warning\",\n what:\n `The video does not close${r.ending_note.trim() ? `: ${r.ending_note.trim()}` : \"\"} — it runs on ` +\n \"and stops. Give the last beat a call to action, and keep its shot short enough that the \" +\n \"picture ends with the read.\",\n });\n }\n return findings;\n}\n\n/**\n * The local file to review, out of whatever the run returned.\n *\n * A canvas ends in one output or several, and only a video is worth watching —\n * a static ad is the image gate's business, not this one. The LAST video wins:\n * the caption pass and the music mix each emit one, and the finished ad is the\n * one at the end of that chain.\n */\nexport function videoPathFromOutput(output: unknown): string | null {\n const refs = Array.isArray(output) ? output : [output];\n let found: string | null = null;\n for (const ref of refs) {\n const r = ref as { kind?: unknown; path?: unknown; mime?: unknown } | null;\n if (!r || typeof r !== \"object\") continue;\n const isVideo = r.kind === \"video\" || (typeof r.mime === \"string\" && r.mime.startsWith(\"video/\"));\n if (isVideo && typeof r.path === \"string\" && r.path) found = r.path;\n }\n return found;\n}\n\n/**\n * What the finished audio measures, as opposed to what it sounds like.\n *\n * A model looking at frames cannot hear, and asking one to judge a mix would be\n * guessing at something ffmpeg answers exactly. These are the failures that are\n * arithmetic: an ad with no audio at all, a mix so quiet nobody hears the bed, and one\n * pushed into the ceiling so the voice distorts.\n *\n * Measured on real renders: a music bed sitting at -41 dB was completely inaudible\n * under a continuous voiceover and read as \"no music\"; a healthy ad of the same length\n * measured -19.3 dB mean and -1.5 dB peak.\n */\n/** One `volumedetect` reading, in dB. `-inf` — real digital silence — survives as -Infinity. */\nfunction parseVolume(volumedetect: string, key: \"mean_volume\" | \"max_volume\"): number {\n const raw = new RegExp(`${key}:\\\\s*(-?(?:inf|[\\\\d.]+)) dB`).exec(volumedetect)?.[1];\n if (raw === undefined) return Number.NaN;\n if (raw === \"-inf\") return Number.NEGATIVE_INFINITY;\n return Number.parseFloat(raw);\n}\n\nexport function classifyAudio(volumedetect: string, hasAudioStream: boolean): RenderFinding[] {\n if (!hasAudioStream) {\n return [\n {\n severity: \"blocking\",\n what: \"The finished video has no audio track at all — no voice, no music, nothing. An ad that plays silent in a feed is not an ad.\",\n },\n ];\n }\n // `-inf` is a value ffmpeg really returns — it is what a stream of pure zeroes measures.\n // Read with a digits-only pattern both numbers came back NaN, every threshold below was\n // skipped, and a completely silent ad passed the audio review with nothing to report.\n const mean = parseVolume(volumedetect, \"mean_volume\");\n const max = parseVolume(volumedetect, \"max_volume\");\n const findings: RenderFinding[] = [];\n if (mean === Number.NEGATIVE_INFINITY || max === Number.NEGATIVE_INFINITY) {\n return [\n {\n severity: \"blocking\",\n what: \"The finished video has an audio track, but it is completely silent — digital zero from start to end. An ad that plays silent in a feed is not an ad.\",\n },\n ];\n }\n if (Number.isFinite(mean) && mean < -30) {\n findings.push({\n severity: \"warning\",\n what:\n `The mix is very quiet (${mean} dB average). On a phone at half volume this is close to silence — ` +\n \"check the music bed is not ducked into nothing under the voice.\",\n });\n }\n if (Number.isFinite(max) && max > -0.5) {\n findings.push({\n severity: \"warning\",\n what:\n `The mix peaks at ${max} dB, which is at or over the ceiling — the voice will distort on a phone speaker. ` +\n \"Bring the loudest track down a few dB.\",\n });\n }\n return findings;\n}\n\n/** What the agent is told when the reviewer could not run. */\nexport const RENDER_REVIEW_UNAVAILABLE =\n \"The render was NOT reviewed — no model gateway key in this environment. Watch it yourself before sending it on.\";\n\n/** Concurrent vision calls. Thirteen at once loses answers to the rate limit. */\nconst REVIEW_CONCURRENCY = 3;\n\n/** `Promise.all` with a ceiling, preserving order. */\nasync function mapWithLimit<T, R>(items: T[], limit: number, fn: (item: T) => Promise<R>): Promise<R[]> {\n const out = new Array<R>(items.length);\n let next = 0;\n await Promise.all(\n Array.from({ length: Math.min(limit, items.length) }, async () => {\n for (let i = next++; i < items.length; i = next++) {\n out[i] = await fn(items[i] as T);\n }\n }),\n );\n return out;\n}\n\nconst execFileAsync = promisify(execFile);\n\n/** What ffmpeg measures about the finished mix. Never throws: an unmeasurable mix is\n * reported as nothing rather than as a fault. */\nasync function measureAudio(video: string): Promise<RenderFinding[]> {\n const streams = await execFileAsync(\n \"ffprobe\",\n [\"-v\", \"error\", \"-select_streams\", \"a\", \"-show_entries\", \"stream=codec_type\", \"-of\", \"csv=p=0\", video],\n { timeout: 20_000 },\n ).catch(() => null);\n if (!streams) return [];\n const hasAudio = streams.stdout.trim().length > 0;\n if (!hasAudio) return classifyAudio(\"\", false);\n const vol = await execFileAsync(\"ffmpeg\", [\"-i\", video, \"-map\", \"0:a:0\", \"-af\", \"volumedetect\", \"-f\", \"null\", \"-\"], {\n timeout: 120_000,\n maxBuffer: 8 * 1024 * 1024,\n }).catch((e: { stderr?: string }) => ({ stdout: \"\", stderr: e.stderr ?? \"\" }));\n // volumedetect reports on stderr, and ffmpeg exits non-zero on the null muxer.\n return classifyAudio(vol.stderr ?? \"\", true);\n}\n\n/** Seconds of picture, or null when the file cannot be probed. */\nasync function videoDuration(video: string): Promise<number | null> {\n try {\n const { stdout } = await execFileAsync(\n \"ffprobe\",\n [\"-v\", \"error\", \"-show_entries\", \"format=duration\", \"-of\", \"default=nw=1:nk=1\", video],\n { timeout: 20_000 },\n );\n const seconds = Number.parseFloat(stdout.trim());\n return Number.isFinite(seconds) && seconds > 0 ? seconds : null;\n } catch {\n return null;\n }\n}\n\n/** One OpenRouter completion, or null when the gateway could not answer. */\ntype ReviewContentPart =\n | { type: \"text\"; text: string }\n | { type: \"image_url\"; image_url: { url: string } }\n | { type: \"video_url\"; video_url: { url: string } };\n\n/**\n * One call to the gateway, which is the only place this module talks to a model.\n *\n * `usage: { include: true }` is what makes the reply carry `usage.cost`, and carrying it\n * is why there is no price list on either side of this. Both passes come through here so\n * they cannot drift into two different ideas of what a call costs.\n *\n * Returns null on anything that is not a parseable answer — no key, a non-200, a reply\n * that is not JSON. The caller reports that as \"nobody looked\", never as \"clean\".\n */\n/** How much the model reasons before answering: `minimal` for a transcription, the model's own default for a judgment. */\nexport type GatewayReasoning = { effort: \"minimal\" | \"low\" | \"medium\" | \"high\" };\n\nasync function askGateway(\n model: string,\n parts: ReviewContentPart[],\n timeoutMs: number,\n spent: UsageSink,\n reasoning?: GatewayReasoning,\n /** More of the request: a pinned `provider`, a `temperature`, a `response_format`. */\n extra: Record<string, unknown> = {},\n): Promise<unknown> {\n const key = openRouterKey();\n if (!key) return null;\n try {\n const response = await fetch(\"https://openrouter.ai/api/v1/chat/completions\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", authorization: `Bearer ${key}` },\n body: JSON.stringify({\n model,\n messages: [{ role: \"user\", content: parts }],\n usage: { include: true },\n ...(reasoning ? { reasoning } : {}),\n ...extra,\n }),\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (!response.ok) return null;\n const body = (await response.json()) as { choices?: { message?: { content?: string } }[] };\n const usage = usageFrom(model, body);\n if (usage) spent(usage);\n const text = body.choices?.[0]?.message?.content;\n return text ? parseReviewJson(text) : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The same pass, given the VIDEO instead of stills.\n *\n * Inline rather than an upload-and-poll: an ad is seconds long, so a data URL costs one\n * round trip where the Files API costs three. Skipped above the cap rather than truncated\n * — a review of the first half reported as a review is the failure this module exists to\n * stop. `WATCH_MAX_BYTES` is ours, not the gateway's: OpenRouter documents no hard inline\n * limit, only \"compress when possible\", and a number we picked is easier to reason about\n * than one nobody states. Probed at the cap rather than assumed — a 51.6MB file is a\n * 68.8MB request body and came back 200 in 45s, so the timeout below is the binding\n * constraint long before the size is.\n */\nasync function askVideo(video: string, prompt: string, spent: UsageSink): Promise<unknown> {\n let bytes: Buffer;\n try {\n bytes = await readFile(video);\n } catch {\n return null;\n }\n if (bytes.byteLength > WATCH_MAX_BYTES) return null;\n return await askGateway(\n RENDER_WATCH_MODEL,\n [\n { type: \"text\", text: prompt },\n { type: \"video_url\", video_url: { url: `data:video/mp4;base64,${bytes.toString(\"base64\")}` } },\n ],\n 600_000,\n spent,\n );\n}\n\nasync function ask(images: string[], prompt: string, spent: UsageSink): Promise<unknown> {\n return await askGateway(\n RENDER_REVIEW_MODEL,\n [\n { type: \"text\", text: prompt },\n ...images.map(\n (b64): ReviewContentPart => ({ type: \"image_url\", image_url: { url: `data:image/jpeg;base64,${b64}` } }),\n ),\n ],\n 180_000,\n spent,\n );\n}\n\n/**\n * One question about finished STILL images (base64 JPEG), through the same gateway and\n * accounting as the video review. Null when no model could answer, which the caller\n * reports as \"nobody looked\", never as \"clean\".\n */\nexport async function askAboutStills(\n images: string[],\n prompt: string,\n onSpend?: (usage: ReviewUsage) => void,\n): Promise<unknown> {\n if (!hasOpenRouterKey()) return null;\n return await ask(images, prompt, (usage) => onSpend?.(usage));\n}\n\n/**\n * One question about STILL images (base64 JPEG) to `model`, text first, through the same\n * gateway and accounting. Null when no model could answer.\n */\nexport async function askAboutImages(\n model: string,\n images: string[],\n prompt: string,\n onSpend?: (usage: ReviewUsage) => void,\n /** How long the answer may take: a long one (a spec written back) needs more than a verdict. */\n timeoutMs = 60_000,\n reasoning?: GatewayReasoning,\n): Promise<unknown> {\n if (!hasOpenRouterKey()) return null;\n return await askGateway(\n model,\n [\n { type: \"text\", text: prompt },\n ...images.map(\n (b64): ReviewContentPart => ({ type: \"image_url\", image_url: { url: `data:image/jpeg;base64,${b64}` } }),\n ),\n ],\n timeoutMs,\n (usage) => onSpend?.(usage),\n reasoning,\n );\n}\n\n/**\n * One text-only question to `model`, through the same gateway and accounting. Null when no\n * model could answer, which the caller reports as \"nobody looked\", never as a pass.\n */\nexport async function askAboutText(\n model: string,\n prompt: string,\n onSpend?: (usage: ReviewUsage) => void,\n /** An extraction pins its provider and asks for JSON at temperature 0: the same text reads the same. */\n opts: { timeoutMs?: number; request?: Record<string, unknown> } = {},\n): Promise<unknown> {\n if (!hasOpenRouterKey()) return null;\n return await askGateway(\n model,\n [{ type: \"text\", text: prompt }],\n opts.timeoutMs ?? 60_000,\n (usage) => onSpend?.(usage),\n undefined,\n opts.request,\n );\n}\n\n/**\n * Look at the finished video and report what is wrong with it.\n *\n * Returns null when the review could not run at all — no key, no ffmpeg, no readable\n * video — which the caller reports as \"nobody looked\", never as \"clean\". The\n * difference is the whole point: an unwatched render was reported as good.\n */\nexport async function reviewRenderedVideo(opts: {\n video: string;\n subject?: string;\n script?: string;\n /** Where the ad is set — the watch pass judges the accent against it. */\n market?: string;\n /**\n * The request, in the words it was made in. Not the spec, and not a summary: the point of\n * this pass is to compare the video against something that did NOT come from the same\n * reading of the ask, and a summary written by the reader is that reading again.\n */\n brief?: string;\n /** Scene timings, so a finding can name the file that produced the shot. */\n windows?: SceneWindow[];\n /**\n * Called once per model call that returned a token count, so the caller can carry the\n * spend home. A review that could not run reports nothing, because it spent nothing.\n */\n onSpend?: (usage: ReviewUsage) => void;\n}): Promise<RenderFinding[] | null> {\n if (!hasOpenRouterKey()) return null;\n const duration = await videoDuration(opts.video);\n if (duration === null) return null;\n const spent: UsageSink = (usage) => opts.onSpend?.(usage);\n\n const dir = await mkdtemp(path.join(tmpdir(), \"baker-review-\"));\n try {\n const grabbed: { at: number; image: string }[] = [];\n for (const [i, at] of reviewFrameTimes(duration, RENDER_REVIEW_FRAMES).entries()) {\n const out = path.join(dir, `f${String(i).padStart(2, \"0\")}.jpg`);\n try {\n await execFileAsync(\"ffmpeg\", buildFrameGrabArgs(opts.video, at, out), { timeout: 30_000 });\n grabbed.push({ at, image: await readFile(out, { encoding: \"base64\" }) });\n } catch {\n // A frame that will not grab is not a reason to abandon the review — the rest\n // of the sample still answers every question being asked.\n }\n }\n if (grabbed.length === 0) return null;\n\n // The whole-reel question first and alone. Fired alongside twelve per-frame\n // calls it lost to the rate limit every time, and `ask` returns null on a\n // failure — so the run that found fourteen frame defects silently reported\n // nothing about the cast, the missing mark or the dead ending.\n const reel = await ask(\n grabbed.map((f) => f.image),\n buildReelReviewPrompt({ subject: opts.subject, script: opts.script }),\n spent,\n );\n const framePrompt = buildFrameReviewPrompt({ subject: opts.subject });\n const perFrame = await mapWithLimit(grabbed, REVIEW_CONCURRENCY, async (f) => ({\n at: f.at,\n json: await ask([f.image], framePrompt, spent),\n }));\n\n // Every answer coming back null means the model was unreachable, not that the\n // render is clean — the caller has to be able to tell those apart.\n const unread = perFrame.filter((f) => f.json === null).length;\n if (unread === perFrame.length && reel === null) return null;\n // The pass that WATCHES, run after the stills rather than beside them: it uploads the\n // whole video, and firing it alongside twelve frame calls is what lost the reel answer\n // to the rate limit before. Its findings are the ones a photograph cannot carry — the\n // accent, the voice against the mouth, the cuts.\n const watch = await askVideo(\n opts.video,\n buildWatchReviewPrompt({ market: opts.market, script: opts.script }),\n spent,\n );\n // Asked separately from the defect passes, because they are different judgements: one\n // is \"is this well made\", this one is \"is this the ad they asked for\". A well-made ad\n // of the wrong brief passes every other check here.\n const fidelity = opts.brief?.trim() ? await askVideo(opts.video, buildFidelityPrompt(opts.brief), spent) : null;\n const findings = [\n ...classifyFrameFindings(perFrame, opts.windows ?? []),\n ...classifyReelFindings(reel),\n ...classifyWatchFindings(watch),\n ...classifyWatchDefects(watch, opts.windows ?? []),\n ...classifyFidelityFindings(fidelity),\n // Measured, not judged: a model looking at frames cannot hear the mix.\n ...(await measureAudio(opts.video)),\n ];\n findings.push(\n ...unreviewedNotes({\n watched: watch !== null,\n fidelityAsked: Boolean(opts.brief?.trim()),\n fidelityRead: fidelity !== null,\n unread,\n frames: perFrame.length,\n }),\n );\n return findings;\n } finally {\n await rm(dir, { recursive: true, force: true });\n }\n}\n\n/**\n * Each scene's slot on the timeline, read from the blueprint beside a canvas.\n *\n * Returns an empty list when the canvas has no split blueprint — a hand-built graph, a\n * static ad — and the findings then carry timestamps only, which is what they did\n * before. Never throws: a review that cannot name the file is still worth having.\n */\n/**\n * What the review has to be told about the ad, read from the blueprint beside the canvas.\n *\n * Every question the two whole-reel passes ask is relative to something: the accent is\n * judged against a MARKET, the cast against a SCRIPT, the frames against an advertiser.\n * Handed none of them, `buildWatchReviewPrompt` still asked \"does the speaker's accent\n * belong there?\" with no antecedent for \"there\" — and `classifyWatchFindings` still turned\n * the answer into a BLOCKING finding. A verdict against nothing is worse than no verdict,\n * and the accent is the exact failure this pass was added for.\n *\n * Read rather than passed down because the caller is `canvas run`, which is handed a graph\n * and no brief. `prompt.json` sits in the same directory `sceneWindowsBeside` already\n * reads, and is the one artefact that knows all three.\n *\n * Returns an empty context for a hand-built canvas — the prompts then drop the clauses\n * that have no antecedent, which is what they did before.\n */\nexport async function reviewContextBeside(\n canvasPath: string,\n): Promise<{ market?: string; subject?: string; script?: string }> {\n const raw = await readFile(path.join(path.dirname(canvasPath), \"prompt.json\"), \"utf-8\").catch(() => null);\n if (!raw) return {};\n try {\n const blueprint = JSON.parse(raw) as {\n global?: { market?: unknown; transcript?: unknown; branding?: { name?: unknown } };\n };\n const global = blueprint.global ?? {};\n const text = (value: unknown): string | undefined =>\n typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n return {\n ...(text(global.market) ? { market: text(global.market) } : {}),\n ...(text(global.branding?.name) ? { subject: text(global.branding?.name) } : {}),\n ...(text(global.transcript) ? { script: text(global.transcript) } : {}),\n };\n } catch {\n // A blueprint that will not parse is the run's problem, not the review's.\n return {};\n }\n}\n\nexport async function sceneWindowsBeside(canvasPath: string): Promise<SceneWindow[]> {\n const dir = path.join(path.dirname(canvasPath), \"scenes\");\n const files = await readdir(dir).catch(() => null);\n if (!files) return [];\n const windows: SceneWindow[] = [];\n for (const name of files.filter((f) => f.endsWith(\".json\")).sort()) {\n const raw = await readFile(path.join(dir, name), \"utf-8\").catch(() => null);\n if (!raw) continue;\n try {\n const scene = JSON.parse(raw) as { start_s?: unknown; end_s?: unknown };\n if (typeof scene.start_s === \"number\" && typeof scene.end_s === \"number\") {\n windows.push({ file: `scenes/${name}`, startS: scene.start_s, endS: scene.end_s });\n }\n } catch {\n // A scene file that will not parse is the run's problem, not the review's.\n }\n }\n return windows;\n}\n\n/**\n * What nobody looked at, said out loud.\n *\n * A partial review reported as a complete one is the failure this whole module exists to\n * stop. `askVideo` returns null on a timeout, an HTTP failure, a reply it could not parse\n * — and deterministically for a finished video over the inline cap; every one of those\n * contributed zero findings, which reads as \"the audio and the cuts are fine\". They are\n * unchecked, not fine, and they are the findings a photograph cannot carry.\n */\nfunction unreviewedNotes(state: {\n watched: boolean;\n fidelityAsked: boolean;\n fidelityRead: boolean;\n unread: number;\n frames: number;\n}): RenderFinding[] {\n const notes: RenderFinding[] = [];\n if (!state.watched) {\n notes.push({\n severity: \"warning\",\n what: \"Nobody watched the finished video end to end — the accent, the voice against the mouth and the cuts are unchecked. The frame-by-frame review still ran.\",\n });\n }\n if (state.fidelityAsked && !state.fidelityRead) {\n notes.push({\n severity: \"warning\",\n what: \"The video was not checked against what you asked for — only against whether it is well made. A well-made ad of the wrong brief passes every other check here.\",\n });\n }\n if (state.unread > 0) {\n notes.push({\n severity: \"warning\",\n what: `${state.unread} of ${state.frames} frames could not be reviewed — that part of the video is unchecked.`,\n });\n }\n return notes;\n}\n"],"mappings":";;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,SAAS,SAAS,UAAU,UAAU;AAC/C,SAAS,cAAc;AACvB,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,SAAS;AA2CX,IAAM,sBAAsB;AAG5B,IAAM,uBAAuB;AAG7B,IAAM,sBAAsB;AAa5B,IAAM,qBAAqB;AAoC3B,SAAS,UAAU,OAAe,MAAmC;AAC1E,QAAM,QACJ,MAQC;AACH,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,WAAW,CAAC,UAChB,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,QAAQ,IAAI,QAAQ;AAC7E,SAAO;AAAA,IACL;AAAA,IACA,aAAa,MAAM,iBAAiB;AAAA,IACpC,cAAc,MAAM,qBAAqB;AAAA,IACzC,SAAS,SAAS,MAAM,IAAI,KAAK,SAAS,MAAM,cAAc,uBAAuB,KAAK;AAAA,EAC5F;AACF;AA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from "./chunk-QMLGJ5OW.js";
7
+
8
+ // src/commands/analytics/conversionArgs.ts
9
+ var ConversionArgsError = class extends Error {
10
+ };
11
+ function allValues(flag, argv) {
12
+ const values = [];
13
+ for (let i = 0; i < argv.length; i += 1) {
14
+ const arg = argv[i];
15
+ if (arg === flag) {
16
+ const next = argv[i + 1];
17
+ if (next !== void 0 && !next.startsWith("--")) values.push(next);
18
+ continue;
19
+ }
20
+ if (arg.startsWith(`${flag}=`)) values.push(arg.slice(flag.length + 1));
21
+ }
22
+ return values.map((value) => value.trim()).filter((value) => value !== "");
23
+ }
24
+ function onlyOnce(value, flag, argv) {
25
+ if (value === void 0) return void 0;
26
+ const given = argv.filter((arg) => arg === flag || arg.startsWith(`${flag}=`)).length;
27
+ if (given > 1) {
28
+ throw new ConversionArgsError(
29
+ `${flag} was given ${given} times and only the last would have been used. It takes one value.`
30
+ );
31
+ }
32
+ const trimmed = String(value).trim();
33
+ return trimmed === "" ? void 0 : trimmed;
34
+ }
35
+ function repeatable(flag, cittyValue, argv) {
36
+ const fromArgv = allValues(flag, argv);
37
+ if (fromArgv.length > 0) return fromArgv;
38
+ if (cittyValue === void 0) return [];
39
+ const trimmed = String(cittyValue).trim();
40
+ return trimmed === "" ? [] : [trimmed];
41
+ }
42
+ function checkFlagShape(args) {
43
+ if (args.eventKeys.length > 0 && args.name === void 0 && args.countMode === void 0) {
44
+ throw new ConversionArgsError(
45
+ "--event needs --name: a conversion nobody named is a row labelled with a UUID. (--event with only --count-mode changes how an event already counted is counted.)"
46
+ );
47
+ }
48
+ if (args.name !== void 0 && args.eventKeys.length === 0 && args.renameTo === void 0) {
49
+ throw new ConversionArgsError("--name needs --event, naming which event to count.");
50
+ }
51
+ if (args.renameFrom !== void 0 && args.renameTo === void 0) {
52
+ throw new ConversionArgsError('--rename needs --to: `--rename "Lead form" --to "Lead"`.');
53
+ }
54
+ if (args.renameTo !== void 0 && args.renameFrom === void 0) {
55
+ throw new ConversionArgsError(
56
+ '--to needs --rename, naming which outcome to rename: `--rename "Lead form" --to "Lead"`.'
57
+ );
58
+ }
59
+ }
60
+ function checkEventKeys(eventKeys) {
61
+ for (const eventKey of eventKeys) {
62
+ if (parseEventKey(eventKey) === null) {
63
+ throw new ConversionArgsError(
64
+ `"${eventKey}" is not an event key. Run with --candidates (or --flow <slug> for one Form) and copy one; they look like form:<form>:<step>:<trigger>, submit:<form>, page:<name> or exit:<host>.`
65
+ );
66
+ }
67
+ if (isLandingViewKey(eventKey)) {
68
+ throw new ConversionArgsError(
69
+ `"${eventKey}" is a landing being viewed \u2014 a funnel step, never a conversion. Add it as a step with \`baker funnel\` instead.`
70
+ );
71
+ }
72
+ }
73
+ }
74
+ function readDays(raw) {
75
+ if (raw === void 0) return void 0;
76
+ const days = Number(raw);
77
+ if (!Number.isFinite(days) || days <= 0) {
78
+ throw new ConversionArgsError("--days must be a positive number of days.");
79
+ }
80
+ return days;
81
+ }
82
+ function parseConversionsArgs(raw, argv) {
83
+ const countMode = onlyOnce(raw["count-mode"], "--count-mode", argv);
84
+ if (countMode !== void 0 && !CONVERSION_COUNT_MODES.includes(countMode)) {
85
+ throw new ConversionArgsError(`--count-mode must be one of ${CONVERSION_COUNT_MODES.join(", ")}.`);
86
+ }
87
+ const args = {
88
+ eventKeys: repeatable("--event", raw.event, argv),
89
+ removeKeys: repeatable("--remove", raw.remove, argv),
90
+ name: onlyOnce(raw.name, "--name", argv),
91
+ countMode,
92
+ renameFrom: onlyOnce(raw.rename, "--rename", argv),
93
+ renameTo: onlyOnce(raw.to, "--to", argv),
94
+ removeName: onlyOnce(raw["remove-name"], "--remove-name", argv),
95
+ flowSlug: onlyOnce(raw.flow, "--flow", argv),
96
+ candidates: raw.candidates === true,
97
+ full: raw.full === true,
98
+ days: readDays(raw.days)
99
+ };
100
+ checkFlagShape(args);
101
+ checkEventKeys(args.eventKeys);
102
+ return args;
103
+ }
104
+ function existingNames(existing) {
105
+ return [...new Set(existing.map((row) => row.name))];
106
+ }
107
+ function checkNameCollision(name, existing) {
108
+ const collision = findNameCollision(name, existingNames(existing));
109
+ if (collision === null) return;
110
+ throw new ConversionArgsError(
111
+ `This company already counts "${collision}", and "${name}" would be a second row for the same outcome \u2014 Baker groups by exact name, so the number would be split in two. Use "${collision}" to make them one number, or pick a name that means something different.`
112
+ );
113
+ }
114
+ function under(name, existing) {
115
+ const rows = existing.filter((row) => row.name === name);
116
+ if (rows.length === 0) {
117
+ throw new ConversionArgsError(
118
+ `Nothing is counted under "${name}". This company counts: ${existingNames(existing).join(", ") || "nothing yet"}.`
119
+ );
120
+ }
121
+ return rows;
122
+ }
123
+ function setFromEvents(args, existing) {
124
+ if (args.eventKeys.length === 0) return [];
125
+ if (args.name !== void 0) {
126
+ checkNameCollision(args.name, existing);
127
+ const name = args.name;
128
+ return args.eventKeys.map((eventKey) => ({
129
+ eventKey,
130
+ name,
131
+ ...args.countMode ? { countMode: args.countMode } : {}
132
+ }));
133
+ }
134
+ return args.eventKeys.map((eventKey) => {
135
+ const current = existing.find((row) => row.eventKey === eventKey);
136
+ if (!current) {
137
+ throw new ConversionArgsError(
138
+ `"${eventKey}" is not counted, so there is no count mode to change. Add it with --event "${eventKey}" --name "<what a person calls it>" --count-mode ${args.countMode}.`
139
+ );
140
+ }
141
+ return { eventKey, name: current.name, countMode: args.countMode };
142
+ });
143
+ }
144
+ function setFromRename(args, existing) {
145
+ if (args.renameFrom === void 0 || args.renameTo === void 0) return [];
146
+ const renameTo = args.renameTo;
147
+ checkNameCollision(renameTo, existing);
148
+ return under(args.renameFrom, existing).map((row) => ({
149
+ eventKey: row.eventKey,
150
+ name: renameTo,
151
+ countMode: row.countMode
152
+ }));
153
+ }
154
+ function conversionsWrite(args, existing) {
155
+ const set = [...setFromEvents(args, existing), ...setFromRename(args, existing)];
156
+ const remove = [
157
+ ...args.removeKeys,
158
+ ...args.removeName === void 0 ? [] : under(args.removeName, existing).map((row) => row.eventKey)
159
+ ];
160
+ if (set.length === 0 && remove.length === 0) return null;
161
+ return { ...set.length > 0 ? { set } : {}, ...remove.length > 0 ? { remove } : {} };
162
+ }
163
+
164
+ export {
165
+ ConversionArgsError,
166
+ onlyOnce,
167
+ parseConversionsArgs,
168
+ conversionsWrite
169
+ };
170
+ //# sourceMappingURL=chunk-TKT3OHZ6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/analytics/conversionArgs.ts"],"sourcesContent":["/**\n * Reading the flags of `baker analytics conversions`, and refusing the shapes\n * that would otherwise count the wrong thing in silence.\n *\n * Its own module because every refusal here is cheap and every one it misses is\n * expensive: a conversion definition that never matches anything does not\n * error, it counts zero forever, and the company reports a rate that is quietly\n * too low. The same is true of the other direction — a name that splits one\n * outcome into two rows makes both numbers too low and neither of them wrong\n * enough to notice.\n *\n * The write is built against what the company **already counts**, which is why\n * `conversionsWrite` takes the current definitions: renaming, re-moding and the\n * near-duplicate refusal are all questions about the existing set, and a CLI\n * that could not see it could only add.\n */\n\nimport { CONVERSION_COUNT_MODES, findNameCollision, isLandingViewKey, parseEventKey } from \"@baker/api/analytics\";\n\nexport interface ConversionsArgs {\n /** Every `--event` given. Several under one `--name` is how they become one number. */\n eventKeys: string[];\n name?: string;\n countMode?: string;\n /** Every `--remove` given. */\n removeKeys: string[];\n renameFrom?: string;\n renameTo?: string;\n removeName?: string;\n /** A Form to read its own endings from, whether or not any of them has fired. */\n flowSlug?: string;\n candidates: boolean;\n /** Every field of every candidate, instead of one short line each. */\n full: boolean;\n days?: number;\n}\n\n/** One definition as this module needs to read it. */\nexport interface ExistingConversion {\n eventKey: string;\n name: string;\n countMode: string;\n}\n\n/** Thrown for anything the caller can fix by re-running with different flags. */\nexport class ConversionArgsError extends Error {}\n\n/**\n * Every value given for a flag, in the order they were typed.\n *\n * Read out of the raw argv rather than out of citty's parsed args, because\n * citty keeps only the LAST value of a repeated flag and hands it over as a\n * plain string: `--event a --event b` arrives as `\"b\"` with nothing recording\n * that `a` was ever there. By the time the handler runs, the evidence is gone.\n *\n * The identical shape has cost this repo before: `--param a=1 --param b=2`\n * staged only `b=2` against a write that replaces an entity's whole set, and\n * two of three UTM parameters were silently deleted on publish. Here the flags\n * that can legitimately repeat are collected, and the ones that cannot are\n * refused by {@link onlyOnce} — never quietly resolved to one of them.\n */\nexport function allValues(flag: string, argv: readonly string[]): string[] {\n const values: string[] = [];\n for (let i = 0; i < argv.length; i += 1) {\n const arg = argv[i] as string;\n if (arg === flag) {\n const next = argv[i + 1];\n if (next !== undefined && !next.startsWith(\"--\")) values.push(next);\n continue;\n }\n if (arg.startsWith(`${flag}=`)) values.push(arg.slice(flag.length + 1));\n }\n return values.map((value) => value.trim()).filter((value) => value !== \"\");\n}\n\n/** One value for a flag, or a refusal — never the last of several. */\nexport function onlyOnce(value: unknown, flag: string, argv: readonly string[]): string | undefined {\n if (value === undefined) return undefined;\n const given = argv.filter((arg) => arg === flag || arg.startsWith(`${flag}=`)).length;\n if (given > 1) {\n throw new ConversionArgsError(\n `${flag} was given ${given} times and only the last would have been used. It takes one value.`,\n );\n }\n const trimmed = String(value).trim();\n return trimmed === \"\" ? undefined : trimmed;\n}\n\n/**\n * The repeatable flags, read from argv with citty's value as the fallback.\n *\n * The fallback matters for the single-value case: a test — and any caller that\n * builds the args itself — passes the parsed object without an argv, and\n * dropping the value there would make every one of those calls a silent read.\n */\nfunction repeatable(flag: string, cittyValue: unknown, argv: readonly string[]): string[] {\n const fromArgv = allValues(flag, argv);\n if (fromArgv.length > 0) return fromArgv;\n if (cittyValue === undefined) return [];\n const trimmed = String(cittyValue).trim();\n return trimmed === \"\" ? [] : [trimmed];\n}\n\n/**\n * The four ways a set of flags can fail to say anything, each named.\n *\n * Split out of the parser for the reason the linter gives: a run of unrelated\n * refusals is the shape that grows one branch per flag until nobody can see\n * which combinations are legal.\n */\nfunction checkFlagShape(args: {\n eventKeys: string[];\n name?: string;\n countMode?: string;\n renameFrom?: string;\n renameTo?: string;\n}): void {\n // An event with no name and no mode change says which event and nothing about\n // it; a name with no event names an outcome with nothing to count.\n if (args.eventKeys.length > 0 && args.name === undefined && args.countMode === undefined) {\n throw new ConversionArgsError(\n \"--event needs --name: a conversion nobody named is a row labelled with a UUID. (--event with only --count-mode changes how an event already counted is counted.)\",\n );\n }\n if (args.name !== undefined && args.eventKeys.length === 0 && args.renameTo === undefined) {\n throw new ConversionArgsError(\"--name needs --event, naming which event to count.\");\n }\n if (args.renameFrom !== undefined && args.renameTo === undefined) {\n throw new ConversionArgsError('--rename needs --to: `--rename \"Lead form\" --to \"Lead\"`.');\n }\n if (args.renameTo !== undefined && args.renameFrom === undefined) {\n throw new ConversionArgsError(\n '--to needs --rename, naming which outcome to rename: `--rename \"Lead form\" --to \"Lead\"`.',\n );\n }\n}\n\n/**\n * Refuse a key that cannot parse, here rather than at the backend.\n *\n * This is the mistake that costs a turn: an event key nothing can produce never\n * matches anything, so it does not error — it counts zero forever.\n */\nfunction checkEventKeys(eventKeys: readonly string[]): void {\n for (const eventKey of eventKeys) {\n if (parseEventKey(eventKey) === null) {\n throw new ConversionArgsError(\n `\"${eventKey}\" is not an event key. Run with --candidates (or --flow <slug> for one Form) and copy one; they look like form:<form>:<step>:<trigger>, submit:<form>, page:<name> or exit:<host>.`,\n );\n }\n // The one readable key that is not an outcome. It exists so a funnel can\n // begin at \"saw the page\"; marked as a conversion it would make the rate a\n // ratio of the traffic to itself.\n if (isLandingViewKey(eventKey)) {\n throw new ConversionArgsError(\n `\"${eventKey}\" is a landing being viewed — a funnel step, never a conversion. Add it as a step with \\`baker funnel\\` instead.`,\n );\n }\n }\n}\n\nfunction readDays(raw: unknown): number | undefined {\n if (raw === undefined) return undefined;\n const days = Number(raw);\n if (!Number.isFinite(days) || days <= 0) {\n throw new ConversionArgsError(\"--days must be a positive number of days.\");\n }\n return days;\n}\n\nexport function parseConversionsArgs(raw: Record<string, unknown>, argv: readonly string[]): ConversionsArgs {\n const countMode = onlyOnce(raw[\"count-mode\"], \"--count-mode\", argv);\n if (countMode !== undefined && !(CONVERSION_COUNT_MODES as readonly string[]).includes(countMode)) {\n throw new ConversionArgsError(`--count-mode must be one of ${CONVERSION_COUNT_MODES.join(\", \")}.`);\n }\n\n const args: ConversionsArgs = {\n eventKeys: repeatable(\"--event\", raw.event, argv),\n removeKeys: repeatable(\"--remove\", raw.remove, argv),\n name: onlyOnce(raw.name, \"--name\", argv),\n countMode,\n renameFrom: onlyOnce(raw.rename, \"--rename\", argv),\n renameTo: onlyOnce(raw.to, \"--to\", argv),\n removeName: onlyOnce(raw[\"remove-name\"], \"--remove-name\", argv),\n flowSlug: onlyOnce(raw.flow, \"--flow\", argv),\n candidates: raw.candidates === true,\n full: raw.full === true,\n days: readDays(raw.days),\n };\n\n checkFlagShape(args);\n checkEventKeys(args.eventKeys);\n return args;\n}\n\nexport interface ConversionsWrite {\n set?: { eventKey: string; name: string; countMode?: string }[];\n remove?: string[];\n}\n\n/**\n * The names this company already counts, in the order they were defined.\n *\n * Exported because it is what every hint about reuse is built from: the first\n * thing an agent naming an outcome should see is what this company calls its\n * outcomes already.\n */\nexport function existingNames(existing: readonly ExistingConversion[]): string[] {\n return [...new Set(existing.map((row) => row.name))];\n}\n\n/**\n * Refuse a name that reads the same as one already counted but stores\n * differently.\n *\n * Baker groups by exact name, so \"Booked a call\" and \"Booked a Call\" are two\n * rows and two numbers — a headline quietly split in half, with both halves\n * plausible. Nothing else in the system can catch it: both names are valid,\n * both keys are real, and every report is correct about the wrong grouping.\n *\n * A refusal rather than a hint because the fix is one character and the damage\n * is permanent-looking: nobody re-reads a conversion list to check for two rows\n * that mean the same thing.\n */\nfunction checkNameCollision(name: string, existing: readonly ExistingConversion[]): void {\n const collision = findNameCollision(name, existingNames(existing));\n if (collision === null) return;\n throw new ConversionArgsError(\n `This company already counts \"${collision}\", and \"${name}\" would be a second row for the same outcome — Baker groups by exact name, so the number would be split in two. Use \"${collision}\" to make them one number, or pick a name that means something different.`,\n );\n}\n\n/** The definitions counted under a name, or a refusal naming what is. */\nfunction under(name: string, existing: readonly ExistingConversion[]): ExistingConversion[] {\n const rows = existing.filter((row) => row.name === name);\n if (rows.length === 0) {\n throw new ConversionArgsError(\n `Nothing is counted under \"${name}\". This company counts: ${existingNames(existing).join(\", \") || \"nothing yet\"}.`,\n );\n }\n return rows;\n}\n\n/** `--event …` — each key set to the given name, or re-moded keeping the one it has. */\nfunction setFromEvents(args: ConversionsArgs, existing: readonly ExistingConversion[]) {\n if (args.eventKeys.length === 0) return [];\n if (args.name !== undefined) {\n checkNameCollision(args.name, existing);\n const name = args.name;\n return args.eventKeys.map((eventKey) => ({\n eventKey,\n name,\n ...(args.countMode ? { countMode: args.countMode } : {}),\n }));\n }\n // `--count-mode` alone. The store needs a name on every write, and the only\n // honest one is the name it already has: inventing one here would rename an\n // outcome somebody chose, as a side effect of changing how it counts.\n return args.eventKeys.map((eventKey) => {\n const current = existing.find((row) => row.eventKey === eventKey);\n if (!current) {\n throw new ConversionArgsError(\n `\"${eventKey}\" is not counted, so there is no count mode to change. Add it with --event \"${eventKey}\" --name \"<what a person calls it>\" --count-mode ${args.countMode}.`,\n );\n }\n return { eventKey, name: current.name, countMode: args.countMode };\n });\n}\n\n/**\n * `--rename … --to …` — every event under one name moved to another.\n *\n * Collision-checked like every other name, and that is not in tension with the\n * merge: renaming ONTO an existing name is the main thing the flag is for, and\n * `findNameCollision` returns `null` for an exact match precisely so that stays\n * free. What it refuses is the near-miss — renaming onto \"Booked a Call\" when\n * the company counts \"Booked a call\" — which is the split the whole rule exists\n * to prevent, arriving through the one flag that used to be exempt.\n */\nfunction setFromRename(args: ConversionsArgs, existing: readonly ExistingConversion[]) {\n if (args.renameFrom === undefined || args.renameTo === undefined) return [];\n const renameTo = args.renameTo;\n checkNameCollision(renameTo, existing);\n return under(args.renameFrom, existing).map((row) => ({\n eventKey: row.eventKey,\n name: renameTo,\n countMode: row.countMode,\n }));\n}\n\n/**\n * The write this call makes, or `null` when it is only a read. *\n * Every operation is expressed as `set` / `remove` over event keys, because\n * that is the only vocabulary the store has: a name is a property of a\n * definition, not a row of its own, so renaming an outcome is re-setting every\n * key underneath it and dropping one is removing them all.\n */\nexport function conversionsWrite(\n args: ConversionsArgs,\n existing: readonly ExistingConversion[],\n): ConversionsWrite | null {\n const set = [...setFromEvents(args, existing), ...setFromRename(args, existing)];\n const remove = [\n ...args.removeKeys,\n ...(args.removeName === undefined ? [] : under(args.removeName, existing).map((row) => row.eventKey)),\n ];\n\n if (set.length === 0 && remove.length === 0) return null;\n return { ...(set.length > 0 ? { set } : {}), ...(remove.length > 0 ? { remove } : {}) };\n}\n"],"mappings":";;;;;;;;AA6CO,IAAM,sBAAN,cAAkC,MAAM;AAAC;AAgBzC,SAAS,UAAU,MAAc,MAAmC;AACzE,QAAM,SAAmB,CAAC;AAC1B,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,GAAG;AACvC,UAAM,MAAM,KAAK,CAAC;AAClB,QAAI,QAAQ,MAAM;AAChB,YAAM,OAAO,KAAK,IAAI,CAAC;AACvB,UAAI,SAAS,UAAa,CAAC,KAAK,WAAW,IAAI,EAAG,QAAO,KAAK,IAAI;AAClE;AAAA,IACF;AACA,QAAI,IAAI,WAAW,GAAG,IAAI,GAAG,EAAG,QAAO,KAAK,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC;AAAA,EACxE;AACA,SAAO,OAAO,IAAI,CAAC,UAAU,MAAM,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,UAAU,EAAE;AAC3E;AAGO,SAAS,SAAS,OAAgB,MAAc,MAA6C;AAClG,MAAI,UAAU,OAAW,QAAO;AAChC,QAAM,QAAQ,KAAK,OAAO,CAAC,QAAQ,QAAQ,QAAQ,IAAI,WAAW,GAAG,IAAI,GAAG,CAAC,EAAE;AAC/E,MAAI,QAAQ,GAAG;AACb,UAAM,IAAI;AAAA,MACR,GAAG,IAAI,cAAc,KAAK;AAAA,IAC5B;AAAA,EACF;AACA,QAAM,UAAU,OAAO,KAAK,EAAE,KAAK;AACnC,SAAO,YAAY,KAAK,SAAY;AACtC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,EAAE,IAAI,CAAC,QAAQ,IAAI,QAAQ;AAAA,EACrG;AAEA,MAAI,IAAI,WAAW,KAAK,OAAO,WAAW,EAAG,QAAO;AACpD,SAAO,EAAE,GAAI,IAAI,SAAS,IAAI,EAAE,IAAI,IAAI,CAAC,GAAI,GAAI,OAAO,SAAS,IAAI,EAAE,OAAO,IAAI,CAAC,EAAG;AACxF;","names":[]}
@@ -0,0 +1,136 @@
1
+ import {
2
+ coercePathUrlToUrl,
3
+ looksLikeHttpUrl
4
+ } from "./chunk-3VXQYDJN.js";
5
+
6
+ // src/commands/canvas/resolve-paths.ts
7
+ import path from "path";
8
+ function resolveRelativeCanvasPaths(canvas, baseDir) {
9
+ if (!canvas || typeof canvas !== "object") return canvas;
10
+ const c = canvas;
11
+ if (!Array.isArray(c.nodes)) return canvas;
12
+ return { ...canvas, nodes: c.nodes.map((n) => resolveNode(n, baseDir)) };
13
+ }
14
+ function localPathParam(node) {
15
+ if (node.type === "ingest") return node.params?.source === "path" ? "path" : null;
16
+ if (node.type === "hyperframe_render" || node.type === "hyperframe_snapshot") return "composition";
17
+ return null;
18
+ }
19
+ function resolveNode(node, baseDir) {
20
+ if (!node || typeof node !== "object") return node;
21
+ const n = node;
22
+ const params = n.params;
23
+ if (!params || typeof params !== "object") return node;
24
+ const key = localPathParam(n);
25
+ if (key && isResolvableRelative(params[key])) {
26
+ return { ...node, params: { ...params, [key]: path.resolve(baseDir, params[key]) } };
27
+ }
28
+ return node;
29
+ }
30
+ function isResolvableRelative(value) {
31
+ return typeof value === "string" && value.length > 0 && !value.includes("[TODO") && !looksLikeHttpUrl(value) && !path.isAbsolute(value);
32
+ }
33
+
34
+ // src/commands/canvas/normalize-paths.ts
35
+ import { existsSync, realpathSync } from "fs";
36
+ import { writeFile } from "fs/promises";
37
+ import path2 from "path";
38
+ function findWorkspaceRoot(startDir, exists = existsSync, maxDepth = 12) {
39
+ let dir = path2.resolve(startDir);
40
+ for (let i = 0; i < maxDepth; i++) {
41
+ if (exists(path2.join(dir, "package.json"))) return dir;
42
+ const parent = path2.dirname(dir);
43
+ if (parent === dir) break;
44
+ dir = parent;
45
+ }
46
+ return null;
47
+ }
48
+ function canvasOutputsRoot(canvasFile, cwd = process.cwd(), exists = existsSync) {
49
+ const root = findWorkspaceRoot(path2.dirname(path2.resolve(cwd, canvasFile)), exists) ?? cwd;
50
+ return path2.join(root, "canvas");
51
+ }
52
+ function canonicalize(target) {
53
+ const abs = path2.resolve(target);
54
+ let dir = abs;
55
+ for (; ; ) {
56
+ try {
57
+ const real = realpathSync(dir);
58
+ return dir === abs ? real : path2.join(real, path2.relative(dir, abs));
59
+ } catch {
60
+ const parent = path2.dirname(dir);
61
+ if (parent === dir) return abs;
62
+ dir = parent;
63
+ }
64
+ }
65
+ }
66
+ function isInside(root, target) {
67
+ const rel = path2.relative(root, target);
68
+ return rel !== "" && !rel.startsWith("..") && !path2.isAbsolute(rel);
69
+ }
70
+ function toCanvasRelative(canvasDir, target) {
71
+ return path2.relative(canvasDir, target).split(path2.sep).join("/");
72
+ }
73
+ var RUNTIME_WORKSPACE_ROOT = "/home/user/repo";
74
+ function rewriteTarget(value, workspaceRoot) {
75
+ if (typeof value !== "string" || value.length === 0) return null;
76
+ if (value.includes("[TODO") || looksLikeHttpUrl(value) || !path2.isAbsolute(value)) return null;
77
+ const target = canonicalize(value);
78
+ if (isInside(workspaceRoot, target)) return target;
79
+ const fromRuntime = path2.relative(RUNTIME_WORKSPACE_ROOT, path2.normalize(value));
80
+ if (fromRuntime !== "" && !fromRuntime.startsWith("..") && !path2.isAbsolute(fromRuntime)) {
81
+ return path2.join(workspaceRoot, fromRuntime);
82
+ }
83
+ return null;
84
+ }
85
+ function normalizeCanvasPaths(canvas, canvasDir, workspaceRoot) {
86
+ if (!canvas || typeof canvas !== "object") return { canvas, rewrites: [] };
87
+ const c = canvas;
88
+ if (!Array.isArray(c.nodes)) return { canvas, rewrites: [] };
89
+ const root = canonicalize(workspaceRoot);
90
+ const dir = canonicalize(canvasDir);
91
+ const rewrites = [];
92
+ const nodes = c.nodes.map((node) => {
93
+ if (!node || typeof node !== "object") return node;
94
+ const n = node;
95
+ const params = n.params;
96
+ if (!params || typeof params !== "object") return node;
97
+ const nodeId = typeof n.id === "string" ? n.id : "?";
98
+ if (n.type === "ingest" && params.source === "path" && looksLikeHttpUrl(params.path)) {
99
+ rewrites.push({ nodeId, param: "source", from: "path", to: "url" });
100
+ return { ...node, params: coercePathUrlToUrl(params) };
101
+ }
102
+ const key = localPathParam(n);
103
+ if (!key) return node;
104
+ const target = rewriteTarget(params[key], root);
105
+ if (target === null) return node;
106
+ const to = toCanvasRelative(dir, target);
107
+ rewrites.push({ nodeId, param: key, from: params[key], to });
108
+ return { ...node, params: { ...params, [key]: to } };
109
+ });
110
+ return rewrites.length === 0 ? { canvas, rewrites } : { canvas: { ...canvas, nodes }, rewrites };
111
+ }
112
+ async function healCanvasPaths(filePath, canvas) {
113
+ const canvasDir = path2.dirname(filePath);
114
+ const workspaceRoot = findWorkspaceRoot(canvasDir);
115
+ if (!workspaceRoot) return { canvas, rewrites: [], text: null };
116
+ const normalized = normalizeCanvasPaths(canvas, canvasDir, workspaceRoot);
117
+ if (normalized.rewrites.length === 0) return { ...normalized, text: null };
118
+ const text = `${JSON.stringify(normalized.canvas, null, 2)}
119
+ `;
120
+ await writeFile(filePath, text, "utf8");
121
+ return { ...normalized, text };
122
+ }
123
+ function describeRewrites(rewrites) {
124
+ return rewrites.map((r) => ` ${r.nodeId}.${r.param}: ${r.from} \u2192 ${r.to}`).join("\n");
125
+ }
126
+
127
+ export {
128
+ resolveRelativeCanvasPaths,
129
+ localPathParam,
130
+ findWorkspaceRoot,
131
+ canvasOutputsRoot,
132
+ normalizeCanvasPaths,
133
+ healCanvasPaths,
134
+ describeRewrites
135
+ };
136
+ //# sourceMappingURL=chunk-TNOSX3PJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/canvas/resolve-paths.ts","../src/commands/canvas/normalize-paths.ts"],"sourcesContent":["import path from \"node:path\";\nimport { looksLikeHttpUrl } from \"../../engine/lib/url.ts\";\n\n/**\n * Make a scaffolded canvas PORTABLE. The scaffold writes workspace-relative paths\n * for the things it owns — `hyperframe_render`/`hyperframe_snapshot` composition dirs\n * and the blueprint `ingest` — so the on-disk canvas carries no absolute path. At load time (run /\n * validate) those relatives are resolved against the canvas file's own directory,\n * so the canvas works wherever it lives.\n *\n * Without this the scaffold baked `path.resolve(...)` absolutes into the JSON; when\n * a workspace was renamed/copied (e.g. `memphis` → `barkibu-video-ad-v1`) the\n * canvas silently read a sibling workspace's stale composition + assets.\n *\n * Pass-through unchanged: absolute paths, URL ingests, and unfilled `[TODO …]`\n * placeholders (the placeholder gate handles those). A `source:\"path\"` whose value\n * is actually an http(s) URL MUST pass through untouched — `path.resolve` would\n * rewrite it to a garbage local path (`<dir>/https:/host/…`), defeating the ingest\n * schema's URL→path heal downstream.\n */\nexport function resolveRelativeCanvasPaths(canvas: unknown, baseDir: string): unknown {\n if (!canvas || typeof canvas !== \"object\") return canvas;\n const c = canvas as { nodes?: unknown };\n if (!Array.isArray(c.nodes)) return canvas;\n return { ...(canvas as object), nodes: c.nodes.map((n) => resolveNode(n, baseDir)) };\n}\n\n/**\n * Which param of this node names a local file or directory in the workspace, or null if none does.\n * The one owner of that question: resolving (here), healing absolutes (`normalizeCanvasPaths`) and\n * snapshotting a run's sources (`localPathRefsFromCanvas`) all ask it, so a node kind that carries a\n * path cannot be known to one of them and missed by another. Every such path is read relative to\n * the canvas file, never to the working directory.\n */\nexport function localPathParam(node: { type?: unknown; params?: Record<string, unknown> }): \"path\" | \"composition\" | null {\n if (node.type === \"ingest\") return node.params?.source === \"path\" ? \"path\" : null;\n if (node.type === \"hyperframe_render\" || node.type === \"hyperframe_snapshot\") return \"composition\";\n return null;\n}\n\nfunction resolveNode(node: unknown, baseDir: string): unknown {\n if (!node || typeof node !== \"object\") return node;\n const n = node as { type?: unknown; params?: Record<string, unknown> };\n const params = n.params;\n if (!params || typeof params !== \"object\") return node;\n\n const key = localPathParam(n);\n if (key && isResolvableRelative(params[key])) {\n return { ...node, params: { ...params, [key]: path.resolve(baseDir, params[key]) } };\n }\n return node;\n}\n\nfunction isResolvableRelative(value: unknown): value is string {\n return (\n typeof value === \"string\" &&\n value.length > 0 &&\n !value.includes(\"[TODO\") &&\n !looksLikeHttpUrl(value) &&\n !path.isAbsolute(value)\n );\n}\n","import { existsSync, realpathSync } from \"node:fs\";\nimport { writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { looksLikeHttpUrl } from \"../../engine/lib/url.ts\";\nimport { coercePathUrlToUrl } from \"../../engine/nodes/ingest.ts\";\nimport { localPathParam } from \"./resolve-paths.ts\";\n\n/**\n * The inverse of `resolveRelativeCanvasPaths`, applied to the file on disk.\n *\n * The scaffold writes `[TODO …]` asset slots that say \"relative to this canvas\n * file, never an absolute path\". An agent filling one by hand writes what it\n * sees — `/home/user/repo/src/brand/logos/logo.webp` — and every in-session\n * gate passes: the file exists at that path in the Runtime, `canvas validate`\n * passes absolutes straight through, `canvas run` renders fine. The mistake is\n * invisible until the publish build checks the repo out under a different root\n * and `validate-creatives` fails on a creative nobody is looking at any more.\n *\n * There is nothing to ask the author here: an absolute path INSIDE the\n * workspace has exactly one correct portable form, `path.relative(canvasDir,\n * it)`, which resolves to the same file. So it is rewritten, not reported.\n *\n * The same holds for an ingest written `source:\"path\"` with an http(s) URL in\n * `path`: the ingest schema already runs it as `source:\"url\"`, so that is the\n * only spelling that says what ran. Left on disk it passes validate and run,\n * then the commit hook reads a URL as a missing local file and fails the\n * creative after the render — and the hand edit that follows re-keys the cache.\n *\n * Untouched, because the rewrite would not be provably equivalent: paths\n * OUTSIDE the workspace (a `/tmp` scratch file, a sibling checkout — a relative\n * form would either escape the repo or point at nothing after a clone), URLs,\n * `[TODO …]` slots, and paths that are already relative.\n */\n\nexport type CanvasPathRewrite = {\n nodeId: string;\n /**\n * Which param was rewritten — `ingest.path` or a hyperframe node's `composition`\n * (absolute → relative), or `ingest.source` (`path` → `url`, the URL moving to `url`).\n */\n param: \"path\" | \"composition\" | \"source\";\n from: string;\n to: string;\n};\n\nexport type CanvasNormalization = { canvas: unknown; rewrites: CanvasPathRewrite[] };\n\n/**\n * A heal applied to the file on disk. `text` is what was written, or null when\n * nothing changed — callers that identify a canvas by its bytes (`canvasSha`,\n * the run snapshot) MUST use it, or they describe content the file no longer\n * has and a resume can never match it back.\n */\nexport type CanvasHeal = CanvasNormalization & { text: string | null };\n\n/**\n * The workspace a canvas belongs to: the nearest ancestor holding a\n * `package.json`. In a Runtime that is `/home/user/repo`; in the publish build\n * it is the CI checkout root — which is the point, the anchor is discovered at\n * read time instead of baked in at write time. The brand kit is found by\n * `findBrandRoot` (static-copy-projection.ts) instead: it needs `src/brand`, not a package.\n */\nexport function findWorkspaceRoot(\n startDir: string,\n exists: (p: string) => boolean = existsSync,\n maxDepth = 12,\n): string | null {\n let dir = path.resolve(startDir);\n for (let i = 0; i < maxDepth; i++) {\n if (exists(path.join(dir, \"package.json\"))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * The `canvas/` directory a run of `canvasFile` writes to by default: the one at the root of the\n * workspace the canvas belongs to, whatever directory the command was started from. Anchored on\n * the working directory, a run started inside `src/creatives/<slug>/` wrote a nested `canvas/`\n * there — a folder the creative gate rejects, and a cache no later run from the root could find.\n */\nexport function canvasOutputsRoot(\n canvasFile: string,\n cwd: string = process.cwd(),\n exists: (p: string) => boolean = existsSync,\n): string {\n const root = findWorkspaceRoot(path.dirname(path.resolve(cwd, canvasFile)), exists) ?? cwd;\n return path.join(root, \"canvas\");\n}\n\n/**\n * `target` with every symlink in its deepest EXISTING ancestor resolved, so the\n * inside-the-workspace test compares like with like. Without it the test is a\n * string prefix match that a symlinked mount defeats: on macOS `/tmp/x` and a\n * cwd of `/private/tmp/x` are the same directory and the check says otherwise,\n * and a path whose file does not exist yet can't be realpath'd at all.\n */\nfunction canonicalize(target: string): string {\n const abs = path.resolve(target);\n let dir = abs;\n for (;;) {\n try {\n const real = realpathSync(dir);\n return dir === abs ? real : path.join(real, path.relative(dir, abs));\n } catch {\n const parent = path.dirname(dir);\n if (parent === dir) return abs;\n dir = parent;\n }\n }\n}\n\nfunction isInside(root: string, target: string): boolean {\n const rel = path.relative(root, target);\n return rel !== \"\" && !rel.startsWith(\"..\") && !path.isAbsolute(rel);\n}\n\n/** Portable form of `target` as read from `canvasDir`, always with `/` separators. */\nfunction toCanvasRelative(canvasDir: string, target: string): string {\n return path.relative(canvasDir, target).split(path.sep).join(\"/\");\n}\n\n/**\n * Every Session's workspace is checked out at this exact path — `REPO_PATH` in\n * `convex/sandbox/constants.ts`. So an absolute path under it names a file in\n * THIS workspace no matter which checkout is reading: remapping it onto the\n * current root is a proof, not the longest-tail-that-exists guess a validator\n * has to fall back on for an unrecognized root. This is what lets a canvas that\n * already escaped a Session heal in the publish build instead of blocking it.\n */\nconst RUNTIME_WORKSPACE_ROOT = \"/home/user/repo\";\n\n/** The in-workspace target this value denotes, else null. */\nfunction rewriteTarget(value: unknown, workspaceRoot: string): string | null {\n if (typeof value !== \"string\" || value.length === 0) return null;\n if (value.includes(\"[TODO\") || looksLikeHttpUrl(value) || !path.isAbsolute(value)) return null;\n\n const target = canonicalize(value);\n if (isInside(workspaceRoot, target)) return target;\n\n const fromRuntime = path.relative(RUNTIME_WORKSPACE_ROOT, path.normalize(value));\n if (fromRuntime !== \"\" && !fromRuntime.startsWith(\"..\") && !path.isAbsolute(fromRuntime)) {\n return path.join(workspaceRoot, fromRuntime);\n }\n return null;\n}\n\nexport function normalizeCanvasPaths(\n canvas: unknown,\n canvasDir: string,\n workspaceRoot: string,\n): CanvasNormalization {\n if (!canvas || typeof canvas !== \"object\") return { canvas, rewrites: [] };\n const c = canvas as { nodes?: unknown };\n if (!Array.isArray(c.nodes)) return { canvas, rewrites: [] };\n\n const root = canonicalize(workspaceRoot);\n const dir = canonicalize(canvasDir);\n const rewrites: CanvasPathRewrite[] = [];\n const nodes = c.nodes.map((node) => {\n if (!node || typeof node !== \"object\") return node;\n const n = node as { id?: unknown; type?: unknown; params?: Record<string, unknown> };\n const params = n.params;\n if (!params || typeof params !== \"object\") return node;\n const nodeId = typeof n.id === \"string\" ? n.id : \"?\";\n if (n.type === \"ingest\" && params.source === \"path\" && looksLikeHttpUrl(params.path)) {\n rewrites.push({ nodeId, param: \"source\", from: \"path\", to: \"url\" });\n return { ...node, params: coercePathUrlToUrl(params) };\n }\n const key = localPathParam(n);\n if (!key) return node;\n\n const target = rewriteTarget(params[key], root);\n if (target === null) return node;\n\n const to = toCanvasRelative(dir, target);\n rewrites.push({ nodeId, param: key, from: params[key] as string, to });\n return { ...node, params: { ...params, [key]: to } };\n });\n\n return rewrites.length === 0 ? { canvas, rewrites } : { canvas: { ...(canvas as object), nodes }, rewrites };\n}\n\n/**\n * Normalize the canvas AT `filePath` and save it when anything changed, so the\n * healed canvas is what gets committed — not just what this process rendered.\n * Called by `canvas validate` and `canvas run`, the two commands every creative\n * passes through before it can ship.\n */\nexport async function healCanvasPaths(filePath: string, canvas: unknown): Promise<CanvasHeal> {\n const canvasDir = path.dirname(filePath);\n const workspaceRoot = findWorkspaceRoot(canvasDir);\n if (!workspaceRoot) return { canvas, rewrites: [], text: null };\n\n const normalized = normalizeCanvasPaths(canvas, canvasDir, workspaceRoot);\n if (normalized.rewrites.length === 0) return { ...normalized, text: null };\n\n const text = `${JSON.stringify(normalized.canvas, null, 2)}\\n`;\n await writeFile(filePath, text, \"utf8\");\n return { ...normalized, text };\n}\n\n/** One line per rewrite, for the agent-facing note. */\nexport function describeRewrites(rewrites: CanvasPathRewrite[]): string {\n return rewrites.map((r) => ` ${r.nodeId}.${r.param}: ${r.from} → ${r.to}`).join(\"\\n\");\n}\n"],"mappings":";;;;;;AAAA,OAAO,UAAU;AAoBV,SAAS,2BAA2B,QAAiB,SAA0B;AACpF,MAAI,CAAC,UAAU,OAAO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