@testmuai/kane-cli 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/dist/ChatSurface-D66CACLX.js +8 -0
  2. package/dist/{ChromeProfilePicker-DK2A3NYY.js → ChromeProfilePicker-4CDSPBWL.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-D5QDOBE2.js → CliFeedbackPrompt-TLRVBA4E.js} +1 -1
  4. package/dist/{CliUploadProgress-AIZL7N6Z.js → CliUploadProgress-WGGFLUSF.js} +1 -1
  5. package/dist/{ConfigView-SDBCTYUU.js → ConfigView-DBANTBXC.js} +1 -1
  6. package/dist/EvidenceViewOffer-DNCQ3A6R.js +2 -0
  7. package/dist/{FolderPicker-IVBHPPMW.js → FolderPicker-W7RCIFEL.js} +1 -1
  8. package/dist/{HelpView-YYYX4RKI.js → HelpView-FBCX32U7.js} +1 -1
  9. package/dist/{InfoBox-MQV3XBT4.js → InfoBox-KK2ICVS4.js} +1 -1
  10. package/dist/{LinksBox-NCFNBUMW.js → LinksBox-KKRANMR3.js} +1 -1
  11. package/dist/{ProfilesView-6GXF6CP2.js → ProfilesView-DGPXSAQN.js} +1 -1
  12. package/dist/{ProjectPicker-W6XDGNDJ.js → ProjectPicker-ESQSL4TT.js} +1 -1
  13. package/dist/{SaveSessionPrompt-QF3P7ERS.js → SaveSessionPrompt-AQGP5W6E.js} +1 -1
  14. package/dist/SingleShotApp-SMCAIKCE.js +2 -0
  15. package/dist/{SummaryBox-4SZI4XSO.js → SummaryBox-BFZJW2KK.js} +1 -1
  16. package/dist/TestMdRunView-FMKZJ3A3.js +2 -0
  17. package/dist/{WhoamiView-N3HAJ3TN.js → WhoamiView-JABY3I5Q.js} +1 -1
  18. package/dist/{auth-RXNBQZI2.js → auth-76LVI6B5.js} +1 -1
  19. package/dist/bind-AACBTSAA.js +12 -0
  20. package/dist/bootstrap-CNOZ5VRB.js +2 -0
  21. package/dist/bridge-T4HL4TG7.js +2 -0
  22. package/dist/{changelog-MI3IPBJS.js → changelog-PSWPPOAF.js} +1 -1
  23. package/dist/chat-committer-4BQBOKI4.js +2 -0
  24. package/dist/chat-controller-NNTMKEPG.js +2 -0
  25. package/dist/{chunk-GQ3NCBYR.js → chunk-2KBD6JZX.js} +1 -1
  26. package/dist/chunk-2SREGETM.js +4 -0
  27. package/dist/chunk-2XGDWUJ5.js +2 -0
  28. package/dist/{chunk-DFDDUMG5.js → chunk-322JEJEH.js} +1 -1
  29. package/dist/{chunk-4BAMZSFU.js → chunk-323MLBYA.js} +1 -1
  30. package/dist/{chunk-VYMCE7UR.js → chunk-33QXD75Y.js} +2 -2
  31. package/dist/{chunk-K7USHLVZ.js → chunk-36OC3TFE.js} +1 -1
  32. package/dist/{chunk-4SJC64KQ.js → chunk-3FN5VJMV.js} +1 -1
  33. package/dist/chunk-3LWTUMDG.js +2 -0
  34. package/dist/chunk-3STZLM5J.js +4 -0
  35. package/dist/{chunk-4GLYNAK7.js → chunk-4OPQJ7PE.js} +1 -1
  36. package/dist/chunk-5JTUL6XL.js +2 -0
  37. package/dist/{chunk-FMR2KPSK.js → chunk-5KFS3GAZ.js} +1 -1
  38. package/dist/{chunk-EN7NW7DU.js → chunk-6HEGD6H2.js} +1 -1
  39. package/dist/{chunk-AV6E6WLY.js → chunk-6UJDOAYR.js} +2 -2
  40. package/dist/{chunk-5WE4DHXL.js → chunk-73C4PRYU.js} +1 -1
  41. package/dist/chunk-AAONIIQV.js +6 -0
  42. package/dist/chunk-AH7ZZIZY.js +2 -0
  43. package/dist/chunk-AM5S4KG4.js +6 -0
  44. package/dist/{chunk-J3EMJ7US.js → chunk-APAIWBIH.js} +1 -1
  45. package/dist/{chunk-XIXR63FI.js → chunk-BAL64WSI.js} +1 -1
  46. package/dist/chunk-BB2W35TW.js +2 -0
  47. package/dist/chunk-BQHKBOSF.js +11 -0
  48. package/dist/{chunk-B4LLKQTK.js → chunk-C4G7RVJ6.js} +1 -1
  49. package/dist/{chunk-YHQFYZJ5.js → chunk-CDQX6HGJ.js} +1 -1
  50. package/dist/{chunk-XLKRV2JH.js → chunk-CSQ46PJ7.js} +1 -1
  51. package/dist/chunk-DQ54MH7F.js +13 -0
  52. package/dist/{chunk-T7ZPMTGS.js → chunk-DXV6MBTD.js} +1 -1
  53. package/dist/chunk-DYW5C6II.js +2 -0
  54. package/dist/{chunk-WREVEATJ.js → chunk-F6ZOJXYU.js} +1 -1
  55. package/dist/chunk-GVIPTX6T.js +6 -0
  56. package/dist/chunk-GW5DWAXY.js +2 -0
  57. package/dist/chunk-HJERKSBK.js +349 -0
  58. package/dist/{chunk-AYY7RYMK.js → chunk-HPMS5KO6.js} +2 -2
  59. package/dist/{chunk-3RZ63RBO.js → chunk-IBNC444G.js} +1 -1
  60. package/dist/{chunk-WTXHOWUP.js → chunk-IQDWBTRJ.js} +1 -1
  61. package/dist/{chunk-5YHVK2EO.js → chunk-IXVOXJP6.js} +1 -1
  62. package/dist/{chunk-IQODWB32.js → chunk-JEUA4UWK.js} +1 -1
  63. package/dist/{chunk-CH3VWCRZ.js → chunk-JKTFTF24.js} +1 -1
  64. package/dist/{chunk-A2IQRVPR.js → chunk-JRMDGLLT.js} +1 -1
  65. package/dist/{chunk-RQYS3KGU.js → chunk-KNDSQ4PS.js} +1 -1
  66. package/dist/chunk-KRXSXQBU.js +12 -0
  67. package/dist/{chunk-NR23HZU4.js → chunk-KT6G7AF2.js} +1 -1
  68. package/dist/chunk-KVQOBPAZ.js +2 -0
  69. package/dist/chunk-L2TV4G56.js +4 -0
  70. package/dist/{chunk-6HYW5RFX.js → chunk-L4JIMNKW.js} +1 -1
  71. package/dist/{chunk-X5P2T7MA.js → chunk-L7VREJTG.js} +1 -1
  72. package/dist/{chunk-QQUZF2DZ.js → chunk-LQZ2BU7Q.js} +1 -1
  73. package/dist/{chunk-MTHCUBDF.js → chunk-LR5XO2KD.js} +1 -1
  74. package/dist/chunk-M7WQM4UA.js +4 -0
  75. package/dist/{chunk-KHQHVSZ6.js → chunk-NAC7SFBE.js} +1 -1
  76. package/dist/{chunk-CSGQIY7X.js → chunk-NAE7MBR2.js} +3 -3
  77. package/dist/{chunk-LGVHW4ZA.js → chunk-NBKQT7LJ.js} +1 -1
  78. package/dist/{chunk-RODHDQU3.js → chunk-NJPTOKW5.js} +1 -1
  79. package/dist/{chunk-44IWSV6L.js → chunk-NOCIMJSN.js} +1 -1
  80. package/dist/chunk-NRC2G4Y5.js +5 -0
  81. package/dist/{chunk-67SSEGDO.js → chunk-NRTHYROA.js} +1 -1
  82. package/dist/chunk-O56PUUNL.js +9 -0
  83. package/dist/chunk-OHRS3H7Z.js +5 -0
  84. package/dist/{chunk-FCHTL74E.js → chunk-PMHJRT3A.js} +1 -1
  85. package/dist/{chunk-GRB66C5S.js → chunk-QROUKGKU.js} +1 -1
  86. package/dist/{chunk-AIMINJVP.js → chunk-R2RGSO4B.js} +1 -1
  87. package/dist/{chunk-77WMTCUQ.js → chunk-RNSSM2BK.js} +1 -1
  88. package/dist/chunk-SE6WNCYU.js +4 -0
  89. package/dist/{chunk-KCBS57IF.js → chunk-SRDHPKJT.js} +1 -1
  90. package/dist/chunk-SWESH2J7.js +10 -0
  91. package/dist/chunk-SY3HLQMV.js +4 -0
  92. package/dist/chunk-T63R6QT4.js +4 -0
  93. package/dist/{chunk-SBZWFULF.js → chunk-UBFKZEX3.js} +1 -1
  94. package/dist/{chunk-E5PWL3BG.js → chunk-UI7KULSI.js} +1 -1
  95. package/dist/chunk-UPPEOQJQ.js +3 -0
  96. package/dist/{chunk-QBCS57EO.js → chunk-URQUQWGW.js} +3 -3
  97. package/dist/chunk-UX2B7L6K.js +2 -0
  98. package/dist/{chunk-K4VIM4RM.js → chunk-V36ATG7A.js} +2 -2
  99. package/dist/chunk-VGFTNLQQ.js +2 -0
  100. package/dist/{chunk-VJFFMOUA.js → chunk-W5DOU2DV.js} +1 -1
  101. package/dist/chunk-W6VD2XFO.js +19 -0
  102. package/dist/chunk-WJ5HDEVH.js +6 -0
  103. package/dist/chunk-WWNSD6FA.js +6 -0
  104. package/dist/{chunk-MV4UYTZT.js → chunk-X3ICV5M5.js} +1 -1
  105. package/dist/chunk-XDHZMCTA.js +4 -0
  106. package/dist/{chunk-BCH3JCND.js → chunk-XVDJ423L.js} +1 -1
  107. package/dist/chunk-ZLCZDAEX.js +6 -0
  108. package/dist/{chunk-HOOXUO3X.js → chunk-ZM5PVRJK.js} +1 -1
  109. package/dist/committer-2EJPVVCQ.js +2 -0
  110. package/dist/{config-5GOFF5F4.js → config-R3GF2FZA.js} +1 -1
  111. package/dist/cover-cmd-TXICWHUU.js +3 -0
  112. package/dist/{credentials-GXDXVMXW.js → credentials-XN4ROCQ3.js} +1 -1
  113. package/dist/design-committer-BQUWD6AC.js +2 -0
  114. package/dist/docx-convert-ZBVQO2LG.js +1 -1
  115. package/dist/dossier-QZV74XOS.js +3 -0
  116. package/dist/evidence-V23FPVXQ.js +2 -0
  117. package/dist/evolve-cmd-PZCPXDMR.js +2 -0
  118. package/dist/{exit-manager-MXUD7GQ7.js → exit-manager-HNFATGSM.js} +1 -1
  119. package/dist/explain-UE4IACQH.js +2 -0
  120. package/dist/{explain-cmd-NWIYH5MI.js → explain-cmd-RZW6QJYM.js} +1 -1
  121. package/dist/{explain-cmd-DBUTPZHA.js → explain-cmd-X7JZLSZZ.js} +1 -1
  122. package/dist/extract-bind-BFY7IRL4.js +10 -0
  123. package/dist/extract-cmd-U3MGK2LP.js +6 -0
  124. package/dist/feeder-XGTFV7TZ.js +2 -0
  125. package/dist/gaps-cmd-BWCRLLBK.js +3 -0
  126. package/dist/{gate-B6C6KLFA.js → gate-YHBPWEM5.js} +1 -1
  127. package/dist/{generate-headless-LZ4HRSQ4.js → generate-headless-BSTDLZZY.js} +2 -2
  128. package/dist/{headless-io-PWW6YKH2.js → headless-io-BL3TEAX5.js} +1 -1
  129. package/dist/index.js +61 -62
  130. package/dist/ingest-AL6CABJT.js +2 -0
  131. package/dist/ingest-cmd-O6OWWZT4.js +2 -0
  132. package/dist/interactive-bind-43HGDF5K.js +24 -0
  133. package/dist/lifecycle-cmd-D6TVTYRK.js +2 -0
  134. package/dist/list-cmd-XCAV2FKA.js +3 -0
  135. package/dist/{list-commands-WIVODSEL.js → list-commands-747UTUSS.js} +1 -1
  136. package/dist/locks-cmd-QAULI5LV.js +2 -0
  137. package/dist/logical-ids-4G4FAHNJ.js +2 -0
  138. package/dist/login-flow-CV76ENHV.js +2 -0
  139. package/dist/maintenance-cmd-ZRB4NTGG.js +2 -0
  140. package/dist/next-TRSKMBO5.js +2 -0
  141. package/dist/paths-JCYX6UWL.js +2 -0
  142. package/dist/{persist-recorded-session-J6Z2SCTT.js → persist-recorded-session-MDPWWUA7.js} +1 -1
  143. package/dist/phase-seed-52LRE3LH.js +2 -0
  144. package/dist/pipeline-LM5JAK7F.js +2 -0
  145. package/dist/readmodel-X7L7W2BA.js +2 -0
  146. package/dist/reconcile-cmd-DGCSDML6.js +2 -0
  147. package/dist/{recording-banner-IRFMIZSJ.js → recording-banner-TALO7PUR.js} +1 -1
  148. package/dist/records-5SVUXJBW.js +2 -0
  149. package/dist/{require-project-folder-XSBJGIVF.js → require-project-folder-R347LFDQ.js} +1 -1
  150. package/dist/revert-DXXYXJGN.js +2 -0
  151. package/dist/review-cmd-2QF5HTI7.js +4 -0
  152. package/dist/run-52UIBPXD.js +2 -0
  153. package/dist/run-VRVH4VO3.js +2 -0
  154. package/dist/{run-test-md-QCERS7FQ.js → run-test-md-DFNIGYB7.js} +2 -2
  155. package/dist/sessions-BLXZVK5U.js +2 -0
  156. package/dist/sessions-cmd-AQWLL5ZN.js +25 -0
  157. package/dist/{skill-installer-WAVEVCSG.js → skill-installer-ANXTCXQV.js} +1 -1
  158. package/dist/spawner-AH5FTUYU.js +2 -0
  159. package/dist/structured-answers-QHFGZPSS.js +5 -0
  160. package/dist/tcg-generate-WKCBBKI5.js +2 -0
  161. package/dist/testmd-actions-RPYG6TJG.js +2 -0
  162. package/dist/token-refresh-NIDUOTRM.js +2 -0
  163. package/dist/trust-gate-EX7R2P4Y.js +2 -0
  164. package/dist/{validate-basic-IJKKRQRU.js → validate-basic-O2DP2XJL.js} +1 -1
  165. package/dist/verdicts-TJH3O5UW.js +2 -0
  166. package/dist/{version-check-O5GYZYTP.js → version-check-RNR3JCQ5.js} +1 -1
  167. package/dist/{view-cmd-GQBFCPDL.js → view-cmd-YSEGA5PI.js} +1 -1
  168. package/dist/walk-session-HXW4OSA2.js +2 -0
  169. package/dist/with-telemetry-PNP6CAVM.js +2 -0
  170. package/package.json +6 -6
  171. package/dist/ChatSurface-PMEOJBZG.js +0 -8
  172. package/dist/EvidenceViewOffer-EOKJE2B6.js +0 -2
  173. package/dist/SingleShotApp-T673X7BS.js +0 -2
  174. package/dist/TestMdRunView-SNYEO6CS.js +0 -2
  175. package/dist/bind-NSGW5BBZ.js +0 -6
  176. package/dist/bootstrap-RPT3JOGD.js +0 -2
  177. package/dist/bridge-BTSWCJ3B.js +0 -2
  178. package/dist/chat-committer-OS7ULZMH.js +0 -2
  179. package/dist/chat-controller-QLORQWJZ.js +0 -2
  180. package/dist/chunk-3C5GMAM4.js +0 -2
  181. package/dist/chunk-3CJIMPQK.js +0 -14
  182. package/dist/chunk-4XSW6WZD.js +0 -5
  183. package/dist/chunk-6W6AIDLJ.js +0 -4
  184. package/dist/chunk-7E24OCGX.js +0 -2
  185. package/dist/chunk-7YPK6EDR.js +0 -4
  186. package/dist/chunk-DGIPQINV.js +0 -12
  187. package/dist/chunk-FHKDTM5L.js +0 -6
  188. package/dist/chunk-FRBYGSGJ.js +0 -4
  189. package/dist/chunk-GG43HSU2.js +0 -3
  190. package/dist/chunk-J2KSZUOO.js +0 -4
  191. package/dist/chunk-J44RN3FB.js +0 -2
  192. package/dist/chunk-JSF5JYZC.js +0 -9
  193. package/dist/chunk-MAO5BAQI.js +0 -347
  194. package/dist/chunk-N4LMQR7C.js +0 -6
  195. package/dist/chunk-RCTM7NGT.js +0 -2
  196. package/dist/chunk-RN4OSVTG.js +0 -6
  197. package/dist/chunk-UXPQRALY.js +0 -13
  198. package/dist/chunk-V3UE6RJP.js +0 -2
  199. package/dist/chunk-Y5RNCJAN.js +0 -19
  200. package/dist/chunk-Z2JSEL3I.js +0 -4
  201. package/dist/cover-cmd-SV3I23UM.js +0 -2
  202. package/dist/dossier-KJSJPWOW.js +0 -3
  203. package/dist/evidence-VDNZ3K23.js +0 -2
  204. package/dist/evolve-cmd-BLSVVW4I.js +0 -2
  205. package/dist/explain-EBVIUS2X.js +0 -2
  206. package/dist/extract-bind-3SWPBZX6.js +0 -8
  207. package/dist/extract-cmd-HEX7F4IS.js +0 -6
  208. package/dist/gaps-cmd-CKCHH3HQ.js +0 -2
  209. package/dist/ingest-FIIO67ZN.js +0 -2
  210. package/dist/ingest-cmd-KRPZVB7W.js +0 -7
  211. package/dist/interactive-bind-PTAZVCE7.js +0 -10
  212. package/dist/lifecycle-cmd-32LG364Q.js +0 -2
  213. package/dist/list-cmd-UTZ2PQUK.js +0 -3
  214. package/dist/logical-ids-I7B3VJEH.js +0 -2
  215. package/dist/login-flow-GX7CTVWN.js +0 -2
  216. package/dist/maintenance-cmd-BZAGSYGI.js +0 -2
  217. package/dist/pipeline-HT7FCEXA.js +0 -2
  218. package/dist/readmodel-S5RAQH3F.js +0 -2
  219. package/dist/reconcile-cmd-2VHBKFA5.js +0 -2
  220. package/dist/revert-RQJE56HF.js +0 -2
  221. package/dist/review-cmd-7LXGYHHQ.js +0 -4
  222. package/dist/run-4LTYFTF2.js +0 -2
  223. package/dist/run-YGJZ2SXX.js +0 -2
  224. package/dist/sessions-cmd-DTQYDZNT.js +0 -23
  225. package/dist/spawner-YNYB4Z7K.js +0 -2
  226. package/dist/tcg-generate-D35EMRMQ.js +0 -2
  227. package/dist/testmd-actions-NB5Z6QJ3.js +0 -2
  228. package/dist/token-refresh-OY3WLAKD.js +0 -2
  229. package/dist/walk-session-OPAEV4WR.js +0 -2
  230. /package/dist/{chunk-BC7UVJJB.js → chunk-CH273NAE.js} +0 -0
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{e as a,f as b,g as c,h as d,i as e}from"./chunk-SE6WNCYU.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-NVGBE2DR.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{a as compositePayloadBytes,e as ingestBytes,d as ingestFile,b as slugFromFilename,c as versionBaseOf};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-BQHKBOSF.js";import"./chunk-EV3EHXEI.js";import"./chunk-F7WKDMX7.js";import"./chunk-VOHQA2SP.js";import"./chunk-ZLCZDAEX.js";import"./chunk-SE6WNCYU.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{c as ingestCommand,b as runIngestCommand,a as runIngestWithResults};
@@ -0,0 +1,24 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as T}from"./chunk-HJERKSBK.js";import"./chunk-IBNC444G.js";import"./chunk-KHU7C6EE.js";import"./chunk-KVQOBPAZ.js";import"./chunk-AM5S4KG4.js";import"./chunk-5JTUL6XL.js";import"./chunk-O56PUUNL.js";import"./chunk-NRC2G4Y5.js";import"./chunk-BQHKBOSF.js";import"./chunk-2XGDWUJ5.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-5KFS3GAZ.js";import"./chunk-EV3EHXEI.js";import"./chunk-F7WKDMX7.js";import"./chunk-VOHQA2SP.js";import"./chunk-XDHZMCTA.js";import"./chunk-AAONIIQV.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import{c as P}from"./chunk-ZLCZDAEX.js";import"./chunk-SE6WNCYU.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import{a as A,b as $}from"./chunk-IQDWBTRJ.js";import"./chunk-GVIPTX6T.js";import"./chunk-BKM2LWU2.js";import"./chunk-2XMJ6YAE.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import{a as R}from"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";async function J(e){let[{render:o},t,{QuestionBatchPrompt:r}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),u=t.default??t;return new Promise(s=>{let g=o(u.createElement(r,{questions:e,onSubmit:m=>{g.unmount(),s(m)}}))})}async function S(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await t.question(`${e} [y/N] `)).trim())}finally{t.close()}}async function K(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{process.stdout.write(`${e.message}
3
+ `),process.stdout.write(` 1. start at ${e.earliest} instead \u2014 the earliest uncommitted phase (recommended)
4
+ `),process.stdout.write(` 2. proceed anyway \u2014 noted on the record
5
+ `),process.stdout.write(` 3. cancel
6
+ `);let r=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return r===""||r==="1"?"earliest":r==="2"?"proceed":"cancel"}finally{t.close()}}async function I(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{if(process.stdout.write(`${e.message}
7
+ `),e.wall==="already-designed"){process.stdout.write(` 1. view the existing design (recommended)
8
+ `),process.stdout.write(` 2. redesign \u2014 asks a reason; ${e.impactPairs} live pair(s) superseded
9
+ `),process.stdout.write(` 3. pick another use-case
10
+ `);let u=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return u===""||u==="1"?{pick:"view"}:u==="2"?{pick:"redesign",because:(await t.question("because (reason for the redesign): ")).trim()}:{pick:"back"}}process.stdout.write(` 1. refresh first \u2014 evolve re-designs against the moved use-case (recommended)
11
+ `),process.stdout.write(` 2. proceed anyway \u2014 asks a reason, noted on the record
12
+ `),process.stdout.write(` 3. back
13
+ `);let r=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return r===""||r==="1"?{pick:"refresh"}:r==="2"?{pick:"proceed",because:(await t.question("because (reason for proceeding): ")).trim()}:{pick:"back"}}finally{t.close()}}async function Z(e){let[{resolveAgentAuthEnv:o},{runAgent:t},{preflightTurn:r}]=await Promise.all([import("./spawner-AH5FTUYU.js"),import("./bridge-T4HL4TG7.js"),import("./turn-preflight-JGYT7LXP.js")]),u=await o(),s=R(process.cwd()),{baseUrlAdvisory:g}=await import("./turn-preflight-JGYT7LXP.js"),m=g();m&&process.stderr.write(m+`
14
+ `);let i=$({verb:"design",mode:e.plan?"cli":"interactive",contextRoot:s,env:A(),resumeSid:e.resume,write:!0,longSession:!0}),h={...u,...i.spawnEnv()},k=await r(h);if(!k.ok)return process.stderr.write((k.message??"error: turn-endpoint preflight failed")+`
15
+ `),process.stderr.write(i.supportFooter()+`
16
+ `),i.error("preflight_auth"),await i.end({exit_code:2}),2;let C=async()=>k;if(e.plan){let n=await T({...e,confirmRetarget:S,askPhaseEntry:K,askDesignEntry:I},{contextDir:s,agent:t,preflightTurn:C,ask:J,out:a=>process.stdout.write(a+`
17
+ `),progress:a=>process.stderr.write(a+`
18
+ `),isTTY:P(),auth:h,telemetry:i});return n===1&&process.stderr.write(i.supportFooter()+`
19
+ `),await i.end({exit_code:n}),n}if(!e.resume&&e.useCase&&!e.phase){let[{openGraph:n},{designGate:a}]=await Promise.all([import("./readmodel-X7L7W2BA.js"),import("./gate-YHBPWEM5.js")]),l=n(s),c=a(l,e.useCase,!!e.force);if(!c.ok)if(c.wall){let{captureForceScope:H}=await import("./design-committer-BQUWD6AC.js"),d=await I({wall:c.wall.kind,message:c.message,display:c.wall.display,impactPairs:H(l,e.useCase).length});if(d.pick==="redesign"||d.pick==="proceed"){if(!d.because.trim())return process.stderr.write(`a redesign needs a reason (--because) \u2014 nothing executed
20
+ `),2;e={...e,force:!0,because:e.because??d.because.trim()}}else return d.pick==="view"?(process.stdout.write(`view the existing design: kane-cli context view ${c.wall.display}
21
+ `),0):d.pick==="refresh"?(process.stdout.write(`refresh it first: kane-cli maintain evolve ${c.wall.display}
22
+ `),0):(process.stdout.write("nothing executed \u2014 pick another use-case (bare `kane-cli design tests` lists them)\n"),0)}else return process.stderr.write(`design: ${c.message}
23
+ `),c.code}let[{render:F},D,{ScrollbackProvider:q},{ChatSurface:G},{ScrollbackTap:N},{makeChatController:V},{setInkExit:_},j]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-D66CACLX.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-NNTMKEPG.js"),import("./exit-manager-HNFATGSM.js"),Promise.all([import("./chat-committer-4BQBOKI4.js"),import("./descriptor-KXDJ4XYD.js"),import("./explain-UE4IACQH.js"),import("./readmodel-X7L7W2BA.js")])]),[{commitChatTurn:B},{topologyDescriptor:O},{explain:Q},{openGraph:y}]=j,b=D.default??D,p=V({commitChatTurn:B,descriptor:O("design"),contextDir:s,refreshGraph:()=>y(s),graph:y(s),explain:Q,by:{kind:"human",id:"owner"}}),{buildDossier:Y}=await import("./dossier-QZV74XOS.js"),U=n=>{try{return Y(y(s),n)}catch{return null}},v={current:null},E=0,x=null,w=!1,z=()=>{if(E+=1,E>=2){try{f.unmount()}catch{}process.exit(130)}p.requestPause(),x=setTimeout(()=>{w||(w=!0,(async()=>{p.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await v.current?.flush();try{f.unmount()}catch{}process.exit(130)})())},5e3)},f=F(b.createElement(q,null,b.createElement(N,{into:v}),b.createElement(G,{controller:p,verb:"design",onCtrlC:z,inspect:U})),{exitOnCtrlC:!1});_(()=>f.unmount()),p.ledger({kind:"banner",text:`kane-cli design \xB7 ${e.useCase??e.resume??""}`});try{let n=T({...e,confirmRetarget:S},{contextDir:s,agent:t,preflightTurn:C,ask:l=>p.ask(l),out:l=>p.note(l),progress:()=>{},isTTY:P(),auth:h,chat:p,telemetry:i});n.finally(()=>{w=!0});let a=await n;return a===1&&process.stderr.write(i.supportFooter()+`
24
+ `),await i.end({exit_code:a}),a}finally{w=!0,x&&clearTimeout(x),await v.current?.flush();try{f.unmount()}catch{}}}export{Z as bindDesignInteractive};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as l,b as a,c as f,d as m}from"./chunk-QROUKGKU.js";import"./chunk-ZLCZDAEX.js";import"./chunk-CH273NAE.js";import{a as c}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import{q as y,r as b,v}from"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var g={kind:"human",id:process.env.USER??"operator"},C=/^(UNKNOWN_|BAD_|INVALID_|MALFORMED_|NOT_|SLUG_TAKEN|ALREADY_|SUPERSEDED_)/;function w(e){return e.every(r=>C.test(r.code))?2:1}function p(e,r){for(let n of r)l(e,`${n.code}: ${n.detail}`);return w(r)}async function E(e,r,n,o=process.cwd()){let t=a(o,n);if(!t||!await f(n,`retire source ${e} (head \u2192 null + tombstone record)`,r.yes))return 2;let i=c(t),s=b({contextDir:t,graph:i,sourceId:e,reason:r.reason,by:g});return s.errors?p(n,s.errors):(n.out(`retired ${e} (record ${s.record.seq}) \u2014 its use-cases stay until no live source evidences them`),0)}async function _(e,r,n,o=process.cwd()){let t=a(o,n);if(!t)return 2;if(v.test(r))return l(n,`"${r}" is in the reserved sequential-id namespace (assigned at mint) \u2014 pick a descriptive name`),2;let i=c(t),s=y({contextDir:t,graph:i,assignments:[{ref:e,slug:r}],by:g});return s.errors?p(n,s.errors):(n.out(`named ${s.record.names[0].cid} as "${r}" (record ${s.record.seq})`),0)}async function x(e,r,n,o=process.cwd()){let t=a(o,n);if(!t)return 2;let i=Number(e);if(!await f(n,`revert record ${i} via a compensation record`,r.yes))return 2;let s=c(t),{commitRevert:$}=await import("./revert-DXXYXJGN.js"),d=$({contextDir:t,graph:s,seq:i,reason:r.reason,by:g});for(let h of d.warnings)n.out(`note: ${h}`);if(d.errors)return p(n,d.errors);let u=d.record;return n.out(`reverted record ${i} via compensation record ${u.seq}: ${u.supersessions.length} supersession(s), ${u.review.length} trust restoration(s), ${Object.keys(u.source_head_moves).length} head move(s) \u2014 history unchanged, effects inverted`),0}async function P(e,r){return E(e,r,m())}async function R(e,r){return _(e,r,m())}async function k(e={},r=process.cwd()){return D(e,m(),r)}async function D(e,r,n=process.cwd()){let o=a(n,r);if(!o||!await f(r,"assign logical ids to every live unnamed node (one commit record)",e.yes))return 2;let{backfillLogicalIds:t}=await import("./logical-ids-4G4FAHNJ.js"),i=c(o),s=t(o,i);return s.errors?p(r,s.errors):(r.out(s.assigned===0?"backfill: every live node already has a logical id":`backfill: assigned ${s.assigned} logical id(s) (record ${s.record.seq})`),0)}async function q(e,r){return x(e,r,m())}export{k as nameBackfillCommand,R as nameCommand,P as retireCommand,q as revertCommand,D as runNameBackfillCommand,_ as runNameCommand,E as runRetireCommand,x as runRevertCommand};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as m}from"./chunk-QROUKGKU.js";import"./chunk-ZLCZDAEX.js";import"./chunk-CH273NAE.js";import{a as g}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import{d as s}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var h=[s.SOURCE,s.USECASE,s.SCENARIO,s.AC,s.TEST,s.GAP];function b(n,e){if(n===s.SOURCE)return String(e.source_id??"");let l=e.question?.header,o=e.title??e.text??l??e.kind??"";return String(o)}function E(n,e){if(n.length<=e)return n;let l=n.slice(0,e-1),o=l.lastIndexOf(" ");return`${(o>e*.6?l.slice(0,o):l).trimEnd()}\u2026`}var p=58;async function O(n,e,l=process.cwd()){let o=m(l,e);if(!o)return 2;let a=g(o),i=[...a.nodeLabel.entries()].filter(([t])=>n.all||!a.superseded.has(t)).map(([t,r])=>{let u=a.getNode(t)?.content??{},f=a.trust.get(t)??(r===s.SOURCE?"-":"derived");return{id:r===s.SOURCE?String(u.source_id??""):a.nameOf.get(t)??t.slice(0,19),cid:t,label:r,title:b(r,u),trust:f,fresh:f==="archived"?"-":a.stale(t)}});if(n.type&&(i=i.filter(t=>t.label===n.type)),n.inferred&&(i=i.filter(t=>t.trust==="derived")),n.stale&&(i=i.filter(t=>t.fresh!=="fresh")),!n.all){let t=new Map;for(let r of i)t.set(`${r.label}:${r.id}`,r);i=[...t.values()]}let c=t=>{let r=h.indexOf(t);return r===-1?h.length:r};if(i.sort((t,r)=>c(t.label)-c(r.label)||t.title.localeCompare(r.title)),n.json){for(let t of i)e.out(JSON.stringify(t));return 0}if(i.length===0)return e.out("(no matching nodes)"),0;e.out("trust \xB7 fresh \xB7 title \xB7 id");let d=null;for(let t of i){if(t.label!==d){d=t.label;let u=i.filter(f=>f.label===t.label).length;e.out(""),e.out(`\u2500\u2500 ${t.label} \xB7 ${u} \u2500\u2500`)}let r=E(t.title||"(untitled)",p);e.out(` ${t.trust.padEnd(8)} ${t.fresh.padEnd(6)} ${r.padEnd(p)} ${t.id}`)}{let{heldArchiveScan:t}=await import("./feeder-XGTFV7TZ.js"),r=t(o,a).live.size;r>0&&(e.out(""),e.out(`${r} held archive(s) awaiting confirmation \u2014 kane-cli context review walks them (or --allow-archive --because applies headlessly)`))}return 0}async function C(n){return O(n,{out:e=>process.stdout.write(e+`
3
+ `),confirm:async()=>!1,isTTY:!!process.stdout.isTTY})}export{E as capWord,C as listCommand,O as runListCommand,b as titleOf};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i}from"./chunk-K4VIM4RM.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-WREVEATJ.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{d as emitNdjson,b as filterByName,g as formatAuthResolutionError,c as paginate,a as parsePagination,i as registerListCommands,e as renderTable,f as resolveTmsBasicAuth,h as validateCreateName};
2
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-V36ATG7A.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-F6ZOJXYU.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{d as emitNdjson,b as filterByName,g as formatAuthResolutionError,c as paginate,a as parsePagination,i as registerListCommands,e as renderTable,f as resolveTmsBasicAuth,h as validateCreateName};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as p,c as f}from"./chunk-WWNSD6FA.js";import"./chunk-UR6MHSHU.js";import{existsSync as c,readFileSync as l,readdirSync as w}from"fs";import{join as g}from"path";function h(n,m,i){let o=g(n,"locks");if(!c(n))return i(`error: no context store at ${n}`),2;let s=[],a=new Map,d=f(n);if(c(d))for(let r of w(d)){let e=r.split(".")[0];try{let t=JSON.parse(l(g(d,r),"utf8"));(a.get(e)??a.set(e,[]).get(e)).push({sid:t.sid,pid:t.pid})}catch{}}if(c(o)){for(let r of w(o))if(r.endsWith(".lock"))try{let e=JSON.parse(l(g(o,r),"utf8")),t=r.replace(/\.lock$/,"");s.push({key:t,grant:e,alive:p(e.pid),age_s:Math.max(0,Math.round((Date.now()-new Date(e.ts).getTime())/1e3)),waiters:a.get(t.replace(/^uc-/,""))??a.get(t)??[]})}catch{}}if(m.json)return i(JSON.stringify(s.map(r=>({key:r.key,owner_sid:r.grant.owner_sid,pid:r.grant.pid,alive:r.alive,verb:r.grant.verb,hold:r.grant.hold,age_s:r.age_s,waiters:r.waiters})))),0;if(s.length===0)return i("no locks held"),0;for(let r of s){i(`${r.key} ${r.grant.owner_sid} pid ${r.grant.pid} (${r.alive?"live":"dead"}) ${r.grant.verb}/${r.grant.hold} age ${r.age_s}s`);for(let e of r.waiters)i(` waiter: ${e.sid} (pid ${e.pid})`)}return 0}export{h as runLocksCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{q as d,t as f,u as m}from"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var y=Object.keys(f).filter(n=>n!=="source");function b(n,t,u={kind:"system",id:"logical-id-backfill"}){let l=new Set(t.names.keys()),r=[];for(let c of y)for(let{cid:s,content:e}of t.byLabel(c)){if(t.superseded.has(s)||t.nameOf.has(s))continue;let a=typeof e.title=="string"&&e.title||typeof e.intent=="string"&&e.intent||typeof e.statement=="string"&&e.statement||typeof e.text=="string"&&e.text||"",i=a?m(c,a,g=>l.has(g)):null;i&&(l.add(i),r.push({ref:s,slug:i}))}if(r.length===0)return{record:null,errors:null,assigned:0};let o=d({contextDir:n,graph:t,assignments:r,by:u});return o.errors?{record:null,errors:o.errors,assigned:0}:{record:o.record,errors:null,assigned:r.length}}export{b as backfillLogicalIds};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-BAL64WSI.js";import"./chunk-KT6G7AF2.js";import"./chunk-RFHMDQXZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-F6ZOJXYU.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as i,c as m,d as s}from"./chunk-QROUKGKU.js";import"./chunk-ZLCZDAEX.js";import{a as t}from"./chunk-CH273NAE.js";import{c as d,d as c}from"./chunk-T63R6QT4.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";async function u(r,o=process.cwd()){if(!i(o,r))return 2;let e=c(t(o));if(e.ok)return r.out(e.pending?`ok: ${e.records} record(s) verified \u2014 ${e.pending} record(s) pending catch-up (applied automatically on the next command)`:`ok: ${e.records} record(s) verified, derived projection in parity`),0;for(let n of e.issues)r.out(`issue: ${n}`);return 1}async function p(r,o,e=process.cwd()){if(!i(e,o)||!await m(o,"wipe .context/derived and rebuild it from the verified commit chain",r.yes))return 2;let n=d(t(e));return o.out(`rebuilt: ${n.applied.seq} record(s) replayed, ${Object.keys(n.nodeLabel).length} node(s) projected`),0}async function b(){return u(s())}async function y(r={}){return p(r,s())}export{b as fsckCommand,y as rebuildCommand,u as runFsckCommand,p as runRebuildCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d}from"./chunk-DYW5C6II.js";import"./chunk-UR6MHSHU.js";export{a as CLI_GRAMMAR,d as composeNext,b as parsesAgainstGrammar,c as resumeCmd};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";export{a as contextDir};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as h}from"./chunk-OIYGGEUL.js";import{a as m,b as I,k as S,s as _}from"./chunk-RKWJG3WW.js";import{a as f}from"./chunk-T7ZPMTGS.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";async function v(e,s={}){e.flushRecorder();let o=e.recorder?.lastWrittenPath??null;if(!o)return e.log("info","PERSIST_SKIPPED","No recorded path \u2014 recorder.flush no-op",{reason:e.sessionName?"recorder_flush_failed":"no_session_name",session_name:e.sessionName}),null;let p;try{p=_(o)}catch(t){throw e.log("error","PERSIST_RESOLVE_FAILED","resolveTestMd threw",{error:t.message,recorded_path:o}),t}let i=e.getRunsAsStepRecords(),u=e.getFlows(),a=[],c=0;for(let t=0;t<i.length;t++){let r=i[t],l=u.slice(c,c+r.totalRunDirs);c+=r.totalRunDirs;let g=l.find(n=>n.status==="failed"||n.status==="error"),T=g?"failed":l.length===0?"skipped":"passed";a.push({rootStepIndex:t+1,status:T,duration_s:l.reduce((n,E)=>n+(E.duration??0),0),reason:g?.reason})}let P=a.some(t=>t.status==="failed")?"failed":"passed",D=new f().load().code_export?.language==="javascript"?"javascript":"python",d=I(o);e.log("info","PERSIST_START","Building staging dir",{recorded_path:o,output_dir:d,session_dir:e.sessionDir,step_count:i.length,flow_count:u.length});try{await h({resolvedTest:p,sessionDir:e.sessionDir,stepRunRecords:i,outcomes:a,overallStatus:P,startedISO:e.startedAt,durationS:a.reduce((t,r)=>t+(r.duration_s??0),0),sessionId:e.sessionId,commitId:e.sessionId,tmsIds:{testId:e.testId??void 0,testcaseId:s.testcaseId,projectId:s.projectId,folderId:s.folderId,orgId:s.orgId??e.orgId??void 0,sessionName:e.sessionName??m(o)},codeExportDir:s.codeExportDir,codeExportLanguage:D,packTestDir:s.packTestDir}),e.log("info","PERSIST_STAGING_OK","Staging dir built",{output_dir:d}),S(d),e.log("info","PERSIST_OK","Persist complete",{output_dir:d})}catch(t){let r=t;e.log("error","PERSIST_FAILED","staging build / atomic replace failed",{error:r.message,stack:r.stack,output_dir:d}),process.stderr.write(`[persist] staging build / atomic replace failed: ${r.message}
2
+ import{g as h}from"./chunk-OIYGGEUL.js";import{a as m,b as I,k as S,s as _}from"./chunk-RKWJG3WW.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import{a as f}from"./chunk-DXV6MBTD.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";async function v(e,s={}){e.flushRecorder();let o=e.recorder?.lastWrittenPath??null;if(!o)return e.log("info","PERSIST_SKIPPED","No recorded path \u2014 recorder.flush no-op",{reason:e.sessionName?"recorder_flush_failed":"no_session_name",session_name:e.sessionName}),null;let p;try{p=_(o)}catch(t){throw e.log("error","PERSIST_RESOLVE_FAILED","resolveTestMd threw",{error:t.message,recorded_path:o}),t}let i=e.getRunsAsStepRecords(),u=e.getFlows(),a=[],c=0;for(let t=0;t<i.length;t++){let r=i[t],l=u.slice(c,c+r.totalRunDirs);c+=r.totalRunDirs;let g=l.find(n=>n.status==="failed"||n.status==="error"),T=g?"failed":l.length===0?"skipped":"passed";a.push({rootStepIndex:t+1,status:T,duration_s:l.reduce((n,E)=>n+(E.duration??0),0),reason:g?.reason})}let P=a.some(t=>t.status==="failed")?"failed":"passed",D=new f().load().code_export?.language==="javascript"?"javascript":"python",d=I(o);e.log("info","PERSIST_START","Building staging dir",{recorded_path:o,output_dir:d,session_dir:e.sessionDir,step_count:i.length,flow_count:u.length});try{await h({resolvedTest:p,sessionDir:e.sessionDir,stepRunRecords:i,outcomes:a,overallStatus:P,startedISO:e.startedAt,durationS:a.reduce((t,r)=>t+(r.duration_s??0),0),sessionId:e.sessionId,commitId:e.sessionId,tmsIds:{testId:e.testId??void 0,testcaseId:s.testcaseId,projectId:s.projectId,folderId:s.folderId,orgId:s.orgId??e.orgId??void 0,sessionName:e.sessionName??m(o)},codeExportDir:s.codeExportDir,codeExportLanguage:D,packTestDir:s.packTestDir}),e.log("info","PERSIST_STAGING_OK","Staging dir built",{output_dir:d}),S(d),e.log("info","PERSIST_OK","Persist complete",{output_dir:d})}catch(t){let r=t;e.log("error","PERSIST_FAILED","staging build / atomic replace failed",{error:r.message,stack:r.stack,output_dir:d}),process.stderr.write(`[persist] staging build / atomic replace failed: ${r.message}
3
3
  `)}return{recordedTestPath:o,outputDir:d}}export{v as persistRecordedSession};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as p}from"./chunk-OHRS3H7Z.js";import{c}from"./chunk-KVQOBPAZ.js";import"./chunk-AM5S4KG4.js";import{a as g}from"./chunk-BB2W35TW.js";import"./chunk-DNNZ353O.js";import"./chunk-NVGBE2DR.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import{d}from"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var u=["grounding","acs","scenarios","wiring","tests"];function l(i,r,o){let s=r.resolve(o);if(s===null)return[];let n=g(r,s.cid),a=c(d(i).records,n),e=a.reduce((t,m)=>Math.max(t,m.generation),0);return a.filter(t=>t.generation===e)}function E(i,r,o,s){let n=u;if(!n.includes(s))return{ok:!1,code:"UNKNOWN_PHASE",message:`--phase must be one of ${n.join(" | ")}, got '${s}'`,valid:[...n]};let a=new Set(l(i,r,o).map(t=>t.phase)),e=n.slice(0,n.indexOf(s)).filter(t=>t!=="grounding"&&!a.has(t));return e.length===0?{ok:!0,phase:s}:{ok:!1,code:"PHASE_ORDER",message:`--phase ${s} needs ${e.join(" + ")} committed first (nothing recorded for ${e.join(", ")})`,missing:e,earliest:e[0]}}function y(i,r,o,s){let n=l(i,r,o),a=r.resolve(o);if(a===null)return{priorDesign:void 0,phaseLadder:n};let e=p(r,a.tip);return{priorDesign:e.scenarios.length===0&&e.tests.length===0&&e.acs.length===0?void 0:e,phaseLadder:n}}function R(i,r,o){return`kane-cli design tests --use-case ${i} --phase ${r}${o?" --mode agent":""}`}export{u as PHASE_ORDER,y as buildPhaseSeed,E as checkPhaseEntry,R as phaseEntryCmd,l as phaseLadderFor};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-NAC7SFBE.js";import"./chunk-2YQ6TW77.js";import"./chunk-DQ54MH7F.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-WAOCHXJ5.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{a as openGraph,b as staleForEvolve};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as J,b as Q,c as X,d as ee}from"./chunk-SWESH2J7.js";import{a as z,c as G,d as pe,f as Z}from"./chunk-3LWTUMDG.js";import{a as P,b as ue,d as fe}from"./chunk-QROUKGKU.js";import"./chunk-OHRS3H7Z.js";import"./chunk-AM5S4KG4.js";import"./chunk-5JTUL6XL.js";import{a as H}from"./chunk-JEUA4UWK.js";import{a as L,b as V,c as N,d as j,e as de,g as O,h as q}from"./chunk-36OC3TFE.js";import{a as le}from"./chunk-JFAFKHDX.js";import"./chunk-ZLCZDAEX.js";import{d as ae,f as ce}from"./chunk-SE6WNCYU.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-QM4S2APK.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import{a as I}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import{f as F}from"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{existsSync as we,statSync as ye}from"fs";import{basename as Y,resolve as W}from"path";var me=new Set(["interactive","agent","ci","override"]);function Re(e,n){if(e.mode!==void 0&&!me.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`};let r=e.mode,t="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return r==="interactive"&&!n?{error:t}:r||(n?"interactive":e.plan?"override":{error:t})}function ke(e,n,r,t){let i=W(n,r);if(!we(i)||!ye(i).isFile())return{error:`--from '${r}' is not a file \u2014 pass the changed source document`};let o=ae(i);if(!o.ok)return{error:`--from '${r}' is not an ingestable document \u2014 allowed: ${o.allowlist.join(", ")}`};let c=I(e);if(!c.heads.has(t))return{error:`unknown source '${t}' \u2014 see \`kane-cli context list --type source\``};if(c.heads.get(t)==null)return{error:`source '${t}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let l=null;try{l=ce(i)}catch{}return l!==null&&l!==t&&c.heads.get(l)!=null?{error:`'${Y(i)}' already backs live source '${l}' \u2014 did you mean --source-id ${l}? To truly move these bytes under '${t}', retire '${l}' first`}:{sourceId:t,filePath:i}}function x(e){return e==null?"(none)":e.slice(0,19)}function T(e,n,r,t=!1){if(e.out(`reconcile ${n.source_id}: head ${n.head.status} \u2014 ${x(n.head.before)} \u2192 ${x(n.head.after)}`),t||(e.out(`note: ${n.note}`),e.out(`skipped arms: ${n.skipped_arms}`)),n.changed&&e.out(n.held?`extract ran in override mode; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),t){let i=n.changeset??[],o=(l,h)=>{let y=i.filter(s=>s.kind===l).length;return y>0?`${y} ${h}`:null},c=[o("ADD","add"),o("MODIFY","modify"),o("ARCHIVE","archive")].filter(Boolean);n.changed&&e.out(`changeset: ${i.length} item(s)${c.length?` \u2014 ${c.join(" \xB7 ")}`:""}`),e.out(`plan: ${n.rows.length} row(s) \u2014 each gets a card below`);return}if(n.changed){let i=n.changeset??[];e.out(`changeset: ${i.length} item(s)`);for(let o of i)if(o.kind==="MODIFY")e.out(` [MODIFY] ${H(o.ref)} \u2014 ${o.summary} (${x(o.old_cid)} \u2192 ${o.new_cid===null?"(staged)":x(o.new_cid)})`);else if(o.kind==="ADD")e.out(` [ADD] ${H(o.ref)}`);else{e.out(` [ARCHIVE] ${H(o.ref)} \u2014 ${o.why}`);let c=ne(o.impact,"retiring drops");c&&e.out(` ${c}`)}}e.out(`plan: ${n.rows.length} row(s)`);for(let i of n.rows){e.out(` [${i.kind}] ${H(i.ref)} \u2014 ${i.reason}`);let o=ne(i.impact,"approving marks");o&&e.out(` ${o}`),e.out(` provenance: ${i.provenance}`),e.out(` action: ${i.action}`)}}function ne(e,n){if(!e||e.stale_refs.length===0)return null;let r=e.direct_refs??[];return`impact: ${n} ${e.stale_refs.length} item(s) stale`+(r.length>0?` \u2014 ${r.length} directly touched: ${r.join(", ")}`:"")}function E(e){return e==="interactive"?"override":e}async function A(e,n,r,t,i,o,c=[],l="override",h,y,s,f,v){let p;try{p=q(e)}catch($){return P(t,$ instanceof Error?$.message:String($)),1}try{if(!r){let{runWalkSession:$}=await import("./walk-session-HXW4OSA2.js");return await $({dir:e,rows:n,archive:c,held:h??null,childMode:l,runDesign:f??null,mark:o,markA:s,...y?{archiveState:y}:{},signals:R=>C(e,R.ref,R.verdict,R.reason),...v?{script:v}:{}})}return await _e(e,n,r,t,i,o,c,l,h,y)}finally{p()}}var M=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function K(e,n,r){let t=n.rows;e({type:"reconcile_plan",source_id:n.source_id,plan_path:r,rows:t.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:n.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function re(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var te=re();async function U(e,n,r,t,i,o,c,l,h){K(i,n,r);let y=n.changeset.filter(v=>v.kind==="ARCHIVE"&&h?.[v.ref]===void 0),s=n.rows,f;try{f=q(e)}catch(v){return i({type:"error",message:v instanceof Error?v.message:String(v)}),i(re()),2}try{return await $e(e,n,r,t,i,o,c,s,y,l)}finally{f()}}async function $e(e,n,r,t,i,o,c,l,h,y){let s=0,f=0,v=0,p=0,$=0,R=0,d=0,k=new Set,w=(u,a)=>{try{y?.(u,a)}catch{}};for(let[u,a]of l.entries()){i({type:"reconcile_row_start",kind:a.kind,ref:a.ref,...a.impact?{stale:a.impact.stale_refs.length,direct:a.impact.direct_refs?.length??0}:{}});let g=(m,D,S)=>i({type:"reconcile_row_end",kind:a.kind,ref:a.ref,outcome:m,...D!==void 0?{exit_code:D}:{},...S?{detail:S}:{}});if(a.applied){f++,g("skipped");continue}if(a.kind==="REMOVE"){$++,g("plan-only");continue}if(a.held_ref&&n.held){let m=new Set;if(a.kind==="MODIFY"&&a.impact){let S=I(e);for(let se of a.impact.stale_refs){let oe=S.resolve(se);oe&&S.stale(oe.tip)==="fresh"&&m.add(se)}}let D=J(e,n.held,a.held_ref,ie);if(!D.ok){v++,d===0&&(d=1),g("failed",1,D.message);continue}if(D.kind==="ADD"){let S=await t(D.ref,{yes:!0,mode:c});if(S!==0){S===3?(p++,d===0&&(d=3),g("paused",3)):(v++,d===0&&(d=1),g("failed",S));continue}}s++,D.kind!=="ADD"&&a.impact&&(R+=m.size),w(u,"approved"),C(e,a.ref,D.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),g("applied");continue}let _=z(I(e),a.ref);if(!_.ok){f++,g("skipped");continue}let b=_.target;if(k.has(b.ucTip)){f++,g("skipped");continue}if(a.kind==="ADD"){let m=await t(b.seamRef,{yes:!0,mode:c});if(m===3){p++,d===0&&(d=3),g("paused",3);continue}if(m!==0){v++,d===0&&(d=1),g("failed",m);continue}k.add(b.ucTip),s++,w(u,"approved"),C(e,a.ref,"gap-resolved-create"),g("applied")}else{let m=await G(e,b,{yes:!0,mode:c},o,t,"batch");m.outcome==="evolved"?(k.add(b.ucTip),s++,w(u,"approved"),C(e,a.ref,"gap-resolved-evolve"),g("applied")):m.outcome==="paused"?(p++,d===0&&(d=m.code),g("paused",m.code)):m.outcome==="failed"?(v++,d===0&&(d=1),g("failed",m.code)):(f++,g("skipped"))}}return h.length>0&&(i({type:"reconcile_paused",plan_path:r,pending:h.map(u=>({ref:u.ref,why:u.why}))}),p+=h.length,d===0&&(d=3)),i(re({applied:s,skipped:f,plan_only:$,failed:v,paused:p,stale_created:R})),d}var ie={kind:"human",id:process.env.USER??"operator"};function C(e,n,r,t){le(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:n,verdict:r,polarity:"preference",by:ie,target:n,...t!==void 0?{reason:t}:{}})}async function _e(e,n,r,t,i,o,c=[],l="override",h,y){let s=0,f=0,v=0,p=0,$=0,R=0,d=0,k=new Set;for(let[w,u]of n.entries()){if(u.applied){t.out(`skipped ${u.ref} \u2014 already applied (${u.applied.outcome} at ${u.applied.at})`),f++;continue}let a=m=>{try{o?.(w,m)}catch(D){P(t,`could not record applied state for ${u.ref}: ${D instanceof Error?D.message:String(D)}`)}};if(u.kind==="REMOVE"){t.out(`REMOVE ${u.ref} \u2014 plan-only in this release (not executed)`),p++;continue}if(u.held_ref&&h){let m=J(e,h,u.held_ref,ie);if(!m.ok){P(t,`held ${u.ref}: ${m.message}`),$++,d===0&&(d=1);continue}if(t.out(`committed ${m.ref} (${u.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),m.kind==="ADD"){let D=await i(m.ref,{yes:r,mode:l});if(D===3){t.out(`design session for ${m.ref} paused \u2014 resume with the "kane-cli design tests --resume <session>" command printed above`),R++,d===0&&(d=3),a("approved");continue}if(D!==0){P(t,`design run for ${m.ref} ended with exit code ${D}`),$++,d===0&&(d=1),a("approved");continue}}s++,a("approved"),C(e,u.ref,u.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let g=I(e),_=z(g,u.ref);if(!_.ok){t.out(`skipped ${u.ref} \u2014 ${_.message}`),f++;continue}let b=_.target;if(k.has(b.ucTip)){t.out(`skipped ${u.ref} \u2014 use-case ${b.display} already handled in this walk`),f++;continue}if(u.kind==="ADD"){let m=await i(b.seamRef,{yes:r,mode:l});if(m===3){t.out(`design session for ${b.display} paused \u2014 resume with the "kane-cli design tests --resume <session>" command printed above; this row lands when that session completes`),R++,d===0&&(d=3);continue}if(m!==0){P(t,`design run for ${b.display} ended with exit code ${m}`),$++,d===0&&(d=1);continue}k.add(b.ucTip),s++,a("approved"),C(e,u.ref,"gap-resolved-create")}else{let m=await G(e,b,{yes:!0,mode:l},t,i,"batch");m.outcome==="evolved"?(k.add(b.ucTip),s++,a("approved"),C(e,u.ref,"gap-resolved-evolve")):m.outcome==="paused"?(R++,d===0&&(d=m.code)):m.outcome==="failed"?($++,d===0&&(d=m.code)):f++}}for(let w of c)if(w.kind==="ARCHIVE"&&y?.[w.ref]===void 0){t.out(`[ARCHIVE] ${w.ref} \u2014 ${w.why}`);{let u=ne(w.impact,"retiring drops");u&&t.out(` ${u}`)}t.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),p++}return t.out(`reconcile walk: ${s} applied, ${f} skipped, ${v} deferred, ${p} plan-only`+($>0?`, ${$} failed`:"")+(R>0?`, ${R} paused`:"")),d}async function he(e,n,r,t,i,o=!1,c=!1){let l=i.seams??{reingest:X(e,r),reextract:ee(e,{stage:o})},h=null,y={reingest:l.reingest,reextract:async f=>h=await l.reextract(f)},s;try{t.out(`reconciling ${n}: re-reading the source and comparing against the graph\u2026`),s=await(i.buildPlan??Q)(e,n,y)}catch(f){return P(t,`reconcile failed: ${f instanceof Error?f.message:String(f)}`),null}return s.changed&&T(t,s,h,c),s}async function Pe(e,n,r,t,i){let o=V(e,n);if("error"in o)return P(t,o.error),2;let{plan:c,path:l}=o,h=r==="override"||r==="ci";if(n===void 0&&r==="interactive"&&t.isTTY&&!await t.confirm(`apply plan ${Y(l)} for ${c.source_id} (created ${c.created})?`))return t.out(`not applying ${Y(l)}`),0;let y=i.runDesignForUc??Z,s=i.runDesignForUc??null,f=i.sessionScript,v=(k,w)=>O(l,k,w),p=(k,w)=>j(l,k,w),$=F(e);if($===c.head_pin){if(r==="agent"){let w=i.emitEvent??(()=>{});return U(e,B(c),l,y,w,t,E(r),v,c.archive_state)}let k=N(c);return r==="ci"&&k.length>0?(P(t,M(k.length)),2):(t.out(`applying stored plan ${Y(l)} for ${c.source_id} (${c.rows.length} row(s))`),A(e,c.rows,h,t,y,v,c.changeset??[],E(r),c.held,c.archive_state,p,s,f))}if(t.out(`graph moved since this plan (${x(c.head_pin)} \u2192 ${x($)}) \u2014 recomputing`),c.held)return ve(e,c,t,i,r,y,!1);let R=await he(e,c.source_id,c.backing_path,t,i,!1,r==="interactive");if(!R)return 1;if(!R.changed)return T(t,R,null),0;if(r==="agent"){let k=i.emitEvent??(()=>{});return U(e,R,null,y,k,t,E(r))}let d=R.changeset.filter(k=>k.kind==="ARCHIVE");return r==="ci"&&d.length>0?(P(t,M(d.length)),2):A(e,R.rows,h,t,y,void 0,R.changeset,E(r),R.held,void 0,void 0,s,f)}function B(e,n=!1){return{source_id:e.source_id,changed:!0,head:{status:"unchanged",before:e.head_pin,after:e.head_pin},note:e.note,skipped_arms:e.skipped_arms,changeset:e.changeset??[],rows:n?e.rows.filter(r=>r.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function be(e,n,r,t,i,o,c){let l=t.runDesignForUc??null,h=t.sessionScript,y=de(e,n);if(y===null)return null;if("error"in y)return P(r,y.error),2;let{plan:s,path:f}=y,v=s.rows.filter(d=>d.applied===void 0),p=N(s),$=t.emitEvent??(()=>{});if(v.length===0&&p.length===0){r.out(`already reconciled \u2014 plan ${s.created} applied ${s.rows.length} row(s)`);let d=pe(I(e)).staleCount;return d>0&&r.out(`${d} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),i==="agent"&&(K($,B(s),f),$({...te})),0}let R=F(e);return R!==s.head_pin?(r.out(`plan ${s.created} superseded \u2014 graph moved (${x(s.head_pin)} \u2192 ${x(R)}); recomputing`),ve(e,s,r,t,i,o,c)):(r.out(`resuming plan ${s.created} \u2014 ${v.length} pending row(s)${p.length>0?`, ${p.length} undecided archive item(s)`:""}`),c?(T(r,B(s),null),r.out(`plan stored: ${f}`),0):i==="agent"?U(e,B(s),f,o,$,r,E(i),(d,k)=>O(f,d,k),s.archive_state):i==="ci"&&p.length>0?(P(r,M(p.length)),2):A(e,s.rows,i==="override"||i==="ci",r,o,(d,k)=>O(f,d,k),s.changeset??[],E(i),s.held,s.archive_state,(d,k)=>j(f,d,k),l,h))}async function ve(e,n,r,t,i,o,c){let l=t.runDesignForUc??null,h=t.sessionScript,y;if(n.held){let u=I(e),a=new Set(n.rows.filter(_=>_.held_ref!==void 0&&_.applied!==void 0).map(_=>_.held_ref)),g=[];for(let _ of n.held.rows){if(a.has(_.temp_ref))continue;if(!_.matched_cid){g.push(_);continue}let b=u.tipOf(_.matched_cid);if(u.superseded.get(b)===null){r.out(`dropped held "${_.title}" \u2014 its use-case was retired meanwhile`);continue}g.push(b===_.matched_cid?_:{..._,matched_cid:b,uc:{..._.uc,matches_existing:{cid:b}}})}y={source_id:n.held.source_id,rows:g}}let s=t.seams??{reingest:X(e,n.backing_path),reextract:ee(e,{stage:y!==void 0})},f;try{f=await(t.buildPlan??Q)(e,n.source_id,s,{resumeHeld:y})}catch(u){return P(r,`reconcile failed: ${u instanceof Error?u.message:String(u)}`),1}T(r,f,null,i==="interactive"&&!c);let v=F(e),p=null;if(v!=null){let u={},a=new Set(f.changeset.filter(g=>g.kind==="ARCHIVE").map(g=>g.ref));for(let[g,_]of Object.entries(n.archive_state??{}))a.has(g)&&(u[g]=_);p=L(e,{version:2,source_id:f.source_id,backing_path:n.backing_path,head_pin:v,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:f.skipped_arms,note:f.note,changeset:f.changeset,rows:f.rows,...f.held?{held:f.held}:{},...Object.keys(u).length>0?{archive_state:u}:{}}),r.out(`plan stored: ${p}`)}if(c)return 0;let $=t.emitEvent??(()=>{}),R=p?V(e,p).plan.archive_state:void 0,d=p?(u,a)=>O(p,u,a):void 0,k=p?(u,a)=>j(p,u,a):void 0;if(i==="agent")return U(e,f,p,o,$,r,E(i),d,R);let w=f.changeset.filter(u=>u.kind==="ARCHIVE"&&R?.[u.ref]===void 0);return i==="ci"&&w.length>0?(P(r,M(w.length)),2):A(e,f.rows,i==="override"||i==="ci",r,o,d,f.changeset,E(i),f.held,R,k,l,h)}async function ge(e,n,r={},t=process.cwd()){let{telemetryBootstrap:i,telemetryEnvName:o}=await import("./bootstrap-CNOZ5VRB.js"),c=i({verb:"reconcile",mode:typeof e.mode=="string"?e.mode:"interactive",contextRoot:W(t,".context"),env:o(),applyPlanPath:typeof e.apply=="string"?W(t,e.apply):void 0,write:!0,longSession:!0});n.out(c.banner());let l=await De(e,n,r,t);return l===1&&n.out(c.supportFooter()),await c.end({exit_code:l}),l}async function De(e,n,r={},t=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,o=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return P(n,"pass --plan OR --apply, not both"),2;if((e.from!==void 0||!i)&&(!e.from||!e.sourceId))return P(n,"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"),2;if(e.from&&o!==void 0)return P(n,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let l=ue(t,n);if(!l)return 2;if(e.mode!==void 0&&!me.has(e.mode))return P(n,`--mode must be interactive | agent | ci | override, got '${e.mode}'`),2;let h=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!h&&!n.isTTY)return P(n,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let y=!e.plan,s="override";if(e.from){let a=Re(e,n.isTTY);if(typeof a=="object")return P(n,a.error),2;s=a}let f=s==="override"||s==="ci";if(i&&!e.from){let a=e.mode??"interactive";return Pe(l,o===void 0?void 0:W(t,o),a,n,r)}let v=ke(l,t,e.from,e.sourceId);if("error"in v)return P(n,v.error),2;let p=await he(l,v.sourceId,v.filePath,n,r,!!e.plan||s==="interactive",s==="interactive"&&!e.plan);if(!p)return 1;let $=r.runDesignForUc??Z,R=r.runDesignForUc??null,d=r.sessionScript;if(!p.changed){let a=await be(l,v.sourceId,n,r,s,$,!!e.plan);if(a!==null)return a;if(T(n,p,null),s==="agent"){let g=r.emitEvent??(()=>{});K(g,p,null),g({...te})}return 0}let k=F(l),w=null;if(k!=null?w=L(l,{version:2,source_id:p.source_id,backing_path:v.filePath,head_pin:k,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:p.skipped_arms,note:p.note,changeset:p.changeset,rows:p.rows,...p.held?{held:p.held}:{}}):P(n,"no chain head after extract \u2014 plan not stored"),s==="agent"){let a=r.emitEvent??(()=>{});if(!y)return K(a,p,w),a({...te}),0;let g=w?(_,b)=>O(w,_,b):void 0;return U(l,p,w,$,a,n,E(s),g)}if(!y)return w&&n.out(`plan stored: ${w}`),0;let u=p.changeset.filter(a=>a.kind==="ARCHIVE");if(s==="ci"&&u.length>0)return w&&n.out(`plan stored: ${w}`),P(n,M(u.length)),2;if(w){n.out(`plan stored: ${w}`);let a=w;return A(l,Ee(l,a)??p.rows,f,n,$,(g,_)=>O(a,g,_),p.changeset,E(s),p.held,void 0,void 0,R,d)}return A(l,p.rows,f,n,$,void 0,p.changeset,E(s),p.held,void 0,void 0,R,d)}function Ee(e,n){let r=V(e,n);return"error"in r?null:r.plan.rows}async function Ye(e,n={},r,t=process.cwd()){if(e.mode==="agent"){let{makeHeadlessIO:i}=await import("./headless-io-BL3TEAX5.js"),o=r?i("ndjson","reconcile",r):i("ndjson","reconcile"),c={out:o.out,err:h=>o.event({type:"error",message:h}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},l=2;try{l=await ge(e,c,{...n,emitEvent:h=>o.event(h)},t)}catch(h){o.event({type:"error",message:h instanceof Error?h.message:String(h)})}return o.done(l)}return ge(e,fe(),n,t)}export{E as childModeFor,Ye as reconcileCommand,Re as resolveReconcileMode,ge as runReconcileCommand,ke as validateReconcileInputs};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import{a as n}from"./chunk-3MSXQU2C.js";import"./chunk-UR6MHSHU.js";function p(t){let s=t.sessionName!==null,e={type:"recording_state",enabled:!0,session_id:t.sessionId,persist:s};return t.sessionName&&(e.session_name=t.sessionName),t.testPath&&(e.test_path=t.testPath),t.outputPath&&(e.output_path=t.outputPath),e}async function g(t){if(t.isAgent){process.stdout.write(JSON.stringify(p(t))+`
3
- `);return}let s=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:a}=await import("./build-JIKYOZUH.js"),{useEffect:o}=s,{InfoBox:r}=await import("./InfoBox-MQV3XBT4.js"),u=t.sessionName?[{label:"session",value:t.sessionName},{label:"test",value:n(t.testPath??"")},{label:"output",value:n(t.outputPath??"")}]:[{label:"session",value:"ephemeral"},{label:"note",value:"use /name <name> to persist this session"}];function l(){let{exit:i}=a();return o(()=>{let c=setTimeout(()=>i(),50);return()=>clearTimeout(c)},[i]),s.createElement(r,{title:"Recording",titleColor:"#ff9500",rows:u})}await e(s.createElement(l),{stdout:process.stderr}).waitUntilExit()}export{p as buildRecordingStateEvent,g as printRecordingBanner};
3
+ `);return}let s=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:a}=await import("./build-JIKYOZUH.js"),{useEffect:o}=s,{InfoBox:r}=await import("./InfoBox-KK2ICVS4.js"),u=t.sessionName?[{label:"session",value:t.sessionName},{label:"test",value:n(t.testPath??"")},{label:"output",value:n(t.outputPath??"")}]:[{label:"session",value:"ephemeral"},{label:"note",value:"use /name <name> to persist this session"}];function l(){let{exit:i}=a();return o(()=>{let c=setTimeout(()=>i(),50);return()=>clearTimeout(c)},[i]),s.createElement(r,{title:"Recording",titleColor:"#ff9500",rows:u})}await e(s.createElement(l),{stdout:process.stderr}).waitUntilExit()}export{p as buildRecordingStateEvent,g as printRecordingBanner};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{c as AppendBusyError,b as AppendCasError,a as ChainError,i as appendRecord,j as appendRecordRaw,f as latestHash,d as readRecords,g as readRecordsFrom,e as readTail,h as recordsSince};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk-AYY7RYMK.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-VE3SUJMA.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{d as buildAutoDefaultAnnouncement,f as buildAutoDefaultedEvent,e as buildAutoDefaultedNdjson,c as buildRemediationMessage,b as decideGateAction,a as loadCachedIds,g as requireProjectFolder};
2
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk-HPMS5KO6.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-VE3SUJMA.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{d as buildAutoDefaultAnnouncement,f as buildAutoDefaultedEvent,e as buildAutoDefaultedNdjson,c as buildRemediationMessage,b as decideGateAction,a as loadCachedIds,g as requireProjectFolder};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d as _,i as k}from"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";function j(w){let{contextDir:v,graph:y,seq:r,by:d}=w,{records:l,hashes:$}=_(v);if(!Number.isInteger(r)||r<1||r>l.length)return{record:null,warnings:[],errors:[{code:"UNKNOWN_SEQ",detail:`no record ${r} (chain has ${l.length})`}]};let i=l[r-1],p=l.slice(0,r-1),c=w.reason??`revert of record ${r}`,t=[],u=[],f=[],g=[],m={},b=new Set(i.nodes.map(e=>e.cid));for(let e of i.nodes){if(y.superseded.has(e.cid)){t.push(`${e.cid} was already superseded after record ${r} \u2014 left as is`);continue}u.push({kind:"node",old:e.cid,new:null,reason:c,by:d})}for(let e of i.supersessions){if(e.kind==="edge"){t.push(`edge retraction ${e.ecid} cannot be auto-restored \u2014 re-extract to re-evidence`);continue}if(l.slice(r).some(n=>n.supersessions.some(s=>s.kind==="node"&&s.old===e.old))){t.push(`supersession of ${e.old.slice(0,19)} was changed again after record ${r} \u2014 later state kept`);continue}let o;for(let n of p)for(let s of n.supersessions)s.kind==="node"&&s.old===e.old&&(o=s.new===s.old?void 0:s.new);o===void 0?u.push({kind:"node",old:e.old,new:e.old,reason:c,by:d}):u.push({kind:"node",old:e.old,new:o,reason:c,by:d})}let h=l.slice(r);for(let e of Object.keys(i.source_head_moves)){if(h.some(n=>e in n.source_head_moves)){t.push(`head of ${e} was moved again after record ${r} \u2014 later state kept`);continue}let o=null;for(let n of p)e in n.source_head_moves&&(o=n.source_head_moves[e]);m[e]=o}let R=new Set;for(let e of i.review){if(R.has(e.id)||b.has(e.id))continue;if(R.add(e.id),h.some(s=>s.review.some(a=>a.id===e.id))){t.push(`trust of ${e.id.slice(0,19)} was reviewed again after record ${r} \u2014 later state kept`);continue}let o=null,n=null;for(let s of p)for(let a of s.review)a.id===e.id&&(o=a.resolution==="reset"?null:a.resolution,n=a.reason);o==="approved"||o==="edited"?f.push({id:e.id,kind:"review-item",resolution:"approved",edit:null,reason:c,by:d}):o==="rejected"?f.push({id:e.id,kind:"review-item",resolution:"rejected",edit:null,reason:n??c,by:d}):f.push({id:e.id,kind:"review-item",resolution:"reset",edit:null,reason:c,by:d})}for(let e of i.names??[]){if(h.some(n=>(n.names??[]).some(s=>s.slug===e.slug))){t.push(`slug "${e.slug}" was reassigned after record ${r} \u2014 later state kept`);continue}let o;for(let n of p)for(let s of n.names??[])s.slug===e.slug&&(o=s.cid);o!==void 0?g.push({cid:o,slug:e.slug,by:d}):t.push(`slug "${e.slug}" was first assigned by record ${r} \u2014 unassignment unsupported, reassign manually`)}return u.length===0&&f.length===0&&g.length===0&&Object.keys(m).length===0?{record:null,warnings:t,errors:[{code:"NOTHING_TO_REVERT",detail:`record ${r} left no compensable facts`}]}:(i.extraction_of&&t.push(`extraction cache for ${i.extraction_of.slice(0,19)} stays \u2014 re-extract with --force`),{record:k(v,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:f,supersessions:u,...g.length>0?{names:g}:{},source_head_moves:m},{expectPrev:$[$.length-1]??null}).record,warnings:t,errors:null})}export{j as commitRevert};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as x}from"./chunk-QROUKGKU.js";import"./chunk-ZLCZDAEX.js";import"./chunk-CH273NAE.js";import{a as O}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import{o as V}from"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import{d as N}from"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{readFileSync as M}from"fs";var P=new Set(["derived","skipped","archived","drift"]),q={kind:"human",id:process.env.USER??"operator"};function $(r,t){return r.nameOf.get(t)??t.slice(0,19)}function A(r,t){let o=r.getNode(t)?.content??{},h=r.derivesInto(t)[0]?.props.anchor;return{cid:t,uc:{temp_ref:t,title:String(o.title??o.text??""),summary:o.summary!==void 0?String(o.summary):void 0,risk:String(o.risk??"med"),cite:{anchor:typeof h=="string"?h:"\u2014",quote:""},depends_on_hint:[],matches_existing:null}}}function G(r,t){let o=new Set,{records:h}=N(r);for(let i of h){if(i.proposal_id==null)continue;let u=new Set(i.review.map(e=>e.id));for(let e of i.nodes)u.has(e.cid)||o.add(e.cid)}for(let i of[...o])(t.trust.get(i)!=="derived"||t.superseded.has(i))&&o.delete(i);return o}var U=new Set(["approved","edited","rejected","skipped","supersede"]);function D(r){let t;try{t=JSON.parse(r)}catch(i){return{errors:[`not valid JSON: ${i instanceof Error?i.message:String(i)}`]}}if(!Array.isArray(t))return{errors:['expected a top-level array of {"ref", "resolution", ...} entries']};let o=[],h=[];return t.forEach((i,u)=>{if(i==null||typeof i!="object"||Array.isArray(i)){o.push(`[${u}]: not an object`);return}let e=i;(typeof e.ref!="string"||!e.ref.trim())&&o.push(`[${u}]: "ref" (slug or cid) is required`),(typeof e.resolution!="string"||!U.has(e.resolution))&&o.push(`[${u}]: "resolution" must be one of approved | edited | rejected | skipped | supersede`),e.resolution==="supersede"&&(typeof e.supersede_target!="string"||!e.supersede_target.trim())&&o.push(`[${u}]: resolution "supersede" requires "supersede_target" (slug or cid)`),e.edit!==void 0&&(e.edit==null||typeof e.edit!="object"||Array.isArray(e.edit))&&o.push(`[${u}]: "edit" must be an object ({title?, summary?, risk?})`),o.length===0&&h.push(e)}),o.length>0?{errors:o}:{entries:h}}async function Q(r,t,o,h=process.cwd()){let i=r.queue??"derived";if(!P.has(i))return t.out(`unknown queue ${i} \u2014 one of: derived | skipped | archived | drift`),2;if(r.mode!=null&&r.mode!=="agent"&&r.mode!=="ci")return(t.err??t.out)(`error: review --mode must be agent | ci, got '${r.mode}'`),2;r.mode==="agent"&&(r={...r,json:!0});let u=x(h,t);if(!u)return 2;let e=O(u),m=n=>(t.err??t.out)(n);if(r.allowArchive&&!r.because?.trim())return m('error: --allow-archive requires --because "<reason>" (the audit trail on the record)'),2;if(r.mode==="ci"&&r.allowArchive)return m("error: ci mode never archives \u2014 nothing committed"),2;if((r.approve?.length??0)>0||(r.skip?.length??0)>0||(r.defer?.length??0)>0){if(r.verdicts)return m("error: --approve/--skip/--defer and --verdicts are mutually exclusive"),2;let n=new Map,c=[];for(let d of r.approve??[]){let f=e.resolve(d),g=f&&!e.superseded.has(f.tip)?f.tip:null;if(!g){c.push(`${d}: names nothing in the graph`);continue}n.set(g,{resolution:"approved"})}for(let d of[...r.skip??[],...r.defer??[]])e.resolve(d)||c.push(`${d}: names nothing in the graph`);if(c.length>0){for(let d of c)m(`error: ${d}`);return m("error: nothing committed (structured verdicts are atomic \u2014 fix every offender and re-run)"),2}if(n.size===0)return t.out("nothing changed \u2014 every ref was skipped/deferred"),0;let l=V({contextDir:u,graph:e,verdicts:n,by:q});if(l.errors){for(let d of l.errors)m(`${d.code}: ${d.detail}`);return 1}return t.out(`review: committed record ${l.record.seq} \u2014 ${n.size} approved`),0}if(r.verdicts){let n=s=>(t.err??t.out)(s),c;try{c=M(r.verdicts,"utf8")}catch{return n(`error: cannot read verdicts file ${r.verdicts}`),2}let l=D(c);if("errors"in l){for(let s of l.errors)n(`error: --verdicts ${r.verdicts}: ${s}`);return 2}let d=new Set([...e.trust.entries()].filter(([s,a])=>(a==="derived"||a==="archived")&&!e.superseded.has(s)).map(([s])=>s)),f=new Map,g=[];for(let s of l.entries){let a=e.resolve(s.ref),p=a&&!e.superseded.has(a.tip)?a.tip:null;if(!p){g.push(`${s.ref}: names nothing in the graph`);continue}if(!d.has(p)){g.push(`${s.ref}: not in a review queue (trust: ${e.trust.get(p)??"?"})`);continue}if(f.has(p)){g.push(`${s.ref}: duplicate \u2014 an earlier entry already resolves to this node (${$(e,p)})`);continue}f.set(p,{resolution:s.resolution,...s.reason?{reason:s.reason}:{},...s.edit?{edit:s.edit}:{},...s.supersede_target?{supersedeTarget:s.supersede_target}:{}})}if(g.length>0){for(let s of g)n(`error: --verdicts: ${s}`);return n("error: nothing committed (the verdicts file is atomic \u2014 fix every offender and re-run)"),2}let y=[...f.entries()].filter(([,s])=>s.resolution==="rejected"||s.resolution==="supersede");if(y.length>0&&r.mode==="ci")return n(`error: ci mode never archives \u2014 ${y.length} retiring verdict(s) (rejected/supersede) present, nothing committed`),2;if(y.length>0&&r.allowArchive){let{archiveImpact:s}=await import("./feeder-XGTFV7TZ.js");for(let[a,p]of y){let R=p.resolution==="supersede"?(()=>{let j=p.supersedeTarget?e.resolve(p.supersedeTarget):null;return j&&!e.superseded.has(j.tip)?j.tip:null})():a;if(R===null)continue;let C=s(e,R),I=p.resolution==="supersede"?`supersede (retires ${$(e,R)})`:`archive ${$(e,R)}`;n(`${I}: ${C.design_children} design child(ren) affected`)}for(let[,a]of y)a.reason||(a.reason=r.because)}let E=y.length>0&&!r.allowArchive,S=V({contextDir:u,graph:e,verdicts:f,by:q,...E?{holdArchives:!0}:{}});if(S.errors){if(S.errors[0]?.code==="NO_VERDICTS")return n("nothing changed \u2014 every item was skipped"),0;for(let s of S.errors)n(`${s.code}: ${s.detail}`);return 1}E&&t.out(`${y.length} archive(s) held for interactive confirmation (re-run with --allow-archive --because "<reason>" to apply headlessly)`);let _=new Map;for(let s of f.values())_.set(s.resolution,(_.get(s.resolution)??0)+1);if(r.json)for(let[s,a]of f.entries())t.out(JSON.stringify({ref:$(e,s),cid:s,resolution:a.resolution}));else{let s=[..._.entries()].map(([a,p])=>`${p} ${a}`).join(", ");t.out(`review: committed record ${S.record.seq} \u2014 ${s}`)}return 0}if(i==="drift"){let n=e.staleList().filter(({state:c})=>c!=="superseded").map(({cid:c,state:l})=>({ref:$(e,c),cid:c,state:l,title:String(e.getNode(c)?.content.title??e.getNode(c)?.content.source_id??""),pinned_sources:[...new Set(e.derivesInto(c).map(d=>String(d.props.source_id)))]}));if(r.json){for(let c of n)t.out(JSON.stringify(c));return 0}if(n.length===0)return t.out("drift queue is empty \u2014 every node's evidence matches the current source snapshots"),0;t.out(`${n.length} item(s) whose evidence changed (re-extract the source to re-approve):`);for(let c of n)t.out(` [${c.state}] ${c.ref} \xB7 ${c.title} \xB7 sources: ${c.pinned_sources.join(", ")||"\u2014"}`);return 0}if(!t.isTTY)return t.out("review: verdict queues need a TTY (drift listing works anywhere, or pass --verdicts <file.json>)"),2;let v,w;if(i==="archived")v=[...e.trust.entries()].filter(([n,c])=>c==="archived"&&!e.superseded.has(n)).map(([n])=>A(e,n)),w="skipped";else{let n=G(u,e),c=[...e.trust.entries()].filter(([d,f])=>f==="derived"&&!e.superseded.has(d)).map(([d])=>d),l=i==="skipped"?c.filter(d=>n.has(d)):c;l.sort((d,f)=>Number(n.has(f))-Number(n.has(d))),v=l.map(d=>A(e,d)),w="skipped"}if(v.length===0)return t.out(`${i} queue is empty`),0;t.out(`${v.length} node(s) in the ${i} queue \u2014 approve promotes, reject ${i==="archived"?"re-archives":"archives"}, edit mints a new version, skip leaves it for later`);let T=await o(v,e,w),k=V({contextDir:u,graph:e,verdicts:T,by:q});if(k.errors){if(k.errors[0]?.code==="NO_VERDICTS")return t.out("nothing changed \u2014 every item was skipped"),0;for(let n of k.errors)t.out(`${n.code}: ${n.detail}`);return 1}let b=k.record;return t.out(`committed record ${b.seq}: ${b.review.length} review fact(s), ${b.supersessions.length} supersession(s), ${b.nodes.length} new version(s)`),0}async function F(r,t,o){let[{render:h},i,{ReviewChecklist:u}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),e=i.default??i;return new Promise(m=>{let v=h(e.createElement(u,{items:r.map(w=>({uc:w.uc})),defaultResolution:o,onSubmit:w=>{v.unmount(),m(w)}}))})}async function B(r){let{bothTTY:t}=await import("./headless-io-BL3TEAX5.js");return Q(r,{out:o=>process.stdout.write(o+`
3
+ `),err:o=>process.stderr.write(o+`
4
+ `),confirm:async()=>!1,isTTY:t()},F)}export{D as parseVerdictsFile,B as reviewCommand,Q as runReviewCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-HJERKSBK.js";import"./chunk-IBNC444G.js";import"./chunk-KHU7C6EE.js";import"./chunk-KVQOBPAZ.js";import"./chunk-AM5S4KG4.js";import"./chunk-5JTUL6XL.js";import"./chunk-O56PUUNL.js";import"./chunk-NRC2G4Y5.js";import"./chunk-BQHKBOSF.js";import"./chunk-2XGDWUJ5.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-5KFS3GAZ.js";import"./chunk-EV3EHXEI.js";import"./chunk-F7WKDMX7.js";import"./chunk-VOHQA2SP.js";import"./chunk-XDHZMCTA.js";import"./chunk-AAONIIQV.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-ZLCZDAEX.js";import"./chunk-SE6WNCYU.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-GVIPTX6T.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-5EOX4MEY.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{a as runDesign};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h}from"./chunk-KRXSXQBU.js";import"./chunk-UPPEOQJQ.js";import"./chunk-36OC3TFE.js";import{d as a}from"./chunk-O56PUUNL.js";import"./chunk-NRC2G4Y5.js";import"./chunk-BQHKBOSF.js";import"./chunk-2XGDWUJ5.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-5KFS3GAZ.js";import"./chunk-EV3EHXEI.js";import"./chunk-F7WKDMX7.js";import"./chunk-VOHQA2SP.js";import"./chunk-UX2B7L6K.js";import"./chunk-XDHZMCTA.js";import"./chunk-AAONIIQV.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-ZLCZDAEX.js";import"./chunk-SE6WNCYU.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-GVIPTX6T.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-5EOX4MEY.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{g as dedupPreFlags,c as deliveredImagesWire,e as displaySourceName,b as extractProtocolCtx,a as resolveAnswers,h as runExtract,d as sessionSourceRef,f as sourceBanner};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as A}from"./chunk-44IWSV6L.js";import{D as M,E as P,F as K,G as H,H as U}from"./chunk-QBCS57EO.js";import"./chunk-2XMJ6YAE.js";import"./chunk-KHQHVSZ6.js";import{a as _,b as E}from"./chunk-VYMCE7UR.js";import{a as h,b as k}from"./chunk-HOOXUO3X.js";import"./chunk-2YQ6TW77.js";import"./chunk-OIYGGEUL.js";import{s as L}from"./chunk-RKWJG3WW.js";import{c as R}from"./chunk-4SJC64KQ.js";import"./chunk-5YHVK2EO.js";import"./chunk-E5PWL3BG.js";import"./chunk-TDPWFYTJ.js";import{a as x}from"./chunk-T7ZPMTGS.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-EN7NW7DU.js";import"./chunk-NR23HZU4.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-UXPQRALY.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import{m as b,n as S,o as T}from"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-AYY7RYMK.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as C}from"./chunk-A2IQRVPR.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-WREVEATJ.js";import"./chunk-B4LLKQTK.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{resolve as Y}from"path";import{existsSync as D}from"fs";function O(){return{register:(n,r)=>b(n,r),deregister:n=>S(n),cleanup:(n,r)=>T(n,r),remoteLogger:null}}async function le(n,r){let t=Y(n);if(!D(t))return process.stderr.write(`error: file not found: ${t}
2
+ import{a as A}from"./chunk-NOCIMJSN.js";import{D as M,E as P,F as K,G as H,H as U}from"./chunk-URQUQWGW.js";import"./chunk-OIYGGEUL.js";import"./chunk-2XMJ6YAE.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-NAC7SFBE.js";import{a as _,b as E}from"./chunk-33QXD75Y.js";import{a as h,b as k}from"./chunk-ZM5PVRJK.js";import{s as L}from"./chunk-RKWJG3WW.js";import"./chunk-2YQ6TW77.js";import"./chunk-S3DAAAE5.js";import"./chunk-DQ54MH7F.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import{c as R}from"./chunk-3FN5VJMV.js";import"./chunk-L5LI2JF4.js";import"./chunk-IXVOXJP6.js";import"./chunk-UI7KULSI.js";import"./chunk-TDPWFYTJ.js";import{a as x}from"./chunk-DXV6MBTD.js";import"./chunk-6HEGD6H2.js";import"./chunk-KT6G7AF2.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import{m as b,n as S,o as T}from"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-HPMS5KO6.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as C}from"./chunk-JRMDGLLT.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-F6ZOJXYU.js";import"./chunk-C4G7RVJ6.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{resolve as Y}from"path";import{existsSync as D}from"fs";function O(){return{register:(n,r)=>b(n,r),deregister:n=>S(n),cleanup:(n,r)=>T(n,r),remoteLogger:null}}async function le(n,r){let t=Y(n);if(!D(t))return process.stderr.write(`error: file not found: ${t}
3
3
  `),2;if(r.finalValidation!==void 0&&r.finalValidation!=="on"&&r.finalValidation!=="off")return process.stderr.write(`error: --final-validation must be 'on' or 'off'
4
4
  `),2;if(!t.endsWith("_test.md"))return process.stderr.write(`error: not a *_test.md file: ${t}
5
5
  helpers are import-only \u2014 run a test that @imports it.
@@ -12,6 +12,6 @@ import{a as A}from"./chunk-44IWSV6L.js";import{D as M,E as P,F as K,G as H,H as
12
12
  \u2022 Run 'kane-cli login --username <user> --access-key <key>'
13
13
  `):e instanceof h&&e.code==="refresh_failed"?process.stderr.write(`error: Token refresh failed. Run 'kane-cli login' to re-authenticate.
14
14
  `):process.stderr.write(`error: auth resolution failed: ${e.message}
15
- `),2}let y=String(p.resolvedCreds?.org_id??"");if(!y)return process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),2;{let{readMetaIfExists:e,assertOrgMatchOrExit:g}=await import("./testmd-actions-NB5Z6QJ3.js"),d=g(e(t),y);if(d!==null)return d}let w=new R,j=A({isAgent:a,log:(e,g,d,V)=>w.log(e,g,d,V)}),F={path:t,cwd:process.cwd(),opts:r,isAgent:a,disableAskUser:!0,resolved:s,resolvedAuth:p,cliOverrides:i,environment:f,envConfig:N,profile:I,model:$,creds:o,configStore:l,session:w};try{return(await M(F,j,c)).exitCode}catch(e){return process.stderr.write(`error: ${e.message}
15
+ `),2}let y=String(p.resolvedCreds?.org_id??"");if(!y)return process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),2;{let{readMetaIfExists:e,assertOrgMatchOrExit:g}=await import("./testmd-actions-RPYG6TJG.js"),d=g(e(t),y);if(d!==null)return d}let w=new R,j=A({isAgent:a,log:(e,g,d,V)=>w.log(e,g,d,V)}),F={path:t,cwd:process.cwd(),opts:r,isAgent:a,disableAskUser:!0,resolved:s,resolvedAuth:p,cliOverrides:i,environment:f,envConfig:N,profile:I,model:$,creds:o,configStore:l,session:w};try{return(await M(F,j,c)).exitCode}catch(e){return process.stderr.write(`error: ${e.message}
16
16
  `),2}}var m=class extends Error{constructor(t,a){super(t);this.exitCode=a;this.name="CliArgError"}};function G(n){let r={mode:"mode",assertionMode:"assertion_mode",finalValidation:"final_validation",maxSteps:"max_steps",timeout:"timeout",globalContext:"global_context",localContext:"local_context",codeExport:"code_export",codeLanguage:"code_language",headless:"headless",cdpEndpoint:"cdp_endpoint",wsEndpoint:"ws_endpoint"},t=new Set(["max_steps","timeout"]),a={};for(let[c,s]of Object.entries(r)){let i=n[c];if(i===void 0||i==="")continue;let o=i;if(t.has(s)&&(o=Number(i),Number.isNaN(o))){let l="--"+c.replace(/[A-Z]/g,u=>"-"+u.toLowerCase());throw new m(`error: ${l} must be a number
17
17
  `,2)}a[s]=o}return a}export{U as applyCliStepConfig,K as buildStepRunVariables,P as buildTestLevelVariables,G as optsToOverrides,H as replayVariablesForStep,le as runTestMdFile};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d,e,f}from"./chunk-GVIPTX6T.js";import"./chunk-UR6MHSHU.js";export{a as SessionError,f as cleanSessions,b as createSession,e as listSessions,d as peekSession,c as resumeSession};
@@ -0,0 +1,25 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as $}from"./chunk-2XGDWUJ5.js";import"./chunk-L2TV4G56.js";import"./chunk-AAONIIQV.js";import{d as m,e as f,f as g}from"./chunk-GVIPTX6T.js";import{a as p}from"./chunk-CH273NAE.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";function w(t,i=new Date){let n=new Date(t).getTime()-i.getTime();if(Number.isNaN(n))return"unknown";if(n<=0)return"EXPIRED";let e=Math.floor(n/36e5),o=Math.round(n%36e5/6e4);return e>0?`${e}h ${o}m`:`${o}m`}function l(t){return t.verb==="design"?`kane-cli design tests --resume ${t.sid} --mode ${t.mode==="agent"?"agent":"interactive"}`:t.verb===void 0||t.verb==="extract"?`kane-cli context extract --resume ${t.sid}${t.mode==="agent"?" --mode agent":""}`:null}function x(t){return t.verb==="design"?t.use_case??"?":t.verb===void 0||t.verb==="extract"?"extract corpus":`${t.verb} session`}function v(t,i,n){let e,o,s;try{if(e=m(t,i),!e)return process.stderr.write(`error: no session ${i} (kane-cli context sessions lists them)
3
+ `),2;o=e.pending.questions.map($),s=l(e)}catch{return process.stderr.write(`error: session ${i} has a corrupt state.json \u2014 remove with: kane-cli context sessions clean ${i}
4
+ `),2}let r=new Date(e.expires_at).getTime()<=Date.now();if(n)return process.stdout.write(JSON.stringify({sid:e.sid,verb:e.verb??"extract",use_case:e.use_case,mode:e.mode,created_at:e.created_at,expires_at:e.expires_at,...r?{expired:!0}:s!==null?{resume:s}:{},pending_questions:o,pending_proposals:e.pending.proposals.length,assumed:e.assumed,...e.force?{force:!0}:{}})+`
5
+ `),0;let c=x(e);process.stdout.write(`${e.sid} ${e.verb??"extract"} \xB7 ${c} \xB7 ${e.mode} \xB7 expires in ${w(e.expires_at)}
6
+ `),r?process.stdout.write(` expired at ${e.expires_at} \u2014 not resumable; discard with: kane-cli context sessions clean ${e.sid}
7
+ `):s===null?process.stdout.write(` created by a newer kane-cli (verb "${e.verb}") \u2014 resume it with that build
8
+ `):(process.stdout.write(` resume: ${s}
9
+ `),process.stdout.write(` answer in words: ${s} --message "<your statement>"
10
+ `)),o.length===0&&process.stdout.write(` pending questions: none
11
+ `);for(let[u,a]of o.entries())process.stdout.write(` q${u+1} [${a.risk}] ${a.text}
12
+ `),a.options.forEach((d,b)=>{let h=b===a.recommended_index?" (recommended)":"";process.stdout.write(` - ${d.label}${h}${d.detail?` \u2014 ${d.detail}`:""}
13
+ `)});return e.assumed.length>0&&process.stdout.write(` assumed while away: ${e.assumed.map(u=>`${u.questionId}\u2192${u.optionId}`).join(", ")}
14
+ `),0}async function y(t,i,n){let e=p(process.cwd());if(t==="show")return n?v(e,n,!!i.json):(process.stderr.write(`error: sessions show needs a <sid> (kane-cli context sessions lists them)
15
+ `),2);if(t==="clean"){let{removed:s,skipped:r}=g(e,{all:i.all,sid:n});for(let c of r)process.stderr.write(`error: session ${c.sid} not removed \u2014 ${c.reason}
16
+ `);return n&&s.length===0?(r.length>0||process.stderr.write(`error: no session ${n}
17
+ `),2):(process.stdout.write(s.length?`removed: ${s.join(", ")}
18
+ `:`nothing to clean
19
+ `),r.length>0?2:0)}let o=f(e);if(i.json){for(let s of o){let r=s.corrupt?null:l(s);process.stdout.write(JSON.stringify(s.corrupt||r===null?s:{...s,resume:r})+`
20
+ `)}return 0}if(o.length===0)return process.stdout.write(`no sessions
21
+ `),0;for(let s of o){if(s.corrupt){process.stdout.write(`${s.sid} CORRUPT state.json \u2014 remove with: kane-cli context sessions clean ${s.sid}
22
+ `);continue}let r=l(s);process.stdout.write(`${s.sid} ${s.verb??"extract"} \xB7 ${x(s)} \xB7 pending ${s.pendingCount} \xB7 expires in ${w(s.expires_at)}
23
+ `+(r===null?` created by a newer kane-cli (verb "${s.verb}") \u2014 resume it with that build
24
+ `:` resume: ${r}
25
+ `))}return 0}export{l as resumeCommandFor,x as sessionSubject,y as sessionsCommand};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as p,b as g}from"./chunk-MV4UYTZT.js";import{b as m}from"./chunk-DFDDUMG5.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-WREVEATJ.js";import{a as f,h as a,i as u}from"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";import{mkdirSync as y,writeFileSync as w,readFileSync as S,rmSync as c,cpSync as v,createWriteStream as T,existsSync as b}from"fs";import{join as s}from"path";import{tmpdir as k}from"os";import{spawn as h}from"child_process";import{Readable as I}from"stream";import{pipeline as $}from"stream/promises";function E(t){try{return S(s(t,"VERSION"),"utf-8").trim()||null}catch{return null}}function L(t,r,l){return l?t!==r:t===null||m(t,r)>0}function C(t){let r=a.split("/").pop()??a;return`https://registry.npmjs.org/${a}/-/${r}-${t}.tgz`}var R=5e3,A=6e4;async function x(){let t=new AbortController,r=setTimeout(()=>t.abort(),R);try{let l=await d(p(),{headers:{Accept:"application/json"},signal:t.signal});if(!l.ok)throw new Error(`Controller returned ${l.status} fetching skill version map`);let i=await l.json(),n=g(i,f);if(!n)throw new Error("No compatible skill version found for this kane-cli build");return n}finally{clearTimeout(r)}}async function _(t){let r=C(t),l=new AbortController,i=setTimeout(()=>l.abort(),A);try{let n=await d(r,{headers:{Accept:"application/octet-stream"},signal:l.signal});if(!n.ok||!n.body)throw new Error(`Failed to download skill tarball (${n.status})`);let e=s(k(),`kane-cli-skill-${t}-${process.pid}.tgz`);return await $(I.fromWeb(n.body),T(e)),e}finally{clearTimeout(i)}}function M(t,r){return new Promise((l,i)=>{y(r,{recursive:!0});let n=h("tar",["-xzf",t,"-C",r,"--strip-components=2","package/skills"],{stdio:["ignore","ignore","pipe"]}),e="";n.stderr?.on("data",o=>{e+=o.toString()}),n.on("error",o=>i(o)),n.on("close",o=>{o===0?l():i(new Error(`tar exited ${o}${e?`: ${e.trim()}`:""}`))})})}async function W(t){let r;try{r=t??await x()}catch(e){return{status:"failed",version:t??"unknown",installedTargets:0,error:e instanceof Error?e.message:String(e)}}let l=u.filter(({dir:e})=>L(E(e),r,!!t));if(l.length===0)return{status:"already-installed",version:r,installedTargets:0};let i=null,n=null;try{if(n=await _(r),i=s(k(),`kane-cli-skill-${r}-stage-${process.pid}`),c(i,{recursive:!0,force:!0}),await M(n,i),!b(s(i,"SKILL.md")))throw new Error(`Unexpected skill tarball layout for v${r}: SKILL.md not at package/skills/ root`);let e=0;for(let{dir:o}of l)try{c(o,{recursive:!0,force:!0}),y(o,{recursive:!0}),v(i,o,{recursive:!0,force:!0}),w(s(o,"VERSION"),r+`
2
+ import{a as p,b as g}from"./chunk-X3ICV5M5.js";import{b as m}from"./chunk-322JEJEH.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-F6ZOJXYU.js";import{a as f,h as a,i as u}from"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";import{mkdirSync as y,writeFileSync as w,readFileSync as S,rmSync as c,cpSync as v,createWriteStream as T,existsSync as b}from"fs";import{join as s}from"path";import{tmpdir as k}from"os";import{spawn as h}from"child_process";import{Readable as I}from"stream";import{pipeline as $}from"stream/promises";function E(t){try{return S(s(t,"VERSION"),"utf-8").trim()||null}catch{return null}}function L(t,r,l){return l?t!==r:t===null||m(t,r)>0}function C(t){let r=a.split("/").pop()??a;return`https://registry.npmjs.org/${a}/-/${r}-${t}.tgz`}var R=5e3,A=6e4;async function x(){let t=new AbortController,r=setTimeout(()=>t.abort(),R);try{let l=await d(p(),{headers:{Accept:"application/json"},signal:t.signal});if(!l.ok)throw new Error(`Controller returned ${l.status} fetching skill version map`);let i=await l.json(),n=g(i,f);if(!n)throw new Error("No compatible skill version found for this kane-cli build");return n}finally{clearTimeout(r)}}async function _(t){let r=C(t),l=new AbortController,i=setTimeout(()=>l.abort(),A);try{let n=await d(r,{headers:{Accept:"application/octet-stream"},signal:l.signal});if(!n.ok||!n.body)throw new Error(`Failed to download skill tarball (${n.status})`);let e=s(k(),`kane-cli-skill-${t}-${process.pid}.tgz`);return await $(I.fromWeb(n.body),T(e)),e}finally{clearTimeout(i)}}function M(t,r){return new Promise((l,i)=>{y(r,{recursive:!0});let n=h("tar",["-xzf",t,"-C",r,"--strip-components=2","package/skills"],{stdio:["ignore","ignore","pipe"]}),e="";n.stderr?.on("data",o=>{e+=o.toString()}),n.on("error",o=>i(o)),n.on("close",o=>{o===0?l():i(new Error(`tar exited ${o}${e?`: ${e.trim()}`:""}`))})})}async function W(t){let r;try{r=t??await x()}catch(e){return{status:"failed",version:t??"unknown",installedTargets:0,error:e instanceof Error?e.message:String(e)}}let l=u.filter(({dir:e})=>L(E(e),r,!!t));if(l.length===0)return{status:"already-installed",version:r,installedTargets:0};let i=null,n=null;try{if(n=await _(r),i=s(k(),`kane-cli-skill-${r}-stage-${process.pid}`),c(i,{recursive:!0,force:!0}),await M(n,i),!b(s(i,"SKILL.md")))throw new Error(`Unexpected skill tarball layout for v${r}: SKILL.md not at package/skills/ root`);let e=0;for(let{dir:o}of l)try{c(o,{recursive:!0,force:!0}),y(o,{recursive:!0}),v(i,o,{recursive:!0,force:!0}),w(s(o,"VERSION"),r+`
3
3
  `),e++}catch{}return e===0?{status:"failed",version:r,installedTargets:0,error:"Could not write to any agent skill directory"}:{status:"installed",version:r,installedTargets:e}}catch(e){return{status:"failed",version:r,installedTargets:0,error:e instanceof Error?e.message:String(e)}}finally{if(n)try{c(n,{force:!0})}catch{}if(i)try{c(i,{recursive:!0,force:!0})}catch{}}}function D(t){switch(t.status){case"installed":return`Installed kane-cli skill v${t.version} (${t.installedTargets}/${u.length} agent dirs). Restart your AI agent (Claude Code / Codex CLI / Gemini CLI) to load it.`;case"already-installed":return`kane-cli skill v${t.version} already installed.`;case"failed":return`Failed to install kane-cli skill: ${t.error??"unknown error"}`}}export{D as formatInstallResult,W as installSkill,L as targetNeedsInstall};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c,d}from"./chunk-UX2B7L6K.js";import"./chunk-XDHZMCTA.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{c as buildAgentEnv,b as findAssuranceAgent,a as platformPackageName,d as resolveAgentAuthEnv};
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as m,g as k}from"./chunk-AAONIIQV.js";import{d as g}from"./chunk-GVIPTX6T.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{join as w}from"path";import{existsSync as y}from"fs";function x(e){return(e.answer?.length??0)>0||(e.approve?.length??0)>0||(e.skip?.length??0)>0||(e.defer?.length??0)>0}function h(e){if(!x(e))return{ok:!0,value:null};let t=[],r=new Set;for(let o of e.answer??[]){let u=o.indexOf("="),c=u>0?o.slice(0,u).trim():"",n=u>0?o.slice(u+1):"";if(!c||!n)return{ok:!1,error:`--answer needs <id>=<option-number-or-text>, got '${o}'`};if(r.has(c))return{ok:!1,error:`--answer target '${c}' given twice \u2014 one answer per id`};if(r.add(c),/^\d+$/.test(n.trim())){let p=Number(n.trim());if(p<1)return{ok:!1,error:`--answer option numbers are 1-based (got '${c}=${n.trim()}')`};t.push({target:c,optionIndex:p-1})}else t.push({target:c,freeText:n})}let i=o=>[...new Set((o??[]).map(u=>u.trim()).filter(Boolean))],s=i(e.approve),a=i(e.skip),d=i(e.defer);for(let[o,u]of[s,a,d].entries())for(let c of u)if([s,a,d].some((p,f)=>f!==o&&p.includes(c)))return{ok:!1,error:`handle '${c}' appears in more than one of --approve/--skip/--defer`};return{ok:!0,value:{answers:t,approve:s,skip:a,defer:d}}}function E(e,t){if(!x(e))return null;let r=t==="extract"?"extract":"design",i=h(e);return i.ok?e.resume?e.mode!=="agent"?`${r}: --answer/--approve/--skip/--defer are the structured agent-mode resume surface \u2014 add --mode agent (interactively, just answer in the session)`:null:`${r}: --answer/--approve/--skip/--defer address a paused session's pending panels \u2014 pair them with --resume <sid>`:`${r}: ${i.error}`}function P(e,t){if(e.archetype==="pause-card")return null;if(e.archetype==="walk-card"){let s=e.body.card??{},a=new Set([e.id]);for(let d of["temp_ref","ref","cid"]){let o=s[d];typeof o=="string"&&o&&a.add(o)}for(let[d,o]of[["approve",t.approve],["skip",t.skip],["defer",t.defer]]){let u=o.find(c=>a.has(c));if(u)return{kind:"verdict",panelId:e.id,ref:u,v:d}}return null}if(e.archetype==="ask"){let s=e.body.questions??[];for(let a=0;a<s.length;a++){let d=t.answers.find(o=>o.target===s[a].id||o.target===e.id);if(d)return d.optionIndex!==void 0?d.optionIndex<0||d.optionIndex>=(s[a].options?.length??0)?null:{kind:"answer",panelId:e.id,qIndex:a,optionIndex:d.optionIndex}:{kind:"answer",panelId:e.id,qIndex:a,freeText:d.freeText??""}}return null}let r=t.answers.find(s=>s.target===e.id);if(!r)return null;let i=e.body.options;return r.optionIndex!==void 0?!Array.isArray(i)||r.optionIndex<0||r.optionIndex>=i.length?null:{kind:"answer",panelId:e.id,qIndex:0,optionIndex:r.optionIndex}:{kind:"answer",panelId:e.id,qIndex:0,freeText:r.freeText??""}}function v(e,t){let r=g(e,t);if(!r)return null;let i=r.pending.questions;try{if(y(w(e,"sessions",t,m))){let a=k(e,t).kane?.pending.questions??[];a.length>0&&(i=a)}}catch{}return{questions:i,panels:[],appliedEvents:r.applied_events??[]}}function I(e){let t=e.questions.map(o=>o.id),r=[],i=[],s=[];for(let o of e.panels){if(s.push(o.id),o.archetype==="ask")for(let u of o.body.questions??[])r.push(u.id);if(o.archetype==="walk-card"){let u=o.body.card??{};for(let c of["temp_ref","ref","cid"]){let n=u[c];typeof n=="string"&&n&&i.push(n)}}}let a=(o,u)=>u.length>0?`${o}: ${u.join(", ")}`:null,d=[a("questions",[...new Set([...t,...r])]),a("panels",s),a("verdict handles",i)].filter(o=>o!==null);return d.length>0?`addressable pending ids \u2014 ${d.join(" \xB7 ")}`:"this session has NO pending panels or questions"}function $(e,t,r,i){let s=[],a=new Map(t.questions.map(n=>[n.id,n])),d=new Map(t.panels.map(n=>[n.id,n])),o=new Map,u=new Set;for(let n of t.panels){if(n.archetype==="ask")for(let p of n.body.questions??[])o.set(p.id,p);if(n.archetype==="walk-card"){let p=n.body.card??{};u.add(n.id);for(let f of["temp_ref","ref","cid"]){let l=p[f];typeof l=="string"&&l&&u.add(l)}}}let c=()=>{let n=t.questions[0],p=n?` --answer ${n.id}=${n.recommendedOptionIndex+1}`:"";return`try: ${i}${p}`};for(let n of e.answers){let p=a.get(n.target)??o.get(n.target);if(p){let l=p.options?.length??0;if(n.optionIndex!==void 0&&(n.optionIndex<0||n.optionIndex>=l))return{ok:!1,error:`error: --answer ${n.target}=${n.optionIndex+1} is out of range \u2014 '${n.target}' has ${l} option(s) (numbers are 1-based)`};continue}let f=d.get(n.target);if(f){let l=f.body.options;if(n.optionIndex!==void 0&&Array.isArray(l)&&(n.optionIndex<0||n.optionIndex>=l.length))return{ok:!1,error:`error: --answer ${n.target}=${n.optionIndex+1} is out of range \u2014 the panel has ${l.length} option(s) (numbers are 1-based)`};continue}if(t.appliedEvents.includes(`resolveq:${r}:${n.target}`)||t.appliedEvents.includes(`assumed:${r}:${n.target}`)){s.push(`note: '${n.target}' was already answered \u2014 --answer ${n.target}=\u2026 is a no-op`);continue}return{ok:!1,error:`error: unknown --answer target '${n.target}' \u2014 ${I(t)}
3
+ ${c()}`}}for(let[n,p]of[["--approve",e.approve],["--skip",e.skip],["--defer",e.defer]])for(let f of p){if(u.has(f))continue;let l=u.size>0?`addressable verdict handles: ${[...u].join(", ")}`:"this session has NO pending walk/review cards";return{ok:!1,error:`error: unknown ${n} handle '${f}' \u2014 ${l}
4
+ ${c()}`}}return{ok:!0,notes:s}}function S(e,t){let r=[],i=[];for(let s of e){let a=t.answers.find(o=>o.target===s.id);if(!a)continue;i.push(s.id);let d=a.optionIndex!==void 0?s.options[a.optionIndex]?.label??`option ${a.optionIndex+1}`:a.freeText??"";r.push(`- ${s.question} [${s.id}] \u2192 ${d}`)}return r.length===0?{statement:null,matchedQids:[]}:{statement:["Structured resume answers (applied via --answer flags \u2014 these ARE the human's decisions; do not re-ask them):",...r].join(`
5
+ `),matchedQids:i}}var b=/^kane-cli (context extract|design tests) --resume [A-Za-z0-9][A-Za-z0-9._-]*( --mode (agent|interactive|ci|override))?( --answer \S+=\d+)*$/;function A(e){try{let t=typeof e.resume=="string"?e.resume:null;if(!t)return[];let r=[{cmd:t,why:"resume the paused session",title:"Resume the session"}],i=Array.isArray(e.pending_questions)?e.pending_questions.filter(s=>s&&typeof s.id=="string"&&!/\s/.test(s.id)):[];if(i.length>0){let s=i.map(d=>{let o=typeof d.recommended_index=="number"&&d.recommended_index>=0?d.recommended_index:0;return` --answer ${d.id}=${o+1}`}).join(""),a=`${t}${s}`;b.test(a)&&r.push({cmd:a,why:`answer the ${i.length} pending question(s) non-interactively \u2014 --answer <question-id>=<option number (1-based) or free text>, repeatable; shown with each question's recommended option`,title:"Answer via structured flags"})}return r}catch{return[]}}function O(e){let t=null;return{encoding:e.encoding,out:e.out,progress:e.progress,event:r=>{if(r.type==="session_paused"&&!("next"in r)&&typeof r.resume=="string"){let i=A(r);if(i.length>0){t=i,e.event({...r,next:i});return}}e.event(r)},done:(r,i,s)=>e.done(r,i,s??(r===3&&t?t:void 0))}}function R(e,t){return e==="design"?`kane-cli design tests --resume ${t} --mode agent`:`kane-cli context extract --resume ${t} --mode agent`}function Q(e){let t=h(e.opts);if(!t.ok)return{kind:"refuse",error:`error: ${t.error}`,code:"STRUCTURED_FLAGS_USAGE"};if(!t.value)return{kind:"none"};let r=e.opts.resume;if(!r)return{kind:"refuse",error:"error: structured resume flags need --resume <sid>",code:"STRUCTURED_FLAGS_USAGE"};let i=v(e.contextDir,r);if(!i)return{kind:"none"};let s=$(t.value,i,r,R(e.verb,r));if(!s.ok)return{kind:"refuse",error:s.error,code:"STRUCTURED_TARGET_UNKNOWN"};let{statement:a,matchedQids:d}=S(i.questions,t.value);return{kind:"apply",answers:t.value,statement:a,matchedQids:d,notes:s.notes}}export{b as STRUCTURED_RESUME_RE,S as composeAnswerStatement,E as gateStructuredFlags,x as hasStructuredFlags,P as matchPanelInput,h as parseStructuredAnswers,Q as prepareStructuredResume,v as readPendingSets,R as resumeExample,A as structuredNextItems,$ as validateStructuredTargets,O as withStructuredNext};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d as a}from"./chunk-NAE7MBR2.js";import"./chunk-3MSXQU2C.js";import"./chunk-L7VREJTG.js";import"./chunk-UBFKZEX3.js";import"./chunk-NRTHYROA.js";import"./chunk-CSQ46PJ7.js";import"./chunk-URQUQWGW.js";import"./chunk-OIYGGEUL.js";import"./chunk-2XMJ6YAE.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-NAC7SFBE.js";import"./chunk-6UJDOAYR.js";import"./chunk-33QXD75Y.js";import"./chunk-ZM5PVRJK.js";import"./chunk-RKWJG3WW.js";import"./chunk-2YQ6TW77.js";import"./chunk-NJPTOKW5.js";import"./chunk-S3DAAAE5.js";import"./chunk-2KBD6JZX.js";import"./chunk-DQ54MH7F.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-RNSSM2BK.js";import"./chunk-3FN5VJMV.js";import"./chunk-L5LI2JF4.js";import"./chunk-NBKQT7LJ.js";import"./chunk-IXVOXJP6.js";import"./chunk-UI7KULSI.js";import"./chunk-TDPWFYTJ.js";import"./chunk-DXV6MBTD.js";import"./chunk-LQZ2BU7Q.js";import"./chunk-R2RGSO4B.js";import"./chunk-5Y2G4NC7.js";import"./chunk-XVDJ423L.js";import"./chunk-6HEGD6H2.js";import"./chunk-BAL64WSI.js";import"./chunk-KT6G7AF2.js";import"./chunk-RFHMDQXZ.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-LR5XO2KD.js";import"./chunk-JKTFTF24.js";import"./chunk-323MLBYA.js";import"./chunk-YCCUBQY4.js";import"./chunk-KNDSQ4PS.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-HPMS5KO6.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-F6ZOJXYU.js";import"./chunk-APAIWBIH.js";import"./chunk-73C4PRYU.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-CDQX6HGJ.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m}from"./chunk-6UJDOAYR.js";import"./chunk-33QXD75Y.js";import"./chunk-ZM5PVRJK.js";import"./chunk-RKWJG3WW.js";import"./chunk-2YQ6TW77.js";import"./chunk-L5LI2JF4.js";import"./chunk-DXV6MBTD.js";import"./chunk-6HEGD6H2.js";import"./chunk-KT6G7AF2.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-KNDSQ4PS.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-F6ZOJXYU.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{i as ExportError,c as assertOrgMatchOrExit,j as exportTestmd,b as metaMatchesOrg,a as readMetaIfExists,d as resolveCurrentOrgId,l as resolveSyncAuth,h as runDeleteAction,k as runExportAction,e as runListAction,f as runListTui,g as runStatusAction,m as runSyncAction};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-6HEGD6H2.js";import"./chunk-KT6G7AF2.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import"./chunk-UR6MHSHU.js";function a(r,e){return r.trust.get(e)}function d(r,e){return a(r,e)==="derived"?"unreviewed":void 0}function s(r,e){let i=r.resolve(e);if(!i)return{ok:!1,code:"UNKNOWN_REF",detail:`${e} names nothing in the graph`};let t=i.tip,n=a(r,t);return n==="archived"?{ok:!1,code:"UC_ARCHIVED",detail:`${e} is archived (previously rejected by the owner) \u2014 re-approve it before designing`,reviewCmd:`kane-cli context review --approve ${e}`}:n==="derived"?{ok:!1,code:"UC_UNREVIEWED",detail:`${e} is unreviewed \u2014 approve it first, or pass --allow-unreviewed`,reviewCmd:`kane-cli context review --approve ${e}`}:{ok:!0}}function o(r,e){return a(r,e)==="derived"?"quarantine":"evidence-attach"}async function u(r,e){let i={id:"trust-gate",header:"unreviewed use-case",text:`design: ${e.detail??"this use-case is unreviewed"} \u2014 design against it anyway?`,risk:"high",rationale:e.reviewCmd?`approve it first: ${e.reviewCmd}`:"",options:[{label:"no \u2014 approve it first",detail:e.reviewCmd??"review it before designing"},{label:"design against it anyway",detail:"the design will build on an unreviewed use-case"}],recommended_index:0,allow_free_text:!1},t=await r([i]);return Array.isArray(t)?t.find(n=>n.id==="trust-gate")?.selected_index===1:!1}export{u as confirmUnreviewedViaAsk,o as dedupAuthority,s as designEntryCheck,d as trustBadge,a as trustOf};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as t}from"./chunk-A2IQRVPR.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";async function l(n,o,r){let{ControllerClient:e}=await import("./controller-client-RD2YEMAH.js");await new e(t(n).controllerBaseUrl,{username:o,accessKey:r}).getTmsCredentials()}export{l as validateBasicAuth};
2
+ import{a as t}from"./chunk-JRMDGLLT.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";async function l(n,o,r){let{ControllerClient:e}=await import("./controller-client-RD2YEMAH.js");await new e(t(n).controllerBaseUrl,{username:o,accessKey:r}).getTmsCredentials()}export{l as validateBasicAuth};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as S}from"./chunk-UPPEOQJQ.js";import{a as x,b as P,c as C,d as V,e as j}from"./chunk-NRC2G4Y5.js";import"./chunk-BB2W35TW.js";import"./chunk-YKTYVJBN.js";import{a as R,b as D}from"./chunk-DNNZ353O.js";import"./chunk-NVGBE2DR.js";import{a as y}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import{c as b,o as f,p as k}from"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import{e as w}from"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";function I(o,t){return{contextDir:o,rootSid:t,locks:w(o,t),probe:S(o,{resolveAlias:i=>P(i),embed:(i,s)=>C(i,s),readVector:(i,s)=>V(o,i,s),writeVector:(i,s,n)=>j(o,i,s,n)})}}var N=new Set(["archive"]);async function Y(o,t,i,s){let n=y(o.contextDir);if(i.v==="defer")return{outcome:"deferred"};if(t.kind==="MODIFY_HELD"){if(!t.heldPayload)return{outcome:"failed",detail:`${t.ref} carries no held payload`};let e=t.heldPayload;if(i.v==="keep_current"){if(!e.event_id)return{outcome:"failed",detail:`this held row has no durable event id \u2014 resume the owner to drop it: kane-cli context extract --resume ${e.sid}`};let{commitChatTurn:r}=await import("./chat-committer-4BQBOKI4.js"),u=r({contextDir:o.contextDir,graph:n,ops:[{kind:"resolve_question",questionId:`drop-held:${e.sid}:${e.tempRef}`,resolution:"deferred",eventId:e.event_id}],by:s});return u.errors?{outcome:"failed",detail:u.errors.map(d=>`${d.code}: ${d.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"held-dropped"}),{outcome:"committed",detail:"held payload dropped (recorded) \u2014 the owner's resume will not re-present it"})}if(i.v==="approve"){let r=e.content._held??null;if(!r?.source_id||!r.source_cid||!r.anchor||!r.quote)return{outcome:"failed",detail:`this held row carries no committable provenance \u2014 resume the owner to apply it: kane-cli context extract --resume ${e.sid}`};{let a=n.mediaOf(r.source_cid),m=R(o.contextDir,n,r.source_cid),g=a.format==="image"?null:m?D(m):null;if(a.format!=="image"&&g===null)return{outcome:"failed",detail:`the pinned source ${r.source_id} (${r.source_cid.slice(0,19)}) has no citable text to verify this held row against \u2014 resume the owner: kane-cli context extract --resume ${e.sid}`};let _=b(a,{anchor:r.anchor,quote:r.quote},g);if(_.length>0)return{outcome:"failed",detail:`held provenance does not verify against the pinned source (${_.map($=>`${$.code}: ${$.detail}`).join("; ")}) \u2014 resume the owner: kane-cli context extract --resume ${e.sid}`}}let{commitProposal:u}=await import("./committer-2EJPVVCQ.js"),{_held:d,...c}=e.content,q={version:1,read_basis:n.latestHash,source:{source_id:r.source_id,source_cid:r.source_cid},use_cases:[{temp_ref:e.tempRef,title:String(c.title??e.tempRef),...c.summary!==void 0?{summary:c.summary}:{},risk:String(c.risk??"med"),cite:{anchor:r.anchor,quote:r.quote},depends_on_hint:[],matches_existing:null}]},l=await x(I(o.contextDir,o.rootSid??`review-${process.pid}`),{verb:"maintain",ucTargets:[],newBuCandidates:[{tempRef:e.tempRef,title:String(c.title??e.tempRef),probeText:`${String(c.title??"")} ${String(c.summary??"")}`.trim()}],sourcePins:[{source_id:r.source_id,source_cid:r.source_cid}],readBasis:n.latestHash,...e.event_id?{eventIds:[e.event_id]}:{}},a=>{let m=u({contextDir:o.contextDir,graph:a.graph,proposal:q,proposalId:null,verdicts:new Map([[e.tempRef,{resolution:"skipped"}]]),by:s,autoName:!0,allowStaleBasis:!0,eventIds:e.event_id?[e.event_id]:a.eventIds("maintain",1),sid:a.sid,probeHits:a.probeHits});return m.errors!==null?{errors:m.errors}:{result:m,record:m.record}}),h=l.ok&&"result"in l?l.result:{record:null,errors:l.ok?null:l.kind==="validation"?l.errors:[{code:l.kind==="contended"?l.err.code:"UNSETTLED",detail:l.kind==="contended"?`held by ${l.err.holder?.owner_sid??"another session"}`:"concurrent activity kept moving the store"}]};return h.errors?{outcome:"failed",detail:h.errors.map(a=>`${a.code}: ${a.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"held-applied"}),{outcome:"committed",detail:`held payload committed (derived) by ${s.id}`})}return{outcome:"failed",detail:`verdict ${i.v} does not apply to a MODIFY_HELD card`}}let v=n.resolve(t.ref);if(!v)return{outcome:"failed",detail:`${t.ref} names nothing in the graph`};let p=n.tipOf(v.cid);if(i.v==="archive"){if(!i.because||!i.because.trim())return{outcome:"failed",detail:"archive requires --because (a reason the record keeps)"};let e=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"rejected",reason:i.because}]]),by:s});return e.errors?{outcome:"failed",detail:e.errors.map(r=>`${r.code}: ${r.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"archived",reason:i.because}),{outcome:"retired"})}if(i.v==="approve"){let e=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"approved"}]]),by:s});return e.errors?{outcome:"failed",detail:e.errors.map(r=>`${r.code}: ${r.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"approved"}),{outcome:"applied"})}if(i.v==="merge"||i.v==="keep_both"){if(t.kind!=="PAIR"||!t.pair)return{outcome:"failed",detail:`${t.ref} is not a PAIR card`};let e=n.resolve(t.pair.candidate_cid);if(!e)return{outcome:"failed",detail:`pair candidate ${t.pair.candidate_ref} names nothing`};let r=n.tipOf(e.cid);if(i.v==="merge"){let d=k({contextDir:o.contextDir,graph:n,survivor:r,merged:p,reason:`pair merge: duplicate of ${t.pair.candidate_ref} (score ${t.pair.score})`,by:s});return d.errors?{outcome:"failed",detail:d.errors.map(c=>`${c.code}: ${c.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"pair-merged",reason:t.pair.candidate_ref}),{outcome:"committed",detail:`merged into ${t.pair.candidate_ref} \u2014 survivor stays derived`})}let u=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"approved"}],[r,{resolution:"approved"}]]),by:s});return u.errors?{outcome:"failed",detail:u.errors.map(d=>`${d.code}: ${d.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"pair-kept-both",reason:t.pair.candidate_ref}),{outcome:"applied",detail:"both promoted as distinct"})}return{outcome:"failed",detail:`verdict ${i.v} does not apply to a ${t.kind} card`}}export{N as requiresBecause,Y as submitReview};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-DFDDUMG5.js";import"./chunk-RZ4F3BHX.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
2
+ import{a,b,c,d}from"./chunk-322JEJEH.js";import"./chunk-RZ4F3BHX.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as T}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import{a as V}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import{b as I}from"./chunk-J2KSZUOO.js";import{d as f,e as x}from"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as ce,mkdirSync as pe}from"fs";import{tmpdir as ue}from"os";import{dirname as fe,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},re=(t,r)=>t===f.SOURCE?String(r.source_id??""):t===f.AC?String(r.text??""):t===f.STYLENOTE?String(r.statement??r.text??""):t===f.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let g=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===f.SOURCE?String(g.source_id??""):t.displayNameOf?.(o)??t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:re(p,g),content:g,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let g=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(g);w?(w.count++,v&&w.anchors.push(v)):e.set(g,{key:g,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let s=[...e.values()],i={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},a=0;for(let o of r)o.superseded||(a++,i[o.label]=(i[o.label]??0)+1,o.label!==f.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:s,summary:{nodes:a,edges:s.reduce((o,p)=>o+p.count,0),byLabel:i,trust:l,fresh:d,usecases:i[f.USECASE]??0,designed:0}}}var P=/^([a-z]+)-(\d+)$/,E=(t,r)=>{let e=P.exec(t),s=P.exec(r);return e&&s&&e[1]===s[1]?Number(e[2])-Number(s[2]):t<r?-1:t>r?1:0};function se(t,r,e){let s=new Set,i=d=>{let a=e.nodeLabel.get(d);if(a===f.USECASE)s.add(d);else if(a===f.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&s.add(o.dst)},l=e.edgesFrom(t);if(r===f.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&s.add(d.dst);if(r===f.AC)for(let d of l)d.type===x.SCOPED_TO&&i(d.dst);if(r===f.TEST)for(let d of l)d.type===x.AUTOMATES&&i(d.dst);return s}function G(t,r){let e=new Map,s=t.nodes.filter(a=>a.label===f.USECASE).map(a=>a.cid),i=s.map(a=>({ucCid:a,slug:r.nameOf.get(a)??a.slice(0,19),designed:r.designOf.has(a),nodeCids:[a]})).sort((a,o)=>E(a.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(i.map(a=>[a.ucCid,a]));for(let a of s)e.set(a,a);for(let a of t.nodes){if(a.label===f.SOURCE||a.label===f.USECASE)continue;let o=se(a.cid,a.label,r);if(o.size===1){let p=[...o][0];e.set(a.cid,p),d.get(p).nodeCids.push(a.cid)}else e.set(a.cid,"__shared__"),l.nodeCids.push(a.cid)}return{laneOf:e,lanes:[...i,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},ie=6,z=260,R=64,B=28;function U(t,r,e){let{lanes:s}=r,i=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],a=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=s.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),g=t.nodes.filter(n=>n.label===f.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>i.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(f.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(f.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(f.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(f.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let A=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+B;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*z,y:v+B/2+_*R})}a.push({...n,y0:v,y1:v+A}),v+=A}let w=Math.max(v,R);g.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(g.length+1)*(m+1)}));let L=ie*z;return{nodes:d,lanes:a,width:L,height:w}}function ae(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function $(t){let r=new Map,e=new Map,s=[];for(let i of t){for(let n of i.nodes)r.has(n.cid)||r.set(n.cid,i.seq);let l=new Map(e);for(let n of i.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of i.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},a=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&a++}let o={trusted:d("trusted"),archived:d("archived"),reset:a},p=ae(i),g=i.nodes.map(n=>n.cid),v=i.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=i.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+g.length+" nodes";s.push({seq:i.seq,ts:i.ts,kind:p,label:L,mintedNodeCids:g,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:s,bornSeq:r}}function Y(t,r,e){let s=[];for(let i of t){i.nodes.some(l=>l.cid===r)&&s.push({seq:i.seq,ts:i.ts,kind:"minted",detail:"minted here"});for(let l of i.review)l.id===r&&s.push({seq:i.seq,ts:i.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&s.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),s}var oe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function k(t){return String(t).replace(/[&<>"']/g,r=>oe[r])}var W=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),de=new RegExp("[\u2028\u2029]","g");function X(t){return t.replace(/[<>&]/g,W).replace(de,W)}var K=t=>t.replace("sha256:","").slice(0,12);function J(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",s=t.unit!=null?" "+String(t.unit):"",i=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+s;break;case"lte":d="<= "+e+s;break;case"equals":d="= "+e+s+(i?" (was "+i+")":"");break;case"changed-by":d="changed by "+e+s;break;default:d=(r+" "+e+s).trim()}if(l){let a=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(a||o)&&(d+=" within "+a+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,le=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function Q(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(s=>C(s)):[]].join(""),le(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([s,i])=>y(s,i)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let s=J(e.expected_answer);return s?`<div class="pred">${k(s)}</div>`:""})()].join("");case"test":{let s=J(e.check),i=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[s?`<div class="pred">${k(s)}</div>`:"",y("definitionId",e.definitionId),i].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(s=>C(s)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,s){let i=H(t),l=G(i,t),d=U(i,l,t),{commits:a}=$(r);i.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of i.nodes){o[n.cid]=Q(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let g=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=i.nodes.some(n=>n.label===f.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:s,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:i.summary,lanes:v,nodes:g,edges:i.edges,commits:a,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var ee="__PAYLOAD__",te=`<!doctype html>
2
+ import{b as T}from"./chunk-QROUKGKU.js";import"./chunk-ZLCZDAEX.js";import"./chunk-CH273NAE.js";import{a as V}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import{d as I}from"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import{d as f,e as x}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as ce,mkdirSync as pe}from"fs";import{tmpdir as ue}from"os";import{dirname as fe,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},re=(t,r)=>t===f.SOURCE?String(r.source_id??""):t===f.AC?String(r.text??""):t===f.STYLENOTE?String(r.statement??r.text??""):t===f.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let g=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===f.SOURCE?String(g.source_id??""):t.displayNameOf?.(o)??t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:re(p,g),content:g,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let g=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(g);w?(w.count++,v&&w.anchors.push(v)):e.set(g,{key:g,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let s=[...e.values()],i={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},a=0;for(let o of r)o.superseded||(a++,i[o.label]=(i[o.label]??0)+1,o.label!==f.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:s,summary:{nodes:a,edges:s.reduce((o,p)=>o+p.count,0),byLabel:i,trust:l,fresh:d,usecases:i[f.USECASE]??0,designed:0}}}var P=/^([a-z]+)-(\d+)$/,E=(t,r)=>{let e=P.exec(t),s=P.exec(r);return e&&s&&e[1]===s[1]?Number(e[2])-Number(s[2]):t<r?-1:t>r?1:0};function se(t,r,e){let s=new Set,i=d=>{let a=e.nodeLabel.get(d);if(a===f.USECASE)s.add(d);else if(a===f.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&s.add(o.dst)},l=e.edgesFrom(t);if(r===f.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&s.add(d.dst);if(r===f.AC)for(let d of l)d.type===x.SCOPED_TO&&i(d.dst);if(r===f.TEST)for(let d of l)d.type===x.AUTOMATES&&i(d.dst);return s}function G(t,r){let e=new Map,s=t.nodes.filter(a=>a.label===f.USECASE).map(a=>a.cid),i=s.map(a=>({ucCid:a,slug:r.nameOf.get(a)??a.slice(0,19),designed:r.designOf.has(a),nodeCids:[a]})).sort((a,o)=>E(a.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(i.map(a=>[a.ucCid,a]));for(let a of s)e.set(a,a);for(let a of t.nodes){if(a.label===f.SOURCE||a.label===f.USECASE)continue;let o=se(a.cid,a.label,r);if(o.size===1){let p=[...o][0];e.set(a.cid,p),d.get(p).nodeCids.push(a.cid)}else e.set(a.cid,"__shared__"),l.nodeCids.push(a.cid)}return{laneOf:e,lanes:[...i,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},ie=6,z=260,R=64,B=28;function U(t,r,e){let{lanes:s}=r,i=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],a=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=s.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),g=t.nodes.filter(n=>n.label===f.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>i.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(f.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(f.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(f.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(f.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let A=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+B;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*z,y:v+B/2+_*R})}a.push({...n,y0:v,y1:v+A}),v+=A}let w=Math.max(v,R);g.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(g.length+1)*(m+1)}));let L=ie*z;return{nodes:d,lanes:a,width:L,height:w}}function ae(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function $(t){let r=new Map,e=new Map,s=[];for(let i of t){for(let n of i.nodes)r.has(n.cid)||r.set(n.cid,i.seq);let l=new Map(e);for(let n of i.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of i.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},a=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&a++}let o={trusted:d("trusted"),archived:d("archived"),reset:a},p=ae(i),g=i.nodes.map(n=>n.cid),v=i.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=i.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+g.length+" nodes";s.push({seq:i.seq,ts:i.ts,kind:p,label:L,mintedNodeCids:g,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:s,bornSeq:r}}function Y(t,r,e){let s=[];for(let i of t){i.nodes.some(l=>l.cid===r)&&s.push({seq:i.seq,ts:i.ts,kind:"minted",detail:"minted here"});for(let l of i.review)l.id===r&&s.push({seq:i.seq,ts:i.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&s.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),s}var oe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function k(t){return String(t).replace(/[&<>"']/g,r=>oe[r])}var W=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),de=new RegExp("[\u2028\u2029]","g");function X(t){return t.replace(/[<>&]/g,W).replace(de,W)}var K=t=>t.replace("sha256:","").slice(0,12);function J(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",s=t.unit!=null?" "+String(t.unit):"",i=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+s;break;case"lte":d="<= "+e+s;break;case"equals":d="= "+e+s+(i?" (was "+i+")":"");break;case"changed-by":d="changed by "+e+s;break;default:d=(r+" "+e+s).trim()}if(l){let a=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(a||o)&&(d+=" within "+a+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,le=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function Q(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(s=>C(s)):[]].join(""),le(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([s,i])=>y(s,i)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let s=J(e.expected_answer);return s?`<div class="pred">${k(s)}</div>`:""})()].join("");case"test":{let s=J(e.check),i=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[s?`<div class="pred">${k(s)}</div>`:"",y("definitionId",e.definitionId),i].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(s=>C(s)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,s){let i=H(t),l=G(i,t),d=U(i,l,t),{commits:a}=$(r);i.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of i.nodes){o[n.cid]=Q(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let g=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=i.nodes.some(n=>n.label===f.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:s,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:i.summary,lanes:v,nodes:g,edges:i.edges,commits:a,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var ee="__PAYLOAD__",te=`<!doctype html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="utf-8">