@testmuai/kane-cli 0.8.23 → 0.10.0-rc.1

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 (645) hide show
  1. package/dist/ChatSurface-VPD5G67Q.js +2 -0
  2. package/dist/ChromeProfilePicker-CRKQEFYD.js +2 -0
  3. package/dist/CliFeedbackPrompt-M7BMWLKK.js +2 -0
  4. package/dist/CliUploadProgress-OP7DXMC2.js +2 -0
  5. package/dist/ConfigView-XI74BCCH.js +2 -0
  6. package/dist/EvidenceViewOffer-HAAK6DS5.js +2 -0
  7. package/dist/FolderPicker-W5S6RFCP.js +2 -0
  8. package/dist/InfoBox-OWUEHV2D.js +2 -0
  9. package/dist/LinksBox-PNSESNCU.js +2 -0
  10. package/dist/ProfilesView-PYDZZHKO.js +2 -0
  11. package/dist/ProjectPicker-BGFCUGT5.js +2 -0
  12. package/dist/SaveSessionPrompt-SUJE54GS.js +2 -0
  13. package/dist/ScrollbackTap-4SPXGFMU.js +2 -0
  14. package/dist/SingleShotApp-4TDXZEUA.js +2 -0
  15. package/dist/SummaryBox-FALOODAQ.js +2 -0
  16. package/dist/TestMdRunView-4GPRWHEU.js +2 -0
  17. package/dist/TestrunEvidenceTable-OBVQJ6IO.js +2 -0
  18. package/dist/WhoamiView-6WXGRANY.js +2 -0
  19. package/dist/{agent-parse-2MLJOJTH.js → agent-parse-CAS45UKA.js} +1 -1
  20. package/dist/app-client-U2YYF65L.js +2 -0
  21. package/dist/app-download-RXVZB6MM.js +2 -0
  22. package/dist/assurance-job-C3TXZGLL.js +7 -0
  23. package/dist/auth-7Z54TMQQ.js +2 -0
  24. package/dist/{binary-MOJTQGUV.js → binary-DJCDMGPX.js} +1 -1
  25. package/dist/bind-XVO4CQYV.js +2 -0
  26. package/dist/bootstrap-TY5RANJ7.js +2 -0
  27. package/dist/bridge-T6QMYKED.js +2 -0
  28. package/dist/build-5ZN47FAT.js +2 -0
  29. package/dist/catalog-RRQF4TCA.js +2 -0
  30. package/dist/{changelog-2N6HKKKQ.js → changelog-GBEVIUFJ.js} +1 -1
  31. package/dist/chat-committer-ZCSRJEUB.js +2 -0
  32. package/dist/chat-controller-XINCDH6Z.js +2 -0
  33. package/dist/child-G2GCW73X.js +2 -0
  34. package/dist/chunk-22PIMG52.js +2 -0
  35. package/dist/chunk-252FWF2G.js +19 -0
  36. package/dist/{chunk-AT3RME5W.js → chunk-2IZRPMZN.js} +1 -1
  37. package/dist/chunk-2NFS4KE4.js +2 -0
  38. package/dist/{chunk-LHUW5QDT.js → chunk-2OOFURWD.js} +1 -1
  39. package/dist/chunk-2OSFI33O.js +97 -0
  40. package/dist/chunk-2S3W2JT3.js +5 -0
  41. package/dist/chunk-2SWSVJUP.js +12 -0
  42. package/dist/chunk-2TVPA3LL.js +2 -0
  43. package/dist/chunk-2XW33VOK.js +2 -0
  44. package/dist/chunk-33DWJV67.js +235 -0
  45. package/dist/chunk-34R7BNZ2.js +2 -0
  46. package/dist/chunk-35ECWCCK.js +2 -0
  47. package/dist/chunk-3BSYOCSW.js +3 -0
  48. package/dist/chunk-3G2LSTK5.js +2 -0
  49. package/dist/chunk-3GXN6VF6.js +2 -0
  50. package/dist/chunk-3JLEDSG5.js +4 -0
  51. package/dist/chunk-3QICDXY5.js +5 -0
  52. package/dist/chunk-3UVSAAES.js +10 -0
  53. package/dist/chunk-42PALMW2.js +4 -0
  54. package/dist/chunk-432ZOE42.js +21 -0
  55. package/dist/chunk-44B6THYK.js +2 -0
  56. package/dist/chunk-47WQBG5I.js +6 -0
  57. package/dist/{chunk-J2FJ62K4.js → chunk-4D5PC6QE.js} +1 -1
  58. package/dist/chunk-4I7YN6YY.js +3 -0
  59. package/dist/chunk-4IEQNX7F.js +2 -0
  60. package/dist/{chunk-SYJXTB4J.js → chunk-4LPX2OLV.js} +1 -1
  61. package/dist/chunk-4LTHDJ3D.js +2 -0
  62. package/dist/chunk-4QTH7VYE.js +2 -0
  63. package/dist/chunk-54XA5MZH.js +2 -0
  64. package/dist/chunk-57MDWTON.js +2 -0
  65. package/dist/{chunk-3C32LVLX.js → chunk-5BUIIFLC.js} +1 -1
  66. package/dist/chunk-5D7ENQTQ.js +2 -0
  67. package/dist/chunk-63EKRZKI.js +2 -0
  68. package/dist/{chunk-EHN5HTUD.js → chunk-65VANXOF.js} +51 -51
  69. package/dist/chunk-672CQECV.js +47 -0
  70. package/dist/chunk-6LIC2R22.js +3 -0
  71. package/dist/chunk-6NFOH4AC.js +4 -0
  72. package/dist/chunk-6NWT2TEJ.js +2 -0
  73. package/dist/chunk-6PIIUAZF.js +3 -0
  74. package/dist/{chunk-MBJHS653.js → chunk-6U7ID777.js} +1 -1
  75. package/dist/chunk-6UVIY56J.js +2 -0
  76. package/dist/chunk-72KYMWQ5.js +2 -0
  77. package/dist/chunk-72RC7JSA.js +21 -0
  78. package/dist/chunk-74W4AOT2.js +2 -0
  79. package/dist/chunk-77ZZQJLX.js +2 -0
  80. package/dist/chunk-7DFBOVUB.js +2 -0
  81. package/dist/chunk-7EXDYXXD.js +2 -0
  82. package/dist/chunk-7HO4NX5W.js +1 -0
  83. package/dist/chunk-7KX2BHKG.js +2 -0
  84. package/dist/chunk-7LKCWO2R.js +11 -0
  85. package/dist/{chunk-ULGZPRKU.js → chunk-7NCJMWFX.js} +1 -1
  86. package/dist/chunk-7RPKHKA3.js +2 -0
  87. package/dist/chunk-7RWP4Y3H.js +2 -0
  88. package/dist/chunk-7V4BQSSV.js +2 -0
  89. package/dist/chunk-7XBNMOH4.js +6 -0
  90. package/dist/chunk-A6TJOZ24.js +2 -0
  91. package/dist/chunk-A7RJQJNT.js +2 -0
  92. package/dist/chunk-AA674WLL.js +2 -0
  93. package/dist/chunk-AIXJYMSP.js +9 -0
  94. package/dist/chunk-AJQZ3ST5.js +8 -0
  95. package/dist/chunk-AQ2OG2EF.js +2 -0
  96. package/dist/chunk-AUJSC7PU.js +4 -0
  97. package/dist/chunk-AVI5H4UM.js +13 -0
  98. package/dist/chunk-AZLNLHUA.js +4 -0
  99. package/dist/chunk-B2HXPGIZ.js +26 -0
  100. package/dist/chunk-B7ZX5HEN.js +8 -0
  101. package/dist/{chunk-XQQHSC7G.js → chunk-BJJUKB5K.js} +1 -1
  102. package/dist/{chunk-66MOZKD2.js → chunk-BSRSXYDZ.js} +1 -1
  103. package/dist/{chunk-TONFENRW.js → chunk-BVO4C5F2.js} +1 -1
  104. package/dist/chunk-BWXLZS5O.js +2 -0
  105. package/dist/chunk-BY65QAAN.js +4 -0
  106. package/dist/chunk-BZVNI44O.js +6 -0
  107. package/dist/chunk-C5Z7MQE6.js +2 -0
  108. package/dist/chunk-C6HI6Y3S.js +2 -0
  109. package/dist/chunk-CB4ARIHR.js +2 -0
  110. package/dist/chunk-CPBBYNL7.js +4 -0
  111. package/dist/{chunk-GFNCGN5V.js → chunk-D4FFXCX6.js} +2 -2
  112. package/dist/chunk-D756UWY2.js +6 -0
  113. package/dist/chunk-DBMW3VUN.js +4 -0
  114. package/dist/chunk-DD5TULWQ.js +34 -0
  115. package/dist/{chunk-SY4T44VC.js → chunk-DDJNYQBH.js} +1 -1
  116. package/dist/{chunk-KJIDMW6N.js → chunk-DHQ4SQWA.js} +1 -1
  117. package/dist/chunk-DNGOT65K.js +3 -0
  118. package/dist/chunk-DPGOAFKF.js +2 -0
  119. package/dist/chunk-DREQ3RAA.js +2 -0
  120. package/dist/chunk-DTUPEKEO.js +2 -0
  121. package/dist/chunk-E6KSRQXL.js +8 -0
  122. package/dist/chunk-EF47KRUK.js +2 -0
  123. package/dist/chunk-ENL4XTQ2.js +2 -0
  124. package/dist/chunk-EXFDIVNI.js +9 -0
  125. package/dist/chunk-EZN7CF45.js +4 -0
  126. package/dist/chunk-F3U6T4YD.js +22 -0
  127. package/dist/{chunk-DHJSM5DT.js → chunk-FCD3NYOM.js} +1 -1
  128. package/dist/chunk-FFL55I2M.js +2 -0
  129. package/dist/chunk-FIP5L6LV.js +9 -0
  130. package/dist/chunk-FOJHSG5M.js +6 -0
  131. package/dist/chunk-FSYOTRMC.js +2 -0
  132. package/dist/chunk-GFLB2SHW.js +2 -0
  133. package/dist/chunk-GMTHZUZ3.js +2 -0
  134. package/dist/chunk-GRURFGBP.js +2 -0
  135. package/dist/chunk-GZFLJORM.js +2 -0
  136. package/dist/{chunk-PXHN7SFG.js → chunk-H3HHSTEK.js} +4 -4
  137. package/dist/chunk-HAW5WEKT.js +13 -0
  138. package/dist/chunk-HFJSP4KD.js +2 -0
  139. package/dist/chunk-HHW6MRU3.js +6 -0
  140. package/dist/chunk-HIUAUZNL.js +2 -0
  141. package/dist/chunk-HJLMH7ZM.js +2 -0
  142. package/dist/{chunk-5GUD3CIH.js → chunk-HQ2E2XCU.js} +1 -1
  143. package/dist/chunk-I2KOGINW.js +7 -0
  144. package/dist/chunk-I2MC6VVX.js +2 -0
  145. package/dist/chunk-I5NSJBOZ.js +2 -0
  146. package/dist/chunk-I6OQISK4.js +2 -0
  147. package/dist/chunk-IBBD36FQ.js +2 -0
  148. package/dist/chunk-IINZZ4BZ.js +2 -0
  149. package/dist/{chunk-UYI4WPNQ.js → chunk-IMDMRJQ6.js} +2 -2
  150. package/dist/chunk-IXW7FOGX.js +2 -0
  151. package/dist/chunk-IZ65ZPWY.js +3 -0
  152. package/dist/chunk-JD52IXON.js +9 -0
  153. package/dist/chunk-JGRXMTME.js +15 -0
  154. package/dist/{chunk-NBXYL2JT.js → chunk-JIRNI5TB.js} +7 -7
  155. package/dist/chunk-JNSWKGTB.js +2 -0
  156. package/dist/chunk-JPYW6U4D.js +2 -0
  157. package/dist/chunk-JQSLUGD4.js +3 -0
  158. package/dist/chunk-K45BKGB5.js +8 -0
  159. package/dist/chunk-KF4DKXSS.js +2 -0
  160. package/dist/chunk-KGNE5CIM.js +2 -0
  161. package/dist/chunk-KM3YCIDV.js +3 -0
  162. package/dist/chunk-KU3YHPWZ.js +2 -0
  163. package/dist/chunk-L4UVUFL6.js +3 -0
  164. package/dist/chunk-LCSJ7GOG.js +2 -0
  165. package/dist/chunk-LKQFG4RW.js +5 -0
  166. package/dist/chunk-LNNWCBPQ.js +2 -0
  167. package/dist/chunk-LRS5MGBY.js +3 -0
  168. package/dist/chunk-LRXBJTD4.js +4 -0
  169. package/dist/chunk-LSDJOVWW.js +6 -0
  170. package/dist/chunk-LWJRSUE2.js +2 -0
  171. package/dist/chunk-LX2I4JEH.js +2 -0
  172. package/dist/{chunk-K6VDRR3H.js → chunk-M6MBMRFR.js} +1 -1
  173. package/dist/chunk-MGNRNLBE.js +2 -0
  174. package/dist/chunk-MII3JOO3.js +4 -0
  175. package/dist/chunk-MNBGG4H3.js +16 -0
  176. package/dist/chunk-MYVKUJGS.js +2 -0
  177. package/dist/chunk-MYZHOBS4.js +2 -0
  178. package/dist/chunk-MZOIHUVX.js +27 -0
  179. package/dist/{chunk-OFRYEWZE.js → chunk-N3TCNZSX.js} +1 -1
  180. package/dist/chunk-NC7D7GOM.js +21 -0
  181. package/dist/{chunk-CLQP3DHT.js → chunk-NDEI7R4K.js} +1 -1
  182. package/dist/chunk-NFRA64NU.js +10 -0
  183. package/dist/chunk-NLZZLANH.js +4 -0
  184. package/dist/{chunk-5HOHXV2K.js → chunk-NQTYWHPB.js} +1 -1
  185. package/dist/chunk-NWBLYMH7.js +3 -0
  186. package/dist/chunk-NWD54VV5.js +2 -0
  187. package/dist/chunk-NXRF7FFS.js +2 -0
  188. package/dist/chunk-O3HHTKZ5.js +6 -0
  189. package/dist/{chunk-FPFS6OSR.js → chunk-OAKYUBD3.js} +1 -1
  190. package/dist/chunk-OEWYXCTA.js +7 -0
  191. package/dist/{chunk-BASTDR3M.js → chunk-OF7WPCTQ.js} +1 -1
  192. package/dist/chunk-OFSDB7B4.js +3 -0
  193. package/dist/chunk-OJ33Q6DU.js +2 -0
  194. package/dist/chunk-OQ5G773E.js +2 -0
  195. package/dist/chunk-OVNRRI4E.js +2 -0
  196. package/dist/{chunk-RAARDC2O.js → chunk-OZNBTSW5.js} +1 -1
  197. package/dist/chunk-P2ZQDQDB.js +2 -0
  198. package/dist/chunk-P7MSVLAH.js +6 -0
  199. package/dist/chunk-PUVMC4PX.js +26 -0
  200. package/dist/{chunk-SEEEGDVK.js → chunk-PZA3BSOE.js} +1 -1
  201. package/dist/chunk-Q3C6NDGI.js +2 -0
  202. package/dist/chunk-QCKA665H.js +2 -0
  203. package/dist/chunk-QDFY5GGO.js +5 -0
  204. package/dist/chunk-QHRUBG7J.js +2 -0
  205. package/dist/chunk-QI5RZ7LL.js +2 -0
  206. package/dist/chunk-QNLVC5ZB.js +2 -0
  207. package/dist/{chunk-DSKJ6J7Y.js → chunk-QQ4TKLWP.js} +1 -1
  208. package/dist/chunk-QS5ZJFGF.js +4 -0
  209. package/dist/chunk-QTZBVDPR.js +12 -0
  210. package/dist/chunk-QXQ7KVEN.js +2 -0
  211. package/dist/chunk-R4JUKTDO.js +2 -0
  212. package/dist/chunk-R7KXAISS.js +12 -0
  213. package/dist/chunk-RDP7GWSY.js +2 -0
  214. package/dist/chunk-REKHAN53.js +5 -0
  215. package/dist/{chunk-5RHR4DMF.js → chunk-RFEON5GN.js} +1 -1
  216. package/dist/chunk-RFIIM33J.js +2 -0
  217. package/dist/chunk-RG372DON.js +6 -0
  218. package/dist/chunk-RPRXRKKR.js +2 -0
  219. package/dist/chunk-RTVWQK7I.js +2 -0
  220. package/dist/chunk-RW3Z2HMB.js +7 -0
  221. package/dist/chunk-RX47NRSM.js +2 -0
  222. package/dist/chunk-RX6776AI.js +5 -0
  223. package/dist/chunk-S53AQU7R.js +6 -0
  224. package/dist/{chunk-HJX5PQRD.js → chunk-SA6IKFFD.js} +1 -1
  225. package/dist/{chunk-2MEQTHNI.js → chunk-SLKYD44Y.js} +1 -1
  226. package/dist/chunk-SMTBOSEJ.js +2 -0
  227. package/dist/chunk-SMXABALN.js +2 -0
  228. package/dist/chunk-SONMD3W5.js +5 -0
  229. package/dist/chunk-SWMTXMKB.js +2 -0
  230. package/dist/chunk-SXRHKXSE.js +2 -0
  231. package/dist/chunk-T3HEJASG.js +5 -0
  232. package/dist/chunk-T4AVLJCW.js +6 -0
  233. package/dist/{chunk-J6TBTWW7.js → chunk-T6K2MEWP.js} +1 -1
  234. package/dist/{chunk-D6BULK7E.js → chunk-T7H4LBFK.js} +1 -1
  235. package/dist/chunk-TNORODUF.js +2 -0
  236. package/dist/chunk-TW63WWEN.js +2 -0
  237. package/dist/chunk-UALJTPSA.js +18 -0
  238. package/dist/chunk-UAWWLLTI.js +2 -0
  239. package/dist/chunk-UEE3RZN4.js +14 -0
  240. package/dist/chunk-UTM7D4PI.js +2 -0
  241. package/dist/chunk-UUJIGOEO.js +2 -0
  242. package/dist/chunk-UYDHOHSZ.js +2 -0
  243. package/dist/chunk-V5JGXOV7.js +2 -0
  244. package/dist/chunk-V7S6S5W3.js +2 -0
  245. package/dist/{chunk-HBSYBL6J.js → chunk-VG44B5JD.js} +1 -1
  246. package/dist/chunk-VJGWVBZR.js +1 -0
  247. package/dist/chunk-VLDCHFXF.js +2 -0
  248. package/dist/chunk-VO66KP2W.js +2 -0
  249. package/dist/{chunk-D4XR7EEQ.js → chunk-VQLH63X7.js} +14 -12
  250. package/dist/chunk-VRIZDOO5.js +2 -0
  251. package/dist/chunk-VYHT2IET.js +1397 -0
  252. package/dist/chunk-VZJ6LUXX.js +2 -0
  253. package/dist/chunk-W3OVSDBN.js +29 -0
  254. package/dist/chunk-W7FLXW6Q.js +5 -0
  255. package/dist/{chunk-IEW7AW64.js → chunk-WEM3MOAL.js} +1 -1
  256. package/dist/chunk-WI7K6VKQ.js +2 -0
  257. package/dist/chunk-WMGKUERB.js +6 -0
  258. package/dist/{chunk-DFS4RMVP.js → chunk-WN5VKKJ3.js} +1 -1
  259. package/dist/chunk-WOSANGV6.js +5 -0
  260. package/dist/chunk-WYSZ6TPW.js +15 -0
  261. package/dist/chunk-XB6BJPDL.js +2 -0
  262. package/dist/{chunk-5ESGUPSR.js → chunk-XBEYWXPV.js} +1 -1
  263. package/dist/chunk-XIPKSXRQ.js +16 -0
  264. package/dist/chunk-XJ7HCXKW.js +2 -0
  265. package/dist/chunk-XMPTFXPW.js +5 -0
  266. package/dist/chunk-XZYA7DNH.js +2 -0
  267. package/dist/chunk-Y4T4SLDO.js +2 -0
  268. package/dist/chunk-Y6Y6RAY4.js +2 -0
  269. package/dist/chunk-YDPTSDIJ.js +2 -0
  270. package/dist/chunk-YDSGXB25.js +2 -0
  271. package/dist/chunk-YIKF4ERQ.js +375 -0
  272. package/dist/chunk-Z55KBMYV.js +2 -0
  273. package/dist/chunk-ZCRZFAOT.js +2 -0
  274. package/dist/chunk-ZFM77AQU.js +2 -0
  275. package/dist/{chunk-Q6F23V7L.js → chunk-ZFMRQ57Y.js} +1 -1
  276. package/dist/chunk-ZHWU6L2G.js +5 -0
  277. package/dist/chunk-ZTHYAHDN.js +17 -0
  278. package/dist/chunk-ZZP5SHUV.js +3 -0
  279. package/dist/committer-JGY66PFM.js +2 -0
  280. package/dist/config-5ZOALGKE.js +2 -0
  281. package/dist/controller-client-PB3AZAGG.js +2 -0
  282. package/dist/cover-cmd-UA2SVIZZ.js +2 -0
  283. package/dist/{credentials-PSQWWFGD.js → credentials-MRG452Y6.js} +1 -1
  284. package/dist/{deps-bundle-PPOQHJTB.js → deps-bundle-FWINW4XM.js} +1 -1
  285. package/dist/{deps-resolve-AX6ZAKLH.js → deps-resolve-IET4KIBO.js} +1 -1
  286. package/dist/descriptor-7T32VRMB.js +2 -0
  287. package/dist/design-chat-MM5PJD2N.js +2 -0
  288. package/dist/design-committer-TRYP3LOZ.js +2 -0
  289. package/dist/design-headless-FZONCKHW.js +2 -0
  290. package/dist/design-remote-SPVRIY2H.js +3 -0
  291. package/dist/device-env-LXJ65AVF.js +2 -0
  292. package/dist/dispatch-DVQ3H7EJ.js +2 -0
  293. package/dist/doctor-VAX2BWQF.js +2 -0
  294. package/dist/docx-convert-6IZO5P5K.js +2 -0
  295. package/dist/{dossier-7HVC6BNK.js → dossier-NROC2MCY.js} +1 -1
  296. package/dist/evidence-LVVK7ROT.js +2 -0
  297. package/dist/evidence-presentation-YYTIDCBS.js +2 -0
  298. package/dist/evolve-cmd-AGRKG7T3.js +2 -0
  299. package/dist/evolve-remote-BGHULJTL.js +2 -0
  300. package/dist/{exit-manager-ZLDO54S4.js → exit-manager-EDHCETUN.js} +1 -1
  301. package/dist/explain-DGJ5T6V5.js +2 -0
  302. package/dist/explain-cmd-VYAANFFZ.js +4 -0
  303. package/dist/explain-cmd-WOBGS6KX.js +12 -0
  304. package/dist/explore-LOKNOVNP.js +2 -0
  305. package/dist/explore-context-tty-JTZVZFOE.js +2 -0
  306. package/dist/explore-entry-5OGNLFAU.js +6 -0
  307. package/dist/explore-live-2XZHUYFS.js +5 -0
  308. package/dist/explore-run-tty-LGTIK2NA.js +5 -0
  309. package/dist/extract-bind-NM2BBK4I.js +14 -0
  310. package/dist/extract-chat-HLQMJJIC.js +2 -0
  311. package/dist/extract-cmd-T2TSAC3N.js +6 -0
  312. package/dist/extract-headless-OQTQ3FJK.js +2 -0
  313. package/dist/feeder-NY45UFJK.js +2 -0
  314. package/dist/folder-flags-WXUR6OPJ.js +2 -0
  315. package/dist/gaps-cmd-PTSKPTF7.js +3 -0
  316. package/dist/gate-P57VP4E5.js +2 -0
  317. package/dist/gate-WISOUTHQ.js +2 -0
  318. package/dist/{generate-headless-TEDHS3F2.js → generate-headless-JYZP6VXZ.js} +3 -3
  319. package/dist/headless-io-FFM5T6KL.js +2 -0
  320. package/dist/hold-passthrough-IOWPVB4W.js +2 -0
  321. package/dist/identity-HL5CJJXR.js +2 -0
  322. package/dist/index.js +194 -175
  323. package/dist/ingest-PDGS5ZTL.js +2 -0
  324. package/dist/ingest-cmd-LHCBMO4Z.js +8 -0
  325. package/dist/ingest-remote-D5TO5JQP.js +2 -0
  326. package/dist/ink-screen-RZ7QDIUI.js +2 -0
  327. package/dist/install-Z6K2D2VY.js +2 -0
  328. package/dist/interactive-bind-5EJQUGKI.js +26 -0
  329. package/dist/interactive-remote-D77ULJGL.js +65 -0
  330. package/dist/interrupt-guard-QETBPINI.js +2 -0
  331. package/dist/lane-AQYRIW24.js +2 -0
  332. package/dist/lattice-auth-74XGF77Y.js +2 -0
  333. package/dist/lifecycle-cmd-7SM6UCMH.js +2 -0
  334. package/dist/list-cmd-Z6FZXMFU.js +3 -0
  335. package/dist/list-commands-CZYZ7GIG.js +2 -0
  336. package/dist/list-remote-WOPOC6KK.js +15 -0
  337. package/dist/locks-cmd-JJ2QNTNY.js +2 -0
  338. package/dist/logical-ids-RXAQJZ3T.js +2 -0
  339. package/dist/login-flow-2FZEOVHM.js +2 -0
  340. package/dist/maintenance-cmd-VRTGZVRE.js +2 -0
  341. package/dist/mobile-prompts-KNAHU64X.js +2 -0
  342. package/dist/{next-KZXH4UA4.js → next-O6SUSX3R.js} +1 -1
  343. package/dist/{objective-variable-gate-JALOH6SL.js → objective-variable-gate-3Z7DNVVC.js} +1 -1
  344. package/dist/onboarding-LGT6PMDZ.js +5 -0
  345. package/dist/open-provider-OZAG6WZS.js +2 -0
  346. package/dist/{paths-JCYX6UWL.js → paths-UMIX3RJF.js} +1 -1
  347. package/dist/pdf-convert-447ACUB3.js +2 -0
  348. package/dist/persist-recorded-session-BX7II5P7.js +3 -0
  349. package/dist/phase-seed-LCJ4WSYV.js +2 -0
  350. package/dist/pipeline-IXVTVRS5.js +2 -0
  351. package/dist/prepare-target-ULMKVKMC.js +2 -0
  352. package/dist/pull-cmd-6AL2WYHB.js +2 -0
  353. package/dist/pull-route-TTVARJMV.js +2 -0
  354. package/dist/readmodel-INMP6MNW.js +2 -0
  355. package/dist/real-device-run-2LFS5WE2.js +2 -0
  356. package/dist/reconcile-cmd-R6H37SQR.js +5 -0
  357. package/dist/reconcile-deps-TWJ3FTSU.js +2 -0
  358. package/dist/reconcile-remote-GWDV5CUT.js +13 -0
  359. package/dist/recording-banner-ACC67Q2U.js +2 -0
  360. package/dist/registry-6IJYQXQC.js +2 -0
  361. package/dist/remote-entry-YL7O2NJQ.js +2 -0
  362. package/dist/remote-mode-7G6PLJCW.js +4 -0
  363. package/dist/remote-words-45USLRVN.js +2 -0
  364. package/dist/require-project-folder-A3UDRELU.js +2 -0
  365. package/dist/resolve-run-intent-ZGPSUBXV.js +2 -0
  366. package/dist/resolver-IPM6R7U4.js +2 -0
  367. package/dist/revert-FHOBLZWF.js +2 -0
  368. package/dist/review-cmd-NNT5C5RZ.js +5 -0
  369. package/dist/run-5RQUCNYP.js +2 -0
  370. package/dist/run-PC5YO4AS.js +2 -0
  371. package/dist/run-channel-63SVP5OI.js +2 -0
  372. package/dist/run-remote-3AYYVPKX.js +2 -0
  373. package/dist/run-startup-gate-NKRMKYBB.js +2 -0
  374. package/dist/run-test-md-HE6DUWQR.js +17 -0
  375. package/dist/scrollback-GGNBDFQV.js +2 -0
  376. package/dist/session-target-DD53UXO7.js +2 -0
  377. package/dist/session-worker.js +12 -0
  378. package/dist/sessions-CFV7FOIT.js +2 -0
  379. package/dist/sessions-cmd-GYMETJHG.js +26 -0
  380. package/dist/sessions-remote-GI7GOBMH.js +3 -0
  381. package/dist/shell-arg-FN3MT5U7.js +2 -0
  382. package/dist/{skill-installer-T2IOCPET.js → skill-installer-3QAVQGDH.js} +1 -1
  383. package/dist/spawner-C7NLLM4F.js +2 -0
  384. package/dist/store-X6XPFSKF.js +2 -0
  385. package/dist/store-choice-RT73HAI7.js +2 -0
  386. package/dist/store-guard-SNWKLHQV.js +2 -0
  387. package/dist/store-id-YZ5WKJ25.js +2 -0
  388. package/dist/store-site-KA2DNBGY.js +2 -0
  389. package/dist/stream-warnings-GEQKKJU7.js +2 -0
  390. package/dist/structured-answers-EQ2AP3F7.js +2 -0
  391. package/dist/sync-cmd-NBPPDG3B.js +2 -0
  392. package/dist/sync-setup-5NUCH6N3.js +2 -0
  393. package/dist/{sync-setup-ui-RC727VK6.js → sync-setup-ui-XITPGSO4.js} +2 -2
  394. package/dist/tcg-generate-Z23CUISY.js +2 -0
  395. package/dist/test-definition-VRI4YIYL.js +2 -0
  396. package/dist/testmd-actions-GH5BW5V5.js +2 -0
  397. package/dist/testmd-sync-ACKCIOL3.js +2 -0
  398. package/dist/tms-client-NXAB6VJD.js +2 -0
  399. package/dist/token-refresh-4UCYAG6A.js +2 -0
  400. package/dist/trust-gate-AT2XBWN4.js +2 -0
  401. package/dist/turn-preflight-LHYLRL7G.js +2 -0
  402. package/dist/ui-SNV3FD2G.js +4 -0
  403. package/dist/use-case-ref-NE4X4MZN.js +2 -0
  404. package/dist/validate-basic-RE2WLIGQ.js +2 -0
  405. package/dist/{variable-receipt-F55CSW5Z.js → variable-receipt-BXSZO36E.js} +1 -1
  406. package/dist/verdicts-XK3GAUX3.js +2 -0
  407. package/dist/version-check-4FJVZP3K.js +2 -0
  408. package/dist/{view-cmd-ELDKYRMZ.js → view-cmd-N47BQZPD.js} +4 -3
  409. package/dist/walk-session-DA7QWXSW.js +2 -0
  410. package/dist/with-telemetry-7V4LY2BG.js +2 -0
  411. package/package.json +11 -11
  412. package/dist/ChatSurface-GBZX4LWL.js +0 -8
  413. package/dist/ChromeProfilePicker-UONX2UVC.js +0 -2
  414. package/dist/CliFeedbackPrompt-6BJCNRNG.js +0 -2
  415. package/dist/CliUploadProgress-K4Z22DSY.js +0 -2
  416. package/dist/ConfigView-BB22G7JO.js +0 -2
  417. package/dist/EvidenceViewOffer-25IQF3TX.js +0 -2
  418. package/dist/FolderPicker-65JFR2NW.js +0 -2
  419. package/dist/InfoBox-OU5PLRIL.js +0 -2
  420. package/dist/LinksBox-DH7TSUXW.js +0 -2
  421. package/dist/ProfilesView-MGJKBOF5.js +0 -2
  422. package/dist/ProjectPicker-YFV6K77F.js +0 -2
  423. package/dist/SaveSessionPrompt-64QKQB6B.js +0 -2
  424. package/dist/ScrollbackTap-QHJOFYMC.js +0 -2
  425. package/dist/SingleShotApp-VYKUCRVW.js +0 -2
  426. package/dist/SummaryBox-DGS3LVRF.js +0 -2
  427. package/dist/TestMdRunView-LKAITAA4.js +0 -2
  428. package/dist/TestrunEvidenceTable-PHBAB4XQ.js +0 -2
  429. package/dist/WhoamiView-6HWPYN6Y.js +0 -2
  430. package/dist/app-client-ZCCNE3RV.js +0 -2
  431. package/dist/app-download-SQ2LYYL7.js +0 -2
  432. package/dist/auth-NWBIFCB7.js +0 -2
  433. package/dist/bind-S3IQTPNN.js +0 -15
  434. package/dist/bootstrap-RCV7PNMQ.js +0 -2
  435. package/dist/bridge-O7ENTV4K.js +0 -2
  436. package/dist/build-JIKYOZUH.js +0 -2
  437. package/dist/chat-committer-6D7AQI6Z.js +0 -2
  438. package/dist/chat-controller-UJQ6Z4RE.js +0 -2
  439. package/dist/chunk-2A7OQRAD.js +0 -17
  440. package/dist/chunk-2FH4HJYB.js +0 -5
  441. package/dist/chunk-2KVECC36.js +0 -2
  442. package/dist/chunk-2YEHV2CX.js +0 -2
  443. package/dist/chunk-3OKX64UR.js +0 -2
  444. package/dist/chunk-3UI5VTQS.js +0 -4
  445. package/dist/chunk-3UMVRJX3.js +0 -6
  446. package/dist/chunk-3VAU3PNU.js +0 -2
  447. package/dist/chunk-5EOX4MEY.js +0 -2
  448. package/dist/chunk-5LJRZI7S.js +0 -6
  449. package/dist/chunk-5UHY3PTQ.js +0 -3
  450. package/dist/chunk-5ZFOKYFB.js +0 -5
  451. package/dist/chunk-63DYVWNX.js +0 -2
  452. package/dist/chunk-6YZ3VP3E.js +0 -2
  453. package/dist/chunk-7KRY26OF.js +0 -4
  454. package/dist/chunk-7N6OCHPC.js +0 -7
  455. package/dist/chunk-A2SQD2AY.js +0 -4
  456. package/dist/chunk-AACQE24F.js +0 -2
  457. package/dist/chunk-AGDPEZXT.js +0 -4
  458. package/dist/chunk-AIK7BAME.js +0 -8
  459. package/dist/chunk-ATYXPCM6.js +0 -6
  460. package/dist/chunk-AXTPNZPX.js +0 -2
  461. package/dist/chunk-BB2W35TW.js +0 -2
  462. package/dist/chunk-BKM2LWU2.js +0 -3
  463. package/dist/chunk-BL5QHONU.js +0 -2
  464. package/dist/chunk-C44QQJR4.js +0 -239
  465. package/dist/chunk-C7NWWGLT.js +0 -6
  466. package/dist/chunk-CAJZQQ3G.js +0 -3
  467. package/dist/chunk-CSVPZ33X.js +0 -2
  468. package/dist/chunk-CXF6AZWY.js +0 -2
  469. package/dist/chunk-D6E6KRVX.js +0 -2
  470. package/dist/chunk-D7WG7SRA.js +0 -2
  471. package/dist/chunk-DDHGEJJP.js +0 -2
  472. package/dist/chunk-DUYRCVI5.js +0 -2
  473. package/dist/chunk-DWHF5HUD.js +0 -2
  474. package/dist/chunk-EM3PU2YW.js +0 -2
  475. package/dist/chunk-EVFFDODK.js +0 -5
  476. package/dist/chunk-EYOCNMUM.js +0 -2
  477. package/dist/chunk-F2OBORCG.js +0 -2
  478. package/dist/chunk-FMBPUXWL.js +0 -8
  479. package/dist/chunk-FORNRNHU.js +0 -2
  480. package/dist/chunk-FQJOWUEN.js +0 -2
  481. package/dist/chunk-FQNQVC5O.js +0 -5
  482. package/dist/chunk-FY7TCYPK.js +0 -6
  483. package/dist/chunk-HJGVM6TS.js +0 -370
  484. package/dist/chunk-HPHETGRE.js +0 -2
  485. package/dist/chunk-I7TIGB7K.js +0 -2
  486. package/dist/chunk-IGHK2ENL.js +0 -2
  487. package/dist/chunk-IICT4VOU.js +0 -2
  488. package/dist/chunk-IIDBLJ5A.js +0 -18
  489. package/dist/chunk-JFZA4UON.js +0 -9
  490. package/dist/chunk-K2UJYY2U.js +0 -2
  491. package/dist/chunk-KBM3XHAM.js +0 -2
  492. package/dist/chunk-KDNNMU7Q.js +0 -4
  493. package/dist/chunk-KJQNAOOE.js +0 -6
  494. package/dist/chunk-LF42V6P6.js +0 -7
  495. package/dist/chunk-LNFU4JZ7.js +0 -2
  496. package/dist/chunk-LNSBC32V.js +0 -2
  497. package/dist/chunk-LSDWPG6C.js +0 -2
  498. package/dist/chunk-MKMJOMLX.js +0 -8
  499. package/dist/chunk-MKQ7ZRDW.js +0 -2
  500. package/dist/chunk-MSGW4JDG.js +0 -2
  501. package/dist/chunk-MV3Q335C.js +0 -7
  502. package/dist/chunk-MWIE6LOZ.js +0 -4
  503. package/dist/chunk-MZ7W4WLF.js +0 -4
  504. package/dist/chunk-NIFJJX6N.js +0 -12
  505. package/dist/chunk-NJ4BXZBX.js +0 -2
  506. package/dist/chunk-NLCCBXXV.js +0 -2
  507. package/dist/chunk-ODU2JSMA.js +0 -8
  508. package/dist/chunk-OYKRCDT4.js +0 -15
  509. package/dist/chunk-Q2F5QB2W.js +0 -2
  510. package/dist/chunk-Q4YYAN6E.js +0 -2
  511. package/dist/chunk-Q6AHSGOE.js +0 -5
  512. package/dist/chunk-QAG67DUT.js +0 -2
  513. package/dist/chunk-QGXVQIN5.js +0 -27
  514. package/dist/chunk-QQCEP3QP.js +0 -2
  515. package/dist/chunk-QU7P7B3W.js +0 -4
  516. package/dist/chunk-RAPV3BTA.js +0 -98
  517. package/dist/chunk-RD72POF2.js +0 -2
  518. package/dist/chunk-RDHWNSDP.js +0 -7
  519. package/dist/chunk-RGRFL7XG.js +0 -29
  520. package/dist/chunk-RKXHVP2Z.js +0 -2
  521. package/dist/chunk-RMVASIVL.js +0 -35
  522. package/dist/chunk-RRY5IXOB.js +0 -2
  523. package/dist/chunk-RSSOJ3L2.js +0 -21
  524. package/dist/chunk-SB2SKN34.js +0 -2
  525. package/dist/chunk-SFFDVF3J.js +0 -9
  526. package/dist/chunk-T2ONUKTL.js +0 -5
  527. package/dist/chunk-TAOHYWEO.js +0 -2
  528. package/dist/chunk-U6OTFMIT.js +0 -4
  529. package/dist/chunk-UD7KKHPW.js +0 -5
  530. package/dist/chunk-UF4MU2AZ.js +0 -22
  531. package/dist/chunk-UQSVO7TY.js +0 -9
  532. package/dist/chunk-URWWROLS.js +0 -9
  533. package/dist/chunk-V4B5QA3U.js +0 -4
  534. package/dist/chunk-VACHFCNC.js +0 -21
  535. package/dist/chunk-VAN7ECN6.js +0 -2
  536. package/dist/chunk-VIO7CCFW.js +0 -5
  537. package/dist/chunk-VOYMN2WQ.js +0 -5
  538. package/dist/chunk-VVOKM2VO.js +0 -2
  539. package/dist/chunk-W5TTF7GB.js +0 -6
  540. package/dist/chunk-WESMQEPO.js +0 -2
  541. package/dist/chunk-WICJY6KL.js +0 -6
  542. package/dist/chunk-WJR2FU7S.js +0 -16
  543. package/dist/chunk-WVHMPIDQ.js +0 -2
  544. package/dist/chunk-X4NUVVCJ.js +0 -26
  545. package/dist/chunk-XLSOQLVT.js +0 -2
  546. package/dist/chunk-YCCUBQY4.js +0 -2
  547. package/dist/chunk-YFQGOOF7.js +0 -2
  548. package/dist/chunk-YI3H2UIB.js +0 -2
  549. package/dist/chunk-YKTYVJBN.js +0 -3
  550. package/dist/chunk-YLQHY4A7.js +0 -2
  551. package/dist/chunk-ZIHG6EKH.js +0 -2
  552. package/dist/chunk-ZKSN2SJ7.js +0 -2
  553. package/dist/chunk-ZLWURCJ7.js +0 -2
  554. package/dist/committer-2QPBANRD.js +0 -2
  555. package/dist/config-7E4NS553.js +0 -2
  556. package/dist/controller-client-ZF5IXRUV.js +0 -2
  557. package/dist/cover-cmd-6KZX46S2.js +0 -3
  558. package/dist/descriptor-3JJUOHBM.js +0 -2
  559. package/dist/design-committer-D44GSUXY.js +0 -2
  560. package/dist/device-env-TZQDB5T3.js +0 -2
  561. package/dist/dispatch-KMWEDMKE.js +0 -2
  562. package/dist/doctor-XDF3MA4W.js +0 -2
  563. package/dist/docx-convert-SQRTF7XS.js +0 -2
  564. package/dist/evidence-EUIDOVOR.js +0 -2
  565. package/dist/evidence-presentation-XF23B7F2.js +0 -2
  566. package/dist/evolve-cmd-QVTGTCJ5.js +0 -2
  567. package/dist/explain-NEFBUX5G.js +0 -2
  568. package/dist/explain-cmd-36SVSHU7.js +0 -9
  569. package/dist/explain-cmd-JAOHSI4F.js +0 -3
  570. package/dist/extract-bind-PLMSZKLZ.js +0 -14
  571. package/dist/extract-cmd-RJBHPPF3.js +0 -5
  572. package/dist/feeder-66TUPB2R.js +0 -2
  573. package/dist/gaps-cmd-3WZPDDYS.js +0 -3
  574. package/dist/gate-OYRDJMF6.js +0 -2
  575. package/dist/headless-io-75HUMWZB.js +0 -2
  576. package/dist/identity-ADZ4PAJF.js +0 -2
  577. package/dist/ingest-OSNNM3DH.js +0 -2
  578. package/dist/ingest-cmd-JDIOPJBN.js +0 -2
  579. package/dist/install-Y3VKFBK3.js +0 -2
  580. package/dist/interactive-bind-XUMKEGAN.js +0 -26
  581. package/dist/interrupt-guard-UREUWNRL.js +0 -2
  582. package/dist/lifecycle-cmd-FBDRFIOE.js +0 -2
  583. package/dist/list-cmd-TFUACRAM.js +0 -3
  584. package/dist/list-commands-OHIQFJGQ.js +0 -2
  585. package/dist/locks-cmd-67OHQZNV.js +0 -2
  586. package/dist/logical-ids-GLVM2SVR.js +0 -2
  587. package/dist/login-flow-OHNKSVYZ.js +0 -2
  588. package/dist/maintenance-cmd-7OSUIDL4.js +0 -2
  589. package/dist/mobile-prompts-DEVUZRG3.js +0 -2
  590. package/dist/open-provider-746LLSEO.js +0 -2
  591. package/dist/pdf-convert-RLXSXFWN.js +0 -2
  592. package/dist/persist-recorded-session-GPP6UKN6.js +0 -3
  593. package/dist/phase-seed-MKHEWUN6.js +0 -2
  594. package/dist/pipeline-QPTPZVUJ.js +0 -2
  595. package/dist/prepare-target-N7QRNYOS.js +0 -2
  596. package/dist/readmodel-FVLRQWZ7.js +0 -2
  597. package/dist/reconcile-cmd-SMGLHMLF.js +0 -2
  598. package/dist/reconcile-deps-DVIJK5UZ.js +0 -4
  599. package/dist/reconcile-engine-KL2J5SNQ.js +0 -2
  600. package/dist/recording-banner-TCFFB6KE.js +0 -2
  601. package/dist/records-LMCVKPE5.js +0 -2
  602. package/dist/registry-BFFA4YJK.js +0 -2
  603. package/dist/require-project-folder-2224ZMJ5.js +0 -2
  604. package/dist/resolve-run-intent-HFXGEOYK.js +0 -2
  605. package/dist/resolver-GJR2Z7JY.js +0 -2
  606. package/dist/revert-NOUECRW4.js +0 -2
  607. package/dist/review-cmd-CQE6SBZA.js +0 -5
  608. package/dist/run-BXKWDJFJ.js +0 -2
  609. package/dist/run-HSP2MZPU.js +0 -2
  610. package/dist/run-channel-RGH4WIQX.js +0 -2
  611. package/dist/run-test-md-2ELPAASM.js +0 -17
  612. package/dist/scrollback-JLPJR25X.js +0 -2
  613. package/dist/session-items-2ATN7VXG.js +0 -2
  614. package/dist/session-target-UWROGOCY.js +0 -2
  615. package/dist/sessions-NH7WQWMX.js +0 -2
  616. package/dist/sessions-cmd-IV25N2L7.js +0 -25
  617. package/dist/spawner-HQM2757J.js +0 -2
  618. package/dist/store-guard-NAW26EEQ.js +0 -2
  619. package/dist/store-id-EOSGEKVK.js +0 -2
  620. package/dist/structured-answers-ZI2B6JJE.js +0 -2
  621. package/dist/sync-cmd-Q6ZYEVWI.js +0 -2
  622. package/dist/sync-setup-CA362C5S.js +0 -2
  623. package/dist/tcg-generate-CDB2N5LD.js +0 -2
  624. package/dist/testmd-actions-BDWDE2TG.js +0 -2
  625. package/dist/testmd-sync-EPTUVJYJ.js +0 -2
  626. package/dist/tms-client-KU6HCA23.js +0 -2
  627. package/dist/token-refresh-TKBOHXSD.js +0 -2
  628. package/dist/trust-gate-EX7R2P4Y.js +0 -2
  629. package/dist/turn-preflight-JGYT7LXP.js +0 -2
  630. package/dist/ui-JEJGTURD.js +0 -4
  631. package/dist/validate-basic-V7R4RH5M.js +0 -2
  632. package/dist/verdicts-7IUZFXB4.js +0 -2
  633. package/dist/version-check-PUUSB7AY.js +0 -2
  634. package/dist/walk-session-EGIMA4VG.js +0 -2
  635. package/dist/with-telemetry-LRWWBISP.js +0 -2
  636. /package/dist/{chunk-BKHXPBWN.js → chunk-2RUSXQ3O.js} +0 -0
  637. /package/dist/{chunk-6J5T5FEY.js → chunk-3AGP2BVN.js} +0 -0
  638. /package/dist/{chunk-CH273NAE.js → chunk-73Y6T2UK.js} +0 -0
  639. /package/dist/{chunk-ZMNJBUAO.js → chunk-73ZFOJOK.js} +0 -0
  640. /package/dist/{chunk-N2P4MI32.js → chunk-FWGUISUG.js} +0 -0
  641. /package/dist/{chunk-UJZZDPDY.js → chunk-HD6NR44L.js} +0 -0
  642. /package/dist/{chunk-LDPLJFCV.js → chunk-I6S6DZ2E.js} +0 -0
  643. /package/dist/{chunk-427OQS2N.js → chunk-LD5B3QFW.js} +0 -0
  644. /package/dist/{chunk-2UIHS2FH.js → chunk-PGESS7BW.js} +0 -0
  645. /package/dist/{chunk-BZAGVBCX.js → chunk-ZCIWQHCO.js} +0 -0
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var i=new Set,c=[];function g(){let e=new Set;for(let t of i){e.add(t);let o=JSON.stringify(t).slice(1,-1);e.add(o),e.add(encodeURIComponent(t)),e.add(encodeURIComponent(t).replace(/%20/g,"+")),e.add(Buffer.from(t,"utf8").toString("base64"))}let n=[...i];for(let t of n)for(let o of n)t!==o&&e.add(Buffer.from(`${t}:${o}`,"utf8").toString("base64"));c=[...e].filter(t=>t.length>=4).sort((t,o)=>o.length-t.length)}function T(e){let n=!1;for(let t of e)typeof t!="string"||t.length<4||i.has(t)||(i.add(t),n=!0);n&&g()}function p(e){if(c.length===0||!e)return e;let n=e;for(let t of c)n.includes(t)&&(n=n.split(t).join("***"));return n}var m=/\.(json|ndjson|har|log|txt|yaml|yml|md|html|js|ts|py|csv|xml)$/i,E=64*1024*1024;async function S(e){if(c.length===0)return[];let{promises:n}=await import("fs"),{join:t}=await import("path"),o=[],a=async f=>{let l;try{l=await n.readdir(f,{withFileTypes:!0})}catch{return}for(let s of l){let r=t(f,s.name);if(s.isDirectory()){await a(r);continue}if(!(!s.isFile()||!m.test(s.name)))try{if((await n.stat(r)).size>E)continue;let d=await n.readFile(r,"utf8"),u=p(d);u!==d&&(await n.writeFile(r,u),o.push(r))}catch{}}};return await a(e),o}export{T as a,p as b,S as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as V,e as W,f as Q}from"./chunk-3JLEDSG5.js";import{d as I,j as T}from"./chunk-7XBNMOH4.js";import{Ea as $,M as y}from"./chunk-UEE3RZN4.js";import{d as N}from"./chunk-KU3YHPWZ.js";import{d as h,m as S}from"./chunk-4I7YN6YY.js";function B(e,n,t){let i=S();return e===void 0||e===n?null:e==="extract"||e==="design"?{code:"WRONG_VERB",message:i.text("WRONG_VERB",{sid:t,verb:e}),next:[h(i,"next.resume_session",{verb:e,sid:t},{why:`this session belongs to a ${e} run`})]}:{code:"WRONG_VERB",message:`error: session ${t} belongs to a ${e} run \u2014 this command cannot resume it`,next:[]}}function X(e){return P(e)!==null}function P(e){let n=e,t=K(n);if(t<0)return null;let i=n[t].data?.tool_calls??[],r=i.map(o=>o.id),a=n.slice(t+1);if(r.length===0||a.some(o=>o?.kind!=="tool_result"))return null;let s=new Set(a.map(o=>o.data?.tool_call_id));if(!r.every(o=>s.has(o)))return null;let c=a.find(o=>o.data?.status==="ok"&&o.data?.payload?.accepted===!0);if(!c)return null;let _=i.find(o=>o.id===c.data?.tool_call_id),w=_?.arguments;return{name:typeof _?.name=="string"?_.name:"",arguments:w!==null&&typeof w=="object"?w:{}}}function Y(e){let n=e,t=K(n);if(t<0)return!1;let i=n.slice(t+1);if(i.some(s=>s?.kind!=="tool_result"))return!1;let r=new Set(i.map(s=>s.data?.tool_call_id)),a=(n[t].data?.tool_calls??[]).filter(s=>!r.has(s.id));return a.length===1&&a[0].name==="ask_user"}function K(e){for(let n=e.length-1;n>=0;n--)if(e[n]?.kind==="assistant_turn")return n;return-1}function ce(e){return{id:e.id,text:e.question,risk:["high","med","low"].includes(e.risk)?e.risk:"med",rationale:e.rationale,options:e.options.map(n=>({label:n.label,detail:n.description??""})),recommended_index:e.recommendedOptionIndex,allow_free_text:e.allowFreeText,kind:e.kind,consequence:e.consequence,evidence_count:e.evidence_count,multi_select:e.multiSelect}}function G(e){return{id:e.id,header:e.kind??"question",question:e.text,kind:e.kind??"clarify",multiSelect:e.multi_select??!1,options:e.options.map((n,t)=>({id:`o${t}`,label:n.label,description:n.detail||void 0})),recommendedOptionIndex:e.recommended_index,risk:e.risk,rationale:e.rationale,consequence:e.consequence??"",evidence_count:e.evidence_count,allowFreeText:e.allow_free_text}}function de(e,n,t){let i=n.pending.questions.map(G),r=W(e.state.pending.answers).filter(a=>n.pending.questions.some(s=>s.id===a.id&&Q(a,s)));e.save({agent_state:n.agent_state,pending:{questions:i,proposals:n.pending.proposals??[],...r.length>0?{answers:r}:{}},assumed:n.assumed.map(a=>({questionId:a.question_id,optionId:a.option_id,flagged:!0,eventId:`assumed:${n.sid}:${a.question_id}`}))}),t?.(),e.release(),I(e.state.sid)}function pe(e,n,t,i){if(t.name.startsWith("finalize"))return{call:t.name,event_id:`${e}:ckpt:${i}`};let r=t.arguments.ops;return Array.isArray(r)&&r.length>0&&n?{call:t.name,event_prefix:`chatop:${n}:s${i}:`}:null}function ge(e,n,t){if(!t)return!0;let i=y(e).appliedEvents;if(t.event_id!==void 0)return i.has(t.event_id)||n.includes(t.event_id);let r=t.event_prefix??"";for(let a of i)if(a.startsWith(r))return!0;return n.some(a=>a.startsWith(r))}function fe(e){return`the agent's last ${e==="finalize_design"?"design phase was":e.startsWith("finalize")?"proposal was":"changes were"} not saved before the session stopped \u2014 it is sent again`}function me(e){return e===1?"your last message was sent again":`your last ${e} messages were sent again`}function U(e,n,t){return t?.call!=="finalize_design"||t.event_id===void 0?!1:y(e).appliedEvents.has(t.event_id)&&!n.includes(t.event_id)}function _e(){return"the agent's last design phase was saved before the session stopped, but not all of its files \u2014 it is sent again to write them"}function he(e){return{persist(n,t){let i=e.seqBase(),r={seq:n.seq+i,turn_id:n.turn_id,at:n.at,agent_state_schema:n.agent_state_schema,delta_items:n.delta_items,binding:n.binding,usage_total:n.usage_total,...n.base_fingerprint!==void 0?{base_fingerprint:n.base_fingerprint}:{}},a={applied_events:[...new Set([...e.handle.state.applied_events,...e.store.sessions().appliedEvents(e.handle.state.sid)])].sort(),held_receipts:e.peekHeldReceipts?.()??[],pending:{questions:n.at!=="turn"?(n.pending_questions??[]).map(G):[],proposals:e.stagedProposals?.()??[]},parent_asks:[],read_basis:e.readBasis(),corpus_cursor:e.corpusCursor(),store_watermark:e.store.serialize(e.store.head()),...(()=>{let s=n.at==="turn"&&e.awaits?P(n.delta_items):null,c=s?e.awaits(s,r.seq):null;return c?{awaits:c}:{}})(),...t?.sentUnread?.length?{sent_unread:[...t.sentUnread]}:{},...(()=>{let s=e.ingestRegistry?e.ingestRegistry():e.handle.state.ingest_registry??[],c=e.ingestSchedule?e.ingestSchedule():e.handle.state.ingest_schedule??[];return{...s.length?{ingest_registry:s}:{},...c.length?{ingest_schedule:c}:{}}})()};return e.store.sessions().persistCheckpoint(e.handle,r,a,{...e.onSoftCap?{onSoftCap:e.onSoftCap}:{},...e.onStat?{onStat:e.onStat}:{},...e.now?{now:e.now}:{}})}}}function D(e,n){return!e.checkpoint&&!n&&e.agent_state.items.length===0}var m=class extends Error{constructor(t,i,r=[]){super(`${t}: ${i}`);this.code=t;this.next=r}};function we(e){return[...new Set(["extract-agent","design-agent","owner",...e?[e.id]:[]])]}async function ke(e,n,t,i={}){let r=i.deps??{},a=S(),s=e.sessions().resume(n);try{let c=s.state.checkpoint??null,_=e.sessions().hasBase(n),w=!c&&s.state.agent_state.items.length>0;if(D(s.state,_))throw new m("SESSION_KEPT_NOTHING",`session ${n} kept nothing to resume \u2014 no checkpoint, no base and no agent snapshot; start the run again`);if(!c&&!_||w)throw new m("SESSION_V1",a.text("SESSION_V1",{sid:n}),[h(a,"next.abandon_session",{sid:n},{why:"abandon the pre-checkpoint session, then start a fresh run"})]);!c&&_&&r.onWarn?.(a.text("note.chain_recovered",{sid:n}));let o=e.sessions().loadCheckpoint(n);o.orphans.length>0&&e.sessions().gcOrphans(n,o.orphans),o.fallback&&r.onWarn?.(a.text("note.chain_truncated",{sid:n,at:o.fallback.resumableAt,lost:o.fallback.turnsLost}));let u=o.base;if(i.verb){let l=B(u.verb,i.verb,n);if(l)throw new m("WRONG_VERB",l.message,l.next)}if(i.useCase!==void 0&&i.useCase!==u.use_case&&!await(r.confirmRetarget?.(u.use_case,i.useCase)??!1))throw new m("RESUME_RETARGET_DECLINED",u.use_case?`session ${n} was designing ${u.use_case}; resuming onto ${i.useCase} needs an explicit retarget`:`session ${n} has no recorded use-case; adopting ${i.useCase} needs an explicit retarget`,u.use_case?[h(a,"next.resume_session",{verb:"design",sid:n},{why:`continue on ${u.use_case} (the session's own subject)`})]:[]);let g=o.kane,R=[],j=g?.read_basis??Object.fromEntries(Object.entries(s.state.read_basis));for(let[l,d]of Object.entries(j)){let p=t.heads.get(l)??null;p!==d&&R.push({subject:l,pinned:d,live:p})}u.uc_tip!==void 0&&r.liveUcTip!==void 0&&r.liveUcTip!==u.uc_tip&&R.push({subject:u.use_case??"use-case",pinned:u.uc_tip,live:r.liveUcTip}),r.locks?.reacquire?.(n);let v={...u.run_config,checkpoints:!0};delete v.resume;let x;if(o.pointer===null||o.agent===null)x=v;else{if(!o.agent.base_fingerprint)throw new m("CHECKPOINT_PROTOCOL",`session ${n}: chain carries no base fingerprint \u2014 cannot attest the seed rebuild`);x={...v,resend_open_ask:!0,resume:{schema:2,binding:o.agent.binding,base_fingerprint:o.agent.base_fingerprint,delta_items:o.agent.delta_items,last_seq:o.pointer.seq}}}let C=g?.pending.questions??[],E=l=>{let d=`resolveq:${n}:${l}`,p=`assumed:${n}:${l}`;return t.appliedEvents.has(d)||t.appliedEvents.has(p)||s.isApplied(d)||s.isApplied(p)},H=g&&C.length>0?C.filter(l=>!E(l.id)):s.state.pending.questions.filter(l=>!E(l.id)),A={redeliverReceipts:[],recommit:[]},k,b;if(g){let l={...g,applied_events:[...new Set([...g.applied_events,...s.state.applied_events])].sort()},d=u.verb==="design"&&U(e,l.applied_events,g.awaits)?g.awaits?.event_id:void 0,p;try{p=T(e,n,l,t,{...d?{resent:d}:{},verb:u.verb==="design"?"design":"extract",...u.use_case?{ucRef:u.use_case}:{},...N(String(o.agent?.binding?.template_version??""))>=8?{typedBlockers:!0}:{},...s.state.force_scope?.length?{ignoreGaps:new Set(s.state.force_scope)}:{},composeReceipt:(f,q,L)=>V(f,q,L),onNote:r.onWarn,...r.ownActors?{ownActors:r.ownActors}:{}})}catch(f){throw f instanceof $?new m("CHECKPOINT_PROTOCOL",`store reconciliation refused: ${f.message}`,[h(a,"next.abandon_session",{sid:n},{why:"abandon the session if the store was rebuilt"})]):f}A={redeliverReceipts:p.redeliverReceipts,recommit:p.recommit},b=p.prunedPending;let O=g.pending.proposals??[];k=(O.length>0?O:s.state.pending.proposals).filter(f=>!(typeof f.event_id=="string"&&t.appliedEvents.has(f.event_id))),(p.newlyApplied.length>0||p.prunedPending.length>0)&&s.reconcileSave({appliedEvents:p.newlyApplied,heldReceipts:[...s.state.held_receipts??[],...p.redeliverReceipts],pending:{questions:s.state.pending.questions,proposals:k,...s.state.pending.answers?.length?{answers:s.state.pending.answers}:{}}})}else{let l=s.state.pending.proposals;b=l.filter(d=>typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)),k=l.filter(d=>!(typeof d.event_id=="string"&&t.appliedEvents.has(d.event_id)))}return{kind:"v2",handle:s,base:u,view:o,kane:g,spawnConfig:x,drift:R,reconcile:A,questions:H,represent:k,prunedPending:b}}catch(c){throw s.release(),c}}export{B as a,X as b,P as c,Y as d,ce as e,de as f,pe as g,ge as h,fe as i,me as j,U as k,_e as l,he as m,D as n,m as o,we as p,ke as q};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-4IEQNX7F.js";import{f as s}from"./chunk-MYZHOBS4.js";import{existsSync as c,mkdirSync as l,readFileSync as f,renameSync as p,writeFileSync as m}from"fs";import{dirname as d,join as u}from"path";function x(n){return u(n,".testmuai","variables","assurance.json")}function S(n){for(let e of n.declarations){let o=s(e.name);if(o)throw new Error(`variable declaration refused: ${o}`)}let i={};if(c(n.file)){let e=a(f(n.file,"utf8"),n.file);e&&typeof e=="object"&&!Array.isArray(e)&&(i=e)}let r=[],t=[];for(let e of n.declarations){if(Object.hasOwn(i,e.name)||n.known?.has(e.name)){t.push(e.name);continue}i[e.name]={value:"",secret:!!e.secret,description:e.description},r.push(e.name)}if(r.length>0){l(d(n.file),{recursive:!0});let e=`${n.file}.tmp-${process.pid}-${Date.now()}`;m(e,JSON.stringify(i,null,2)+`
3
+ `),p(e,n.file)}return{written:r,skipped:t}}export{x as a,S as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as i}from"./chunk-4QTH7VYE.js";import{a}from"./chunk-RZ4F3BHX.js";var c=class{constructor(r,e){this.baseUrl=r;typeof e=="string"?this.authHeader=`Bearer ${e}`:this.authHeader=i(e.username,e.accessKey)}authHeader;headers(){return{Authorization:this.authHeader,"Content-Type":"application/json",Accept:"application/json"}}async request(r,e,n,u){let s=new AbortController,o=setTimeout(()=>s.abort(),3e4);try{let t=await a(`${this.baseUrl}${e}`,{method:r,headers:{...this.headers(),...u},...n!==void 0?{body:JSON.stringify(n)}:{},signal:s.signal});if(clearTimeout(o),!t.ok){let d=await t.text();throw new Error(`${r} ${e} failed: ${t.status} ${d}`)}return(t.headers.get("content-type")??"").includes("application/json")?await t.json():await t.text()}catch(t){throw clearTimeout(o),t instanceof DOMException&&t.name==="AbortError"?new Error(`${r} ${e} timed out after 30s`):t}}};export{c as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{ta as u}from"./chunk-UEE3RZN4.js";import{m as c}from"./chunk-4I7YN6YY.js";function a(e,r){let n=u(e.superseded,i=>e.nodeLabel.get(i)),t=r,o=new Set;for(;n.has(t)&&!o.has(t);)o.add(t),t=n.get(t);return t}function d(e,r){let n=e.resolve(r);if(n===null)return null;let t=e.designGenerationOf.get(a(e,n.cid));if(t===void 0)return null;let o=e.tipOf(n.cid),i=!e.superseded.has(o);return{gen:t.gen,live:i,minted_at_seq:t.seq}}function _(e,r,n){let t=e.resolve(r);if(t===null)return{error:{code:"UNKNOWN_REF",detail:`'${r}' names no use-case in this context`}};let o=a(e,t.cid),i=e.designGenerationOf.get(o);if(i===void 0)return{uc_root:o,next_gen:1,expected_prev_gen:null,...n.because?{because:n.because}:{}};let s=d(e,r);return s!==null&&s.live&&!n.force?{error:{code:"GENERATION_LIVE",detail:c().text("GENERATION_LIVE",{use_case:r,gen:i.gen})}}:s!==null&&s.live&&n.force&&!n.because?{error:{code:"MISSING_BECAUSE",detail:`superseding the live generation of ${r} requires --because <reason>`}}:{uc_root:o,next_gen:i.gen+1,expected_prev_gen:i.gen,...n.because?{because:n.because}:{}}}function f(e,r){let n=e.designGenerationOf.get(r.uc_root)?.gen??null;return n!==r.expected_prev_gen?{code:"GENERATION_MOVED",detail:`design generation of ${r.uc_root.slice(0,12)} moved (expected ${String(r.expected_prev_gen)}, found ${String(n)}) \u2014 another session finalized; re-open and re-ground`}:null}function p(e,r,n){return{uc_root:e.uc_root,uc_cid:r,generation:e.next_gen,supersedes_generation:e.expected_prev_gen,...e.because?{because:e.because}:{},by:n}}export{a,d as b,_ as c,f as d,p as e};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{e as x}from"./chunk-KU3YHPWZ.js";var h=12,G=6e3;function p(e,n){return e.byLabel(n).filter(({cid:i})=>!e.superseded.has(i)&&e.trust.get(i)!=="archived")}function b(e,n,i){return e.displayNameOf(n)??String(i.title??i.text??n)}function O(e,n,i={}){let c=p(e,"scenario"),d=null;if(n){let t=e.resolve(n);if(t){d=new Set([t.cid,t.tip,e.tipOf(t.cid)]);let o=d;c=c.filter(({cid:g})=>e.edgesFrom(g).some(l=>l.type==="belongs_to"&&(o.has(l.dst)||o.has(e.tipOf(l.dst)))))}}let s=new Set;for(let{cid:t}of c)s.add(t),s.add(e.tipOf(t));let m=p(e,"test").filter(({cid:t})=>!n||e.edgesFrom(t).some(o=>o.type==="automates"&&(s.has(o.dst)||s.has(e.tipOf(o.dst))))),a=new Set;for(let t of m)for(let o of e.edgesFrom(t.cid))o.type==="automates"&&a.add(e.tipOf(o.dst));let v=i.typedBlockers===!0&&d!==null,r=new Set,f=[];for(let t of v?p(e,"gap"):[]){if(!x.has(String(t.content.kind??""))||i.ignoreGaps?.has(t.cid))continue;let o=typeof t.content.uc=="string"?t.content.uc:null;if(d&&o&&!d.has(o)&&!d.has(e.tipOf(o)))continue;let g=t.content.ref,l=typeof g=="string"&&g?e.resolve(g):null,R=l&&(s.has(l.cid)||s.has(e.tipOf(l.cid)));if(!l||!R){if(String(t.content.kind)==="budget-evicted"&&!l)continue;let k=t.content.question?.header;f.push(`${typeof k=="string"?k:b(e,t.cid,t.content)} (ref ${typeof g=="string"&&g?g:"missing"})`);continue}r.add(l.cid),r.add(e.tipOf(l.cid))}let y=t=>a.has(t)||a.has(e.tipOf(t)),_=t=>r.has(t)||r.has(e.tipOf(t)),$=c.filter(({cid:t})=>!y(t)&&!_(t)).map(({cid:t,content:o})=>b(e,t,o)),A=c.filter(({cid:t})=>!y(t)&&_(t)).map(({cid:t,content:o})=>b(e,t,o));return{live_scenarios:c.length,live_tests:m.length,missing:$,blocked:A,unresolved_blockers:f}}function u(e){return e.length<=h?e.join(", "):`${e.slice(0,h).join(", ")} +${e.length-h} more`}function S(e,n){let i=e.committed.length===0?"committed: nothing new":`committed: ${u(e.committed.map(r=>r.temp_ref?`${r.temp_ref} \u2192 ${r.logical_id??r.cid}`:r.logical_id??r.cid))}`,c=[];e.reused&&c.push(`reused: ${e.reused}`),e.rejected?.length&&c.push(`rejected: ${u(e.rejected.map(r=>`${r.ref} (${r.reason})`))}`),e.warnings?.length&&c.push(`warnings: ${u(e.warnings)}`);let d=[`RECEIPT (commit ${e.commitN}, ${e.phase})`,i,...c],s,m;if(e.verb==="design"){s=O(n,e.ucRef,{typedBlockers:e.typedBlockers===!0,...e.ignoreGaps?{ignoreGaps:e.ignoreGaps}:{}}),d.push(`parity: ${s.live_scenarios} scenario(s) live \xB7 ${s.live_tests} test(s) live`+(s.blocked.length?` \xB7 blocked by a typed gap: ${u(s.blocked)}`:"")+(s.missing.length?` \xB7 missing tests: ${u(s.missing)}`:"")+(s.unresolved_blockers.length?` \xB7 blocker gap(s) naming no live scenario of this use-case: ${u(s.unresolved_blockers)}`:""));let r=e.typedBlockers?" A path with no web- or mobile-observable surface gets no test: emit one `unmeasurable` gap whose `ref` is that scenario's id instead.":"",f=s.unresolved_blockers.length?` ${s.unresolved_blockers.length} blocker gap(s) name no live scenario of this use-case and account for nothing.`:"";m=s.missing.length>0?`next: emit tests for the ${s.missing.length} scenario(s) listed \u2014 1:1, strict.${r} Never re-emit committed items; reference them by the ids above.`+f:s.blocked.length?`next: every live scenario has a test or a typed blocker (${s.blocked.length} blocked). Address open gaps, or finish.`+f:"next: every live scenario has a test. Address open gaps, or finish."+f}else{let r=p(n,"usecase").length;d.push(`parity: ${r} use-case(s) live`),m="next: refine via chat ops using the ids above. Never re-emit committed items."}d.push(m);let a=d.join(`
3
+ `);for(;Buffer.byteLength(a,"utf8")>G;)a=a.slice(0,Math.floor(a.length*.9))+"\u2026";let v={type:"receipt",verb:e.verb,commit_n:e.commitN,phase:e.phase,committed:e.committed,reused:e.reused??0,rejected:e.rejected??[],warnings:e.streamWarnings??e.warnings??[],...s?{parity:{live_scenarios:s.live_scenarios,live_tests:s.live_tests,missing:s.missing,blocked:s.blocked,unresolved_blockers:s.unresolved_blockers}}:{}};return{text:a,event:v}}function P(e,n,i){try{let c=e.design_of?"design":e.proposal_id!==null?"proposal":e.conv?"chat":"commit",d=e.nodes.map(m=>{let a=n.displayNameOf(m.cid);return{cid:m.cid,...a!==null?{logical_id:a}:{}}}),s=S({verb:i.verb,commitN:i.commitN,phase:c,committed:d,...i.ucRef?{ucRef:i.ucRef}:{},...i.typedBlockers?{typedBlockers:!0}:{},...i.ignoreGaps?.size?{ignoreGaps:i.ignoreGaps}:{}},n);return{text:s.text+`
4
+ (recomputed against the current graph)`,event:{...s.event,recomputed_at_resume:!0}}}catch{let c=e.event_ids?.[0]??`seq ${e.seq}`,d=e.review[0]?.by?.id??e.sid??"unknown",s=`commit ${c} by ${d} at ${e.ts} \u2014 details unavailable (graph moved since)`;return{text:s,event:{type:"receipt",verb:i.verb,commit_n:i.commitN,phase:"recovered",recomputed_at_resume:!0,degraded:!0,message:s}}}}import{createHash as j}from"crypto";function w(e){let n=JSON.stringify([e.text,e.options.map(i=>[i.label,i.detail??""])]);return"sha256:"+j("sha256").update(n).digest("hex")}function I(e,n){return{id:n.id,selected_index:n.selected_index,free_text:n.free_text,digest:w(e)}}function N(e){return e.selected_index===null&&(e.free_text??"").trim()===""}function C(e){return(e??[]).filter(n=>!N(n))}function L(e,n){return e!==void 0&&e.digest===w(n)}function F(e){return{id:e.id,selected_index:e.selected_index,free_text:e.free_text}}export{S as a,P as b,w as c,I as d,C as e,L as f,F as g};
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as d,e as l}from"./chunk-4I7YN6YY.js";var h=e=>`'${e.replace(/'/g,"'\\''")}'`,u=e=>e!==void 0?` --mode ${e}`:"",s=({verb:e,sid:t,mode:n})=>e==="design"?`kane-cli design tests --resume ${t}${u(n)}`:`kane-cli context extract --resume ${t}${u(n)}`,g=({ref:e,because:t,answers:n})=>`kane-cli maintain evolve ${e??"--from-stale"}${t?` --because ${h(t)}`:""} --mode agent`+n.map(i=>` --answer ${i.id}=${i.choice==="proceed"?1:2}`).join(""),r=e=>`kane-cli context extract --resume ${e}`,$=e=>/^[\w@%+=:,./-]+$/.test(e)?e:h(e),a=e=>e?`to review its source's change, run: ${e}`:"review its source's change with kane-cli maintain reconcile first",o="re-run kane-cli maintain reconcile to re-stage",c=e=>`retire it first (kane-cli context retire ${e}) or ingest under a different id with --as`,_=d({commands:{"next.resume_session":s,"next.resume_with_message":e=>`${s(e)} --message "<your words>"`,"next.resume_child":({sid:e})=>`kane-cli design tests --resume ${e}`,"next.design_use_case":({use_case:e,force:t})=>`kane-cli design tests --use-case ${e}${t?" --force":""}`,"next.review_use_case":({use_case:e})=>`kane-cli context review --approve ${e}`,"next.design_unreviewed":({use_case:e})=>`kane-cli design tests --use-case ${e} --mode agent --allow-unreviewed`,"next.view_design":({use_case:e})=>`kane-cli context view ${e}`,"next.evolve_design":({use_case:e})=>`kane-cli maintain evolve ${e}`,"next.redesign":({use_case:e})=>`kane-cli design tests --use-case ${e} --force --mode agent`,"next.design_phase":({use_case:e,phase:t,agent_mode:n})=>`kane-cli design tests --use-case ${e} --phase ${t}${n?" --mode agent":""}`,"next.answer_evolve":g,"next.abandon_session":({sid:e})=>`kane-cli context sessions clean ${e}`,"next.review_held_changeset":()=>"kane-cli maintain reconcile --apply","next.show_session":({sid:e})=>`kane-cli context sessions show ${e}`,"next.review_source":({source_id:e,from:t,agent_mode:n})=>t===null?null:`kane-cli maintain reconcile --from ${$(t)}${/^https?:\/\//.test(t)?"":` --source-id ${e}`}${n?" --mode agent":""}`},texts:{...l,"note.paused":e=>e.verb==="design"?`paused \u2014 resume with: ${s(e)}`:`paused: session ${e.sid} saved \u2014 resume with: ${s(e)}`,"note.crashed":e=>`agent crashed \u2014 session ${e.sid} is resumable at checkpoint seq ${e.seq} (at most the in-flight turn lost); resume with: ${s(e)}`,"note.model_unavailable_kept":e=>`the model service did not answer (${e.detail}) \u2014 session ${e.sid} is kept; resume with: ${s(e)}`,"note.model_retry":({seconds:e})=>`the model service is not answering; trying again in ${e}s`,"note.already_extracted":({source_id:e})=>`${e} already extracted \u2014 skipped (--force re-runs it)`,"note.conversation_source_skipped":({source_id:e})=>`skipped ${e} \u2014 conversation source; extract it explicitly with --source ${e}`,"note.reconcile_plan_pending":({source_id:e,pending:t,path:n})=>`note: a reconcile plan for ${e} is pending (${t} item(s)) \u2014 resume with \`kane-cli maintain reconcile --apply ${n}\``,"note.nothing_to_extract":({sources:e,count:t})=>`extract: nothing to do \u2014 ${e} ${t===1?"is":"are all"} already extracted at the current snapshot (--force to re-run)`,"note.only_conversation_sources":()=>"extract: nothing to do \u2014 only conversation sources here (extract one explicitly with --source <id>)","note.all_extracted":()=>"extract: nothing to do \u2014 every ingested source is already extracted","note.changeset_held_for_review":({held:e})=>`paused: ${e} held change(s) await your verdicts \u2014 review them in a terminal: kane-cli maintain reconcile --apply`,"note.held_for_review":({sid:e,mode:t,held:n})=>`paused: ${n} held item(s) await review \u2014 resume with: ${s({verb:"extract",sid:e,mode:t})}`,"note.session_kept":e=>`session ${e.sid} kept its last checkpoint (seq ${e.seq}, ${e.ts}) \u2014 resume with: ${s(e)}`,"note.assumed_defaults":({sid:e,count:t})=>`note: ${t} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${e} lists them`,"note.landed_changed":({source_id:e})=>`note: ${e} changed after it was added \u2014 skipping its extraction this run; re-run kane-cli context extract to pick up the newer version`,"note.landed_older_queued":({source_id:e})=>`note: an older version of ${e} is already queued this run \u2014 the newly landed version is not extracted; re-run kane-cli context extract to pick it up`,"note.reingest_binary":({source_id:e,kind:t})=>`skipping ${e}: binary ${t} ingested before image support \u2014 re-ingest it (kane-cli context ingest) to extract from it`,"note.schedule_refused":()=>"this run holds items for review, so its extraction is not scheduled \u2014 kane-cli context extract runs it after the review","note.not_reached":()=>"run ended before its turn \u2014 kane-cli context extract runs it","note.nothing_committed":({source_id:e,remaining:t})=>`done \u2014 nothing committed for ${e} (no finalize before the session ended)`+(t>0?`; stopping here \u2014 ${t} remaining source(s) not extracted (re-run kane-cli context extract to continue)`:""),"note.landed_not_extracted":({count:e,sources:t})=>`note: ${e} source(s) landed this session (${t}) were not extracted \u2014 the session ended first; kane-cli context extract runs them`,"note.evidence_not_attached":({count:e})=>`note: ${e} unchanged match(es) target unreviewed (or no-longer-resolving) item(s) \u2014 evidence not attached (bless them with kane-cli context review; a later reconcile attaches)`,"note.sources_failed":({failed:e,total:t,sources:n})=>`${e} of ${t} source(s) failed \u2014 re-run kane-cli context extract to retry (${n})`,"note.already_designed":({use_case:e,version:t})=>`'${e}' is already designed @ v${t} \u2014 current; use --force to redesign`,"note.design_stale":({use_case:e,designed:t,current:n})=>`'${e}' was designed @ ${t} \u2014 the use-case is now @ v${n} (STALE); use --force to redesign`,"note.view_design":({use_case:e})=>`view the existing design: kane-cli context view ${e}`,"note.evolve_first":({use_case:e})=>`refresh it first: kane-cli maintain evolve ${e}`,"note.nothing_executed":()=>"nothing executed \u2014 list use-cases: kane-cli context list","note.tests_await_approval_command":({tests:e,criteria:t,criterion:n})=>{let i=e===1?"1 test checks":`${e} tests check`;return t===1&&n!==null?`note: ${i} a criterion not approved yet; to approve it, run:
3
+ kane-cli context review --approve ${n}`:`note: ${i} criteria not approved yet; to approve them, run:
4
+ kane-cli context review`},"note.links_await_approval":({count:e})=>`warning: ${e} test link(s) refer to items still awaiting approval \u2014 saved anyway; review and approve those items in chat or via kane-cli context review`,"note.no_design_skipped":({use_case:e})=>`note: ${e} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${e} first`,"note.no_design":({use_case:e})=>`nothing to evolve \u2014 run kane-cli design tests --use-case ${e} first (no design output)`,"note.design_paused":({use_case:e})=>`design session for ${e} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`,"note.nothing_changed":({ref:e})=>`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`,"note.source_changed_skipped":({use_case:e,review:t})=>`${e} is left out: it's out of date because its source changed \u2014 ${a(t)}`,"note.source_changed":({use_case:e,review:t})=>`${e} is out of date because its source changed, and an update can't change that \u2014 ${a(t)}`,"note.source_changed_after":({use_case:e,review:t})=>`${e} is still out of date because its source changed \u2014 ${a(t)}`,"note.checkpoint_not_saved":({error:e,chain_unverified:t})=>`warning: couldn't save the session checkpoint \u2014 ${e}; asking the agent to pause`+(t?". The store's record chain fails verification \u2014 run kane-cli context fsck to diagnose.":""),"note.held_no_event_id":({sid:e})=>`this held row has no durable event id \u2014 resume the owner to drop it: ${r(e)}`,"note.held_no_provenance":({sid:e})=>`this held row carries no committable provenance \u2014 resume the owner to apply it: ${r(e)}`,"note.held_no_citable_text":({sid:e,source_id:t,source_cid:n})=>`the pinned source ${t} (${n.slice(0,19)}) has no citable text to verify this held row against \u2014 resume the owner: ${r(e)}`,"note.held_unverified":({sid:e,errors:t})=>`held provenance does not verify against the pinned source (${t}) \u2014 resume the owner: ${r(e)}`,"note.controller_unreachable":({base:e,error:t})=>`error: cannot reach the controller at ${e} (${t})
5
+ hint: check your network connection and login (kane-cli whoami)`,"note.assurance_unsupported":()=>"error: this environment does not support assurance sessions yet (404) \u2014 update kane-cli, or contact support if the problem persists","note.credentials_rejected":({env:e})=>`error: your credentials were rejected (401) \u2014 run kane-cli login (active environment: ${e})`,"note.key_recycled":({source_id:e,what:t})=>`source '${e}' was ingested from a different ${t} that used this key \u2014 the key was recycled; ${c(e)}`,"note.kind_taken":({source_id:e,backing:t,kind:n})=>`source '${e}' is already backed by ${t}, not ${n} \u2014 ${c(e)}`,"note.site_moved":({source_id:e,previous:t,site:n})=>`source '${e}' was ingested from ${t}, but this read serves ${n} \u2014 ${c(e)}`,"note.web_url_changed":({source_id:e,previous:t})=>`source '${e}' was ingested from ${t} \u2014 re-run on a TTY to adopt the new URL as its next version, or ingest under a different id with --as`,"note.web_id_taken":({url:e})=>`skipped ${e} \u2014 ingest under a different id with --as to keep both pages`,"note.web_login":()=>"your credentials were rejected \u2014 run `kane-cli login` and retry","note.web_projection_unknown":({kind:e})=>`unknown web projection kind '${e}' \u2014 update kane-cli to read this source`,LIS_AUTH:()=>"credentials rejected \u2014 run `kane-cli login` and retry",MULTI_SOURCE_RESUME:({sid:e,sources:t})=>`error: session ${e} spans ${t} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (re-run kane-cli context extract for anything remaining)`,CHANGE_BASIS_MOVED:({source_id:e,sid:t})=>`error: ${e} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; re-run kane-cli maintain reconcile against the current file (session ${t} is defunct and can be ignored)`,PROPOSAL_UNREADABLE:({proposal:e})=>`proposal ${e} is unreadable \u2014 re-run maintain reconcile`,SOURCE_UNRESOLVED:({source_id:e})=>`the source ${e} no longer resolves \u2014 cannot verify this changeset is current; re-run maintain reconcile`,SOURCE_MOVED:({source_id:e})=>`the source ${e} moved again while this review was open \u2014 re-run maintain reconcile to refresh the changeset`,ARCHIVE_UNRESOLVED:({use_case:e})=>`its archive op no longer resolves to ${e} \u2014 re-run maintain reconcile`,POSTURE_IN_CHAT:({sid:e})=>`error: session ${e} is a held reconcile review \u2014 resumed in the chat its changes would commit without verdicts; review its cards with kane-cli maintain reconcile --apply`,SOURCE_MISSING:({sid:e,sources:t})=>`error: resumed session's paused source (${t}) is no longer in the corpus \u2014 restore/re-ingest it and re-run --resume ${e}, or discard with: kane-cli context sessions clean ${e}`,BLOB_MISSING:({source_id:e})=>`error: ${e}: its stored content is missing \u2014 re-ingest the file (kane-cli context ingest <file>) [BLOB_MISSING]`,"AGENT_FAILED.invalid_proposal":({source_id:e})=>`error: the agent could not produce a valid proposal for ${e} \u2014 re-run kane-cli context extract to retry`,UC_UNREVIEWED:({use_case:e})=>`${e} is unreviewed \u2014 approve it first, or pass --allow-unreviewed`,"UC_UNREVIEWED.merge_target":({temp_ref:e,target:t})=>`${e}: merge target ${t} is unreviewed (derived) \u2014 bless it first (kane-cli context review) and re-propose the merge`,UC_HELD:({use_case:e,owner_sid:t,stopped:n})=>`design: ${e} is being designed by another session`+(n?` \u2014 that session looks stopped; resume it with kane-cli design tests --resume ${t??"<session>"}`:"")+" \u2014 pick another use-case (kane-cli design tests) or wait for it to finish",GENERATION_LIVE:({use_case:e,gen:t})=>`${e} already has a live design generation (gen ${t}) \u2014 pass --force with --because to supersede it`,MESSAGE_TOO_LARGE:({bytes:e,max:t})=>`error: the opening statement is ${e} bytes and the agent takes at most ${t} per message (it would drop it silently) \u2014 pass a shorter --because (it replaces the generated stale reason)`,REASON_TOO_LARGE:()=>"nothing was started: that reason is too long; run it again with a sentence or two",SESSION_V1:({sid:e})=>`session ${e} predates durable checkpoints \u2014 this build cannot resume it; abandon it with kane-cli context sessions clean ${e} and start a fresh run (committed work is untouched)`,WRONG_VERB:({sid:e,verb:t})=>`error: session ${e} is a ${t} session \u2014 resume it with ${s({verb:t,sid:e})}`,"HELD_CITES_STALE.moved":()=>`the source moved after this plan staged \u2014 its quotes no longer verify against the current head; ${o}`,"HELD_CITES_STALE.predates_images":({where:e,anchor:t})=>`${e}: this plan predates image-part staging \u2014 ${t} cannot be verified against the version it staged under; ${o}`,"HELD_CITES_STALE.no_image":({where:e,anchor:t})=>`${e}: ${t} names no decodable image of the staged version \u2014 ${o}`,"HELD_CITES_STALE.image_moved":({where:e,anchor:t,gone:n})=>`${e}: the image behind ${t} is ${n?"no longer in":"ambiguous in"} the current head \u2014 ${o}`}});export{_ as a};
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as w,c as L,g as fe,j as ge}from"./chunk-UUJIGOEO.js";import{b as pe}from"./chunk-SWMTXMKB.js";import{d as X}from"./chunk-DBMW3VUN.js";import{a as Q}from"./chunk-7V4BQSSV.js";import{a as ue,b as le}from"./chunk-MGNRNLBE.js";import{a as de}from"./chunk-4QTH7VYE.js";var De={requestMs:3e4,requests:64,redirects:5,bodyBytes:X.contentBytes},Fe=new Set(["authorization","proxy-authorization","cookie","host"]),He=new Set(["set-cookie","set-cookie2","www-authenticate","proxy-authenticate"]);function he(e){try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.origin:null}catch{return null}}async function Je(e,t,n,r){let i=Number(e.headers.get("content-length"));if(Number.isFinite(i)&&i>t&&(await e.body?.cancel().catch(()=>{}),r(`${n} answered with ${i} bytes; a plugin's source may be at most ${t}`)),e.body===null)return new Uint8Array(0);let s=e.body.getReader(),u=[],c=0;for(;;){let{done:k,value:x}=await s.read();if(k)break;c+=x.byteLength,c>t&&(await s.cancel().catch(()=>{}),r(`${n} answered with more than ${t} bytes; a plugin's source may be at most ${t}`)),u.push(x)}let l=new Uint8Array(c),g=0;for(let k of u)l.set(k,g),g+=k.byteLength;return l}function xe(e){let{plugin:t}=e,n={...De,...e.limits},r=e.fetchImpl??fetch,i=new Set(e.allow.map(h=>he(h)).filter(h=>h!==null)),s=[...i].join(", ")||"no origin",u=0,c=null,l=!1,g=new Set,k=()=>{throw new L({code:"PLUGIN_CONNECTION_REFUSED",message:`the connection for plugin ${t} is closed: its fetch has ended`,plugin:t,hook:"fetch"})},x=(h,o)=>{let d=new L({code:h,message:o,plugin:t,hook:"fetch"});throw c??=d,d},$=h=>x("PLUGIN_CONNECTION_REFUSED",`plugin ${t} ${h}`),R=(h,o)=>{let d=he(h);return d===null&&$(`${o} ${JSON.stringify(h)}, which is not an http or https URL`),i.has(d)||$(`${o} ${h}, which is not an origin it may reach \u2014 it may reach ${s}`),new URL(h)};return{get breach(){return c},close(){l=!0;for(let h of g)h.abort();g.clear()},async request(h){l&&k();let o=h.method??"GET",d=o==="POST"?h.body:void 0;o!=="GET"&&o!=="POST"&&$(`asked for a ${JSON.stringify(o)} request; a plugin's connection makes GET and POST requests only`);let p={};for(let[m,O]of Object.entries(h.headers??{})){let E=m.toLowerCase();Fe.has(E)&&$(`set the ${E} header itself; the host adds its own credentials, and a plugin never sends any`),p[E]=String(O)}let a=R(h.url,"asked the connection for");for(let m=0;;m+=1){u+=1,u>n.requests&&$(`made more than ${n.requests} requests in one fetch`);let O={...p};for(let[C,T]of Object.entries(await e.authorize(a)))O[C.toLowerCase()]=String(T);l&&k();let E=new AbortController;g.add(E);let I=setTimeout(()=>E.abort(),n.requestMs),U;try{U=await r(a,{method:o,headers:O,redirect:"manual",signal:E.signal,...d!==void 0?{body:d}:{}})}catch(C){throw g.delete(E),clearTimeout(I),l&&k(),E.signal.aborted?new Error(`${a.origin} did not answer plugin ${t}'s request within ${n.requestMs/1e3} seconds`):new Error(`plugin ${t}'s request to ${a.origin} failed: ${C instanceof Error?C.message:String(C)}`)}try{let C=U.status>=300&&U.status<400?U.headers.get("location"):null;if(C!==null){await U.body?.cancel().catch(()=>{}),m>=n.redirects&&$(`was redirected more than ${n.redirects} times from ${h.url}`),a=R(new URL(C,a).href,"was redirected to"),(U.status===303||(U.status===301||U.status===302)&&o==="POST")&&(o="GET",d=void 0,delete p["content-type"],delete p["content-length"]);continue}let T=await Je(U,n.bodyBytes,a.href,M=>x("PLUGIN_CONTENT_TOO_LARGE",M)),H={};return U.headers.forEach((M,S)=>{He.has(S.toLowerCase())||(H[S.toLowerCase()]=M)}),{status:U.status,headers:H,body:T}}catch(C){throw l&&!(C instanceof L)&&k(),E.signal.aborted?new Error(`${a.origin} did not finish answering plugin ${t}'s request within ${n.requestMs/1e3} seconds`):C}finally{g.delete(E),clearTimeout(I)}}}}}var ee=()=>ue(le()).controllerBaseUrl,Me={explore:e=>[new URL(e).origin]};async function Xe(e){let t=await e.controller();if(t.basic)return{authorization:de(t.basic.username,t.basic.accessKey)};if(t.token)return{authorization:`Bearer ${t.token}`};throw new Error("no credentials for the controller: run `kane-cli login`, then try again")}var Ge="run `kane-cli login`, then run the command again";function qe(e,t){let n=null;return{get breach(){return t.breach??n},close:()=>t.close(),request:async r=>{if(n!==null)throw n;let i=await t.request(r);return i.status===401&&n===null&&(n=new L({code:"PLUGIN_REFUSED",message:`${new URL(r.url).origin} refused the credential this run holds (${i.status}) when plugin ${e} fetched`,plugin:e,hook:"fetch",remedy:Ge})),i}}}function Ve(e,t={}){let n=t.origins??Me;if(!Object.hasOwn(n,e))return;let r=n[e],i=t.credentials??pe;return qe(e,xe({plugin:e,allow:r((t.controller??ee)()),authorize:()=>Xe(i),...t.fetchImpl?{fetchImpl:t.fetchImpl}:{}}))}var we=e=>Ve(e);import{createHash as ze}from"crypto";var re="exploration-export/1",F="exploration-export/2",We=new Set([re,F]),ye="/exploration/{id}/assurance",W="explore",te=/^[0-9a-f]{8}-[0-9a-f]{4}-[47][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function $e(e){let t=`${W}://`;if(!e.startsWith(t))return{ok:!1,why:`it does not start with ${t}`};let n=e.slice(t.length),r=n.indexOf("?"),i=r===-1?n:n.slice(0,r);if(!te.test(i))return{ok:!1,why:`${JSON.stringify(i)} is not an exploration id: a lowercase UUID, as kane-cli explore prints it`};if(r===-1)return{ok:!0,value:{exploration:i}};let s={exploration:i};for(let u of n.slice(r+1).split("&")){let c=/^(run|cut)=(.*)$/.exec(u);if(c===null)return{ok:!1,why:`after "?" only run=<run id> and cut=<N>|end may come; found ${JSON.stringify(u)}`};let[,l,g]=c;if(s[l]!==void 0)return{ok:!1,why:`${l} is given twice`};if(l==="run"){if(!te.test(g))return{ok:!1,why:`${JSON.stringify(g)} is not a run id: a lowercase UUID`};s.run=g}else if(g==="end")s.cut="end";else if(/^(0|[1-9]\d{0,8})$/.test(g))s.cut=Number(g);else return{ok:!1,why:`${JSON.stringify(g)} is not a cut: a whole number or end`}}return{ok:!0,value:s}}var me=e=>`explore-${e.exploration}`,Ee=e=>`${W}://${e.exploration}`,Be={junction:"junctions",control:"controls",flow:"flows",finding:"findings"},ne=/^[A-Za-z0-9][A-Za-z0-9._:/#-]{0,127}$/,y=e=>{throw new w(`the exploration export cannot be read: ${e}`,"the explorer answered an export this build does not understand; update kane-cli, or report it to the explorer's team")};function oe(e){if(typeof e!="string"||!We.has(e))throw new w(`exploration export version ${JSON.stringify(e)} is not supported by this build \u2014 update kane-cli`,"update kane-cli, then ingest it again")}var P=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),D=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0,Ke=(e,t)=>e.id<t.id?-1:e.id>t.id?1:0;function z(e,t){let n=Be[e];Array.isArray(t)||y(`${n} is not a list`);let r=new Set;return t.map((i,s)=>{P(i)||y(`${n}[${s}] is not an object`);let u=i;(typeof u.id!="string"||!ne.test(u.id))&&y(`${n}[${s}] has no id the explorer gives a ${e}`);let c=u.id;return r.has(c)&&y(`${n} names ${c} twice`),r.add(c),(u.fp===void 0||u.fp===null)&&y(`${n}[${s}] (${c}) has no fp, which its fingerprint is made of`),{id:c,fp:u.fp,text:P(u.text)?u.text:{},info:P(u.info)?u.info:{}}}).sort(Ke)}var Ye=new Set(["stopped","completed","paused","failed","cancelled"]),ie="x-export-digest",_e=(e,t)=>t===`sha256:${ze("sha256").update(e).digest("hex")}`;function B(e,t){P(e)||y(`${t} has no cursor`);let n=e;oe(n.export_version),(typeof n.run!="string"||n.run==="")&&y(`${t}'s cursor names no run`),D(n.run_version)||y(`${t}'s cursor has no whole run_version`),D(n.deltas)||y(`${t}'s cursor has no whole deltas`);let r={export_version:n.export_version,run:n.run,run_version:n.run_version,deltas:n.deltas};return r.export_version===F&&(n.cut!=="end"&&!D(n.cut)&&y(`${t}'s cursor has no cut (a whole number or end)`),typeof n.provisional!="boolean"&&y(`${t}'s cursor does not say whether it is provisional`),r.cut=n.cut,r.provisional=n.provisional),r}var se=e=>JSON.stringify(e.export_version===F?[e.export_version,e.run,e.run_version,e.deltas,e.cut??"end",e.provisional===!0]:[e.export_version,e.run,e.run_version,e.deltas]);function ke(e){let t;try{t=JSON.parse(e)}catch{return null}if(!Array.isArray(t)||t.length<4)return null;let[n,r,i,s,u,c]=t;return typeof n!="string"||typeof r!="string"||!D(i)||!D(s)?null:{export_version:n,run:r,run_version:i,deltas:s,...t.length>=6&&(u==="end"||D(u))?{cut:u,provisional:c===!0}:{}}}function be(e){let t;try{t=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(e))}catch{y("it is not JSON")}P(t)||y("it is not a JSON object");let n=t;P(n.cursor)||y("the export has no cursor");let r=n.cursor;return n.cursor={export_version:r.export_version,...r.provisional!==void 0?{provisional:r.provisional}:{}},delete n.run_state,new TextEncoder().encode(JSON.stringify(n))}function Ze(e,t){if(P(e)&&e.run!==void 0)return B(e,t);P(e)||y(`${t} has no cursor`);let n=e;return oe(n.export_version),n.export_version===F&&typeof n.provisional!="boolean"&&y(`${t}'s cursor does not say whether it is provisional`),{export_version:n.export_version,...typeof n.provisional=="boolean"?{provisional:n.provisional}:{}}}function Se(e){return ve(e,B,!0)}function K(e){return ve(e,Ze,!1)}function ve(e,t,n){let r;try{r=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(e))}catch{y("it is not JSON")}P(r)||y("it is not a JSON object");let i=r;oe(i.export_version),(typeof i.exploration_id!="string"||!te.test(i.exploration_id))&&y("exploration_id is not a lowercase UUID");let s=t(i.cursor,"the export");if(s.export_version!==i.export_version&&y(`its cursor is of ${s.export_version}, the export of ${String(i.export_version)}`),n&&s.provisional!==!0&&(typeof i.run_state!="string"||!Ye.has(i.run_state))){let x=s.run;throw new w(`the export of exploration ${i.exploration_id} is of ${x!==void 0?`run ${x}`:"a run"}, which has not ended (${JSON.stringify(i.run_state??null)}): the export is read once it ends`,"try again after the run ends; the current version is kept")}let u=x=>typeof i[x]=="string"?i[x]:null,c={junctions:z("junction",i.junctions),controls:z("control",i.controls),flows:z("flow",i.flows),findings:z("finding",i.findings)},l=new Set(Object.values(c).flatMap(x=>x.map($=>$.id))),g=i.redirects??{};P(g)||y("redirects is not an object");let k={};for(let[x,$]of Object.entries(g).sort(([R],[h])=>R<h?-1:R>h?1:0))(!ne.test(x)||typeof $!="string"||!ne.test($))&&y(`the redirect from ${JSON.stringify(x)} is not one explorer id to another`),Object.hasOwn(g,$)&&y(`the redirect from ${x} goes to ${$}, which is itself redirected: a redirect names the unit that took the id over`),l.has(x)&&y(`${x} is both a unit and redirected to ${$}`),l.has($)||y(`${x} is redirected to ${$}, which is not a unit of the export`),k[x]=$;return{export_version:i.export_version,exploration_id:i.exploration_id,project_id:u("project_id"),target_url:u("target_url"),cursor:s,run_state:u("run_state"),skipped:D(i.skipped)?i.skipped:0,...c,redirects:k}}import{createHash as Qe}from"crypto";var b={junction:"junction",control:"control",flow:"flow",retiredFlow:"flow.retired",finding:"finding",alias:"merged"},Re=/^[0-9a-f]{64}$/,j={junction:e=>`j:${e}`,control:e=>`c:${Re.test(e)?e.slice(0,16):e}`,flow:e=>`f:${e}`,finding:e=>`fd:${e}`},Oe=e=>Qe("sha256").update(Q(e),"utf8").digest().subarray(0,16).toString("base64url"),G=(e,t)=>Oe({kind:e,fp:t.fp}),et=(e,t)=>Oe({kind:"alias",survivor:e,fingerprint:t}),v=(e,t=200)=>{let n=(typeof e=="string"?e:Q(e??null)).replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}\u2026`:n},N=e=>JSON.stringify(v(e??"")),Y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),f=(e,t)=>Y(e)?e[t]:void 0,_=e=>typeof e=="string"&&e!==""?e:void 0,ae=e=>typeof e=="string"&&Re.test(e)?e.slice(0,12):v(e),tt=" (in flight at this cut: not citable yet)";function Z(e){let t=o=>e.cursor.provisional===!0&&o.info.settled===!1,n=o=>t(o)?tt:"",r=[],i=[],s=new Map,u=(o,d,p,a,m,O)=>{let E=s.get(o);if(E!==void 0)throw new w(`two units of exploration ${e.exploration_id} have the id ${o} (${E} and ${d}), so neither can be told apart`,"report it to kane's team: the unit id needs more of the explorer's id");s.set(o,d),i.push({id:o,ref:o,kind:p,lines:[a,r.length],fingerprint:m,...O!==void 0?{label:v(O,80)}:{}})},c=new Map;for(let o of["junction","control","flow","finding"])for(let d of e[`${o}s`])c.set(d.id,o);let l=o=>{if(typeof o!="string")return v(o);let d=c.get(e.redirects[o]??o);return d!==void 0?j[d](o):o};r.push(`Exploration ${e.exploration_id}${e.target_url!==null?` of ${v(e.target_url)}`:""}`),r.push(`Project: ${e.project_id??"none"}`),e.skipped>0&&r.push(`Left out by the explorer: ${e.skipped} item(s) whose ids cannot be cited`),r.push("Units: j: a screen, c: a control on it, f: a flow, fd: a finding. Cite the unit's id.");let g=new Map,k=new Set(e.junctions.map(o=>o.id)),x=new Map,$=[];for(let o of e.controls){let d=_(o.info.junction);d!==void 0&&k.has(d)?x.set(d,[...x.get(d)??[],o]):$.push(o)}let R=o=>{let{text:d,fp:p,info:a}=o,m=[_(d.container)?` in ${N(d.container)}`:"",_(f(p,"href_pattern"))?` to ${v(f(p,"href_pattern"))}`:"",a.disabled===!0?" disabled":"",f(p,"gated")===!0?" gated":""].join("");r.push(`${j.control(o.id)} ${v(_(d.role)??f(p,"role")??"control")} ${N(d.name??d.label)}${m}${n(o)}`);let O=G("control",o);g.set(o.id,O),t(o)||u(j.control(o.id),o.id,b.control,r.length,O)};r.push("","## Screens");for(let o of e.junctions){let d=j.junction(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1;r.push(`${d} screen ${N(p.name??p.heading??p.url_pattern??o.id)} at ${v(p.url_pattern??f(a,"url_pattern")??"?")}${n(o)}`),_(p.heading)&&p.heading!==p.name&&r.push(` heading: ${N(p.heading)}`);let E=f(a,"signatures");r.push(` kind ${v(f(a,"kind")??"?")}, ${Array.isArray(E)?E.length:0} version(s), current ${ae(m.current_signature??"none")}`);let I=G("junction",o);g.set(o.id,I),t(o)||u(d,o.id,b.junction,O,I,_(p.name));for(let U of x.get(o.id)??[])R(U)}if($.length>0){r.push("","## Controls on no screen of this export");for(let o of $)R(o)}r.push("","## Flows");for(let o of e.flows){let d=j.flow(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1,E=f(a,"exit")!==null&&f(a,"exit")!==void 0?l(f(a,"exit")):"(no exit)";r.push(`${d} flow ${N(p.name??o.id)}: ${l(f(a,"entry"))} to ${E}, ${v(m.status??"?")}${n(o)}`),r.push(` steps key: ${ae(f(a,"steps_key")??"none")}`);let I=Array.isArray(p.steps)?p.steps:[];for(let S of I)r.push(` step: ${v(f(S,"kind")??"step")} ${N(f(S,"label")??"")}`);let U=Array.isArray(p.assertions)?p.assertions:[];for(let S of U)r.push(` asserts ${ae(f(S,"id"))}: ${N(f(S,"text")??"")}`);let C=f(a,"assertions");Array.isArray(C)&&C.length!==U.length&&r.push(` assertions: ${C.length}`);let T=f(a,"stateful");(Y(T)||f(a,"state")===!0||_(f(a,"in_state")))&&r.push(` stateful${Y(T)?` ${v([T.type,T.role,T.kind].filter(S=>typeof S=="string").join(" "))}`:""}${f(a,"state")===!0?", sets state":""}${_(f(a,"in_state"))?`, needs ${N(f(a,"in_state"))}`:""}`),_(f(a,"after_flow"))&&r.push(` after: ${l(f(a,"after_flow"))}`);let H=_(f(a,"retired"));H!==void 0&&r.push(` retired: ${v(H)}${_(f(a,"superseded_by"))?`, superseded by ${l(f(a,"superseded_by"))}`:""}`);let M=Array.isArray(m.changes)?m.changes.filter(Y).slice(-3).reverse():[];for(let S of M){let Le=_(S.from_exit)||_(S.to_exit)?`: exit ${_(S.from_exit)?l(S.from_exit):"none"} to ${_(S.to_exit)?l(S.to_exit):"none"}`:"";r.push(` changed in run ${v(S.run_id??"?")}: ${v(S.kind??"a change")}${Le}`)}t(o)||u(d,o.id,H!==void 0?b.retiredFlow:b.flow,O,G("flow",o),_(p.name))}r.push("","## Findings");for(let o of e.findings){let d=j.finding(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1,E=(Array.isArray(m.junctions)?m.junctions:[]).map(l).join(", "),I=[_(f(a,"candidate"))?` at ${l(f(a,"candidate"))}`:"",E!==""?` on ${E}`:""].join("");r.push(`${d} finding ${v(f(a,"kind")??"?")}${_(f(a,"category"))?` (${v(f(a,"category"))})`:""}${I}${_(m.severity)?`, ${v(m.severity)}`:""}${n(o)}`),_(p.title)&&r.push(` ${N(p.title)}`),_(p.description)&&r.push(` ${N(p.description)}`),f(a,"blocked_by")!==null&&f(a,"blocked_by")!==void 0&&r.push(` blocked by: ${v(f(a,"blocked_by"))}`),t(o)||u(d,o.id,b.finding,O,G("finding",o),_(p.title))}let h=Object.entries(e.redirects);if(h.length>0){r.push("","## Merged");for(let[o,d]of h){let p=c.get(d),a=e[`${p}s`].find(m=>m.id===d);r.push(`${j[p](o)} merged into ${j[p](d)}${n(a)}`),t(a)||u(j[p](o),o,b.alias,r.length,et(d,g.get(d)??G(p,e[`${p}s`].find(m=>m.id===d))))}}return{text:r.join(`
3
+ `)+`
4
+ `,units:i}}var nt="explore",rt="exploration-export/1";function Ue(e,t,n){let r=ye.replace("{id}",t.exploration);return`${e.replace(/\/+$/,"")}${r}/${n}?cut=${t.cut??"end"}${t.run!==void 0?`&run=${t.run}`:""}`}function ot(e,t){let n=e.headers[ie];if(n===void 0)throw new w(`the export of exploration ${t.exploration} came with no digest (the ${ie} header)`,V);if(!_e(e.body,n))throw new w(`the export of exploration ${t.exploration} is not the bytes its digest names: it was changed on the way, or not served whole`,V);let r=Se(e.body);if(r.exploration_id!==t.exploration)throw new w(`the explorer answered the export of exploration ${r.exploration_id} when asked for ${t.exploration}`,"report it to the explorer's team");if(t.run!==void 0&&r.cursor.run!==t.run)throw new w(`the explorer answered the export as of run ${r.cursor.run} when asked for run ${t.run}`,"report it to the explorer's team");if(r.export_version!==F)throw new w(`the explorer answered ${r.export_version} when asked for a cut (export/2)`,"report it to the explorer's team");if((r.cursor.cut??"end")!==(t.cut??"end"))throw new w(`the explorer answered ${r.cursor.cut==="end"?"the end":`cut ${String(r.cursor.cut)}`} when asked for ${ce(t)}`,"report it to the explorer's team");return Z(r),r}var ce=e=>e.cut===void 0||e.cut==="end"?e.run!==void 0?`the end of run ${e.run}`:"its latest ended run":`cut ${e.cut}${e.run!==void 0?` of run ${e.run}`:""}`,Ce=e=>{let t=$e(e);if(!t.ok)throw new w(`${e} is not an exploration reference: ${t.why}`,"name it as explore://<exploration id>, with ?run=<run id> and/or cut=<N>|end to read one cut");return t.value},V="try again later; the current version is kept";function it(e){try{let t=JSON.parse(new TextDecoder().decode(e));return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function Pe(e,t,n,r){let i=`exploration ${n.exploration}${n.run!==void 0?` at run ${n.run}`:""}`,s=it(t);throw e===409&&s.code==="CUT_SUPERSEDED"?new w(`${ce(n)} of exploration ${n.exploration} is superseded (CUT_SUPERSEDED): a later run's cuts are served now`,"nothing to do: a later cut covers it"):e===404&&s.code==="CUT_NOT_FOUND"?new w(`${ce(n)} of exploration ${n.exploration} was never taken (CUT_NOT_FOUND)`,"name a cut the controller took (a checkpoint or a sync), or cut=end"):e===409&&s.code==="RUN_ACTIVE"?new w(`a run of exploration ${n.exploration} is in progress${typeof s.active_run=="string"?` (run ${s.active_run})`:""}: the export is read once it ends`,"try again after the run ends; the current version is kept"):e===409&&s.code==="EXPLORATION_OUTDATED"?new w(`${i} can no longer be read (OUTDATED): re-explore`,"explore the site again, then ingest the new exploration"):e===404&&s.code==="NO_ENDED_RUN"?new w(`exploration ${n.exploration} has no ended run yet: the export is read once its first run ends`,"try again after the first run ends"):e===404?new w(`${i} was not found (404): the explorer has no such exploration${n.run!==void 0?" or run":""}, or it is not one of your organisation's`,"check the id, and that kane-cli is signed in to the controller the exploration ran on"):e===401||e===403?new w(`the controller refused kane-cli's credentials (${e}) for ${i}`,"sign in again with kane-cli login, then try again"):e===400?new w(`the explorer refused the request for the ${r} of ${i} (400)${typeof s.error=="string"?`: ${s.error.slice(0,200)}`:""}`,"report it to kane's team"):new w(`the explorer answered ${e} for the ${r} of ${i}`,V)}async function Ne(e,t,n){try{return await e.connection.request({url:t,headers:{accept:"application/json"}})}catch(r){throw r instanceof L?r:new w(`exploration ${n.exploration} could not be read: ${r instanceof Error?r.message:String(r)}`,V)}}function Te(e){return{manifest:{contract:1,id:nt,version:"0.1.0",rules:rt,capabilities:["remote","explain","context","coverage","cites-deep"],claims:{schemes:[W]}},claim(t){if(t.isFile)return null;let n=Ce(t.ref),r=Ee(n);return{sourceId:me(n),label:`Exploration ${n.exploration}`,...r!==t.ref?{recorded:r}:{}}},async fetch(t){let n=Ce(t.ref);if(t.cursor!==null){let s=await Ne(t,Ue(e.controller,n,"head"),n);s.status!==200&&Pe(s.status,s.body,n,"head");let u;try{u=JSON.parse(new TextDecoder().decode(s.body))}catch{throw new w(`the head of exploration ${n.exploration} is not JSON`,V)}let c=B(u?.cursor,"the head");if(n.run!==void 0&&c.run!==n.run)throw new w(`the explorer answered the head as of run ${c.run} when asked for run ${n.run}`,"report it to the explorer's team");if(se(c)===t.cursor)return{kind:"unchanged"};let l=ke(t.cursor);if(l!==null&&l.export_version===re&&c.export_version===F&&l.run_version===c.run_version&&l.deltas===c.deltas)return{kind:"unchanged"}}let r=await Ne(t,Ue(e.controller,n,"export"),n);r.status!==200&&Pe(r.status,r.body,n,"export");let i=ot(r,n);return{kind:"content",bytes:be(r.body),cursor:se(i.cursor)}},render(t){return{text:Z(K(t.bytes)).text}},index(t){return Z(K(t.bytes)).units},explain:at,context:ct,coverage:ut}}var Ie=e=>e.replace(/\n$/,"").split(`
5
+ `).slice(1).map(t=>t.trim()),A=e=>e.split(`
6
+ `)[0]??"",J=e=>e.length>X.reasonChars?`${e.slice(0,X.reasonChars-1)}\u2026`:e,q=(e,t)=>e.find(n=>n.startsWith(`${t}: `))?.slice(t.length+2),st=e=>e===b.flow||e===b.retiredFlow;function at(e){let{before:t,after:n}=e,r=n.unit.id,i=l=>/ merged into (\S+)$/.exec(A(l))?.[1];if(n.unit.kind===b.alias){let l=i(n.text),g=i(t.text);return t.unit.kind!==b.alias?J(`${r} was merged into ${l}`):J(g!==l?`${r} is now merged into ${l} (was ${g})`:`${l}, which ${r} was merged into, changed`)}if(t.unit.kind===b.alias)return J(`${r} is a unit of its own again (it was merged into ${i(t.text)})`);let s=Ie(t.text),u=Ie(n.text),c=[];if(n.unit.kind===b.junction){let l=g=>g.find(k=>k.startsWith("kind "));return l(s)!==l(u)&&c.push(`the screen has a new version: ${l(u)}`),A(t.text)!==A(n.text)&&c.push(`now ${A(n.text).slice(r.length+1)}`),c.length>0?J(c.join("; ")):"the explorer's record of the screen changed"}if(st(n.unit.kind)){let l=u.find(R=>R.startsWith("changed in run "));l!==void 0&&!s.includes(l)&&c.push(l);let g=q(u,"retired");g!==void 0&&q(s,"retired")!==g&&c.push(`retired: ${g}`),g===void 0&&q(s,"retired")!==void 0&&c.push("no longer retired");let k=R=>/: (\S+) to (\S+|\(no exit\)), [^,]*$/.exec(A(R))?.slice(1,3).join(" to ");k(t.text)!==k(n.text)&&c.push(`now ${k(n.text)} (was ${k(t.text)})`),q(s,"steps key")!==q(u,"steps key")&&c.push("its steps changed");let x=R=>R.filter(h=>h.startsWith("asserts ")||h.startsWith("assertions: ")).map(h=>h.split(":")[0]).join(`
7
+ `);x(s)!==x(u)&&c.push("its assertions changed");let $=R=>R.filter(h=>h.startsWith("stateful")||h.startsWith("after: ")).join(`
8
+ `);return $(s)!==$(u)&&c.push("its state changed"),c.length>0?J(c.join("; ")):"the explorer's record of the flow changed"}return A(t.text)!==A(n.text)?J(`now ${A(n.text).slice(r.length+1)} (was ${A(t.text).slice(r.length+1)})`):`the explorer's record of the ${n.unit.kind===b.control?"control":"finding"} changed`}function ct(e){let t=K(e.bytes),n=r=>e.units.filter(i=>r.includes(i.kind??"")).length;return[{stage:"all",title:"How to read an exploration map",text:[`This is exploration ${t.exploration_id} as of ${t.cursor.provisional===!0?"a cut of its running run":"its last ended run"}.`,`${n([b.junction])} screen(s) (j:), ${n([b.control])} control(s) (c:), ${n([b.flow,b.retiredFlow])} flow(s) (f:), ${n([b.finding])} finding(s) (fd:), ${n([b.alias])} merged id(s).`,"A control is a unit of its own, listed under the screen it is on: a new control on a screen changes nothing for a test that does not touch it.","A flow's status (verified, stale, changed) is the explorer's reading of its last walk, not a change to the product."].join(`
9
+ `)},...t.skipped>0?[{stage:"all",title:"Items left out",text:`${t.skipped} explorer items could not be cited and were left out`}]:[],...t.cursor.provisional===!0?[{stage:"all",title:"A cut of a running exploration",text:`This map is a cut of a run, taken while the run was still exploring. A line marked "in flight at this cut: not citable yet" is something the explorer was still working on: read it, never cite it; a later cut or the run's end settles it.`}]:[],{stage:"design",title:"What each item cites",text:["Give every acceptance criterion, scenario and test its own `cites`: the screens (j:) and flows (f:) it rests on, each by the lines of that unit as the map shows them, quoted as written.","A test cites the flow it walks, each control (c:) its steps touch, and the screen it ends on.","Cite a finding (fd:) only for a regression test of it, together with its flow.","An item that cites nothing is committed with a warning; one that cites a unit goes stale exactly when that unit changes."].join(`
10
+ `)},{stage:"reconcile",title:"Merged ids and retired flows",text:'A unit shown as "<old> merged into <survivor>" was the same screen or control all along: cite the survivor. A retired flow names its successor when it was superseded: cite that.'}]}function ut(e){let t=e.units.filter(n=>n.kind===b.flow).map(n=>n.id);return{expected:t,groups:t.length>0?[{name:"Flows",units:t}]:[]}}var lt=[({controller:e})=>Te({controller:e})];function dt(){return{controller:ee()}}function pt(e=dt()){return lt.map(t=>t(e))}var je;function ft(){return je??=fe(pt()),je}var Ae=!1;function Ft(e=ft,t=we){if(Ae)return;let n;try{n=e()}catch{return}ge(n,t),Ae=!0}export{ee as a,Ve as b,we as c,ke as d,Z as e,Ue as f,ot as g,ft as h,Ft as i};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{L as _,a as b,c as x,r as S,x as k,y as O}from"./chunk-UEE3RZN4.js";import{f as v,h as C}from"./chunk-KU3YHPWZ.js";var F=e=>`conv#turn=${e}`,$=(e,r)=>`${e}:turn:${r}`,N=/^(.+):turn:(\d+)$/,G=e=>N.test(e);function P(e){return e.flatMap(r=>{let t=r;return t.kind==="user_message"&&typeof t.data?.message_id=="string"?[t.data.message_id]:[]})}function L(e,r,t,n,o=[]){let a=e.parse(t);if(a!==null&&e.resolveToken(a)===null)return[];let m=new Set(P(n)),s=new Set;for(let i of e.recordsSince(a))i.conv?.source_id===r&&i.conv.turn>=1&&s.add(i.conv.turn);for(let i of o){let c=N.exec(i);c&&c[1]===r&&s.add(Number(c[2]))}if(s.size===0)return[];let d=e.headOf(r,{token:null}),l=typeof d=="string"?e.getNode(d,{token:null})?.content?.blob:void 0,f=typeof l=="string"?e.getBlob(l)?.toString("utf8")??"":"",p=[];for(let i of[...s].sort((c,u)=>c-u)){let c=$(r,i),u=m.has(c)?null:y(f,i);u?.speaker==="person"&&p.push({message_id:c,text:u.text})}return p}function y(e,r){for(let t of e.split(`
3
+ `))if(t.trim())try{let n=JSON.parse(t);if(n.turn===r){let o=n.speaker==="person"||n.speaker==="agent"||n.speaker==="kane"?n.speaker:null;return{text:k(n.text).text,speaker:o}}}catch{}return null}function H(e,r){return y(e,r)?.text??null}var E={format:"conversation",media_type:"text/x-conversation",anchors_supported:["#turn="]},V="su-conv-";function J(e){let{store:r,graph:t,sessionStamp:n}=e,o=`${V}${n}`,a=t.heads.get(o);if(typeof a=="string")return{record:null,errors:[{code:"CONV_SOURCE_EXISTS",detail:`${o} already exists \u2014 resume it`}],sourceId:o,cid:a};let m=r.putBlob(Buffer.from("","utf8")),s=x(o,m),d=C("source",s);if(d.length>0)return{record:null,errors:d.map(p=>({code:p.code,detail:p.detail})),sourceId:o,cid:""};let l=b("source",s);return{record:_(r,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:l,label:v.SOURCE,content:s}],edges:[],review:[],supersessions:[],source_head_moves:{[o]:l},media:{[o]:E},conv:{source_id:o,turn:0,append_of:null}},{graph:t,scope:{sourcePins:[{source_id:o}]},expectPrev:t.latestHash,intent:{v:1,verb:"conv-mint",args:S({sessionStamp:n,by:e.by}),pins:{}},provenance:e.provenance}).record,errors:null,sourceId:o,cid:l}}function X(e){let{store:r,graph:t,sourceId:n,force:o}=e,{text:a,replaced:m}=k(e.text),s=t.heads.get(n),d=t.convChains.get(n);if(typeof s!="string"||!d)return{record:null,errors:[{code:"CONV_SOURCE_MISSING",detail:`${n} is not a live conversation source`}]};let f=t.getNode(s)?.content?.blob;if(typeof f!="string")return{record:null,errors:[{code:"CONV_SOURCE_MISSING",detail:`${n} head node unreadable`}]};let p=r.getBlob(f)?.toString("utf8")??"",i=d.turns,c=i>0?y(p,i):null;if(!o&&c!==null&&c.text===a&&c.speaker===(e.speaker??null))return{record:null,errors:null,turn:i,cid:s,idempotent:!0};let u=i+1,I=e.speaker?{turn:u,text:a,speaker:e.speaker}:{turn:u,text:a},T=`${p}${JSON.stringify(I)}
4
+ `,w=r.putBlob(Buffer.from(T,"utf8")),h=x(n,w),g=b("source",h),R=_(r,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:g,label:v.SOURCE,content:h}],edges:[],review:[],supersessions:[],source_head_moves:{[n]:g},media:{[n]:E},conv:{source_id:n,turn:u,append_of:s}},{graph:t,scope:{sourcePins:[{source_id:n}]},expectPrev:t.latestHash,intent:{v:1,verb:"conv-turn",args:S({sourceId:n,text:a,force:o??!1,by:e.by,...e.speaker?{speaker:e.speaker}:{}}),pins:{append_of:s}},provenance:e.provenance}),B=m>0?{warnings:[O(n,m)]}:{};return{record:R.record,errors:null,turn:u,cid:g,idempotent:!1,...B}}export{F as a,$ as b,G as c,P as d,L as e,H as f,V as g,J as h,X as i};
@@ -0,0 +1,21 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as P}from"./chunk-TW63WWEN.js";import{b as Le}from"./chunk-A6TJOZ24.js";import{a as m,c as Nt,d as At,e as I,f as Ae,g as Ce,h as Ct,i as Te,j as Tt}from"./chunk-CB4ARIHR.js";import{a as _t}from"./chunk-BSRSXYDZ.js";import{a as Z,c as xt,e as It}from"./chunk-WOSANGV6.js";import{d as Ot}from"./chunk-XMPTFXPW.js";import{a as Rt}from"./chunk-73Y6T2UK.js";import{a as et}from"./chunk-WN5VKKJ3.js";import{b as Pt,c as Ft}from"./chunk-MNBGG4H3.js";import{a as Lt}from"./chunk-VRIZDOO5.js";import{b as qe,d as qt}from"./chunk-ZHWU6L2G.js";import{a as vt,b as Ne,c as Et,d as de}from"./chunk-ZFM77AQU.js";import{Da as pt,Ea as S,Ga as ft,Ha as ht,Ia as mt,Ka as gt,Na as bt,Pa as W,Qa as L,Sa as ke,Ta as wt,Ua as yt,Va as C,Xa as Re,Ya as St,bb as ve,cb as Ee,eb as $,fb as w,gb as xe,h as at,hb as $t,ib as Ie,kb as Oe,l as ct,lb as kt,mb as _e,o as lt,ob as X,s as dt,xa as K,ya as ut}from"./chunk-UEE3RZN4.js";import{c as st,n as it}from"./chunk-DBMW3VUN.js";import{a as q}from"./chunk-KU3YHPWZ.js";import{a as ce,b as le}from"./chunk-7V4BQSSV.js";import{c as rt}from"./chunk-HHW6MRU3.js";import{a as ae}from"./chunk-7DFBOVUB.js";import{a as ot}from"./chunk-6PIIUAZF.js";import{s as tt,t as nt}from"./chunk-NC7D7GOM.js";import{a as ie}from"./chunk-HCBYKLMW.js";import{a as M,b as k,i as se}from"./chunk-33DWJV67.js";import{a as Nn}from"./chunk-6YGTRKDT.js";import{y as A}from"./chunk-I6OQISK4.js";import{e as z}from"./chunk-UR6MHSHU.js";import{existsSync as co}from"fs";var D=z(Nn(),1);import{existsSync as re,mkdirSync as Sn,readdirSync as Lr,readFileSync as we,rmSync as yn,writeFileSync as Pr,renameSync as Fr}from"fs";import{randomBytes as Jr}from"crypto";import{basename as Br,join as ze}from"path";import{appendFileSync as he,closeSync as cr,existsSync as b,mkdirSync as T,openSync as lr,readdirSync as j,readFileSync as y,renameSync as ge,rmdirSync as dr,rmSync as _,realpathSync as ur,statfsSync as pr,statSync as on,writeFileSync as fr}from"fs";import{randomBytes as sn}from"crypto";import{basename as an,dirname as R,join as f,relative as Me}from"path";var An=/^sha256:[0-9a-f]{64}$/;function Q(t){let e=new Set,n=r=>{typeof r=="string"&&An.test(r)&&e.add(r)};for(let r of t.nodes??[])n(r.content?.blob);for(let r of Object.values(t.media??{})){n(r.text_blob);for(let o of r.images??[])n(o.blob);n(r.plugin?.index),n(r.plugin?.notes),n(r.plugin?.coverage)}return{blobs:[...e].sort(),proposalId:t.proposal_id??null}}function Pe(t){return"sha256:"+le(Buffer.from("assurance.proposal\0"+ce(JSON.parse(t)),"utf8"))}import{mkdirSync as Cn,readFileSync as Tn}from"fs";import{dirname as qn,join as Ln}from"path";var Jt="locations.json",Bt="state.json";function ue(t,e){return Ln(t,"sync",e)}function Ut(t){return Yt(ue(t,Jt),{version:1,locations:[]})}function $o(t,e){jt(ue(t,Jt),e)}function F(t){return Yt(ue(t,Bt),{version:1,entries:{}})}function Mt(t,e){jt(ue(t,Bt),e)}function Wt(t,e){let n=t.locations;if(n.length===0)throw new Error("no locations yet \u2014 add one with kane-cli context sync add <name> <descriptor>");if(e!==void 0){let o=n.find(i=>i.name===e);if(o)return o;throw new Error(`no location named ${e} \u2014 known locations: ${n.map(i=>i.name).join(", ")}`)}if(n.length===1)return n[0];let r=n.find(o=>o.name==="origin");if(r)return r;throw new Error(`name a location: ${n.map(o=>o.name).join(", ")}`)}var H=class extends Error{code="WITNESS_LOWERED"};function Ht(t,e,n){let r=t.entries[e];if(!r)throw new Error(`no sync state for ${e} \u2014 run kane-cli context sync add ${e} <descriptor> first`);let o=r.witness;if(o){if(n.seq<o.seq)throw new H(`${e} is behind what it already served: position ${o.seq} was seen there, now ${n.seq}`);if(n.seq===o.seq&&n.hash!==o.hash)throw new H(`${e} changed the record at position ${o.seq}: ${o.hash} was seen there, now ${n.hash}`)}r.witness=n}function ko(t,e,n){let r=t.locations.length,o=t.locations.filter(i=>i.name!==n);if(o.length===r){let i=r===0?"none":t.locations.map(s=>s.name).join(", ");throw new Error(`no location named ${n} \u2014 known locations: ${i}`)}return t.locations=o,e.entries[n]?.witness??null}function Yt(t,e){let n;try{n=Tn(t,"utf-8")}catch(o){if(o.code==="ENOENT")return e;throw new Error(`${t} could not be read: ${o instanceof Error?o.message:String(o)}`)}let r;try{r=JSON.parse(n)}catch(o){throw new Error(`${t} is not readable JSON: ${o instanceof Error?o.message:String(o)}`)}if(typeof r!="object"||r===null||!("version"in r)||r.version!==1)throw new Error(`${t} is not a version 1 sync file \u2014 this store was written by a newer kane-cli`);return r}function jt(t,e){Cn(qn(t),{recursive:!0}),$(t,JSON.stringify(e,null,2)+`
3
+ `)}import{closeSync as Yn,existsSync as Zt,linkSync as jn,mkdirSync as Vn,openSync as Gn,readFileSync as Dn,rmSync as Qt,writeFileSync as zn}from"fs";import{dirname as pe,join as en}from"path";import{existsSync as Un}from"fs";import{join as Mn}from"path";var Vt=1e3,Pn=999999999,Gt=/^assurance\/context@(\d+)$/,Fn=Number(Gt.exec(q)[1]);async function te(t,e){let n=await t.get(I(e));if(n===null)throw ee(`position ${e} is absent`);return{hash:Fe(e,n).hash,raw:n}}function Fe(t,e){let n=i=>new m("SYNC_OBJECT_CORRUPT",`the record at position ${t} on the storage is not usable: ${i}`,"the storage object needs a human look; nothing was changed"),r;try{r=JSON.parse(Buffer.from(e).toString("utf8"))}catch(i){throw n(`not JSON (${i instanceof Error?i.message:String(i)})`)}if(typeof r!="object"||r===null||Array.isArray(r)||r.seq!==t)throw n(`it says it is position ${String(r?.seq)}`);let o=r.schema_version===ve&&Ee(r);if(r.schema_version!==void 0&&r.schema_version!==q&&!o){let i=Gt.exec(r.schema_version);throw i&&Number(i[1])>Fn?new m("SYNC_CLIENT_TOO_OLD",`position ${t} is stamped ${r.schema_version}; this kane-cli reads ${q}`,`upgrade kane-cli to a release that reads ${r.schema_version}, then run the command again`):n(`it is stamped ${r.schema_version}, this build reads ${q}`)}if(r.schema_version===q&&Ee(r))throw n(`it carries a source-plugin fact and is stamped ${q}; such a record is stamped ${ve}`);if(r.parents!==void 0&&!(r.prev_hash===null?r.parents.length===0:r.parents.length===1&&r.parents[0]===r.prev_hash))throw n("parents does not mirror prev_hash");return{record:r,hash:L(r)}}async function J(t,e,n=0){let r=e,o=1,i;for(;;){let p=e+o;if(!await t.head(I(p))){i=p;break}r=p,o*=2}if(r===e&&e>0&&!await t.head(I(e)))return J(t,0);for(;i-r>1;){let p=r+Math.floor((i-r)/2);await t.head(I(p))?r=p:i=p}let s=r;if(s===0){if(await t.head(At))throw ee("meta.json exists but position 1 is gone");let p=(await t.list(Nt)).map(Ce).find(h=>h!==null);if(p!==void 0)throw ee(`position ${p} exists but position 1 is gone`);return{seq:0,hash:null,raw:null}}let a=[Ae(s),Ae(Math.min(s+Vt,Pn))];a[1]===a[0]&&a.pop();let c=new Set;for(let p of a)for(let h of await t.list(p)){let x=Ce(h);if(x!==null){if(x>s){if(await t.head(I(s+1))){if(n>=Jn)throw Bn(s);return J(t,s,n+1)}throw ee(`position ${x} exists above the tail at ${s}`)}c.add(x)}}let d=s-(s-1)%Vt;for(let p=d;p<=s;p++)if(!c.has(p))throw ee(`position ${p} is missing below the tail at ${s}`);let{hash:l,raw:u}=await te(t,s);return{seq:s,hash:l,raw:u}}var Jn=3;function Bn(t){return new m("SYNC_REMOTE_HOLE",`the storage kept growing while its tail was being found (last seen at ${t}); nothing was changed`,"run the command again in a moment")}function ee(t){return new m("SYNC_REMOTE_HOLE",`the storage has a hole: ${t} \u2014 a position was deleted below evidence of a later one`,"restore the missing position from a copy that holds it; nothing was changed")}function Dt(t,e){let n=St(t,e);if(n===null)throw new S(`no local record at position ${e} \u2014 run kane-cli context fsck`);if(!(n!==Re&&Un(Mn(t,"commits",`${String(e).padStart(6,"0")}-${n.slice(7,19)}.json`))))throw new m("SYNC_LOCAL_RECORD_CORRUPT",`the local record at position ${e} ${n===Re?"is unreadable":"does not hash to its file name"}`,"run kane-cli context fsck, then restore the record from a backup or a clone; nothing was changed");return n}async function zt(t,e,n){let r=C(t),o=await J(e,n?.seq??0),i=async u=>u===o.seq?o.hash:(await te(e,u)).hash;if(n&&(o.seq<n.seq||await i(n.seq)!==n.hash))throw new m("SYNC_REMOTE_ROLLED_BACK",`the storage was rolled back: position ${n.seq} was seen there with ${n.hash}, `+(o.seq<n.seq?`now its tail is ${o.seq}`:"now a different record sits there"),"restore the storage from a copy that holds the witnessed records, or remove and re-add the location after a human has decided it was rebuilt on purpose");let s=o.seq===0?null:{seq:o.seq,hash:o.hash};if(s===null)return{kind:"empty-storage",local:r,storage:s};if(r===null)return{kind:"empty-local",local:r,storage:s};if(Dt(t,1)!==await i(1))return{kind:"foreign-lineage",local:r,storage:s};let a=Math.min(r.seq,s.seq),c=async u=>(u===r.seq?r.hash:Dt(t,u))===await i(u);if(await c(a))return{kind:r.seq===s.seq?"up-to-date":r.seq<s.seq?"behind":"ahead",local:r,storage:s};let d=1,l=a;for(;l-d>1;){let u=d+Math.floor((l-d)/2);await c(u)?d=u:l=u}return{kind:"diverged",local:r,storage:s,at:l}}function Kt(t){let e=new Map;return{indexOf(n){if(!e.has(n)){let r=t(n);e.set(n,r===null?void 0:it(r))}return e.get(n)},notesBlob:n=>t(n),coverageBlob:n=>t(n)}}function Xt(t,e){for(let[n,r]of Object.entries(t??{})){let o=r?.plugin;if(o==null||typeof o!="object")continue;let i;if(typeof o.index=="string"){if(i=e.indexOf(o.index),i===null)return{code:"UNIT_INDEX_INVALID",sourceId:n,blob:o.index,detail:"that blob is not a unit index"};if(i!==void 0&&(i.plugin!==o.id||i.rules!==o.rules))return{code:"UNIT_INDEX_INVALID",sourceId:n,blob:o.index,detail:`that index was written by plugin ${JSON.stringify(i.plugin)} under rules ${JSON.stringify(i.rules)}, not by ${JSON.stringify(o.id)} under rules ${JSON.stringify(o.rules)} as the record says`}}if(typeof o.notes=="string"){let s=e.notesBlob(o.notes);if(s===null)continue;let a=qt(s);if(a===null)return{code:"NOTES_INVALID",sourceId:n,blob:o.notes,detail:`that blob is not the stored form of a version's notes${Hn(s)}`};if(a.plugin!==o.id)return{code:"NOTES_INVALID",sourceId:n,blob:o.notes,detail:`those notes were written by plugin ${JSON.stringify(a.plugin)}, not by ${JSON.stringify(o.id)} as the record says`};let c=new Set((i?.units??[]).map(l=>l.id).filter(l=>l!==st)),d=qe(a,c);if(d!==null)return{code:"NOTES_INVALID",sourceId:n,blob:o.notes,detail:d}}if(typeof o.coverage=="string"){let s=e.coverageBlob(o.coverage);if(s===null)continue;let a=Wn(s);if(a===void 0)return{code:"COVERAGE_INVALID",sourceId:n,blob:o.coverage,detail:"that blob is not the stored form of a coverage plan (it is not JSON)"};let c=(i?.units??[]).map(l=>l.id),d=Lt(a,c);if(d!==null)return{code:"COVERAGE_INVALID",sourceId:n,blob:o.coverage,detail:`that blob is not the stored form of a coverage plan of this version (${/^(expected|group \d|the unit|two groups)/.test(d)?d:`it ${d}`})`};if(ce(a)!==Buffer.from(s).toString("utf8"))return{code:"COVERAGE_INVALID",sourceId:n,blob:o.coverage,detail:"that blob is not the stored form of a coverage plan (its bytes are not the canonical form of what it holds)"};if(a.plugin!==o.id)return{code:"COVERAGE_INVALID",sourceId:n,blob:o.coverage,detail:`that coverage plan was written by plugin ${JSON.stringify(a.plugin)}, not by ${JSON.stringify(o.id)} as the record says`}}}return null}function Wn(t){try{return JSON.parse(Buffer.from(t).toString("utf8"))}catch{return}}function Hn(t){try{let e=qe(JSON.parse(Buffer.from(t).toString("utf8")));return e===null?" (its bytes are not the canonical form of what it holds)":e.startsWith("note ")?` (${e})`:` (it ${e})`}catch{return" (it is not JSON)"}}var Kn=2e3;async function rs(t,e,n,r,o){let i=F(t).entries[n]?.witness??null,s=await zt(t,e,i),a=s.local?.seq??0,c={imported:0,from:a,to:a,blobs:0,proposals:0};switch(s.kind){case"empty-storage":return r(`nothing to pull: ${n} is empty`),c;case"up-to-date":return r("up to date"),c;case"ahead":return o?.quietAhead||r(`nothing to pull; you are ahead of ${n} \u2014 run kane-cli context push ${n}`),c;case"diverged":throw new m("SYNC_DIVERGED",`you and ${n} both added work after position ${s.at-1}; nothing was pulled`,`run kane-cli context pull ${n} --rebase to save your local work, take the team version from ${n}, and then reapply yours`);case"foreign-lineage":throw new m("SYNC_FOREIGN_LINEAGE",`${n} holds a different history (its first record is not this store's)`,`to work on it, clone it: kane-cli context clone <descriptor of ${n}> <dir>; to share this store, add an empty location`);case"behind":case"empty-local":break}let d=s.storage.seq,l=await Be(t,e,s.local,s.storage,Xn(t,s.local),r);return Ue(t,l,s.local?.hash??null,n),X(t),Je(t,n,{seq:d,hash:l.records[l.records.length-1].hash}),{imported:l.records.length,from:a,to:d,blobs:l.blobs.size,proposals:l.proposals.size}}function Je(t,e,n,r){let o=r?.lockHeld?()=>{}:W(t,{deadlineMs:Kn});try{let i=F(t),s=i.entries[e]?.witness??null;if(r?.forwardOnly&&s&&s.seq>n.seq)return;try{Ht(i,e,n)}catch(a){throw a instanceof H?new m("SYNC_REMOTE_ROLLED_BACK",a.message,"restore the storage from a copy that holds the witnessed records, or remove and re-add the location after a human has decided it was rebuilt on purpose"):a}Mt(t,i)}finally{o()}}function Xn(t,e){let n=kt(t);return n&&n.applied.seq===(e?.seq??0)&&n.applied.hash===(e?.hash??null)?n:X(t)}async function Be(t,e,n,r,o,i=()=>{}){let s=await Qn(e,n?.seq??0,n?.hash??null,r.seq,r.hash),a=nr(s,o),c=await er(t,e,s);ir(t,s),ar(t,s,a);let d=await tr(t,e,s,i);return{records:s,blobs:c,proposals:d}}function Ue(t,e,n,r,o){for(let[a,c]of e.proposals){let[d,l]=a.split("/");Zn(en(pe(Z(t,d)),l),c)}let i=n,s=null;for(let a=0;a<e.records.length;a+=xe){let c=e.records.slice(a,a+xe),d=o?.lockHeld?()=>{}:W(t);try{$t(t,c.map(({seq:l,raw:u})=>({seq:l,raw:u})),i,{...o,lockHeld:!0})}catch(l){if(!(l instanceof bt))throw l;let u=`this store appended position ${C(t)?.seq??0} while the pull was`;throw new m("SYNC_LOCAL_MOVED",s===null?`${u} being prepared; nothing was imported`:`${u} landing; positions ${e.records[0].seq}..${s} were imported, a valid prefix, and nothing more`,`kane-cli context pull ${r}`)}finally{d()}i=c[c.length-1].hash,s=c[c.length-1].seq,o?.afterChunk?.(s)}}function Zn(t,e){Vn(pe(t),{recursive:!0});let n=`${t}.tmp-${process.pid}`,r=Gn(n,"w");try{zn(r,e),ae(r)}finally{Yn(r)}try{jn(n,t)}catch(o){if(o.code!=="EEXIST")throw Qt(n,{force:!0}),o}Qt(n,{force:!0}),w(pe(t))}async function Qn(t,e,n,r,o){let i=[],s=n;for(let a=e+1;a<=r;a++){let c=await t.get(I(a));if(c===null)throw new m("SYNC_REMOTE_HOLE",`the storage has a hole: position ${a} is missing below its tail at ${r}`,"restore the missing position from a copy that holds it; nothing was changed");let{record:d,hash:l}=Fe(a,c);if(d.prev_hash!==s)throw new m("SYNC_REMOTE_CHAIN_BROKEN",`position ${a} on the storage is sealed onto ${String(d.prev_hash)}, but position ${a-1} hashes ${String(s)}`,"the storage chain needs a human look; nothing was changed");if(a===r&&l!==o)throw new m("SYNC_REMOTE_CHAIN_BROKEN",`the tail at position ${r} changed while this pull ran: it hashed ${o}, now ${l}`,"run kane-cli context pull again");i.push({seq:a,hash:l,raw:Buffer.from(c).toString("utf8"),record:d}),s=l}return i}async function er(t,e,n){let r=new Set;for(let{seq:o,record:i}of n)for(let s of Q(i).blobs){if(r.has(s))continue;let a=de(t,s);if(a!==null&&Ne(a)===s)continue;let c=await e.get(Ct(s));if(c===null)throw new m("SYNC_REMOTE_HOLE",`the storage has a hole: position ${o} names blob ${s}, which the storage does not hold`,"restore the blob from a copy that holds it; nothing was changed");let d=Buffer.from(c);if(Ne(d)!==s)throw new m("SYNC_OBJECT_CORRUPT",`the blob ${s} on the storage does not hash to its name (named by position ${o})`,"the storage object needs a human look; nothing was changed");a===null?Et(t,d):$(vt(t,s),d),r.add(s)}return r}async function tr(t,e,n,r){let o=new Map,i=new Set;for(let{seq:s,record:a}of n){let c=Q(a).proposalId;if(c===null||i.has(c))continue;i.add(c);let d=Z(t,c),l=null;if(Zt(d))try{l=Pe(Dn(d,"utf8"))}catch{l=""}let u=await e.list(Tt(c));if(u.length===0)continue;if(u.length>1){r(`proposal ${c} (position ${s}) has ${u.length} payloads on the storage and the record names none of them; skipped`);continue}if(l!==null&&Te(c,l)===u[0])continue;let p=await e.get(u[0]);if(p===null)continue;let h=null;try{h=Pe(Buffer.from(p).toString("utf8"))}catch{h=null}if(h===null||Te(c,h)!==u[0]){r(`proposal ${c} (position ${s}) on the storage does not digest to its key ${u[0]}; skipped`);continue}if(l===null){o.set(`${c}/proposal.json`,Buffer.from(p));continue}let x=`${c}/proposal.${h.slice(7,19)}.json`;Zt(en(pe(d),x.slice(c.length+1)))||(r(`proposal ${c} (position ${s}) differs from the one here; the storage's payload is installed beside it as ${x}`),o.set(x,Buffer.from(p)))}return o}function nr(t,e){let n=structuredClone(e);for(let{seq:r,hash:o,record:i}of t)try{lt(n,i,o)}catch(s){throw s instanceof ct?new m("SYNC_REMOTE_ADMISSION_RED",`position ${r} would not pass this store's checks: ${s.message}`,`nothing was imported; ask whoever pushed position ${r} to run kane-cli context fsck on their store, or upgrade kane-cli if theirs is newer`):s}return n}var fe=t=>t.slice(0,19),rr=t=>t===null?"no units":`units [${t.join(", ")}]`,or=t=>t===null?"no units":`[${t.join(", ")}]`,sr=(t,e)=>`the record at position ${t} says citation ${fe(e.ecid)} is in ${rr(e.said)}; its lines ${e.anchor} of ${e.sourceId} fall in ${or(e.found)} \u2014 nothing was applied`;function ir(t,e){let n=Kt(r=>de(t,r));for(let{seq:r,record:o}of e){let i=Xt(o.media,n);if(i===null)continue;let s=i.code==="UNIT_INDEX_INVALID"?"unit index":i.code==="NOTES_INVALID"?"notes":"coverage plan";throw new m(i.code==="UNIT_INDEX_INVALID"?"SYNC_UNIT_INDEX_INVALID":i.code==="NOTES_INVALID"?"SYNC_NOTES_INVALID":"SYNC_COVERAGE_INVALID",`the record at position ${r} names blob ${fe(i.blob)} as the ${s} of ${i.sourceId}, and ${i.detail} \u2014 nothing was applied`,`this build cannot take that record. It was written by a kane-cli with a fault or was altered; tell whoever pushed position ${r}, and keep working from your own store`)}}function ar(t,e,n){let r={mediaOf:o=>Object.hasOwn(n.media,o)?n.media[o]:void 0,getBlob:o=>de(t,o)};for(let{seq:o,record:i}of e){let s=at(i.edges,r);if(s!==null)throw s.code==="UNIT_INDEX_MISSING"?new m("SYNC_UNIT_INDEX_MISSING",`the record at position ${o} cites ${s.anchor} of ${s.sourceId} at version ${fe(s.versionCid)}, and that version's unit index (blob ${fe(s.index??"")}) is not in this store's blob store, so the citation's units cannot be checked \u2014 nothing was applied`,"restore this store's blobs from a copy, or clone the location into a new folder (a clone fetches every blob); kane-cli context fsck names what is missing"):new m("SYNC_UNITS_MISMATCH",sr(o,s),`this build cannot take that record. It was written by a kane-cli with a fault or was altered; tell whoever pushed position ${o}, and keep working from your own store`)}}var hr=["pending-facts.ndjson","signals.ndjson","store.json"],mr=/^\d{6}-[0-9a-f]{12}\.json$/,tn=["staged","fenced","backed-up","trimmed","importing","imported","unfenced"],cn=2e3,gr=1440*60*1e3,br=(t,e)=>f(t,"sync","backups",`${e}-reset`),wr=()=>new Date().toISOString().replace(/[:.]/g,"-"),yr=t=>f(t,"sync","incoming"),v=t=>f(t,"sync","replay"),We=t=>an(t),ln=(t,e)=>f(v(t),`${We(e)}.receipt.json`),N=t=>f(t,"sync","journal.json"),O=t=>f(t,"commits"),ne=t=>f(O(t),ke),V=(t,e)=>f(yr(t),e),He=(t,e)=>`${String(t).padStart(6,"0")}-${e.slice(7,19)}.json`,Y=t=>"sha256:"+le(t),dn=()=>({pid:process.pid,nonce:sn(4).toString("hex")});async function vs(t,e,n,r,o,i={}){if(r.kind!=="diverged"||r.at===void 0)throw new Error(`reset needs a diverged relation, got ${r.kind}`);let s=r.at;if(b(N(t)))throw new m("SYNC_STORE_BUSY","a reset is already in progress","run kane-cli context sync doctor");rn(t),$r(t,n),Sr(t);let{records:a,hashes:c}=yt(t),d={seq:s-1,hash:c[s-2]},l=Oe();_e(t,l,a.slice(0,s-1),c.slice(0,s-1),{writeNodeFiles:!1});let u=await Be(t,e,d,r.storage,l),p=a.slice(s-1).map(U=>He(U.seq,c[U.seq-1])),h=Ar(t,a,c,s),x=fn(t,p,h);kr(t,Rr(u)+x.reduce((U,_n)=>U+on(_n.src).size,0));let Qe=i.ts??wr(),oe={nonce:sn(8).toString("hex"),state:"staged",name:n,holder:dn(),base:d,at:s,storage:r.storage,backup:br(t,Qe),ts:Qe,moved:p,testIds:h,counts:{records:u.records.length,blobs:u.blobs.size,proposals:u.proposals.size},manifest:[]};Er(t,oe.nonce,u);let On=W(t,{deadlineMs:cn});try{if(C(t)?.hash!==r.local?.hash)throw new m("SYNC_STORE_BUSY","the chain moved while the reset was being prepared",`run kane-cli context pull ${n} --rebase again`);return rn(t),Ye(t,oe,i.afterTransition),un(t,oe,o,i)}catch(U){throw b(N(t))||me(V(t,oe.nonce)),U}finally{On()}}async function Es(t,e,n=()=>{}){let r={state:"none",detail:"no reset in progress"},o=nn(t);if(o===null)return r;let i=W(t,{deadlineMs:cn});try{let s=nn(t);if(s===null||s.nonce!==o.nonce)return r;if(s.holder.pid!==process.pid&&K(s.holder.pid))throw new m("SYNC_STORE_BUSY",`a reset is running as pid ${s.holder.pid} \u2014 wait`,"wait for it to finish, then run the command again");if(s.holder=dn(),Ye(t,s),e==="resume"){let l=un(t,s,n,{});return{state:"resumed",detail:`finished the reset interrupted at '${s.state}': ${l.moved.length} records moved to ${l.backup}`,result:l}}if(B(s,"imported"))return{state:"refused",detail:`the shared records are already imported, so the reset can only finish (kane-cli context sync or kane-cli context pull finishes it); its receipt will be ${ln(t,s.backup)}`};let a=Nr(t,s),c=0;for(let{name:l,hash:u}of s.manifest){if(!l.startsWith("commits/")&&!l.startsWith("intents/"))continue;let p=f(t,l);try{if(b(p)){if(Y(y(p))!==u)throw new Error("the live file does not match the backup manifest");continue}let h=y(f(s.backup,l));if(Y(h)!==u)throw new Error("the backup copy does not match the manifest");T(R(p),{recursive:!0}),$(p,h),l.startsWith("commits/")&&c++}catch(h){throw new Error(`restore stopped at ${l}: ${h instanceof Error?h.message:String(h)}; re-run abort`)}}pn(t,s.nonce),_(Ie(t),{recursive:!0,force:!0});let d=`${s.backup}.aborted`;return b(s.backup)&&ge(s.backup,d),w(R(s.backup)),_(N(t),{force:!0}),w(R(N(t))),me(d),me(V(t,s.nonce)),{state:"aborted",detail:`aborted the reset at '${s.state}': ${a} imported records removed, ${c} records put back, the chain is as it was`}}finally{i()}}function nn(t){return b(N(t))?JSON.parse(y(N(t),"utf8")):null}var B=(t,e)=>tn.indexOf(t.state)>=tn.indexOf(e);function un(t,e,n,r){let o=l=>{e.state=l,Ye(t,e,r.afterTransition)},i=()=>{if(!je(t,e.nonce))throw new Error("sentinel missing \u2014 run kane-cli context sync doctor")};B(e,"fenced")||(vr(t,e.nonce),o("fenced")),B(e,"backed-up")||(i(),e.manifest=Ir(t,e),o("backed-up")),B(e,"trimmed")||(i(),Or(t,e),o("trimmed")),B(e,"importing")||(i(),o("importing")),B(e,"imported")||(i(),_(Ie(t),{recursive:!0,force:!0}),_r(t,e,xr(t,e.nonce),r.afterChunk),o("imported")),B(e,"unfenced")||(pn(t,e.nonce),o("unfenced"));let s=X(t),a=Cr(t,e),c=It(t,gr),d=Tr(t,f(v(t),We(e.backup)),new Set(Object.keys(s.nodeLabel)));T(v(t),{recursive:!0}),$(ln(t,e.backup),JSON.stringify({from:e.at,moved:e.moved,storageTail:e.storage,quarantinedTests:a,droppedPendingFacts:d,liveSideQueues:c},null,2)+`
4
+ `),w(v(t)),_(N(t),{force:!0}),w(R(N(t))),me(V(t,e.nonce)),Je(t,e.name,e.storage,{lockHeld:!0}),n(`saved ${e.moved.length} local record${e.moved.length===1?"":"s"} from position ${e.at} in ${e.backup}; ${e.name}'s records took their place`);for(let l of a)n(`quarantined test file ${l}: its test was minted by a moved record`);return{name:e.name,backup:e.backup,moved:e.moved,quarantinedTests:a,pulled:{imported:e.counts.records,from:e.base.seq,to:e.storage.seq,blobs:e.counts.blobs,proposals:e.counts.proposals}}}function rn(t){let e=new Date,n=f(t,"sessions");if(b(n))for(let r of j(n)){let o=f(n,r,".lock");if(!b(o))continue;let i;try{i=JSON.parse(y(o,"utf8"))}catch{continue}let s=e.getTime()-new Date(i.ts??0).getTime();if(typeof i.pid=="number"&&K(i.pid)&&s<rt)throw new m("SYNC_STORE_BUSY",`session ${r} is live (pid ${i.pid})`,"finish or pause that session, then run the reset again")}for(let{key:r,grant:o}of pt(t))if(!ut(o,e))throw new m("SYNC_STORE_BUSY",`lock ${r} is held by ${o.verb} (pid ${o.pid})`,"wait for that command to finish, then run the reset again")}function Sr(t){let e=gn(t);if(!e)return;let n=e.listHolds().length;throw new m("SYNC_REBASE_PENDING",`your last rebase still has ${n} unresolved decision${n===1?"":"s"}; no new rebase was started`,"run kane-cli context sync or kane-cli context pull again to continue. To discard the unresolved local changes instead, run kane-cli context sync doctor --abort")}function $r(t,e){let n=F(t).entries[e]?.binding,r=ot(t),o=ur(t),i=on(t),s=r!==null&&n?.instance_id===r.context_instance_id&&n.realpath===o;if(!(s&&n.dev===i.dev&&n.ino===i.ino))throw new m("SYNC_COPIED_STORE_UNRESOLVED",r===null?"this store has no store.json ids, so it cannot prove it is the one the location was added from":s?`this store's directory is not the one ${e} was bound from: same ids and path, but the .context inode changed \u2014 it was replaced in place by a copy`:`this store is not the one ${e} was added from (${n?`bound to ${n.realpath}`:"no binding"}; this is ${o})`,`re-run kane-cli context sync add ${e} <descriptor> from this directory to bind it`)}function kr(t,e){let n=pr(t),r=n.bavail*n.bsize;if(!(r>=2*e))throw new m("SYNC_DISK_LOW",`${r} bytes free, the reset needs ${2*e} (twice the staged suffix plus the backup)`,"free some disk space, then run the reset again")}function Rr(t){let e=0;for(let n of t.records)e+=Buffer.byteLength(n.raw);for(let n of t.proposals.values())e+=n.length;return e}function Ye(t,e,n){T(R(N(t)),{recursive:!0}),$(N(t),JSON.stringify(e,null,2)+`
5
+ `),n?.(e.state)}function vr(t,e){let n=ne(t);try{let r=lr(n,"wx");try{fr(r,wt(e)),ae(r)}finally{cr(r)}w(O(t))}catch(r){if(r.code!=="EEXIST")throw r;if(!je(t,e))throw new Error(`${n} belongs to another reset \u2014 run kane-cli context sync doctor`)}}function pn(t,e){if(b(ne(t))){if(!je(t,e))throw new Error(`${ne(t)} belongs to another reset \u2014 left in place`);_(ne(t)),w(O(t))}}function je(t,e){try{return JSON.parse(y(ne(t),"utf8")).kane?.nonce===e}catch{return!1}}function Er(t,e,n){let r=V(t,e);for(let o of["records","proposals"])T(f(r,o),{recursive:!0});for(let o of n.records)$(f(r,"records",`${o.seq}.json`),o.raw);for(let[o,i]of n.proposals)T(R(f(r,"proposals",o)),{recursive:!0}),$(f(r,"proposals",o),i)}function xr(t,e){let n=V(t,e),r=j(f(n,"records")).map(i=>Number(i.slice(0,-5))).sort((i,s)=>i-s).map(i=>{let s=y(f(n,"records",`${i}.json`),"utf8"),a=JSON.parse(s);return{seq:i,raw:s,record:a,hash:L(a)}}),o=new Map;for(let i of Ve(f(n,"proposals")))o.set(Me(f(n,"proposals"),i),y(i));return{records:r,blobs:new Set,proposals:o}}function me(t){_(t,{recursive:!0,force:!0});try{dr(R(t))}catch{}}function fn(t,e,n){let r=[],o=a=>{r.push({name:a,src:f(t,a)})},i=[];for(let a of e){o(`commits/${a}`);let c=JSON.parse(y(f(O(t),a),"utf8"));i.push(c);let d=dt(t,L(c));b(d)&&o(Me(t,d))}let s=f(t,"sessions");if(b(s))for(let a of Ve(s))o(Me(t,a));for(let a of hr)b(f(t,a))&&o(a);for(let a of j(t))xt.test(a)&&o(a);for(let a of i){let c=Q(a).proposalId;c!==null&&b(Z(t,c))&&o(`proposals/${c}/proposal.json`)}for(let a of mn(t,n))r.push({name:`tests/${an(a)}`,src:a});return r}function Ve(t){let e=[];for(let n of j(t,{withFileTypes:!0})){let r=f(t,n.name);n.isDirectory()?e.push(...Ve(r)):n.isFile()&&e.push(r)}return e}function Ir(t,e){let n=f(e.backup,"manifest.json");if(b(n))return JSON.parse(y(n,"utf8"));let r=[];T(e.backup,{recursive:!0}),w(R(e.backup)),w(R(R(e.backup)));let o=(i,s)=>{let a=f(e.backup,i);T(R(a),{recursive:!0}),$(a,s),r.push({name:i,hash:Y(s)})};for(let{name:i,src:s}of fn(t,e.moved,e.testIds??[]))o(i,y(s));return o("base-witness.json",Buffer.from(JSON.stringify({name:e.name,base:e.base,storage:e.storage,from:e.at},null,2)+`
6
+ `)),$(f(e.backup,"manifest.json"),JSON.stringify(r,null,2)+`
7
+ `),r}function Or(t,e){if(!b(f(O(t),He(e.base.seq,e.base.hash))))throw new Error(`the record at position ${e.base.seq} is not the one the reset was planned on \u2014 nothing removed; run kane-cli context sync doctor`);let n=e.manifest.filter(r=>r.name.startsWith("commits/")).sort((r,o)=>r.name<o.name?1:-1);for(let{name:r,hash:o}of n){let i=f(t,r);if(b(i)){if(Y(y(i))!==o)throw new Error(`${i} does not match the backup manifest \u2014 not removed; run kane-cli context sync doctor`);_(i)}}w(O(t));for(let{name:r}of e.manifest)r.startsWith("intents/")&&_(f(t,r),{force:!0})}function hn(t,e){return j(O(t)).filter(n=>mr.test(n)&&n!==ke&&Number(n.slice(0,6))>e.base.seq).sort()}function _r(t,e,n,r){let o=hn(t,e).at(-1),i=e.base;if(o!==void 0){let s=n.records.find(a=>o===He(a.seq,a.hash));if(!s)throw new Error(`commits/${o} is neither the base nor a staged record \u2014 run kane-cli context sync doctor`);i={seq:s.seq,hash:s.hash}}Ue(t,{...n,records:n.records.filter(s=>s.seq>i.seq)},i.hash,e.name,{lockHeld:!0,underReset:{nonce:e.nonce},afterChunk:r})}function Nr(t,e){let n=new Map(e.manifest.filter(s=>s.name.startsWith("commits/")).map(s=>[s.name.slice(8),s.hash])),r=f(V(t,e.nonce),"records"),o=new Set(b(r)?j(r).map(s=>Y(y(f(r,s)))):[]),i=[];for(let s of hn(t,e)){let a=Y(y(f(O(t),s)));if(n.get(s)!==a){if(!o.has(a))throw new Error(`commits/${s} is neither an original of this store nor a staged record \u2014 nothing changed; ask for help before touching commits/`);i.push(s)}}for(let s of i.reverse())_(f(O(t),s));return i.length>0&&w(O(t)),i.length}function Ar(t,e,n,r){let o=new Set;for(let a of e.slice(r-1))for(let c of a.nodes)c.label==="test"&&o.add(c.cid);if(o.size===0)return[];let i=Oe();_e(t,i,e,n,{writeNodeFiles:!1});let s=a=>{let c=new Set;for(let d=a;;){let l=i.superseded[d];if(typeof l!="string"||c.has(l))return d;c.add(l),d=l}};return Object.entries(i.names).filter(([,a])=>o.has(s(a))).map(([a])=>a).sort()}function mn(t,e){if(e.length===0)return[];let n=Ft(Pt(R(t)));return e.flatMap(r=>n.get(r)??[])}function Cr(t,e){let n=[];for(let r of mn(t,e.testIds??[]))b(r)&&(ge(r,`${r}.quarantined-${e.ts}`),n.push(r));return n}function xs(t,e,n,r){let o=`${f(v(t),We(e))}.pending-facts.dropped.ndjson`;if(!b(o))return{reparked:0,unmapped:[]};let i=[],s=[];for(let a of y(o,"utf8").split(`
8
+ `).filter(c=>c!=="")){let c;try{c=JSON.parse(a)}catch{continue}let d=(c.facts??[]).flatMap(l=>{let u=l.about_cid?n.get(l.about_cid)??l.about_cid:l.about_cid;if(!u||!r.has(u))return l.about_cid&&s.push(l.about_cid),[];let p=l.per_ac?.map(h=>h.ac_cid?{...h,ac_cid:n.get(h.ac_cid)??h.ac_cid}:h);return[{...l,about_cid:u,...p?{per_ac:p}:{}}]});d.length>0&&i.push(JSON.stringify({...c,facts:d}))}return i.length>0&&he(f(t,"pending-facts.ndjson"),i.join(`
9
+ `)+`
10
+ `),ge(o,o.replace(/\.dropped\.ndjson$/,".reparked.ndjson")),{reparked:i.reduce((a,c)=>a+JSON.parse(c).facts.length,0),unmapped:s}}function Tr(t,e,n){let r=f(t,"pending-facts.ndjson"),o=`${e}.pending-facts.rotated.ndjson`;if(!b(o)){if(!b(r))return 0;T(R(e),{recursive:!0}),ge(r,o)}let i=[],s=[],a=y(o,"utf8").split(`
11
+ `).filter(d=>d!=="");for(let d of a){let l;try{l=JSON.parse(d)}catch{s.push(d);continue}let u=l.facts??[],p=u.filter(h=>h.about_cid!==void 0&&h.about_cid!==""&&!n.has(h.about_cid));p.length===0?s.push(d):p.length===u.length?i.push(d):(i.push(JSON.stringify({...l,facts:p})),s.push(JSON.stringify({...l,facts:u.filter(h=>!p.includes(h))})))}i.length>0&&he(`${e}.pending-facts.dropped.ndjson`,i.join(`
12
+ `)+`
13
+ `),s.length>0&&he(r,s.join(`
14
+ `)+`
15
+ `);let c=y(o,"utf8").split(`
16
+ `).filter(d=>d!=="").slice(a.length);return c.length>0&&he(r,c.join(`
17
+ `)+`
18
+ `),_(o),i.length}var qr=/^sha256:[0-9a-f]{64}$/,Ge=class t{m=new Map;get size(){return this.m.size}set(e,n){this.m.set(e,n)}get(e){return this.m.get(e)}rewrite(e){if(typeof e=="string")return qr.test(e)?this.m.get(e)??e:e;if(Array.isArray(e))return e.map(n=>this.rewrite(n));if(e!==null&&typeof e=="object"){let n={};for(let[r,o]of Object.entries(e))n[r]=this.rewrite(o);return n}return e}toJSON(){return Object.fromEntries(this.m)}static fromJSON(e){let n=new t;for(let[r,o]of Object.entries(e??{}))n.set(r,o);return n}},De=class t{m=new Map;set(e,n){this.m.set(e.hash,{orig:e,fate:n})}get(e){let n=this.m.get(e.hash);return n&&n.orig.seq===e.seq?n.fate:void 0}byHash(e){return this.m.get(e)?.fate}toJSON(){return[...this.m.values()]}static fromJSON(e){let n=new t;for(let r of e??[])n.set(r.orig,r.fate);return n}},bn=t=>({cid:t.cid.toJSON(),record:t.record.toJSON()}),wn=t=>({cid:Ge.fromJSON(t?.cid),record:De.fromJSON(t?.record)});var Ps=["keep-theirs","apply-mine","apply-mine-as-new"];function Ke(t,e,n){switch(e){case"keep-theirs":return t==="generation"?"the local design stays in the backup; after this rebase, run design again if you want both":"the local change stays in the backup";case"apply-mine":return t==="slug"?`the name moves to the local node; the node that holds it on ${n} is reached by its id again`:t==="head"?`retire the source as it is now, ${n}'s version included`:`the local version lands on top of ${n}'s`;case"apply-mine-as-new":return`a new node beside ${n}'s (duplicate check first)`;case"later":return"leaves the rebase open; kane-cli context sync or kane-cli context pull asks again"}}function Fs(t,e,n){return{rebase_id:t,decision_id:e.holdId,kind:e.kind,intent:e.verb,seq:e.orig.seq,label:e.label,location:n,mine:e.mine,theirs:e.theirs,answers:e.answers.map(r=>({answer:r,consequence:Ke(e.kind,r,n)}))}}function Js(t){return{from:(n,r)=>{let o=n===0?null:t.tokenAt(n);if(n>0&&o===null)throw new S(`the record log holds no record at position ${n} \u2014 run kane-cli context rebuild`);let i=t.recordsSince(o);if(i.length>0&&o!==null&&t.resolveToken(o)?.hash!==r)throw new S(`broken chain after position ${n}: it no longer continues ${String(r)}`);return{records:i,hashes:i.map(L)}},hashAt:n=>{let r=t.tokenAt(n);return r===null?null:t.resolveToken(r)?.hash??null}}}var Bs=t=>t.dirOrThrow(),be=(t,e)=>ze(v(t),`${e}.json`),Ur=(t,e)=>ze(v(t),`${e}.lock`),G=class t{constructor(e,n){this.contextDir=e;this.data=n;this.maps=wn(n.maps)}maps;static create(e,n,r,o,i){let s=Br(n);if(re(be(e,s)))throw new S(`rebase ${s} already has a ledger \u2014 run kane-cli context sync or kane-cli context pull to continue it, or kane-cli context sync doctor --abort to close it`);let a=new t(e,{version:1,backup:n,backupId:s,from:o,state:"open",...i?{location:i}:{},items:r.map(d=>({...d})),maps:{cid:{},record:[]},aliases:[]}),c=!re(v(e));return Sn(v(e),{recursive:!0}),c&&w(ze(e,"sync")),a.save(),a}static open(e,n){let r=be(e,n);if(!re(r))throw new S(`no rebase ${n} here \u2014 kane-cli context sync doctor lists the rebases this store has`);let o;try{o=JSON.parse(we(r,"utf8"))}catch{o=null}if(!ht(o)||typeof o.backup!="string")throw new S(Hr(n));return new t(e,o)}get backupId(){return this.data.backupId}get location(){return this.data.location??"the location"}get rev(){return this.data.rev??0}get backup(){return this.data.backup}get from(){return this.data.from}get state(){return this.data.state}get closedBy(){return this.data.closedBy}get items(){return this.data.items}get aliases(){return this.data.aliases}item(e){let n=this.data.items.find(r=>r.k===e);if(!n)throw new Error(`no replay item ${e}`);return n}itemAt(e){return this.data.items.find(n=>n.orig.seq===e||n.group?.some(r=>r.seq===e))}beginItem(e,n){this.assertOpen();let r=this.item(e);r.begin={expectPrev:n},delete r.outcome,this.save()}endItem(e,n){this.assertOpen(),this.item(e).outcome=n,this.save()}pendingItem(){return this.data.items.find(e=>e.begin!==void 0&&e.outcome===void 0)}reconcileAll(e,n){let r=this.item(e);if(!r.begin)return[];let o=r.origins??Object.fromEntries((r.group??[r.orig]).map(c=>[c.hash,c.seq])),{records:i,hashes:s}=n.from(r.begin.expectPrev.seq,r.begin.expectPrev.hash),a=[];return i.forEach((c,d)=>{let l=c.replayed_from===void 0?void 0:o[c.replayed_from.orig.hash];l!==void 0&&a.push({seq:c.seq,hash:s[d],member:l})}),a}reconcileFrom(e,n,r){let o=this.item(e),i=o.origins??Object.fromEntries((o.group??[o.orig]).map(d=>[d.hash,d.seq])),{records:s,hashes:a}=n.from(r.seq,r.hash),c=[];return s.forEach((d,l)=>{let u=d.replayed_from===void 0?void 0:i[d.replayed_from.orig.hash];u!==void 0&&c.push({seq:d.seq,hash:a[l],member:u})}),c}reconcile(e,n){let r=this.reconcileAll(e,n).at(-1);return r?{seq:r.seq,hash:r.hash}:void 0}lastAppliedInChain(e){for(let n of[...this.data.items].reverse()){let r=n.outcome;if(r&&"applied"in r)return e.hashAt(r.applied.newSeq)===r.applied.newHash;if(r&&"deduped"in r&&r.deduped.newSeq!==void 0)return e.hashAt(r.deduped.newSeq)===r.deduped.newHash}return!0}setMaps(e){this.maps=e,this.data.maps=bn(e),this.save()}addAlias(e){this.data.aliases.push(e),this.save()}listHolds(){return this.data.items.flatMap(e=>e.outcome&&"held"in e.outcome?[e.outcome.held]:[])}resolveHold(e,n){let r=this.heldItem(e);if(!r.outcome.held.answers.includes(n))throw new S(`${n} is not an answer ${e} accepts`);return r.answer=n,this.reopen(r)}reopenHold(e){let n=this.heldItem(e);return delete n.answer,this.reopen(n)}heldItem(e){this.assertOpen();let n=this.data.items.find(r=>r.outcome&&"held"in r.outcome&&r.outcome.held.holdId===e);if(!n)throw new S(`${e} is not an open decision \u2014 kane-cli context sync status lists them`);return n}reopen(e){return delete e.outcome,delete e.begin,this.save(),e}close(e){this.data.state="closed",this.data.closedBy=e,this.save()}toJSON(){return structuredClone(this.data)}assertOpen(){if(this.data.state!=="open")throw new S(`rebase ${this.data.backupId} is closed \u2014 kane-cli context sync doctor lists every rebase and what it reapplied`)}save(){let e=be(this.contextDir,this.data.backupId);if(re(e)){let n=0;try{n=JSON.parse(we(e,"utf8")).rev??0}catch{n=0}if(n>(this.data.rev??0))throw new S(`the replay ledger for ${this.data.backupId} changed on disk (rev ${n}, this process holds rev ${this.data.rev??0}) \u2014 another process is working on it; run the command again`)}this.data.rev=(this.data.rev??0)+1,$(e,JSON.stringify(this.data,null,2)+`
19
+ `)}};function Mr(t,e){let n=Ur(t,e);Sn(v(t),{recursive:!0});let r=Jr(6).toString("hex");for(;;)try{return Pr(n,JSON.stringify({pid:process.pid,nonce:r}),{flag:"wx"}),()=>{try{JSON.parse(we(n,"utf8")).nonce===r&&yn(n)}catch{}}}catch(o){if(o.code!=="EEXIST")throw o;let i={};try{i=JSON.parse(we(n,"utf8"))}catch{i={}}if(typeof i.pid=="number"&&K(i.pid))throw new S(`rebase ${e} is being worked on by pid ${i.pid} \u2014 wait for it to finish`);yn(n,{force:!0})}}var Us=(t,e,n,r,o)=>G.create(t,e,n,r,o),Wr=(t,e)=>G.open(t,e),Hr=t=>`rebase ${t} has a ledger this store cannot read (sync/replay/${t}.json) \u2014 ${ft}`,$n=t=>{let e=v(t);return re(e)?Lr(e).filter(n=>n.endsWith(".json")&&!n.endsWith(".receipt.json")).sort().reverse().map(n=>n.slice(0,-5)):[]};function Yr(t,e={}){let n=[];for(let r of $n(t))try{n.push(G.open(t,r))}catch(o){if(!e.tolerant)throw o}return n}function Ms(t){return $n(t).filter(e=>{try{return G.open(t,e),!1}catch{return!0}})}function Ws(t,e){let n=be(t,e),r=`${n}.unreadable`;return Fr(n,r),w(v(t)),r}function gn(t){return Yr(t).find(e=>e.state==="open")}function jr(t){let e=t.outcome;return e?"applied"in e?`reapplied \u2192 record ${e.applied.newSeq}`:"held"in e?`decision ${e.held.holdId} (${e.held.kind})`:"deduped"in e?`already present: ${e.deduped.as.slice(0,19)}`:`not reapplied: ${e.skipped.reason}`:t.begin?"pending":"waiting"}function Hs(t,e,n={}){let r=t.itemAt(e);if(!r)throw new S(`no moved record at position ${e} in rebase ${t.backupId}`);let o=r.label.startsWith(`${r.verb} `)||r.label===r.verb?r.label:`${r.verb} ${r.label}`,i=[`record ${r.orig.seq}: ${o}`,`origin ${r.orig.hash}`,`outcome: ${jr(r)}`];if(r.group&&i.push(`group: records ${r.group.map(s=>s.seq).join(", ")}`),r.outcome&&"held"in r.outcome){let s=r.outcome.held,a=Math.max(5,t.location.length)+1;i.push(`${"local:".padEnd(a+1)}${s.mine}`,`${`${t.location}:`.padEnd(a+1)}${s.theirs}`,`choose: ${s.answers.join(", ")}`),n.detail!==!1&&i.push(JSON.stringify(s.detail,null,2))}return i}function Ys(t,e){let n=Mr(t,e);try{let r=Wr(t,e);return r.state==="open"&&r.close("abort"),r}finally{n()}}var g=z(ie(),1);function kn(t,e,n){let r={"keep-theirs":`keep ${n}'s version`,"apply-mine":"apply the local version","apply-mine-as-new":"add the local version as new",later:"decide later"},o=t.answers.map(i=>({key:i,answer:i,label:r[i],detail:e(i)}));return o.push({key:"later",answer:"later",label:r.later,detail:e("later")}),o}function Rn({card:t,index:e,total:n,rebaseId:r,location:o,diff:i,rows:s,sel:a,focused:c,expanded:d}){let l=Math.max(...(i??[]).map(u=>Math.max(u.was.length,u.local.length,u.origin.length)),8);return(0,g.jsxs)(M,{flexDirection:"column",children:[(0,g.jsxs)(k,{bold:!0,children:[`decision ${e} of ${n}`,(0,g.jsx)(k,{color:A.dim,children:` \xB7 ${t.kind} on your ${t.verb} from record ${t.orig.seq}`})]}),i&&i.length>0?(0,g.jsxs)(M,{flexDirection:"column",children:[(0,g.jsx)(k,{color:A.dim,children:` ${"".padEnd(12)}${"was".padEnd(l+2)}${"local".padEnd(l+2)}${o}`}),i.map(u=>(0,g.jsxs)(k,{children:[(0,g.jsx)(k,{color:A.dim,children:` ${u.field.padEnd(12)}`}),u.was.padEnd(l+2),(0,g.jsx)(k,{color:A.assuranceAccent,children:u.local.padEnd(l+2)}),u.origin]},u.field))]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(P,{label:"local",text:t.mine,accent:!0}),(0,g.jsx)(P,{label:o,text:t.theirs})]}),d?d.map((u,p)=>(0,g.jsx)(k,{color:A.dim,children:` ${u}`},`x-${p}`)):null,(0,g.jsx)(Le,{headline:`what should happen to the local ${t.verb} from record ${t.orig.seq}`,ask:!0,rows:s,sel:a,focused:c}),(0,g.jsx)(k,{color:A.dim,children:" \u2191\u2193 select \xB7 \u23CE confirm \xB7 1\u20139 jump \xB7 v full record \xB7 a decide everything later \xB7 ctrl+c pause"})]})}function vn({name:t,count:e,from:n,backupPath:r,taking:o,sel:i,focused:s}){let a=[{key:"continue",label:"continue",detail:"save, take, reapply"},{key:"not-now",label:"not now",detail:"nothing changes"}];return(0,g.jsxs)(M,{flexDirection:"column",children:[(0,g.jsx)(k,{bold:!0,children:`rebase from ${t}`}),(0,g.jsx)(P,{label:"local",text:`${e} record${e===1?"":"s"} from position ${n} saved to ${r}`}),(0,g.jsx)(P,{label:t,text:`records ${o.from}..${o.to} taken into this store`}),(0,g.jsx)(P,{label:"then",text:"the local records reapplied on top; a disagreement becomes a decision you answer"}),(0,g.jsx)(P,{label:"never",text:`history on ${t} rewritten`}),(0,g.jsx)(Le,{headline:"continue",ask:!0,rows:a,sel:i,focused:s}),(0,g.jsx)(k,{color:A.dim,children:" \u2191\u2193 select \xB7 \u23CE confirm \xB7 esc not now"})]})}var E=z(ie(),1);function Vr(t){let e=t.detail,n=c=>c&&typeof c=="object"&&!Array.isArray(c)?c:null,r=n(e.was),o=n(e.mine),i=n(e.theirs);if(!r||!o||!i)return[];let s=c=>c==null?"":typeof c=="string"?c:JSON.stringify(c);return[...new Set([...Object.keys(r),...Object.keys(o),...Object.keys(i)])].filter(c=>s(o[c])!==s(r[c])||s(i[c])!==s(r[c])).map(c=>({field:c,was:s(r[c]),local:s(o[c]),origin:s(i[c])}))}function oi(t,e,n,r){let o={"keep-theirs":`kept ${n}'s version`,"apply-mine":"applied the local version","apply-mine-as-new":"added the local version as new",later:"decided later","later-all":"decided later"},i=r&&"deduped"in r?`already present on ${n}`:r&&"skipped"in r&&e!=="keep-theirs"?`not reapplied (${r.skipped.reason})`:o[e];return`decision ${t.holdId}: ${i}`}var Xe=class{screen={kind:"idle"};version=0;interrupted=!1;scrollback={current:null};listeners=new Set;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));set(e){this.screen=e,this.emit()}note(e){this.scrollback.current?.append((0,E.jsx)(k,{children:e}))}flush(){return this.scrollback.current?.flush()??Promise.resolve()}emit(){this.version+=1;for(let e of this.listeners)e()}};function Gr(t){return(0,D.useSyncExternalStore)(t.subscribe,()=>t.version),t.screen}function Dr({ask:t,rows:e,done:n}){let[r,o]=(0,D.useState)(0),[i,s]=(0,D.useState)(!1);se((c,d)=>{if(d.ctrl&&c==="c")return n("later-all");if(d.escape)return n("later");if(c==="a")return n("later-all");if(c==="v")return s(u=>!u);if(d.upArrow)return o(u=>Math.max(0,u-1));if(d.downArrow)return o(u=>Math.min(e.length-1,u+1));if(d.return)return n(e[r].answer);let l=Number(c);Number.isInteger(l)&&l>=1&&l<=e.length&&o(l-1)});let a=Vr(t.card);return(0,E.jsx)(Rn,{card:t.card,index:t.index,total:t.total,rebaseId:t.rebaseId,location:t.location,diff:a,rows:e,sel:r,focused:!0,expanded:i?t.record:void 0})}function zr({ask:t,done:e}){let[n,r]=(0,D.useState)(0);return se((o,i)=>{if(i.ctrl&&o==="c"||i.escape)return e(!1);if(i.upArrow)return r(0);if(i.downArrow)return r(1);if(o==="1")return r(0);if(o==="2")return r(1);if(i.return)return e(n===0)}),(0,E.jsx)(vn,{...t,sel:n,focused:!0})}function Kr({store:t}){return se((e,n)=>{n.ctrl&&e==="c"&&(t.interrupted=!0)}),null}function Xr({store:t}){let e=Gr(t);return e.kind==="decide"?(0,E.jsx)(Dr,{ask:e.ask,rows:e.rows,done:e.done},e.ask.card.holdId):e.kind==="confirm"?(0,E.jsx)(zr,{ask:e.ask,done:e.done}):(0,E.jsx)(Kr,{store:t})}function Zr({store:t}){return(0,E.jsxs)(et,{children:[(0,E.jsx)(_t,{into:t.scrollback}),(0,E.jsx)(M,{flexDirection:"column",children:(0,E.jsx)(Xr,{store:t})})]})}function Qr(t,e){return kn(t,n=>Ke(t.kind,n,e),e)}function En(){let t=new Xe,e=null,n=async()=>{if(e)return;let{render:o}=await import("./build-5ZN47FAT.js");e=o((0,E.jsx)(Zr,{store:t}),{exitOnCtrlC:!1}),tt(()=>e?.unmount())},r=async()=>{if(!e)return;let o=e;e=null,await t.flush();let i=o.waitUntilExit().catch(()=>{});o.unmount(),await i,nt()};return{async confirm(o){await n();let i=await new Promise(s=>t.set({kind:"confirm",ask:o,done:s}));return t.set({kind:"idle"}),await r(),i},async decide(o){await n();let i=await new Promise(s=>t.set({kind:"decide",ask:o,rows:Qr(o.card,o.location),done:s}));return t.set({kind:"idle"}),i},note(o){t.note(o)},close:r,interrupted:()=>t.interrupted}}import{resolve as eo}from"path";import{fileURLToPath as to,pathToFileURL as no}from"url";var ro="us-east-1",oo=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,$e="use file:///abs/path, an absolute or relative directory path, s3://<bucket>/<prefix>?endpoint=<url>&region=<region>, or a GitHub HTTPS/SSH repository URL";function In(t,e){let n=t.trim();if(n==="")throw new Error(`a location is required \u2014 ${$e}`);if(/^(?:git\+)?https:\/\//i.test(n)||/^(?:git\+)?ssh:\/\//i.test(n)||/^[^/\s@:]+@[^/\s:]+:/.test(n)||n.startsWith("git+scp://"))return ao(n);if(!oo.test(n))return xn(eo(e,n));let r=new URL(n);switch(r.protocol){case"fake:":if(r.hostname==="")throw new Error(`fake:// needs a name \u2014 ${$e}`);return{kind:"fake",location:`fake://${r.hostname}`};case"file:":return xn(to(r));case"s3:":return so(r);default:throw new Error(`this release does not speak "${r.protocol}" \u2014 ${$e}`)}}function xn(t){return{kind:"dir",location:no(t).href,path:t}}function so(t){let e=t.hostname;if(e==="")throw new Error(`an s3 location needs a bucket \u2014 ${$e}`);let n=t.pathname.replace(/^\/+/,"").replace(/\/+$/,""),r=n===""?"":`${n}/`,o=t.searchParams.get("region")||ro;if(!/^[A-Za-z0-9-]{1,64}$/.test(o))throw new Error("the region must be letters, digits and dashes only, like us-east-1");let i=t.searchParams.get("endpoint"),s=i===null||i===""?null:io(i),a=s===null?`?region=${o}`:`?endpoint=${s}&region=${o}`,c={kind:"s3",location:`s3://${e}/${r}${a}`,bucket:e,prefix:r,region:o};return s!==null&&(c.endpoint=s),c}function io(t){let e="the endpoint must be an http URL like http://127.0.0.1:9000",n;try{n=new URL(t)}catch{throw new Error(e)}if(n.protocol!=="http:"&&n.protocol!=="https:")throw new Error(e);if(n.username||n.password)throw new Error("an endpoint never carries a user name or password; pass credentials with --credential-env or --credential-file");if(n.search!==""||n.hash!==""||n.pathname!=="/")throw new Error(`the endpoint must be a host and port only, with no path or query \u2014 got ${n.origin}`);return`${n.protocol}//${n.host}`}var ye="Use a Git repository address with no dot or parent segments";function Se(t){return t.split("/").some(e=>e==="."||e==="..")}function ao(t){if(/[\x00-\x20\x7f]/.test(t))throw new Error("A Git location cannot contain whitespace or control characters");let e=t;if(e.startsWith("git+scp://")){let p=e.slice(10).replace(/[?#].*$/,"").replace(/^[^/]*/,"");if(Se(p.slice(1)))throw new Error(ye);let h=new URL(e);e=`${decodeURIComponent(h.username)}@${h.hostname}:${h.pathname.slice(1)}${h.search}${h.hash}`}else e=e.replace(/^git\+/,"");let n=e.indexOf("#"),r=n<0?"main":decodeURIComponent(e.slice(n+1)),o=n<0?e:e.slice(0,n),i=o.indexOf("?"),s=i<0?o:o.slice(0,i),a=new URLSearchParams(i<0?"":o.slice(i+1));for(let p of a.keys())if(p!=="prefix")throw new Error("https: and ssh: Git locations accept only the prefix query option; never put credentials in a location");if(a.getAll("prefix").length>1)throw new Error("Only one Git prefix may be supplied");let c=a.get("prefix")??"";if(c&&(!/^[a-zA-Z0-9_~./-]+$/.test(c)||c.split("/").some(p=>!p||p==="."||p===".."||p.toLowerCase()===".git")))throw new Error("Use a relative Git prefix with no empty, dot or parent segments");if(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(r)||r.includes("..")||r.includes("//")||r.endsWith(".")||r.split("/").some(p=>!p||p.startsWith(".")||p.endsWith(".lock")))throw new Error("Use a valid Git branch name");let d=/^([^/@:]+)@([^/:]+):(.+)$/.exec(s),l;if(d){if(!/^[A-Za-z0-9._-]+$/.test(d[1])||!/^[A-Za-z0-9.-]+$/.test(d[2])||!/^[A-Za-z0-9_~./-]+$/.test(d[3]))throw new Error("Use a valid SSH repository address");if(Se(d[3]))throw new Error(ye);l=`git+scp://${d[1]}@${d[2]}/${d[3]}`}else{if(Se(s.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^/]*/,"")))throw new Error(ye);let p=new URL(s);if(!["https:","ssh:"].includes(p.protocol)||!p.hostname||!p.pathname||p.pathname==="/"||p.password||p.protocol==="https:"&&p.username)throw new Error("Use a secret-free HTTPS or SSH repository URL; sign in through Git instead");if(/%(?:00|0a|0d)/i.test(p.pathname))throw new Error("Invalid repository path");if(Se(p.pathname))throw new Error(ye);s=p.href,l=`git+${p.href}`}let u=c?`?${new URLSearchParams({prefix:c})}`:"";return{kind:"git",gitUrl:s,branch:r,prefix:c,location:`${l}${u}#${encodeURIComponent(r)}`}}function ci(t){if(t.kind==="dir")return t.path;if(t.kind!=="git")return t.location;let e=t.prefix?`?${new URLSearchParams({prefix:t.prefix})}`:"",n=t.branch&&t.branch!=="main"?`#${encodeURIComponent(t.branch)}`:"";return`${t.gitUrl}${e}${n}`}function Ze(t,e){(t.err??t.out)(`error: ${e}`)}function Si(t,e){let n=Rt(t);return co(n)?n:(Ze(e,"no context store here (run `kane-cli context ingest <files>` first)"),null)}async function $i(t,e,n){return n?!0:t.isTTY?t.confirm(`${e}?`):(Ze(t,`refusing to ${e} without --yes (no TTY to confirm)`),!1)}function ki(){return{out:t=>process.stdout.write(t+`
20
+ `),err:t=>process.stderr.write(t+`
21
+ `),isTTY:Ot(),walkUI:En,confirm:async t=>{let{createInterface:e}=await import("readline/promises"),n=e({input:process.stdin,output:process.stdout});try{let r=await n.question(`${t} [y/N] `);return/^y(es)?$/i.test(r.trim())}catch(r){if(r.name==="AbortError")return!1;throw r}finally{n.close()}},ask:async t=>{let{createInterface:e}=await import("readline/promises"),n=e({input:process.stdin,output:process.stdout});try{return await n.question(t)}finally{n.close()}}}}var lo=1500;function uo(t,e){return t==="behind"?`${e} has moved past this machine \u2014 run kane-cli context pull ${e}`:`this store and ${e} have diverged \u2014 run kane-cli context pull ${e} --rebase`}async function Ri(t,e,n){let r=await po(t,n);r&&e(r.text)}async function po(t,e){if(process.env.KANE_SYNC_GUARD==="0")return null;try{let n=Ut(t);if(n.locations.length===0)return null;let r=Wt(n),o=F(t).entries[r.name]?.witness;if(!o)return null;let{openProvider:i}=await import("./open-provider-OZAG6WZS.js"),s=i(In(r.location,t),r.name,e),a=await Promise.race([fo(t,s,o),ho()]);return a?{text:uo(a.kind,r.name),name:r.name,localSeq:a.localSeq,storageSeq:a.storageSeq}:null}catch{return null}}function vi(t){return{type:"sync_behind",name:t.name,local_seq:t.localSeq,storage_seq:t.storageSeq,text:t.text}}async function fo(t,e,n){try{let r=C(t),o=r?.seq??0;return await e.head(I(n.seq+1))?{kind:"behind",localSeq:o,storageSeq:(await J(e,n.seq+1)).seq}:r===null||(await te(e,r.seq)).hash===r.hash?null:{kind:"diverged",localSeq:o,storageSeq:(await J(e,r.seq)).seq}}catch{return null}}function ho(){return new Promise(t=>{setTimeout(()=>t(null),lo).unref()})}function mo(t){try{return gt(t),null}catch(e){if(e instanceof mt)return{code:e.code,text:e.message,remedy:e.remedy};throw e}}function Ei(t){return{type:"sync_error",code:t.code,detail:t.text,remedy:t.remedy}}function xi(t,e){let n=mo(t);return n?(Ze(e,n.text),(e.err??e.out)(`next: ${n.remedy}`),!0):!1}export{Q as a,Pe as b,Ut as c,$o as d,F as e,Mt as f,Wt as g,ko as h,te as i,J as j,zt as k,rs as l,Je as m,br as n,wr as o,yr as p,v as q,We as r,ln as s,vs as t,Es as u,nn as v,xs as w,Ps as x,Fs as y,Js as z,Bs as A,Mr as B,Us as C,Wr as D,Yr as E,Ms as F,Ws as G,gn as H,Hs as I,Ys as J,oi as K,In as L,ci as M,Ze as N,Si as O,$i as P,ki as Q,Ri as R,po as S,vi as T,mo as U,Ei as V,xi as W};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as g}from"./chunk-W7FLXW6Q.js";import{g as d}from"./chunk-D756UWY2.js";import{a as c}from"./chunk-3GXN6VF6.js";var p=["grounding","acs","scenarios","wiring","tests"];function P(i){let t=p.filter(e=>e!=="grounding"),n=0;for(let e of i)n=Math.max(n,t.indexOf(e)+1);return n}var x={acs:"acceptance criteria",scenarios:"scenarios",wiring:"acceptance criteria + exercises",tests:"tests + gaps"};function l(i,t,n){let e=t.resolve(n);if(e===null)return[];let s=c(t,e.cid),a=d(i.recordsSince(null),s),r=a.reduce((o,m)=>Math.max(o,m.generation),0);return a.filter(o=>o.generation===r)}function S(i,t,n,e){let s=p;if(!s.includes(e))return{ok:!1,code:"UNKNOWN_PHASE",message:`--phase must be one of ${s.join(" | ")}, got '${e}'`,valid:[...s]};let a=new Set(l(i,t,n).map(o=>o.phase)),r=s.slice(0,s.indexOf(e)).filter(o=>o!=="grounding"&&!a.has(o));return r.length===0?{ok:!0,phase:e}:{ok:!1,code:"PHASE_ORDER",message:`--phase ${e} needs ${r.join(" + ")} committed first (nothing recorded for ${r.join(", ")})`,missing:r,earliest:r[0]}}function E(i,t,n,e){let s=l(i,t,n),a=t.resolve(n);if(a===null)return{priorDesign:void 0,phaseLadder:s};let r=g(t,a.tip);return{priorDesign:r.scenarios.length===0&&r.tests.length===0&&r.acs.length===0?void 0:r,phaseLadder:s}}export{p as a,P as b,x as c,l as d,S as e,E as f};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{closeSync as $,existsSync as _,mkdirSync as d,openSync as k,readFileSync as u,readdirSync as m,renameSync as w,rmSync as f,writeFileSync as y}from"fs";import{basename as S,join as c}from"path";var a=class extends Error{constructor(e,t){super(`${e}: ${t}`);this.code=e}},p=r=>c(r,"reconcile","plans");function g(r,n){let e=`${r}.tmp-${process.pid}`;y(e,n,{mode:384}),w(e,r)}function x(r,n){let e=p(r);d(e,{recursive:!0});let t=c(e,`${n.created}-${n.source_id}.json`);return g(t,JSON.stringify(n,null,2)+`
3
+ `),t}function P(r,n){let e=n;if(e===void 0){let o=p(r),l=[];try{l=m(o).filter(A=>A.endsWith(".json")).sort()}catch{}if(l.length===0)return{error:`no stored plans under ${o} \u2014 run reconcile --plan first`};e=c(o,l[l.length-1])}if(!_(e))return{error:`no such plan file: ${e}`};let t;try{t=u(e,"utf8")}catch(o){return{error:`cannot read plan ${e}: ${o instanceof Error?o.message:String(o)}`}}let i;try{i=JSON.parse(t)}catch(o){return{error:`corrupted plan ${e}: ${o instanceof Error?o.message:String(o)}`}}let s=i?.version;return s===1?{error:`plan predates the vocabulary change \u2014 recompute with --from <file> --source-id <id> (${e})`}:s!==2?{error:`unsupported plan version ${String(s)} in ${e} (expected 2)`}:Array.isArray(i.rows)?{plan:i,path:e}:{error:`not a reconcile plan \u2014 ${e} has no rows[] (hand-edited?)`}}function v(r){let n=r.archive_state??{};return(r.changeset??[]).filter(e=>e.kind==="ARCHIVE"&&n[e.ref]===void 0).map(e=>e.ref)}function b(r,n,e){let t=P("",r);if("error"in t)throw new a("PLAN_UNREADABLE",t.error);let i=t.plan,s=i.archive_state??{};if(s[n]!==void 0)throw new a("ROW_ALREADY_APPLIED",`archive ${n} already ${s[n].outcome}`);s[n]={at:new Date().toISOString(),outcome:e},i.archive_state=s,g(r,JSON.stringify(i,null,2)+`
4
+ `)}function D(r,n){let e=c(p(r),"superseded");d(e,{recursive:!0});let t=c(e,S(n));return w(n,t),t}function E(r,n){let e=p(r),t=[];try{t=m(e).filter(i=>i.endsWith(`-${n}.json`)).sort()}catch{}return t.length===0?null:P(r,c(e,t[t.length-1]))}function O(r,n){let e=E(r,n);if(e===null||"error"in e)return null;let t=e.plan.rows.filter(i=>i.applied===void 0).length+v(e.plan).length;return t>0?{path:e.path,created:e.plan.created,pending:t}:null}function W(r,n,e){let t;try{t=JSON.parse(u(r,"utf8"))}catch(s){throw new a("PLAN_UNREADABLE",`${r}: ${s instanceof Error?s.message:String(s)}`)}let i=t.rows?.[n];if(!i)throw new a("ROW_MISSING",`${r} has no row ${n}`);if(i.applied)throw new a("ROW_ALREADY_APPLIED",`row ${n} of ${r} was already applied (${i.applied.outcome} at ${i.applied.at})`);i.applied={at:new Date().toISOString(),outcome:e},g(r,JSON.stringify(t,null,2)+`
5
+ `)}function I(r){let n=p(r);d(n,{recursive:!0});let e=c(n,".walk-lock");for(let t=0;t<2;t++)try{let i=k(e,"wx");return y(i,`${process.pid}
6
+ `),$(i),()=>{try{f(e)}catch{}}}catch(i){if(i.code!=="EEXIST")throw i;let s=h(e);if(!Number.isFinite(s)){let l=Date.now()+50;for(;Date.now()<l;);s=h(e)}if(Number.isFinite(s)&&L(s))throw new a("WALK_LOCKED",`another reconciliation is already running (pid ${s}) \u2014 wait for it to finish; if it appears stuck, stop that process before retrying`);try{f(e)}catch{}}throw new a("WALK_LOCKED",`could not take the walk lock at ${c(n,".walk-lock")}`)}function h(r){try{return parseInt(u(r,"utf8").trim(),10)}catch{return NaN}}function L(r){try{return process.kill(r,0),!0}catch{return!1}}export{x as a,P as b,v as c,b as d,D as e,E as f,O as g,W as h,I as i};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-CSVPZ33X.js";import{y as t}from"./chunk-CXF6AZWY.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
2
+ import{a as m}from"./chunk-OVNRRI4E.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{y as t}from"./chunk-I6OQISK4.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ function l(e){return{command:(t,n)=>e.commands[t](n),text:(t,n)=>e.texts[t](n)}}function $(e,t,n){let s=n?(i,a)=>n[i](a):e.header;return{command:e.command,text:(i,a)=>{let u=t[i];return u?u(a):e.text(i,a)},...s?{header:s}:{}}}function w(e,t){let n=e.command("next.resume_session",t),s=e.command("next.resume_with_message",t);return{...n!==null?{resume:n}:{},...s!==null?{resumeMessage:s}:{}}}function x(e,t,n,s){let i=e.command(t,n);return i!==null?{cmd:i,...s}:{code:t,facts:n,...s}}import{getEnvironmentData as v,setEnvironmentData as f}from"worker_threads";var d=(e,t)=>e?`${e} ${t}${e>1?"s":""}`:null,p={"chat.added_use_cases":({minted:e,matched:t})=>e===0&&t>0?`all ${t} matched existing \u2014 nothing new to save`:`saved ${e} use-case${e===1?"":"s"} as drafts`+(t>0?` \xB7 ${t} matched existing`:""),"chat.added_design":({acs:e,scenarios:t,tests:n,gaps:s})=>`saved ${[d(e,"AC"),d(t,"scenario"),d(n,"test"),d(s,"gap")].filter(Boolean).join(" \xB7 ")||"judgements/wiring"} as drafts`,"chat.proposal_refused":()=>"proposal failed validation \u2014 nothing landed","chat.commit_failed":()=>"commit failed \u2014 nothing landed","chat.approved":({count:e})=>`${e} change${e===1?"":"s"} applied`,"chat.stales":({count:e})=>`stales ${e}`,"chat.held_degraded":({held:e})=>`held ${e} item(s) for review \u2014 semantic dedup ran degraded (embeddings unavailable); nothing saved this turn`,"chat.child_back":({drafts:e})=>`${e} draft${e===1?"":"s"} saved`,"chat.refine_hint":()=>'chat to refine ("looks good" approves; /done finishes)',"chat.repair_sent":()=>"that couldn't be saved as it was \u2014 the agent is fixing it","chat.updates_held":({count:e})=>`${e} update(s) held for review`,"note.dedup_reduced":()=>"note: duplicate detection is running in a reduced mode this run \u2014 new items will be held for your review instead of committed","note.chain_recovered":({sid:e})=>`session ${e}: checkpoint chain present with no pointer \u2014 recovering from the chain`,"note.chain_truncated":({sid:e,at:t,lost:n})=>`session ${e}: chain truncated to checkpoint ${t} \u2014 ${n} turn(s) lost to a corrupt record`,"note.turns_unrecorded":({detail:e})=>`this chat's turns are not being saved to its conversation (${e}) \u2014 your messages still reach the agent, but a resume cannot send them again`,"note.receipt_unbuilt":({detail:e})=>`a saved change's receipt for the agent could not be built (${e}) \u2014 the change is saved, but the agent is not told what it saved`,"note.tests_await_approval":({tests:e,criteria:t,criterion:n})=>{let s=e===1?"1 test checks":`${e} tests check`;return t===1&&n!==null?`note: ${s} a criterion not approved yet \u2014 say "approve ${n}"`:`note: ${s} criteria not approved yet \u2014 say "approve the criteria"`},"note.phase_unchanged":()=>"this phase matched what's already there \u2014 nothing new added","warning.variables_unwritten":({message:e})=>`warning: the design was saved, but its variable stubs could not be written (${e})`};var r=()=>null,c=e=>`resume session ${e}, which holds it`,h="review the current version again",g="retire it first, or add this under another id",m=l({commands:{"next.resume_session":r,"next.resume_with_message":r,"next.resume_child":r,"next.design_use_case":r,"next.review_use_case":r,"next.design_unreviewed":r,"next.view_design":r,"next.evolve_design":r,"next.redesign":r,"next.design_phase":r,"next.answer_evolve":r,"next.abandon_session":r,"next.review_held_changeset":r,"next.show_session":r,"next.review_source":r},texts:{...p,"note.paused":({sid:e})=>`paused: session ${e} saved and can be resumed`,"note.crashed":({sid:e,seq:t})=>`agent crashed \u2014 session ${e} can be resumed from its checkpoint ${t} (at most the in-flight turn lost)`,"note.model_unavailable_kept":({sid:e,detail:t})=>`the model service did not answer (${t}) \u2014 session ${e} is kept and can be resumed once it answers`,"note.model_retry":({seconds:e})=>`the model service is not answering; trying again in ${e}s`,"note.held_for_review":({sid:e,held:t})=>`paused: ${t} held item(s) await review in session ${e}`,"note.already_extracted":({source_id:e})=>`${e} already extracted \u2014 skipped`,"note.conversation_source_skipped":({source_id:e})=>`skipped ${e} \u2014 a conversation source is extracted only when it is named`,"note.reconcile_plan_pending":({source_id:e,pending:t})=>`note: a reconcile plan for ${e} is pending (${t} item(s))`,"note.nothing_to_extract":({sources:e,count:t})=>`extract: nothing to do \u2014 ${e} ${t===1?"is":"are all"} already extracted at the current snapshot`,"note.only_conversation_sources":()=>"extract: nothing to do \u2014 only conversation sources here, and each is extracted only when it is named","note.all_extracted":()=>"extract: nothing to do \u2014 every ingested source is already extracted","note.changeset_held_for_review":({sid:e,held:t})=>`paused: ${t} held change(s) await your verdicts in session ${e}`,"note.session_kept":({sid:e,seq:t,ts:n})=>`session ${e} kept its last checkpoint (seq ${t}, ${n}) and can be resumed`,"note.assumed_defaults":({sid:e,count:t})=>`note: ${t} default(s) were assumed while you were away \u2014 session ${e} lists them`,"note.landed_changed":({source_id:e})=>`note: ${e} changed after it was added \u2014 skipping its extraction this run; extract it again to pick up the newer version`,"note.landed_older_queued":({source_id:e})=>`note: an older version of ${e} is already queued this run \u2014 the newly landed version is not extracted; extract it again to pick it up`,"note.reingest_binary":({source_id:e,kind:t})=>`skipping ${e}: binary ${t} ingested before image support \u2014 add it again to extract from it`,"note.schedule_refused":()=>"this run holds items for review, so its extraction is not scheduled \u2014 it runs after the review","note.not_reached":()=>"run ended before its turn \u2014 extracting again runs it","note.nothing_committed":({source_id:e,remaining:t})=>`done \u2014 nothing committed for ${e} (no finalize before the session ended)`+(t>0?`; stopping here \u2014 ${t} remaining source(s) not extracted (extract them again to continue)`:""),"note.landed_not_extracted":({count:e,sources:t})=>`note: ${e} source(s) landed this session (${t}) were not extracted \u2014 the session ended first; extracting again runs them`,"note.evidence_not_attached":({count:e})=>`note: ${e} unchanged match(es) target unreviewed (or no-longer-resolving) item(s) \u2014 evidence not attached (review them; a later reconcile attaches)`,"note.sources_failed":({failed:e,total:t,sources:n})=>`${e} of ${t} source(s) failed \u2014 extract them again to retry (${n})`,"note.already_designed":({use_case:e,version:t})=>`'${e}' is already designed @ v${t} \u2014 current; redesign it to replace that design`,"note.design_stale":({use_case:e,designed:t,current:n})=>`'${e}' was designed @ ${t} \u2014 the use-case is now @ v${n} (STALE); evolve or redesign it`,"note.view_design":({use_case:e})=>`view the existing design of ${e}`,"note.evolve_first":({use_case:e})=>`refresh it first: evolve ${e}`,"note.nothing_executed":()=>"nothing executed","note.tests_await_approval_command":({tests:e,criteria:t,criterion:n})=>{let s=e===1?"1 test checks":`${e} tests check`;return t===1&&n!==null?`note: ${s} a criterion not approved yet; approve ${n}`:`note: ${s} criteria not approved yet; approve them`},"note.links_await_approval":({count:e})=>`warning: ${e} test link(s) refer to items still awaiting approval \u2014 saved anyway; review and approve those items`,"note.no_design_skipped":({use_case:e})=>`note: ${e} has no design output \u2014 nothing to evolve; design it first`,"note.no_design":({use_case:e})=>`nothing to evolve \u2014 design ${e} first (no design output)`,"note.design_paused":({use_case:e})=>`design session for ${e} paused \u2014 resume it, then evolve again for the diff`,"note.nothing_changed":({ref:e})=>`nothing changed underneath ${e} \u2014 its sources and requirements are current; give a reason to re-design anyway`,"note.source_changed_skipped":({use_case:e})=>`${e} is left out: it's out of date because its source changed \u2014 review its source's change first`,"note.source_changed":({use_case:e})=>`${e} is out of date because its source changed, and an update can't change that \u2014 review its source's change first`,"note.source_changed_after":({use_case:e})=>`${e} is still out of date because its source changed \u2014 review its source's change`,"note.checkpoint_not_saved":({error:e,chain_unverified:t})=>`warning: couldn't save the session checkpoint \u2014 ${e}; asking the agent to pause`+(t?". The store's record chain fails verification.":""),"note.held_no_event_id":({sid:e})=>`this held row has no durable event id \u2014 ${c(e)}, to drop it`,"note.held_no_provenance":({sid:e})=>`this held row carries no committable provenance \u2014 ${c(e)}, to apply it`,"note.held_no_citable_text":({sid:e,source_id:t,source_cid:n})=>`the pinned source ${t} (${n.slice(0,19)}) has no citable text to verify this held row against \u2014 ${c(e)}`,"note.held_unverified":({sid:e,errors:t})=>`held provenance does not verify against the pinned source (${t}) \u2014 ${c(e)}`,"note.controller_unreachable":({base:e,error:t})=>`error: cannot reach the controller at ${e} (${t})
3
+ hint: check the network connection and the sign-in`,"note.assurance_unsupported":()=>"error: this environment does not support assurance sessions yet (404) \u2014 contact support if the problem persists","note.credentials_rejected":({env:e})=>`error: your credentials were rejected (401) \u2014 sign in again (active environment: ${e})`,"note.key_recycled":({source_id:e,what:t})=>`source '${e}' was ingested from a different ${t} that used this key \u2014 the key was recycled; ${g}`,"note.kind_taken":({source_id:e,backing:t,kind:n})=>`source '${e}' is already backed by ${t}, not ${n} \u2014 ${g}`,"note.site_moved":({source_id:e,previous:t,site:n})=>`source '${e}' was ingested from ${t}, but this read serves ${n} \u2014 ${g}`,"note.web_url_changed":({source_id:e,previous:t})=>`source '${e}' was ingested from ${t} \u2014 adopt the new URL as its next version, or add it under another id`,"note.web_id_taken":({url:e})=>`skipped ${e} \u2014 add it under another id to keep both pages`,"note.web_login":()=>"your credentials were rejected \u2014 sign in again and retry","note.web_projection_unknown":({kind:e})=>`unknown web projection kind '${e}' \u2014 this source needs a newer engine to read it`,LIS_AUTH:()=>"credentials rejected \u2014 sign in again and retry",MULTI_SOURCE_RESUME:({sid:e,sources:t})=>`error: session ${e} spans ${t} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (extract anything remaining again)`,CHANGE_BASIS_MOVED:({source_id:e,sid:t})=>`error: ${e} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; review the current version instead (session ${t} is defunct and can be ignored)`,PROPOSAL_UNREADABLE:({proposal:e})=>`proposal ${e} is unreadable \u2014 review the source's changes again`,SOURCE_UNRESOLVED:({source_id:e})=>`the source ${e} no longer resolves \u2014 cannot verify this changeset is current; review the source's changes again`,SOURCE_MOVED:({source_id:e})=>`the source ${e} moved again while this review was open \u2014 review its changes again to refresh the changeset`,ARCHIVE_UNRESOLVED:({use_case:e})=>`its archive op no longer resolves to ${e} \u2014 review the source's changes again`,POSTURE_IN_CHAT:({sid:e})=>`error: session ${e} is a held reconcile review \u2014 resumed in the chat its changes would commit without verdicts; give its cards their verdicts in the review`,SOURCE_MISSING:({sid:e,sources:t})=>`error: resumed session's paused source (${t}) is no longer in the corpus \u2014 add it again and resume session ${e}, or abandon that session`,BLOB_MISSING:({source_id:e})=>`error: ${e}: its stored content is missing \u2014 add the file again [BLOB_MISSING]`,"AGENT_FAILED.invalid_proposal":({source_id:e})=>`error: the agent could not produce a valid proposal for ${e} \u2014 extract it again to retry`,UC_UNREVIEWED:({use_case:e})=>`${e} is unreviewed \u2014 approve it first, or design it unreviewed`,"UC_UNREVIEWED.merge_target":({temp_ref:e,target:t})=>`${e}: merge target ${t} is unreviewed (derived) \u2014 approve it first and re-propose the merge`,UC_HELD:({use_case:e,owner_sid:t,stopped:n})=>`design: ${e} is being designed by another session`+(n?` \u2014 that session looks stopped; resume session ${t??"<session>"}`:"")+" \u2014 pick another use-case or wait for it to finish",GENERATION_LIVE:({use_case:e,gen:t})=>`${e} already has a live design generation (gen ${t}) \u2014 redesign it, with a reason, to supersede it`,MESSAGE_TOO_LARGE:({bytes:e,max:t})=>`error: the opening statement is ${e} bytes and the agent takes at most ${t} per message (it would drop it silently) \u2014 give a shorter reason (it replaces the generated stale reason)`,REASON_TOO_LARGE:()=>"nothing was started: that reason is too long; run it again with a sentence or two",SESSION_V1:({sid:e})=>`session ${e} predates durable checkpoints \u2014 this build cannot resume it; abandon it and start a fresh run (committed work is untouched)`,WRONG_VERB:({sid:e,verb:t})=>`error: session ${e} is a ${t} session \u2014 resume it as one`,"HELD_CITES_STALE.moved":()=>`the source moved after this plan staged \u2014 its quotes no longer verify against the current head; ${h}`,"HELD_CITES_STALE.predates_images":({where:e,anchor:t})=>`${e}: this plan predates image-part staging \u2014 ${t} cannot be verified against the version it staged under; ${h}`,"HELD_CITES_STALE.no_image":({where:e,anchor:t})=>`${e}: ${t} names no decodable image of the staged version \u2014 ${h}`,"HELD_CITES_STALE.image_moved":({where:e,anchor:t,gone:n})=>`${e}: the image behind ${t} is ${n?"no longer in":"ambiguous in"} the current head \u2014 ${h}`}});var _="kane-context:flushToDisk",o=null;function U(e){o=e,e.flushToDisk!==void 0&&f(_,e.flushToDisk)}function A(){if(!o)throw new Error("engine config not set; the host must call setEngineConfig before any engine call");return o}function I(){return o?.writersFenced===!0}function L(){return(o?.flushToDisk??v(_))!==!1}function O(){return o?.warn}function W(){return o?.userSessionId?.()??null}function H(){return o?.version??null}function D(){return o?.wording??m}export{l as a,$ as b,w as c,x as d,p as e,U as f,A as g,I as h,L as i,O as j,W as k,H as l,D as m};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ function t(n,r){try{return JSON.parse(n)}catch{throw new Error(`${r} isn't valid JSON`)}}export{t as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-QAG67DUT.js";import{a as m}from"./chunk-DUYRCVI5.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-5ESGUPSR.js";import{a as c,b as s,h as a,x as u}from"./chunk-CXF6AZWY.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
2
+ import{b as l}from"./chunk-57MDWTON.js";import{a as m}from"./chunk-MGNRNLBE.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-XBEYWXPV.js";import{a as c,b as s,h as a,x as u}from"./chunk-I6OQISK4.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as b}from"./chunk-ZHWU6L2G.js";import{e as g,g as d,n as m,r as h}from"./chunk-DBMW3VUN.js";function x(i,o,a){let y=i.tipOf(a),p=i.derivesInto(y).filter(t=>Array.isArray(t.props.units)&&typeof t.props.source_id=="string");if(p.length===0)return[];let l=new Map;for(let t of p)l.set(String(t.props.source_id),[...l.get(String(t.props.source_id))??[],t]);let c=new Map;for(let[t,n]of l){let r=i.heads.get(t),e=typeof r=="string"?g(r,s=>i.mediaOf(s)?.plugin):null;c.set(t,e===null?new Set(n.flatMap(s=>s.props.units)):new Set(d(n,e).failing))}let u=new Map,C=t=>{let n=u.get(t);if(n===void 0){let r=i.mediaOf(t)?.plugin?.index,e=r===void 0?null:m(o(r));n=new Map((e?.units??[]).flatMap(s=>{let f=b(s.label);return f!==null?[[s.id,f]]:[]})),u.set(t,n)}return n};return p.map(t=>{let n=String(t.props.source_id),r=String(t.props.source_cid);return{source_id:n,version:r,anchor:String(t.props.anchor),units:t.props.units.map(e=>({id:e,label:C(r).get(e)??null,fresh:!c.get(n).has(e)}))}})}function I(i){return`${i.source_id} ${i.anchor}: ${i.units.map(o=>`${o.id}${(a=>a!==null?` ${a}`:"")(h(o.label))}${o.fresh?"":" (stale)"}`).join(", ")}`}export{x as a,I as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ function i(r,t){return`Basic ${Buffer.from(`${r}:${t}`).toString("base64")}`}export{i as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{L as N,a as k,pa as S,r as w}from"./chunk-UEE3RZN4.js";import{f as _,h as $}from"./chunk-KU3YHPWZ.js";var T=3,F={edit:"edit",reject:"mistake",dedup_dropped:"mistake",approve:"usage",enhance:"directed-edit",add:"directed-edit",default_accepted:"usage",default_overridden:"edit",gap_resolution:"usage",dedup_kept:"usage"};function P(m){let{store:u,graph:s,watermark:v,by:f}=m,{signals:b}=u.signals().snapshot(v),E=b.filter(e=>e.event_id===void 0||s.appliedEvents.has(e.event_id)),n=new Map;for(let e of E){let t=e.event_id??`${e.ts}|${e.id}|${e.verdict}|${e.polarity}`;n.has(`${t}|${e.polarity}|${e.verdict}`)||n.set(`${t}|${e.polarity}|${e.verdict}`,e)}let j=[...n.values()].sort((e,t)=>(e.event_id??e.ts)<(t.event_id??t.ts)?-1:1),i=new Map;for(let e of j){let t=`${e.verdict}|${e.tag??""}`,r=i.get(t)??{verdict:e.verdict,tag:e.tag,events:new Set};r.events.add(e.event_id??e.ts),i.set(t,r)}let d=[],a=[],g=new Set,c=[],y=0;for(let[,e]of[...i.entries()].sort(([t],[r])=>t<r?-1:1)){if(e.events.size<T)continue;let r={derived:!0,statement:`${e.verdict}${e.tag?`/${e.tag}`:""} recurs (${e.events.size} distinct events) \u2014 bias future proposals ${e.verdict==="approve"?"toward":"away from"} this pattern`,learned_from_kind:F[e.verdict]??"usage",learned_from:[...e.events].sort()},h=$("stylenote",r);if(h.length>0)return{record:null,errors:h.map(o=>({code:o.code,detail:o.detail})),minted:0};let p=k("stylenote",r);if(s.hasNode(p))continue;d.push({cid:p,label:_.STYLENOTE,content:r});for(let o of r.learned_from)c.includes(o)||c.push(o);let l=S("stylenote",o=>g.has(o),s.names.keys());l!==null&&(g.add(l),a.push({cid:p,slug:l,by:f})),y+=1}return d.length===0?{record:null,errors:null,minted:0}:{record:N(u,{ts:new Date().toISOString(),proposal_id:null,nodes:d,edges:[],review:[],supersessions:[],source_head_moves:{},...a.length>0?{names:a}:{}},{graph:s,expectPrev:s.latestHash,intent:{v:1,verb:"distill",args:w({watermark:v,by:f}),pins:{events:c}},provenance:m.provenance}).record,errors:null,minted:y}}export{P as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{a as s,b as o,e as c}from"./chunk-I6OQISK4.js";import{readFileSync as f,writeFileSync as d,mkdirSync as g,realpathSync as h}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function N(){try{let t=process.argv[1];if(t&&h(t).includes("/Cellar/"))return b}catch{}return C}var m=y(o,"version-check.json"),w=1440*60*1e3;function A(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<w)return t}catch{}return null}function k(t){try{g(o,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,e){let n=t.split(".").map(Number),r=e.split(".").map(Number);for(let i=0;i<3;i++){let a=(r[i]??0)-(n[i]??0);if(a!==0)return a}return 0}function p(t,e){let n=t.split(".").map(Number),r=e.split(".").map(Number);return(r[0]??0)!==(n[0]??0)?"major":(r[1]??0)!==(n[1]??0)?"minor":"patch"}async function T(){try{let t=A();if(t)return u(s,t.latest)>0?{current:s,latest:t.latest,severity:p(s,t.latest)}:null;let e=new AbortController,n=setTimeout(()=>e.abort(),5e3),r=await l(c,{headers:{Accept:"application/json"},signal:e.signal});if(clearTimeout(n),!r.ok)return null;let a=(await r.json())["dist-tags"]?.latest;return a?(k(a),u(s,a)>0?{current:s,latest:a,severity:p(s,a)}:null):null}catch{return null}}async function v(t=5e3){let e=new AbortController,n=setTimeout(()=>e.abort(),t);try{let r=await l(c,{headers:{Accept:"application/json"},signal:e.signal});return r.ok?(await r.json())["dist-tags"]?.latest??null:null}catch{return null}finally{clearTimeout(n)}}export{N as a,u as b,p as c,T as d,v as e};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u,b as x}from"./chunk-IGHK2ENL.js";import{y as m}from"./chunk-CXF6AZWY.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
2
+ import{a as u,b as x}from"./chunk-I5NSJBOZ.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as m}from"./chunk-33DWJV67.js";import{y as i}from"./chunk-I6OQISK4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(m,{color:i.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{j as n}from"./chunk-A7RJQJNT.js";var o={command:"set-auto-grant-permissions",capability:"auto_grant_permissions",label:"Auto Grant Permissions",onHint:"grant Android runtime permissions at session start (default)",offHint:"leave permission dialogs on screen"},r={command:"set-auto-accept-alerts",capability:"auto_accept_alerts",label:"Auto Accept Alerts",onHint:"accept iOS alerts, incl. permission prompts (default)",offHint:"leave alerts on screen"},s=[{target:"emulator",key:"auto_grant_permissions",...o},{target:"simulator",key:"auto_accept_alerts",...r},{target:"android",key:"android_auto_grant_permissions",...o},{target:"ios",key:"ios_auto_accept_alerts",...r}],g=s.map(e=>e.key);function i(e){return s.find(t=>t.target===e)}function c(e,t){return e?.[i(t).key]!==!1}function u(e,t){return{[i(t).capability]:c(e,t)}}function l(e){return e.label.charAt(0)+e.label.slice(1).toLowerCase()}function d(e){return`${l(e)} (${n(e.target)})`}function m(e,t){let a=c(e,t);return i(t).capability==="auto_grant_permissions"?{autoGrantPermissions:a}:{autoAcceptAlerts:a}}export{s as a,g as b,i as c,c as d,u as e,l as f,d as g,m as h};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as n,b as r}from"./chunk-22PIMG52.js";function g(){return{currentAttempt:null,liveThinking:"",thinkingLog:[],activity:[]}}var a={dedup_candidate:"checking a possible duplicate",context_read:"checking what's already there",version_history:"checking an item's past versions",corpus_roster:"checking which sources there are",provenance_check:"checking what came from a source",freshness_check:"checking what's out of date",evidence_readback:"checking what the source says",evidence_search:"searching the source",mechanics:"working out the scenarios",owner_provided_source:"adding the source you gave",ambiguity:"asking about something unclear",validation_failed:"fixing a problem in its draft",validation_repair:"fixing a problem in its draft",terminal_call:"putting the result together",finalize:"putting the result together",truncated:"picking up where it stopped",malformed_tool_call:"trying that step again",no_tool_calls:"trying that step again"};function o(t){return a[t.reason_code]??n}function c(t){let e=r({name:t.name});return t.status==="started"?`\u2192 ${e}\u2026`:t.status==="error"||t.status==="aborted"?`\u2717 ${e}`:`\u2713 ${e}`}function s(t,e){return e.turn_id!==t.turn_id?e.turn_id<t.turn_id:e.attempt<t.attempt}function h(t,e){let i=t.currentAttempt;if(i===null||i.turn_id!==e.turn_id||i.attempt!==e.attempt){if(i!==null&&s(i,e))return t;t={...t,currentAttempt:{turn_id:e.turn_id,attempt:e.attempt},liveThinking:""}}switch(e.type){case"reasoning_delta":return{...t,liveThinking:t.liveThinking+e.text};case"reasoning_done":return e.present?{...t,thinkingLog:[...t.thinkingLog,{text:t.liveThinking,tookMs:e.took_ms}],liveThinking:""}:{...t,liveThinking:""};case"tool_activity":return{...t,activity:[...t.activity,{name:e.name,status:e.status,label:c(e)}]};case"decision_activity":return{...t,activity:[...t.activity,{name:e.action,status:"decision",label:o(e)}]}}}export{g as a,h as b};