@testmuai/kane-cli 0.10.0 → 0.10.2

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 (397) hide show
  1. package/dist/ChatSurface-FIYDTZSI.js +2 -0
  2. package/dist/{ChromeProfilePicker-FWPUDKD6.js → ChromeProfilePicker-Q6FIGVYU.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-D5L2DO6A.js → CliFeedbackPrompt-2NV2G65E.js} +1 -1
  4. package/dist/{CliUploadProgress-HQX57WE6.js → CliUploadProgress-JZ5FXODE.js} +1 -1
  5. package/dist/{ConfigView-DGQXKEON.js → ConfigView-TZ4YINOE.js} +1 -1
  6. package/dist/EvidenceViewOffer-LKPN5BHX.js +2 -0
  7. package/dist/FolderPicker-H5K74PCH.js +2 -0
  8. package/dist/InfoBox-DNSOAK5L.js +2 -0
  9. package/dist/{LinksBox-WZ4RAMSH.js → LinksBox-32TZOANP.js} +1 -1
  10. package/dist/{ProfilesView-AGRNPGSW.js → ProfilesView-UC4MPM54.js} +1 -1
  11. package/dist/ProjectPicker-ZJ5RW6XL.js +2 -0
  12. package/dist/SaveSessionPrompt-F327WC7A.js +2 -0
  13. package/dist/SingleShotApp-OMLRYOSI.js +2 -0
  14. package/dist/{SummaryBox-XQJUZBAN.js → SummaryBox-XGFO5X76.js} +1 -1
  15. package/dist/TestMdRunView-ZZ77QTAQ.js +2 -0
  16. package/dist/TestrunEvidenceTable-G7MPF55X.js +2 -0
  17. package/dist/{WhoamiView-JQCURK2M.js → WhoamiView-4XIJXMTU.js} +1 -1
  18. package/dist/{app-download-OU6AGH2X.js → app-download-XEDO3EMV.js} +1 -1
  19. package/dist/{assurance-job-ZI3L6I4F.js → assurance-job-MD65GQLC.js} +1 -1
  20. package/dist/{auth-7Z54TMQQ.js → auth-WBIEHHDS.js} +1 -1
  21. package/dist/{binary-S5YL5GJD.js → binary-NVYLR36K.js} +1 -1
  22. package/dist/{bind-LIV72SEZ.js → bind-H3ALI2NG.js} +1 -1
  23. package/dist/{bootstrap-3V6TOO6I.js → bootstrap-JEVSVPQ2.js} +1 -1
  24. package/dist/bridge-2UHJOVLX.js +2 -0
  25. package/dist/{catalog-I3PC6LT6.js → catalog-5UYBWA4W.js} +1 -1
  26. package/dist/{catalog-client-WKYG3JN6.js → catalog-client-VVKV4JKW.js} +1 -1
  27. package/dist/{changelog-IHNWFYWY.js → changelog-FPWJXERY.js} +1 -1
  28. package/dist/chat-committer-ZKEKJA2R.js +2 -0
  29. package/dist/chat-controller-FXRJXUG3.js +2 -0
  30. package/dist/child-JHYENXE7.js +2 -0
  31. package/dist/{chunk-URAYFJGM.js → chunk-226AGYHB.js} +1 -1
  32. package/dist/{chunk-ZTAZ2R5Z.js → chunk-23DKB2MT.js} +1 -1
  33. package/dist/{chunk-JGLADDRH.js → chunk-2COXO5LQ.js} +1 -1
  34. package/dist/{chunk-TZVPDGJD.js → chunk-2GEAKFAV.js} +1 -1
  35. package/dist/{chunk-45URQUAK.js → chunk-2QKBXRLI.js} +1 -1
  36. package/dist/{chunk-AG5XJWEV.js → chunk-2ULYGALF.js} +1 -1
  37. package/dist/{chunk-G3J4XY3Z.js → chunk-32HED7X2.js} +1 -1
  38. package/dist/{chunk-GRURFGBP.js → chunk-32MFECUA.js} +1 -1
  39. package/dist/{chunk-N3KTLWJL.js → chunk-35BG2EMW.js} +1 -1
  40. package/dist/{chunk-KDR662D2.js → chunk-3KY7HHQU.js} +1 -1
  41. package/dist/{chunk-ZGQM6KWN.js → chunk-3V4J65GN.js} +1 -1
  42. package/dist/{chunk-DBTMKBHU.js → chunk-3YIA3DSL.js} +1 -1
  43. package/dist/{chunk-VVCZRCRD.js → chunk-44SIFDNY.js} +1 -1
  44. package/dist/{chunk-Z5BFCTHI.js → chunk-45NM23EQ.js} +2 -2
  45. package/dist/{chunk-I2MC6VVX.js → chunk-4C7WVQOD.js} +1 -1
  46. package/dist/{chunk-3UHPVQLU.js → chunk-4HARMERK.js} +1 -1
  47. package/dist/{chunk-A3TCFSCK.js → chunk-4HYPMGDF.js} +1 -1
  48. package/dist/{chunk-7KX2BHKG.js → chunk-4KCYNP2K.js} +1 -1
  49. package/dist/{chunk-FVYIV36L.js → chunk-4LGQHTXM.js} +1 -1
  50. package/dist/{chunk-WKZLK57W.js → chunk-4NEPHIAO.js} +1 -1
  51. package/dist/{chunk-YYVBE6W2.js → chunk-54NJJVG5.js} +1 -1
  52. package/dist/{chunk-3OVFKUXV.js → chunk-5F44KH3R.js} +1 -1
  53. package/dist/{chunk-WERIGVOH.js → chunk-5F5IVART.js} +1 -1
  54. package/dist/{chunk-FBQ7PQJV.js → chunk-5KJU4MG4.js} +1 -1
  55. package/dist/{chunk-D6CS62O7.js → chunk-5MFPQYW3.js} +1 -1
  56. package/dist/{chunk-ZI3X7DI2.js → chunk-5WLXAQ4H.js} +1 -1
  57. package/dist/{chunk-RFEON5GN.js → chunk-5XVWT6UK.js} +1 -1
  58. package/dist/{chunk-5IO5ZC4S.js → chunk-6CS23F3E.js} +1 -1
  59. package/dist/{chunk-DTYT6KBO.js → chunk-6JUS2ULI.js} +1 -1
  60. package/dist/{chunk-HMQ5M4JJ.js → chunk-6LEHGRRG.js} +1 -1
  61. package/dist/{chunk-5R3ODQHH.js → chunk-6SD4XTYC.js} +1 -1
  62. package/dist/{chunk-Y3YULFCK.js → chunk-6SWHEBPR.js} +1 -1
  63. package/dist/{chunk-BY2B4YJN.js → chunk-6YBH3WUW.js} +1 -1
  64. package/dist/{chunk-X3J4CC27.js → chunk-73HMW2WA.js} +1 -1
  65. package/dist/{chunk-PQXYHI5W.js → chunk-75FF7J5R.js} +1 -1
  66. package/dist/{chunk-JTJ7IPNI.js → chunk-7DLDADQR.js} +1 -1
  67. package/dist/{chunk-J4LQAT5P.js → chunk-7LYLJ75Z.js} +1 -1
  68. package/dist/{chunk-XLQ4F6BI.js → chunk-7O2FIZB7.js} +2 -2
  69. package/dist/{chunk-UUWSULIM.js → chunk-7PCLHURF.js} +3 -3
  70. package/dist/{chunk-FLOQ5NZL.js → chunk-7XJNYLQW.js} +1 -1
  71. package/dist/{chunk-3ZPEQDXZ.js → chunk-7ZR5CQY3.js} +1 -1
  72. package/dist/{chunk-CJQUVHHS.js → chunk-A474TUCE.js} +1 -1
  73. package/dist/chunk-A4ZV2SHL.js +5 -0
  74. package/dist/{chunk-RDH3E25Q.js → chunk-A7IMHUFY.js} +2 -2
  75. package/dist/{chunk-EVZLINBN.js → chunk-ABMM37L2.js} +1 -1
  76. package/dist/{chunk-QECTIQAC.js → chunk-AUSLHNXQ.js} +1 -1
  77. package/dist/{chunk-4MNSP4EO.js → chunk-B226SFOV.js} +1 -1
  78. package/dist/{chunk-2L3A5NKZ.js → chunk-B57ZRHEQ.js} +1 -1
  79. package/dist/{chunk-2PZKMT3I.js → chunk-BHQIH2FE.js} +1 -1
  80. package/dist/{chunk-4SJAOAYY.js → chunk-BJT6PZXL.js} +1 -1
  81. package/dist/{chunk-YKOEABP2.js → chunk-C6P6YUCR.js} +1 -1
  82. package/dist/chunk-CB344EDO.js +2 -0
  83. package/dist/chunk-CCOD4GQJ.js +2 -0
  84. package/dist/{chunk-CJE7PKRV.js → chunk-CQDCNP7V.js} +1 -1
  85. package/dist/{chunk-EPJ5SJL2.js → chunk-D4QXYAYA.js} +2 -2
  86. package/dist/{chunk-CBVHP7JB.js → chunk-DLP5S3TO.js} +1 -1
  87. package/dist/{chunk-EH43VWVR.js → chunk-DXIQVBMI.js} +1 -1
  88. package/dist/chunk-DXLZCJH5.js +7 -0
  89. package/dist/{chunk-WZLDFEWR.js → chunk-E4GIGM5V.js} +1 -1
  90. package/dist/{chunk-JOCEZK2M.js → chunk-EAWU2TOG.js} +1 -1
  91. package/dist/{chunk-G3CYFCSR.js → chunk-EEOAU43D.js} +1 -1
  92. package/dist/{chunk-MYZHOBS4.js → chunk-EHB55V23.js} +1 -1
  93. package/dist/{chunk-OR2B6T3B.js → chunk-ENRFXGID.js} +1 -1
  94. package/dist/{chunk-JT6WLJSV.js → chunk-ET5EK2CM.js} +1 -1
  95. package/dist/{chunk-HGVM2OZU.js → chunk-EZMRWXRT.js} +1 -1
  96. package/dist/{chunk-QMOGBKJM.js → chunk-FAMQ4DHU.js} +1 -1
  97. package/dist/{chunk-GGV336P5.js → chunk-FI2DVNRT.js} +1 -1
  98. package/dist/{chunk-AUJSC7PU.js → chunk-FNUGDPTS.js} +1 -1
  99. package/dist/{chunk-MPEIMWQI.js → chunk-FOLUB336.js} +1 -1
  100. package/dist/{chunk-4JWJH6TB.js → chunk-FYPIF3BE.js} +1 -1
  101. package/dist/{chunk-HHW6MRU3.js → chunk-G4K3TP2I.js} +1 -1
  102. package/dist/{chunk-P2ZQDQDB.js → chunk-GAKBHNC4.js} +1 -1
  103. package/dist/{chunk-DPGOAFKF.js → chunk-GBQ4K25P.js} +1 -1
  104. package/dist/{chunk-PCDIEYV6.js → chunk-GEZVC4S3.js} +1 -1
  105. package/dist/{chunk-UX2CDUPE.js → chunk-GJ7MO2FW.js} +2 -2
  106. package/dist/{chunk-PL3SG3M2.js → chunk-GJXO6FF7.js} +1 -1
  107. package/dist/{chunk-252GEI3H.js → chunk-GLM5UGTF.js} +1 -1
  108. package/dist/{chunk-JCSVBD4F.js → chunk-GQARXS6F.js} +1 -1
  109. package/dist/{chunk-NTXFPNAP.js → chunk-GT3JDX5H.js} +1 -1
  110. package/dist/{chunk-RARD6TC6.js → chunk-GZQAETB2.js} +1 -1
  111. package/dist/{chunk-TLOYTGVT.js → chunk-H4TIVILC.js} +1 -1
  112. package/dist/{chunk-7C4IEL5V.js → chunk-HG2ILWCE.js} +1 -1
  113. package/dist/{chunk-2SY2NCOP.js → chunk-HHOVANJ7.js} +1 -1
  114. package/dist/{chunk-DHYGCHKB.js → chunk-HM6LZ2KM.js} +1 -1
  115. package/dist/{chunk-NJCN6LP5.js → chunk-HNF3PWF3.js} +6 -6
  116. package/dist/{chunk-P2LDAW3C.js → chunk-HVOXMCKE.js} +1 -1
  117. package/dist/{chunk-JSLKCCD2.js → chunk-HWPWCCEV.js} +1 -1
  118. package/dist/{chunk-XMALVGH7.js → chunk-HX5OLRKU.js} +2 -2
  119. package/dist/{chunk-4I7YN6YY.js → chunk-HYJVYYAZ.js} +2 -2
  120. package/dist/{chunk-2N75WO7Y.js → chunk-I52NWH4U.js} +1 -1
  121. package/dist/{chunk-3T2TYDPT.js → chunk-IB5WG5YY.js} +1 -1
  122. package/dist/{chunk-6DZ7LVOG.js → chunk-IH73ZCBB.js} +1 -1
  123. package/dist/{chunk-SBR6D6GS.js → chunk-IT5JVCZN.js} +1 -1
  124. package/dist/{chunk-GGS3ATPB.js → chunk-IZ66FKPC.js} +1 -1
  125. package/dist/{chunk-EX6ORR7P.js → chunk-JNPFEBUR.js} +1 -1
  126. package/dist/{chunk-AU26ZZTX.js → chunk-JTNEF5ZP.js} +1 -1
  127. package/dist/{chunk-K2PLULJD.js → chunk-JUVY6PHY.js} +1 -1
  128. package/dist/{chunk-JQ7ZZQXC.js → chunk-K4K2BGQC.js} +3 -3
  129. package/dist/{chunk-VZA7BPCK.js → chunk-K75WIRI5.js} +1 -1
  130. package/dist/{chunk-4R4YUOVY.js → chunk-KKLCXRW6.js} +1 -1
  131. package/dist/{chunk-YGMQXS2J.js → chunk-KN7GZWKK.js} +1 -1
  132. package/dist/{chunk-I2VU2DTS.js → chunk-L3BUPFAQ.js} +4 -4
  133. package/dist/{chunk-2GE5X2A5.js → chunk-LLQWEGXD.js} +1 -1
  134. package/dist/chunk-LTPOMMAB.js +2 -0
  135. package/dist/{chunk-AUBSLPJZ.js → chunk-LWCP4GLY.js} +1 -1
  136. package/dist/{chunk-VQZOKTJ2.js → chunk-LXCTV75T.js} +1 -1
  137. package/dist/{chunk-YH4VZVHJ.js → chunk-LZGAFKYH.js} +1 -1
  138. package/dist/{chunk-3QICDXY5.js → chunk-LZPYIFHZ.js} +1 -1
  139. package/dist/{chunk-WQR2GYP7.js → chunk-M3TFOFUQ.js} +1 -1
  140. package/dist/{chunk-MKPDF26Q.js → chunk-M7Y5GGVJ.js} +1 -1
  141. package/dist/{chunk-52VCA4K2.js → chunk-MEMXFTLD.js} +1 -1
  142. package/dist/{chunk-U7NRZBB5.js → chunk-MINDIQET.js} +1 -1
  143. package/dist/{chunk-JX5NVKTV.js → chunk-MP6NCJFE.js} +1 -1
  144. package/dist/{chunk-VA3BSIUQ.js → chunk-MSYRAPDK.js} +1 -1
  145. package/dist/{chunk-HJLMH7ZM.js → chunk-MUX2A37P.js} +1 -1
  146. package/dist/{chunk-EQWMOGLO.js → chunk-NCP54AIQ.js} +2 -2
  147. package/dist/{chunk-QQI6N3FO.js → chunk-NVD2MXHQ.js} +1 -1
  148. package/dist/{chunk-2EVP636F.js → chunk-O2Y46A3G.js} +3 -3
  149. package/dist/{chunk-ONZ2CSTZ.js → chunk-O3TXAMFW.js} +1 -1
  150. package/dist/{chunk-YI4ESDAX.js → chunk-O5KTMDTH.js} +1 -1
  151. package/dist/{chunk-HBVHIEPB.js → chunk-OK6NLITG.js} +1 -1
  152. package/dist/{chunk-JFBEHCJN.js → chunk-OKA6FPJM.js} +1 -1
  153. package/dist/{chunk-65BG6GAE.js → chunk-OVNTCBNS.js} +1 -1
  154. package/dist/{chunk-4523YDTG.js → chunk-P4VFC6HO.js} +1 -1
  155. package/dist/{chunk-ULGBK4NS.js → chunk-PC22QRIY.js} +1 -1
  156. package/dist/{chunk-B2WFW74J.js → chunk-PEUIHME2.js} +1 -1
  157. package/dist/{chunk-Z777GGHB.js → chunk-PI7OXS62.js} +1 -1
  158. package/dist/{chunk-MHB6DMKZ.js → chunk-POA336CU.js} +1 -1
  159. package/dist/{chunk-ZZNQIFFI.js → chunk-PR5EGLEI.js} +1 -1
  160. package/dist/{chunk-MW2WNYJO.js → chunk-PRBWZXFA.js} +2 -2
  161. package/dist/{chunk-4BUEOKFV.js → chunk-PWNYTIVA.js} +1 -1
  162. package/dist/{chunk-FYCD765R.js → chunk-Q4JV4U65.js} +58 -58
  163. package/dist/{chunk-BRVIK3BU.js → chunk-Q5AKIQIE.js} +1 -1
  164. package/dist/{chunk-EC5IP5HZ.js → chunk-QB77LRF4.js} +1 -1
  165. package/dist/{chunk-AGXAJ2II.js → chunk-QUNIY6NN.js} +1 -1
  166. package/dist/{chunk-LHQUCRCH.js → chunk-QVMXL675.js} +1 -1
  167. package/dist/{chunk-FPPVNF53.js → chunk-R6TFRAMZ.js} +1 -1
  168. package/dist/{chunk-567D5ZTO.js → chunk-RAVAJZV2.js} +7 -7
  169. package/dist/{chunk-7ZJWUWSN.js → chunk-RDAIOJCR.js} +1 -1
  170. package/dist/{chunk-PBWYQR5I.js → chunk-RRKYHUOD.js} +1 -1
  171. package/dist/{chunk-GXMD23XB.js → chunk-S7XCOBYD.js} +1 -1
  172. package/dist/{chunk-32Y6QVFG.js → chunk-SALZ6WSF.js} +1 -1
  173. package/dist/{chunk-4NUSW4A2.js → chunk-SIHX5FW5.js} +1 -1
  174. package/dist/{chunk-USJ3LUAL.js → chunk-SSOUYKVG.js} +1 -1
  175. package/dist/{chunk-2B75UL7Y.js → chunk-SVIIUKJ2.js} +1 -1
  176. package/dist/{chunk-QVP4FSKT.js → chunk-T77LTLAD.js} +1 -1
  177. package/dist/{chunk-KRRZCY7U.js → chunk-TAY7J5VS.js} +1 -1
  178. package/dist/chunk-TD6GCEIK.js +2 -0
  179. package/dist/{chunk-ZY65IZJR.js → chunk-TM6VLC6V.js} +1 -1
  180. package/dist/{chunk-YKL5H4K6.js → chunk-TMH4TPMB.js} +1 -1
  181. package/dist/{chunk-COJINPOK.js → chunk-TU2KPOW2.js} +2 -2
  182. package/dist/{chunk-3BSYOCSW.js → chunk-U2VYTVKV.js} +1 -1
  183. package/dist/{chunk-W3NWHWK2.js → chunk-UCVP7ZY4.js} +1 -1
  184. package/dist/{chunk-436FZ4KG.js → chunk-UICJ2KLJ.js} +1 -1
  185. package/dist/{chunk-QWZJ5QDO.js → chunk-UMNCM4RJ.js} +1 -1
  186. package/dist/{chunk-LNHBZEDC.js → chunk-UWPG5MWM.js} +1 -1
  187. package/dist/{chunk-MJKRJGER.js → chunk-V3OZJO7Y.js} +1 -1
  188. package/dist/{chunk-ZKPY3AXW.js → chunk-VE4HLIGA.js} +1 -1
  189. package/dist/{chunk-K3OSK6PB.js → chunk-W2HRX3DR.js} +1 -1
  190. package/dist/{chunk-B7JLM3IX.js → chunk-W54BX6HC.js} +1 -1
  191. package/dist/{chunk-IZ65ZPWY.js → chunk-W5HFUBXD.js} +1 -1
  192. package/dist/{chunk-GRO6DLN3.js → chunk-WEJR2V7R.js} +1 -1
  193. package/dist/{chunk-A4BB6GLN.js → chunk-X3A4QPA3.js} +1 -1
  194. package/dist/{chunk-G2KTWFMU.js → chunk-X52YIWGG.js} +1 -1
  195. package/dist/{chunk-UEPJ26X2.js → chunk-X6FCXBXU.js} +1 -1
  196. package/dist/{chunk-LXM7VHYN.js → chunk-X7S7IGCV.js} +1 -1
  197. package/dist/{chunk-UNWPBMVM.js → chunk-XCUF5AVM.js} +1 -1
  198. package/dist/{chunk-FPVGA6XT.js → chunk-XHFU5TGS.js} +1 -1
  199. package/dist/{chunk-ZRDX2ARO.js → chunk-XNXJXGVB.js} +2 -2
  200. package/dist/{chunk-JRSEAXFE.js → chunk-XZ6J3Y2W.js} +1 -1
  201. package/dist/{chunk-JGRXMTME.js → chunk-YDB72F4K.js} +1 -1
  202. package/dist/{chunk-7DFBOVUB.js → chunk-YJAQZMJT.js} +1 -1
  203. package/dist/{chunk-GYDJO32R.js → chunk-YO6SNXBJ.js} +1 -1
  204. package/dist/{chunk-RLOJH5O6.js → chunk-Z24SD2EJ.js} +1 -1
  205. package/dist/{chunk-ENG2UTMX.js → chunk-Z36KVIRR.js} +1 -1
  206. package/dist/{chunk-PTISAIZW.js → chunk-Z6SI7YNV.js} +1 -1
  207. package/dist/{chunk-6NFOH4AC.js → chunk-ZAQGIC33.js} +1 -1
  208. package/dist/{chunk-AIGQCMGY.js → chunk-ZCL7XIVS.js} +1 -1
  209. package/dist/{chunk-ORNVIEUA.js → chunk-ZDCXWEQG.js} +1 -1
  210. package/dist/{chunk-WX4VGH5Q.js → chunk-ZDQYGLCZ.js} +1 -1
  211. package/dist/{chunk-6TNLITJO.js → chunk-ZHAMVLQZ.js} +1 -1
  212. package/dist/{chunk-H4KPNGY4.js → chunk-ZMWTRXFH.js} +1 -1
  213. package/dist/{chunk-GET4DINR.js → chunk-ZO3ZAMUU.js} +1 -1
  214. package/dist/{chunk-GI2JPIX5.js → chunk-ZZZGTDYE.js} +1 -1
  215. package/dist/commands-R5AYK6XM.js +2 -0
  216. package/dist/{committer-26UZDYSA.js → committer-UO3B3S5Y.js} +1 -1
  217. package/dist/{config-B472DZSR.js → config-YMHI3H3Y.js} +1 -1
  218. package/dist/cover-cmd-DVQIGFDY.js +2 -0
  219. package/dist/{credentials-TLT3RQOO.js → credentials-BCR73VGS.js} +1 -1
  220. package/dist/{deps-bundle-CMTIWBS5.js → deps-bundle-6WLX44OA.js} +1 -1
  221. package/dist/{deps-resolve-XLFZK74A.js → deps-resolve-DSAKPZ3T.js} +1 -1
  222. package/dist/{design-chat-I7X3QDDY.js → design-chat-YUI2JPO6.js} +1 -1
  223. package/dist/design-committer-7YIPFKMO.js +2 -0
  224. package/dist/design-headless-KIP6R7UV.js +2 -0
  225. package/dist/{design-remote-UDC5FP45.js → design-remote-XMSHDDUX.js} +2 -2
  226. package/dist/device-env-K7J5NN66.js +2 -0
  227. package/dist/dispatch-BV6XMCN3.js +2 -0
  228. package/dist/{doctor-UHFCIM4B.js → doctor-PGTNOMSP.js} +1 -1
  229. package/dist/{docx-convert-N4KMLLKO.js → docx-convert-DO5AQYD3.js} +1 -1
  230. package/dist/{dossier-6KMKEIXV.js → dossier-5XKNAK6Q.js} +1 -1
  231. package/dist/evidence-RO3RDZXO.js +2 -0
  232. package/dist/evidence-presentation-LSFOZGLH.js +2 -0
  233. package/dist/evolve-cmd-U2ALVGMT.js +2 -0
  234. package/dist/evolve-remote-K2MCCVMM.js +2 -0
  235. package/dist/{explain-cmd-R67B4YR3.js → explain-cmd-KNDORU2D.js} +1 -1
  236. package/dist/{explain-cmd-235TY7QX.js → explain-cmd-UWK5YVXG.js} +1 -1
  237. package/dist/explore-S2BGQUIF.js +2 -0
  238. package/dist/{explore-context-tty-YXEFT32U.js → explore-context-tty-WJHUSP3A.js} +1 -1
  239. package/dist/{explore-entry-V6L5FSP4.js → explore-entry-3EX2T3NS.js} +4 -4
  240. package/dist/{explore-live-N5VBLBUI.js → explore-live-TRY5A2ME.js} +1 -1
  241. package/dist/{explore-run-tty-ZZQ33GNA.js → explore-run-tty-ZV5XFKZA.js} +2 -2
  242. package/dist/{extract-bind-BTINHHE5.js → extract-bind-TXUBMK3T.js} +3 -3
  243. package/dist/extract-chat-VPYDGQKO.js +2 -0
  244. package/dist/{extract-cmd-45OZETCM.js → extract-cmd-YUOYMVF5.js} +2 -2
  245. package/dist/extract-headless-UWTAPOET.js +2 -0
  246. package/dist/{feeder-L55TH2NC.js → feeder-NGWIPZ26.js} +1 -1
  247. package/dist/folder-flags-WV7UV3JG.js +2 -0
  248. package/dist/gaps-cmd-PFV3FZCM.js +3 -0
  249. package/dist/gate-7ALXLCNB.js +2 -0
  250. package/dist/gate-NB5CJMTN.js +2 -0
  251. package/dist/{generate-headless-DAH3HHRQ.js → generate-headless-KMBBZTLS.js} +2 -2
  252. package/dist/hold-passthrough-JGHWMYDM.js +2 -0
  253. package/dist/{impact-cmd-3VFJAKYK.js → impact-cmd-PW33L5RF.js} +2 -2
  254. package/dist/index.js +4154 -190
  255. package/dist/ingest-ZHHHBUXR.js +2 -0
  256. package/dist/{ingest-cmd-YSEH5EPU.js → ingest-cmd-MXYILQLV.js} +3 -3
  257. package/dist/ingest-remote-2EEJP6ML.js +2 -0
  258. package/dist/install-7J34AYB6.js +2 -0
  259. package/dist/{interactive-bind-P3GTFIZM.js → interactive-bind-FDWJUTI6.js} +4 -4
  260. package/dist/{interactive-remote-PBRQHTAF.js → interactive-remote-O2Q2FNOH.js} +1 -1
  261. package/dist/lane-CNGO7LH5.js +2 -0
  262. package/dist/lattice-auth-TXNDLHM6.js +2 -0
  263. package/dist/{lifecycle-cmd-PUNFWKV5.js → lifecycle-cmd-GFHDBRXX.js} +1 -1
  264. package/dist/{list-cmd-RD7YBF4S.js → list-cmd-RR75PMPE.js} +1 -1
  265. package/dist/{list-commands-UZELZAB3.js → list-commands-3QGZWJ5P.js} +1 -1
  266. package/dist/{list-remote-KGKXPCQA.js → list-remote-AA3VSWOI.js} +1 -1
  267. package/dist/{locks-cmd-LXZ6I4QG.js → locks-cmd-AZKCSGHI.js} +1 -1
  268. package/dist/{logical-ids-D5PFYY4C.js → logical-ids-74PLU3VR.js} +1 -1
  269. package/dist/login-flow-ZQ6UFTS2.js +2 -0
  270. package/dist/{maintenance-cmd-WRWBCP3R.js → maintenance-cmd-OHGVARQ2.js} +1 -1
  271. package/dist/{mobile-prompts-Z7NQHRGP.js → mobile-prompts-FZRKLLTN.js} +1 -1
  272. package/dist/{objective-variable-gate-3Z7DNVVC.js → objective-variable-gate-V5HHFOUS.js} +1 -1
  273. package/dist/{onboarding-ZP4XDYEO.js → onboarding-NXGMV3VG.js} +1 -1
  274. package/dist/open-provider-XDJKT3W3.js +2 -0
  275. package/dist/pdf-convert-YB6PJFMI.js +2 -0
  276. package/dist/persist-recorded-session-INFN4JZT.js +3 -0
  277. package/dist/phase-seed-ZZSJME7M.js +2 -0
  278. package/dist/pipeline-MVZRI6YZ.js +2 -0
  279. package/dist/{policy-commands-TY6WOR73.js → policy-commands-3YJ6YCDN.js} +1 -1
  280. package/dist/{prepare-target-EVL2QSXA.js → prepare-target-DII5WZCX.js} +1 -1
  281. package/dist/{pull-cmd-QJQANBAW.js → pull-cmd-XZN53XFZ.js} +1 -1
  282. package/dist/{pull-route-AIOTLA3D.js → pull-route-R33BVADE.js} +1 -1
  283. package/dist/readmodel-TRV4E3MW.js +2 -0
  284. package/dist/real-device-run-DGENHGUV.js +2 -0
  285. package/dist/{reconcile-cmd-IJTQAJZX.js → reconcile-cmd-KFPRCCJB.js} +4 -4
  286. package/dist/reconcile-deps-UDQBWSLE.js +2 -0
  287. package/dist/{reconcile-remote-23D6SXXT.js → reconcile-remote-6WISFGRG.js} +2 -2
  288. package/dist/{recording-banner-MNRMMEX4.js → recording-banner-XOX2CDCF.js} +1 -1
  289. package/dist/registry-NV3EMDMK.js +2 -0
  290. package/dist/remote-entry-BCTFT643.js +2 -0
  291. package/dist/{remote-mode-AFNCN6EE.js → remote-mode-4HN27MD4.js} +1 -1
  292. package/dist/{remote-words-RCNFI2TQ.js → remote-words-LFDYKIZ7.js} +1 -1
  293. package/dist/{require-project-folder-7UH43GHI.js → require-project-folder-ZK4JJCDB.js} +1 -1
  294. package/dist/{resolve-run-intent-XEWFYMGN.js → resolve-run-intent-LYLVNNDZ.js} +1 -1
  295. package/dist/{resolver-QMPX6RBR.js → resolver-RMHGGYRP.js} +1 -1
  296. package/dist/revert-QKHPCRT6.js +2 -0
  297. package/dist/{review-cmd-2OECKNL5.js → review-cmd-UGF2FC5Y.js} +1 -1
  298. package/dist/run-CSYGVV3D.js +2 -0
  299. package/dist/run-YUHHD54J.js +2 -0
  300. package/dist/{run-channel-63SVP5OI.js → run-channel-IIIYXOIW.js} +1 -1
  301. package/dist/run-remote-BGKQDAOA.js +2 -0
  302. package/dist/{run-startup-gate-USQFSW47.js → run-startup-gate-4XE73OON.js} +1 -1
  303. package/dist/run-test-md-G6U3RU2Q.js +19 -0
  304. package/dist/session-worker.js +2 -2
  305. package/dist/{sessions-CFV7FOIT.js → sessions-NH2EG7BP.js} +1 -1
  306. package/dist/{sessions-cmd-LQ2LZQOC.js → sessions-cmd-CABAX7BO.js} +2 -2
  307. package/dist/{sessions-remote-H7CQST42.js → sessions-remote-Y4FTZL7Y.js} +1 -1
  308. package/dist/{skill-installer-LKYY6XFJ.js → skill-installer-FS2AV7GX.js} +1 -1
  309. package/dist/spawner-MQ4XEHIX.js +2 -0
  310. package/dist/{store-KM5MG3XB.js → store-PLKJZTGC.js} +1 -1
  311. package/dist/store-choice-UAB6Z4AL.js +2 -0
  312. package/dist/{store-guard-34GG2TW2.js → store-guard-DUN2X3SR.js} +1 -1
  313. package/dist/{store-site-ZSFINU6C.js → store-site-K5NHLI7D.js} +1 -1
  314. package/dist/stream-warnings-GM7YEOVG.js +2 -0
  315. package/dist/sync-cmd-AGTOGPYM.js +2 -0
  316. package/dist/{sync-setup-QQXYO6R4.js → sync-setup-4KIY3PDO.js} +1 -1
  317. package/dist/tcg-generate-CUY4AZ2V.js +2 -0
  318. package/dist/testmd-actions-UD6PAWUX.js +2 -0
  319. package/dist/{testmd-sync-PQ4GFKHB.js → testmd-sync-EEJ7GPLR.js} +1 -1
  320. package/dist/token-refresh-K6PVBBFE.js +2 -0
  321. package/dist/{trust-gate-AT2XBWN4.js → trust-gate-674C2NZS.js} +1 -1
  322. package/dist/{turn-preflight-LHYLRL7G.js → turn-preflight-R4PU6NYY.js} +1 -1
  323. package/dist/{use-case-ref-NA3IXGQW.js → use-case-ref-44BPIP4N.js} +1 -1
  324. package/dist/{validate-basic-3DX3MMC7.js → validate-basic-3JZRZL45.js} +1 -1
  325. package/dist/{variable-receipt-BXSZO36E.js → variable-receipt-7PRKDTRJ.js} +1 -1
  326. package/dist/verdicts-PVB7TV5S.js +2 -0
  327. package/dist/{version-check-OV6AOVED.js → version-check-IY3YSQIP.js} +1 -1
  328. package/dist/{view-cmd-QDKBBNIU.js → view-cmd-WUIGTRFX.js} +1 -1
  329. package/dist/{walk-session-BAYYPIKN.js → walk-session-EH7227WR.js} +1 -1
  330. package/dist/with-telemetry-7JMZUBUZ.js +2 -0
  331. package/package.json +16 -16
  332. package/dist/ChatSurface-XUV3EQPZ.js +0 -2
  333. package/dist/EvidenceViewOffer-EIANIYN7.js +0 -2
  334. package/dist/FolderPicker-XOA7FTHF.js +0 -2
  335. package/dist/InfoBox-OBH7SUGC.js +0 -2
  336. package/dist/ProjectPicker-6KRLKV4U.js +0 -2
  337. package/dist/SaveSessionPrompt-J2OPDEOO.js +0 -2
  338. package/dist/SingleShotApp-QI4B2TSL.js +0 -2
  339. package/dist/TestMdRunView-I4MV54FB.js +0 -2
  340. package/dist/TestrunEvidenceTable-WEIUSW3E.js +0 -2
  341. package/dist/bridge-SDEP7Y33.js +0 -2
  342. package/dist/chat-committer-FM5NG46O.js +0 -2
  343. package/dist/chat-controller-FWFQVZTB.js +0 -2
  344. package/dist/child-H2YSDFCG.js +0 -2
  345. package/dist/chunk-34R7BNZ2.js +0 -2
  346. package/dist/chunk-5T6II7VN.js +0 -7
  347. package/dist/chunk-KF4DKXSS.js +0 -2
  348. package/dist/chunk-NOFJXCYP.js +0 -5
  349. package/dist/chunk-SB6P5EQH.js +0 -2
  350. package/dist/commands-QOORPTSI.js +0 -2
  351. package/dist/cover-cmd-3VO6QC5Y.js +0 -2
  352. package/dist/design-committer-Y7R56RFZ.js +0 -2
  353. package/dist/design-headless-HUQOXLZB.js +0 -2
  354. package/dist/device-env-MMGISNHN.js +0 -2
  355. package/dist/dispatch-P2445PUU.js +0 -2
  356. package/dist/evidence-M3JTOJNL.js +0 -2
  357. package/dist/evidence-presentation-DV3DRB4S.js +0 -2
  358. package/dist/evolve-cmd-K3JXACMN.js +0 -2
  359. package/dist/evolve-remote-CUDVV2O2.js +0 -2
  360. package/dist/explore-UDD5FHXW.js +0 -2
  361. package/dist/extract-chat-ABZ5S7UU.js +0 -2
  362. package/dist/extract-headless-ALEFAMVS.js +0 -2
  363. package/dist/folder-flags-HTKJCXKB.js +0 -2
  364. package/dist/gaps-cmd-ROGQWK5X.js +0 -3
  365. package/dist/gate-QA5J7UZA.js +0 -2
  366. package/dist/gate-XFFFX5ZF.js +0 -2
  367. package/dist/hold-passthrough-K5PP26CP.js +0 -2
  368. package/dist/ingest-S5R736ZV.js +0 -2
  369. package/dist/ingest-remote-C6AP2Q7E.js +0 -2
  370. package/dist/install-B26Y2NU4.js +0 -2
  371. package/dist/lane-7IEAE6AC.js +0 -2
  372. package/dist/lattice-auth-7EL4ET3P.js +0 -2
  373. package/dist/login-flow-CHLGQGHK.js +0 -2
  374. package/dist/open-provider-U26BBVUE.js +0 -2
  375. package/dist/pdf-convert-LMKOKLXT.js +0 -2
  376. package/dist/persist-recorded-session-4IRYG5CJ.js +0 -3
  377. package/dist/phase-seed-2H6OXZXT.js +0 -2
  378. package/dist/pipeline-U7D25NST.js +0 -2
  379. package/dist/readmodel-KXCFPL2M.js +0 -2
  380. package/dist/real-device-run-QODMDUXF.js +0 -2
  381. package/dist/reconcile-deps-2CTIFXDR.js +0 -2
  382. package/dist/registry-MZYBLEW2.js +0 -2
  383. package/dist/remote-entry-DW2J56N4.js +0 -2
  384. package/dist/revert-37346WLE.js +0 -2
  385. package/dist/run-JWOHNWA3.js +0 -2
  386. package/dist/run-QFJ6ZRVD.js +0 -2
  387. package/dist/run-remote-66QTUQ2M.js +0 -2
  388. package/dist/run-test-md-7DRWCSQE.js +0 -19
  389. package/dist/spawner-C7NLLM4F.js +0 -2
  390. package/dist/store-choice-4J2NN6OQ.js +0 -2
  391. package/dist/stream-warnings-N4KVVWXV.js +0 -2
  392. package/dist/sync-cmd-3CHSWWWW.js +0 -2
  393. package/dist/tcg-generate-IPD5FQUW.js +0 -2
  394. package/dist/testmd-actions-V7P7BMKE.js +0 -2
  395. package/dist/token-refresh-LR33BKAB.js +0 -2
  396. package/dist/verdicts-7GKZEDHV.js +0 -2
  397. package/dist/with-telemetry-62LW4VFI.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as bt}from"./chunk-LX2I4JEH.js";import{a as St}from"./chunk-PCDIEYV6.js";import{a as gt,b as mt,d as ht,e as _t}from"./chunk-KDR662D2.js";import{F as ct,H as dt,L as at,M as ft,P as le,W as ut,a as st,b as Ie,ba as pt,f as nt,g as it,oa as X,pa as lt,r as ot,v as rt}from"./chunk-Z777GGHB.js";import{d as pe,e as W,f as _,g,h as Ze,i as et,j as tt}from"./chunk-KU3YHPWZ.js";var Pt=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/,Lt=new Set([g.EXERCISES,g.VERIFIES,g.SCOPED_TO]),Y=n=>({record:null,errors:n,minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}});function J(n){return n.toLowerCase().trim().replace(/\s+/g," ")}function yt(n,E,t,l,f){return y=>{if(!f||!W.has(String(y.kind))||!(y.kind==="unmeasurable"||l==="tests")||y.ref&&(t.scenarios??[]).some(T=>T.temp_ref===y.ref))return!0;let O=y.ref?n.resolve(y.ref):null;return!!(O&&n.nodeLabel.get(O.cid)===_.SCENARIO&&!n.superseded.has(n.tipOf(O.cid))&&n.edgesFrom(n.tipOf(O.cid)).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===E))}}function Ot(n){let E=new Set;return n.sections.scenarios?.length&&E.add(_.SCENARIO),n.sections.tests?.length&&E.add(_.TEST),n.gen8&&(n.sections.tests?.length||n.phase==="tests"&&n.gapsToMint.some(t=>W.has(String(t.kind))))&&(E.add(_.TEST),E.add(_.GAP)),E}function Et(n,E,t){let l=new Set,f=[];for(let y of E)n.superseded.has(y)||(t.has(n.nodeLabel.get(y)??"")?l.add(y):f.push(y));return{retired:l,remaining:f}}function ss(n,E){let t=n.tokenAt(E.seq),l=t===null?null:n.intentOf(t);if(l===null)return null;let f=l.args,y=l.pins.forceScope;if(l.verb!=="design"||f.forceScope==null||!Array.isArray(y)||!f.sections||!f.ucRef)return;let O=E.seq>1?n.tokenAt(E.seq-1):null;if(O===null)return null;let T=ft(n,{token:O}),F=le(T,f.ucRef);if(!F.ok)return null;let R=pe(f.templateVersion)>=8,C=(f.sections.gaps??[]).filter(yt(T,F.cid,f.sections,f.phase,R));return Et(T,y,Ot({sections:f.sections,phase:f.phase,gen8:R,gapsToMint:C})).remaining}function Ft(n,E,t={}){let l=le(n,E);if(!l.ok)return[];let f=new Set,y=new Set;for(let{cid:O}of n.byLabel(_.SCENARIO))if(!n.superseded.has(O)&&n.edgesFrom(O).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===l.cid)){f.add(O),y.add(O),y.add(n.tipOf(O));for(let T of n.edgesInto(O))T.type!==g.AUTOMATES||n.superseded.has(T.src)||f.add(T.src)}if(t.blockerGaps){let O=new Set([l.cid,n.tipOf(l.cid)]);for(let{cid:T,content:F}of n.byLabel(_.GAP)){if(n.superseded.has(T)||n.trust.get(T)==="archived"||!W.has(String(F.kind??"")))continue;let R=typeof F.uc=="string"?F.uc:"";if(!O.has(R)&&!O.has(n.tipOf(R)))continue;let C=F.ref,k=typeof C=="string"&&C?n.resolve(C):null;k&&(y.has(k.cid)||y.has(n.tipOf(k.cid)))&&f.add(T)}}return[...f]}function ns(n){let{store:E,graph:t,sections:l,by:f}=n,y=n.engine??"design@1",O=E.head(),T=E.serialize(O);if(!E.sameToken(E.parse(t.latestHash),O))return Y([{code:"STALE_BASIS",detail:`graph opened at ${String(t.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]);let F=le(t,n.ucRef);if(!F.ok)return Y([{code:"UNKNOWN_UC",detail:`${n.ucRef} is not a live use-case`}]);let R=F.cid,C={ucRef:R,automates:{},verifies:{},reuses:{},scope:{},depends_on:{},exercises:[],scoped_to_repoints:[],judgements:[],body_tags:{},forceScope:[]},k=[],Ae=/^design@(\d+)$/.exec(n.templateVersion??""),Q=pe(n.templateVersion)>=8,Ne=yt(t,R,l,n.phase,Q),te=(l.gaps??[]).filter(Ne),Tt=Ae!==null&&Number.parseInt(Ae[1],10)>=3,De=new Map,$t=(e,i)=>{let s=De.get(e.source_cid);if(s===void 0){let p=rt(E,t,e.source_cid);s=p?St(p.toString("utf8")):null,De.set(e.source_cid,s)}if(s===null)return k.push({code:"CITE_UNVERIFIED",detail:`${i}: source ${e.source_id} (${e.source_cid.slice(0,19)}) has no citable text to verify against`}),!1;let u=ct(t.mediaOf(e.source_cid),e,s);if(u.length>0){for(let p of u)k.push({code:"CITE_UNVERIFIED",detail:`${i}: ${p.code}: ${p.detail}`});return!1}return!0},xe=pe(n.templateVersion)>=9,kt=(e,i)=>{let s=e.source_cid?t.mediaOf(e.source_cid):void 0;if(!e.source_cid||!t.hasNode(e.source_cid)&&s==null)return{code:"CITE_SOURCE_UNKNOWN",detail:`${i}: there is no source ${e.source_id} in this store to cite \u2014 cite a source the use case reads, by its id`};if(s?.plugin?.cites_deep===!0)return null;let u=s?.format==="plugin"?`version ${e.source_cid.slice(0,19)} of ${e.source_id} was stored before its plugin allowed citations below the use case (or by a plugin that does not allow them) \u2014 re-ingest it, or cite it at the use case`:`${e.source_id} is not a source-plugin source that allows citations below the use case \u2014 cite it at the use case instead, or leave this item's cites out`;return{code:"CITE_DEPTH_UNSUPPORTED",detail:`${i}: ${u}`}},ge=(e,i,s,u,p)=>{for(let m of i??[]){if(u){let a=kt(m,`${s}.cite`);if(a){k.push(a);continue}}if(Tt&&!$t(m,`${s}.cite`))continue;let x={source_id:m.source_id,source_cid:m.source_cid,anchor:m.anchor,...m.quote?{quote:m.quote}:{}},G=Ct.one(e,x,p);if("fault"in G){k.push(G.fault);continue}B(g.DERIVES,m.source_cid,e,G.props,`${s}.cite`)}},vt=()=>xe?bt(t,R):[],P=[],M=[],N=[],me=[],re=[],w={},q={},he={},L=[],Z=[],H=[],Pe=new Set,_e=[],ce=new Set,Le=n.forceScope??(n.force?Ft(t,n.ucRef,{blockerGaps:Q}):[]);C.forceScope=[...Le];let{retired:U,remaining:Fe}=Et(t,Le,Ot({sections:l,phase:n.phase,gen8:Q,gapsToMint:te})),V=new Set,be=e=>!t.superseded.has(e)&&(!U.has(e)||V.has(e)),j=(e,i,s)=>{if(w[e])return w[e];let u=t.resolve(e),p=u?be(u.cid)?u.cid:t.tipOf(u.cid):null;return!u||!p||!be(p)?(k.push({code:"UNKNOWN_REF",detail:`${i}: '${e}' is neither in this payload nor a live committed node`}),null):s&&t.nodeLabel.get(p)!==s?(k.push({code:"ILLEGAL_EDGE",detail:`${i}: '${e}' is a ${t.nodeLabel.get(p)}, expected ${s}`}),null):p},Rt=(e,i,s,u)=>{if(t.nameOf.has(i)){q[u]=t.nameOf.get(i);return}let p=lt(e,m=>Pe.has(m),t.names.keys());p!==null&&(Pe.add(p),me.push({cid:i,slug:p,by:f}),q[u]=p)},de=(e,i,s,u)=>{for(let m of Ze(e,s))k.push({code:m.code,detail:`${i}: ${m.detail}`});let p=st(e,s);if(t.hasNode(p)&&!t.superseded.has(p))return U.has(p)&&V.add(p),w[i]=p,p;if(t.hasNode(p)&&t.superseded.has(p)){let m=X(t.nameOf.get(p)??p),x=t.tipOf(p),G=x!==p&&!t.superseded.has(x);return k.push(G?{code:"NODE_SUPERSEDED",detail:`${i}: '${u}' is ${m} as it was before it was replaced by ${X(t.nameOf.get(x)??x)} \u2014 refer to ${X(t.nameOf.get(x)??x)} to keep it, or send it changed`}:{code:"NODE_TOMBSTONED",detail:`${i}: '${u}' is ${m}, which was retired \u2014 a retired item can't come back as it was; send it changed (it is then a new item), or leave it out`}),null}return P.push({cid:p,label:e,content:s}),w[i]=p,Rt(e,p,u,i),p},Ct=it(nt(E,t)),B=(e,i,s,u,p)=>{let m=Ie(e,i,s,u);if(t.edgesFrom(i).some(d=>d.ecid===m&&!t.superseded.has(d.ecid))){e===g.AUTOMATES&&ce.add(s);return}if(t.superseded.has(m)){k.push({code:"EDGE_RETRACTED",detail:`${p}: this ${e} edge was retracted (${m}) \u2014 retraction is terminal for commits. Add a NEW relationship (different endpoint or props), redesign, or revert the retracting record`});return}if(Lt.has(e)&&t.hasNode(i)&&!t.superseded.has(i)&&t.hasNode(s)&&!t.superseded.has(s)){let d=t.displayNameOf(s);for(let c of t.edgesFrom(i))c.type!==e||c.dst===s||t.superseded.has(c.ecid)||!t.superseded.has(c.dst)||t.tipOf(c.dst)!==s||d===null||t.displayNameOf(c.dst)!==d||N.some(v=>v.kind==="edge"&&v.ecid===c.ecid)||N.push({kind:"edge",ecid:c.ecid,reason:`re-pinned onto ${s} (the same link to its live version) by ${f.id}`,by:f})}let x=t.nodeLabel.get(i)??P.find(d=>d.cid===i)?.label??"(unknown)",G=t.nodeLabel.get(s)??P.find(d=>d.cid===s)?.label??"(unknown)";for(let d of tt(e,x,G,u))k.push({code:d.code,detail:`${p}: ${d.detail}`});let a=ut(t,e,i,s,_e);if(a){k.push({code:a.code,detail:`${p}: ${a.detail}`});return}if(e===g.BELONGS_TO||e===g.SCOPED_TO){let d=dt(t,{type:e,src:i,dst:s},{pending:_e,retracted:new Set(N.flatMap(c=>c.kind==="edge"?[c.ecid]:[])),freed:new Set([...U].filter(c=>!V.has(c)))},p);if(d){k.push(d);return}}if(e===g.AUTOMATES){if(ce.has(s)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: two automates onto ${s} in one record (strict 1:1)`});return}if(ce.add(s),!U.has(s)||V.has(s)){let d=h=>U.has(h)&&!V.has(h);if(t.edgesFrom(i).some(h=>h.type===g.AUTOMATES&&h.dst!==s&&!t.superseded.has(h.dst)&&!d(h.dst))&&t.hasNode(i)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates from ${i} already has a live edge \u2014 supersede it first`});return}if(t.edgesInto(s).some(h=>h.type===g.AUTOMATES&&h.src!==i&&!t.superseded.has(h.src)&&!d(h.src))){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates onto ${s} already has a live edge \u2014 strict 1:1, supersede it first`});return}}}M.push({ecid:Ie(e,i,s,u),type:e,src:i,dst:s,props:u}),_e.push({src:i,dst:s,type:e})},Se=new Set;for(let e of te)e.kind==="budget-evicted"&&e.ref&&Se.add(e.ref);let K=[];for(let[e,i]of(l.gaps??[]).entries()){if(Ne(i))continue;let s=i.temp_ref??i.ref??"gap";K.push(e),L.push(`${s} not committed: a ${i.kind} gap stands in for a scenario's test \u2014 ref must be that scenario's committed id (sc-N) or its temp_ref in this payload; got ${i.ref?`'${i.ref}'`:"no ref"}`)}let Me=()=>{for(let e of te){let i=e.temp_ref??e.ref??"gap",s=e.question;if(!s||typeof s!="object"||!s.header||!Array.isArray(s.options)||s.options.length===0||!Number.isInteger(s.recommended_index)){k.push({code:"GAP_QUESTION_INCOMPLETE",detail:`${i}: design gaps carry a full ranked question object (header/options/recommended_index)`});continue}let u=e.ref?Q?w[e.ref]??e.ref:e.ref:void 0,p={kind:e.kind,question:s,derived:!0,uc:R,...e.risk?{risk:e.risk}:{},...e.risk_rationale?{risk_rationale:e.risk_rationale}:{},...e.text?{text:e.text}:{},...u?{ref:u}:{}};de(_.GAP,i,p,String(s.header))}};Q||Me();let ae=n.lineage===2,D={reuseOf:{seen:0,honored:0,linked:0,unresolved:0},byPair:0,byCriteria:0,byTitle:0},fe=[],ye={},Oe=new Map;if(ae)for(let e of l.scenarios??[]){if(typeof e.reuse_of!="string"||!e.reuse_of)continue;D.reuseOf.seen+=1;let i=t.resolve(e.reuse_of),s=i?t.superseded.has(i.cid)?t.tipOf(i.cid):i.cid:null;if(!(s!==null&&!t.superseded.has(s)&&t.nodeLabel.get(s)===_.SCENARIO&&t.edgesFrom(s).some(p=>p.type===g.BELONGS_TO&&t.tipOf(p.dst)===R))){D.reuseOf.unresolved+=1,fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names no scenario of this use case \u2014 saved as a new scenario`);continue}Oe.set(e.temp_ref,s),ye[e.temp_ref]=s}let Ge=new Map;for(let{cid:e,content:i}of t.byLabel(_.SCENARIO))be(e)&&t.edgesFrom(e).some(s=>s.type===g.BELONGS_TO&&t.tipOf(s.dst)===R)&&Ge.set(J(String(i.title??"")),e);for(let e of l.scenarios??[]){let i=Oe.get(e.temp_ref);if(i!==void 0&&!U.has(i))if(t.edgesInto(i).some(m=>m.type===g.AUTOMATES&&!t.superseded.has(m.ecid)&&!t.superseded.has(m.src))&&(l.tests??[]).some(m=>m.automates===e.temp_ref))fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names a scenario that already has its test \u2014 saved as a new scenario`);else{w[e.temp_ref]=i;let m=t.displayNameOf(i);m&&(q[e.temp_ref]=m),D.reuseOf.linked+=1;continue}let s=Ge.get(J(e.title));if(s){k.push({code:"DUPLICATE_SCENARIO",detail:`${e.temp_ref}: '${e.title}' duplicates live scenario ${t.nameOf.get(s)??s} \u2014 exercise/link it instead (reuse before minting)`});continue}let u={title:e.title,intent:e.intent,case_type:e.case_type,derived:!0,...e.technique_notes?{technique_notes:e.technique_notes}:{},...e.description?{description:e.description}:{},...e.parameters?{parameters:e.parameters}:{},...e.tags?{tags:e.tags}:{}};de(_.SCENARIO,e.temp_ref,u,e.title)}for(let e of l.scenarios??[]){let i=w[e.temp_ref];if(i){B(g.BELONGS_TO,i,R,{},e.temp_ref);for(let s of e.depends_on??[]){let u=j(s,`${e.temp_ref}.depends_on`,_.SCENARIO);u&&((C.depends_on[e.temp_ref]??=[]).push(u),B(g.DEPENDS_ON,i,u,{},`${e.temp_ref}.depends_on`))}ge(i,e.cites,e.temp_ref,!0,M)}}for(let e of l.acs??[]){let i={text:e.text,kind:e.kind,risk:e.risk,derived:!0,...e.expected_answer?{expected_answer:e.expected_answer}:{},...e.measurable!==void 0?{measurable:e.measurable}:{}},s=de(_.AC,e.temp_ref,i,e.text);if(!s)continue;let u=e.scope?.type==="scenario"&&e.scope.ref?j(e.scope.ref,`${e.temp_ref}.scope`,_.SCENARIO):R;u&&u!==R&&(C.scope[e.temp_ref]=u),u&&!t.edgesFrom(s).some(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid))&&B(g.SCOPED_TO,s,u,{},`${e.temp_ref}.scope`),ge(s,e.cites,e.temp_ref,xe,M)}for(let e of l.exercises??[]){let i=j(e.scenario,"exercises.scenario",_.SCENARIO),s=j(e.ac,"exercises.ac",_.AC);!i||!s||(C.exercises.push({scenario:i,ac:s}),B(g.EXERCISES,i,s,{},`exercises ${e.scenario}\u2192${e.ac}`))}let Be=0;for(let e of l.scoped_to_repoints??[]){let i=j(e.ac,"scoped_to_repoints.ac",_.AC),s=j(e.to,"scoped_to_repoints.to");if(!i||!s)continue;C.scoped_to_repoints.push({ac:i,to:s});let u=t.edgesFrom(i).find(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid));if(u&&u.dst===s){Be+=1,L.push(`scoped_to_repoints ${e.ac}: already scoped to ${e.to} \u2014 no-op`);continue}u&&N.push({kind:"edge",ecid:u.ecid,reason:`re-scoped to ${e.to} by ${f.id}`,by:f}),B(g.SCOPED_TO,i,s,{},`scoped_to_repoints ${e.ac}`)}let Ue=new Map;if(n.finalizeTestBody)for(let[e,i]of t.nameOf)Ue.set(t.tipOf(e),i);let je=e=>t.nameOf.get(e)??Ue.get(t.tipOf(e))??null,Ee=e=>{if(w[e])return w[e];let i=t.resolve(e);return i?t.names.has(e)&&!t.superseded.has(i.cid)?i.cid:t.tipOf(i.cid):null},wt=e=>{let i=Ee(e);if(!i&&n.strict)throw new Error(`UNMAPPED_REF: '${e}' resolves to nothing on this graph`);return i?w[e]?q[e]??je(i):t.names.has(e)?e:je(i):null};Q&&Me();for(let e of l.tests??[]){for(let a of e.reuses??[])Se.has(a)&&k.push({code:"REUSES_EVICTED",detail:`${e.temp_ref}: reuses '${a}' which was budget-evicted \u2014 drop the edge; the dependent gap names the missing @import`});{let a=c=>c==="emulator"||c==="simulator"?c:"web",d=c=>{let v=(l.tests??[]).find(z=>z.temp_ref===c);if(v)return a(v.target);let h=t.resolve(c),b=h?t.getNode(t.tipOf(h.cid)??h.cid)?.content:void 0;if(typeof b?.target=="string")return a(String(b.target));let I=/^\s*\[mobile:\s*(emulator|simulator)\]/m.exec(String(b?.test_md_blob??""));return I?I[1]:"web"};for(let c of e.reuses??[]){let v=a(e.target),h=d(c);v!==h&&k.push({code:"REUSES_CROSS_SURFACE",detail:`${e.temp_ref}: reuses '${c}' which runs on ${h} while this test runs on ${v} \u2014 a test imports only same-surface units`})}}let i=e.test_md_blob,s=e.definitionId,u=e.objectives_blob;if(n.finalizeTestBody){let a;try{a=n.finalizeTestBody({temp_ref:e.temp_ref,test_md_blob:e.test_md_blob,verifies:e.verifies,reuses:e.reuses??[]},wt)}catch(d){return Y([{code:"FINALIZE_BODY",detail:`${e.temp_ref}: ${d instanceof Error?d.message:String(d)}`}])}a&&(i=a.test_md_blob,s=a.definitionId,u=a.objectives_blob??u,he[e.temp_ref]=s)}let p={title:e.title,check:e.check,definitionId:s,derived:!0,...e.config?{config:e.config}:{},...i?{test_md_blob:i}:{},...u?{objectives_blob:u}:{},...e.surface_required!==void 0?{surface_required:e.surface_required}:{},...e.target?{target:e.target}:{},...e.app&&e.target?{app:e.app}:{}},m=de(_.TEST,e.temp_ref,p,e.title);if(!m)continue;ge(m,e.cites,e.temp_ref,!0,M);let x=j(e.automates,`${e.temp_ref}.automates`,_.SCENARIO);x&&(C.automates[e.temp_ref]=x,B(g.AUTOMATES,m,x,{},`${e.temp_ref}.automates`)),C.verifies[e.temp_ref]=[];for(let a of e.verifies){let d=j(a,`${e.temp_ref}.verifies`,_.AC);d&&(C.verifies[e.temp_ref].push(d),B(g.VERIFIES,m,d,{},`${e.temp_ref}.verifies`))}C.reuses[e.temp_ref]=[];for(let a of e.reuses??[]){if(Se.has(a))continue;let d=j(a,`${e.temp_ref}.reuses`,_.TEST);d&&(C.reuses[e.temp_ref].push(d),B(g.REUSES,m,d,{},`${e.temp_ref}.reuses`))}for(let a of e.verifies){let d=Ee(a)??void 0;d&&(t.trust.get(d)??"derived")==="derived"&&!P.some(c=>c.cid===d)?(L.push(`${e.temp_ref}: verifies ${a} which is still DERIVED (unapproved) \u2014 committed anyway; approve it in chat or via review`),Z.push({test:e.temp_ref,criterion:d})):d&&w[a]===d&&(l.acs??[]).some(c=>c.temp_ref===a)&&(L.push(`${e.temp_ref}: verifies ${a} minted in this same record (unapproved) \u2014 committed anyway; approve it in chat`),Z.push({test:e.temp_ref,criterion:d}))}if(!String(e.test_md_blob??"").split(`
2
+ import{a as bt}from"./chunk-LX2I4JEH.js";import{a as St}from"./chunk-GEZVC4S3.js";import{a as gt,b as mt,d as ht,e as _t}from"./chunk-3KY7HHQU.js";import{F as ct,H as dt,L as at,M as ft,P as le,W as ut,a as st,b as Ie,ba as pt,f as nt,g as it,oa as X,pa as lt,r as ot,v as rt}from"./chunk-PI7OXS62.js";import{d as pe,e as W,f as _,g,h as Ze,i as et,j as tt}from"./chunk-KU3YHPWZ.js";var Pt=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/,Lt=new Set([g.EXERCISES,g.VERIFIES,g.SCOPED_TO]),Y=n=>({record:null,errors:n,minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}});function J(n){return n.toLowerCase().trim().replace(/\s+/g," ")}function yt(n,E,t,l,f){return y=>{if(!f||!W.has(String(y.kind))||!(y.kind==="unmeasurable"||l==="tests")||y.ref&&(t.scenarios??[]).some(T=>T.temp_ref===y.ref))return!0;let O=y.ref?n.resolve(y.ref):null;return!!(O&&n.nodeLabel.get(O.cid)===_.SCENARIO&&!n.superseded.has(n.tipOf(O.cid))&&n.edgesFrom(n.tipOf(O.cid)).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===E))}}function Ot(n){let E=new Set;return n.sections.scenarios?.length&&E.add(_.SCENARIO),n.sections.tests?.length&&E.add(_.TEST),n.gen8&&(n.sections.tests?.length||n.phase==="tests"&&n.gapsToMint.some(t=>W.has(String(t.kind))))&&(E.add(_.TEST),E.add(_.GAP)),E}function Et(n,E,t){let l=new Set,f=[];for(let y of E)n.superseded.has(y)||(t.has(n.nodeLabel.get(y)??"")?l.add(y):f.push(y));return{retired:l,remaining:f}}function ss(n,E){let t=n.tokenAt(E.seq),l=t===null?null:n.intentOf(t);if(l===null)return null;let f=l.args,y=l.pins.forceScope;if(l.verb!=="design"||f.forceScope==null||!Array.isArray(y)||!f.sections||!f.ucRef)return;let O=E.seq>1?n.tokenAt(E.seq-1):null;if(O===null)return null;let T=ft(n,{token:O}),F=le(T,f.ucRef);if(!F.ok)return null;let R=pe(f.templateVersion)>=8,C=(f.sections.gaps??[]).filter(yt(T,F.cid,f.sections,f.phase,R));return Et(T,y,Ot({sections:f.sections,phase:f.phase,gen8:R,gapsToMint:C})).remaining}function Ft(n,E,t={}){let l=le(n,E);if(!l.ok)return[];let f=new Set,y=new Set;for(let{cid:O}of n.byLabel(_.SCENARIO))if(!n.superseded.has(O)&&n.edgesFrom(O).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===l.cid)){f.add(O),y.add(O),y.add(n.tipOf(O));for(let T of n.edgesInto(O))T.type!==g.AUTOMATES||n.superseded.has(T.src)||f.add(T.src)}if(t.blockerGaps){let O=new Set([l.cid,n.tipOf(l.cid)]);for(let{cid:T,content:F}of n.byLabel(_.GAP)){if(n.superseded.has(T)||n.trust.get(T)==="archived"||!W.has(String(F.kind??"")))continue;let R=typeof F.uc=="string"?F.uc:"";if(!O.has(R)&&!O.has(n.tipOf(R)))continue;let C=F.ref,k=typeof C=="string"&&C?n.resolve(C):null;k&&(y.has(k.cid)||y.has(n.tipOf(k.cid)))&&f.add(T)}}return[...f]}function ns(n){let{store:E,graph:t,sections:l,by:f}=n,y=n.engine??"design@1",O=E.head(),T=E.serialize(O);if(!E.sameToken(E.parse(t.latestHash),O))return Y([{code:"STALE_BASIS",detail:`graph opened at ${String(t.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]);let F=le(t,n.ucRef);if(!F.ok)return Y([{code:"UNKNOWN_UC",detail:`${n.ucRef} is not a live use-case`}]);let R=F.cid,C={ucRef:R,automates:{},verifies:{},reuses:{},scope:{},depends_on:{},exercises:[],scoped_to_repoints:[],judgements:[],body_tags:{},forceScope:[]},k=[],Ae=/^design@(\d+)$/.exec(n.templateVersion??""),Q=pe(n.templateVersion)>=8,Ne=yt(t,R,l,n.phase,Q),te=(l.gaps??[]).filter(Ne),Tt=Ae!==null&&Number.parseInt(Ae[1],10)>=3,De=new Map,$t=(e,i)=>{let s=De.get(e.source_cid);if(s===void 0){let p=rt(E,t,e.source_cid);s=p?St(p.toString("utf8")):null,De.set(e.source_cid,s)}if(s===null)return k.push({code:"CITE_UNVERIFIED",detail:`${i}: source ${e.source_id} (${e.source_cid.slice(0,19)}) has no citable text to verify against`}),!1;let u=ct(t.mediaOf(e.source_cid),e,s);if(u.length>0){for(let p of u)k.push({code:"CITE_UNVERIFIED",detail:`${i}: ${p.code}: ${p.detail}`});return!1}return!0},xe=pe(n.templateVersion)>=9,kt=(e,i)=>{let s=e.source_cid?t.mediaOf(e.source_cid):void 0;if(!e.source_cid||!t.hasNode(e.source_cid)&&s==null)return{code:"CITE_SOURCE_UNKNOWN",detail:`${i}: there is no source ${e.source_id} in this store to cite \u2014 cite a source the use case reads, by its id`};if(s?.plugin?.cites_deep===!0)return null;let u=s?.format==="plugin"?`version ${e.source_cid.slice(0,19)} of ${e.source_id} was stored before its plugin allowed citations below the use case (or by a plugin that does not allow them) \u2014 re-ingest it, or cite it at the use case`:`${e.source_id} is not a source-plugin source that allows citations below the use case \u2014 cite it at the use case instead, or leave this item's cites out`;return{code:"CITE_DEPTH_UNSUPPORTED",detail:`${i}: ${u}`}},ge=(e,i,s,u,p)=>{for(let m of i??[]){if(u){let a=kt(m,`${s}.cite`);if(a){k.push(a);continue}}if(Tt&&!$t(m,`${s}.cite`))continue;let x={source_id:m.source_id,source_cid:m.source_cid,anchor:m.anchor,...m.quote?{quote:m.quote}:{}},G=Ct.one(e,x,p);if("fault"in G){k.push(G.fault);continue}B(g.DERIVES,m.source_cid,e,G.props,`${s}.cite`)}},vt=()=>xe?bt(t,R):[],P=[],M=[],N=[],me=[],re=[],w={},q={},he={},L=[],Z=[],H=[],Pe=new Set,_e=[],ce=new Set,Le=n.forceScope??(n.force?Ft(t,n.ucRef,{blockerGaps:Q}):[]);C.forceScope=[...Le];let{retired:U,remaining:Fe}=Et(t,Le,Ot({sections:l,phase:n.phase,gen8:Q,gapsToMint:te})),V=new Set,be=e=>!t.superseded.has(e)&&(!U.has(e)||V.has(e)),j=(e,i,s)=>{if(w[e])return w[e];let u=t.resolve(e),p=u?be(u.cid)?u.cid:t.tipOf(u.cid):null;return!u||!p||!be(p)?(k.push({code:"UNKNOWN_REF",detail:`${i}: '${e}' is neither in this payload nor a live committed node`}),null):s&&t.nodeLabel.get(p)!==s?(k.push({code:"ILLEGAL_EDGE",detail:`${i}: '${e}' is a ${t.nodeLabel.get(p)}, expected ${s}`}),null):p},Rt=(e,i,s,u)=>{if(t.nameOf.has(i)){q[u]=t.nameOf.get(i);return}let p=lt(e,m=>Pe.has(m),t.names.keys());p!==null&&(Pe.add(p),me.push({cid:i,slug:p,by:f}),q[u]=p)},de=(e,i,s,u)=>{for(let m of Ze(e,s))k.push({code:m.code,detail:`${i}: ${m.detail}`});let p=st(e,s);if(t.hasNode(p)&&!t.superseded.has(p))return U.has(p)&&V.add(p),w[i]=p,p;if(t.hasNode(p)&&t.superseded.has(p)){let m=X(t.nameOf.get(p)??p),x=t.tipOf(p),G=x!==p&&!t.superseded.has(x);return k.push(G?{code:"NODE_SUPERSEDED",detail:`${i}: '${u}' is ${m} as it was before it was replaced by ${X(t.nameOf.get(x)??x)} \u2014 refer to ${X(t.nameOf.get(x)??x)} to keep it, or send it changed`}:{code:"NODE_TOMBSTONED",detail:`${i}: '${u}' is ${m}, which was retired \u2014 a retired item can't come back as it was; send it changed (it is then a new item), or leave it out`}),null}return P.push({cid:p,label:e,content:s}),w[i]=p,Rt(e,p,u,i),p},Ct=it(nt(E,t)),B=(e,i,s,u,p)=>{let m=Ie(e,i,s,u);if(t.edgesFrom(i).some(d=>d.ecid===m&&!t.superseded.has(d.ecid))){e===g.AUTOMATES&&ce.add(s);return}if(t.superseded.has(m)){k.push({code:"EDGE_RETRACTED",detail:`${p}: this ${e} edge was retracted (${m}) \u2014 retraction is terminal for commits. Add a NEW relationship (different endpoint or props), redesign, or revert the retracting record`});return}if(Lt.has(e)&&t.hasNode(i)&&!t.superseded.has(i)&&t.hasNode(s)&&!t.superseded.has(s)){let d=t.displayNameOf(s);for(let c of t.edgesFrom(i))c.type!==e||c.dst===s||t.superseded.has(c.ecid)||!t.superseded.has(c.dst)||t.tipOf(c.dst)!==s||d===null||t.displayNameOf(c.dst)!==d||N.some(v=>v.kind==="edge"&&v.ecid===c.ecid)||N.push({kind:"edge",ecid:c.ecid,reason:`re-pinned onto ${s} (the same link to its live version) by ${f.id}`,by:f})}let x=t.nodeLabel.get(i)??P.find(d=>d.cid===i)?.label??"(unknown)",G=t.nodeLabel.get(s)??P.find(d=>d.cid===s)?.label??"(unknown)";for(let d of tt(e,x,G,u))k.push({code:d.code,detail:`${p}: ${d.detail}`});let a=ut(t,e,i,s,_e);if(a){k.push({code:a.code,detail:`${p}: ${a.detail}`});return}if(e===g.BELONGS_TO||e===g.SCOPED_TO){let d=dt(t,{type:e,src:i,dst:s},{pending:_e,retracted:new Set(N.flatMap(c=>c.kind==="edge"?[c.ecid]:[])),freed:new Set([...U].filter(c=>!V.has(c)))},p);if(d){k.push(d);return}}if(e===g.AUTOMATES){if(ce.has(s)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: two automates onto ${s} in one record (strict 1:1)`});return}if(ce.add(s),!U.has(s)||V.has(s)){let d=h=>U.has(h)&&!V.has(h);if(t.edgesFrom(i).some(h=>h.type===g.AUTOMATES&&h.dst!==s&&!t.superseded.has(h.dst)&&!d(h.dst))&&t.hasNode(i)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates from ${i} already has a live edge \u2014 supersede it first`});return}if(t.edgesInto(s).some(h=>h.type===g.AUTOMATES&&h.src!==i&&!t.superseded.has(h.src)&&!d(h.src))){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates onto ${s} already has a live edge \u2014 strict 1:1, supersede it first`});return}}}M.push({ecid:Ie(e,i,s,u),type:e,src:i,dst:s,props:u}),_e.push({src:i,dst:s,type:e})},Se=new Set;for(let e of te)e.kind==="budget-evicted"&&e.ref&&Se.add(e.ref);let K=[];for(let[e,i]of(l.gaps??[]).entries()){if(Ne(i))continue;let s=i.temp_ref??i.ref??"gap";K.push(e),L.push(`${s} not committed: a ${i.kind} gap stands in for a scenario's test \u2014 ref must be that scenario's committed id (sc-N) or its temp_ref in this payload; got ${i.ref?`'${i.ref}'`:"no ref"}`)}let Me=()=>{for(let e of te){let i=e.temp_ref??e.ref??"gap",s=e.question;if(!s||typeof s!="object"||!s.header||!Array.isArray(s.options)||s.options.length===0||!Number.isInteger(s.recommended_index)){k.push({code:"GAP_QUESTION_INCOMPLETE",detail:`${i}: design gaps carry a full ranked question object (header/options/recommended_index)`});continue}let u=e.ref?Q?w[e.ref]??e.ref:e.ref:void 0,p={kind:e.kind,question:s,derived:!0,uc:R,...e.risk?{risk:e.risk}:{},...e.risk_rationale?{risk_rationale:e.risk_rationale}:{},...e.text?{text:e.text}:{},...u?{ref:u}:{}};de(_.GAP,i,p,String(s.header))}};Q||Me();let ae=n.lineage===2,D={reuseOf:{seen:0,honored:0,linked:0,unresolved:0},byPair:0,byCriteria:0,byTitle:0},fe=[],ye={},Oe=new Map;if(ae)for(let e of l.scenarios??[]){if(typeof e.reuse_of!="string"||!e.reuse_of)continue;D.reuseOf.seen+=1;let i=t.resolve(e.reuse_of),s=i?t.superseded.has(i.cid)?t.tipOf(i.cid):i.cid:null;if(!(s!==null&&!t.superseded.has(s)&&t.nodeLabel.get(s)===_.SCENARIO&&t.edgesFrom(s).some(p=>p.type===g.BELONGS_TO&&t.tipOf(p.dst)===R))){D.reuseOf.unresolved+=1,fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names no scenario of this use case \u2014 saved as a new scenario`);continue}Oe.set(e.temp_ref,s),ye[e.temp_ref]=s}let Ge=new Map;for(let{cid:e,content:i}of t.byLabel(_.SCENARIO))be(e)&&t.edgesFrom(e).some(s=>s.type===g.BELONGS_TO&&t.tipOf(s.dst)===R)&&Ge.set(J(String(i.title??"")),e);for(let e of l.scenarios??[]){let i=Oe.get(e.temp_ref);if(i!==void 0&&!U.has(i))if(t.edgesInto(i).some(m=>m.type===g.AUTOMATES&&!t.superseded.has(m.ecid)&&!t.superseded.has(m.src))&&(l.tests??[]).some(m=>m.automates===e.temp_ref))fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names a scenario that already has its test \u2014 saved as a new scenario`);else{w[e.temp_ref]=i;let m=t.displayNameOf(i);m&&(q[e.temp_ref]=m),D.reuseOf.linked+=1;continue}let s=Ge.get(J(e.title));if(s){k.push({code:"DUPLICATE_SCENARIO",detail:`${e.temp_ref}: '${e.title}' duplicates live scenario ${t.nameOf.get(s)??s} \u2014 exercise/link it instead (reuse before minting)`});continue}let u={title:e.title,intent:e.intent,case_type:e.case_type,derived:!0,...e.technique_notes?{technique_notes:e.technique_notes}:{},...e.description?{description:e.description}:{},...e.parameters?{parameters:e.parameters}:{},...e.tags?{tags:e.tags}:{}};de(_.SCENARIO,e.temp_ref,u,e.title)}for(let e of l.scenarios??[]){let i=w[e.temp_ref];if(i){B(g.BELONGS_TO,i,R,{},e.temp_ref);for(let s of e.depends_on??[]){let u=j(s,`${e.temp_ref}.depends_on`,_.SCENARIO);u&&((C.depends_on[e.temp_ref]??=[]).push(u),B(g.DEPENDS_ON,i,u,{},`${e.temp_ref}.depends_on`))}ge(i,e.cites,e.temp_ref,!0,M)}}for(let e of l.acs??[]){let i={text:e.text,kind:e.kind,risk:e.risk,derived:!0,...e.expected_answer?{expected_answer:e.expected_answer}:{},...e.measurable!==void 0?{measurable:e.measurable}:{}},s=de(_.AC,e.temp_ref,i,e.text);if(!s)continue;let u=e.scope?.type==="scenario"&&e.scope.ref?j(e.scope.ref,`${e.temp_ref}.scope`,_.SCENARIO):R;u&&u!==R&&(C.scope[e.temp_ref]=u),u&&!t.edgesFrom(s).some(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid))&&B(g.SCOPED_TO,s,u,{},`${e.temp_ref}.scope`),ge(s,e.cites,e.temp_ref,xe,M)}for(let e of l.exercises??[]){let i=j(e.scenario,"exercises.scenario",_.SCENARIO),s=j(e.ac,"exercises.ac",_.AC);!i||!s||(C.exercises.push({scenario:i,ac:s}),B(g.EXERCISES,i,s,{},`exercises ${e.scenario}\u2192${e.ac}`))}let Be=0;for(let e of l.scoped_to_repoints??[]){let i=j(e.ac,"scoped_to_repoints.ac",_.AC),s=j(e.to,"scoped_to_repoints.to");if(!i||!s)continue;C.scoped_to_repoints.push({ac:i,to:s});let u=t.edgesFrom(i).find(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid));if(u&&u.dst===s){Be+=1,L.push(`scoped_to_repoints ${e.ac}: already scoped to ${e.to} \u2014 no-op`);continue}u&&N.push({kind:"edge",ecid:u.ecid,reason:`re-scoped to ${e.to} by ${f.id}`,by:f}),B(g.SCOPED_TO,i,s,{},`scoped_to_repoints ${e.ac}`)}let Ue=new Map;if(n.finalizeTestBody)for(let[e,i]of t.nameOf)Ue.set(t.tipOf(e),i);let je=e=>t.nameOf.get(e)??Ue.get(t.tipOf(e))??null,Ee=e=>{if(w[e])return w[e];let i=t.resolve(e);return i?t.names.has(e)&&!t.superseded.has(i.cid)?i.cid:t.tipOf(i.cid):null},wt=e=>{let i=Ee(e);if(!i&&n.strict)throw new Error(`UNMAPPED_REF: '${e}' resolves to nothing on this graph`);return i?w[e]?q[e]??je(i):t.names.has(e)?e:je(i):null};Q&&Me();for(let e of l.tests??[]){for(let a of e.reuses??[])Se.has(a)&&k.push({code:"REUSES_EVICTED",detail:`${e.temp_ref}: reuses '${a}' which was budget-evicted \u2014 drop the edge; the dependent gap names the missing @import`});{let a=c=>c==="emulator"||c==="simulator"?c:"web",d=c=>{let v=(l.tests??[]).find(z=>z.temp_ref===c);if(v)return a(v.target);let h=t.resolve(c),b=h?t.getNode(t.tipOf(h.cid)??h.cid)?.content:void 0;if(typeof b?.target=="string")return a(String(b.target));let I=/^\s*\[mobile:\s*(emulator|simulator)\]/m.exec(String(b?.test_md_blob??""));return I?I[1]:"web"};for(let c of e.reuses??[]){let v=a(e.target),h=d(c);v!==h&&k.push({code:"REUSES_CROSS_SURFACE",detail:`${e.temp_ref}: reuses '${c}' which runs on ${h} while this test runs on ${v} \u2014 a test imports only same-surface units`})}}let i=e.test_md_blob,s=e.definitionId,u=e.objectives_blob;if(n.finalizeTestBody){let a;try{a=n.finalizeTestBody({temp_ref:e.temp_ref,test_md_blob:e.test_md_blob,verifies:e.verifies,reuses:e.reuses??[]},wt)}catch(d){return Y([{code:"FINALIZE_BODY",detail:`${e.temp_ref}: ${d instanceof Error?d.message:String(d)}`}])}a&&(i=a.test_md_blob,s=a.definitionId,u=a.objectives_blob??u,he[e.temp_ref]=s)}let p={title:e.title,check:e.check,definitionId:s,derived:!0,...e.config?{config:e.config}:{},...i?{test_md_blob:i}:{},...u?{objectives_blob:u}:{},...e.surface_required!==void 0?{surface_required:e.surface_required}:{},...e.target?{target:e.target}:{},...e.app&&e.target?{app:e.app}:{}},m=de(_.TEST,e.temp_ref,p,e.title);if(!m)continue;ge(m,e.cites,e.temp_ref,!0,M);let x=j(e.automates,`${e.temp_ref}.automates`,_.SCENARIO);x&&(C.automates[e.temp_ref]=x,B(g.AUTOMATES,m,x,{},`${e.temp_ref}.automates`)),C.verifies[e.temp_ref]=[];for(let a of e.verifies){let d=j(a,`${e.temp_ref}.verifies`,_.AC);d&&(C.verifies[e.temp_ref].push(d),B(g.VERIFIES,m,d,{},`${e.temp_ref}.verifies`))}C.reuses[e.temp_ref]=[];for(let a of e.reuses??[]){if(Se.has(a))continue;let d=j(a,`${e.temp_ref}.reuses`,_.TEST);d&&(C.reuses[e.temp_ref].push(d),B(g.REUSES,m,d,{},`${e.temp_ref}.reuses`))}for(let a of e.verifies){let d=Ee(a)??void 0;d&&(t.trust.get(d)??"derived")==="derived"&&!P.some(c=>c.cid===d)?(L.push(`${e.temp_ref}: verifies ${a} which is still DERIVED (unapproved) \u2014 committed anyway; approve it in chat or via review`),Z.push({test:e.temp_ref,criterion:d})):d&&w[a]===d&&(l.acs??[]).some(c=>c.temp_ref===a)&&(L.push(`${e.temp_ref}: verifies ${a} minted in this same record (unapproved) \u2014 committed anyway; approve it in chat`),Z.push({test:e.temp_ref,criterion:d}))}if(!String(e.test_md_blob??"").split(`
3
3
  `).some(a=>/^##\s/.test(a)&&!/—\s?assert/.test(a)&&Pt.test(a))&&e.verifies.length>1){let a=e.check?.verified_against;L.push(`${e.temp_ref}: verifies ${e.verifies.length} ACs but machine-asserts only 1 (check.verified_against=${a!=null?String(a):"?"}) \u2014 the rest ride prose only`)}}let se=[];for(let e of l.tests??[]){let i={};for(let s of Gt(e.test_md_blob,e.objectives_blob)){let u=Ee(s);u?i[s]=u:se.push(`${e.temp_ref}: body tag '${s}' resolves to nothing`)}C.body_tags[e.temp_ref]=i,se.push(...Mt(e.temp_ref,i,[...C.verifies[e.temp_ref]??[],...C.reuses[e.temp_ref]??[]]))}if(se.length>0){if(n.strict)return Y(se.map(e=>({code:"BODY_EDGE_MISMATCH",detail:e})));L.push(...se.map(e=>`integrity: ${e}`))}let ee=[];{let e=(a,d)=>`${a??""}\0${J(String(d??""))}`,i=(a,d)=>n.reason?`${n.reason} \u2014 evolve by ${f.id}${d?` (${d})`:""}`:a,s=a=>t.edgesFrom(a).some(d=>d.type!==g.SCOPED_TO?!1:d.dst===R||t.tipOf(d.dst)===R?!0:t.nodeLabel.get(d.dst)===_.SCENARIO&&t.edgesFrom(d.dst).some(c=>c.type===g.BELONGS_TO&&t.tipOf(c.dst)===R)),u=new Map;for(let{cid:a,content:d}of t.byLabel(_.AC)){if(t.superseded.has(a)||!s(a))continue;let c=J(String(d.text??""));u.set(c,[...u.get(c)??[],a])}let p=new Map;for(let a of P){if(a.label!==_.AC)continue;let d=J(String(a.content.text??""));p.set(d,[...p.get(d)??[],a.cid])}let m=[];for(let[a,d]of u){let c=p.get(a)??[];d.length!==1||c.length!==1||m.push([d[0],c[0]])}if(ae){let a=new Map(m),d=[...U].filter(o=>!V.has(o)),c=new Map,v=new Set,h=(o,r,S)=>{c.set(o,{cid:r,tag:S}),v.add(r)},b=(o,r)=>{let S=new Map;for(let A of o){let oe=r(A);oe&&S.set(oe,[...S.get(oe)??[],A])}return S},I=(o,r,S)=>{let A=0;for(let[oe,Je]of o){let Qe=r.get(oe)??[];Je.length===1&&Qe.length===1&&(h(Je[0],Qe[0],S),A+=1)}return A},z=new Map,$e=new Set;for(let[o,r]of Oe){let S=w[o];!U.has(r)||V.has(r)||!S||!P.some(A=>A.cid===S)||($e.add(S),z.set(r,[...z.get(r)??[],S]))}let $=new Set,It=o=>J(String(P.find(r=>r.cid===o)?.content.title??""));for(let[o,r]of z){if(r.length===1){h(o,r[0],"reuse_of successor"),D.reuseOf.honored+=1;continue}$.add(o);let S=r.filter(A=>It(A)===J(String(t.getNode(o)?.content.title??"")));S.length===1&&(h(o,S[0],"title-matched successor"),D.byTitle+=1)}let ke=o=>d.filter(r=>t.nodeLabel.get(r)===o&&!c.has(r)&&!$.has(r)),ve=o=>P.filter(r=>r.label===o&&!v.has(r.cid)&&!$e.has(r.cid)).map(r=>r.cid),ze=o=>[...new Set(o.map(r=>a.get(t.tipOf(r))??t.tipOf(r)))].sort().join(`
4
4
  `),At=o=>t.edgesFrom(o).filter(r=>r.type===g.EXERCISES&&!t.superseded.has(r.ecid)).map(r=>r.dst),Nt=o=>M.filter(r=>r.type===g.EXERCISES&&r.src===o).map(r=>r.dst);D.byCriteria+=I(b(ke(_.SCENARIO),o=>ze(At(o))),b(ve(_.SCENARIO),o=>ze(Nt(o))),"same-criteria successor");let He=(o,r)=>e(t.nodeLabel.get(o)??P.find(S=>S.cid===o)?.label,(r??t.getNode(o)?.content)?.title),Re=new Map(P.map(o=>[o.cid,o.content])),Ke=o=>I(b(ke(o),r=>He(r)),b(ve(o),r=>He(r,Re.get(r))),"title-matched successor");D.byTitle+=Ke(_.SCENARIO);let Dt=o=>{let r=t.edgesFrom(o).find(A=>A.type===g.AUTOMATES&&!t.superseded.has(A.ecid));if(!r)return"";let S=t.tipOf(r.dst);return c.get(r.dst)?.cid??c.get(S)?.cid??S};D.byPair+=I(b(ke(_.TEST),Dt),b(ve(_.TEST),o=>M.find(r=>r.type===g.AUTOMATES&&r.src===o)?.dst??""),"paired test successor"),D.byTitle+=Ke(_.TEST);let Ce=new Set(d),ue=o=>{let r=c.get(o)?.cid??c.get(t.tipOf(o))?.cid??t.tipOf(o);return t.superseded.has(r)&&!Re.has(r)||Ce.has(r)&&!c.has(r)?null:r},we=new Set;for(let o of M)o.type===g.AUTOMATES&&Re.has(o.src)&&we.add(ue(o.dst)??o.dst);for(let{cid:o}of t.byLabel(_.TEST))if(!(t.superseded.has(o)||Ce.has(o)))for(let r of t.edgesFrom(o))r.type===g.AUTOMATES&&!t.superseded.has(r.ecid)&&we.add(ue(r.dst)??r.dst);let xt=!l.tests?.length&&te.some(o=>W.has(String(o.kind))),We=new Set,Xe=o=>{if(typeof o!="string"||!o)return;let r=w[o]??t.resolve(o)?.cid,S=r?ue(r):null;S!==null&&We.add(S)};for(let o of te)W.has(String(o.kind))&&Xe(o.ref);for(let{cid:o,content:r}of t.byLabel(_.GAP))t.superseded.has(o)||Ce.has(o)||t.trust.get(o)==="archived"||W.has(String(r.kind??""))&&Xe(r.ref);let ie=new Map,Ye=new Set;for(let o of xt?[]:d){if(t.nodeLabel.get(o)!==_.TEST||c.has(o))continue;let r=t.edgesFrom(o).find(A=>A.type===g.AUTOMATES&&!t.superseded.has(A.ecid)),S=r?ue(r.dst):null;!r||S===null||we.has(S)||Ye.has(S)||We.has(S)||(ie.set(o,{edge:r,scenario:S}),Ye.add(S))}for(let o of d){if(ie.has(o))continue;let r=c.get(o);r?(N.push({kind:"node",old:o,new:r.cid,reason:i(`--force redesign of ${n.ucRef} by ${f.id} (${r.tag})`,r.tag),by:f}),ee.push({old:o,next:r.cid})):N.push({kind:"node",old:o,new:null,reason:i(`--force redesign of ${n.ucRef} by ${f.id}`),by:f}),H.push(o)}for(let[o,{edge:r,scenario:S}]of ie)r.dst===S||ee.some(A=>A.old===r.dst)||(N.push({kind:"edge",ecid:r.ecid,reason:`re-blessed onto ${S} (its test kept by the redesign of ${n.ucRef}) by ${f.id}`,by:f}),B(g.AUTOMATES,o,S,r.props,`keep ${t.nameOf.get(o)??o}`));ie.size>0&&(D.keptTests=ie.size)}else{let a=new Map;for(let c of P){if(c.label!==_.SCENARIO&&c.label!==_.TEST)continue;let v=e(c.label,c.content.title);a.set(v,[...a.get(v)??[],c.cid])}let d=new Map;for(let c of U){if(V.has(c))continue;let v=e(t.nodeLabel.get(c),t.getNode(c)?.content.title);d.set(v,[...d.get(v)??[],c])}for(let[c,v]of d){let h=a.get(c)??[],b=v.length===1&&h.length===1;for(let I of v)b?(N.push({kind:"node",old:I,new:h[0],reason:i(`--force redesign of ${n.ucRef} by ${f.id} (title-matched successor)`,"title-matched successor"),by:f}),ee.push({old:I,next:h[0]})):N.push({kind:"node",old:I,new:null,reason:i(`--force redesign of ${n.ucRef} by ${f.id}`),by:f}),H.push(I)}}for(let[a,d]of m)N.push({kind:"node",old:a,new:d,reason:i(`AC re-emitted with changed content by ${f.id} (text-matched successor)`,"AC text-matched successor"),by:f}),ee.push({old:a,next:d}),H.push(a);if(n.force||n.forceScope){let a=new Set(H),d=new Map(ee.map(b=>[b.old,b.next])),c=new Set(P.map(b=>b.cid)),v=b=>{if(c.has(b))return!0;let I=d.get(b)??t.tipOf(b);return c.has(I)||!t.superseded.has(I)&&!a.has(I)},h=new Set(N.flatMap(b=>b.kind==="edge"?[b.ecid]:[]));for(let{cid:b}of t.byLabel(_.AC)){if(t.superseded.has(b)||a.has(b)||!s(b))continue;let I=t.edgesFrom(b).filter($=>$.type===g.SCOPED_TO&&!t.superseded.has($.ecid)&&!h.has($.ecid)).map($=>$.dst);if(I.length===0||I.some(v))continue;let z=I.map($=>t.nameOf.get($)??t.nameOf.get(t.tipOf($))??$).join(", ");if([...t.edgesInto(b).filter($=>($.type===g.EXERCISES||$.type===g.VERIFIES)&&!t.superseded.has($.ecid)&&!h.has($.ecid)).map($=>$.src),...M.filter($=>($.type===g.EXERCISES||$.type===g.VERIFIES)&&$.dst===b).map($=>$.src)].some($=>v($))){L.push(`ORPHANED_CRITERION: ${X(t.nameOf.get(b)??b)} is scoped to ${z}, which is retired, and a live scenario or test still rests on it \u2014 kept; re-scope it (scoped_to_repoints) to the scenario or use case it belongs to`);continue}N.push({kind:"node",old:b,new:null,reason:i(`orphaned: its scenario ${z} was retired; retired with it by the redesign of ${n.ucRef} (${f.id})`,"orphaned criterion"),by:f}),H.push(b)}}let x=new Set(H),G=new Set;for(let a of N)a.kind==="edge"&&G.add(a.ecid);for(let{old:a,next:d}of ee)for(let c of t.edgesInto(a))et(c.type)?.pin?.comparesTo!=="dst_tip"||t.superseded.has(c.src)||x.has(c.src)||G.has(c.ecid)||(N.push({kind:"edge",ecid:c.ecid,reason:`re-blessed onto ${d} (redirect successor of ${a}) by ${f.id}`,by:f}),G.add(c.ecid),M.some(h=>h.type===c.type&&h.src===c.src&&h.dst===d)||t.edgesFrom(c.src).some(h=>h.type===c.type&&h.dst===d))||c.type===g.AUTOMATES&&ce.has(d)||B(c.type,c.src,d,c.props,`rebless ${c.type} from ${t.nameOf.get(c.src)??c.src}`)}let ne=vt();if(ne.length>0){let e=s=>[...M.filter(u=>u.dst===s),...t.edgesInto(s).filter(u=>!t.superseded.has(u.ecid))].some(u=>u.type===g.DERIVES&&ne.includes(String(u.props.source_id))),i=[...(l.scenarios??[]).map(s=>({label:"scenario",temp_ref:s.temp_ref,title:s.title})),...(l.tests??[]).map(s=>({label:"test",temp_ref:s.temp_ref,title:s.title}))];for(let s of i){let u=w[s.temp_ref];!u||e(u)||L.push(`CITE_MISSING: ${s.label} ${X(q[s.temp_ref]??t.nameOf.get(u)??s.temp_ref)} "${s.title}" cites nothing of ${ne.join(", ")}, whose plugin asks each scenario and test to cite what it rests on \u2014 committed anyway; cite its screens and flows so a change to them marks exactly this ${s.label} stale`)}}if(ne.length>0)for(let e of n.droppedCriterionCites??[]){let i=w[e.temp_ref],s=X(q[e.temp_ref]??(i?t.nameOf.get(i):void 0)??e.temp_ref);L.push(`CITE_DROPPED: criterion ${s} \u2014 a cite was dropped: ${e.why}; the criterion is committed without it. A criterion cites only into ${ne.join(", ")}, whose plugin asks each item to cite what it rests on`)}if(k.length>0)return Y(k);let qe=ae&&(D.reuseOf.seen>0||D.byPair+D.byCriteria+D.byTitle+(D.keptTests??0)>0)?{lineage:D}:{},Ve=fe.length?{modelWarnings:fe}:{};if(P.length===0&&M.length===0&&N.length===0&&re.length===0)return Object.keys(w).length>0||Be>0?(L.push("everything in this phase is already current \u2014 nothing re-committed"),{record:null,errors:null,minted:w,logicalIds:q,superseded:[],warnings:L,finalizedTests:he,unchanged:!0,...K.length?{droppedBlockers:K}:{},...Z.length?{awaitingApproval:Z}:{},...qe,...Ve,...n.force||n.forceScope?{forceScopeRemaining:Fe}:{}}):{...Y([{code:"EMPTY_DESIGN",detail:"finalize_design produced nothing to commit"}]),warnings:L,...K.length?{droppedBlockers:K}:{}};if(n.generationTicket){let e=ht(t,n.generationTicket);if(e!==null)return Y([e])}let Te=n.eventIds&&n.eventIds.length>0?n.eventIds:n.sid?pt(t,n.sid,"design",1):null;return{record:at(E,{ts:new Date().toISOString(),proposal_id:null,nodes:P,edges:M,review:[],supersessions:N,source_head_moves:{},...me.length>0?{names:me}:{},...(()=>{for(let e of l.judgements??[]){let i=e.target?w[e.target]??t.resolve(e.target)?.tip??R:R;C.judgements.push(i),re.push({about:i,rationale:`[${e.kind}] ${e.rationale}`,by:f})}return re.length>0?{judgements:re}:{}})(),design_of:{uc_cid:R,engine:y},...n.generationTicket?{design_generation:_t(n.generationTicket,R,f)}:{},...Te?{event_ids:Te}:{},...n.sid?{sid:n.sid}:{},...n.phase?{design_phase:{uc_root:gt(t,t.resolve(n.ucRef)?.cid??R),generation:n.generationTicket?.next_gen??mt(t,n.ucRef)?.gen??1,phase:n.phase,completeness:n.phaseCompleteness??"complete",...n.payloadDigest?{payload_digest:n.payloadDigest}:{}}}:{}},{graph:t,scope:{ucTargets:[{ref:R}],...n.generationTicket?{generationTicket:{uc_root:n.generationTicket.uc_root,next_gen:n.generationTicket.next_gen}}:{}},expectPrev:t.latestHash,intent:{v:1,verb:"design",args:ot({ucRef:n.ucRef,sections:l,by:f,engine:y,force:n.force??!1,forceScope:n.forceScope??null,reason:n.reason??null,generationTicket:n.generationTicket??null,templateVersion:n.templateVersion??null,phase:n.phase??null,phaseCompleteness:n.phaseCompleteness??null,eventIds:Te,sid:n.sid??null,...ae?{lineage:2}:{}}),pins:Object.keys(ye).length?{...C,reuse_of:ye}:C},provenance:n.provenance}).record,errors:null,minted:w,logicalIds:q,superseded:H,warnings:L,finalizedTests:he,...K.length?{droppedBlockers:K}:{},...Z.length?{awaitingApproval:Z}:{},...n.force||n.forceScope?{forceScopeRemaining:Fe}:{},...qe,...Ve}}function Mt(n,E,t){let l=new Set(Object.values(E));if(l.size===0)return[];let f=new Set(t),y=[];for(let[O,T]of Object.entries(E))f.has(T)||y.push(`${n}: body tag '${O}' has no verifies or reuses edge`);for(let O of f)l.has(O)||y.push(`${n}: edge to ${O} has no body tag`);return y}function Gt(n,E){let t=[];for(let f of(n??"").split(`
5
5
  `)){let y=/^##\s.*?\s@verifies\s+(.+?)\s*$/.exec(f);y&&t.push(...y[1].split(",").map(T=>T.trim()).filter(Boolean));let O=/^@import\s+(\S+)\s*$/.exec(f.trim())??/^## Import: (\S+)\s*$/.exec(f);O&&t.push(O[1])}let l=null;for(let f of(E??"").split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as g}from"./chunk-TZXXJWHA.js";import{a as C}from"./chunk-A3TCFSCK.js";import{d as b,j as x,k as T,n as S}from"./chunk-A7RJQJNT.js";import{a as v}from"./chunk-HCBYKLMW.js";import{a,b as l,i as f}from"./chunk-33DWJV67.js";import{a as B}from"./chunk-6YGTRKDT.js";import{z as s}from"./chunk-QMOGBKJM.js";import{e as h}from"./chunk-UR6MHSHU.js";var y=h(B(),1);var o=h(v(),1);function k(i,d=g()){let n=S(d);return(i==="all"?n:i==="devices"?n.filter(e=>b(e)):["emulator","simulator"].filter(e=>n.includes(e))).map(e=>({value:e,label:x(e),hint:T(e)}))}function H({mode:i="all",hostSupportsMobile:d=g(),onSelect:n,onCancel:c}){let e=k(i,d),[m,u]=(0,y.useState)(0);return f((p,t)=>{if(t.escape&&c){c();return}t.upArrow&&u(r=>Math.max(0,r-1)),t.downArrow&&u(r=>Math.min(e.length-1,r+1)),t.return&&n(e[m].value)}),(0,o.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:s.orange,paddingX:2,paddingY:1,children:[(0,o.jsx)(l,{color:s.orange,bold:!0,children:i==="all"?"Where should tests run?":"Which kind of device?"}),(0,o.jsx)(a,{marginTop:1,flexDirection:"column",children:e.map((p,t)=>{let r=t===m;return(0,o.jsxs)(a,{children:[(0,o.jsxs)(l,{color:r?s.orange:void 0,children:[r?"\u276F ":" ",p.label]}),(0,o.jsxs)(l,{color:s.dim,children:[" ",p.hint]})]},p.value)})}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:s.dim,children:"You can change this any time with /desktop or /mobile."})}),(0,o.jsx)(C,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],suppressEscBack:!c,escBackLabel:"skip"})]})}export{H as a};
2
+ import{b as g}from"./chunk-TZXXJWHA.js";import{a as C}from"./chunk-4HYPMGDF.js";import{d as b,j as x,k as T,n as S}from"./chunk-A7RJQJNT.js";import{a as v}from"./chunk-HCBYKLMW.js";import{a,b as l,i as f}from"./chunk-33DWJV67.js";import{a as B}from"./chunk-6YGTRKDT.js";import{z as s}from"./chunk-FAMQ4DHU.js";import{e as h}from"./chunk-UR6MHSHU.js";var y=h(B(),1);var o=h(v(),1);function k(i,d=g()){let n=S(d);return(i==="all"?n:i==="devices"?n.filter(e=>b(e)):["emulator","simulator"].filter(e=>n.includes(e))).map(e=>({value:e,label:x(e),hint:T(e)}))}function H({mode:i="all",hostSupportsMobile:d=g(),onSelect:n,onCancel:c}){let e=k(i,d),[m,u]=(0,y.useState)(0);return f((p,t)=>{if(t.escape&&c){c();return}t.upArrow&&u(r=>Math.max(0,r-1)),t.downArrow&&u(r=>Math.min(e.length-1,r+1)),t.return&&n(e[m].value)}),(0,o.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:s.orange,paddingX:2,paddingY:1,children:[(0,o.jsx)(l,{color:s.orange,bold:!0,children:i==="all"?"Where should tests run?":"Which kind of device?"}),(0,o.jsx)(a,{marginTop:1,flexDirection:"column",children:e.map((p,t)=>{let r=t===m;return(0,o.jsxs)(a,{children:[(0,o.jsxs)(l,{color:r?s.orange:void 0,children:[r?"\u276F ":" ",p.label]}),(0,o.jsxs)(l,{color:s.dim,children:[" ",p.hint]})]},p.value)})}),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(l,{color:s.dim,children:"You can change this any time with /desktop or /mobile."})}),(0,o.jsx)(C,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],suppressEscBack:!c,escBackLabel:"skip"})]})}export{H as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as qr}from"./chunk-32Y6QVFG.js";import{a as Pr}from"./chunk-OR2B6T3B.js";import{e as dt,f as jt,g as Bt,h as qe}from"./chunk-UEPJ26X2.js";import{A as st,B as ve,C as yr,D as oe,E as $e,F as ot,G as br,H as K,I as it,J as Tt,K as at,L as ke,M as wr,N as vr,Q as Te,a as tr,b as nr,c as Se,d as Ee,e as de,f as tt,g as sr,h as or,i as ce,j as cr,k as Ce,l as Ae,m as lr,n as fr,o as hr,p as At,q as Nt,r as Q,s as Ne,t as gr,u as Pt,v as Pe,w as mr,x as qt,y as te,z as rt}from"./chunk-Z5BFCTHI.js";import{a as R,b as rr,d as X,e as Oe,h as ir,i as ar,k as dr}from"./chunk-CB4ARIHR.js";import{a as Un,b as Vn,e as Wn}from"./chunk-USJ3LUAL.js";import{a as Zn}from"./chunk-P2LDAW3C.js";import{a as Yn,b as zn}from"./chunk-WMGKUERB.js";import{a as Qn}from"./chunk-LNHBZEDC.js";import{a as Jn}from"./chunk-73Y6T2UK.js";import{b as Xn,e as er,h as Ct,i as J}from"./chunk-XMPTFXPW.js";import{e as Ar,f as Nr}from"./chunk-U7NRZBB5.js";import{a as Er}from"./chunk-GGS3ATPB.js";import{a as Or,b as Lt,c as Cr}from"./chunk-WZLDFEWR.js";import{a as Ir,d as Sr}from"./chunk-KDR662D2.js";import{h as _r,i as Rr}from"./chunk-6TNLITJO.js";import{g as Ft,h as $r,q as kr}from"./chunk-RLOJH5O6.js";import{a as nt,b as le,c as pr,d as ur}from"./chunk-ZTAZ2R5Z.js";import{b as Ot,d as Kn}from"./chunk-CJE7PKRV.js";import{b as dn,f as cn,h as ln,k as pn,l as un,q as et}from"./chunk-7V34ZMMS.js";import{b as we}from"./chunk-6PIIUAZF.js";import{Ea as C,Fa as On,Ia as Cn,Ka as An,M as wn,Na as Nn,Oa as Pn,Pa as qn,Qa as ee,Ra as Tn,Sa as jn,Ua as Bn,Va as Qe,Ya as Fn,Za as Ln,a as ae,d as Et,da as vn,ea as $n,eb as xn,fa as kn,fb as Ze,ga as _n,ha as Rn,ia as In,ja as Sn,kb as Mn,mb as Hn,na as Ye,oa as En,ob as Xe,pa as ze,q as mn,r as yn,t as bn,vb as Dn,wb as Gn}from"./chunk-Z777GGHB.js";import{c as hn,n as gn}from"./chunk-DBMW3VUN.js";import{d as fn,f as Je,g as Ke}from"./chunk-KU3YHPWZ.js";import{b as an}from"./chunk-7V4BQSSV.js";import{g as We}from"./chunk-ZCRZFAOT.js";import{existsSync as De,readdirSync as ws,readFileSync as vs,realpathSync as oi,statSync as ii,writeFileSync as ai}from"fs";import{basename as Rt,join as Ge,relative as di,resolve as sn}from"path";import{randomBytes as Fs}from"crypto";var Tr=8,je=()=>dr(Fs(8).toString("hex")),jr=(e,t)=>e!==null&&Buffer.from(e).equals(Buffer.from(t)),Ls=[["P1 exclusive create",async e=>{for(let t=1;t<=2;t++){let n=je(),r=Buffer.from(`probe ${t} first`);if(await e.putIfAbsent(n,r)!=="created")return"a fresh key was reported as existing";if(await e.putIfAbsent(n,Buffer.from(`probe ${t} second`))!=="exists")return"the second write to one key was not refused";if(!jr(await e.get(n),r))return"the second write replaced the first"}return null}],["P2 contention",async e=>{let t=je(),r=(await Promise.all(Array.from({length:Tr},(o,i)=>e.putIfAbsent(t,Buffer.from(`contender ${i}`))))).filter(o=>o==="created").length;return r===1?null:`${r} of ${Tr} concurrent writers were told "created"`}],["P3 read-after-write",async e=>{let t=je(),n=Buffer.from("visible");return await e.putIfAbsent(t,n),await e.head(t)?jr(await e.get(t),n)?(await e.list(t)).includes(t)?null:"list does not show a key just created":"get does not return the bytes just created":"head does not see a key just created"}],["P4 definitive absence",async e=>await e.head(je())?"a never-written key was reported present":null]];async function ct(e){if(e.probe){let r=await e.probe();return{tier:Math.max(r.tier,e.ceilingTier),detail:r.detail}}let t=1,n="all probes passed";for(let[r,o]of Ls){let i;try{i=await o(e)}catch(s){if(s instanceof R){if(!(s.code==="SYNC_LOCATION_REFUSED_WRITE"&&r.startsWith("P1")&&await Br(e)))throw s;n=`${r}: ${s.message}`,t=3;break}n=`${r}: ${s instanceof Error?s.message:String(s)}`,t=r.startsWith("P1")&&await Br(e)?3:2;break}if(i!==null){n=`${r}: ${i}`,t=2;break}}return{tier:Math.max(t,e.ceilingTier),detail:n}}async function Br(e){try{return!await e.head(je())}catch(t){if(t instanceof R)throw t;return!1}}import{existsSync as xs,readFileSync as xr}from"fs";import{join as Ms}from"path";async function xt(e,t,n,r){let i=de(e).entries[n];if(!i)throw new Error(`no sync state for ${n} \u2014 run kane-cli context sync add ${n} <descriptor> first`);if(i.tier!==1)throw new R("SYNC_READ_ONLY",`${n} is a tier ${i.tier} location: it can be cloned and pulled, never pushed`,"push to a location whose probe reached tier 1, or pull from this one");let s=await Ce(e,t,i.witness);switch(s.kind){case"empty-storage":case"ahead":case"up-to-date":break;case"behind":case"empty-local":throw new R("SYNC_BEHIND",`${n} holds ${s.storage.seq} records, this store ${s.local?.seq??0}: it has records this store has not seen`,`kane-cli context pull ${n}`);case"diverged":throw new R("SYNC_DIVERGED",`you and ${n} both added work after position ${s.at-1}; nothing was pushed`,`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 R("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`)}let a=s.storage,c=qn(e),d;try{An(e),d=Hs(e,a)}catch(M){throw M instanceof Cn?new R("SYNC_REBASE_PENDING",`${M.message.split(";")[0]}; nothing was pushed`,M.remedy):M}finally{c()}let l=d.map(M=>Ds(e,M)),f=0,p=0,g=0,u=0,m=a,y=null,w=null,h=t.beginTransaction?await t.beginTransaction():void 0,b=h?{...t,head:h.head,get:h.get,list:t.list.bind(t),putIfAbsent:t.putIfAbsent.bind(t)}:t,v=h?h.stageIfAbsent.bind(h):t.putIfAbsent.bind(t),q=[],re=M=>h?q.push(M):r(M);try{let M=new Set;for(let S of l){for(let D of S.blobs)if(await v(D.key,D.bytes)!=="exists")p++,M.add(D.key);else if(!M.has(D.key)){let $=await b.get(D.key);if($===null||Ot(Buffer.from($))!==D.fp){w=new R("SYNC_OBJECT_CORRUPT",`the blob ${D.fp} ${n} already holds does not hash to its name (named by record ${S.seq}); the record was not pushed`,"the storage object needs a human look before anything more is pushed to it");break}M.add(D.key)}if(w)break;S.proposal&&await v(S.proposal.key,S.proposal.bytes)!=="exists"&&g++;let Z=Oe(S.seq);if(await v(Z,S.raw)!=="exists")f++;else if((await ce(b,S.seq)).hash===S.hash)re(`position ${S.seq} is already on ${n}`),u++;else{y=S.seq;break}m={seq:S.seq,hash:S.hash}}if(h||await Lr(t,m,a,n),m&&!await b.head(X)){let S=await ce(b,1),Z={layout:1,canonicalizer:"v1",genesis_hash:S.hash};await v(X,Buffer.from(JSON.stringify(Z)+`
2
+ import{a as qr}from"./chunk-SALZ6WSF.js";import{a as Pr}from"./chunk-ENRFXGID.js";import{e as dt,f as jt,g as Bt,h as qe}from"./chunk-X6FCXBXU.js";import{A as st,B as ve,C as yr,D as oe,E as $e,F as ot,G as br,H as K,I as it,J as Tt,K as at,L as ke,M as wr,N as vr,Q as Te,a as tr,b as nr,c as Se,d as Ee,e as de,f as tt,g as sr,h as or,i as ce,j as cr,k as Ce,l as Ae,m as lr,n as fr,o as hr,p as At,q as Nt,r as Q,s as Ne,t as gr,u as Pt,v as Pe,w as mr,x as qt,y as te,z as rt}from"./chunk-45NM23EQ.js";import{a as R,b as rr,d as X,e as Oe,h as ir,i as ar,k as dr}from"./chunk-CB4ARIHR.js";import{a as Un,b as Vn,e as Wn}from"./chunk-SSOUYKVG.js";import{a as Zn}from"./chunk-HVOXMCKE.js";import{a as Yn,b as zn}from"./chunk-WMGKUERB.js";import{a as Qn}from"./chunk-UWPG5MWM.js";import{a as Jn}from"./chunk-73Y6T2UK.js";import{b as Xn,e as er,h as Ct,i as J}from"./chunk-XMPTFXPW.js";import{e as Ar,f as Nr}from"./chunk-MINDIQET.js";import{a as Er}from"./chunk-IZ66FKPC.js";import{a as Or,b as Lt,c as Cr}from"./chunk-E4GIGM5V.js";import{a as Ir,d as Sr}from"./chunk-3KY7HHQU.js";import{h as _r,i as Rr}from"./chunk-ZHAMVLQZ.js";import{g as Ft,h as $r,q as kr}from"./chunk-Z24SD2EJ.js";import{a as nt,b as le,c as pr,d as ur}from"./chunk-23DKB2MT.js";import{b as Ot,d as Kn}from"./chunk-CQDCNP7V.js";import{b as dn,f as cn,h as ln,k as pn,l as un,q as et}from"./chunk-7V34ZMMS.js";import{b as we}from"./chunk-6PIIUAZF.js";import{Ea as C,Fa as On,Ia as Cn,Ka as An,M as wn,Na as Nn,Oa as Pn,Pa as qn,Qa as ee,Ra as Tn,Sa as jn,Ua as Bn,Va as Qe,Ya as Fn,Za as Ln,a as ae,d as Et,da as vn,ea as $n,eb as xn,fa as kn,fb as Ze,ga as _n,ha as Rn,ia as In,ja as Sn,kb as Mn,mb as Hn,na as Ye,oa as En,ob as Xe,pa as ze,q as mn,r as yn,t as bn,vb as Dn,wb as Gn}from"./chunk-PI7OXS62.js";import{c as hn,n as gn}from"./chunk-DBMW3VUN.js";import{d as fn,f as Je,g as Ke}from"./chunk-KU3YHPWZ.js";import{b as an}from"./chunk-7V4BQSSV.js";import{g as We}from"./chunk-ZCRZFAOT.js";import{existsSync as De,readdirSync as ws,readFileSync as vs,realpathSync as oi,statSync as ii,writeFileSync as ai}from"fs";import{basename as Rt,join as Ge,relative as di,resolve as sn}from"path";import{randomBytes as Fs}from"crypto";var Tr=8,je=()=>dr(Fs(8).toString("hex")),jr=(e,t)=>e!==null&&Buffer.from(e).equals(Buffer.from(t)),Ls=[["P1 exclusive create",async e=>{for(let t=1;t<=2;t++){let n=je(),r=Buffer.from(`probe ${t} first`);if(await e.putIfAbsent(n,r)!=="created")return"a fresh key was reported as existing";if(await e.putIfAbsent(n,Buffer.from(`probe ${t} second`))!=="exists")return"the second write to one key was not refused";if(!jr(await e.get(n),r))return"the second write replaced the first"}return null}],["P2 contention",async e=>{let t=je(),r=(await Promise.all(Array.from({length:Tr},(o,i)=>e.putIfAbsent(t,Buffer.from(`contender ${i}`))))).filter(o=>o==="created").length;return r===1?null:`${r} of ${Tr} concurrent writers were told "created"`}],["P3 read-after-write",async e=>{let t=je(),n=Buffer.from("visible");return await e.putIfAbsent(t,n),await e.head(t)?jr(await e.get(t),n)?(await e.list(t)).includes(t)?null:"list does not show a key just created":"get does not return the bytes just created":"head does not see a key just created"}],["P4 definitive absence",async e=>await e.head(je())?"a never-written key was reported present":null]];async function ct(e){if(e.probe){let r=await e.probe();return{tier:Math.max(r.tier,e.ceilingTier),detail:r.detail}}let t=1,n="all probes passed";for(let[r,o]of Ls){let i;try{i=await o(e)}catch(s){if(s instanceof R){if(!(s.code==="SYNC_LOCATION_REFUSED_WRITE"&&r.startsWith("P1")&&await Br(e)))throw s;n=`${r}: ${s.message}`,t=3;break}n=`${r}: ${s instanceof Error?s.message:String(s)}`,t=r.startsWith("P1")&&await Br(e)?3:2;break}if(i!==null){n=`${r}: ${i}`,t=2;break}}return{tier:Math.max(t,e.ceilingTier),detail:n}}async function Br(e){try{return!await e.head(je())}catch(t){if(t instanceof R)throw t;return!1}}import{existsSync as xs,readFileSync as xr}from"fs";import{join as Ms}from"path";async function xt(e,t,n,r){let i=de(e).entries[n];if(!i)throw new Error(`no sync state for ${n} \u2014 run kane-cli context sync add ${n} <descriptor> first`);if(i.tier!==1)throw new R("SYNC_READ_ONLY",`${n} is a tier ${i.tier} location: it can be cloned and pulled, never pushed`,"push to a location whose probe reached tier 1, or pull from this one");let s=await Ce(e,t,i.witness);switch(s.kind){case"empty-storage":case"ahead":case"up-to-date":break;case"behind":case"empty-local":throw new R("SYNC_BEHIND",`${n} holds ${s.storage.seq} records, this store ${s.local?.seq??0}: it has records this store has not seen`,`kane-cli context pull ${n}`);case"diverged":throw new R("SYNC_DIVERGED",`you and ${n} both added work after position ${s.at-1}; nothing was pushed`,`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 R("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`)}let a=s.storage,c=qn(e),d;try{An(e),d=Hs(e,a)}catch(M){throw M instanceof Cn?new R("SYNC_REBASE_PENDING",`${M.message.split(";")[0]}; nothing was pushed`,M.remedy):M}finally{c()}let l=d.map(M=>Ds(e,M)),f=0,p=0,g=0,u=0,m=a,y=null,w=null,h=t.beginTransaction?await t.beginTransaction():void 0,b=h?{...t,head:h.head,get:h.get,list:t.list.bind(t),putIfAbsent:t.putIfAbsent.bind(t)}:t,v=h?h.stageIfAbsent.bind(h):t.putIfAbsent.bind(t),q=[],re=M=>h?q.push(M):r(M);try{let M=new Set;for(let S of l){for(let D of S.blobs)if(await v(D.key,D.bytes)!=="exists")p++,M.add(D.key);else if(!M.has(D.key)){let $=await b.get(D.key);if($===null||Ot(Buffer.from($))!==D.fp){w=new R("SYNC_OBJECT_CORRUPT",`the blob ${D.fp} ${n} already holds does not hash to its name (named by record ${S.seq}); the record was not pushed`,"the storage object needs a human look before anything more is pushed to it");break}M.add(D.key)}if(w)break;S.proposal&&await v(S.proposal.key,S.proposal.bytes)!=="exists"&&g++;let Z=Oe(S.seq);if(await v(Z,S.raw)!=="exists")f++;else if((await ce(b,S.seq)).hash===S.hash)re(`position ${S.seq} is already on ${n}`),u++;else{y=S.seq;break}m={seq:S.seq,hash:S.hash}}if(h||await Lr(t,m,a,n),m&&!await b.head(X)){let S=await ce(b,1),Z={layout:1,canonicalizer:"v1",genesis_hash:S.hash};await v(X,Buffer.from(JSON.stringify(Z)+`
3
3
  `,"utf8"))!=="exists"&&re(`wrote ${X} on ${n}`)}if(h){if(m){let $=await b.get(X),ge=await ce(b,1),T={};try{let me=JSON.parse(Buffer.from($??[]).toString("utf8"));me&&typeof me=="object"&&!Array.isArray(me)&&(T=me)}catch{}if(T.layout!==1||T.canonicalizer!=="v1"||T.genesis_hash!==ge.hash)throw new R("SYNC_OBJECT_CORRUPT",`${X} does not describe this context's verified genesis and format.`,"Ask the location owner to inspect the metadata before publishing.")}if(w)throw w;if(y!==null)throw new R("SYNC_POSITION_TAKEN",`position ${y} on ${n} was taken by another writer; this batch was not published`,Fr(n,y));let S=await h.commit(),Z=new Set(S.created),D=l.filter($=>Z.has(Oe($.seq))).length;u+=f-D,f=D,p=new Set(l.flatMap($=>$.blobs.map(ge=>ge.key)).filter($=>Z.has($))).size,g=new Set(l.flatMap($=>$.proposal?[$.proposal.key]:[]).filter($=>Z.has($))).size}h&&await Lr(t,m,a,n);for(let S of q)r(S);let se="";if(m)try{lr(e,n,m,{forwardOnly:!0})}catch(S){if(y===null||!(S instanceof C))throw S;se=" (the witness was not saved; the next pull records it)"}if(w)throw w;if(y!==null)throw new R("SYNC_POSITION_TAKEN",`position ${y} on ${n} was taken by another writer while this push ran; this store's history through position ${m?.seq??0} is confirmed on ${n}${se}`,Fr(n,y))}finally{await h?.abort()}return{pushed:f,from:a?.seq??0,to:m?.seq??0,blobs:p,proposals:g,alreadyThere:u}}function Fr(e,t){return t===1?`${e} holds a different history: to work on it, clone it with kane-cli context clone <descriptor of ${e}> <dir>; to share this store, add an empty location`:`kane-cli context pull ${e} --rebase`}async function Lr(e,t,n,r){if(!t||t.seq<=(n?.seq??0))return;let o=await ce(e,t.seq);if(o.hash!==t.hash)throw new R("SYNC_OBJECT_CORRUPT",`${r} answered "created" for position ${t.seq} but serves a record hashing ${o.hash}, not ${t.hash}`,"The location needs inspection before publishing more context.")}function Hs(e,t){let{records:n,hashes:r}=Ln(e,t?.seq??0,t?.hash??null);return n.map((o,i)=>{let s=r[i],a=xr(Ms(e,"commits",`${String(o.seq).padStart(6,"0")}-${s.slice(7,19)}.json`));if(ee(JSON.parse(a.toString("utf8")))!==s)throw new Error(`record ${o.seq} changed on disk while it was being read \u2014 run kane-cli context fsck`);return{rec:o,hash:s,raw:a}})}function Ds(e,{rec:t,hash:n,raw:r}){{let o=tr(t),i=o.blobs.map(s=>{let a=Kn(e,s);if(a===null)throw new R("SYNC_CLOSURE_MISSING",`record ${t.seq} names blob ${s}, which this store does not hold`,"restore the blob from a copy of this store, or run kane-cli context fsck");if(Ot(a)!==s)throw new R("SYNC_LOCAL_BLOB_CORRUPT",`record ${t.seq} names blob ${s}, but the local file does not hash to that: it is torn`,"restore the blob from a copy of this store, or run kane-cli context fsck");return{key:ir(s),fp:s,bytes:a}});return{seq:t.seq,hash:n,raw:new Uint8Array(r),blobs:i,proposal:Gs(e,o.proposalId)}}}function Gs(e,t){if(t===null)return null;let n=Qn(e,t);if(!xs(n))return null;let r=xr(n);return{key:ar(t,nr(r.toString("utf8"))),bytes:r}}import{existsSync as Us,readdirSync as Vs,readFileSync as Mr}from"fs";import{basename as Ws,join as Mt}from"path";function lt(e){return{id:Ws(e),witness:()=>JSON.parse(Mr(Mt(e,"base-witness.json"),"utf8")),records:t=>Ht(e,t),readIntent:t=>bn(e,t)}}var Js=/^\d{6}-[0-9a-f]{12}\.json$/;function Ht(e,t){let n=Mt(e,"commits"),r=Us(n)?Vs(n).filter(s=>Js.test(s)).sort():[],o=t.hash,i=t.seq;return r.map(s=>{let a;try{a=JSON.parse(Mr(Mt(n,s),"utf8"))}catch(d){throw new C(`backup record ${s} is not JSON: ${String(d)}`)}if(i+=1,a.seq!==i||a.prev_hash!==o)throw new C(`backup record ${s} does not continue the chain at ${i} from ${String(o)}`);let c=ee(a);if(!c.slice(7).startsWith(s.slice(7,19)))throw new C(`backup record ${s} does not match its name`);return o=c,{seq:i,hash:c,body:a}})}function pt(e,t){let n=t.witness(),r=e.recordsSince(null).slice(0,n.base.seq),o=t.records(n.base),i=[...r,...o.map(p=>p.body)],s=[...r.map(ee),...o.map(p=>p.hash)],a=new Map;for(let p of i)for(let g of p.nodes)a.set(g.cid,{label:g.label,content:g.content});let c=Mn();Hn(null,c,i,s,{writeNodeFiles:!1});let d=Gn(null,c,a),l=new Map(o.map(p=>[p.seq,p])),f=p=>d.displayNameOf(p)??p.slice(0,19);return{backup:t,backupId:t.id,from:n.from,base:n.base,index:c,graph:d,records:o,chain:i,recordAt:p=>l.get(p),resolveName:p=>d.resolve(p)?.cid,nameOf:p=>d.displayNameOf(p)??void 0,displayNameFor:p=>{let g=Dt(t,p),u=Object.keys(p.source_head_moves),m=g==="revert"?String(Ks(t,p)??""):g==="names"?(p.names??[]).map(y=>y.slug).join(", "):u.length>0?u.join(", "):p.nodes.length>0?[...new Set(p.nodes.map(y=>f(y.cid)))].join(", "):(p.executions?.length??0)>0?[...new Set(p.executions.map(y=>f(y.about)))].join(", "):p.review.length>0?[...new Set(p.review.map(y=>f(y.id)))].join(", "):p.supersessions.length>0?[...new Set(p.supersessions.map(y=>y.kind==="node"?f(y.old):y.ecid.slice(0,19)))].join(", "):u.join(", ");return m?`${g} ${m}`:g}}}function Ks(e,t){try{let r=e.readIntent(ee(t))?.args?.seq;return typeof r=="number"?r:void 0}catch{return}}function Dt(e,t){let n=null;try{n=e.readIntent(ee(t))}catch{n=null}if(n)return n.verb;if(t.intent_verb)return t.intent_verb;let r=Object.entries(t.source_head_moves);return(t.executions?.length??0)>0?"execution":t.design_of?"design":t.proposal_id!=null?"extract":t.conv?t.conv.turn===0?"conv-mint":"conv-turn":r.length===1&&r[0][1]===null&&t.supersessions.some(o=>o.kind==="node"&&o.new===null)?"retire":r.length===1&&typeof r[0][1]=="string"&&t.nodes.some(o=>o.label==="source")?"ingest":t.review.some(o=>o.resolution==="reset")||t.supersessions.some(o=>o.kind==="node"&&o.new===o.old||o.kind==="edge"&&o.revoke)?"revert":t.nodes.length===0&&t.edges.length===0&&t.supersessions.length===1&&t.supersessions[0].kind==="node"&&t.supersessions[0].new===null?"archive":t.nodes.length===0&&t.edges.length===0&&t.review.length===0&&(t.names?.length??0)>0?"names":t.nodes.length===0&&t.edges.length===0&&t.supersessions.length===0&&t.review.length>0?"review":"unknown"}import{existsSync as Hr,readdirSync as Ys,readFileSync as Gt}from"fs";import{isAbsolute as zs,join as ut,normalize as Qs,relative as Zs,sep as Xs}from"path";var eo=e=>e===""||zs(e)||e.includes("\\")||Qs(e).split(Xs).some(t=>t==="..")||e.startsWith("./")||e.includes("\0");function Fe(e){let t=ut(e,"manifest.json");if(!Hr(t))throw new C(`backup ${e} has no manifest.json \u2014 it was never completed; kane-cli context sync doctor`);let n;try{n=JSON.parse(Gt(t,"utf8"))}catch(s){throw new C(`backup manifest ${t} is not JSON: ${s instanceof Error?s.message:String(s)}`)}if(!Array.isArray(n))throw new C(`backup manifest ${t} is not a list`);let r=new Set,o=[];for(let s of n){let a=typeof s?.name=="string"?s.name:"";if(eo(a))throw new C(`backup manifest names an unsafe path ${JSON.stringify(s?.name)} \u2014 the backup is not trusted`);let c=ut(e,a);if(!Hr(c))throw new C(`backup file ${a} is missing from ${e}`);let d=Gt(c);if("sha256:"+an(d)!==s.hash)throw new C(`backup file ${a} does not match its manifest hash \u2014 the backup was changed after it was written`);if(a.startsWith("commits/"))try{r.add(ee(JSON.parse(d.toString("utf8"))))}catch(l){throw new C(`backup record ${a} is not a record: ${l instanceof Error?l.message:String(l)}`)}a.startsWith("intents/")&&o.push(a)}let i=new Set(n.map(s=>s.name));for(let s of Dr(e)){let a=Zs(e,s);if(a!=="manifest.json"&&!i.has(a))throw new C(`backup ${e} holds ${a}, which its manifest does not name \u2014 the backup was changed after it was written`)}for(let s of o){let a;try{a=JSON.parse(Gt(ut(e,s),"utf8"))}catch(d){throw new C(`backup envelope ${s} is not JSON: ${d instanceof Error?d.message:String(d)}`)}let c=mn(a);if(c!==null)throw new C(`backup envelope ${s} is not a valid intent: ${c}`);if(typeof a.born?.hash!="string"||!r.has(a.born.hash))throw new C(`backup envelope ${s} was born from a record the backup does not hold`)}}function Dr(e){let t=[];for(let n of Ys(e,{withFileTypes:!0})){let r=ut(e,n.name);n.isDirectory()?t.push(...Dr(r)):t.push(r)}return t}import{basename as Oo,join as Co}from"path";import{existsSync as Ao,readFileSync as No}from"fs";var G=class extends Error{},L=(e,t)=>({kind:"apply",inputs:e,...t&&t.length>0?{aliases:t}:{}}),V=e=>({kind:"noop",reason:e}),Vt=e=>({kind:"dedupe",as:e}),k=(e,t,n,r,o={})=>({kind:"hold",hold:{kind:e,mine:t,theirs:n,answers:r,detail:o}}),Gr=(e,t)=>{let n=ft(t.label,t.content);return e.graph.byLabel(t.label).filter(r=>!e.graph.superseded.has(r.cid)&&ft(t.label,r.content)===n).map(r=>r.cid)},z=e=>e?e.slice(0,19):"none",H=(e,t)=>e.maps.cid.rewrite(t);function I(e,t,n){if(typeof t!="string")throw new G(`${n} was not pinned`);let r=H(e,t);if(!e.graph.hasNode(r))throw new G(`${n} ${_(e,t)} has no counterpart on ${e.location}`);return r}var j=(e,t)=>e.graph.tipOf(t),Wt=(e,t)=>e.graph.superseded.has(e.graph.tipOf(t)),_=(e,t)=>e.fold.nameOf(t)??z(t),E=(e,t)=>e.graph.displayNameOf(t)??z(t);function Jt(e,t,n,r){let o=r==="fold"?e.fold.graph:e.graph,i=o.displayNameOf(t);if(i!==null&&i!==n)return i;let s=o.tipOf(t);for(let[d,l]of o.heads)if(l===t||l===s)return d;let a=o.getNode(t);if(a?.label==="source"&&typeof a.content.source_id=="string")return a.content.source_id;let c=a?.content.title??a?.content.text??a?.content.statement;return a&&typeof c=="string"&&c!==""?`${a.label} "${Y(c,32)}"`:z(t)}var F=e=>e.created_by?.by?.id??e.review[0]?.by.id??e.supersessions[0]?.by.id??e.names?.[0]?.by.id??"someone",N=e=>e.ts;function Y(e,t=48){let n=typeof e=="string"?e:JSON.stringify(e);return n.length>t?`${n.slice(0,t-1)}\u2026`:n}var Ut={test_md_blob:"steps",objectives_blob:"checks"},to=/^sha256:[0-9a-f]{64}$/,no=(e,t)=>e==="derived"||Or.includes(e)||/_blob$/.test(e)||/(^|_)id$|Id$/.test(e)||t.some(n=>typeof n=="string"&&to.test(n));function pe(e,t,n,r){let o=[...new Set([...Object.keys(e),...Object.keys(t)])].filter(c=>JSON.stringify(e[c])!==JSON.stringify(t[c])),i=o.filter(c=>Ut[c]===void 0&&!no(c,[e[c],t[c]])).map(c=>`${c} "${Y(e[c]??"")}" \u2192 "${Y(t[c]??"")}"`),s=Object.keys(Ut).filter(c=>o.includes(c)).map(c=>Ut[c]);return`${[...i,...s.length>0?[`${s.join(" and ")} changed`]:[]].join(", ")||"no field changed"} by ${n} ${r===null?"since your last pull":`at ${r}`}`}var ro={usecase:"use case",scenario:"scenario",test:"test",ac:"acceptance criterion",source:"document"};function Ur(e,t){let n=e.graph.getNode(t),r=n?ro[n.label]??n.label:"item",o=n?.label!=="ac"?n?.content.title:void 0;if(typeof o=="string"&&o.trim()!=="")return`the ${r} "${o}"`;let i=e.fold.nameOf(t)??e.graph.displayNameOf(t);return i?`the ${r} ${En(i)}`:`the ${r}`}function ie(e,t){for(let n of e.theirs)for(let r of n.supersessions)if(r.kind==="node"&&r.old===t)return{rec:n,next:r.new}}function Kt(e,t){let n=new Set([t]);for(let o=!0;o;){o=!1;for(let[i,s]of e.graph.superseded)typeof s=="string"&&n.has(s)&&!n.has(i)&&(n.add(i),o=!0)}let r=[];for(let o of e.theirs)for(let i of o.review)n.has(i.id)&&i.resolution!=="pending"&&r.push({rec:o,resolution:i.resolution});return r}var so=new Set(Object.values(Ke).filter(e=>e!==Ke.DERIVES&&e!==Ke.ANNOTATES));function Yt(e,t){let n=new Set,r=[],o=[t,e.graph.tipOf(t)];for(;o.length>0;){let i=o.pop();if(!n.has(i)){n.add(i);for(let s of e.graph.edgesInto(i))!so.has(s.type)||e.graph.superseded.has(s.src)||(!(s.src in e.fold.index.nodeLabel)&&!r.some(a=>a.cid===s.src)&&r.push({cid:s.src,label:e.graph.nodeLabel.get(s.src)??"node"}),o.push(s.src))}}return r}function zt(e){let t=new Map;for(let n of e)t.set(n.label,(t.get(n.label)??0)+1);return[...t].map(([n,r])=>`${r} ${n}${r===1?"":"s"}`).join(", ")}function ht(e,t,n){if(!e.theirs.some(o=>o.edges.some(i=>i.type===t&&i.src===n)))return;let r=e.graph.edgesFrom(n).find(o=>o.type===t);return r?{live:r.dst}:void 0}function _e(e,t){let n=t.event_ids??[],r={token:e.store.parse(e.graph.latestHash)},o=new Map(n.map(a=>[a,e.store.appliedEvent(a,r)?.digest])),i=n.filter(a=>o.get(a)!==void 0);return n.length===0||i.length===0?void 0:i.every(a=>{let c=n.indexOf(a),d=t.event_digests?.[c];return d!==void 0&&d!==""&&o.get(a)===d})&&i.length===n.length?V("already applied: every event id is in the chain with the same intent"):k("ambiguous",`committed ${n.length} event id${n.length===1?"":"s"}`,`${i.length} of them already in the shared chain under another intent`,["keep-theirs"],{event_ids:n})}function oo(e){return String(e??"").toLowerCase().trim().replace(/\s+/g," ")}function ft(e,t){let n=t.question;return`${e}\0${oo(t.title??t.text??t.statement??n?.header??t.source_id??"")}`}function Vr(e,t){let n=[],r=new Set;for(let o of e.nodes){let i=ft(o.label,o.content),s=t.nodes.find(a=>!r.has(a.cid)&&ft(a.label,a.content)===i);s&&(r.add(s.cid),n.push([o.cid,s.cid]))}for(let o of e.nodes){if(n.some(([s])=>s===o.cid))continue;let i=t.nodes.find(s=>!r.has(s.cid)&&s.label===o.label);i&&(r.add(i.cid),n.push([o.cid,i.cid]))}return n}function Wr(e,t){let n=[],r=new Set;for(let o of t.names??[]){if(!Ye.test(o.slug))continue;let i=t.nodes.find(a=>a.cid===o.cid);if(!i||e.graph.nameOf.has(H(e,o.cid)))continue;let s=ze(i.label,a=>r.has(a),e.graph.names.keys());s!==null&&(r.add(s),s!==o.slug&&n.push({from:o.slug,to:s}))}return n}function Jr(e,t,n){let r=[];for(let o of e.names??[]){let i=n.find(([a])=>a===o.cid)?.[1],s=t.names?.find(a=>a.cid===i);s&&s.slug!==o.slug&&r.push({from:o.slug,to:s.slug})}return r}function Kr(e,t,n){let r=e===void 0?void 0:e.split(`
4
4
  `).map(s=>{let a=/^(##\s.*?)\s@verifies\s+(.+?)\s*$/.exec(s);if(a)return`${a[1]} @verifies ${a[2].split(",").map(l=>l.trim()).filter(Boolean).map(n).join(", ")}`;let c=/^(\s*)@import\s+(\S+)\s*$/.exec(s);if(c)return`${c[1]}@import ${n(c[2])}`;let d=/^## Import: (\S+)\s*$/.exec(s);return d?`## Import: ${n(d[1])}`:s}).join(`
5
5
  `),o=null,i=t===void 0?void 0:t.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as C}from"./chunk-IZ65ZPWY.js";import{e as w}from"./chunk-6NFOH4AC.js";var E=.8,P="usecase-dedup";function S(n,e){let c=Math.min(n.length,e.length),u=0,o=0,a=0;for(let t=0;t<c;t++)u+=n[t]*e[t],o+=n[t]*n[t],a+=e[t]*e[t];return o===0||a===0?0:u/(Math.sqrt(o)*Math.sqrt(a))}function D(n,e,c){return c*n+(1-c)*e}var v=.7;function _(n){return new Set(n.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").split(" ").filter(Boolean))}function y(n,...e){let c=_(n);if(c.size===0)return 0;let u=n.trim().toLowerCase(),o=0;for(let a of e){let t=_(a);if(t.size===0)continue;let p=0;for(let l of c)t.has(l)&&p++;let m=c.size+t.size-p,d=m===0?0:p/m;u&&a.toLowerCase().includes(u)&&(d=Math.max(d,.9)),o=Math.max(o,d)}return o}var A=n=>String(n.title??"");function H(n){return n.byLabel("usecase").filter(e=>!n.superseded.has(e.cid)).map(e=>({cid:e.cid,text:A(e.content)}))}function B(n,e){let c=e.threshold??E,u=new Map,o=null;return{async batchSimilar(a,t){let p=a.latestHash;if(t.length===0)return{hits:[],degraded:!1,probeBasis:p};let m=H(a),d=[];try{let l=await e.resolveAlias(P);o=l.alias,e.prefetchVectors?.(o,P,l.dims);let f=new Map,b=[];for(let r of m){let i=e.readVector?.(o,P,r.cid)??null;i!==null?f.set(r.cid,i):b.push(r)}let s=await C(r=>e.embed(P,r),t.map(r=>r.probeText),b,(r,i)=>{f.set(r,i),e.writeVector?.(o,P,r,i)});t.forEach((r,i)=>u.set(r.tempRef,s[i]));for(let r of t){let i=u.get(r.tempRef);for(let g of m){let h=f.get(g.cid);if(h===void 0)continue;let x=D(S(i,h),y(r.probeText,g.text),v);x>=c&&d.push({tempRef:r.tempRef,candidateCid:g.cid,score:x,scorer:"embedding"})}}return{hits:d,degraded:!1,probeBasis:p}}catch(l){w(JSON.stringify({event:"dedup_probe_degraded",candidates:t.length,reason:String(l?.message??l).slice(0,160),ts:new Date().toISOString()}),"DEDUP_PROBE_DEGRADED");for(let f of t)for(let b of m){let s=y(f.probeText,b.text);s>=c&&d.push({tempRef:f.tempRef,candidateCid:b.cid,score:s,scorer:"lexical_fallback"})}return{hits:d,degraded:!0,probeBasis:p}}},recheckLocal(a,t,p,m){let d=[],l=[],f=new Set;for(let b of m)for(let s of b.nodes){if(s.label!=="usecase"||f.has(s.cid)||(f.add(s.cid),a.superseded.has(s.cid)||!a.hasNode(s.cid)))continue;let r=A(s.content),i=o!==null?e.readVector?.(o,P,s.cid)??null:null,g=i!==null;for(let h of t){let x=u.get(h.tempRef),R;i!==null&&x!==void 0?R=D(S(x,i),y(h.probeText,r),v):(R=y(h.probeText,r),g=g&&!1),R>=c&&d.push({tempRef:h.tempRef,candidateCid:s.cid,score:R,scorer:i!==null&&x!==void 0?"embedding":"lexical_fallback"})}g||l.push(s.cid)}return{hits:d,uncachedNewNodes:l}}}}export{B as a};
2
+ import{a as C}from"./chunk-W5HFUBXD.js";import{e as w}from"./chunk-ZAQGIC33.js";var E=.8,P="usecase-dedup";function S(n,e){let c=Math.min(n.length,e.length),u=0,o=0,a=0;for(let t=0;t<c;t++)u+=n[t]*e[t],o+=n[t]*n[t],a+=e[t]*e[t];return o===0||a===0?0:u/(Math.sqrt(o)*Math.sqrt(a))}function D(n,e,c){return c*n+(1-c)*e}var v=.7;function _(n){return new Set(n.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").split(" ").filter(Boolean))}function y(n,...e){let c=_(n);if(c.size===0)return 0;let u=n.trim().toLowerCase(),o=0;for(let a of e){let t=_(a);if(t.size===0)continue;let p=0;for(let l of c)t.has(l)&&p++;let m=c.size+t.size-p,d=m===0?0:p/m;u&&a.toLowerCase().includes(u)&&(d=Math.max(d,.9)),o=Math.max(o,d)}return o}var A=n=>String(n.title??"");function H(n){return n.byLabel("usecase").filter(e=>!n.superseded.has(e.cid)).map(e=>({cid:e.cid,text:A(e.content)}))}function B(n,e){let c=e.threshold??E,u=new Map,o=null;return{async batchSimilar(a,t){let p=a.latestHash;if(t.length===0)return{hits:[],degraded:!1,probeBasis:p};let m=H(a),d=[];try{let l=await e.resolveAlias(P);o=l.alias,e.prefetchVectors?.(o,P,l.dims);let f=new Map,b=[];for(let r of m){let i=e.readVector?.(o,P,r.cid)??null;i!==null?f.set(r.cid,i):b.push(r)}let s=await C(r=>e.embed(P,r),t.map(r=>r.probeText),b,(r,i)=>{f.set(r,i),e.writeVector?.(o,P,r,i)});t.forEach((r,i)=>u.set(r.tempRef,s[i]));for(let r of t){let i=u.get(r.tempRef);for(let g of m){let h=f.get(g.cid);if(h===void 0)continue;let x=D(S(i,h),y(r.probeText,g.text),v);x>=c&&d.push({tempRef:r.tempRef,candidateCid:g.cid,score:x,scorer:"embedding"})}}return{hits:d,degraded:!1,probeBasis:p}}catch(l){w(JSON.stringify({event:"dedup_probe_degraded",candidates:t.length,reason:String(l?.message??l).slice(0,160),ts:new Date().toISOString()}),"DEDUP_PROBE_DEGRADED");for(let f of t)for(let b of m){let s=y(f.probeText,b.text);s>=c&&d.push({tempRef:f.tempRef,candidateCid:b.cid,score:s,scorer:"lexical_fallback"})}return{hits:d,degraded:!0,probeBasis:p}}},recheckLocal(a,t,p,m){let d=[],l=[],f=new Set;for(let b of m)for(let s of b.nodes){if(s.label!=="usecase"||f.has(s.cid)||(f.add(s.cid),a.superseded.has(s.cid)||!a.hasNode(s.cid)))continue;let r=A(s.content),i=o!==null?e.readVector?.(o,P,s.cid)??null:null,g=i!==null;for(let h of t){let x=u.get(h.tempRef),R;i!==null&&x!==void 0?R=D(S(x,i),y(h.probeText,r),v):(R=y(h.probeText,r),g=g&&!1),R>=c&&d.push({tempRef:h.tempRef,candidateCid:s.cid,score:R,scorer:i!==null&&x!==void 0?"embedding":"lexical_fallback"})}g||l.push(s.cid)}return{hits:d,uncachedNewNodes:l}}}}export{B as a};
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as j}from"./chunk-MKPDF26Q.js";import{e as d}from"./chunk-6K5BEEAJ.js";import{r as a}from"./chunk-UJLULWSR.js";import{a as y}from"./chunk-GGV336P5.js";import{a as h}from"./chunk-VZA7BPCK.js";var $=10,u=200,C=1e4,N=1e6;function k(t,e,r="streaming"){let n=r==="full-fetch"?N:C,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function S(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function b(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
2
+ import{a as j}from"./chunk-M7Y5GGVJ.js";import{e as d}from"./chunk-6K5BEEAJ.js";import{r as a}from"./chunk-UJLULWSR.js";import{a as y}from"./chunk-FI2DVNRT.js";import{a as h}from"./chunk-K75WIRI5.js";var $=10,u=200,C=1e4,N=1e6;function k(t,e,r="streaming"){let n=r==="full-fetch"?N:C,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function S(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function b(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
3
3
  `)){for(let n of t)r(JSON.stringify(n));r(JSON.stringify({_meta:"page",limit:e.limit,offset:e.offset,returned:t.length,has_more:e.has_more}))}function T(t,e,r=n=>process.stdout.write(`${n}
4
- `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:m}=await import("./token-refresh-LR33BKAB.js"),w=await m({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(m){return{ok:!1,reason:"refresh_failed",detail:m instanceof Error?m.message:String(m)}}let c=y(e),f=await new j(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
4
+ `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:m}=await import("./token-refresh-K6PVBBFE.js"),w=await m({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(m){return{ok:!1,reason:"refresh_failed",detail:m instanceof Error?m.message:String(m)}}let c=y(e),f=await new j(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
5
5
  `,exitCode:2};case"refresh_failed":return{message:`error: OAuth token refresh failed for profile "${t}" [${e}]${r.detail?`: ${r.detail}`:""}. Run \`kane-cli login\` to re-auth.
6
6
  `,exitCode:2};case"exchange_failed":return{message:`error: TMS credential exchange failed for profile "${t}" [${e}]. Token may be revoked \u2014 try \`kane-cli login\`; if the problem persists, TMS may be down.
7
7
  `,exitCode:2}}}function M(t){return{id:t.project_id,name:t.name}}function O(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function x(t,e=r=>process.stdout.write(`${r}
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as p}from"./chunk-73Y6T2UK.js";import{Ha as l}from"./chunk-TLOYTGVT.js";import{c as u}from"./chunk-GGV336P5.js";import{existsSync as d,mkdirSync as m,readFileSync as j,rmSync as g,writeFileSync as y,statSync as I}from"fs";import{dirname as f,join as n}from"path";var o=n(".testmuai","assurance.json");function N(e,r=u()){let t={kind:"local",dir:p(e)},s=r.trim().replace(/\/+$/,"");if(!s)return t;let a=d(n(e,o));if(d(t.dir))return a?{kind:"refuse",code:"BOTH_STORES",refusal:l.bothStores(i(n(e,o))?.projectName??null)}:t;if(!a)return{kind:"pick",latticeUrl:s};let c=i(n(e,o));return c===null?{kind:"refuse",code:"PROJECT_FILE_UNREADABLE",refusal:l.linkUnreadable()}:{kind:"remote",latticeUrl:s,projectId:c.projectId,projectName:c.projectName}}function P(e){return i(n(e,o))?.lastUserId??null}function R(e,r){let t=i(n(e,o));t!==null&&t.lastUserId!==r&&S(e,{...t,lastUserId:r})}function i(e){try{let r=JSON.parse(j(e,"utf8"));return typeof r!="object"||r===null||Array.isArray(r)||typeof r.projectId!="string"||r.projectId===""||typeof r.projectName!="string"?null:{projectId:r.projectId,projectName:r.projectName,writtenBy:typeof r.writtenBy=="string"?r.writtenBy:"",...typeof r.lastUserId=="string"?{lastUserId:r.lastUserId}:{}}}catch{return null}}function O(e){try{return!I(n(e,f(o))).isDirectory()}catch{return!1}}function S(e,r){let t=n(e,o);m(f(t),{recursive:!0}),y(t,JSON.stringify(r,null,2)+`
2
+ import{a as p}from"./chunk-73Y6T2UK.js";import{Ha as l}from"./chunk-H4TIVILC.js";import{c as u}from"./chunk-FI2DVNRT.js";import{existsSync as d,mkdirSync as m,readFileSync as j,rmSync as g,writeFileSync as y,statSync as I}from"fs";import{dirname as f,join as n}from"path";var o=n(".testmuai","assurance.json");function N(e,r=u()){let t={kind:"local",dir:p(e)},s=r.trim().replace(/\/+$/,"");if(!s)return t;let a=d(n(e,o));if(d(t.dir))return a?{kind:"refuse",code:"BOTH_STORES",refusal:l.bothStores(i(n(e,o))?.projectName??null)}:t;if(!a)return{kind:"pick",latticeUrl:s};let c=i(n(e,o));return c===null?{kind:"refuse",code:"PROJECT_FILE_UNREADABLE",refusal:l.linkUnreadable()}:{kind:"remote",latticeUrl:s,projectId:c.projectId,projectName:c.projectName}}function P(e){return i(n(e,o))?.lastUserId??null}function R(e,r){let t=i(n(e,o));t!==null&&t.lastUserId!==r&&S(e,{...t,lastUserId:r})}function i(e){try{let r=JSON.parse(j(e,"utf8"));return typeof r!="object"||r===null||Array.isArray(r)||typeof r.projectId!="string"||r.projectId===""||typeof r.projectName!="string"?null:{projectId:r.projectId,projectName:r.projectName,writtenBy:typeof r.writtenBy=="string"?r.writtenBy:"",...typeof r.lastUserId=="string"?{lastUserId:r.lastUserId}:{}}}catch{return null}}function O(e){try{return!I(n(e,f(o))).isDirectory()}catch{return!1}}function S(e,r){let t=n(e,o);m(f(t),{recursive:!0}),y(t,JSON.stringify(r,null,2)+`
3
3
  `)}function A(e){g(n(e,o),{force:!0})}export{o as a,N as b,P as c,R as d,i as e,O as f,S as g,A as h};