@testmuai/kane-cli 0.8.14 → 0.8.15

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 (189) hide show
  1. package/dist/{ChatSurface-AVL3TJA2.js → ChatSurface-2GPR4S7I.js} +1 -1
  2. package/dist/{ChromeProfilePicker-WJZJOZ6Z.js → ChromeProfilePicker-XAZGCJKR.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-65BQF5G5.js → CliFeedbackPrompt-4SILDU7S.js} +1 -1
  4. package/dist/{CliUploadProgress-HEBZYKGN.js → CliUploadProgress-OAQBY55Y.js} +1 -1
  5. package/dist/{ConfigView-JEVQ2SO4.js → ConfigView-FDBMJC26.js} +1 -1
  6. package/dist/EvidenceViewOffer-YSNRKKPC.js +2 -0
  7. package/dist/FolderPicker-XCTJ5447.js +2 -0
  8. package/dist/{InfoBox-KM5DLBCV.js → InfoBox-ZPUBB7J4.js} +1 -1
  9. package/dist/{LinksBox-FQA36GTV.js → LinksBox-MNNNOH23.js} +1 -1
  10. package/dist/{ProfilesView-76KGHTMK.js → ProfilesView-GY5QCIT3.js} +1 -1
  11. package/dist/{ProjectPicker-65YOU46H.js → ProjectPicker-UCHMCNFV.js} +1 -1
  12. package/dist/{SaveSessionPrompt-QD6BNTWO.js → SaveSessionPrompt-ATVHKAHN.js} +1 -1
  13. package/dist/SingleShotApp-IPNZBFXB.js +2 -0
  14. package/dist/{SummaryBox-N2B6DUDD.js → SummaryBox-2DTNE25L.js} +1 -1
  15. package/dist/TestMdRunView-2FQIEI5W.js +2 -0
  16. package/dist/{TestrunEvidenceTable-3WLQVTF4.js → TestrunEvidenceTable-6UE5EMON.js} +1 -1
  17. package/dist/{WhoamiView-T26HA4ZZ.js → WhoamiView-TFCHIOW5.js} +1 -1
  18. package/dist/{app-download-XKZWFMEK.js → app-download-N7MLJQ42.js} +1 -1
  19. package/dist/{auth-PPJANIMZ.js → auth-IQPCVCZK.js} +1 -1
  20. package/dist/{binary-DKWWODT2.js → binary-VML7EGV4.js} +1 -1
  21. package/dist/{bind-62AZYFAY.js → bind-YV6V5AI6.js} +2 -2
  22. package/dist/{bootstrap-6IJNZIPT.js → bootstrap-KCPWDBLX.js} +1 -1
  23. package/dist/bridge-5UKX7YIO.js +2 -0
  24. package/dist/{changelog-UTGJ7FSP.js → changelog-CJFWGRIL.js} +1 -1
  25. package/dist/chunk-27ERHOW3.js +2 -0
  26. package/dist/{chunk-WR42Q3HU.js → chunk-2WRBCTNM.js} +1 -1
  27. package/dist/{chunk-73ULUGBM.js → chunk-3D5MKSG3.js} +1 -1
  28. package/dist/{chunk-2BFXT7VQ.js → chunk-3GELV4IN.js} +3 -3
  29. package/dist/{chunk-O6U2HU5M.js → chunk-4TMQTSIO.js} +1 -1
  30. package/dist/{chunk-X74PP5NJ.js → chunk-5HTSKF5K.js} +1 -1
  31. package/dist/{chunk-MLRO7OH3.js → chunk-6DHEOPXX.js} +1 -1
  32. package/dist/{chunk-WBHSPN55.js → chunk-6GLFQHSW.js} +2 -2
  33. package/dist/chunk-6K4FDYMH.js +89 -0
  34. package/dist/{chunk-3BHRGHIZ.js → chunk-6L5RV62W.js} +1 -1
  35. package/dist/{chunk-N7ZRF5K3.js → chunk-74FHTDEE.js} +1 -1
  36. package/dist/{chunk-CGT4NFQN.js → chunk-7EGIX6Y4.js} +2 -2
  37. package/dist/{chunk-3YX3RQXO.js → chunk-7WDPU33M.js} +1 -1
  38. package/dist/{chunk-JKX57HA7.js → chunk-7X4R6464.js} +1 -1
  39. package/dist/{chunk-RQLU4NDG.js → chunk-A557OSRS.js} +1 -1
  40. package/dist/{chunk-3SPOJWRA.js → chunk-AYJ2YZP5.js} +1 -1
  41. package/dist/{chunk-YHVG7V3E.js → chunk-BMVE73M7.js} +1 -1
  42. package/dist/chunk-CAOZKSQ3.js +8 -0
  43. package/dist/{chunk-L6MOO4WT.js → chunk-CNPIJFZM.js} +1 -1
  44. package/dist/{chunk-EMSLJTYN.js → chunk-D6GBOFK5.js} +1 -1
  45. package/dist/{chunk-FFFB5BXL.js → chunk-DMCEGMGB.js} +1 -1
  46. package/dist/{chunk-J7NRD4Q7.js → chunk-DMT3W26F.js} +1 -1
  47. package/dist/{chunk-NOLYYHVG.js → chunk-EDQZIEPJ.js} +1 -1
  48. package/dist/{chunk-K7K23DIQ.js → chunk-EFTRH35G.js} +1 -1
  49. package/dist/{chunk-LL5DQO6V.js → chunk-EJXBKCNF.js} +1 -1
  50. package/dist/{chunk-OH2NSBO6.js → chunk-EPE2ELDH.js} +1 -1
  51. package/dist/{chunk-42FHKRPA.js → chunk-FXO7JKMZ.js} +3 -3
  52. package/dist/{chunk-VNFCX2SH.js → chunk-GSDXZS4U.js} +1 -1
  53. package/dist/{chunk-4K5XTIJ6.js → chunk-GZ65ZA4C.js} +1 -1
  54. package/dist/{chunk-Q7XBMBMR.js → chunk-HLCETZ73.js} +1 -1
  55. package/dist/{chunk-B2ZGG7WM.js → chunk-HYTBEPC2.js} +1 -1
  56. package/dist/{chunk-AC7BPO4X.js → chunk-IAHOLH5W.js} +1 -1
  57. package/dist/{chunk-GESG672R.js → chunk-JCMHB4KH.js} +1 -1
  58. package/dist/{chunk-XGHMZJGI.js → chunk-JFUFWICY.js} +2 -2
  59. package/dist/{chunk-JH6E632O.js → chunk-JGAMMOUC.js} +1 -1
  60. package/dist/{chunk-KOL6ZWOQ.js → chunk-JL3L6KOG.js} +1 -1
  61. package/dist/chunk-JQCOKL6U.js +15 -0
  62. package/dist/{chunk-M7DN6FO3.js → chunk-JSS22MFY.js} +9 -9
  63. package/dist/chunk-JVEZBJJ7.js +2 -0
  64. package/dist/{chunk-ZWHPIR2Z.js → chunk-KALEPJAV.js} +2 -2
  65. package/dist/{chunk-O2APH6TZ.js → chunk-KUS324VE.js} +1 -1
  66. package/dist/{chunk-NDCRJXYF.js → chunk-LJGAXIDU.js} +1 -1
  67. package/dist/{chunk-ZKEOPIQ3.js → chunk-M36MOFJW.js} +1 -1
  68. package/dist/{chunk-O5AS2ZIX.js → chunk-MLYNVJNH.js} +1 -1
  69. package/dist/{chunk-GKZ2KVE6.js → chunk-N3CVR4Z2.js} +1 -1
  70. package/dist/{chunk-6F6YI3ZG.js → chunk-NLEA6NPU.js} +1 -1
  71. package/dist/{chunk-SGHP44WS.js → chunk-NUJVYAI4.js} +1 -1
  72. package/dist/{chunk-IQ7NGOAT.js → chunk-NWNG5UWD.js} +1 -1
  73. package/dist/{chunk-IICQ5KRD.js → chunk-O66WXOOC.js} +3 -3
  74. package/dist/{chunk-ZA4M4O7E.js → chunk-OFWJBOGT.js} +2 -2
  75. package/dist/{chunk-MNE5VMHT.js → chunk-OGDAWNFY.js} +1 -1
  76. package/dist/{chunk-75I46VTM.js → chunk-ORQGQSWG.js} +2 -2
  77. package/dist/{chunk-YHR2YAN5.js → chunk-OWGFFJKK.js} +1 -1
  78. package/dist/{chunk-SQDQADWD.js → chunk-PGXJ275T.js} +1 -1
  79. package/dist/{chunk-P3JUE2RM.js → chunk-Q77QO3PC.js} +4 -4
  80. package/dist/{chunk-JJJSDDQ2.js → chunk-QVLYK5JL.js} +1 -1
  81. package/dist/{chunk-UXH3RMQ7.js → chunk-QXRT6HSV.js} +1 -1
  82. package/dist/{chunk-RH6KFHJB.js → chunk-R7QMZBBH.js} +1 -1
  83. package/dist/{chunk-BJYGWXVP.js → chunk-RI4ILZZC.js} +1 -1
  84. package/dist/{chunk-PGU64EWQ.js → chunk-RQILLYSP.js} +1 -1
  85. package/dist/chunk-S4JUCBCT.js +7 -0
  86. package/dist/{chunk-4BBDKWM3.js → chunk-SHSXOYKT.js} +1 -1
  87. package/dist/{chunk-7RAI77XD.js → chunk-SIYSKT6I.js} +1 -1
  88. package/dist/{chunk-22QIVSQR.js → chunk-SWTJMTBY.js} +1 -1
  89. package/dist/{chunk-X5276I5H.js → chunk-T4R26WER.js} +2 -2
  90. package/dist/{chunk-BAKJPQGU.js → chunk-TEHZUSUY.js} +1 -1
  91. package/dist/{chunk-RBHQXWR7.js → chunk-TVELOH5A.js} +1 -1
  92. package/dist/{chunk-6LGED4FC.js → chunk-UHSNUUX3.js} +2 -2
  93. package/dist/{chunk-QPUVOVD7.js → chunk-UZIMYV5U.js} +1 -1
  94. package/dist/{chunk-WILT62DP.js → chunk-VOTIGXQ4.js} +1 -1
  95. package/dist/{chunk-SFTFHFG3.js → chunk-VZDLRJ5N.js} +1 -1
  96. package/dist/{chunk-2RMHDOP4.js → chunk-W77SZLFC.js} +1 -1
  97. package/dist/{chunk-QJ5O27SJ.js → chunk-WFBJNVMQ.js} +1 -1
  98. package/dist/{chunk-SX56MVUO.js → chunk-WNB2IYHY.js} +1 -1
  99. package/dist/chunk-XSUJJB7Z.js +11 -0
  100. package/dist/{chunk-NBMLBCJ3.js → chunk-XUJXGE42.js} +1 -1
  101. package/dist/{chunk-ARG56PJG.js → chunk-XXE7W5AV.js} +1 -1
  102. package/dist/{chunk-DA57DXCF.js → chunk-YAAQER2L.js} +1 -1
  103. package/dist/{chunk-7L25ZNNP.js → chunk-YGMUNNKH.js} +1 -1
  104. package/dist/{chunk-OO5GMBVI.js → chunk-YKYKOV6U.js} +1 -1
  105. package/dist/{chunk-C74ABM24.js → chunk-YZVR7ESF.js} +1 -1
  106. package/dist/{chunk-GPIXV7AV.js → chunk-Z3YYMZHT.js} +1 -1
  107. package/dist/{chunk-WOA7VCGA.js → chunk-Z73ZYROU.js} +1 -1
  108. package/dist/{chunk-LR5DJ6EN.js → chunk-ZCSEBT2W.js} +1 -1
  109. package/dist/{chunk-KOPP4CJW.js → chunk-ZEVU2OT3.js} +1 -1
  110. package/dist/{chunk-IQ7GPETF.js → chunk-ZKCCG3GK.js} +1 -1
  111. package/dist/{config-3AKWRTFS.js → config-UGCWZGH5.js} +1 -1
  112. package/dist/{cover-cmd-ZLAWMEC2.js → cover-cmd-SWJ2NZUZ.js} +1 -1
  113. package/dist/{credentials-Q4WH5CBN.js → credentials-GWLYYRTL.js} +1 -1
  114. package/dist/{deps-bundle-RVZK6LZJ.js → deps-bundle-VNGC2UG6.js} +1 -1
  115. package/dist/{deps-resolve-6F2U4TJP.js → deps-resolve-YLCEU6I7.js} +1 -1
  116. package/dist/{dispatch-46BETGXY.js → dispatch-OMQCT7WO.js} +1 -1
  117. package/dist/{doctor-WRPG56HH.js → doctor-B4Z6RPKQ.js} +1 -1
  118. package/dist/{evidence-XWR32HWP.js → evidence-XJGXVLO5.js} +1 -1
  119. package/dist/{evolve-cmd-27ZQN6YB.js → evolve-cmd-QQQPPGL3.js} +1 -1
  120. package/dist/{explain-cmd-JCJTXVZY.js → explain-cmd-XVE6Z67Q.js} +1 -1
  121. package/dist/{extract-bind-D5BYYGYA.js → extract-bind-7IDQS4QP.js} +2 -2
  122. package/dist/{extract-cmd-CCYW7FIY.js → extract-cmd-KIEOBRIT.js} +1 -1
  123. package/dist/{gaps-cmd-3VJKQ25D.js → gaps-cmd-RGIPUSIR.js} +1 -1
  124. package/dist/{generate-headless-2M6UT3IK.js → generate-headless-XGRIDD6O.js} +2 -2
  125. package/dist/index.js +134 -136
  126. package/dist/{ingest-cmd-HVTUK264.js → ingest-cmd-R5H5SF5K.js} +1 -1
  127. package/dist/install-W3VPVPAQ.js +2 -0
  128. package/dist/{interactive-bind-OJCYNQPI.js → interactive-bind-X5DVLRRW.js} +3 -3
  129. package/dist/{lifecycle-cmd-GWFGUGTC.js → lifecycle-cmd-6R2PR2HM.js} +1 -1
  130. package/dist/{list-cmd-AXDW64OY.js → list-cmd-QCIYKWYQ.js} +1 -1
  131. package/dist/{list-commands-YNZ6EFIF.js → list-commands-VRRCVWKO.js} +1 -1
  132. package/dist/login-flow-5HL2QYEL.js +2 -0
  133. package/dist/{maintenance-cmd-QEMK6YNV.js → maintenance-cmd-GZ4EMT3V.js} +1 -1
  134. package/dist/{mobile-prompts-OXHA5GHJ.js → mobile-prompts-CMIVWDHQ.js} +1 -1
  135. package/dist/objective-variable-gate-EEYJ6B3X.js +2 -0
  136. package/dist/{open-provider-E5VUGFNE.js → open-provider-UFSCTIQQ.js} +1 -1
  137. package/dist/{persist-recorded-session-KWPH37HI.js → persist-recorded-session-JXL5E53A.js} +1 -1
  138. package/dist/pipeline-RSCRNNPW.js +2 -0
  139. package/dist/prepare-target-XZ3FTVBW.js +2 -0
  140. package/dist/{reconcile-cmd-V7TDYETT.js → reconcile-cmd-4VRTUM2D.js} +1 -1
  141. package/dist/{reconcile-deps-X6IGH4CA.js → reconcile-deps-ZCJ2QCK5.js} +2 -2
  142. package/dist/{reconcile-engine-OGXSIE7O.js → reconcile-engine-IVLZCYZB.js} +1 -1
  143. package/dist/{recording-banner-IZWN2XFY.js → recording-banner-SRLPSTFP.js} +1 -1
  144. package/dist/registry-CPQHW2L2.js +2 -0
  145. package/dist/{require-project-folder-PEEUITK6.js → require-project-folder-SKEZMSN7.js} +1 -1
  146. package/dist/{resolve-run-intent-JGXXE45Y.js → resolve-run-intent-THC3EPAX.js} +1 -1
  147. package/dist/{resolver-TY7XLJBN.js → resolver-2NUNLK7N.js} +1 -1
  148. package/dist/{review-cmd-74YTPT7E.js → review-cmd-BMJQZ6XJ.js} +1 -1
  149. package/dist/{run-GRYWYKIH.js → run-TURFDLC6.js} +1 -1
  150. package/dist/{run-DN4XARP2.js → run-UDP5VPYS.js} +1 -1
  151. package/dist/{run-test-md-DFCKCQ4T.js → run-test-md-MRYNFNPO.js} +2 -2
  152. package/dist/{skill-installer-GRU3HOYF.js → skill-installer-CVJ5VTEJ.js} +1 -1
  153. package/dist/{spawner-LNMD4NJF.js → spawner-7FUA3JXA.js} +1 -1
  154. package/dist/{store-guard-Q4MYZQHF.js → store-guard-XQ5MSUB2.js} +1 -1
  155. package/dist/{sync-cmd-H6Y5EB3L.js → sync-cmd-5INKTZN2.js} +1 -1
  156. package/dist/{sync-setup-THGRBKTA.js → sync-setup-4R54VRAO.js} +1 -1
  157. package/dist/tcg-generate-2BOPGRM6.js +2 -0
  158. package/dist/testmd-actions-2CPJZAC2.js +2 -0
  159. package/dist/testmd-sync-HYZI6NRM.js +2 -0
  160. package/dist/token-refresh-NTE4LQRN.js +2 -0
  161. package/dist/{validate-basic-RCBEELSB.js → validate-basic-OKLJLDML.js} +1 -1
  162. package/dist/{variable-receipt-JHRW73Z6.js → variable-receipt-CMCDUJI2.js} +1 -1
  163. package/dist/{verdicts-XFXDRND4.js → verdicts-EMCYGQWM.js} +1 -1
  164. package/dist/{version-check-Z774UWW3.js → version-check-4DQJBSXW.js} +1 -1
  165. package/dist/{view-cmd-I4LQGJ2X.js → view-cmd-P3XRFORJ.js} +1 -1
  166. package/dist/{walk-session-FP52IGLB.js → walk-session-MUGS6CZY.js} +1 -1
  167. package/dist/{with-telemetry-P6RUPWBH.js → with-telemetry-3T53GIQC.js} +1 -1
  168. package/package.json +11 -11
  169. package/dist/EvidenceViewOffer-5MB4ZXKM.js +0 -2
  170. package/dist/FolderPicker-SYFXH6D5.js +0 -2
  171. package/dist/SingleShotApp-U54ETXS3.js +0 -2
  172. package/dist/TestMdRunView-WA4TC5PT.js +0 -2
  173. package/dist/bridge-X5DEJL6F.js +0 -2
  174. package/dist/chunk-53MPG2J3.js +0 -11
  175. package/dist/chunk-KN65CUNT.js +0 -15
  176. package/dist/chunk-L4M7753M.js +0 -2
  177. package/dist/chunk-LBNADEQN.js +0 -8
  178. package/dist/chunk-LNV7C2YO.js +0 -6
  179. package/dist/chunk-ZZTZJPT2.js +0 -88
  180. package/dist/install-5WJLE7XT.js +0 -2
  181. package/dist/login-flow-PRXFPRYZ.js +0 -2
  182. package/dist/objective-variable-gate-76GYUHEP.js +0 -2
  183. package/dist/pipeline-A2OGF4XW.js +0 -2
  184. package/dist/prepare-target-P6BWJZBZ.js +0 -2
  185. package/dist/registry-GOLIFVK5.js +0 -2
  186. package/dist/tcg-generate-SZZ7MJXY.js +0 -2
  187. package/dist/testmd-actions-MRIUOOXO.js +0 -2
  188. package/dist/testmd-sync-UYVJ47BN.js +0 -2
  189. package/dist/token-refresh-KN5JK2U4.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Y,b as Z,c as nn,d as en,e as tn}from"./chunk-KOL6ZWOQ.js";import{b as rn,c as sn}from"./chunk-P7YZ3PU3.js";import{n as X,p as P}from"./chunk-RSSOJ3L2.js";import{a as jn}from"./chunk-6YGTRKDT.js";import{e as Pn}from"./chunk-UR6MHSHU.js";function on(i){return{command:"start",...i}}function an(i,e,o){return{command:"run",run_id:i,kind:e,...o}}function un(i){return{command:"cancel",...i?{run_id:i}:{}}}function dn(i){return{command:"ask_user_response",answer:i}}function ln(){return{command:"shutdown"}}var z=Symbol("run-queue-end"),G=class{items=[];waiting=null;ended=!1;error=null;push(e){if(this.waiting){let{resolve:o}=this.waiting;this.waiting=null,o(e)}else this.items.push(e)}end(){if(this.ended=!0,this.waiting){let{resolve:e}=this.waiting;this.waiting=null,e(z)}}fail(e){if(this.error=e,this.waiting){let{reject:o}=this.waiting;this.waiting=null,o(e)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(z):new Promise((e,o)=>{this.waiting={resolve:e,reject:o}})}},D=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;exited;constructor(e){this.env=e.env,this.runner=e.runner,this.log=e.log,this.sessionId=e.sessionId,this.spawnFn=e.spawn??Z;let o;this.exited=new Promise(c=>{o=c}),this.exitResolve=o}async start(e){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let o=new Promise((c,g)=>{this.pendingReady={resolve:c,reject:g}});this.writeCommand(on(e)),await o}async*run(e,o,c){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${e}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new G,w={runId:e,queue:g};this.activeRun=w,this.writeCommand(an(e,o,c));try{for(;;){let v=await g.next();if(v===z||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===e)))break}}finally{this.activeRun===w&&(this.activeRun=null)}}sendUserResponse(e){this.writeCommand(dn(e))}cancel(e){this.writeCommand(un(e))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(){this.shuttingDown=!0,this.proc&&(this.writeCommand(ln()),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(e){let o=JSON.stringify(e)+`
2
+ import{a as Y,b as Z,c as nn,d as en,e as tn}from"./chunk-JL3L6KOG.js";import{b as rn,c as sn}from"./chunk-P7YZ3PU3.js";import{n as X,p as P}from"./chunk-RSSOJ3L2.js";import{a as jn}from"./chunk-6YGTRKDT.js";import{e as Pn}from"./chunk-UR6MHSHU.js";function on(i){return{command:"start",...i}}function an(i,e,o){return{command:"run",run_id:i,kind:e,...o}}function un(i){return{command:"cancel",...i?{run_id:i}:{}}}function dn(i){return{command:"ask_user_response",answer:i}}function ln(){return{command:"shutdown"}}var z=Symbol("run-queue-end"),G=class{items=[];waiting=null;ended=!1;error=null;push(e){if(this.waiting){let{resolve:o}=this.waiting;this.waiting=null,o(e)}else this.items.push(e)}end(){if(this.ended=!0,this.waiting){let{resolve:e}=this.waiting;this.waiting=null,e(z)}}fail(e){if(this.error=e,this.waiting){let{reject:o}=this.waiting;this.waiting=null,o(e)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(z):new Promise((e,o)=>{this.waiting={resolve:e,reject:o}})}},D=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;exited;constructor(e){this.env=e.env,this.runner=e.runner,this.log=e.log,this.sessionId=e.sessionId,this.spawnFn=e.spawn??Z;let o;this.exited=new Promise(c=>{o=c}),this.exitResolve=o}async start(e){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let o=new Promise((c,g)=>{this.pendingReady={resolve:c,reject:g}});this.writeCommand(on(e)),await o}async*run(e,o,c){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${e}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new G,w={runId:e,queue:g};this.activeRun=w,this.writeCommand(an(e,o,c));try{for(;;){let v=await g.next();if(v===z||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===e)))break}}finally{this.activeRun===w&&(this.activeRun=null)}}sendUserResponse(e){this.writeCommand(dn(e))}cancel(e){this.writeCommand(un(e))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(){this.shuttingDown=!0,this.proc&&(this.writeCommand(ln()),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(e){let o=JSON.stringify(e)+`
3
3
  `;try{this.proc?.child.stdin?.write(o)}catch{}}async consume(){if(!this.proc)return;try{for await(let c of this.proc.events){if(c.type==="ready"){this.onReady();continue}this.routeEvent(c)}}catch(c){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:c instanceof Error?c.message:String(c)})}let{code:e,signal:o}=await this.proc.exited;this.onExit(e,o)}onReady(){if(this.pendingReady){let{resolve:e}=this.pendingReady;this.pendingReady=null,e()}}routeEvent(e){let o=this.activeRun;if(!o){this.log?.("warn","PERSISTENT_RUNNER_ORPHAN_EVENT","Runner event with no active run",{event_type:e.type});return}o.queue.push(e)}onExit(e,o){if(!this.finalized){if(this.finalized=!0,this.exitInfo={code:e,signal:o},this.shuttingDown||(this.exitedUnexpectedly=!0),this.exitResolve({code:e,signal:o}),this.pendingReady){let{reject:c}=this.pendingReady;this.pendingReady=null,c(new Error(`v16-runner exited before ready (code=${e}, signal=${o??"none"})`))}if(this.activeRun){let{queue:c}=this.activeRun;if(this.activeRun=null,this.shuttingDown)c.end();else{let g=this.proc?.getStderr()?.slice(-500)??"";c.fail(new Error(`v16-runner exited unexpectedly mid-run (code=${e}, signal=${o??"none"})${g?`
4
4
  ${g}`:""}`))}}}}};var p=Pn(jn(),1);function cn(i){let e={cdp_endpoint:i.cdp_endpoint,ws_endpoint:i.ws_endpoint,width:i.width,height:i.height,headless:i.headless,model:i.model,max_steps:i.max_steps,network_ws:i.network_ws,network_sse:i.network_sse,session_id:i.session_id};return i.device&&(e.device=i.device),i.auth&&(e.auth=i.auth),i.disable_ask_user&&(e.disable_ask_user=!0),i.username&&(e.username=i.username),i.access_key&&(e.access_key=i.access_key),e}function j(i,e){let o=null,c=(g,w)=>{for(let v=0;v<g.length;v++){let _=g[v],h=[...w,v];e(_)&&(o===null||h.length>o.length)&&(o=h),_.children&&_.children.length>0&&c(_.children,h)}};return c(i,[]),o}function N(i,e,o){if(e.length===0)return[...i];let c=e[0],g=[...i],w=g[c];if(e.length===1)g[c]=o(w);else{let v=e.slice(1),_=N(w.children??[],v,o);g[c]={...w,children:_}}return g}function pn(){return{steps:[],maxOrdinal:0}}function Nn(i,e){if(e.type==="run_start"&&e.child_id)return e.environment?.resolution?{...i,resolution:e.environment.resolution}:i;if(e.type==="run_start"){let o=sn(i.runnerEnvironment,rn(e.environment));if(o)return{...i,runnerEnvironment:o,...o.resolution?{resolution:o.resolution}:{}}}if(e.type==="step_end"&&typeof e.ordinal=="number"&&e.id){let o={id:e.id,ordinal:e.ordinal,status:e.status,...e.kind?{kind:e.kind}:{},...typeof e.duration=="number"?{duration_ms:Math.round(e.duration*1e3)}:{},...typeof e.action_id=="string"&&e.action_id?{action_id:e.action_id}:{}};return{...i,steps:[...i.steps,o],maxOrdinal:Math.max(i.maxOrdinal,e.ordinal)}}return i}function K(i){let e=i.indexOf(": ");return e>0&&e<15?i.slice(e+2):i}function V(i){return i.map(e=>{let o=e.children?V(e.children):e.children;return e.status==="running"?{...e,status:"stopped",phase:void 0,children:o}:o!==e.children?{...e,children:o}:e})}function Gn(i,e,o,c,g){let[w,v]=(0,p.useState)(!1),[_,h]=(0,p.useState)([]),[hn,T]=(0,p.useState)(null),[fn,B]=(0,p.useState)(null),[mn,k]=(0,p.useState)(null),[vn,W]=(0,p.useState)(null),[gn,J]=(0,p.useState)([]),[Rn,H]=(0,p.useState)(null),[Sn,yn]=(0,p.useState)(void 0),[wn,$]=(0,p.useState)(0),y=(0,p.useRef)(null),E=(0,p.useRef)(null),S=(0,p.useRef)(null),b=(0,p.useRef)(0),F=(0,p.useRef)(!1),U=(0,p.useRef)(pn()),O=(0,p.useRef)(null),xn=(0,p.useCallback)(async(m,x)=>{let Q=O.current;if(Q)try{await Q}catch{}h([]),T(null),B(null),k(null),W(null),J([]),H(null),yn(m.max_steps),v(!0),S.current=null,b.current=0,U.current=pn();let I=y.current;if(I&&E.current!==m.session_id){try{I.kill()}catch{}y.current=null,E.current=null,$(n=>n+1),I=null}if(!I){let n=Y();if(!n){k("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available."),v(!1);return}let d=en({environment:x?.environment,mode:x?.mode,assertionMode:x?.assertionMode,finalValidation:x?.finalValidation,username:m.username,accessKey:m.access_key,sessionId:m.session_id});m.device?.platform&&await nn(d,m.device);let u=new D({env:d,runner:n,log:x?.log,sessionId:m.session_id});y.current=u,E.current=m.session_id,I=u,X("runner",()=>{try{u.kill()}catch{}});let s=cn(m);try{await u.start(s)}catch(a){k(a instanceof Error?a.message:String(a)),v(!1),P("runner","Runner start failed"),y.current=null,E.current=null,$(t=>t+1);return}}let M={...m};delete M.run_id,tn(M,{environment:x?.environment});let In=`run-${m.run_index}`,Cn=m.mode==="replay"?"replay":"author",L=I,q=(async()=>{F.current=!1;for await(let n of L.run(In,Cn,M)){if(F.current)break;switch(U.current=Nn(U.current,n),n.type){case"run_start":if(n.child_id)break;if(S.current&&!S.current.isSingleFlow){let d=b.current;b.current++,h(u=>u.map((s,a)=>a===d?{...s,status:"running"}:s.status==="running"&&!s.children?.some(t=>t.status==="running")?{...s,status:s.children?.some(t=>t.status==="failed")?"failed":"passed"}:s))}break;case"bifurcation":{let d=n.flows??[],u=n.count??d.length,s={flows:d,isSingleFlow:n.is_single_flow??u<=1};W(s),S.current=s,b.current=0,h(d.map((a,t)=>({index:t+1,objective:a??`Flow ${t+1}`,status:"pending"})));break}case"step_start":{e?.("STEP_START",`Step ${n.index} started`,{index:n.index,objective:n.objective,child_id:n.child_id});let d=n.index,u=n.objective??`Step ${d}`,s=n.child_id,a=S.current&&!S.current.isSingleFlow;if(s)h(t=>{let r=j(t,l=>l.branchChildId===s)??j(t,l=>l.status==="running");return r?N(t,r,l=>{let f=(l.children??[]).map(R=>R.status==="running"&&R.childId===s?{...R,status:"stopped",phase:void 0}:R);return f.push({index:d,objective:u,status:"running",childId:s}),{...l,children:f}}):t});else if(a){let t=Math.max(0,b.current-1);h(r=>{let l=[...r];if(t>=l.length)return r;let f={...l[t]},C=[...f.children??[]].map(A=>A.status==="running"&&A.childId===void 0?{...A,status:"stopped",phase:void 0}:A);return C.push({index:d,objective:u,status:"running"}),f.children=C,f.status="running",l[t]=f,l})}else h(t=>{let r=V(t);return r.some(f=>f.index===d)?r.map(f=>f.index===d?{...f,status:"running",objective:u}:f):[...r,{index:d,objective:u,status:"running"}]});break}case"step_event":{e?.("STEP_EVENT",`Step ${n.index} ${n.event}`,{index:n.index,phase:n.event,action_type:n.action_type,detail:n.detail,child_id:n.child_id});let d=n.child_id,u=S.current&&!S.current.isSingleFlow;if(n.event==="cm_init"&&n.checkpoint_count!=null){J(s=>[...s,n.checkpoint_count]);break}if(n.event==="replay_started"){H({recordingLength:n.recording_length??0});break}if(n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&o?.(n.detail),d){let s=t=>{if(t.index!==n.index||t.childId!==d)return t;let r={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(r.objective=n.detail),n.action_type&&(r.actionType=n.action_type),{...t,...r}},a=t=>t.map(r=>{let l=s(r);return l!==r?l:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let s=Math.max(0,b.current-1);h(a=>{let t=[...a];if(s>=t.length)return a;let r={...t[s]},l=[...r.children??[]];if(!l.some(R=>R.index===n.index&&R.childId===void 0))l.push({index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type});else for(let R=0;R<l.length;R++){if(l[R].index!==n.index||l[R].childId!==void 0)continue;let C={phase:n.event};n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(C.objective=n.detail),n.action_type&&(C.actionType=n.action_type),l[R]={...l[R],...C}}return r.children=l,t[s]=r,t})}else h(s=>s.some(t=>t.index===n.index)?s.map(t=>{if(t.index!==n.index)return t;let r={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(r.objective=n.detail),n.action_type&&(r.actionType=n.action_type),{...t,...r}}):[...V(s),{index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type}]);break}case"step_end":{e?.("STEP_END",`Step ${n.index} ${n.status}`,{index:n.index,status:n.status,duration:n.duration,summary:n.summary,child_id:n.child_id}),c?.();let d=n.child_id,u=S.current&&!S.current.isSingleFlow;if(d){let s=t=>t.index===n.index&&t.childId===d?{...t,status:n.status,duration:n.duration,phase:void 0,objective:t.objective.startsWith("Step ")?K(n.summary||t.objective):t.objective}:t,a=t=>t.map(r=>{let l=s(r);return l!==r?l:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let s=Math.max(0,b.current-1);h(a=>{let t=[...a];if(s>=t.length)return a;let r={...t[s]},l=(r.children??[]).map(f=>f.index===n.index&&f.childId===void 0?{...f,status:n.status,duration:n.duration,phase:void 0,objective:f.objective.startsWith("Step ")?K(n.summary||f.objective):f.objective}:f);return r.children=l,t[s]=r,t})}else h(s=>s.map(a=>a.index===n.index?{...a,status:n.status,duration:n.duration,phase:void 0,objective:a.objective.startsWith("Step ")?K(n.summary||a.objective):a.objective}:a));{let a=S.current&&!S.current.isSingleFlow?Math.max(0,b.current-1):0,t=typeof n.ordinal=="number"&&n.id?{ordinal:n.ordinal,id:n.id}:void 0;i?.(n.index,a,n.child_id,t)}break}case"child_agent_start":{let d=n.objective??"",u=n.child_id;h(s=>{let a=j(s,t=>t.status==="running");return a?N(s,a,t=>({...t,objective:`${d} (branch)`,phase:`child: ${d.slice(0,50)}`,branchObjective:d,branchChildId:u})):s});break}case"child_agent_end":{let d=n.child_id,u=`child ${n.success?"done":"failed"}`;h(s=>{let a=j(s,t=>t.branchChildId===d);return a?N(s,a,t=>({...t,phase:u})):s.map(t=>t.phase?.startsWith("child:")?{...t,phase:u}:t)});break}case"describe_trigger":g?.(n);break;case"ask_user":T(n.question??"");break;case"run_end":h(d=>d.map(u=>u.status==="running"?{...u,status:n.status,phase:void 0}:u)),v(!1),B(n);break;case"error":v(!1),k(n.message??"Runner error"),h(d=>d.map(u=>u.status==="running"?{...u,status:"failed",phase:void 0}:u));break}}})().catch(n=>{if(y.current!==L)return;let u=[n instanceof Error?n.message:String(n)],s=L.stderr;s&&!u.join(`
5
5
  `).includes(s)&&u.push(s),k(u.join(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-RBHQXWR7.js";import{a as k}from"./chunk-BPMSNGXQ.js";import{a as _}from"./chunk-OO5GMBVI.js";import{a as T}from"./chunk-OH2NSBO6.js";import{y as i}from"./chunk-B2ZGG7WM.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as u,b as s}from"./chunk-C44QQJR4.js";import{a as K}from"./chunk-6YGTRKDT.js";import{e as S}from"./chunk-UR6MHSHU.js";var e=S(K(),1);var r=S(O(),1);function V(n,x,c){return{id:n,label:`${x} (${n})`,isActive:n===c}}function se({resolver:n,currentProjectId:x,env:c,onSelect:w,onCancel:C}){let[q,B]=(0,e.useState)([]),[D,l]=(0,e.useState)(!0),[H,m]=(0,e.useState)(!1),[J,g]=(0,e.useState)(!1),[Q,P]=(0,e.useState)(null),[d,p]=(0,e.useState)("list"),[v,R]=(0,e.useState)(""),[E,h]=(0,e.useState)(null),[I,X]=(0,e.useState)(""),b=(0,e.useRef)(!1),A=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController,a=I.trim();return A.current?l(!0):a&&g(!0),m(!0),P(null),(async()=>{try{let t=n.cached??await n.resolve();if(!t){P("Login first to browse projects"),l(!1),m(!1),g(!1);return}let L=T(c),F=new k(L.tmsBaseUrl,t.username,t.access_key),f=!0,N=0,G=a?{signal:o.signal,name:a,perPage:10}:{signal:o.signal,perPage:10};for await(let y of F.listProjectsStream(G)){if(f&&(l(!1),g(!1),A.current=!1,f=!1),y.totalLoaded===0&&y.done&&N===0&&!a){b.current=!0,p("naming"),m(!1);return}let M=y.projects.map(j=>V(j.project_id,j.name,x));B(N===0?M:j=>[...j,...M]),N+=y.projects.length,y.done&&m(!1)}f&&(l(!1),m(!1),g(!1))}catch(t){if(t?.name==="AbortError")return;P(t instanceof Error?t.message:String(t)),l(!1),m(!1),g(!1)}})(),()=>o.abort()},[n,x,c,I]);let Y=(0,e.useCallback)(o=>{let a=o.trim();if(!a){h("Name cannot be empty");return}h(null),p("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let t=n.cached??await n.resolve();if(!t)throw new Error("Not authenticated");let L=T(c),f=await new k(L.tmsBaseUrl,t.username,t.access_key).createProject(a);w(f.id,f.name)}catch(t){h(t instanceof Error?t.message:String(t)),p("naming")}})()},[n,c,w]),z=(0,e.useCallback)(()=>{R(""),h(null),b.current?C():p("list")},[C]);return d==="naming"||d==="creating"?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(s,{color:i.orange,bold:!0,children:"Create new project"}),b.current&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"No projects yet \u2014 let's create one."})}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(s,{color:i.dim,children:"Name: "}),d==="naming"?(0,r.jsx)($,{value:v,onChange:o=>{R(o),E&&h(null)},onSubmit:Y,onCancel:z}):(0,r.jsx)(s,{children:v})]}),E&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.red,children:E})}),d==="creating"&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"Creating..."})}),d==="naming"&&(0,r.jsx)(_,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,r.jsx)(U,{title:"Projects",items:q,loading:D,loadingMore:H,searching:J,preserveSelectionById:!0,onSearch:X,error:Q,itemNoun:"projects",onTab:()=>{b.current=!1,p("naming")},extraHint:"tab to create new",onSelect:o=>{let a=o.label.replace(` (${o.id})`,"");w(o.id,a)},onCancel:C})}export{V as a,se as b};
2
+ import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-TVELOH5A.js";import{a as k}from"./chunk-BPMSNGXQ.js";import{a as _}from"./chunk-YKYKOV6U.js";import{a as T}from"./chunk-EPE2ELDH.js";import{y as i}from"./chunk-HYTBEPC2.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as u,b as s}from"./chunk-C44QQJR4.js";import{a as K}from"./chunk-6YGTRKDT.js";import{e as S}from"./chunk-UR6MHSHU.js";var e=S(K(),1);var r=S(O(),1);function V(n,x,c){return{id:n,label:`${x} (${n})`,isActive:n===c}}function se({resolver:n,currentProjectId:x,env:c,onSelect:w,onCancel:C}){let[q,B]=(0,e.useState)([]),[D,l]=(0,e.useState)(!0),[H,m]=(0,e.useState)(!1),[J,g]=(0,e.useState)(!1),[Q,P]=(0,e.useState)(null),[d,p]=(0,e.useState)("list"),[v,R]=(0,e.useState)(""),[E,h]=(0,e.useState)(null),[I,X]=(0,e.useState)(""),b=(0,e.useRef)(!1),A=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController,a=I.trim();return A.current?l(!0):a&&g(!0),m(!0),P(null),(async()=>{try{let t=n.cached??await n.resolve();if(!t){P("Login first to browse projects"),l(!1),m(!1),g(!1);return}let L=T(c),F=new k(L.tmsBaseUrl,t.username,t.access_key),f=!0,N=0,G=a?{signal:o.signal,name:a,perPage:10}:{signal:o.signal,perPage:10};for await(let y of F.listProjectsStream(G)){if(f&&(l(!1),g(!1),A.current=!1,f=!1),y.totalLoaded===0&&y.done&&N===0&&!a){b.current=!0,p("naming"),m(!1);return}let M=y.projects.map(j=>V(j.project_id,j.name,x));B(N===0?M:j=>[...j,...M]),N+=y.projects.length,y.done&&m(!1)}f&&(l(!1),m(!1),g(!1))}catch(t){if(t?.name==="AbortError")return;P(t instanceof Error?t.message:String(t)),l(!1),m(!1),g(!1)}})(),()=>o.abort()},[n,x,c,I]);let Y=(0,e.useCallback)(o=>{let a=o.trim();if(!a){h("Name cannot be empty");return}h(null),p("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let t=n.cached??await n.resolve();if(!t)throw new Error("Not authenticated");let L=T(c),f=await new k(L.tmsBaseUrl,t.username,t.access_key).createProject(a);w(f.id,f.name)}catch(t){h(t instanceof Error?t.message:String(t)),p("naming")}})()},[n,c,w]),z=(0,e.useCallback)(()=>{R(""),h(null),b.current?C():p("list")},[C]);return d==="naming"||d==="creating"?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(s,{color:i.orange,bold:!0,children:"Create new project"}),b.current&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"No projects yet \u2014 let's create one."})}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(s,{color:i.dim,children:"Name: "}),d==="naming"?(0,r.jsx)($,{value:v,onChange:o=>{R(o),E&&h(null)},onSubmit:Y,onCancel:z}):(0,r.jsx)(s,{children:v})]}),E&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.red,children:E})}),d==="creating"&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"Creating..."})}),d==="naming"&&(0,r.jsx)(_,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,r.jsx)(U,{title:"Projects",items:q,loading:D,loadingMore:H,searching:J,preserveSelectionById:!0,onSearch:X,error:Q,itemNoun:"projects",onTab:()=>{b.current=!1,p("naming")},extraHint:"tab to create new",onSelect:o=>{let a=o.label.replace(` (${o.id})`,"");w(o.id,a)},onCancel:C})}export{V as a,se as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-EMSLJTYN.js";import{a as m}from"./chunk-OH2NSBO6.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-IQ7NGOAT.js";import{a as c,b as s,h as a,x as u}from"./chunk-B2ZGG7WM.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
2
+ import{b as l}from"./chunk-D6GBOFK5.js";import{a as m}from"./chunk-EPE2ELDH.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-NWNG5UWD.js";import{a as c,b as s,h as a,x as u}from"./chunk-HYTBEPC2.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as C}from"./chunk-X74PP5NJ.js";import{k as Z}from"./chunk-6F6YI3ZG.js";import{a as D}from"./chunk-YCCUBQY4.js";import{a as M}from"./chunk-RBHQXWR7.js";import{a as z}from"./chunk-RQLU4NDG.js";import{b as W}from"./chunk-AC7BPO4X.js";import{a as B}from"./chunk-OO5GMBVI.js";import{e as V}from"./chunk-Z7S3IWUX.js";import{y as o}from"./chunk-B2ZGG7WM.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as n,b as t,i as L}from"./chunk-C44QQJR4.js";import{a as N}from"./chunk-6YGTRKDT.js";import{e as g}from"./chunk-UR6MHSHU.js";var T=g(A(),1);function te(e){let i=e.kind==="simulator";switch(e.state){case"ready":return i?"Booted":"Running";case"stopped":return i?"Shutdown":"Stopped";case"unauthorized":return"UNAUTHORIZED";case"offline":return"Offline"}}function re(e){switch(e.state){case"unauthorized":return"accept the authorisation prompt on the device, then reopen this list";case"offline":return e.kind==="simulator"?"not responding \u2014 open Simulator.app to inspect it":"not responding \u2014 reconnect it, or restart the emulator";default:return}}function ne(e,i){let m=i.id!==void 0?{...i,id:z(i.id)}:i,c=e.virtualName!==void 0?{...e,virtualName:z(e.virtualName)}:e;return V(c,m)}function ie(e){return e.virtualName??e.displayName}function ae(e,i){let m=e.state==="ready"||e.state==="stopped",c=re(e),b=e.osVersion?` (${e.osVersion})`:"";return{id:e.id,label:`${ie(e)}${b} \xB7 ${te(e)}`,...i&&ne(e,i)?{isActive:!0}:{},...m?{}:{disabled:!0},...!m&&c?{disabledHint:c}:{}}}function le(e){return e==="emulator"?"No Android emulator found. Make sure an emulator exists on this machine (Android Studio \u2192 Device Manager), then reopen this list.":e==="simulator"?"No iOS simulator found. Make sure a simulator exists on this machine (Xcode \u2192 Windows \u2192 Devices and Simulators), then reopen this list.":"No emulator or simulator found. Make sure one exists on this machine, then reopen this list."}function he({targets:e,preselectedTarget:i,preselectedId:m,busyMessage:c,onSelect:b,onCancel:f,kind:l}){if(c)return(0,T.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,T.jsx)(t,{color:o.orange,bold:!0,children:"Device"}),(0,T.jsxs)(n,{marginTop:1,children:[(0,T.jsx)(C,{}),(0,T.jsxs)(t,{color:o.secondary,children:[" ",c]})]})]});if(e.length===0)return(0,T.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,T.jsx)(t,{color:o.orange,bold:!0,children:"Device"}),(0,T.jsx)(n,{marginTop:1,children:(0,T.jsx)(t,{color:o.dim,children:le(l)})})]});let d=e.map(r=>ae(r,i)),p=i?d.find(r=>r.isActive)?.id??null:m?e.find(r=>r.id===m||r.virtualName===m)?.id??null:null,a=new Map(e.map(r=>[r.id,r]));return(0,T.jsx)(M,{title:"Device",items:d,itemNoun:"devices",defaultActiveId:p,preserveSelectionById:!0,onSelect:r=>{let y=a.get(r.id);y&&b(y)},onCancel:f})}var x=g(N(),1);var u=g(A(),1),q=50,G=500;function pe(e){return`${e.name} (${e.appId})`}function Pe({kind:e,listApps:i,onSelect:m,onManualEntry:c,onCancel:b,busyMessage:f}){let[l,d]=(0,x.useState)([]),[p,a]=(0,x.useState)(!0),[r,y]=(0,x.useState)(!1),[Q,O]=(0,x.useState)(!1),[E,H]=(0,x.useState)(null),[w,J]=(0,x.useState)(""),[j,U]=(0,x.useState)(!1),$=(0,x.useRef)(!0),R=(0,x.useRef)(0);if((0,x.useEffect)(()=>{let h=++R.current,k=w.trim();$.current?a(!0):k&&O(!0),y(!0),H(null),U(!1),(async()=>{let I=[];try{for(let P=0;;P+=q){let X=await i({limit:q,offset:P,search:k});if(h!==R.current)return;if(I.push(...X.apps),d([...I]),$.current&&(a(!1),$.current=!1),O(!1),X.apps.length===0||I.length>=X.total)break;if(I.length>=G){U(!0);break}}}catch(P){if(h!==R.current)return;H(P instanceof Error?P.message:String(P)),a(!1),O(!1)}finally{h===R.current&&y(!1)}})()},[w,i]),L((h,k)=>{if(k.tab){c();return}k.escape&&b()},{isActive:!!E&&!f}),f)return(0,u.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,u.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,u.jsxs)(n,{marginTop:1,children:[(0,u.jsx)(C,{}),(0,u.jsxs)(t,{color:o.secondary,children:[" ",f]})]})]});if(E)return(0,u.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.red,paddingX:2,paddingY:1,children:[(0,u.jsx)(t,{color:o.red,bold:!0,children:"App under test"}),(0,u.jsx)(n,{marginTop:1,children:(0,u.jsx)(t,{color:o.red,children:"Could not load your uploads."})}),(0,u.jsx)(n,{marginTop:1,children:(0,u.jsx)(t,{color:o.dim,children:E})}),(0,u.jsx)(B,{bindings:[{keys:"tab",label:"tab to enter an app id"}],escBackLabel:"back to chat"})]});let ee=new Map(l.map(h=>[h.appId,h])),oe=l.map(h=>({id:h.appId,label:pe(h)})),_=!p&&!r&&l.length===0&&!w.trim()?e==="simulator"?"No simulator builds uploaded to this account yet \u2014 press Tab to enter an app id.":"No emulator builds uploaded to this account yet \u2014 press Tab to enter an app id.":null;return(0,u.jsx)(M,{title:"App under test",items:oe,loading:p,loadingText:"Loading your uploads\u2026",loadingMore:r,searching:Q,itemNoun:"uploads",preserveSelectionById:!0,onSearch:J,onTab:c,extraHint:"tab to enter an id",footer:_?(0,u.jsx)(t,{color:o.dim,children:_}):j?(0,u.jsx)(t,{color:o.dim,children:`Showing the first ${G} \u2014 type to search the rest.`}):void 0,onSelect:h=>{let k=ee.get(h.id);k&&m({appId:k.appId,name:k.name})},onCancel:b})}var Y=g(N(),1);var S=g(A(),1),se={emulator:["apk"],simulator:["zip"]};function ce(e){return Z(e.trim())}function Oe({kind:e,onBack:i,onSelect:m,onCancel:c}){let[b,f]=(0,Y.useState)(""),[l,d]=(0,Y.useState)(null),p=e==="emulator"?".apk":".zip";return(0,S.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,S.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,S.jsx)(n,{marginTop:1,children:(0,S.jsx)(t,{color:o.dim,children:`Path to a build (${p}): `})}),(0,S.jsxs)(n,{marginTop:1,children:[(0,S.jsx)(t,{color:o.dim,children:" "}),(0,S.jsx)(D,{value:b,onChange:a=>{f(a),l&&d(null)},onSubmit:a=>{let r=ce(a);if(!r){d(a.trim()?`Not a build \u2014 expected ${p}.`:"Enter the path to a build.");return}if(!se[e].includes(r.kind)){d(`${r.kind} builds don't run on a ${e} \u2014 expected ${p}.`);return}d(null),m(r).then(y=>{!y.ok&&y.error&&d(y.error)})},onCancel:i,placeholder:e==="emulator"?"/path/to/app-debug.apk":"/path/to/MyApp.zip"})]}),l&&(0,S.jsx)(n,{marginTop:1,children:(0,S.jsx)(t,{color:o.red,children:l})}),(0,S.jsx)(B,{bindings:[{keys:"\u21B5",label:"use this build"}],escBackLabel:"back"})]})}var F=g(N(),1);var v=g(A(),1);function de(e){return[{value:"local",label:"Local build",hint:e==="emulator"?".apk":".zip",available:!0},{value:"uploaded",label:"Uploaded app",hint:"an app id from your cloud uploads",available:!0}]}function Ye({kind:e,onSelect:i,onCancel:m}){let c=de(e),[b,f]=(0,F.useState)(0),[l,d]=(0,F.useState)(null);return L((p,a)=>{if(a.escape){m();return}if(a.upArrow&&f(r=>Math.max(0,r-1)),a.downArrow&&f(r=>Math.min(c.length-1,r+1)),a.return){let r=c[b];if(!r.available){d("That source isn't available \u2014 choose a local build for now.");return}d(null),i(r.value)}}),(0,v.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,v.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,v.jsx)(n,{marginTop:1,flexDirection:"column",children:c.map((p,a)=>{let r=a===b,y=p.available?r?o.orange:void 0:o.muted;return(0,v.jsxs)(n,{children:[(0,v.jsxs)(t,{color:y,children:[r?"\u276F ":" ",p.label]}),(0,v.jsxs)(t,{color:o.dim,children:[" ",p.hint]})]},p.value)})}),l&&(0,v.jsx)(n,{marginTop:1,children:(0,v.jsx)(t,{color:o.red,children:l})}),(0,v.jsx)(B,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}var K=g(N(),1);var s=g(A(),1);function qe({busyMessage:e,onSubmit:i,onBack:m}){let[c,b]=(0,K.useState)(""),[f,l]=(0,K.useState)(null);return e?(0,s.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,s.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,s.jsxs)(n,{marginTop:1,children:[(0,s.jsx)(C,{}),(0,s.jsxs)(t,{color:o.secondary,children:[" ",e]})]})]}):(0,s.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,s.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,s.jsx)(n,{marginTop:1,children:(0,s.jsx)(t,{color:o.dim,children:"App id from your cloud uploads:"})}),(0,s.jsxs)(n,{marginTop:1,children:[(0,s.jsx)(t,{color:o.dim,children:" "}),(0,s.jsx)(D,{value:c,onChange:d=>{b(d),f&&l(null)},onSubmit:d=>{let p=d.trim();if(!p){l("Enter an app id.");return}if(!W(p)){l("That doesn't look like an app id \u2014 they start with APP.");return}l(null),i(p).then(a=>{!a.ok&&a.error&&l(a.error)})},onCancel:m,placeholder:"APP1016032231178585590501450"})]}),f&&(0,s.jsxs)(n,{marginTop:1,flexDirection:"column",children:[(0,s.jsx)(t,{color:o.red,children:f}),(0,s.jsx)(t,{color:o.dim,children:"Enter a valid app id \u2014 copy it from your cloud uploads."})]}),(0,s.jsx)(B,{bindings:[{keys:"\u21B5",label:"use this app"}],escBackLabel:"back"})]})}export{he as a,Pe as b,Oe as c,Ye as d,qe as e};
2
+ import{a as C}from"./chunk-5HTSKF5K.js";import{k as Z}from"./chunk-NLEA6NPU.js";import{a as D}from"./chunk-YCCUBQY4.js";import{a as M}from"./chunk-TVELOH5A.js";import{a as z}from"./chunk-A557OSRS.js";import{b as W}from"./chunk-IAHOLH5W.js";import{a as B}from"./chunk-YKYKOV6U.js";import{e as V}from"./chunk-Z7S3IWUX.js";import{y as o}from"./chunk-HYTBEPC2.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as n,b as t,i as L}from"./chunk-C44QQJR4.js";import{a as N}from"./chunk-6YGTRKDT.js";import{e as g}from"./chunk-UR6MHSHU.js";var T=g(A(),1);function te(e){let i=e.kind==="simulator";switch(e.state){case"ready":return i?"Booted":"Running";case"stopped":return i?"Shutdown":"Stopped";case"unauthorized":return"UNAUTHORIZED";case"offline":return"Offline"}}function re(e){switch(e.state){case"unauthorized":return"accept the authorisation prompt on the device, then reopen this list";case"offline":return e.kind==="simulator"?"not responding \u2014 open Simulator.app to inspect it":"not responding \u2014 reconnect it, or restart the emulator";default:return}}function ne(e,i){let m=i.id!==void 0?{...i,id:z(i.id)}:i,c=e.virtualName!==void 0?{...e,virtualName:z(e.virtualName)}:e;return V(c,m)}function ie(e){return e.virtualName??e.displayName}function ae(e,i){let m=e.state==="ready"||e.state==="stopped",c=re(e),b=e.osVersion?` (${e.osVersion})`:"";return{id:e.id,label:`${ie(e)}${b} \xB7 ${te(e)}`,...i&&ne(e,i)?{isActive:!0}:{},...m?{}:{disabled:!0},...!m&&c?{disabledHint:c}:{}}}function le(e){return e==="emulator"?"No Android emulator found. Make sure an emulator exists on this machine (Android Studio \u2192 Device Manager), then reopen this list.":e==="simulator"?"No iOS simulator found. Make sure a simulator exists on this machine (Xcode \u2192 Windows \u2192 Devices and Simulators), then reopen this list.":"No emulator or simulator found. Make sure one exists on this machine, then reopen this list."}function he({targets:e,preselectedTarget:i,preselectedId:m,busyMessage:c,onSelect:b,onCancel:f,kind:l}){if(c)return(0,T.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,T.jsx)(t,{color:o.orange,bold:!0,children:"Device"}),(0,T.jsxs)(n,{marginTop:1,children:[(0,T.jsx)(C,{}),(0,T.jsxs)(t,{color:o.secondary,children:[" ",c]})]})]});if(e.length===0)return(0,T.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,T.jsx)(t,{color:o.orange,bold:!0,children:"Device"}),(0,T.jsx)(n,{marginTop:1,children:(0,T.jsx)(t,{color:o.dim,children:le(l)})})]});let d=e.map(r=>ae(r,i)),p=i?d.find(r=>r.isActive)?.id??null:m?e.find(r=>r.id===m||r.virtualName===m)?.id??null:null,a=new Map(e.map(r=>[r.id,r]));return(0,T.jsx)(M,{title:"Device",items:d,itemNoun:"devices",defaultActiveId:p,preserveSelectionById:!0,onSelect:r=>{let y=a.get(r.id);y&&b(y)},onCancel:f})}var x=g(N(),1);var u=g(A(),1),q=50,G=500;function pe(e){return`${e.name} (${e.appId})`}function Pe({kind:e,listApps:i,onSelect:m,onManualEntry:c,onCancel:b,busyMessage:f}){let[l,d]=(0,x.useState)([]),[p,a]=(0,x.useState)(!0),[r,y]=(0,x.useState)(!1),[Q,O]=(0,x.useState)(!1),[E,H]=(0,x.useState)(null),[w,J]=(0,x.useState)(""),[j,U]=(0,x.useState)(!1),$=(0,x.useRef)(!0),R=(0,x.useRef)(0);if((0,x.useEffect)(()=>{let h=++R.current,k=w.trim();$.current?a(!0):k&&O(!0),y(!0),H(null),U(!1),(async()=>{let I=[];try{for(let P=0;;P+=q){let X=await i({limit:q,offset:P,search:k});if(h!==R.current)return;if(I.push(...X.apps),d([...I]),$.current&&(a(!1),$.current=!1),O(!1),X.apps.length===0||I.length>=X.total)break;if(I.length>=G){U(!0);break}}}catch(P){if(h!==R.current)return;H(P instanceof Error?P.message:String(P)),a(!1),O(!1)}finally{h===R.current&&y(!1)}})()},[w,i]),L((h,k)=>{if(k.tab){c();return}k.escape&&b()},{isActive:!!E&&!f}),f)return(0,u.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,u.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,u.jsxs)(n,{marginTop:1,children:[(0,u.jsx)(C,{}),(0,u.jsxs)(t,{color:o.secondary,children:[" ",f]})]})]});if(E)return(0,u.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.red,paddingX:2,paddingY:1,children:[(0,u.jsx)(t,{color:o.red,bold:!0,children:"App under test"}),(0,u.jsx)(n,{marginTop:1,children:(0,u.jsx)(t,{color:o.red,children:"Could not load your uploads."})}),(0,u.jsx)(n,{marginTop:1,children:(0,u.jsx)(t,{color:o.dim,children:E})}),(0,u.jsx)(B,{bindings:[{keys:"tab",label:"tab to enter an app id"}],escBackLabel:"back to chat"})]});let ee=new Map(l.map(h=>[h.appId,h])),oe=l.map(h=>({id:h.appId,label:pe(h)})),_=!p&&!r&&l.length===0&&!w.trim()?e==="simulator"?"No simulator builds uploaded to this account yet \u2014 press Tab to enter an app id.":"No emulator builds uploaded to this account yet \u2014 press Tab to enter an app id.":null;return(0,u.jsx)(M,{title:"App under test",items:oe,loading:p,loadingText:"Loading your uploads\u2026",loadingMore:r,searching:Q,itemNoun:"uploads",preserveSelectionById:!0,onSearch:J,onTab:c,extraHint:"tab to enter an id",footer:_?(0,u.jsx)(t,{color:o.dim,children:_}):j?(0,u.jsx)(t,{color:o.dim,children:`Showing the first ${G} \u2014 type to search the rest.`}):void 0,onSelect:h=>{let k=ee.get(h.id);k&&m({appId:k.appId,name:k.name})},onCancel:b})}var Y=g(N(),1);var S=g(A(),1),se={emulator:["apk"],simulator:["zip"]};function ce(e){return Z(e.trim())}function Oe({kind:e,onBack:i,onSelect:m,onCancel:c}){let[b,f]=(0,Y.useState)(""),[l,d]=(0,Y.useState)(null),p=e==="emulator"?".apk":".zip";return(0,S.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,S.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,S.jsx)(n,{marginTop:1,children:(0,S.jsx)(t,{color:o.dim,children:`Path to a build (${p}): `})}),(0,S.jsxs)(n,{marginTop:1,children:[(0,S.jsx)(t,{color:o.dim,children:" "}),(0,S.jsx)(D,{value:b,onChange:a=>{f(a),l&&d(null)},onSubmit:a=>{let r=ce(a);if(!r){d(a.trim()?`Not a build \u2014 expected ${p}.`:"Enter the path to a build.");return}if(!se[e].includes(r.kind)){d(`${r.kind} builds don't run on a ${e} \u2014 expected ${p}.`);return}d(null),m(r).then(y=>{!y.ok&&y.error&&d(y.error)})},onCancel:i,placeholder:e==="emulator"?"/path/to/app-debug.apk":"/path/to/MyApp.zip"})]}),l&&(0,S.jsx)(n,{marginTop:1,children:(0,S.jsx)(t,{color:o.red,children:l})}),(0,S.jsx)(B,{bindings:[{keys:"\u21B5",label:"use this build"}],escBackLabel:"back"})]})}var F=g(N(),1);var v=g(A(),1);function de(e){return[{value:"local",label:"Local build",hint:e==="emulator"?".apk":".zip",available:!0},{value:"uploaded",label:"Uploaded app",hint:"an app id from your cloud uploads",available:!0}]}function Ye({kind:e,onSelect:i,onCancel:m}){let c=de(e),[b,f]=(0,F.useState)(0),[l,d]=(0,F.useState)(null);return L((p,a)=>{if(a.escape){m();return}if(a.upArrow&&f(r=>Math.max(0,r-1)),a.downArrow&&f(r=>Math.min(c.length-1,r+1)),a.return){let r=c[b];if(!r.available){d("That source isn't available \u2014 choose a local build for now.");return}d(null),i(r.value)}}),(0,v.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,v.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,v.jsx)(n,{marginTop:1,flexDirection:"column",children:c.map((p,a)=>{let r=a===b,y=p.available?r?o.orange:void 0:o.muted;return(0,v.jsxs)(n,{children:[(0,v.jsxs)(t,{color:y,children:[r?"\u276F ":" ",p.label]}),(0,v.jsxs)(t,{color:o.dim,children:[" ",p.hint]})]},p.value)})}),l&&(0,v.jsx)(n,{marginTop:1,children:(0,v.jsx)(t,{color:o.red,children:l})}),(0,v.jsx)(B,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}var K=g(N(),1);var s=g(A(),1);function qe({busyMessage:e,onSubmit:i,onBack:m}){let[c,b]=(0,K.useState)(""),[f,l]=(0,K.useState)(null);return e?(0,s.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,s.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,s.jsxs)(n,{marginTop:1,children:[(0,s.jsx)(C,{}),(0,s.jsxs)(t,{color:o.secondary,children:[" ",e]})]})]}):(0,s.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,s.jsx)(t,{color:o.orange,bold:!0,children:"App under test"}),(0,s.jsx)(n,{marginTop:1,children:(0,s.jsx)(t,{color:o.dim,children:"App id from your cloud uploads:"})}),(0,s.jsxs)(n,{marginTop:1,children:[(0,s.jsx)(t,{color:o.dim,children:" "}),(0,s.jsx)(D,{value:c,onChange:d=>{b(d),f&&l(null)},onSubmit:d=>{let p=d.trim();if(!p){l("Enter an app id.");return}if(!W(p)){l("That doesn't look like an app id \u2014 they start with APP.");return}l(null),i(p).then(a=>{!a.ok&&a.error&&l(a.error)})},onCancel:m,placeholder:"APP1016032231178585590501450"})]}),f&&(0,s.jsxs)(n,{marginTop:1,flexDirection:"column",children:[(0,s.jsx)(t,{color:o.red,children:f}),(0,s.jsx)(t,{color:o.dim,children:"Enter a valid app id \u2014 copy it from your cloud uploads."})]}),(0,s.jsx)(B,{bindings:[{keys:"\u21B5",label:"use this app"}],escBackLabel:"back"})]})}export{he as a,Pe as b,Oe as c,Ye as d,qe as e};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as O,d as S}from"./chunk-VNFCX2SH.js";import{c as L}from"./chunk-RFHMDQXZ.js";import{n as P,o as R}from"./chunk-RSSOJ3L2.js";import{y as s}from"./chunk-B2ZGG7WM.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
2
+ import{b as O,d as S}from"./chunk-GSDXZS4U.js";import{c as L}from"./chunk-RFHMDQXZ.js";import{n as P,o as R}from"./chunk-RSSOJ3L2.js";import{y as s}from"./chunk-HYTBEPC2.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-OH2NSBO6.js";import"./chunk-B2ZGG7WM.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
2
+ import{a}from"./chunk-EPE2ELDH.js";import"./chunk-HYTBEPC2.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as O}from"./chunk-DYW5C6II.js";import{P as g,Q as S,S as G}from"./chunk-6LGED4FC.js";import"./chunk-C74ABM24.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{e as w,f as $}from"./chunk-5GUD3CIH.js";import{d as x}from"./chunk-YMLC55J4.js";import{e as k}from"./chunk-EHN5HTUD.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import{b}from"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as R}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{basename as h}from"path";import{statSync as A}from"fs";function C(t,e){if(!t)return 1;let o=t.resolve(e);return!o||o.superseded?1:t.getNode(o.tip)?.content.risk==="high"?3:1}function D(t,e){return t.usecases.map(o=>{let s=o.acceptance_criteria??[],a=s.filter(n=>(n.covered_by??[]).length>0),l=s.filter(n=>n.execution==="passed"),i=s.filter(n=>n.execution==="failed"),u=s.filter(n=>n.execution==="blocked"),d=0,m=0;for(let n of s){let f=C(e,n.id);d+=f,n.execution==="passed"&&(m+=f)}let r=d===0?0:Math.round(100*m/d),p=a.length===0?"uncovered":s.length===l.length?"covered":u.length>0&&i.length===0?"blocked":"partial";return{id:o.id,title:o.title,status:p,pct:r,acs:{total:s.length,covered:a.length,passed:l.length,failed:i.length,blocked:u.length},stale:s.filter(n=>n.fresh==="stale").map(n=>n.id)}})}async function P(t){let e=await w(t);return e.length===0?null:e.map(o=>({p:o,m:A(o).mtimeMs})).sort((o,s)=>s.m-o.m)[0].p}var N={covered:"\u2714",partial:"\u25D0",uncovered:"\u2716",blocked:"\u23F8"};function _(t){let e=Math.round(t/10);return"\u2588".repeat(e)+"\u2591".repeat(10-e)}async function I(t,e=G(),o=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return g(e,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:r,agentRefusal:p}=await import("./headless-io-3A3BZVQ5.js"),n=r("ndjson","cover",{stdout:c=>e.out(c.replace(/\n$/,"")),stderr:c=>(e.err??e.out)(c.replace(/\n$/,""))}),f=[],v=[],j={out:c=>f.push(c),err:c=>v.push(c),confirm:async()=>!1,isTTY:!1};if(await I({...t,json:!0,mode:void 0},j,o)!==0)return p(n,v.join("; ")||"cover refused");let y=JSON.parse(f.join(`
2
+ import{b as O}from"./chunk-DYW5C6II.js";import{P as g,Q as S,S as G}from"./chunk-UHSNUUX3.js";import"./chunk-YZVR7ESF.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{e as w,f as $}from"./chunk-5GUD3CIH.js";import{d as x}from"./chunk-YMLC55J4.js";import{e as k}from"./chunk-EHN5HTUD.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import{b}from"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as R}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-HYTBEPC2.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{basename as h}from"path";import{statSync as A}from"fs";function C(t,e){if(!t)return 1;let o=t.resolve(e);return!o||o.superseded?1:t.getNode(o.tip)?.content.risk==="high"?3:1}function D(t,e){return t.usecases.map(o=>{let s=o.acceptance_criteria??[],a=s.filter(n=>(n.covered_by??[]).length>0),l=s.filter(n=>n.execution==="passed"),i=s.filter(n=>n.execution==="failed"),u=s.filter(n=>n.execution==="blocked"),d=0,m=0;for(let n of s){let f=C(e,n.id);d+=f,n.execution==="passed"&&(m+=f)}let r=d===0?0:Math.round(100*m/d),p=a.length===0?"uncovered":s.length===l.length?"covered":u.length>0&&i.length===0?"blocked":"partial";return{id:o.id,title:o.title,status:p,pct:r,acs:{total:s.length,covered:a.length,passed:l.length,failed:i.length,blocked:u.length},stale:s.filter(n=>n.fresh==="stale").map(n=>n.id)}})}async function P(t){let e=await w(t);return e.length===0?null:e.map(o=>({p:o,m:A(o).mtimeMs})).sort((o,s)=>s.m-o.m)[0].p}var N={covered:"\u2714",partial:"\u25D0",uncovered:"\u2716",blocked:"\u23F8"};function _(t){let e=Math.round(t/10);return"\u2588".repeat(e)+"\u2591".repeat(10-e)}async function I(t,e=G(),o=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return g(e,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:r,agentRefusal:p}=await import("./headless-io-3A3BZVQ5.js"),n=r("ndjson","cover",{stdout:c=>e.out(c.replace(/\n$/,"")),stderr:c=>(e.err??e.out)(c.replace(/\n$/,""))}),f=[],v=[],j={out:c=>f.push(c),err:c=>v.push(c),confirm:async()=>!1,isTTY:!1};if(await I({...t,json:!0,mode:void 0},j,o)!==0)return p(n,v.join("; ")||"cover refused");let y=JSON.parse(f.join(`
3
3
  `));return n.event({type:"coverage",...y}),n.done(0,void 0,M(y.completeness??[]))}let s=S(o,e);if(!s)return 2;let a=t.from?await $(t.from,o):await P(o);if(!a)return g(e,t.from?`no evidence pack at '${t.from}'`:"no evidence pack in .testmuai/evidence \u2014 run a test first, or pass --from <pack>"),2;let l=await k(a,"coverage/usecases.yaml");if(l==null)return g(e,`${h(a)} carries no coverage/usecases.yaml \u2014 the pack predates coverage or its project had no .context at seal time`),2;let i=b(l);if(!i||!Array.isArray(i.usecases))return g(e,`${h(a)}: coverage/usecases.yaml is not a usecases document`),2;let u=R(s),d=D(i,u),m=await x(u,"design");if(t.json)return e.out(JSON.stringify({pack:a,depth:d,completeness:m},null,2)),0;e.out(`coverage \u2014 ${h(a)}`),e.out(""),e.out("depth (proven by the pack):");for(let r of d){let p=r.stale.length?` \xB7 ${r.stale.length} stale`:"";e.out(` ${N[r.status]} ${_(r.pct)} ${String(r.pct).padStart(3)}% ${r.id} \u2014 ${r.status} (${r.acs.passed}/${r.acs.total} ACs proven${r.acs.failed?`, ${r.acs.failed} failed`:""}${r.acs.blocked?`, ${r.acs.blocked} blocked`:""})${p}`)}e.out(""),e.out("completeness (live graph):"),m.length===0&&e.out(" no design gaps \u2014 every AC verified, every use-case scenarioed");for(let r of m)e.out(` [${r.risk}] ${r.tag} ${r.ref} \u2014 ${r.why}`),e.out(` \u2192 ${r.ready_command}`);return 0}function M(t){return t.filter(e=>e.ready_command.startsWith("kane-cli ")&&O(e.ready_command)).slice(0,4).map(e=>({cmd:e.ready_command,why:e.why}))}export{I as coverCommand,M as coverNext,D as depthRows};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-IQ7NGOAT.js";import"./chunk-B2ZGG7WM.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
2
+ import{a}from"./chunk-NWNG5UWD.js";import"./chunk-HYTBEPC2.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
@@ -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,j}from"./chunk-WBHSPN55.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-B2ZGG7WM.js";import"./chunk-UR6MHSHU.js";export{a as DEPS_INSTALL_SCHEMA_VERSION,i as DepsBundleResolver,c as DepsInstallRequiredError,h as NoPublishedBundleError,b as classOfTarget,g as downloadPayload,e as formatEta,d as formatRate,j as managedDeps,f as planRangeParts};
2
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-6GLFQHSW.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-HYTBEPC2.js";import"./chunk-UR6MHSHU.js";export{a as DEPS_INSTALL_SCHEMA_VERSION,i as DepsBundleResolver,c as DepsInstallRequiredError,h as NoPublishedBundleError,b as classOfTarget,g as downloadPayload,e as formatEta,d as formatRate,j as managedDeps,f as planRangeParts};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-UR6MHSHU.js";var c="Mobile dependencies are resolved through your KaneAI account. Run `kane-cli login` first.";function d(l,o,e=process.env){return e.KANE_MOBILE_DEPS_BASE_URL||o(l)}async function u(){let[{CredentialsManager:l},{refreshOAuthToken:o},{getEnvironment:e},{ControllerClient:n}]=await Promise.all([import("./credentials-Q4WH5CBN.js"),import("./token-refresh-KN5JK2U4.js"),import("./config-3AKWRTFS.js"),import("./controller-client-ZF5IXRUV.js")]),s=new l;return{creds:s,refresh:r=>o({creds:s,profile:r.profile,env:r.env,credentials:r.credentials}),controllerBaseUrlFor:r=>d(r,t=>e(t).controllerBaseUrl),makeClient:(r,t)=>new n(r,t)}}function p(l){return async o=>{let e=l??await u(),n=e.creds.getActiveProfile();if(!n)throw new Error(c);let s=e.creds.getDefaultEnv(),r=e.controllerBaseUrlFor(s),t=e.creds.loadBasicAuth(n,s);if(t)return e.makeClient(r,{username:t.username,accessKey:t.access_key}).resolveMobileDepsBundle(o);let i=e.creds.loadCredentials(n,s);if(!i)throw new Error(c);try{await e.refresh({creds:e.creds,profile:n,env:s,credentials:i})}catch{}let a=(e.creds.loadCredentials(n,s)??i).access_token;if(typeof a!="string"||!a)throw new Error(c);return e.makeClient(r,a).resolveMobileDepsBundle(o)}}export{p as controllerResolveBundle,d as depsControllerBaseUrl};
2
+ import"./chunk-UR6MHSHU.js";var c="Mobile dependencies are resolved through your KaneAI account. Run `kane-cli login` first.";function d(l,o,e=process.env){return e.KANE_MOBILE_DEPS_BASE_URL||o(l)}async function u(){let[{CredentialsManager:l},{refreshOAuthToken:o},{getEnvironment:e},{ControllerClient:n}]=await Promise.all([import("./credentials-GWLYYRTL.js"),import("./token-refresh-NTE4LQRN.js"),import("./config-UGCWZGH5.js"),import("./controller-client-ZF5IXRUV.js")]),s=new l;return{creds:s,refresh:r=>o({creds:s,profile:r.profile,env:r.env,credentials:r.credentials}),controllerBaseUrlFor:r=>d(r,t=>e(t).controllerBaseUrl),makeClient:(r,t)=>new n(r,t)}}function p(l){return async o=>{let e=l??await u(),n=e.creds.getActiveProfile();if(!n)throw new Error(c);let s=e.creds.getDefaultEnv(),r=e.controllerBaseUrlFor(s),t=e.creds.loadBasicAuth(n,s);if(t)return e.makeClient(r,{username:t.username,accessKey:t.access_key}).resolveMobileDepsBundle(o);let i=e.creds.loadCredentials(n,s);if(!i)throw new Error(c);try{await e.refresh({creds:e.creds,profile:n,env:s,credentials:i})}catch{}let a=(e.creds.loadCredentials(n,s)??i).access_token;if(typeof a!="string"||!a)throw new Error(c);return e.makeClient(r,a).resolveMobileDepsBundle(o)}}export{p as controllerResolveBundle,d as depsControllerBaseUrl};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-P3JUE2RM.js";import"./chunk-YKTYVJBN.js";import"./chunk-AHXOKBVE.js";import"./chunk-ALCE5RLK.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-IE3OO5GI.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-B2ZGG7WM.js";import"./chunk-UR6MHSHU.js";export{b as REMOTE_PROVIDERS,d as findProvider,a as landingReceipt,c as looksLikeUrl};
2
+ import{a,b,c,d}from"./chunk-Q77QO3PC.js";import"./chunk-YKTYVJBN.js";import"./chunk-AHXOKBVE.js";import"./chunk-ALCE5RLK.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-IE3OO5GI.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-HYTBEPC2.js";import"./chunk-UR6MHSHU.js";export{b as REMOTE_PROVIDERS,d as findProvider,a as landingReceipt,c as looksLikeUrl};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-JJJSDDQ2.js";import"./chunk-RQLU4NDG.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-WBHSPN55.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-B2ZGG7WM.js";import"./chunk-UR6MHSHU.js";export{d as doctorExitCode,c as doctorPreflightBlocked,b as renderDoctorText,a as runDoctor};
2
+ import{a,b,c,d}from"./chunk-QVLYK5JL.js";import"./chunk-A557OSRS.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-6GLFQHSW.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HYTBEPC2.js";import"./chunk-UR6MHSHU.js";export{d as doctorExitCode,c as doctorPreflightBlocked,b as renderDoctorText,a as runDoctor};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{A as K,B as L,D as M,E as N,F as O,G as P,H as Q,J as R,K as S,L as T,M as U,N as _,P as $,Q as aa,R as ba,T as ca,U as da,V as ea,W as fa,X as ga,Y as ha,Z as ia,a as c,b as d,c as e,d as f,e as g,f as h,h as i,i as j,j as t,k as u,l as v,m as w,n as x,o as y,p as z,q as A,r as B,s as C,t as D,u as E,v as F,w as G,x as H,y as I,z as J}from"./chunk-CGT4NFQN.js";import{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-VNFCX2SH.js";import"./chunk-7O54QURK.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-5GUD3CIH.js";import"./chunk-WILT62DP.js";import"./chunk-YMLC55J4.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import{a,f as b}from"./chunk-P7YZ3PU3.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-3BHRGHIZ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-WBHSPN55.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-OH2NSBO6.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,b as buildEnvironment,j as buildEvidenceRunConfig,i as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,a as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,f as shortHash,e as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,h as testIdForInline,g as testIdForTestmd,k as validatePack,c as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,d as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
2
+ import{A as K,B as L,D as M,E as N,F as O,G as P,H as Q,J as R,K as S,L as T,M as U,N as _,P as $,Q as aa,R as ba,T as ca,U as da,V as ea,W as fa,X as ga,Y as ha,Z as ia,a as c,b as d,c as e,d as f,e as g,f as h,h as i,i as j,j as t,k as u,l as v,m as w,n as x,o as y,p as z,q as A,r as B,s as C,t as D,u as E,v as F,w as G,x as H,y as I,z as J}from"./chunk-7EGIX6Y4.js";import{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-GSDXZS4U.js";import"./chunk-7O54QURK.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-5GUD3CIH.js";import"./chunk-VOTIGXQ4.js";import"./chunk-YMLC55J4.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import{a,f as b}from"./chunk-P7YZ3PU3.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-6L5RV62W.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-6GLFQHSW.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-EPE2ELDH.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-HYTBEPC2.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,b as buildEnvironment,j as buildEvidenceRunConfig,i as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,a as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,f as shortHash,e as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,h as testIdForInline,g as testIdForTestmd,k as validatePack,c as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,d as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
@@ -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}from"./chunk-SQDQADWD.js";import"./chunk-O3XBIURC.js";import"./chunk-UJZZDPDY.js";import"./chunk-BZAGVBCX.js";import"./chunk-JUJ4SAGH.js";import"./chunk-ALCE5RLK.js";import"./chunk-6LGED4FC.js";import"./chunk-C74ABM24.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
2
+ import{a,b,c,d,e,f,g}from"./chunk-PGXJ275T.js";import"./chunk-O3XBIURC.js";import"./chunk-UJZZDPDY.js";import"./chunk-BZAGVBCX.js";import"./chunk-JUJ4SAGH.js";import"./chunk-ALCE5RLK.js";import"./chunk-UHSNUUX3.js";import"./chunk-YZVR7ESF.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-HYTBEPC2.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-3IXEARDX.js";import{Q as i}from"./chunk-6LGED4FC.js";import"./chunk-C74ABM24.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as n}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=i(process.cwd(),{out:r=>process.stdout.write(r+`
2
+ import{a}from"./chunk-3IXEARDX.js";import{Q as i}from"./chunk-UHSNUUX3.js";import"./chunk-YZVR7ESF.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as n}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-HYTBEPC2.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=i(process.cwd(),{out:r=>process.stdout.write(r+`
3
3
  `),err:r=>process.stderr.write(r+`
4
4
  `),confirm:async()=>!1,isTTY:!!process.stdout.isTTY});if(!o)return 2;let c=n(o),t=a(o,c,s);if(p.json)return process.stdout.write(JSON.stringify(t)+`
5
5
  `),t.target?0:1;if(!t.target)return process.stdout.write(`error: ${s} names nothing in the graph
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $}from"./chunk-A2SQD2AY.js";import{f as se,g as U}from"./chunk-L6MOO4WT.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-MLRO7OH3.js";import"./chunk-KZG4E5RM.js";import"./chunk-X5276I5H.js";import"./chunk-UHT5SVP5.js";import"./chunk-FFFB5BXL.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-BZAGVBCX.js";import"./chunk-52WM3XYO.js";import"./chunk-BB2W35TW.js";import"./chunk-P3JUE2RM.js";import{c as L}from"./chunk-YKTYVJBN.js";import"./chunk-CRZUBDJ3.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.js";import{a as A}from"./chunk-NDCRJXYF.js";import{a as ie}from"./chunk-JUJ4SAGH.js";import"./chunk-AHXOKBVE.js";import"./chunk-ALCE5RLK.js";import"./chunk-55YDTPB7.js";import"./chunk-YCH7H7JX.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import{e as W}from"./chunk-4K5XTIJ6.js";import"./chunk-J7NRD4Q7.js";import{T as ee,U as te,V as re,W as Y,X as ne}from"./chunk-6LGED4FC.js";import"./chunk-C74ABM24.js";import{c as O}from"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import{a as C}from"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import{a as B,b as H}from"./chunk-O2APH6TZ.js";import"./chunk-4PMZ5FCD.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as oe}from"fs";async function he(n){let[{render:s},a,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),h=a.default??a;return new Promise(x=>{let v=s(h.createElement(m,{questions:n,onSubmit:t=>{v.unmount(),x(t)}}))})}async function we(n,s){let[{render:a},m,{ReviewChecklist:h}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),x=m.default??m;return new Promise(v=>{let t=a(x.createElement(h,{items:n.map(f=>{let w=s.get(f.temp_ref);return{uc:f,dedupWith:w&&!w.archived?w.cid:void 0,archivedMatch:w?.archived?{cid:w.cid,reason:w.reason}:void 0}}),onSubmit:f=>{t.unmount(),v(f)}}))})}async function ye(n){let{createInterface:s}=await import("readline/promises"),a=s({input:process.stdin,output:process.stdout});try{let m=await a.question(`${n} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{a.close()}}async function Ae(n){let s=C(process.cwd()),a=H({verb:"extract",mode:n.plan?"cli":"interactive",contextRoot:s,env:B(),resumeSid:n.resume,write:!0,longSession:!0});await ee(s,r=>process.stderr.write(r+`
2
+ import{a as $}from"./chunk-A2SQD2AY.js";import{f as se,g as U}from"./chunk-CNPIJFZM.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-6DHEOPXX.js";import"./chunk-KZG4E5RM.js";import"./chunk-T4R26WER.js";import"./chunk-UHT5SVP5.js";import"./chunk-DMCEGMGB.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-BZAGVBCX.js";import"./chunk-52WM3XYO.js";import"./chunk-BB2W35TW.js";import"./chunk-Q77QO3PC.js";import{c as L}from"./chunk-YKTYVJBN.js";import"./chunk-CRZUBDJ3.js";import"./chunk-GX3FPJUG.js";import"./chunk-427OQS2N.js";import{a as A}from"./chunk-LJGAXIDU.js";import{a as ie}from"./chunk-JUJ4SAGH.js";import"./chunk-AHXOKBVE.js";import"./chunk-ALCE5RLK.js";import"./chunk-55YDTPB7.js";import"./chunk-YCH7H7JX.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import{e as W}from"./chunk-GZ65ZA4C.js";import"./chunk-DMT3W26F.js";import{T as ee,U as te,V as re,W as Y,X as ne}from"./chunk-UHSNUUX3.js";import"./chunk-YZVR7ESF.js";import{c as O}from"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import{a as C}from"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import{a as B,b as H}from"./chunk-KUS324VE.js";import"./chunk-4PMZ5FCD.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-HYTBEPC2.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as oe}from"fs";async function he(n){let[{render:s},a,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),h=a.default??a;return new Promise(x=>{let v=s(h.createElement(m,{questions:n,onSubmit:t=>{v.unmount(),x(t)}}))})}async function we(n,s){let[{render:a},m,{ReviewChecklist:h}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),x=m.default??m;return new Promise(v=>{let t=a(x.createElement(h,{items:n.map(f=>{let w=s.get(f.temp_ref);return{uc:f,dedupWith:w&&!w.archived?w.cid:void 0,archivedMatch:w?.archived?{cid:w.cid,reason:w.reason}:void 0}}),onSubmit:f=>{t.unmount(),v(f)}}))})}async function ye(n){let{createInterface:s}=await import("readline/promises"),a=s({input:process.stdin,output:process.stdout});try{let m=await a.question(`${n} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{a.close()}}async function Ae(n){let s=C(process.cwd()),a=H({verb:"extract",mode:n.plan?"cli":"interactive",contextRoot:s,env:B(),resumeSid:n.resume,write:!0,longSession:!0});await ee(s,r=>process.stderr.write(r+`
3
3
  `));{let r=oe(s)?Y(s):null;if(r)return process.stderr.write(`error: ${r.text}
4
4
  next: ${r.remedy}
5
5
  `),await a.end({exit_code:2}),2}let h={...await W(),...a.spawnEnv()},x=await L(h);if(!x.ok)return process.stderr.write((x.message??"error: turn-endpoint preflight failed")+`
@@ -7,7 +7,7 @@ next: ${r.remedy}
7
7
  `),a.error("preflight_auth"),await a.end({exit_code:2}),2;let v=async()=>x;if(n.plan){let r=await U(n,{contextDir:s,agent:A,preflightTurn:v,ask:he,review:we,confirmStale:ye,out:l=>process.stdout.write(l+`
8
8
  `),progress:l=>process.stderr.write(l+`
9
9
  `),isTTY:O(),auth:h,telemetry:a});return r===1&&process.stderr.write(a.supportFooter()+`
10
- `),await a.end({exit_code:r}),r}let[{render:t},f,{ScrollbackProvider:w},{ChatSurface:z},{ScrollbackTap:u},{makeChatController:F},{setInkExit:Q},T]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-AVL3TJA2.js"),import("./ScrollbackTap-QHJOFYMC.js"),import("./chat-controller-3EPK7UZG.js"),import("./exit-manager-ZLDO54S4.js"),Promise.all([import("./chat-committer-HDE3TP5I.js"),import("./descriptor-PWUUNYV7.js"),import("./explain-H5HJEDEF.js"),import("./readmodel-IBFRM6EO.js")])]),[{commitChatTurn:J},{topologyDescriptor:j},{explain:e},{openGraph:i}]=T,S=f.default??f,o=F({commitChatTurn:J,descriptor:j(),contextDir:s,refreshGraph:()=>i(s),graph:i(s),explain:e,by:{kind:"human",id:"owner"},dedupFlags:r=>se(r,i(s))}),q={current:null},P=null,K=0,G=null,I=!1,ae=()=>{if(K+=1,K>=2){try{M.unmount()}catch{}$({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}o.requestPause(),G=setTimeout(()=>{I||(I=!0,(async()=>{o.finalizeForExit(),await q.current?.flush();try{M.unmount()}catch{}$({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},ce=await import("./dossier-UGJMYYAB.js"),de=r=>{try{return ce.buildDossier(i(s),r)}catch{return null}},ue={listUcs:()=>{let r=i(s),l=new Set(o.state.turns.flatMap(c=>(c.items??[]).map(p=>p.title.toLowerCase()))),d={high:0,med:1,low:2};return r.byLabel("usecase").filter(c=>!r.superseded.has(c.cid)).map((c,p)=>{let k=c.content,b=String(k.title??c.cid.slice(0,12)),V=ie(r,c.cid),E=V?V.designed_at_cid===c.cid?"current":"stale":void 0;return{key:c.cid,title:b,badge:E==="current"?"designed":E==="stale"?"designed \xB7 stale":l.has(b.toLowerCase())?"drafted this session":"existing",designed:E,risk:k.risk,i:p}}).sort((c,p)=>(d[c.risk??"zz"]??3)-(d[p.risk??"zz"]??3)||c.i-p.i).map(({key:c,title:p,badge:k,designed:b})=>({key:c,title:p,badge:k,designed:b}))},runDesignChild:async(r,l=!1,d="design")=>{try{let{designEntryCheck:g,confirmUnreviewedViaAsk:_}=await import("./trust-gate-EX7R2P4Y.js"),y=g(i(s),r);if(!y.ok&&(y.code==="UC_UNREVIEWED"||y.code==="UC_ARCHIVED")&&!await _(D=>o.ask(D),y))return o.note(`design child refused \u2014 approve it first: ${y.reviewCmd}`),2}catch{}let[{runDesign:c}]=await Promise.all([import("./run-DN4XARP2.js")]),p="",k=(()=>{try{let g=i(s),_=g.resolve(r);return(_?g.getNode(_.cid)?.content?.title:void 0)??r}catch{return r}})(),{collectSessionItems:b}=await import("./session-items-2ATN7VXG.js"),V=b(o.state.turns).entries.length,E=o.state.credits?.total,fe=Date.now();o.ledger({kind:"childOpen",verb:d,subject:k});let ge=g=>{let _=Math.max(1,Math.round((Date.now()-fe)/1e3)),y=b(o.state.turns).entries.length-V,R=o.state.credits?.total,D=R!==void 0&&E!==void 0?R-E:R;o.ledger(g===0?{kind:"childClose",verb:d,subject:k,ok:!0,durS:_,...y>0?{results:`${y} item${y===1?"":"s"}`}:{},...D!==void 0&&D>0?{credits:D}:{}}:{kind:"childClose",verb:d,subject:k,ok:!1,durS:_,exitCode:g,fixCmd:`kane-cli design tests --use-case ${r}${l||d==="evolve"?" --force":""}`});let Z=b(o.state.turns).entries.length;o.ledger({kind:"childBack",parentVerb:"extract",context:`${Z} draft${Z===1?"":"s"} saved`})},N=1;try{N=await c({useCase:r,force:l,mode:"interactive"},{contextDir:s,agent:A,preflightTurn:v,ask:g=>o.ask(g),chat:o,nested:!0,out:g=>{p=g},progress:()=>{},isTTY:!0,auth:h})}finally{ge(N)}return N!==0&&p&&o.note(p),N}},{makeReconcileDeps:le}=await import("./reconcile-deps-X6IGH4CA.js"),me=le({contextDir:s,...n.changeContext?{changeContext:n.changeContext}:{},note:r=>o.note(r)}),pe={verb:"extract",sid:n.resume??a.ids.session_id,env:B(),...n.source?{subject:n.source}:{}},M=t(S.createElement(w,null,S.createElement(u,{into:q}),S.createElement(z,{controller:o,verb:"extract",onCtrlC:ae,chain:ue,inspect:de,reconcile:me,meta:pe})),{exitOnCtrlC:!1});Q(()=>M.unmount());let X=null;try{let r=U(n,{contextDir:s,agent:A,preflightTurn:v,onSummary:d=>{P=d},ask:d=>o.ask(d),review:async d=>new Map(d.map(c=>[c.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>o.note(d),progress:()=>{},isTTY:O(),auth:h,chat:o,telemetry:a});r.finally(()=>{I=!0});let l=await r;return X=l,l===1&&process.stderr.write(a.supportFooter()+`
10
+ `),await a.end({exit_code:r}),r}let[{render:t},f,{ScrollbackProvider:w},{ChatSurface:z},{ScrollbackTap:u},{makeChatController:F},{setInkExit:Q},T]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-2GPR4S7I.js"),import("./ScrollbackTap-QHJOFYMC.js"),import("./chat-controller-3EPK7UZG.js"),import("./exit-manager-ZLDO54S4.js"),Promise.all([import("./chat-committer-HDE3TP5I.js"),import("./descriptor-PWUUNYV7.js"),import("./explain-H5HJEDEF.js"),import("./readmodel-IBFRM6EO.js")])]),[{commitChatTurn:J},{topologyDescriptor:j},{explain:e},{openGraph:i}]=T,S=f.default??f,o=F({commitChatTurn:J,descriptor:j(),contextDir:s,refreshGraph:()=>i(s),graph:i(s),explain:e,by:{kind:"human",id:"owner"},dedupFlags:r=>se(r,i(s))}),q={current:null},P=null,K=0,G=null,I=!1,ae=()=>{if(K+=1,K>=2){try{M.unmount()}catch{}$({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}o.requestPause(),G=setTimeout(()=>{I||(I=!0,(async()=>{o.finalizeForExit(),await q.current?.flush();try{M.unmount()}catch{}$({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},ce=await import("./dossier-UGJMYYAB.js"),de=r=>{try{return ce.buildDossier(i(s),r)}catch{return null}},ue={listUcs:()=>{let r=i(s),l=new Set(o.state.turns.flatMap(c=>(c.items??[]).map(p=>p.title.toLowerCase()))),d={high:0,med:1,low:2};return r.byLabel("usecase").filter(c=>!r.superseded.has(c.cid)).map((c,p)=>{let k=c.content,b=String(k.title??c.cid.slice(0,12)),V=ie(r,c.cid),E=V?V.designed_at_cid===c.cid?"current":"stale":void 0;return{key:c.cid,title:b,badge:E==="current"?"designed":E==="stale"?"designed \xB7 stale":l.has(b.toLowerCase())?"drafted this session":"existing",designed:E,risk:k.risk,i:p}}).sort((c,p)=>(d[c.risk??"zz"]??3)-(d[p.risk??"zz"]??3)||c.i-p.i).map(({key:c,title:p,badge:k,designed:b})=>({key:c,title:p,badge:k,designed:b}))},runDesignChild:async(r,l=!1,d="design")=>{try{let{designEntryCheck:g,confirmUnreviewedViaAsk:_}=await import("./trust-gate-EX7R2P4Y.js"),y=g(i(s),r);if(!y.ok&&(y.code==="UC_UNREVIEWED"||y.code==="UC_ARCHIVED")&&!await _(D=>o.ask(D),y))return o.note(`design child refused \u2014 approve it first: ${y.reviewCmd}`),2}catch{}let[{runDesign:c}]=await Promise.all([import("./run-UDP5VPYS.js")]),p="",k=(()=>{try{let g=i(s),_=g.resolve(r);return(_?g.getNode(_.cid)?.content?.title:void 0)??r}catch{return r}})(),{collectSessionItems:b}=await import("./session-items-2ATN7VXG.js"),V=b(o.state.turns).entries.length,E=o.state.credits?.total,fe=Date.now();o.ledger({kind:"childOpen",verb:d,subject:k});let ge=g=>{let _=Math.max(1,Math.round((Date.now()-fe)/1e3)),y=b(o.state.turns).entries.length-V,R=o.state.credits?.total,D=R!==void 0&&E!==void 0?R-E:R;o.ledger(g===0?{kind:"childClose",verb:d,subject:k,ok:!0,durS:_,...y>0?{results:`${y} item${y===1?"":"s"}`}:{},...D!==void 0&&D>0?{credits:D}:{}}:{kind:"childClose",verb:d,subject:k,ok:!1,durS:_,exitCode:g,fixCmd:`kane-cli design tests --use-case ${r}${l||d==="evolve"?" --force":""}`});let Z=b(o.state.turns).entries.length;o.ledger({kind:"childBack",parentVerb:"extract",context:`${Z} draft${Z===1?"":"s"} saved`})},N=1;try{N=await c({useCase:r,force:l,mode:"interactive"},{contextDir:s,agent:A,preflightTurn:v,ask:g=>o.ask(g),chat:o,nested:!0,out:g=>{p=g},progress:()=>{},isTTY:!0,auth:h})}finally{ge(N)}return N!==0&&p&&o.note(p),N}},{makeReconcileDeps:le}=await import("./reconcile-deps-ZCJ2QCK5.js"),me=le({contextDir:s,...n.changeContext?{changeContext:n.changeContext}:{},note:r=>o.note(r)}),pe={verb:"extract",sid:n.resume??a.ids.session_id,env:B(),...n.source?{subject:n.source}:{}},M=t(S.createElement(w,null,S.createElement(u,{into:q}),S.createElement(z,{controller:o,verb:"extract",onCtrlC:ae,chain:ue,inspect:de,reconcile:me,meta:pe})),{exitOnCtrlC:!1});Q(()=>M.unmount());let X=null;try{let r=U(n,{contextDir:s,agent:A,preflightTurn:v,onSummary:d=>{P=d},ask:d=>o.ask(d),review:async d=>new Map(d.map(c=>[c.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>o.note(d),progress:()=>{},isTTY:O(),auth:h,chat:o,telemetry:a});r.finally(()=>{I=!0});let l=await r;return X=l,l===1&&process.stderr.write(a.supportFooter()+`
11
11
  `),await a.end({exit_code:l}),l}catch(r){throw P||(P={state:"crashed",facts:[`the session ended unexpectedly \u2014 ${r instanceof Error?r.name:"error"}`]}),r}finally{I=!0,G&&clearTimeout(G),o.finalizeForExit(),await q.current?.flush();try{M.unmount()}catch{}P?$(P):X===1&&$({state:"interrupted",facts:["the session ended without saving \u2014 see the error above"]})}}async function $e(n){let s=H({verb:"extract",mode:n.mode,contextRoot:C(process.cwd()),env:B(),resumeSid:n.resume,write:!0,longSession:!0}),{makeHeadlessIO:a,resolveEncoding:m,guardedChannels:h}=await import("./headless-io-3A3BZVQ5.js"),{withStructuredNext:x,prepareStructuredResume:v}=await import("./structured-answers-NADW6D44.js"),t=x(a(m(n.mode),"extract")),f=await te(C(process.cwd()));f&&(m(n.mode)==="ndjson"?t.event(re(f)):t.progress(f.text));let{runWithChannel:w}=await import("./run-channel-RGH4WIQX.js"),z=m(n.mode)==="ndjson"?e=>w({event:i=>t.event(i)},e):e=>e();for(let e of n.landed??[]){let i=e;t.event({type:"ingested",source_id:e.source_id,status:e.status,cid:e.source_cid,...i.warnings?.length?{warnings:i.warnings}:{},...i.media?{media:i.media}:{},...i.duplicate_of?{duplicate_of:i.duplicate_of}:{},...i.lineage_candidate?{lineage_candidate:i.lineage_candidate}:{}})}{let e=oe(C(process.cwd()))?Y(C(process.cwd())):null;if(e)return m(n.mode)==="ndjson"?t.event(ne(e)):t.progress(`error: ${e.text}
12
12
  next: ${e.remedy}`),await s.end({exit_code:2}),t.done(2,"refused")}let u;try{u=v({opts:n,contextDir:C(process.cwd()),verb:"extract"})}catch(e){let i=e instanceof Error?e.message:String(e);return t.out(`error: ${i}`),n.mode==="agent"&&t.event({type:"error",message:i}),await s.end({exit_code:1}),n.mode==="agent"?t.done(1,"error"):1}if(u.kind==="refuse")return t.out(u.error),n.mode==="agent"&&t.event({type:"error",message:u.error,code:u.code}),await s.end({exit_code:2}),n.mode==="agent"?t.done(2,"refused"):2;let F=n;if(u.kind==="apply"){for(let e of u.notes)t.out(e);if(u.matchedQids.length>0){t.out(`applying ${u.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let e of u.matchedQids)t.event({type:"panel_resolved",id:e,by:"user",via:"flag"})}u.statement&&(F={...n,message:[n.message,u.statement].filter(Boolean).join(`
13
13
 
@@ -2,4 +2,4 @@ import { createRequire } from 'module'; const require = createRequire(import.met
2
2
  import{a as i}from"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";import{existsSync as u}from"fs";async function g(e){if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-3A3BZVQ5.js");return r(t("ndjson","extract"),`extract: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}let n=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
3
3
  `),2;let{makeHeadlessIO:o,agentRefusal:c}=await import("./headless-io-3A3BZVQ5.js");return c(o("ndjson","extract"),t,r)};if(e.apply)return n("extract: --apply is not implemented yet \u2014 coming with the plan\u2192apply workflow (run without --apply, or use --plan to preview)");{let{validateResumeMessage:t}=await import("./headless-io-3A3BZVQ5.js"),r=t(e,"extract");if(r)return n(r)}{let{gateStructuredFlags:t}=await import("./structured-answers-NADW6D44.js"),r=t(e,"extract");if(r)return n(r,"STRUCTURED_FLAGS_USAGE")}if(e.withSource&&!e.resume)return n("extract: --with-source pairs with --resume \u2014 it lands the source and sets the resumed session's pending questions aside");if(e.queued)return n("extract: --queued is gone \u2014 extract sweeps every pending source by default (just run kane-cli context extract)");if(!u(i(process.cwd())))return n("error: no context store here (run `kane-cli context ingest <files>` first)","NO_STORE");if(!e.mode&&!process.stdin.isTTY)return process.stderr.write(`extract: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
4
4
  `),2;let s=e.mode??"interactive";if(s==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`extract: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
5
- `),2;let{bindExtractInteractive:t}=await import("./extract-bind-D5BYYGYA.js");return t(e)}let{bindExtractHeadless:a}=await import("./extract-bind-D5BYYGYA.js");return a({...e,mode:s})}export{g as extractCommand};
5
+ `),2;let{bindExtractInteractive:t}=await import("./extract-bind-7IDQS4QP.js");return t(e)}let{bindExtractHeadless:a}=await import("./extract-bind-7IDQS4QP.js");return a({...e,mode:s})}export{g as extractCommand};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{P as G,Q as re,S as oe,o as ne,p as se}from"./chunk-6LGED4FC.js";import"./chunk-C74ABM24.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{a as H,b as q,c as Q,d as X,e as Z,f as ee,g as te}from"./chunk-7O54QURK.js";import{f as V}from"./chunk-5GUD3CIH.js";import{a as O,b as F,c as C,d as z}from"./chunk-YMLC55J4.js";import"./chunk-EHN5HTUD.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as Y}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import{d as E,e as U}from"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";function me(e,t){return e.length===0?"not_run":Q(e,t).verified?"proven":q(e,t).some(r=>r.verdict==="failed")?"failing":"blocked"}function ie(e,t){let s=null;for(let{cid:g}of e.byLabel(E.TEST))for(let o of e.execHistory(g))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let r=H[t],a=te(e),l=X(a).aspects[t],x={},u={},m=0,h=0,R=0;for(let g of a.usecases){let o=[];for(let v of g.acceptance_criteria){let f=v.executions??[],p=me(f,r);o.push(p),p==="failing"?m++:p==="blocked"?h++:p==="not_run"&&R++;let y=[],c;if(p==="failing"){let n=null,d=e.resolve(v.id)?.cid;for(let b of v.covered_by){let w=e.execHistory(b).map($=>({verdict:String(ee(e,$.per_ac,d,v.id)??$.verdict),oracle_mode:String($.oracle_mode),ts:String($.started_at),execution_id:String($.execution_id)})).filter($=>r.counted_verdicts.includes($.verdict)&&r.accepted_oracle_modes.includes($.oracle_mode)),S=w[w.length-1];S?.verdict==="failed"&&(y.push(b),(!n||S.ts>n.ts)&&(n={ts:S.ts,execution_id:S.execution_id}))}c=n?.execution_id}else p==="blocked"&&(c=f[f.length-1]?.execution_id);x[v.id]={state:p,viaTests:y,...c?{executionId:c}:{}}}let i=o.some(v=>v!=="not_run"),k=l.usecases[g.id],_=i?k.status==="covered"?"proven":k.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";u[g.id]={pct:k.pct,status:_}}return{aspect:t,pct:l.summary.coverage_pct,acs_proven:l.summary.acs_verified,failing:m,blocked:h,not_run:R,latest_run:s,perUc:u,perAc:x,config:{...r,source:"graph_execution_facts",denominator:"current_live_acs"}}}var he=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],ve={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},M={high:0,med:1,low:2};function D(e,t){let s=/^(.*?)(\d+)$/.exec(e),r=/^(.*?)(\d+)$/.exec(t);return s&&r&&s[1]===r[1]?Number(s[2])-Number(r[2]):e<t?-1:e>t?1:0}function I(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function be(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function ye(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(r?.title??r?.text??"")}function ce(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:be(ye(e,t),8)}}function xe(e,t){let s=e.resolve(t);if(!s)return null;let r=e.tipOf(s.cid);if(!O(e,r))return null;let a=e.nodeLabel.get(r);if(a===E.USECASE)return r;if(a===E.AC)return C(e,r);if(a===E.TEST){let l=e.edgesFrom(r).find(u=>u.type===U.VERIFIES&&O(e,u.dst));if(l)return C(e,l.dst);let x=e.edgesFrom(r).find(u=>u.type===U.AUTOMATES&&O(e,u.dst));if(x){let u=e.edgesFrom(x.dst).find(m=>m.type===U.BELONGS_TO&&O(e,m.dst));return u?u.dst:null}}return null}function L(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function ke(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return r==="high"||r==="med"||r==="low"?r:"med"}function le(e,t,s,r,a){let l=a.servePaths??new Map,x=e.byLabel(E.USECASE).filter(({cid:o})=>O(e,o)),u=new Map(x.map(o=>[o.cid,o])),m=new Map(x.map(({cid:o})=>[o,[]])),h=[];for(let o of t){if(o.stage!=="design")continue;let i={...o,...ce(e,o.ref)},k=xe(e,o.ref),_=k?m.get(k):void 0;_&&L(o)!=="other"?_.push(i):h.push(i)}let R=new Map(x.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(E.AC)){if(!O(e,o))continue;let i=C(e,o),k=i?R.get(i):void 0;if(!k)continue;k.total++;let _=F(e,o);if(_&&k.designed++,!r)continue;let v=e.nameOf.get(o)??o,f=r.perAc[v];if(!f)continue;let{id:p,title:y}=ce(e,v),c={ref:e.displayNameOf(o)??o,id:p,title:y,risk:ke(e,v),stage:"cover"},n=m.get(i);f.state==="failing"?n.push({...c,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",via_tests:f.viaTests,...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{},...a.testFiles?{viaFiles:f.viaTests.map(d=>a.testFiles.get(d)??null)}:{}}):f.state==="blocked"?n.push({...c,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{}}):f.state==="not_run"&&_&&n.push({...c,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let g=[];for(let{cid:o,content:i}of x){let k=e.displayNameOf(o)??o,_=e.nameOf.get(o)??o,v=s.perUc[k]??{pct:0,status:"undesigned",staleAcs:0},f=r?r.perUc[_]??{pct:0,status:"not_run"}:null,p=r!==null&&(f===null||f.status==="not_run"),y=R.get(o),c=m.get(o)??[],n=new Set(c.filter(b=>L(b)==="needs-refresh").map(b=>b.ref)),d=[];for(let b of he){let w=c.filter($=>L($)===b);if(b==="needs-tests"&&(w=w.filter($=>!n.has($.ref))),w.length===0)continue;w.sort(($,T)=>(M[$.risk]??3)-(M[T.risk]??3)||D($.ref,T.ref));let S=b==="failing"||b==="blocked"||w.length<=2||new Set(w.map($=>$.ready_command)).size>1;d.push({key:b,label:ve[b],...b==="needs-refresh"?{suffix:"source moved since these were designed"}:{},rows:w,...S?{}:{rosterCommand:w[0].ready_command}})}g.push({slug:k,title:String(i.title??""),risk:String(i.risk??""),des:v,prov:f,provAbsent:p,acTotal:y.total,acDesigned:y.designed,groups:d})}return g.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.slug,i.slug)),h.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.ref,i.ref)),{stage:a.stage,aspect:a.aspect,top:a.top,dc:s,pa:r,ucs:g,other:h}}function N(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function W(e,t){return e==="all"||t.stage===e}function B(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}var _e={failing:"failing",blocked:"blocked","needs-refresh":"stale","needs-tests":"needs test","needs-scenarios":"no scenario","happy-only":"happy only","possible-duplicate":"duplicate?","not-yet-run":"to run"},$e=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate"];function ue(e,t){let s=Date.parse(e);if(Number.isNaN(s))return e;let r=Math.max(0,Math.floor((t-s)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function we(e,t){return(t.get("failing")??[]).length?0:(t.get("blocked")??[]).length?1:(t.get("needs-tests")??[]).length||(t.get("needs-scenarios")??[]).length?2:(t.get("needs-refresh")??[]).length?3:(t.get("not-yet-run")??[]).length>0||e.provAbsent?4:5}function de(e,t){let s=new Map;for(let g of t.groups)g.rows.length&&s.set(g.key,g.rows);let r=new Map;for(let g of t.groups){let o=g.rows.filter(i=>W(e.stage,i));o.length&&r.set(g.key,o)}let a=[],l=[],x=[],u=new Set;for(let g of $e){let o=r.get(g);if(o){for(let i of o){let k=g==="failing"&&i.via_tests?.length?` \xB7 via ${i.via_tests.map(_=>I(_)).join(", ")}`:"";a.push({id:i.ref===t.slug?"\u2014":I(i.id??i.ref),cls:_e[g],risk:i.ref===t.slug?"\u2014":i.risk,title:(i.ref===t.slug?i.why:i.title)+k})}if(g==="failing"||g==="blocked")for(let i of o)i.servePath&&u.add(`kane-cli evidence serve ${i.servePath}`);for(let i of o)i.ready_command&&!i.ready_command.startsWith("kane-cli evidence serve")&&i.ready_command!=="kane-cli testrun run"&&u.add(i.ready_command)}}let m=[...u].sort((g,o)=>Number(o.startsWith("kane-cli evidence serve"))-Number(g.startsWith("kane-cli evidence serve")));l.push(...m.map(g=>`\u21B3 ${g}`));let h=s.get("not-yet-run")??[],R=e.pa===null?t.acDesigned:h.length;return e.pa!==null&&R>0&&x.push(`${R} to run`),{uc:t,rows:a,spans:l,tails:x,toRun:R,severity:we(t,s)}}function pe(e,t){let{dc:s,pa:r}=e,a=Math.max(80,Math.min(t.width,100)),l=n=>t.color?`\x1B[2m${n}\x1B[22m`:n,x=t.now??Date.now(),u=[],m=r?.latest_run?`last run ${ue(r.latest_run.started_at,x)}`:"no runs yet";u.push(`coverage \u2014 designed \xD7 proven \xB7 ${e.aspect} \xB7 ${m}`),u.push(""),u.push(P(`designed ${String(s.pct).padStart(3)}% ${N(s.pct,10)} ${s.acs_designed} ACs have a verifying test`,t.color)),r?u.push(P(`proven ${String(r.pct).padStart(3)}% ${N(r.pct,10)} ${r.acs_proven} \xB7 ${r.failing} failing \xB7 ${r.blocked} blocked \xB7 ${r.not_run} not yet run`,t.color)):u.push("proven \u2014 no runs recorded yet \xB7 run tests, then re-run"),u.push("");let h=e.ucs.map(n=>de(e,n));h.sort((n,d)=>n.severity-d.severity||D(n.uc.slug,d.uc.slug));let R=h.some(n=>n.rows.length||n.spans.length||n.tails.length||r!==null&&n.toRun>0),g=n=>{let[d,b]=n.split("/").map(Number);return b>0&&d===b};if(!R&&g(s.acs_designed)&&(r===null||g(r.acs_proven))){let n=e.ucs.length,d=`use-case${n===1?"":"s"}`;return u.push(r?`no gaps \u2014 all ${n} ${d} designed and proven`:`no gaps \u2014 all ${n} ${d} designed \xB7 nothing run yet`),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}let o=(n,d)=>n.groups.filter(b=>d.includes(b.key)).reduce((b,w)=>b+w.rows.length,0),i=h.map(n=>({band:n,failing:o(n.uc,["failing"]),blocked:o(n.uc,["blocked"]),stale:o(n.uc,["needs-refresh"]),design:o(n.uc,["needs-tests","needs-scenarios"]),run:n.toRun})),k=[];i.some(n=>n.failing)&&k.push({hdr:"FAILING",get:n=>n.failing}),i.some(n=>n.blocked)&&k.push({hdr:"BLOCKED",get:n=>n.blocked}),i.some(n=>n.stale)&&k.push({hdr:"STALE",get:n=>n.stale}),i.some(n=>n.design)&&k.push({hdr:"TO DESIGN",get:n=>n.design}),i.some(n=>n.run)&&k.push({hdr:"TO RUN",get:n=>n.run}),a<100&&(k.length=0);let _=Math.min(16,Math.max(4,...h.map(n=>I(n.uc.slug).length))),v=15,f=k.map(n=>n.hdr.length+2),p=a-_-2-3-v-3-v-f.reduce((n,d)=>n+d,0)-2,y=n=>n.padStart(Math.floor((v+n.length)/2)).padEnd(v),c=`${" ".repeat(_+2)}${"USE CASE".padEnd(p+3)}${y("DESIGNED")} ${y("PROVEN")}`+k.map((n,d)=>n.hdr.padStart(f[d])).join("");u.push(l(c.trimEnd().slice(0,a)));for(let n of i){let d=n.band.uc,b=`${String(d.des.pct).padStart(3)}% ${N(d.des.pct,10)}`,w=r===null||d.provAbsent?Te("no runs",v,t.color):`${String(d.prov?.pct??0).padStart(3)}% ${N(d.prov?.pct??0,10)}`,S=k.map((T,j)=>String(T.get(n)||"\u2014").padStart(f[j])).join(""),$=`${B(I(d.slug),_).padEnd(_)} ${B(d.title,p).padEnd(p)} ${b} ${w}${S}`;u.push(P($,t.color))}return u.push(""),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}function Te(e,t,s){let r=e.padStart(Math.floor((t+e.length)/2)).padEnd(t);return s?`\x1B[2m${r}\x1B[22m`:r}function P(e,t){return t?e.replace(/(\s*\d+%) (█*)(░*)/g,(s,r,a,l)=>{let x=Number(r.trim().replace("%","")),u=x===100?"\x1B[32m":"\x1B[33m";return`${x===0?"\x1B[31m":u}${r}\x1B[39m ${u}${a}\x1B[39m\x1B[2m${l}\x1B[22m`}):e}function fe(e,t,s,r){let{pa:a}=e,l=Math.max(80,Math.min(r.width,100)),x=p=>r.color?`\x1B[2m${p}\x1B[22m`:p,u=r.now??Date.now(),m=[],h=e.ucs.find(p=>p.slug===t),R=a?.latest_run?`last run ${ue(a.latest_run.started_at,u)}`:"no runs yet";m.push(`${I(t)} \xB7 ${h?.title??""} \u2014 risk ${h?.risk??"\u2014"} \xB7 ${e.aspect} \xB7 ${R}`.slice(0,l)),m.push("");let g=h?de(e,h):null;if(h&&g){m.push(P(`designed ${String(h.des.pct).padStart(3)}% ${N(h.des.pct,10)} ${h.acDesigned}/${h.acTotal} ACs have a verifying test`,r.color));let p=g.tails.length?` \xB7 ${g.tails.join(" \xB7 ")}`:"";a===null||h.provAbsent?m.push(`proven \u2014 no runs yet${p}`):m.push(P(`proven ${String(h.prov?.pct??0).padStart(3)}% ${N(h.prov?.pct??0,10)} ${p.replace(/^ · /,"")}`,r.color)),m.push("")}let o=Math.min(16,Math.max(5,...s.map(p=>I(p.id).length))),i=10,k=5,_=l-o-2-i-2-k-2;m.push(x(`${" ".repeat(o+2)}${"STATE".padEnd(i+2)}${"RISK".padEnd(k+2)}ACCEPTANCE CRITERION`));let v=p=>{if(!r.color)return p;let y=p.trim(),c=y.startsWith("proven")?"\x1B[32m":y==="failing"||y==="needs test"?"\x1B[31m":y==="blocked"||y==="stale"?"\x1B[33m":"\x1B[2m",n=c==="\x1B[2m"?"\x1B[22m":"\x1B[39m";return p.replace(y,`${c}${y}${n}`)};for(let p of s){let c=(p.text+(p.via?` \xB7 via ${p.via}`:"")).split(/\s+/),n=[],d="";for(let b of c)d&&d.length+1+b.length>_?(n.push(d),d=b):d=d?`${d} ${b}`:b;d&&n.push(d),n.forEach((b,w)=>{w===0?m.push(`${B(I(p.id),o).padEnd(o)} ${v(p.state.padEnd(i))} ${p.risk.padEnd(k)} ${b}`):m.push(`${" ".repeat(o+2+i+2+k+2)}${b}`)})}let f=[];if(h&&g){for(let y of g.spans){let c=y.replace(/^↳ /,"");if(c.startsWith("kane-cli evidence serve")){let n=s.filter(d=>d.state==="blocked"||d.state==="failing").map(d=>I(d.id)).join(" \xB7 ");f.push({label:"see why",cmd:c,...n?{note:`(explains ${n})`}:{}})}else f.push({label:"design",cmd:c})}let p=s.filter(y=>y.state==="to run").length;if(p>0){let c=s.some(n=>n.state==="failing")?"(review evidence first \u2014 a re-run may heal over failures)":f.some(n=>n.label==="see why")?`(${p} ACs never executed \u2014 see why first)`:`(${p} ACs never executed)`;f.push({label:"first run",cmd:"kane-cli testrun run",note:c})}}if(f.length){m.push(""),m.push("next");let p=Math.max(...f.map(c=>c.label.length))+2,y=c=>r.color?`\x1B[36m${c}\x1B[39m`:c;for(let c of f){let n=` ${c.label.padEnd(p)}`;if(n.length+c.cmd.length>l){let d=c.cmd.lastIndexOf(" ",l-n.length),b=d>0?c.cmd.slice(0,d):c.cmd.slice(0,l-n.length),w=d>0?c.cmd.slice(d+1):c.cmd.slice(l-n.length);m.push(`${n}${y(b)}`),m.push(`${" ".repeat(n.length)}${y(w)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`))}else c.note&&n.length+c.cmd.length+3+c.note.length<=l?m.push(`${n}${y(c.cmd)} ${x(c.note)}`):(m.push(`${n}${y(c.cmd)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`)))}}return m.push(""),m.push(x("all use-cases: kane-cli cover gaps")),m}function K(e){let{dc:t,pa:s}=e,r=a=>e.top!==void 0?a.slice(0,e.top):a;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(a=>({id:/^sha256:/.test(a.slug)?null:a.slug,title:a.title,risk:a.risk,design_completeness:{pct:a.des.pct,status:a.des.status},stale_acs:a.des.staleAcs,...s?{proven:a.prov??{pct:0,status:"not_run"}}:{},pending:r(a.groups.flatMap(l=>l.rows).filter(l=>W(e.stage,l))).map(ae)})),other:e.other.filter(a=>W(e.stage,a)).map(ae)}}function ae(e){let{servePath:t,viaFiles:s,meta:r,...a}=e;return{...a}}async function Re(e,t,s=oe(),r=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return G(s,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:_,agentRefusal:v}=await import("./headless-io-3A3BZVQ5.js"),{parsesAgainstGrammar:f}=await import("./next-TRSKMBO5.js"),p=_("ndjson","gaps",{stdout:T=>s.out(T.replace(/\n$/,"")),stderr:T=>(s.err??s.out)(T.replace(/\n$/,""))}),y=[],c=[],n={out:T=>y.push(T),err:T=>c.push(T),confirm:async()=>!1,isTTY:!1};if(await Re(e,{...t,json:!0,mode:void 0},n,r)!==0)return v(p,c.join("; ")||"cover gaps refused");let b=JSON.parse(y.join(`
2
+ import{P as G,Q as re,S as oe,o as ne,p as se}from"./chunk-UHSNUUX3.js";import"./chunk-YZVR7ESF.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{a as H,b as q,c as Q,d as X,e as Z,f as ee,g as te}from"./chunk-7O54QURK.js";import{f as V}from"./chunk-5GUD3CIH.js";import{a as O,b as F,c as C,d as z}from"./chunk-YMLC55J4.js";import"./chunk-EHN5HTUD.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as Y}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import{d as E,e as U}from"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-HYTBEPC2.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";function me(e,t){return e.length===0?"not_run":Q(e,t).verified?"proven":q(e,t).some(r=>r.verdict==="failed")?"failing":"blocked"}function ie(e,t){let s=null;for(let{cid:g}of e.byLabel(E.TEST))for(let o of e.execHistory(g))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let r=H[t],a=te(e),l=X(a).aspects[t],x={},u={},m=0,h=0,R=0;for(let g of a.usecases){let o=[];for(let v of g.acceptance_criteria){let f=v.executions??[],p=me(f,r);o.push(p),p==="failing"?m++:p==="blocked"?h++:p==="not_run"&&R++;let y=[],c;if(p==="failing"){let n=null,d=e.resolve(v.id)?.cid;for(let b of v.covered_by){let w=e.execHistory(b).map($=>({verdict:String(ee(e,$.per_ac,d,v.id)??$.verdict),oracle_mode:String($.oracle_mode),ts:String($.started_at),execution_id:String($.execution_id)})).filter($=>r.counted_verdicts.includes($.verdict)&&r.accepted_oracle_modes.includes($.oracle_mode)),S=w[w.length-1];S?.verdict==="failed"&&(y.push(b),(!n||S.ts>n.ts)&&(n={ts:S.ts,execution_id:S.execution_id}))}c=n?.execution_id}else p==="blocked"&&(c=f[f.length-1]?.execution_id);x[v.id]={state:p,viaTests:y,...c?{executionId:c}:{}}}let i=o.some(v=>v!=="not_run"),k=l.usecases[g.id],_=i?k.status==="covered"?"proven":k.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";u[g.id]={pct:k.pct,status:_}}return{aspect:t,pct:l.summary.coverage_pct,acs_proven:l.summary.acs_verified,failing:m,blocked:h,not_run:R,latest_run:s,perUc:u,perAc:x,config:{...r,source:"graph_execution_facts",denominator:"current_live_acs"}}}var he=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],ve={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},M={high:0,med:1,low:2};function D(e,t){let s=/^(.*?)(\d+)$/.exec(e),r=/^(.*?)(\d+)$/.exec(t);return s&&r&&s[1]===r[1]?Number(s[2])-Number(r[2]):e<t?-1:e>t?1:0}function I(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function be(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function ye(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(r?.title??r?.text??"")}function ce(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:be(ye(e,t),8)}}function xe(e,t){let s=e.resolve(t);if(!s)return null;let r=e.tipOf(s.cid);if(!O(e,r))return null;let a=e.nodeLabel.get(r);if(a===E.USECASE)return r;if(a===E.AC)return C(e,r);if(a===E.TEST){let l=e.edgesFrom(r).find(u=>u.type===U.VERIFIES&&O(e,u.dst));if(l)return C(e,l.dst);let x=e.edgesFrom(r).find(u=>u.type===U.AUTOMATES&&O(e,u.dst));if(x){let u=e.edgesFrom(x.dst).find(m=>m.type===U.BELONGS_TO&&O(e,m.dst));return u?u.dst:null}}return null}function L(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function ke(e,t){let s=e.resolve(t),r=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return r==="high"||r==="med"||r==="low"?r:"med"}function le(e,t,s,r,a){let l=a.servePaths??new Map,x=e.byLabel(E.USECASE).filter(({cid:o})=>O(e,o)),u=new Map(x.map(o=>[o.cid,o])),m=new Map(x.map(({cid:o})=>[o,[]])),h=[];for(let o of t){if(o.stage!=="design")continue;let i={...o,...ce(e,o.ref)},k=xe(e,o.ref),_=k?m.get(k):void 0;_&&L(o)!=="other"?_.push(i):h.push(i)}let R=new Map(x.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(E.AC)){if(!O(e,o))continue;let i=C(e,o),k=i?R.get(i):void 0;if(!k)continue;k.total++;let _=F(e,o);if(_&&k.designed++,!r)continue;let v=e.nameOf.get(o)??o,f=r.perAc[v];if(!f)continue;let{id:p,title:y}=ce(e,v),c={ref:e.displayNameOf(o)??o,id:p,title:y,risk:ke(e,v),stage:"cover"},n=m.get(i);f.state==="failing"?n.push({...c,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",via_tests:f.viaTests,...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{},...a.testFiles?{viaFiles:f.viaTests.map(d=>a.testFiles.get(d)??null)}:{}}):f.state==="blocked"?n.push({...c,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:f.executionId&&l.has(f.executionId)?`kane-cli evidence serve ${l.get(f.executionId)}`:"kane-cli testrun run",...f.executionId?{execution_id:f.executionId}:{},...f.executionId&&l.has(f.executionId)?{servePath:l.get(f.executionId)}:{}}):f.state==="not_run"&&_&&n.push({...c,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let g=[];for(let{cid:o,content:i}of x){let k=e.displayNameOf(o)??o,_=e.nameOf.get(o)??o,v=s.perUc[k]??{pct:0,status:"undesigned",staleAcs:0},f=r?r.perUc[_]??{pct:0,status:"not_run"}:null,p=r!==null&&(f===null||f.status==="not_run"),y=R.get(o),c=m.get(o)??[],n=new Set(c.filter(b=>L(b)==="needs-refresh").map(b=>b.ref)),d=[];for(let b of he){let w=c.filter($=>L($)===b);if(b==="needs-tests"&&(w=w.filter($=>!n.has($.ref))),w.length===0)continue;w.sort(($,T)=>(M[$.risk]??3)-(M[T.risk]??3)||D($.ref,T.ref));let S=b==="failing"||b==="blocked"||w.length<=2||new Set(w.map($=>$.ready_command)).size>1;d.push({key:b,label:ve[b],...b==="needs-refresh"?{suffix:"source moved since these were designed"}:{},rows:w,...S?{}:{rosterCommand:w[0].ready_command}})}g.push({slug:k,title:String(i.title??""),risk:String(i.risk??""),des:v,prov:f,provAbsent:p,acTotal:y.total,acDesigned:y.designed,groups:d})}return g.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.slug,i.slug)),h.sort((o,i)=>(M[o.risk]??3)-(M[i.risk]??3)||D(o.ref,i.ref)),{stage:a.stage,aspect:a.aspect,top:a.top,dc:s,pa:r,ucs:g,other:h}}function N(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function W(e,t){return e==="all"||t.stage===e}function B(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}var _e={failing:"failing",blocked:"blocked","needs-refresh":"stale","needs-tests":"needs test","needs-scenarios":"no scenario","happy-only":"happy only","possible-duplicate":"duplicate?","not-yet-run":"to run"},$e=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate"];function ue(e,t){let s=Date.parse(e);if(Number.isNaN(s))return e;let r=Math.max(0,Math.floor((t-s)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function we(e,t){return(t.get("failing")??[]).length?0:(t.get("blocked")??[]).length?1:(t.get("needs-tests")??[]).length||(t.get("needs-scenarios")??[]).length?2:(t.get("needs-refresh")??[]).length?3:(t.get("not-yet-run")??[]).length>0||e.provAbsent?4:5}function de(e,t){let s=new Map;for(let g of t.groups)g.rows.length&&s.set(g.key,g.rows);let r=new Map;for(let g of t.groups){let o=g.rows.filter(i=>W(e.stage,i));o.length&&r.set(g.key,o)}let a=[],l=[],x=[],u=new Set;for(let g of $e){let o=r.get(g);if(o){for(let i of o){let k=g==="failing"&&i.via_tests?.length?` \xB7 via ${i.via_tests.map(_=>I(_)).join(", ")}`:"";a.push({id:i.ref===t.slug?"\u2014":I(i.id??i.ref),cls:_e[g],risk:i.ref===t.slug?"\u2014":i.risk,title:(i.ref===t.slug?i.why:i.title)+k})}if(g==="failing"||g==="blocked")for(let i of o)i.servePath&&u.add(`kane-cli evidence serve ${i.servePath}`);for(let i of o)i.ready_command&&!i.ready_command.startsWith("kane-cli evidence serve")&&i.ready_command!=="kane-cli testrun run"&&u.add(i.ready_command)}}let m=[...u].sort((g,o)=>Number(o.startsWith("kane-cli evidence serve"))-Number(g.startsWith("kane-cli evidence serve")));l.push(...m.map(g=>`\u21B3 ${g}`));let h=s.get("not-yet-run")??[],R=e.pa===null?t.acDesigned:h.length;return e.pa!==null&&R>0&&x.push(`${R} to run`),{uc:t,rows:a,spans:l,tails:x,toRun:R,severity:we(t,s)}}function pe(e,t){let{dc:s,pa:r}=e,a=Math.max(80,Math.min(t.width,100)),l=n=>t.color?`\x1B[2m${n}\x1B[22m`:n,x=t.now??Date.now(),u=[],m=r?.latest_run?`last run ${ue(r.latest_run.started_at,x)}`:"no runs yet";u.push(`coverage \u2014 designed \xD7 proven \xB7 ${e.aspect} \xB7 ${m}`),u.push(""),u.push(P(`designed ${String(s.pct).padStart(3)}% ${N(s.pct,10)} ${s.acs_designed} ACs have a verifying test`,t.color)),r?u.push(P(`proven ${String(r.pct).padStart(3)}% ${N(r.pct,10)} ${r.acs_proven} \xB7 ${r.failing} failing \xB7 ${r.blocked} blocked \xB7 ${r.not_run} not yet run`,t.color)):u.push("proven \u2014 no runs recorded yet \xB7 run tests, then re-run"),u.push("");let h=e.ucs.map(n=>de(e,n));h.sort((n,d)=>n.severity-d.severity||D(n.uc.slug,d.uc.slug));let R=h.some(n=>n.rows.length||n.spans.length||n.tails.length||r!==null&&n.toRun>0),g=n=>{let[d,b]=n.split("/").map(Number);return b>0&&d===b};if(!R&&g(s.acs_designed)&&(r===null||g(r.acs_proven))){let n=e.ucs.length,d=`use-case${n===1?"":"s"}`;return u.push(r?`no gaps \u2014 all ${n} ${d} designed and proven`:`no gaps \u2014 all ${n} ${d} designed \xB7 nothing run yet`),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}let o=(n,d)=>n.groups.filter(b=>d.includes(b.key)).reduce((b,w)=>b+w.rows.length,0),i=h.map(n=>({band:n,failing:o(n.uc,["failing"]),blocked:o(n.uc,["blocked"]),stale:o(n.uc,["needs-refresh"]),design:o(n.uc,["needs-tests","needs-scenarios"]),run:n.toRun})),k=[];i.some(n=>n.failing)&&k.push({hdr:"FAILING",get:n=>n.failing}),i.some(n=>n.blocked)&&k.push({hdr:"BLOCKED",get:n=>n.blocked}),i.some(n=>n.stale)&&k.push({hdr:"STALE",get:n=>n.stale}),i.some(n=>n.design)&&k.push({hdr:"TO DESIGN",get:n=>n.design}),i.some(n=>n.run)&&k.push({hdr:"TO RUN",get:n=>n.run}),a<100&&(k.length=0);let _=Math.min(16,Math.max(4,...h.map(n=>I(n.uc.slug).length))),v=15,f=k.map(n=>n.hdr.length+2),p=a-_-2-3-v-3-v-f.reduce((n,d)=>n+d,0)-2,y=n=>n.padStart(Math.floor((v+n.length)/2)).padEnd(v),c=`${" ".repeat(_+2)}${"USE CASE".padEnd(p+3)}${y("DESIGNED")} ${y("PROVEN")}`+k.map((n,d)=>n.hdr.padStart(f[d])).join("");u.push(l(c.trimEnd().slice(0,a)));for(let n of i){let d=n.band.uc,b=`${String(d.des.pct).padStart(3)}% ${N(d.des.pct,10)}`,w=r===null||d.provAbsent?Te("no runs",v,t.color):`${String(d.prov?.pct??0).padStart(3)}% ${N(d.prov?.pct??0,10)}`,S=k.map((T,j)=>String(T.get(n)||"\u2014").padStart(f[j])).join(""),$=`${B(I(d.slug),_).padEnd(_)} ${B(d.title,p).padEnd(p)} ${b} ${w}${S}`;u.push(P($,t.color))}return u.push(""),u.push(l("inspect a use-case: kane-cli cover gaps <uc-id>")),u}function Te(e,t,s){let r=e.padStart(Math.floor((t+e.length)/2)).padEnd(t);return s?`\x1B[2m${r}\x1B[22m`:r}function P(e,t){return t?e.replace(/(\s*\d+%) (█*)(░*)/g,(s,r,a,l)=>{let x=Number(r.trim().replace("%","")),u=x===100?"\x1B[32m":"\x1B[33m";return`${x===0?"\x1B[31m":u}${r}\x1B[39m ${u}${a}\x1B[39m\x1B[2m${l}\x1B[22m`}):e}function fe(e,t,s,r){let{pa:a}=e,l=Math.max(80,Math.min(r.width,100)),x=p=>r.color?`\x1B[2m${p}\x1B[22m`:p,u=r.now??Date.now(),m=[],h=e.ucs.find(p=>p.slug===t),R=a?.latest_run?`last run ${ue(a.latest_run.started_at,u)}`:"no runs yet";m.push(`${I(t)} \xB7 ${h?.title??""} \u2014 risk ${h?.risk??"\u2014"} \xB7 ${e.aspect} \xB7 ${R}`.slice(0,l)),m.push("");let g=h?de(e,h):null;if(h&&g){m.push(P(`designed ${String(h.des.pct).padStart(3)}% ${N(h.des.pct,10)} ${h.acDesigned}/${h.acTotal} ACs have a verifying test`,r.color));let p=g.tails.length?` \xB7 ${g.tails.join(" \xB7 ")}`:"";a===null||h.provAbsent?m.push(`proven \u2014 no runs yet${p}`):m.push(P(`proven ${String(h.prov?.pct??0).padStart(3)}% ${N(h.prov?.pct??0,10)} ${p.replace(/^ · /,"")}`,r.color)),m.push("")}let o=Math.min(16,Math.max(5,...s.map(p=>I(p.id).length))),i=10,k=5,_=l-o-2-i-2-k-2;m.push(x(`${" ".repeat(o+2)}${"STATE".padEnd(i+2)}${"RISK".padEnd(k+2)}ACCEPTANCE CRITERION`));let v=p=>{if(!r.color)return p;let y=p.trim(),c=y.startsWith("proven")?"\x1B[32m":y==="failing"||y==="needs test"?"\x1B[31m":y==="blocked"||y==="stale"?"\x1B[33m":"\x1B[2m",n=c==="\x1B[2m"?"\x1B[22m":"\x1B[39m";return p.replace(y,`${c}${y}${n}`)};for(let p of s){let c=(p.text+(p.via?` \xB7 via ${p.via}`:"")).split(/\s+/),n=[],d="";for(let b of c)d&&d.length+1+b.length>_?(n.push(d),d=b):d=d?`${d} ${b}`:b;d&&n.push(d),n.forEach((b,w)=>{w===0?m.push(`${B(I(p.id),o).padEnd(o)} ${v(p.state.padEnd(i))} ${p.risk.padEnd(k)} ${b}`):m.push(`${" ".repeat(o+2+i+2+k+2)}${b}`)})}let f=[];if(h&&g){for(let y of g.spans){let c=y.replace(/^↳ /,"");if(c.startsWith("kane-cli evidence serve")){let n=s.filter(d=>d.state==="blocked"||d.state==="failing").map(d=>I(d.id)).join(" \xB7 ");f.push({label:"see why",cmd:c,...n?{note:`(explains ${n})`}:{}})}else f.push({label:"design",cmd:c})}let p=s.filter(y=>y.state==="to run").length;if(p>0){let c=s.some(n=>n.state==="failing")?"(review evidence first \u2014 a re-run may heal over failures)":f.some(n=>n.label==="see why")?`(${p} ACs never executed \u2014 see why first)`:`(${p} ACs never executed)`;f.push({label:"first run",cmd:"kane-cli testrun run",note:c})}}if(f.length){m.push(""),m.push("next");let p=Math.max(...f.map(c=>c.label.length))+2,y=c=>r.color?`\x1B[36m${c}\x1B[39m`:c;for(let c of f){let n=` ${c.label.padEnd(p)}`;if(n.length+c.cmd.length>l){let d=c.cmd.lastIndexOf(" ",l-n.length),b=d>0?c.cmd.slice(0,d):c.cmd.slice(0,l-n.length),w=d>0?c.cmd.slice(d+1):c.cmd.slice(l-n.length);m.push(`${n}${y(b)}`),m.push(`${" ".repeat(n.length)}${y(w)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`))}else c.note&&n.length+c.cmd.length+3+c.note.length<=l?m.push(`${n}${y(c.cmd)} ${x(c.note)}`):(m.push(`${n}${y(c.cmd)}`),c.note&&m.push(x(`${" ".repeat(n.length)}${c.note}`)))}}return m.push(""),m.push(x("all use-cases: kane-cli cover gaps")),m}function K(e){let{dc:t,pa:s}=e,r=a=>e.top!==void 0?a.slice(0,e.top):a;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(a=>({id:/^sha256:/.test(a.slug)?null:a.slug,title:a.title,risk:a.risk,design_completeness:{pct:a.des.pct,status:a.des.status},stale_acs:a.des.staleAcs,...s?{proven:a.prov??{pct:0,status:"not_run"}}:{},pending:r(a.groups.flatMap(l=>l.rows).filter(l=>W(e.stage,l))).map(ae)})),other:e.other.filter(a=>W(e.stage,a)).map(ae)}}function ae(e){let{servePath:t,viaFiles:s,meta:r,...a}=e;return{...a}}async function Re(e,t,s=oe(),r=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return G(s,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:_,agentRefusal:v}=await import("./headless-io-3A3BZVQ5.js"),{parsesAgainstGrammar:f}=await import("./next-TRSKMBO5.js"),p=_("ndjson","gaps",{stdout:T=>s.out(T.replace(/\n$/,"")),stderr:T=>(s.err??s.out)(T.replace(/\n$/,""))}),y=[],c=[],n={out:T=>y.push(T),err:T=>c.push(T),confirm:async()=>!1,isTTY:!1};if(await Re(e,{...t,json:!0,mode:void 0},n,r)!==0)return v(p,c.join("; ")||"cover gaps refused");let b=JSON.parse(y.join(`
3
3
  `));p.event({type:"gaps",...b});let w=[],S=new Set,$=(T,j)=>{if(Array.isArray(T)){for(let A of T)$(A,j);return}if(T&&typeof T=="object"){let A=T,J=typeof A.why=="string"?A.why:j;typeof A.ready_command=="string"&&A.ready_command.startsWith("kane-cli ")&&f(A.ready_command)&&!S.has(A.ready_command)&&(S.add(A.ready_command),w.push({cmd:A.ready_command,why:J||"close the gap"}));for(let ge of Object.values(A))$(ge,J)}};return $(b,"close the gap"),p.done(0,void 0,w.slice(0,4))}let a=t.stage??"all";if(a!=="design"&&a!=="cover"&&a!=="all")return G(s,`--stage must be design | cover | all, got '${a}'`),2;if(t.top!==void 0&&(!Number.isInteger(t.top)||t.top<1))return G(s,"--top must be a positive integer"),2;let l=t.rollup??"lenient";if(l!=="lenient"&&l!=="strict")return G(s,`--rollup must be lenient | strict, got '${l}'`),2;let x=re(r,s);if(!x)return 2;let u=Y(x),m=Z(u),h=ie(u,l),R=await z(u,"design"),g=new Map;if(h)for(let _ of Object.values(h.perAc)){if(!_.executionId||g.has(_.executionId))continue;let v=await V(_.executionId,r);v&&g.set(_.executionId,Se(v,r))}let o=new Map;for(let[_,v]of se(ne(r)))v.length===1&&o.set(_,v[0].split("/").pop());let i=le(u,R,m,h,{stage:a,top:t.top,aspect:l,servePaths:g,testFiles:o});if(e!==void 0){let _=u.resolve(e),v=_?u.tipOf(_.cid):null;if(!v||u.nodeLabel.get(v)!==E.USECASE||!O(u,v))return G(s,`no use-case '${e}' in the graph`),2;let f=u.displayNameOf(v)??v;if(t.json){let c=K(i);return s.out(JSON.stringify({...c,usecases:c.usecases.filter(n=>n.id===f),other:[]},null,2)),0}let p=Ae(u,v,h,o),y=s.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let c of fe(i,f,p,{width:y,color:s.isTTY}))s.out(c);return 0}if(t.json)return s.out(JSON.stringify(K(i),null,2)),0;if(m.usecases_complete==="0/0")return s.out("nothing to measure yet \u2014 no live use-cases in the graph"),0;let k=s.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let _ of pe(i,{width:k,color:s.isTTY}))s.out(_);return 0}function Se(e,t){let s=t.endsWith("/")?t:t+"/";return e.startsWith(s)?e.slice(s.length):e}function Ae(e,t,s,r){let a=[];for(let{cid:l,content:x}of e.byLabel(E.AC)){if(!O(e,l)||C(e,l)!==t)continue;let u=F(e,l),m=e.nameOf.get(l)??l,h=s?.perAc[m],R=e.stale(l)!=="fresh",g=u?h?.state==="proven"?"proven \u2713":h?.state==="failing"?"failing":h?.state==="blocked"?"blocked":R?"stale":"to run":"needs test",o=h?.state==="failing"&&h.viaTests.length?h.viaTests.map(i=>`${I(i)}${r.get(i)?` ${r.get(i)}`:""}`).join(", "):void 0;a.push({id:e.displayNameOf(l)??l,state:g,risk:String(x.risk??""),text:String(x.text??x.title??""),...o?{via:o}:{}})}return a.sort((l,x)=>D(l.id,x.id)),a}export{Re as gapsCommand};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-WR42Q3HU.js";import{d as J}from"./chunk-EMSLJTYN.js";import{b as k}from"./chunk-JKX57HA7.js";import{c as x}from"./chunk-M7DN6FO3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-KOL6ZWOQ.js";import"./chunk-TDPWFYTJ.js";import{a as A}from"./chunk-O5AS2ZIX.js";import"./chunk-4BBDKWM3.js";import{h as H}from"./chunk-SGHP44WS.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-RQLU4NDG.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-WBHSPN55.js";import"./chunk-MSGW4JDG.js";import{n as E,o as q}from"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-N7ZRF5K3.js";import"./chunk-BAKJPQGU.js";import{a as R}from"./chunk-OH2NSBO6.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import{a as j}from"./chunk-IQ7NGOAT.js";import"./chunk-B2ZGG7WM.js";import"./chunk-UR6MHSHU.js";import{join as se}from"path";async function V(t){let e=t.projectId,n=t.folderId,r=null;if(!e&&t.autoResolve){let l=await t.resolver.resolve();if(!l)throw new $("unauthorized; run `kane-cli login`");let u=await H({creds:t.autoResolve.creds,config:t.autoResolve.config,profile:t.autoResolve.profile,env:t.autoResolve.envName,tmsCreds:{username:l.username,access_key:l.access_key},isLocal:!1,log:t.log});u.status==="ok"&&(e=u.projectId,n=n??u.folderId,u.autoDefaulted&&(r={projectId:u.autoDefaulted.projectId,projectName:u.autoDefaulted.projectName,folderId:u.autoDefaulted.folderId,folderName:u.autoDefaulted.folderName}))}return{baseUrl:`${t.env.testGeneratorBaseUrl}/test-generator/api/v2`,tmsBaseUrl:t.env.tmsBaseUrl,authResolver:t.resolver,projectId:e,folderId:n,suiteName:t.suiteName,autoDefaulted:r,log:t.log}}function Z(t){return t.reduce((e,n)=>e+(n.test_cases?.length??0),0)}var y=class{constructor(e=n=>process.stdout.write(n)){this.write=e}emit(e){this.write(JSON.stringify(e)+`
2
+ import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-2WRBCTNM.js";import{d as J}from"./chunk-D6GBOFK5.js";import{b as k}from"./chunk-7X4R6464.js";import{c as x}from"./chunk-JSS22MFY.js";import"./chunk-27ERHOW3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-JL3L6KOG.js";import"./chunk-TDPWFYTJ.js";import{a as A}from"./chunk-MLYNVJNH.js";import"./chunk-SHSXOYKT.js";import{h as H}from"./chunk-NUJVYAI4.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-A557OSRS.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-6GLFQHSW.js";import"./chunk-MSGW4JDG.js";import{n as E,o as q}from"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-74FHTDEE.js";import"./chunk-TEHZUSUY.js";import{a as R}from"./chunk-EPE2ELDH.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import{a as j}from"./chunk-NWNG5UWD.js";import"./chunk-HYTBEPC2.js";import"./chunk-UR6MHSHU.js";import{join as se}from"path";async function V(t){let e=t.projectId,n=t.folderId,r=null;if(!e&&t.autoResolve){let l=await t.resolver.resolve();if(!l)throw new $("unauthorized; run `kane-cli login`");let u=await H({creds:t.autoResolve.creds,config:t.autoResolve.config,profile:t.autoResolve.profile,env:t.autoResolve.envName,tmsCreds:{username:l.username,access_key:l.access_key},isLocal:!1,log:t.log});u.status==="ok"&&(e=u.projectId,n=n??u.folderId,u.autoDefaulted&&(r={projectId:u.autoDefaulted.projectId,projectName:u.autoDefaulted.projectName,folderId:u.autoDefaulted.folderId,folderName:u.autoDefaulted.folderName}))}return{baseUrl:`${t.env.testGeneratorBaseUrl}/test-generator/api/v2`,tmsBaseUrl:t.env.tmsBaseUrl,authResolver:t.resolver,projectId:e,folderId:n,suiteName:t.suiteName,autoDefaulted:r,log:t.log}}function Z(t){return t.reduce((e,n)=>e+(n.test_cases?.length??0),0)}var y=class{constructor(e=n=>process.stdout.write(n)){this.write=e}emit(e){this.write(JSON.stringify(e)+`
3
3
  `)}onStart(e){this.emit({type:"generate_start",request_id:e.requestId,objective_chars:e.objectiveChars,scenario_limit:e.scenarioLimit,per_scenario_limit:e.perScenarioLimit,is_refine:e.isRefine})}onUpload(e){this.emit({type:"generate_upload",file:e.file,index:e.index,total:e.total,status:e.status})}onThinking(e){this.emit({type:"generate_thinking",took_ms:e.tookMs})}onProgress(e){this.emit({type:"generate_progress",pct:e})}onSnapshot(e){this.emit({type:"generate_snapshot",scenario_count:e.scenarios.length,case_count:Z(e.scenarios),scenarios:e.scenarios})}onClarification(e){this.emit({type:"generate_clarification",text:e})}onChat(e){this.emit({type:"generate_chat",text:e})}onError(e){this.emit({type:"error",message:e})}onSaveResult(e){this.emit({type:"generate_save_result",suite_dir:e.suiteDir,saved:e.saved,fell_back:e.fellBack,...e.warning?{warning:e.warning}:{}})}onDone(e){this.emit({type:"generate_done",request_id:e.requestId,status:e.status,scenario_count:e.scenarioCount,case_count:e.caseCount,refine_hint:e.refineHint,save_hint:e.saveHint,...e.suiteDir?{suite_dir:e.suiteDir}:{}})}onUpdateAvailable(e){this.emit({type:"update_available",current:e.current,latest:e.latest,severity:e.severity})}},S=class{constructor(e=n=>process.stdout.write(n)){this.write=e}onStart(e){let n=e.isRefine?"Refining":"Generating";this.write(`${n} (request ${e.requestId})\u2026
4
4
  `)}onUpload(e){e.status==="uploading"&&this.write(` uploading ${e.file} (${e.index}/${e.total})
5
5
  `)}onThinking(e){let n=e.tookMs?` (${Math.round(e.tookMs/1e3)}s)`:"";this.write(` thinking${n}
@@ -16,6 +16,6 @@ import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p a
16
16
  `),this.write(` Save: ${e.saveHint}
17
17
  `),e.suiteDir&&this.write(` Saved: ${e.suiteDir}
18
18
  `)}onUpdateAvailable(e){this.write(`(update available: ${e.current} \u2192 ${e.latest})
19
- `)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-PEEUITK6.js");n(i(d))}try{let i=await(e.checkUpdate??J)();i&&r.onUpdateAvailable(i)}catch{}let g=t.reqId??null;E(X,()=>{g&&l.cancel(g).catch(()=>{})});let p=process.cwd(),v={validate:e.validate??z,upload:e.upload??O,buildMappings:K,onUpload:i=>r.onUpload(i)};try{if(t.op==="save"){let s;try{s=(await l.attach(t.reqId)).state}catch(D){return r.onError(D.message),2}g=s.requestId,r.onSnapshot(s);let m=t.outDir??ie(),o=await e.materialize(s,m,t.suiteName);r.onSaveResult({suiteDir:o.suiteDir,saved:o.paths.length,fellBack:o.fellBack,warning:o.warning});let h=Q(s.requestId);return r.onDone({requestId:s.requestId,status:"completed",scenarioCount:s.scenarios.length,caseCount:W(s),refineHint:h.refineHint,saveHint:h.saveHint,suiteDir:o.suiteDir}),0}let i=t.op==="refine",f,a;if(i){let s;try{s=await l.attach(t.reqId)}catch(o){return r.onError(o.message),2}if(a=s.state,g=a.requestId,a.error)return r.onError(a.error),2;let m;try{m=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:a.scenarios,isRefine:!0,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of m.warnings)process.stderr.write(`warning: ${o}
19
+ `)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-SKEZMSN7.js");n(i(d))}try{let i=await(e.checkUpdate??J)();i&&r.onUpdateAvailable(i)}catch{}let g=t.reqId??null;E(X,()=>{g&&l.cancel(g).catch(()=>{})});let p=process.cwd(),v={validate:e.validate??z,upload:e.upload??O,buildMappings:K,onUpload:i=>r.onUpload(i)};try{if(t.op==="save"){let s;try{s=(await l.attach(t.reqId)).state}catch(D){return r.onError(D.message),2}g=s.requestId,r.onSnapshot(s);let m=t.outDir??ie(),o=await e.materialize(s,m,t.suiteName);r.onSaveResult({suiteDir:o.suiteDir,saved:o.paths.length,fellBack:o.fellBack,warning:o.warning});let h=Q(s.requestId);return r.onDone({requestId:s.requestId,status:"completed",scenarioCount:s.scenarios.length,caseCount:W(s),refineHint:h.refineHint,saveHint:h.saveHint,suiteDir:o.suiteDir}),0}let i=t.op==="refine",f,a;if(i){let s;try{s=await l.attach(t.reqId)}catch(o){return r.onError(o.message),2}if(a=s.state,g=a.requestId,a.error)return r.onError(a.error),2;let m;try{m=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:a.scenarios,isRefine:!0,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of m.warnings)process.stderr.write(`warning: ${o}
20
20
  `);r.onStart({requestId:a.requestId,objectiveChars:m.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!0});try{await l.chat(t.reqId,m.promptText,{mappings:m.mappings,attachments:m.attachments})}catch(o){return r.onError(o.message),2}f=s.events}else{let s;try{s=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:[],isRefine:!1,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of s.warnings)process.stderr.write(`warning: ${o}
21
21
  `);let m;try{m=await l.start({prompt:s.promptText,attachments:s.attachments,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,memoryEnhancement:t.memory})}catch(o){return r.onError(o.message),2}a=m.state,g=a.requestId,r.onStart({requestId:a.requestId,objectiveChars:s.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!1}),f=m.events}let w="";for await(let s of f){switch(a=P(a,s),s.type){case"thinking_done":r.onThinking({tookMs:s.tookMs});break;case"progress":r.onProgress(s.pct);break;case"clarification":r.onClarification(s.text);break;case"chat":r.onChat(s.text);break;case"error":r.onError(s.message);break;case"done":w=s.status;break;default:break}if(s.type==="done"||s.type!=="thinking"&&a.status&&T(a.status))break}r.onSnapshot(a);let b=w||a.status||"completed",c=Q(a.requestId);return r.onDone({requestId:a.requestId,status:b,scenarioCount:a.scenarios.length,caseCount:W(a),refineHint:c.refineHint,saveHint:c.saveHint,suiteDir:void 0}),oe(b)}finally{q(X)}}var ae=()=>{};async function Me(t){let e=new j,n=new A,r=e.getActiveProfile()??"default",l=t.env??e.getDefaultEnv()??"prod",u=R(l),d=new x;t.name&&d.setSessionName(t.name);let g=n.load().model,p=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}}),f=await V({resolver:i.resolver,env:u,log:ae,projectId:t.projectId,folderId:t.folderId,autoResolve:t.projectId?void 0:{creds:e,config:n,profile:r,envName:l}});return{client:G(f),conn:f,autoDefaulted:f.autoDefaulted??null}},v=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}});return i.basicAuth?{username:i.basicAuth.username,access_key:i.basicAuth.access_key}:i.token?{auth:{type:"bearer",token:i.token}}:{}};return{mode:t.mode,makeClient:p,materialize:(i,f,a)=>Y(i,f,{model:g,sessionId:d.sessionId,resolveAuth:v,spawnOpts:{environment:l},suiteName:a})}}export{Me as buildHeadlessDeps,Pe as decideGenerateMode,ie as defaultOutDir,Ge as parseFilesFlag,$e as resolveGenerateOp,Ne as runGenerateHeadless};