@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,8 +1,8 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as H,c as D,d as K,e as Y}from"./chunk-VNFCX2SH.js";import{d as je,h as Oe}from"./chunk-7O54QURK.js";import{b as _,c as B,d as Ae,f as z,g as U}from"./chunk-5GUD3CIH.js";import{c as $e,d as Ne}from"./chunk-WILT62DP.js";import{a as A,b as C,d as Pe}from"./chunk-EHN5HTUD.js";import{h as j,k as Ce,m as De,o as Le}from"./chunk-22QIVSQR.js";import{d as Fe}from"./chunk-IE3OO5GI.js";import{a as Me}from"./chunk-CH273NAE.js";import{b as x,c as v}from"./chunk-VZ7KXRXB.js";import{a as T,c as Se,d as Ee,e as Re,f as V}from"./chunk-P7YZ3PU3.js";import{C as O}from"./chunk-GP7WD4UY.js";import{a as xe,b as Ie}from"./chunk-3BHRGHIZ.js";import{a as ke}from"./chunk-B2ZGG7WM.js";function S(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var I={failed:3,broken:2,passed:1,skipped:0};function q(e){let t="skipped";for(let r of e)I[r]>I[t]&&(t=r);return t}import{createHash as ft}from"crypto";import{basename as gt}from"path";function W(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function G(e){return ft("sha256").update(e).digest("hex").slice(0,8)}function J(e){let t=gt(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${W(t)}-${G(e)}`}function X(e,t){return`${W(e)}-${G(t)}`}function Z(e){let t=e?.trim();return t||void 0}function Te(e=process.env){let t=Z(e.TEST_INSTANCE_ID),r=Z(e.JOB_ID),n=Z(e.TASK_ID);return{...t?{testInstanceId:t}:{},...r?{jobId:r}:{},...n?{taskId:n}:{}}}function Q(e,t=process.env){let r=Te(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(i[o]=s);return i}function _t(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as w}from"fs";import{join as y}from"path";function ee(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return v(t,{lineWidth:-1})}async function te(e,t,r,n=process.cwd(),i){let o=i??_(e.execution_id,n),s=y(o,"tests",t);return await w.mkdir(y(o,"coverage"),{recursive:!0}),await w.writeFile(y(o,"coverage",".keep"),""),await w.mkdir(s,{recursive:!0}),await w.writeFile(y(o,"run.yaml"),ee(e)),r&&await w.writeFile(y(s,r.path),r.content),o}async function ht(e,t=process.cwd()){let r=_(e.execution_id,t);await w.mkdir(y(r,"coverage"),{recursive:!0}),await w.writeFile(y(r,"coverage",".keep"),"");let n=x(ee(e));return n.environment&&delete n.environment.run_kind,await w.writeFile(y(r,"run.yaml"),v(n,{lineWidth:-1})),r}async function vt(e,t=process.cwd()){return C(_(e,t),new Date().toISOString())}async function re(e,t=process.cwd()){await w.rm(_(e,t),{recursive:!0,force:!0})}import{promises as ne}from"fs";import{join as ie}from"path";function F(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return v(t,{lineWidth:-1})}function oe(e){return v({logs:e},{lineWidth:-1})}async function se(e,t,r){await ne.writeFile(ie(e,"tests",t,"result.yaml"),r)}async function ae(e,t,r){let n=ie(e,"tests",t,"logs");await ne.mkdir(n,{recursive:!0}),await ne.writeFile(ie(n,"meta.yaml"),r)}import{promises as M}from"fs";import{join as Ve}from"path";function Be(e){return Ve(e,".internal","meta.json")}async function ze(e){let t;try{t=await M.readFile(Be(e),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function ce(e,t){let r;try{r=await ze(e)??{}}catch(s){console.warn(`evidence: meta.json at ${e} unreadable \u2014 skipping execution-pointer append to preserve identity`,s);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(t),r.executions=n,await M.mkdir(Ve(e,".internal"),{recursive:!0});let i=Be(e),o=`${i}.tmp-${process.pid}-${Date.now()}`;await M.writeFile(o,JSON.stringify(r,null,2)+`
2
+ import{b as H,c as D,d as K,e as Y}from"./chunk-GSDXZS4U.js";import{d as je,h as Oe}from"./chunk-7O54QURK.js";import{b as _,c as B,d as Ae,f as z,g as U}from"./chunk-5GUD3CIH.js";import{c as $e,d as Ne}from"./chunk-VOTIGXQ4.js";import{a as A,b as C,d as Pe}from"./chunk-EHN5HTUD.js";import{h as j,k as Ce,m as De,o as Le}from"./chunk-SWTJMTBY.js";import{d as Fe}from"./chunk-IE3OO5GI.js";import{a as Me}from"./chunk-CH273NAE.js";import{b as x,c as v}from"./chunk-VZ7KXRXB.js";import{a as T,c as Se,d as Ee,e as Re,f as V}from"./chunk-P7YZ3PU3.js";import{C as O}from"./chunk-GP7WD4UY.js";import{a as xe,b as Ie}from"./chunk-6L5RV62W.js";import{a as ke}from"./chunk-HYTBEPC2.js";function S(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var I={failed:3,broken:2,passed:1,skipped:0};function q(e){let t="skipped";for(let r of e)I[r]>I[t]&&(t=r);return t}import{createHash as ft}from"crypto";import{basename as gt}from"path";function W(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function G(e){return ft("sha256").update(e).digest("hex").slice(0,8)}function J(e){let t=gt(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${W(t)}-${G(e)}`}function X(e,t){return`${W(e)}-${G(t)}`}function Z(e){let t=e?.trim();return t||void 0}function Te(e=process.env){let t=Z(e.TEST_INSTANCE_ID),r=Z(e.JOB_ID),n=Z(e.TASK_ID);return{...t?{testInstanceId:t}:{},...r?{jobId:r}:{},...n?{taskId:n}:{}}}function Q(e,t=process.env){let r=Te(t),n={...r.testInstanceId?{hyper_test_instance_id:r.testInstanceId}:{},...r.jobId?{hyper_job_id:r.jobId}:{},...r.taskId?{hyper_task_id:r.taskId}:{},...e},i={};for(let[o,s]of Object.entries(n))typeof s=="string"&&s.length>0&&(i[o]=s);return i}function _t(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as w}from"fs";import{join as y}from"path";function ee(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return v(t,{lineWidth:-1})}async function te(e,t,r,n=process.cwd(),i){let o=i??_(e.execution_id,n),s=y(o,"tests",t);return await w.mkdir(y(o,"coverage"),{recursive:!0}),await w.writeFile(y(o,"coverage",".keep"),""),await w.mkdir(s,{recursive:!0}),await w.writeFile(y(o,"run.yaml"),ee(e)),r&&await w.writeFile(y(s,r.path),r.content),o}async function ht(e,t=process.cwd()){let r=_(e.execution_id,t);await w.mkdir(y(r,"coverage"),{recursive:!0}),await w.writeFile(y(r,"coverage",".keep"),"");let n=x(ee(e));return n.environment&&delete n.environment.run_kind,await w.writeFile(y(r,"run.yaml"),v(n,{lineWidth:-1})),r}async function vt(e,t=process.cwd()){return C(_(e,t),new Date().toISOString())}async function re(e,t=process.cwd()){await w.rm(_(e,t),{recursive:!0,force:!0})}import{promises as ne}from"fs";import{join as ie}from"path";function F(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.attempts&&e.attempts.length?{attempts:e.attempts}:{},...e.flaky!==void 0?{flaky:e.flaky}:{},...e.adaptiveHeal?{adaptive_heal:e.adaptiveHeal}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return v(t,{lineWidth:-1})}function oe(e){return v({logs:e},{lineWidth:-1})}async function se(e,t,r){await ne.writeFile(ie(e,"tests",t,"result.yaml"),r)}async function ae(e,t,r){let n=ie(e,"tests",t,"logs");await ne.mkdir(n,{recursive:!0}),await ne.writeFile(ie(n,"meta.yaml"),r)}import{promises as M}from"fs";import{join as Ve}from"path";function Be(e){return Ve(e,".internal","meta.json")}async function ze(e){let t;try{t=await M.readFile(Be(e),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function ce(e,t){let r;try{r=await ze(e)??{}}catch(s){console.warn(`evidence: meta.json at ${e} unreadable \u2014 skipping execution-pointer append to preserve identity`,s);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(t),r.executions=n,await M.mkdir(Ve(e,".internal"),{recursive:!0});let i=Be(e),o=`${i}.tmp-${process.pid}-${Date.now()}`;await M.writeFile(o,JSON.stringify(r,null,2)+`
3
3
  `),await M.rename(o,i)}async function wt(e){try{let t=await ze(e);return t&&Array.isArray(t.executions)?t.executions:[]}catch{return[]}}async function yt(e,t,r=process.cwd()){let n=await z(e,r);if(!n){let o=`evidence: no pack found for "${e}"`;return t.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:e})):console.error(o),2}let i=await A(n,t.profile??"L1");return t.json?console.log(JSON.stringify({valid:i.valid,status:i.status,diagnostics:i.diagnostics})):console.log(`evidence: ${i.valid?"valid":"INVALID"} (${t.profile??"L1"}, status ${i.status})`),i.valid?0:1}function ue(e){let t=[];for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)t.push(S(i))}return q(t)}function bt(e){let t=null;for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)i!=null&&(t==null||I[S(i)]>I[S(t)]||I[S(i)]===I[S(t)]&&i>t)&&(t=i)}return t}import{promises as kt}from"fs";import{extname as Ue,basename as xt}from"path";var It={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function de(e){let t;try{t=await kt.readdir(e)}catch{return[]}return t.filter(r=>r!=="meta.yaml"&&!r.startsWith(".")).sort().map(r=>({name:xt(r,Ue(r)),file:r,format:It[Ue(r)]??"txt"}))}import{mkdirSync as St,appendFileSync as Et}from"fs";import{join as He}from"path";function le(e,t){return He(e,"tests",t,"logs")}function pe(e,t,r,n={},i){try{i?.(t,r,r,n)}catch{}if(e)try{St(e,{recursive:!0});let o=JSON.stringify({ts:new Date().toISOString(),level:t,event:r,...n})+`
4
4
  `;Et(He(e,"diagnostics.ndjson"),o)}catch{}}import{promises as b}from"fs";import{dirname as Ft,join as E}from"path";import{statSync as Rt}from"fs";import{promises as me}from"fs";import{basename as Pt,join as At}from"path";var Ct=1e6,Dt=2e6;function Lt(){return xe.map(e=>Ie(e))}function Ke(e=Lt()){return e.map(t=>{let r=0;try{r=Rt(t).size}catch{}return{path:t,offset:r}})}var jt=/\x1b\[[0-9;]*[A-Za-z]/g;async function Ot(e,t,r){let n;try{n=await me.open(e,"r");let i=(await n.stat()).size,o=t<=i?t:0,s=i-o;if(s<=0)return null;let a=s>r?i-r:o,u=Buffer.alloc(Math.min(s,r));return await n.read(u,0,u.length,a),u.toString("utf8")}catch{return null}finally{await n?.close().catch(()=>{})}}async function Ye(e,t){let r=t.caps?.stderr??Ct,n=t.caps?.appium??Dt,i=[];t.runnerStderrPath&&i.push({src:t.runnerStderrPath,from:0,cap:r});for(let o of t.appiumMarks??[])i.push({src:o.path,from:o.offset,cap:n});for(let o of i){let s=await Ot(o.src,o.from,o.cap);if(s===null)continue;let a=s.replace(jt,"");if(a!=="")try{await me.mkdir(e,{recursive:!0}),await me.writeFile(At(e,Pt(o.src)),a)}catch{}}}async function Mt(e){try{let t=E(e,"tests"),r=await b.readdir(t).catch(()=>[]);for(let n of r){let i=E(t,n,"steps"),o=await b.readdir(i).catch(()=>[]);for(let s of o){let a=await b.readFile(E(i,s,"failure.yaml"),"utf8").catch(()=>null);if(a!=null)try{let u=x(a);if(u&&typeof u=="object"&&u.triage)return!0}catch{}}}}catch{}return!1}async function qe(e,t,r,n={}){let i=E(e,"tests",t,"logs");if(r)try{await b.mkdir(i,{recursive:!0}),await b.copyFile(r,E(i,"tui.log"))}catch{}await Ye(i,{runnerStderrPath:r?E(Ft(r),"runner-stderr.log"):void 0,appiumMarks:n.appiumMarks});let o=await de(i);if(!o.length&&n.requireRealLog)throw new Error(`evidence test ${t} has no real log to declare`);o.length&&await ae(e,t,oe(o))}async function fe(e){let t=e.cwd??process.cwd(),r=e.packDir??_(e.executionId,t);if(!e.saved&&!e.packDir)return await re(e.executionId,t),{sealed:!1};await qe(r,e.testId,e.tuiLogPath,{requireRealLog:e.requireRealLog,appiumMarks:e.appiumMarks});let n=E(r,"run.yaml"),i=x(await b.readFile(n,"utf8"));i.environment={...i.environment??{},saved:e.saved,run_kind:e.runKind},await b.writeFile(n,v(i,{lineWidth:-1}));let o=await b.open(n,"r+");try{await o.sync()}finally{await o.close()}let s=await Mt(r);await C(r,new Date().toISOString());let a;try{let c=await A(r,"L1");a=c.valid;let p=(c.diagnostics??[]).filter(l=>String(l?.code??"").includes("failure.status_disagrees"));if(p.length>0)if(e.expectStatusDisagrees||s){let l=e.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 ${l}`)}else console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,p);if(!c.valid){console.warn(`evidence: sealed pack ${e.executionId} failed L1 validation`,c.diagnostics);let l=String(c.diagnostics?.[0]?.code??"");pe(le(r,e.testId),"warn","EVIDENCE_INVALID",{execution_id:e.executionId,first_code:l,surface:e.surface??"testmd"},e.log)}}catch(c){console.warn(`evidence: validation error for ${e.executionId}`,c)}let u;if(e.saved&&e.packDir)try{u=await Ae(r,e.executionId,t)}catch(c){console.warn(`evidence: store install failed for ${e.executionId}`,c)}if(e.outputStemDir)try{await ce(e.outputStemDir,{execution_id:e.executionId,run_kind:e.runKind,status:e.verdict,valid:a,at:new Date().toISOString()})}catch(c){console.warn(`evidence: execution-pointer append failed for ${e.executionId} (pack is sealed)`,c)}return{sealed:!0,valid:a,storePath:u}}import{release as Ze}from"os";import{execFileSync as $t}from"child_process";import{promises as We}from"fs";import{join as Ge}from"path";function Je(e){return e.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}async function Xe(e){try{let t=Ge(e,"steps"),r=(await We.readdir(t,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort((n,i)=>(parseInt(n,10)||0)-(parseInt(i,10)||0));for(let n of r)try{let i=await We.readFile(Ge(t,n,"step.json"),"utf8"),s=JSON.parse(i).basis?.window;if(Array.isArray(s)&&s.length===2&&Number.isFinite(Number(s[0]))&&Number.isFinite(Number(s[1]))&&Number(s[0])>0&&Number(s[1])>0)return`${Math.round(Number(s[0]))}x${Math.round(Number(s[1]))}`}catch{}return}catch{return}}var Qe=!1,$;function Nt(){if(!Qe)if(Qe=!0,process.platform==="darwin")try{$=$t("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{$=Ze()||void 0}else $=Ze()||void 0;return $}function ge(e){let t={os:T(process.platform)},r=Nt();if(r&&(t.os_version=r),e.cdpBrowser){let i=/^([A-Za-z]+)\/(\d+)/.exec(e.cdpBrowser);i&&(t.browser=i[1].replace(/^Headless/,""),t.browser_version=i[2])}e.resolution&&(t.resolution=e.resolution);let n=Ee(t,e.runnerEnvironment);if(!n.native_platform)return n;if(e.deviceName&&(n.device=e.deviceName),e.deviceModel){let i=Je(e.deviceModel);i&&(n.device_slug=i)}return e.pixelResolution&&(n.viewport=n.resolution??Tt(e.pixelResolution,n.pixel_ratio)??e.pixelResolution,n.resolution=e.pixelResolution),n}function Tt(e,t){if(!t||!Number.isFinite(t)||t<=0)return;let r=/^(\d+)x(\d+)$/.exec(e);if(r)return`${Math.round(Number(r[1])/t)}x${Math.round(Number(r[2])/t)}`}async function et(e){if(e)try{let t=await fetch(`${e}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!t.ok)return;let r=await t.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function Vt(e){let t;return()=>(t||(t=et(e)),t)}import{promises as h,existsSync as k,readFileSync as Ht}from"fs";import{basename as Kt,join as m}from"path";import{readFileSync as Bt}from"fs";import{dirname as zt,resolve as Ut}from"path";function tt(e,t){let r=Ut(e),n=Bt(r,"utf8");return j(t?Ce(n,De(zt(r),t)):n)}async function rt(e){for(let t of await h.readdir(e,{withFileTypes:!0})){let r=m(e,t.name);if(t.isDirectory()){await rt(r);continue}try{await h.unlink(r)}catch{await h.truncate(r,0)}}await h.rmdir(e).catch(()=>{})}function Yt(e){let t=e.authorBoundary<0||e.authorBoundary>e.totalSteps?e.totalSteps:e.authorBoundary;return{shrink_count:e.shrinkCount,complete_reauthor:t===0&&e.totalSteps>0,author_boundary:t,total_steps:e.totalSteps,reauthored_steps:e.totalSteps-t,credits_consumed:Math.round(e.creditsConsumed*100)/100}}var L=class e{constructor(t){this.opts=t}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_attempts=[];_packDirOverride;_attached=!1;appiumMarks=Ke();get attached(){return this._attached}static async attach(t){let r=Kt(t.packDir).replace(/\.evidence$/,""),n=new e({origin:"testrun",runKind:"author",pid:process.pid,title:t.testId,started:new Date().toISOString(),producerVersion:ke,cwd:t.cwd});n.executionId=r,n.testId=t.testId,n._packDirOverride=t.packDir,n._attached=!0;let i=m(t.packDir,"tests",t.testId);return await h.mkdir(i,{recursive:!0}),t.definition&&(await h.writeFile(m(i,t.definition.path),t.definition.content),n.definitionPath=t.definition.path,n.definitionContent=t.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=B(),this.testId=this.opts.testmdRelPath?J(this.opts.testmdRelPath):X(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let t=this.opts.definition??null;return await te({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{}},this.testId,t,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),t&&(this.definitionPath=t.path,this.definitionContent=t.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?m(this.opts.packRootDir,`${this.executionId}.evidence`):_(this.executionId,this.opts.cwd)}get packTestDir(){return m(this.pack,"tests",this.testId)}async writeDefinition(t,r="test.md"){await h.writeFile(m(this.packTestDir,r),t),this.definitionPath=r,this.definitionContent=t}computeAssuranceId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=m(this.opts.cwd,this.opts.testmdRelPath);if(k(t))return Le(Ht(t,"utf8"))?.id}}catch{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=m(this.opts.cwd,this.opts.testmdRelPath),r=m(this.opts.cwd,".context"),n=k(r)?O(r):void 0;if(k(t))return tt(t,n)}if(this.definitionContent!=null)return j(this.definitionContent)}catch{}}noteSpawn(t){this.accumulatedSteps.push(...t.steps),this.maxOrdinal=Math.max(this.maxOrdinal,t.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}get attempts(){return this._attempts}async archiveAttempt(t,r,n={}){let i=this._attempts.length+1,o=m(this.packTestDir,String(i)),s=n.log,a=(c,d)=>s?.("warn","ARCHIVE_ATTEMPT_FAILED",`Attempt ${i}: ${c} could not be archived into ${i}/; the next attempt will mingle with it`,{attempt:i,dir:c,error:String(d)}),u;try{await h.mkdir(o,{recursive:!0})}catch(c){a(`${i}/`,c)}for(let c of["steps","logs","v16-trajectory"]){let d=m(this.packTestDir,c);if(!k(d))continue;let p=m(o,c);try{await h.rename(d,p);continue}catch(l){s?.("warn","ARCHIVE_ATTEMPT_RENAME_FAILED",`Attempt ${i}: rename of ${c}/ refused; copying it into ${i}/ and emptying the originals in place`,{attempt:i,dir:c,error:String(l),fallback:"copy+truncate"})}try{await h.cp(d,p,{recursive:!0}),await rt(d)}catch(l){a(c,l)}}try{this.definitionPath&&k(m(this.packTestDir,this.definitionPath))&&await h.copyFile(m(this.packTestDir,this.definitionPath),m(o,this.definitionPath));let c=m(o,"steps");if(k(c)){for(let d of await h.readdir(c))if(k(m(c,d,"failure.yaml"))){u=`${i}/steps/${d}/failure.yaml`;break}}}catch(c){a("definition + failure pointer",c)}return this._attempts.push({n:i,status:t,steps:this.accumulatedSteps,...r!==void 0?{failedAt:r}:{},...u?{failure:u}:{}}),this.accumulatedSteps=[],this.maxOrdinal=0,i}async writeResult(t){let r=ue(t.spawns),n=this._attempts.length?[...this._attempts.map(g=>({status:g.status})),{status:r,...t.durationMs!==void 0?{duration_ms:t.durationMs}:{}}]:void 0,i=n?new Set(n.map(g=>g.status)).size>1:void 0,o=this._attempts.length>0,s=t.heal,a=o||s?.forced?{triggered:o,...o?{outcome:r==="passed"?"healed":"exhausted"}:{},...s?Yt(s):{},...o?{attempts:this._attempts.map(g=>({n:g.n,status:g.status,failed_at:g.failedAt??-1,...g.failure?{failure:g.failure}:{}}))}:{}}:void 0,u=this.pack,c=Q(t.externalIdInput),d=V(t.runnerEnv,t.intentEnv),p=this.computeDefinitionId(),l=this.computeAssuranceId();await se(u,this.testId,F({testId:this.testId,status:r,durationMs:t.durationMs,definitionPath:this.definitionPath,definitionId:p,assuranceId:l,externalId:c,environment:d,steps:t.steps,tags:t.tags,attempts:n,flaky:i,adaptiveHeal:a}));for(let g of this._attempts){let R=m(this.packTestDir,String(g.n));k(R)&&await h.writeFile(m(R,"result.yaml"),F({testId:this.testId,status:g.status,definitionPath:this.definitionPath,definitionId:p,assuranceId:l,externalId:c,environment:d,steps:g.steps,tags:t.tags}))}let f=t.externalIdInput;return t.log&&(f.commit_id||f.test_id||f.testcase_id)&&t.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:f.commit_id??null,test_id:f.test_id??null,testcase_id:f.testcase_id??null,project_id:f.project_id??null,session_id:f.session_id??null,session_name:f.session_name??null,hyper_test_instance_id:c.hyper_test_instance_id??null,hyper_job_id:c.hyper_job_id??null,hyper_task_id:c.hyper_task_id??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function qt(e,t,r=U){try{let n=await r(e);if(n.aborted.length>0||n.removed.length>0)try{t?.("info","EVIDENCE_RECOVERY","Startup evidence recovery swept incomplete packs",{aborted:n.aborted,removed:n.removed,origin:"startup"})}catch{}return n}catch(n){return console.warn("evidence: startup recovery failed",n),{aborted:[],removed:[]}}}import{promises as sr}from"fs";import{existsSync as _e,mkdirSync as Qt,readdirSync as er,readFileSync as tr,rmSync as rr,statSync as nr,writeFileSync as ir}from"fs";import{join as P}from"path";import{mkdirSync as Wt,renameSync as Gt,rmSync as Jt,writeFileSync as Xt}from"fs";import{join as nt}from"path";var Zt=5e6;function it(e,t,r){let n=nt(e,"coverage","sources"),i=new Map,o=!1;try{for(let s of r.usecases)for(let a of s.sources){if(i.has(a.id)){a.file=i.get(a.id);continue}if(!a.cid)continue;let u=Fe(t,a.cid);if(u===null||u.byteLength>Zt)continue;o||(Wt(n,{recursive:!0}),o=!0);let c=nt(n,a.id),d=`${c}.tmp-${process.pid}`;Xt(d,u),Gt(d,c);let p=`coverage/sources/${a.id}`;i.set(a.id,p),a.file=p}}catch{for(let s of r.usecases)for(let a of s.sources)delete a.file;if(o)try{Jt(n,{recursive:!0,force:!0})}catch{}}}var or={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"},ot=(e,t)=>{try{if(!_e(t))return{status:"skipped",reason:"no context store at the project root"};let r=P(e,"tests");if(!_e(r))return{status:"skipped",reason:"pack has no tests/"};let n=new Map;for(let a of er(r)){let u=P(r,a,"result.yaml");if(!_e(u)||!nr(P(r,a)).isDirectory())continue;let c=x(tr(u,"utf8"));if(!c?.definition_id&&!c?.assurance_id)continue;let d=$e(c.steps??[]),p={testShortId:String(c.test??a),execution:or[String(c.status)]??"not-run",...d.length?{acs:d}:{}};c.assurance_id&&n.set(`id:${c.assurance_id}`,p),c.definition_id&&n.set(`def:${c.definition_id}`,p)}let i=Oe(O(t),n,{scope:"run"}),o=je(i);it(e,t,i);let s=v({...i,rollup:o},{lineWidth:-1});return Qt(P(e,"coverage"),{recursive:!0}),ir(P(e,"coverage","usecases.yaml"),s),{status:"written"}}catch(r){try{rr(P(e,"coverage","sources"),{recursive:!0,force:!0})}catch{}return{status:"skipped",reason:r instanceof Error?r.message:String(r)}}};async function ar(e){try{let t=new L({origin:"inline",runKind:"author",pid:e.pid,title:e.title,started:new Date().toISOString(),producerVersion:e.producerVersion,surfaces:e.surfaces,objectiveOrName:e.objectiveOrName,sessionId:e.sessionId,cwd:e.cwd,packRootDir:e.packRootDir}),r=await t.start();return{session:t,...r,packDir:t.pack,spawns:[],startedAtMs:Date.now(),cwd:e.cwd}}catch(t){return console.warn("evidence: inline pack creation failed",t),null}}function cr(e,t,r){if(!e)return;e.session.noteSpawn(t),t.resolution&&(e.resolution=t.resolution),e.runnerEnvironment=Se(e.runnerEnvironment,t.runnerEnvironment);let n=(r?.per_flow_metadata??[]).map(i=>({resultCode:i?.result_code!=null?Number(i.result_code):null}));e.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function ur(e){if(e)return{packTestDir:e.packTestDir,ordinalOffset:e.session.nextOrdinalOffset()}}async function dr(e,t){if(!e)return null;if(e.finalized)return e.finalized;let r=(n,i,o)=>t.log?t.log("warn",n,i,o):console.warn(`evidence: ${i}`,o??"");try{if(t.recordedTestPath)try{await e.session.writeDefinition(await sr.readFile(t.recordedTestPath,"utf8"))}catch(s){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(s)})}let n=t.cdpBrowserCapture?await t.cdpBrowserCapture():void 0,i=await e.session.writeResult({steps:e.session.steps,spawns:e.spawns.length?e.spawns:[{resultCode:null}],externalIdInput:{...t.externalIdInput,execution_id:e.executionId},runnerEnv:ge({cdpBrowser:n,resolution:e.resolution,runnerEnvironment:e.runnerEnvironment,deviceName:t.deviceName,deviceModel:t.deviceModel,pixelResolution:await Xe(e.packTestDir)}),intentEnv:Re(t.model,e.runnerEnvironment),durationMs:t.durationMs??Date.now()-e.startedAtMs,log:t.log});try{if(t.recordedTestPath){let s=Ne({cwd:t.cwd??e.cwd??process.cwd(),members:[{path:t.recordedTestPath,verdict:i,executionId:e.executionId,startedAt:new Date(e.startedAtMs).toISOString(),mode:"inline",local:t.local??!1}]});for(let a of s.warnings)r("EXEC_SYNC",a)}}catch(s){r("EXEC_SYNC","exec-sync failed",{error:String(s)})}try{let s=(t.coverageWriter??ot)(e.packDir,Me(t.cwd??e.cwd??process.cwd()));s.status==="skipped"&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${s.reason}`)}catch(s){r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(s)})}let o=await fe({executionId:e.executionId,testId:e.testId,saved:t.saved,runKind:"author",verdict:i,cwd:t.cwd??e.cwd,packDir:e.packDir,tuiLogPath:t.tuiLogPath,log:t.log,surface:"inline",requireRealLog:!!e.runnerEnvironment?.native_platform,appiumMarks:e.session.appiumMarks});return e.finalized=o,t.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:e.executionId,verdict:i,valid:o.valid,pack:e.packDir,store_copy:o.storePath??null}),o}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as lr,openSync as pr,readSync as mr,closeSync as fr}from"fs";import{basename as gr,resolve as _r}from"path";async function hr(e,t,r={}){let n=r.out??(d=>process.stdout.write(d+`
5
5
  `)),i=d=>(n(`error: ${d}`),2);if(t.env!=="prod"&&t.env!=="stage")return i(`invalid --env: ${String(t.env)}`);if(t.port!==void 0&&(!Number.isInteger(t.port)||t.port<1||t.port>65535))return i("invalid --port: expected an integer 1-65535");let o;try{o=D(t.env,t.viewerUrl),new URL(o)}catch{return i(`invalid --viewer-url: ${t.viewerUrl}`)}if(e.length===0)return i("no pack paths given");let s=new Map;for(let d of e){let p=_r(d),l;try{l=lr(p)}catch{return i(`${d}: not found`)}if(l.isDirectory())return i(`${d}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!l.isFile())return i(`${d}: not a regular file`);let f=Buffer.alloc(2),g=pr(p,"r");try{mr(g,f,0,2,0)}finally{fr(g)}if(f.toString("latin1")!=="PK")return i(`${d}: not a sealed evidence pack (zip magic missing)`);let R=gr(p);if(s.has(R))return i(`duplicate pack basename: ${R} (URL names collide \u2014 rename one)`);s.set(R,p)}let a=r.log??((d,p,l)=>process.stderr.write(`warn: ${p} reason=${l.reason} path=${l.path}
6
- `)),u;try{u=await H({packs:s,allowedOrigins:[new URL(o).origin],port:t.port,log:a})}catch(d){return i(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${d.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${u.port}`);for(let d of s.keys()){let p=u.urlFor(d);n(d),n(` pack ${p}`),n(` viewer ${K(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??vr)(),await u.close(),0}function vr(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as N}from"fs";import{tmpdir as kr}from"os";import{join as ct,resolve as ve}from"path";var wr=["error","prefer_first","prefer_latest","discard"],yr=["external_id.commit_id","external_id.test_id","environment.os","environment.os_version","environment.browser","environment.browser_version"];function st(e){let t=e.replace(/-/g,"_");return wr.includes(t)?t:null}function at(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...yr],on_same:e??"nest",on_different:e?"error":"split"}};return v({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:t,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function he(e){try{if(!e.isTTY){e.log(Y(e.packPath));return}let t=D(e.env);await(e.renderPrompt??br)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function br(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-5MB4ZXKM.js");await new Promise(o=>{let s=n(r.default.createElement(i,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function xr(e,t,r=process.cwd(),n={}){let i=n.out??(l=>process.stdout.write(l+`
6
+ `)),u;try{u=await H({packs:s,allowedOrigins:[new URL(o).origin],port:t.port,log:a})}catch(d){return i(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${d.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${u.port}`);for(let d of s.keys()){let p=u.urlFor(d);n(d),n(` pack ${p}`),n(` viewer ${K(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??vr)(),await u.close(),0}function vr(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as N}from"fs";import{tmpdir as kr}from"os";import{join as ct,resolve as ve}from"path";var wr=["error","prefer_first","prefer_latest","discard"],yr=["external_id.commit_id","external_id.test_id","environment.os","environment.os_version","environment.browser","environment.browser_version"];function st(e){let t=e.replace(/-/g,"_");return wr.includes(t)?t:null}function at(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...yr],on_same:e??"nest",on_different:e?"error":"split"}};return v({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:t,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function he(e){try{if(!e.isTTY){e.log(Y(e.packPath));return}let t=D(e.env);await(e.renderPrompt??br)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function br(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-YSNRKKPC.js");await new Promise(o=>{let s=n(r.default.createElement(i,{packPath:e,viewerBase:t,onDone:()=>{s.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function xr(e,t,r=process.cwd(),n={}){let i=n.out??(l=>process.stdout.write(l+`
7
7
  `)),o=n.err??(l=>process.stderr.write(l+`
8
8
  `)),s=l=>(o(`evidence merge: ${l}`),2);if(!t.runId)return s("--run-id is required (merged identity is the caller's fact)");if(t.rules&&t.onCollision)return s("--rules and --on-collision are mutually exclusive");let a;if(t.onCollision!==void 0){let l=st(t.onCollision);if(!l)return s(`invalid --on-collision: ${t.onCollision} (expected error | prefer-first | prefer-latest | discard)`);a=l}let u=[];for(let l of e){let f=await Ir(l,r);if(!f)return s(`no pack found for "${l}"`);u.push(f)}let c=t.out?ve(r,t.out):_(t.runId,r),d=null,p;t.rules?p=ve(r,t.rules):(d=await N.mkdtemp(ct(kr(),"kane-merge-rules-")),p=ct(d,"merge-rules.yaml"),await N.writeFile(p,at(a)));try{let l=await(n.mergeFn??Pe)(u,{runId:t.runId,out:c,rulesPath:p,title:t.title,finalize:t.finalize});return t.json?i(JSON.stringify(l)):Sr(i,l),l.output.finalized&&!t.json&&await(n.offer??he)({packPath:c,env:t.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:o}),0}catch(l){let f=l instanceof Error?l.message:String(l);return l?.code==="ABORT"?(o(`evidence merge: aborted \u2014 ${f}`),1):s(f)}finally{d&&await N.rm(d,{recursive:!0,force:!0}).catch(()=>{})}}async function Ir(e,t){let r=ve(t,e);if(await ut(r))return r;let n=_(e,t);return await ut(n)?n:null}async function ut(e){try{return await N.stat(e),!0}catch{return!1}}function Sr(e,t){let{packs:r,tests:n,output:i}=t;e(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${i.path} (${i.finalized?"sealed":"live"})`);for(let o of r.skipped)e(` skipped ${o.runId}: ${o.rule} \u2014 ${o.reason}`);for(let o of n.collisions){let s;o.action==="nest"?s=`nested into ${o.folder}, latest ${o.winner}`:o.action==="split"?s=`split into ${o.folder}`:s=`winner ${o.winner}`,e(` collision ${o.test}: ${s} (${o.rule})`)}for(let o of n.discarded)e(` discarded ${o}`)}import{copyFileSync as Er,existsSync as we,mkdirSync as Rr}from"fs";import{join as dt}from"path";function Pr(e,t,r){try{let n=dt(e,"auteur","execution.json");if(we(n))return!0;for(let i of t)if(!(!i||!we(i)))return Rr(dt(e,"auteur"),{recursive:!0}),Er(i,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:t.find(i=>i&&we(i))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as Ar}from"fs";import{join as Cr}from"path";var lt="module_block";var Dr=new Set(["generative_block",lt]);function be(e){let t=[],r=!0,n=o=>{if(o===null||typeof o!="object")return;let s=o;if(Array.isArray(s.operations))for(let a of s.operations){let u=a?.operation_id;typeof u=="string"&&u&&t.push(u)}if(Array.isArray(s.children)){Dr.has(s.content_type)||(r=!1);for(let a of s.children)n(a)}if(Array.isArray(s.branches)){r=!1;for(let a of s.branches){let u=a?.children;if(Array.isArray(u))for(let c of u)n(c)}}},i=e?.instructions;if(Array.isArray(i))for(let o of i)n(o);return{ids:t,linear:r}}function Lr(e){return be(e).ids}function ye(e,t){let r=new Set(t.map(a=>a.action_id).filter(Boolean)),n=-1;for(let a of r){let u=e.indexOf(a);u>n&&(n=u)}let i=t.reduce((a,u)=>Math.max(a,u.ordinal),0),o=new Set,s=[];for(let a of e.slice(n+1))r.has(a)||o.has(a)||(o.add(a),s.push({id:a,ordinal:++i,status:"skipped",action_id:a}));return s}function pt(e,t){let r=new Set(t),n=e.filter(o=>o.action_id);if(n.some(o=>r.has(o.action_id))||n.length>t.length)return null;let i=0;return e.map(o=>o.action_id?{...o,action_id:t[i++]}:o)}function jr(e,t){if(e.length>t.length)return!1;for(let r=0;r<e.length;r++)if(t[r]!==e[r].action_id)return!1;return!0}function Or(e,t,r,n=!0){if(t.length===0)return{steps:e,tail:[]};let i=(r&&n?pt(e,t):null)??e,o=i.filter(a=>a.action_id),s=new Set(t);return o.length>0&&o.every(a=>s.has(a.action_id))?{steps:i,tail:ye(t,i)}:o.length>0&&!jr(o,t)?{steps:i,tail:[],unjoined:!0}:{steps:i,tail:ye(t,i)}}function mt(e){try{let t=Ar(Cr(e,"auteur","execution.json"),"utf8");return be(JSON.parse(t))}catch{return{ids:[],linear:!0}}}function Fr(e){return mt(e).ids}export{S as a,q as b,W as c,G as d,J as e,X as f,Te as g,Q as h,_t as i,ee as j,te as k,ht as l,vt as m,re as n,F as o,oe as p,se as q,ae as r,ce as s,wt as t,yt as u,ue as v,bt as w,de as x,le as y,pe as z,qe as A,fe as B,Xe as C,ge as D,et as E,Vt as F,L as G,qt as H,ot as I,ar as J,cr as K,ur as L,dr as M,hr as N,at as O,he as P,xr as Q,Pr as R,lt as S,be as T,Lr as U,ye as V,pt as W,Or as X,mt as Y,Fr as Z};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as j}from"./chunk-RKXHVP2Z.js";import{a as L}from"./chunk-TCAHDVII.js";import{a as O}from"./chunk-5Y2G4NC7.js";import{a as D}from"./chunk-YCCUBQY4.js";import{y as l}from"./chunk-B2ZGG7WM.js";import{a as E}from"./chunk-HCBYKLMW.js";import{a as g,b as s,i as I,k as B}from"./chunk-C44QQJR4.js";import{a as P}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var H=$(P(),1);var w=$(E(),1),K=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function J(e){let t=e.replace(/…$/,"");return t&&t.charAt(0).toLowerCase()+t.slice(1)}function N(e,t){if(e.length<=t)return e;if(t<=1)return"\u2026";let r=Math.ceil((t-1)/2),n=Math.floor((t-1)/2);return`${e.slice(0,r)}\u2026${n>0?e.slice(-n):""}`}function Z({status:e,meta:t,tallies:r,keys:n,child:d,cols:c}){let{stdout:h}=B(),m=c??h?.columns??80,f=e.kind==="working"||e.kind==="child-working",[i,b]=(0,H.useState)(0);O(()=>b(a=>a+1),f?120:null);let k=K[i%K.length],u,p;switch(e.kind){case"working":u=`${k} ${e.step}${e.elapsedS!==void 0?` \xB7 ${e.elapsedS}s`:""}`,p=l.assuranceAccent;break;case"waiting":u=`\u25CF waiting on you${e.pending?` \u2014 ${e.pending} question${e.pending===1?"":"s"}`:""}`,p=l.amber;break;case"idle":u="\u25CF idle",p=l.assuranceAccent;break;case"card":u=`\u25CF card ${e.n} of ${e.m}`,p=l.amber;break;case"child-working":u=`${k} child: ${e.step}`,p=l.assuranceAccent;break;case"child-waiting":u="\u25CF child waiting on you",p=l.amber;break}let A=d?`${t.verb} \u25B8 ${d.verb}`:t.verb,S=d?.sid?t.sid?`${N(t.sid,14)} \u25B8 ${d.sid}`:d.sid:t.sid,C=t.env==="prod"?"":t.env,_=[A,S,C].filter(Boolean),v=" \xB7 ",R=u.length+v.length+_.join(v).length,T=t.subject;if(T){let a=m-R-v.length;T=a>=8?N(T,a):void 0}let M=[A,...T?[T]:[],S,C].filter(Boolean).join(v);return(0,w.jsxs)(g,{flexDirection:"column",children:[(0,w.jsx)(s,{color:l.muted,children:"\u2500".repeat(Math.max(1,m))}),(0,w.jsxs)(s,{children:[(0,w.jsx)(s,{color:p,children:u}),(0,w.jsx)(s,{color:l.dim,children:`${v}${M}`})]}),(0,w.jsx)(s,{color:l.dim,children:r.items.length>0?r.items.join(v):" "}),(0,w.jsx)(s,{color:l.muted,children:n.join(v)})]})}var y=$(P(),1);function ne({onToggleThinking:e,onCtrlC:t,explorer:r,panel:n}){let c=(0,y.useRef)(null),h=(0,y.useRef)(""),m=()=>{c.current&&clearTimeout(c.current),c.current=null,h.current=""};return(0,y.useEffect)(()=>m,[]),I((f,i)=>{if(i.ctrl&&f==="t"){e();return}if(i.ctrl&&f==="c"){t();return}if(!i.ctrl&&f.includes("")){t();return}if(!i.ctrl&&f.includes("")){e();return}if(r&&r.isOpen()){let b=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{m(),r.onBack()},150)};if(c.current){if(i.upArrow||i.downArrow||i.return){m(),i.return?r.onEnter():r.onMove(i.upArrow?-1:1);return}if(h.current+=f,h.current==="["){b();return}let k=h.current;m();let u=/^\[([ABCD])/.exec(k);if(u){(u[1]==="A"||u[1]==="B")&&r.onMove(u[1]==="A"?-1:1);return}r.onBack();return}if(i.upArrow){r.onMove(-1);return}if(i.downArrow){r.onMove(1);return}if(i.return){r.onEnter();return}if(i.escape){h.current="",b();return}return}if(n&&n.isFocused()){let b=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{m(),n.onBack()},150)};if(c.current){if(i.upArrow||i.downArrow||i.return||i.leftArrow||i.rightArrow){m(),i.return?n.onSelect():i.leftArrow?n.onLeft?.():i.rightArrow?n.onRight?.():n.onMove(i.upArrow?-1:1);return}if(h.current+=f,h.current==="["){b();return}let k=h.current;m();let u=/^\[([ABCD])/.exec(k);if(u){u[1]==="A"||u[1]==="B"?n.onMove(u[1]==="A"?-1:1):u[1]==="C"?n.onRight?.():n.onLeft?.();return}n.onBack();return}if(i.upArrow){n.onMove(-1);return}if(i.downArrow){n.onMove(1);return}if(i.leftArrow){n.onLeft?.();return}if(i.rightArrow){n.onRight?.();return}if(i.return){n.onSelect();return}if(i.escape){h.current="",b();return}if(/^[1-9]$/.test(f)){n.onDigit(Number(f));return}if(i.tab){n.onTab?.();return}if(f===" "&&n.isMulti()){n.onSpace();return}if(f&&!i.ctrl&&!i.meta){n.onType(f);return}return}}),null}var o=$(E(),1);function V(e){return e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function F(e){let t=V(e);return e.viewDiff&&t.push({v:"view_diff",label:"view diff",detail:"full old \u2192 new"}),t}function W(e){return e.kind==="ARCHIVE"?null:F(e).length}var q={ADD:{color:l.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:l.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},Q=60;function ce({card:e,position:t,sel:r=0,focused:n=!1,freeText:d=null,editorIntent:c="steer"}){let{stdout:h}=B(),m=h?.columns??80,f=m<Q,i=F(e),b=W(e),k=q[e.kind],u=a=>n&&r===a?(0,o.jsx)(s,{color:l.assuranceAccent,children:"\u276F"}):" ",p=e.impact,A=p&&"stale_refs"in p&&p.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${p.stale_refs.length} item(s) stale`+((p.direct_refs?.length??0)>0?` \u2014 ${p.direct_refs.length} directly touched: ${p.direct_refs.join(", ")}`:""):p&&"design_children"in p?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${p.design_children} design child(ren)`:null,S=e.provenance&&e.provenance!==e.why?e.provenance:e.origin??null,C=[{label:"why",text:e.why},...S?[{label:"from",text:S,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...A?[{label:"impact",text:A}]:[]],_=Math.max(...C.map(a=>a.label.length)),v="? reconcile",R=`item ${t.n} of ${t.of}`,T=(0,o.jsxs)(g,{flexDirection:"column",children:[(0,o.jsx)(g,{paddingLeft:2,children:(0,o.jsxs)(s,{bold:!0,children:[(0,o.jsx)(s,{color:k.color,children:`[${e.kind}]`}),` ${L(e.title)}`]})}),C.map((a,x)=>(0,o.jsx)(g,{paddingLeft:2,children:(0,o.jsxs)(s,{children:[(0,o.jsx)(s,{color:l.dim,children:`${a.label.padEnd(_)} `}),(0,o.jsx)(s,{color:a.dimmer?l.dim:void 0,children:a.text})]})},`f-${x}`)),e.diffSummary?(0,o.jsx)(g,{paddingLeft:2,children:(0,o.jsx)(s,{color:l.dim,children:e.diffSummary})}):(e.diff??[]).map((a,x)=>(0,o.jsx)(g,{paddingLeft:4,children:(0,o.jsx)(s,{color:a.op==="-"?"red":"green",children:`${a.op==="-"?"\u2212":"+"} ${a.field==="criteria"?"criterion":a.field}: ${a.text}`})},`d-${x}`)),(e.citeLines??[]).map((a,x)=>(0,o.jsx)(g,{paddingLeft:2,children:(0,o.jsx)(s,{color:l.dim,children:a})},`c-${x}`)),(0,o.jsx)(s,{children:" "}),i.map((a,x)=>(0,o.jsxs)(s,{children:[u(x),` ${x+1}. ${a.label}`,(0,o.jsx)(s,{color:l.dim,children:` \u2014 ${a.detail}`})]},`o-${x}`)),b!==null||d&&c==="because"?d?(0,o.jsxs)(g,{flexDirection:"column",children:[(0,o.jsxs)(g,{children:[(0,o.jsxs)(s,{children:[(0,o.jsx)(s,{color:l.assuranceAccent,children:"\u276F"})," ",(0,o.jsx)(s,{color:l.dim,children:"\u270E "})]}),(0,o.jsx)(D,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:c==="because"?"why archive it?":"say what to adjust"})]}),(0,o.jsx)(s,{color:l.muted,children:c==="because"?" submits as: archive \xB7 your reason goes on the record":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):b!==null?(0,o.jsxs)(s,{children:[u(b)," ",(0,o.jsx)(s,{color:l.dim,children:e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(f)return(0,o.jsxs)(g,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(s,{bold:!0,color:l.assuranceAccent,children:v}),(0,o.jsx)(s,{color:l.dim,children:R}),T]});let M=Math.max(2,Math.min(m-1,100)-v.length-R.length);return(0,o.jsxs)(g,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,o.jsxs)(s,{children:[(0,o.jsx)(s,{bold:!0,color:l.assuranceAccent,children:v})," ".repeat(M),(0,o.jsx)(s,{color:l.dim,children:R})]}),(0,o.jsx)(s,{children:" "}),T]})}var Y={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4};function ue(e,t){let r=[],n=j(e.turns).entries.length;if(t==="design"){let c;for(let m=e.ledger.length-1;m>=0;m--){let f=e.ledger[m];if(f.kind==="banner"&&f.text.startsWith("designing: ")){c=f.text.slice(11);break}}let h=c?Y[c]:void 0;h&&r.push(`phase ${h}/4`),n>0&&r.push(`${n} item${n===1?"":"s"} this session`)}else n>0&&r.push(`${n} saved as draft${n===1?"":"s"}`);let d=e.pending?e.pending.resolution.filter(c=>!c).length:0;return d>0&&r.push(`${d} question${d===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function fe(e,t){let r=[],n=e.applied+e.committed+e.retired;r.push(`${n} applied`),r.push(`${t} to decide`);let d=[];return e.skipped>0&&d.push(`${e.skipped} skipped`),e.deferred>0&&d.push(`${e.deferred} deferred`),e.failed>0&&d.push(`${e.failed} failed`),{items:[...r,...d]}}function he(e,t){let r=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&r.push("space toggle"),t.batchCount>1&&r.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(n=>n.input===!0))&&r.push("\u270E type your own"),t.canAttach&&r.push("@ attach a file or URL"),t.escBack&&r.push("esc back"),{keys:r}}function ge(e,t){let r=["\u2191\u2193 select","\u23CE confirm"];return e.some(n=>n.free)&&r.push("\u270E type your own"),t.escBack&&r.push("esc back"),{keys:r}}function be(e){let t=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return W(e)!==null&&t.push("type = adjust"),t.push("esc \xB7 nothing to undo"),{keys:t}}export{J as a,Z as b,ne as c,V as d,F as e,W as f,ce as g,ue as h,fe as i,he as j,ge as k,be as l};
2
+ import{d as j}from"./chunk-RKXHVP2Z.js";import{a as L}from"./chunk-TCAHDVII.js";import{a as O}from"./chunk-5Y2G4NC7.js";import{a as D}from"./chunk-YCCUBQY4.js";import{y as l}from"./chunk-HYTBEPC2.js";import{a as E}from"./chunk-HCBYKLMW.js";import{a as g,b as s,i as I,k as B}from"./chunk-C44QQJR4.js";import{a as P}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var H=$(P(),1);var w=$(E(),1),K=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function J(e){let t=e.replace(/…$/,"");return t&&t.charAt(0).toLowerCase()+t.slice(1)}function N(e,t){if(e.length<=t)return e;if(t<=1)return"\u2026";let r=Math.ceil((t-1)/2),n=Math.floor((t-1)/2);return`${e.slice(0,r)}\u2026${n>0?e.slice(-n):""}`}function Z({status:e,meta:t,tallies:r,keys:n,child:d,cols:c}){let{stdout:h}=B(),m=c??h?.columns??80,f=e.kind==="working"||e.kind==="child-working",[i,b]=(0,H.useState)(0);O(()=>b(a=>a+1),f?120:null);let k=K[i%K.length],u,p;switch(e.kind){case"working":u=`${k} ${e.step}${e.elapsedS!==void 0?` \xB7 ${e.elapsedS}s`:""}`,p=l.assuranceAccent;break;case"waiting":u=`\u25CF waiting on you${e.pending?` \u2014 ${e.pending} question${e.pending===1?"":"s"}`:""}`,p=l.amber;break;case"idle":u="\u25CF idle",p=l.assuranceAccent;break;case"card":u=`\u25CF card ${e.n} of ${e.m}`,p=l.amber;break;case"child-working":u=`${k} child: ${e.step}`,p=l.assuranceAccent;break;case"child-waiting":u="\u25CF child waiting on you",p=l.amber;break}let A=d?`${t.verb} \u25B8 ${d.verb}`:t.verb,S=d?.sid?t.sid?`${N(t.sid,14)} \u25B8 ${d.sid}`:d.sid:t.sid,C=t.env==="prod"?"":t.env,_=[A,S,C].filter(Boolean),v=" \xB7 ",R=u.length+v.length+_.join(v).length,T=t.subject;if(T){let a=m-R-v.length;T=a>=8?N(T,a):void 0}let M=[A,...T?[T]:[],S,C].filter(Boolean).join(v);return(0,w.jsxs)(g,{flexDirection:"column",children:[(0,w.jsx)(s,{color:l.muted,children:"\u2500".repeat(Math.max(1,m))}),(0,w.jsxs)(s,{children:[(0,w.jsx)(s,{color:p,children:u}),(0,w.jsx)(s,{color:l.dim,children:`${v}${M}`})]}),(0,w.jsx)(s,{color:l.dim,children:r.items.length>0?r.items.join(v):" "}),(0,w.jsx)(s,{color:l.muted,children:n.join(v)})]})}var y=$(P(),1);function ne({onToggleThinking:e,onCtrlC:t,explorer:r,panel:n}){let c=(0,y.useRef)(null),h=(0,y.useRef)(""),m=()=>{c.current&&clearTimeout(c.current),c.current=null,h.current=""};return(0,y.useEffect)(()=>m,[]),I((f,i)=>{if(i.ctrl&&f==="t"){e();return}if(i.ctrl&&f==="c"){t();return}if(!i.ctrl&&f.includes("")){t();return}if(!i.ctrl&&f.includes("")){e();return}if(r&&r.isOpen()){let b=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{m(),r.onBack()},150)};if(c.current){if(i.upArrow||i.downArrow||i.return){m(),i.return?r.onEnter():r.onMove(i.upArrow?-1:1);return}if(h.current+=f,h.current==="["){b();return}let k=h.current;m();let u=/^\[([ABCD])/.exec(k);if(u){(u[1]==="A"||u[1]==="B")&&r.onMove(u[1]==="A"?-1:1);return}r.onBack();return}if(i.upArrow){r.onMove(-1);return}if(i.downArrow){r.onMove(1);return}if(i.return){r.onEnter();return}if(i.escape){h.current="",b();return}return}if(n&&n.isFocused()){let b=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{m(),n.onBack()},150)};if(c.current){if(i.upArrow||i.downArrow||i.return||i.leftArrow||i.rightArrow){m(),i.return?n.onSelect():i.leftArrow?n.onLeft?.():i.rightArrow?n.onRight?.():n.onMove(i.upArrow?-1:1);return}if(h.current+=f,h.current==="["){b();return}let k=h.current;m();let u=/^\[([ABCD])/.exec(k);if(u){u[1]==="A"||u[1]==="B"?n.onMove(u[1]==="A"?-1:1):u[1]==="C"?n.onRight?.():n.onLeft?.();return}n.onBack();return}if(i.upArrow){n.onMove(-1);return}if(i.downArrow){n.onMove(1);return}if(i.leftArrow){n.onLeft?.();return}if(i.rightArrow){n.onRight?.();return}if(i.return){n.onSelect();return}if(i.escape){h.current="",b();return}if(/^[1-9]$/.test(f)){n.onDigit(Number(f));return}if(i.tab){n.onTab?.();return}if(f===" "&&n.isMulti()){n.onSpace();return}if(f&&!i.ctrl&&!i.meta){n.onType(f);return}return}}),null}var o=$(E(),1);function V(e){return e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function F(e){let t=V(e);return e.viewDiff&&t.push({v:"view_diff",label:"view diff",detail:"full old \u2192 new"}),t}function W(e){return e.kind==="ARCHIVE"?null:F(e).length}var q={ADD:{color:l.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:l.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},Q=60;function ce({card:e,position:t,sel:r=0,focused:n=!1,freeText:d=null,editorIntent:c="steer"}){let{stdout:h}=B(),m=h?.columns??80,f=m<Q,i=F(e),b=W(e),k=q[e.kind],u=a=>n&&r===a?(0,o.jsx)(s,{color:l.assuranceAccent,children:"\u276F"}):" ",p=e.impact,A=p&&"stale_refs"in p&&p.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${p.stale_refs.length} item(s) stale`+((p.direct_refs?.length??0)>0?` \u2014 ${p.direct_refs.length} directly touched: ${p.direct_refs.join(", ")}`:""):p&&"design_children"in p?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${p.design_children} design child(ren)`:null,S=e.provenance&&e.provenance!==e.why?e.provenance:e.origin??null,C=[{label:"why",text:e.why},...S?[{label:"from",text:S,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...A?[{label:"impact",text:A}]:[]],_=Math.max(...C.map(a=>a.label.length)),v="? reconcile",R=`item ${t.n} of ${t.of}`,T=(0,o.jsxs)(g,{flexDirection:"column",children:[(0,o.jsx)(g,{paddingLeft:2,children:(0,o.jsxs)(s,{bold:!0,children:[(0,o.jsx)(s,{color:k.color,children:`[${e.kind}]`}),` ${L(e.title)}`]})}),C.map((a,x)=>(0,o.jsx)(g,{paddingLeft:2,children:(0,o.jsxs)(s,{children:[(0,o.jsx)(s,{color:l.dim,children:`${a.label.padEnd(_)} `}),(0,o.jsx)(s,{color:a.dimmer?l.dim:void 0,children:a.text})]})},`f-${x}`)),e.diffSummary?(0,o.jsx)(g,{paddingLeft:2,children:(0,o.jsx)(s,{color:l.dim,children:e.diffSummary})}):(e.diff??[]).map((a,x)=>(0,o.jsx)(g,{paddingLeft:4,children:(0,o.jsx)(s,{color:a.op==="-"?"red":"green",children:`${a.op==="-"?"\u2212":"+"} ${a.field==="criteria"?"criterion":a.field}: ${a.text}`})},`d-${x}`)),(e.citeLines??[]).map((a,x)=>(0,o.jsx)(g,{paddingLeft:2,children:(0,o.jsx)(s,{color:l.dim,children:a})},`c-${x}`)),(0,o.jsx)(s,{children:" "}),i.map((a,x)=>(0,o.jsxs)(s,{children:[u(x),` ${x+1}. ${a.label}`,(0,o.jsx)(s,{color:l.dim,children:` \u2014 ${a.detail}`})]},`o-${x}`)),b!==null||d&&c==="because"?d?(0,o.jsxs)(g,{flexDirection:"column",children:[(0,o.jsxs)(g,{children:[(0,o.jsxs)(s,{children:[(0,o.jsx)(s,{color:l.assuranceAccent,children:"\u276F"})," ",(0,o.jsx)(s,{color:l.dim,children:"\u270E "})]}),(0,o.jsx)(D,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:c==="because"?"why archive it?":"say what to adjust"})]}),(0,o.jsx)(s,{color:l.muted,children:c==="because"?" submits as: archive \xB7 your reason goes on the record":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):b!==null?(0,o.jsxs)(s,{children:[u(b)," ",(0,o.jsx)(s,{color:l.dim,children:e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(f)return(0,o.jsxs)(g,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(s,{bold:!0,color:l.assuranceAccent,children:v}),(0,o.jsx)(s,{color:l.dim,children:R}),T]});let M=Math.max(2,Math.min(m-1,100)-v.length-R.length);return(0,o.jsxs)(g,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,o.jsxs)(s,{children:[(0,o.jsx)(s,{bold:!0,color:l.assuranceAccent,children:v})," ".repeat(M),(0,o.jsx)(s,{color:l.dim,children:R})]}),(0,o.jsx)(s,{children:" "}),T]})}var Y={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4};function ue(e,t){let r=[],n=j(e.turns).entries.length;if(t==="design"){let c;for(let m=e.ledger.length-1;m>=0;m--){let f=e.ledger[m];if(f.kind==="banner"&&f.text.startsWith("designing: ")){c=f.text.slice(11);break}}let h=c?Y[c]:void 0;h&&r.push(`phase ${h}/4`),n>0&&r.push(`${n} item${n===1?"":"s"} this session`)}else n>0&&r.push(`${n} saved as draft${n===1?"":"s"}`);let d=e.pending?e.pending.resolution.filter(c=>!c).length:0;return d>0&&r.push(`${d} question${d===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function fe(e,t){let r=[],n=e.applied+e.committed+e.retired;r.push(`${n} applied`),r.push(`${t} to decide`);let d=[];return e.skipped>0&&d.push(`${e.skipped} skipped`),e.deferred>0&&d.push(`${e.deferred} deferred`),e.failed>0&&d.push(`${e.failed} failed`),{items:[...r,...d]}}function he(e,t){let r=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&r.push("space toggle"),t.batchCount>1&&r.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(n=>n.input===!0))&&r.push("\u270E type your own"),t.canAttach&&r.push("@ attach a file or URL"),t.escBack&&r.push("esc back"),{keys:r}}function ge(e,t){let r=["\u2191\u2193 select","\u23CE confirm"];return e.some(n=>n.free)&&r.push("\u270E type your own"),t.escBack&&r.push("esc back"),{keys:r}}function be(e){let t=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return W(e)!==null&&t.push("type = adjust"),t.push("esc \xB7 nothing to undo"),{keys:t}}export{J as a,Z as b,ne as c,V as d,F as e,W as f,ce as g,ue as h,fe as i,he as j,ge as k,be as l};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as h}from"./chunk-4BBDKWM3.js";import{a as f}from"./chunk-N7ZRF5K3.js";import{a as m}from"./chunk-OH2NSBO6.js";var o=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function k(c){let{creds:i,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=i.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=i.getActiveCredentials();if(!r)throw new o("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await f({creds:i,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let d=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:d}),new o(`Token refresh failed: ${d}`,"refresh_failed")}}let v=m(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new h(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{o as a,k as b};
2
+ import{a as h}from"./chunk-SHSXOYKT.js";import{a as f}from"./chunk-74FHTDEE.js";import{a as m}from"./chunk-EPE2ELDH.js";var i=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function k(c){let{creds:o,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=o.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=o.getActiveCredentials();if(!r)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await f({creds:o,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let d=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:d}),new i(`Token refresh failed: ${d}`,"refresh_failed")}}let v=m(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new h(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{i as a,k as b};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as ae}from"./chunk-MMBBQ4OZ.js";import{j as R}from"./chunk-WBHSPN55.js";import{c as ie,e as ne,i as re,j as K}from"./chunk-Z7S3IWUX.js";import{d as $,e as oe}from"./chunk-4JOD47QI.js";import{a as se}from"./chunk-RZ4F3BHX.js";import{spawn as ze}from"child_process";import{closeSync as Xe,existsSync as Ge,mkdirSync as We,openSync as Ye,readFileSync as Ze,rmSync as Qe}from"fs";import{homedir as ge}from"os";import{dirname as X,join as S}from"path";import{access as Re,mkdir as de,readFile as Le}from"fs/promises";import{homedir as Ce}from"os";import{arch as Fe,platform as Be}from"process";import{join as M}from"path";var Ue=35,qe="google_apis",Ve="KaneCLI_Pixel_API35",He="KaneAI_Pixel_API35";function Ht(t){return t===He?Ve:t}var je=1;function Ke(t,e){return t==="darwin"&&e==="arm64"?"arm64-v8a":"x86_64"}function Je(){return{home:Ce(),os:Be,arch:Fe}}async function le(t){try{return await Re(t),!0}catch{return!1}}var J=class{deps;constructor(e={}){this.deps={...Je(),...e}}paths(){let e=M(this.deps.home,".testmuai","kaneai","mobile"),r=M(e,"android-sdk");return{root:r,emulatorDir:M(r,"emulator"),systemImageDir:M(r,"system-images",`android-${Ue}`,qe,Ke(this.deps.os,this.deps.arch)),avdHome:M(e,"avd"),manifest:M(r,"sdk-manifest.json")}}environment(){let e=this.paths();return{ANDROID_HOME:e.root,ANDROID_SDK_ROOT:e.root,ANDROID_AVD_HOME:e.avdHome}}async ensureSdkRootMarkers(){let e=this.paths().root;await de(M(e,"platforms"),{recursive:!0}),await de(M(e,"platform-tools"),{recursive:!0})}async status(){let e=this.paths(),r=null;try{r=JSON.parse(await Le(e.manifest,"utf8"))}catch{}if(!r||r.schemaVersion!==je)return{emulator:!1,systemImage:!1};let o=this.deps.os==="win32"?"emulator.exe":"emulator";return{emulator:!!r.components.emulator&&await le(M(e.emulatorDir,o)),systemImage:!!r.components.systemImage&&await le(M(e.systemImageDir,"system.img"))}}},ue;function B(){return ue??=new J,ue}var G="android",et="http://127.0.0.1:4723/status",tt=2e3,z=(()=>{let t=Number(process.env.KANE_CLI_EMULATOR_BOOT_TIMEOUT_MS);return Number.isFinite(t)&&t>=3e4?t:3e5})(),it=1e3,nt=3e5;var rt=5,ce="Run `kane-cli doctor --target emulator --install` to install the managed Appium tree.",st={device:"ready",unauthorized:"unauthorized",offline:"offline"};function ot(t){let e={};for(let r of t){let o=r.indexOf(":");o<=0||(e[r.slice(0,o)]=r.slice(o+1))}return e}function at(t){let e=[];for(let r of t.split(`
2
+ import{a as ae}from"./chunk-MMBBQ4OZ.js";import{j as R}from"./chunk-6GLFQHSW.js";import{c as ie,e as ne,i as re,j as K}from"./chunk-Z7S3IWUX.js";import{d as $,e as oe}from"./chunk-4JOD47QI.js";import{a as se}from"./chunk-RZ4F3BHX.js";import{spawn as ze}from"child_process";import{closeSync as Xe,existsSync as Ge,mkdirSync as We,openSync as Ye,readFileSync as Ze,rmSync as Qe}from"fs";import{homedir as ge}from"os";import{dirname as X,join as S}from"path";import{access as Re,mkdir as de,readFile as Le}from"fs/promises";import{homedir as Ce}from"os";import{arch as Fe,platform as Be}from"process";import{join as M}from"path";var Ue=35,qe="google_apis",Ve="KaneCLI_Pixel_API35",He="KaneAI_Pixel_API35";function Ht(t){return t===He?Ve:t}var je=1;function Ke(t,e){return t==="darwin"&&e==="arm64"?"arm64-v8a":"x86_64"}function Je(){return{home:Ce(),os:Be,arch:Fe}}async function le(t){try{return await Re(t),!0}catch{return!1}}var J=class{deps;constructor(e={}){this.deps={...Je(),...e}}paths(){let e=M(this.deps.home,".testmuai","kaneai","mobile"),r=M(e,"android-sdk");return{root:r,emulatorDir:M(r,"emulator"),systemImageDir:M(r,"system-images",`android-${Ue}`,qe,Ke(this.deps.os,this.deps.arch)),avdHome:M(e,"avd"),manifest:M(r,"sdk-manifest.json")}}environment(){let e=this.paths();return{ANDROID_HOME:e.root,ANDROID_SDK_ROOT:e.root,ANDROID_AVD_HOME:e.avdHome}}async ensureSdkRootMarkers(){let e=this.paths().root;await de(M(e,"platforms"),{recursive:!0}),await de(M(e,"platform-tools"),{recursive:!0})}async status(){let e=this.paths(),r=null;try{r=JSON.parse(await Le(e.manifest,"utf8"))}catch{}if(!r||r.schemaVersion!==je)return{emulator:!1,systemImage:!1};let o=this.deps.os==="win32"?"emulator.exe":"emulator";return{emulator:!!r.components.emulator&&await le(M(e.emulatorDir,o)),systemImage:!!r.components.systemImage&&await le(M(e.systemImageDir,"system.img"))}}},ue;function B(){return ue??=new J,ue}var G="android",et="http://127.0.0.1:4723/status",tt=2e3,z=(()=>{let t=Number(process.env.KANE_CLI_EMULATOR_BOOT_TIMEOUT_MS);return Number.isFinite(t)&&t>=3e4?t:3e5})(),it=1e3,nt=3e5;var rt=5,ce="Run `kane-cli doctor --target emulator --install` to install the managed Appium tree.",st={device:"ready",unauthorized:"unauthorized",offline:"offline"};function ot(t){let e={};for(let r of t){let o=r.indexOf(":");o<=0||(e[r.slice(0,o)]=r.slice(o+1))}return e}function at(t){let e=[];for(let r of t.split(`
3
3
  `)){let o=r.trim();if(!o||o.startsWith("*"))continue;let u=o.toLowerCase();if(u.startsWith("list of devices")||u.startsWith("adb server"))continue;let g=o.split(/\s+/),p=g[0],w=g[1];if(!p||!w)continue;let v=ot(g.slice(2)),x=/^(localhost|127\.0\.0\.1):\d{1,5}$/.test(p),P=/^[A-Za-z0-9._-]+:\d{1,5}$/.test(p),C=/^sdk_/.test(v.product??"")||/^sdk_/.test(v.model??"")||/^emu/.test(v.device??"");if(!p.startsWith("emulator-")&&!x&&!(P&&C))continue;let l=v.model?v.model.replace(/_/g," "):void 0;e.push({platform:G,kind:"emulator",id:p,displayName:l??p,state:st[w]??"offline"})}return e}function me(t){let e=[];for(let r of t.split(`
4
4
  `)){let o=r.trim();o&&/^[A-Za-z0-9._-]+$/.test(o)&&(e.includes(o)||e.push(o))}return e}function dt(t){for(let e of t.split(`
5
5
  `)){let r=e.trim();if(!(!r||r==="OK"))return r}}function lt(t){let e=/^Version\s+(\S+)/m.exec(t);return e?.[1]?e[1].split("-")[0]:/Android Debug Bridge version\s+(\S+)/.exec(t)?.[1]}function ut(t){let e=[];for(let r of t.split(`
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Ve}from"./chunk-O5AS2ZIX.js";import{a as Ye}from"./chunk-4BBDKWM3.js";import{a as We}from"./chunk-YCCUBQY4.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{a as be}from"./chunk-OO5GMBVI.js";import{a as Ge}from"./chunk-BAKJPQGU.js";import{a as He}from"./chunk-OH2NSBO6.js";import{b as Le,y as u}from"./chunk-B2ZGG7WM.js";import{a as re}from"./chunk-HCBYKLMW.js";import{a as h,b as f,h as Fe,i as Se,k as Ne}from"./chunk-C44QQJR4.js";import{a as we}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var je=$(we(),1);import{readFileSync as ct,writeFileSync as ut,mkdirSync as ft}from"fs";import{dirname as dt,join as ze}from"path";var mt=ze(Le,"command-history.json"),Dt=ze(Le,"generate-history.json"),ht=200,De=class{entries;filePath;max;constructor(t=mt,e=ht){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),o=[];for(let s=this.entries.length-1;s>=0;s--)this.entries[s].toLowerCase().includes(e)&&o.push(this.entries[s]);return o}_load(){if(this.filePath===null)return[];try{let t=ct(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){if(this.filePath!==null)try{ft(dt(this.filePath),{recursive:!0}),ut(this.filePath,JSON.stringify(this.entries)+`
2
+ import{a as Ve}from"./chunk-MLYNVJNH.js";import{a as Ye}from"./chunk-SHSXOYKT.js";import{a as We}from"./chunk-YCCUBQY4.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{a as be}from"./chunk-YKYKOV6U.js";import{a as Ge}from"./chunk-TEHZUSUY.js";import{a as He}from"./chunk-EPE2ELDH.js";import{b as Le,y as u}from"./chunk-HYTBEPC2.js";import{a as re}from"./chunk-HCBYKLMW.js";import{a as h,b as f,h as Fe,i as Se,k as Ne}from"./chunk-C44QQJR4.js";import{a as we}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var je=$(we(),1);import{readFileSync as ct,writeFileSync as ut,mkdirSync as ft}from"fs";import{dirname as dt,join as ze}from"path";var mt=ze(Le,"command-history.json"),Dt=ze(Le,"generate-history.json"),ht=200,De=class{entries;filePath;max;constructor(t=mt,e=ht){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),o=[];for(let s=this.entries.length-1;s>=0;s--)this.entries[s].toLowerCase().includes(e)&&o.push(this.entries[s]);return o}_load(){if(this.filePath===null)return[];try{let t=ct(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){if(this.filePath!==null)try{ft(dt(this.filePath),{recursive:!0}),ut(this.filePath,JSON.stringify(this.entries)+`
3
3
  `)}catch{}}};function kt(n){let t=(0,je.useRef)(null);return t.current||(t.current=new De(n)),t.current}var D=$(we(),1);var ke=$(we(),1);var Z=$(re(),1);function Xe({history:n,onSelect:t,onClose:e}){let[o,s]=(0,ke.useState)(""),[l,m]=(0,ke.useState)(0),v=o?n.search(o).slice(0,8):[];return Se((b,d)=>{if(d.escape){e();return}if(d.return){v.length>0&&v[l]?t(v[l]):e();return}if(d.upArrow){m(S=>Math.max(0,S-1));return}if(d.downArrow){m(S=>Math.min(v.length-1,S+1));return}if(d.backspace||d.delete){s(S=>S.slice(0,-1)),m(0);return}b&&!d.ctrl&&!d.meta&&(s(S=>S+b),m(0))}),(0,Z.jsxs)(h,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,Z.jsx)(f,{color:u.muted,bold:!0,children:"reverse search"}),(0,Z.jsxs)(h,{gap:1,children:[(0,Z.jsx)(f,{color:u.dim,children:"search:"}),(0,Z.jsx)(f,{children:o}),(0,Z.jsx)(f,{color:u.orange,children:"\u2588"})]}),v.length>0&&(0,Z.jsx)(f,{children:" "}),v.map((b,d)=>(0,Z.jsx)(h,{marginLeft:2,children:(0,Z.jsxs)(f,{color:d===l?u.orange:u.dim,bold:d===l,children:[d===l?"\u25B8 ":" ",b]})},`${d}-${b}`))]})}var X=$(re(),1);function Je({commands:n,selectedIndex:t}){return n.length===0?null:(0,X.jsx)(h,{flexDirection:"column",marginBottom:0,children:n.map((e,o)=>{let s=o===t;return e.disabled?(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:u.dim,children:["/",e.name]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.disabledReason??e.description]})]},e.name):(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:s?u.orange:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:s?u.orange:void 0,bold:s,children:["/",e.name]}),e.args&&(0,X.jsxs)(f,{color:u.dim,children:[" ",e.args]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.description]})]},e.name)})})}var Ze=$(we(),1);var q=$(re(),1),et={scenario:"Scenarios",case:"Test Cases",file:"Files",artifact:"Artifact candidates",installed:"Installed on device"};function Qe(n){let t={scenario:0,case:0,file:0,artifact:0,installed:0};for(let e of n)t[e.kind]++;return["scenario","case","file","artifact","installed"].filter(e=>t[e]>0).map(e=>`${t[e]} ${et[e]}`).join(" \xB7 ")}var Pe=7;function tt({items:n,selectedIndex:t,accent:e=u.orange}){let o=n.length;if(o===0)return null;let s=Math.floor(Pe/2),l=o<=Pe?0:Math.max(0,Math.min(t-s,o-Pe)),m=Math.min(o,l+Pe),v=l,b=o-m;return(0,q.jsxs)(h,{flexDirection:"column",marginBottom:0,children:[v>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${v} above \u2014 ${Qe(n.slice(0,l))}`})}),n.slice(l,m).map((d,S)=>{let U=l+S,F=d.selectable!==!1,E=U===t&&F,R=S===0||n[U-1].kind!==d.kind;return(0,q.jsxs)(Ze.default.Fragment,{children:[R&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:et[d.kind]})}),(0,q.jsxs)(h,{children:[(0,q.jsx)(f,{color:E?e:u.dim,children:E?"\u276F ":" "}),(0,q.jsxs)(f,{color:E?e:F?void 0:u.dim,bold:E,children:[d.label,d.reason?` \u2014 ${d.reason}`:""]})]})]},`${d.kind}:${d.value}:${U}`)}),b>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${b} more \u2014 ${Qe(n.slice(m))}`})})]})}var Be=$(we(),1);var gt=27,pt=127,xt=11;function bt(n){return n>=64&&n<=126}function Tt(n,t){n===xt&&t({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(n)})}function vt(n,t){n===pt&&t({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function wt(n,t){let e=n.map(s=>String.fromCharCode(s)).join(""),o=/^\[1;([0-9]+)([A-D])$/.exec(e);if(o){let s=parseInt(o[1],10),l=o[2],m={raw:"\x1B"+e};if(s===2)m.shift=!0;else if(s===3)m.meta=!0;else if(s===5)m.ctrl=!0;else return;l==="A"?m.arrowUp=!0:l==="B"?m.arrowDown=!0:l==="C"?m.arrowRight=!0:l==="D"&&(m.arrowLeft=!0),t(m);return}if(e==="[H"||e==="[1~"||e==="[7~"){t({home:!0,raw:"\x1B"+e});return}if(e==="[F"||e==="[4~"||e==="[8~"){t({end:!0,raw:"\x1B"+e});return}if(e==="[3;5~"){t({delete:!0,ctrl:!0,raw:"\x1B"+e});return}if(e==="[3;3~"){t({delete:!0,meta:!0,raw:"\x1B"+e});return}}function St(n,t){n===72?t({home:!0,raw:"\x1BO"+String.fromCharCode(n)}):n===70&&t({end:!0,raw:"\x1BO"+String.fromCharCode(n)})}function Et(){let n="IDLE",t=[];function e(){n="IDLE",t=[]}return{feed(o,s){for(let l of o)n==="IDLE"?l===gt?(n="ESC",t=[]):Tt(l,s):n==="ESC"?l===91?(n="CSI",t=[]):l===79?(n="SS3",t=[]):(vt(l,s),e()):n==="CSI"?(t.push(l),bt(l)&&(wt([91,...t],s),e())):n==="SS3"&&(St(l,s),e())},flushIdle(o){n==="ESC"&&t.length===0&&o({raw:"\x1B"}),e()}}}function nt(n,t={}){let e=(0,Be.useRef)(n);e.current=n;let{stdin:o}=Fe();(0,Be.useEffect)(()=>{if(t.isActive===!1||!o)return;let s=Et(),l=null,m=v=>{l&&(clearTimeout(l),l=null);let b=Buffer.isBuffer(v)?v:Buffer.from(v,"binary");s.feed(b,d=>e.current(d)),l=setTimeout(()=>{s.flushIdle(d=>e.current(d)),l=null},50)};return o.on("data",m),()=>{o.removeListener("data",m),l&&clearTimeout(l)}},[t.isActive,o])}var w=$(re(),1);function yt(n,t){let e=t-1;for(;e>=0&&n[e]!=="@"&&n[e]!==" "&&n[e]!==`
4
4
  `;)e--;return e<0||n[e]!=="@"||e>0&&n[e-1]!==" "&&n[e-1]!==`
5
5
  `?null:{at:e,query:n.slice(e+1,t).join("")}}function rt(n,t,e){for(let o=t+e;o>=0&&o<n.length;o+=e)if(n[o]?.selectable!==!1)return o;return t}function At(n){let t=n.findIndex(e=>e.selectable!==!1);return t===-1?0:t}var Oe=10;function Rt(n){return n.replace(/\x1b?\[200~/g,"").replace(/\x1b?\[201~/g,"").replace(/\r\n/g,`
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as d,g as B,k as ee}from"./chunk-YLQHY4A7.js";import{P as Z}from"./chunk-3N6IAVD5.js";import{b as A}from"./chunk-B2ZGG7WM.js";import{createHash as Ie,randomBytes as F}from"crypto";import{mkdirSync as xe,mkdtempSync as P,rmSync as $,existsSync as ve,renameSync as ke}from"fs";import{tmpdir as j}from"os";import{join as _,dirname as ce}from"path";import{spawn as te}from"child_process";function N(n,e=process.env){let t=n.replace(/https?:\/\/[^\s/@]+:[^\s/@]+@/gi,"https://[redacted]@").replace(/(authorization\s*[:=])[^\r\n]+/gi,"$1 [redacted]"),r=e.KANE_SYNC_GIT_TOKEN;if(r)for(let i of[r,Buffer.from(`x-access-token:${r}`).toString("base64")])t=t.split(i).join("[redacted]");return t}function be(n,e){if(n.GIT_SSH_COMMAND)return re(n.GIT_SSH_COMMAND);if(!n.GIT_SSH)return e?re(e):"ssh -o BatchMode=yes"}function re(n){return/(^|\s)-o\s*BatchMode=yes(\s|$)/.test(n)?n:`${n} -o BatchMode=yes`}var _e=/^(?:ssh:\/\/|[^/\s@:]+@[^/\s:]+:)/i,ie=new Map;function Ae(n,e){let t=[e??"",n.GIT_CONFIG_GLOBAL??"",n.HOME??""].join("\0"),r=ie.get(t);return r===void 0&&(r=se(["config","--get","core.sshCommand"],n,e,12e4).then(i=>i.code===0&&i.stdout.toString().trim()||void 0,()=>{}),ie.set(t,r)),r}var ne=new Set(["fetch","push","clone","ls-remote"]);function Ce(n,e,t){if(t!==void 0)return t;if(!n.some(i=>ne.has(i)))return 12e4;let r=e.KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS;if(r!==void 0){if(!/^\d+$/.test(r)||Number(r)<60||Number(r)>3600)throw new Error("KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS must be 60 to 3600");return Number(r)*1e3}return 9e5}function Ne(n){if(n.some(t=>/^(--force(?:-with-lease|-if-includes)?(?:=|$)|--mirror(?:=|$)|--delete(?:=|$)|-f$)/.test(t)))throw new Error("Git location cannot force, mirror or delete");let e=n.indexOf("push");if(e>=0){let t=n.slice(e+1);if(t.length!==3||t[0]!=="--porcelain"||!/^[0-9a-f]{40,64}:refs\/(heads|kane\/probe)\/[A-Za-z0-9._/-]+$/.test(t[2]))throw new Error("Git location requires an exact commit SHA and explicit ref")}}var H=async(n,e={})=>{Ne(n);let t={...process.env,...e.env};for(let h of["GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_CONFIG_PARAMETERS"])delete t[h];e.env?.GIT_INDEX_FILE&&(t.GIT_INDEX_FILE=e.env.GIT_INDEX_FILE);let r=[["core.autocrlf","false"],["core.eol","lf"],["core.symlinks","false"],["core.hooksPath","/dev/null"],["gc.autoDetach","false"],["gc.pruneExpire","3.days.ago"],["maintenance.auto","false"],["push.followTags","false"],["push.gpgSign","false"],["commit.gpgSign","false"]],i=t.KANE_SYNC_GIT_HTTP_POST_BUFFER;if(i!==void 0){if(!/^\d+$/.test(i)||Number(i)<1048576||Number(i)>536870912)throw new Error("KANE_SYNC_GIT_HTTP_POST_BUFFER must be 1048576 to 536870912 bytes; use it only for a proxy that rejects chunked uploads");r.push(["http.postBuffer",i])}for(let h of Object.keys(t))h.startsWith("GIT_TRACE")&&delete t[h];let s=n.find(h=>h.startsWith("https://"));if(t.KANE_SYNC_GIT_TOKEN&&s){let h=new URL(s);r.push([`http.${h.origin}${h.pathname}.extraheader`,""],[`http.${h.origin}${h.pathname}.extraheader`,`AUTHORIZATION: basic ${Buffer.from(`x-access-token:${t.KANE_SYNC_GIT_TOKEN}`).toString("base64")}`],["credential.helper",""])}for(let h of Object.keys(t))/^GIT_CONFIG_(COUNT|KEY_\d+|VALUE_\d+)$/.test(h)&&delete t[h];let a=!t.GIT_SSH_COMMAND&&!t.GIT_SSH&&n.some(h=>ne.has(h))&&n.some(h=>_e.test(h))?await Ae({...t},e.cwd):void 0;r.forEach(([h,u],g)=>{t[`GIT_CONFIG_KEY_${g}`]=h,t[`GIT_CONFIG_VALUE_${g}`]=u}),t.GIT_CONFIG_COUNT=String(r.length),t.GIT_TERMINAL_PROMPT="0",t.GCM_INTERACTIVE="never",t.GIT_ASKPASS="",t.SSH_ASKPASS="";let c=be(t,a);return c!==void 0&&(t.GIT_SSH_COMMAND=c),t.GIT_NO_REPLACE_OBJECTS="1",se(n,t,e.cwd,Ce(n,t,e.timeout),e.input)};function se(n,e,t,r,i){return new Promise((s,o)=>{let a=te("git",n,{cwd:t,env:e,windowsHide:!0,detached:process.platform!=="win32",stdio:["pipe","pipe","pipe"]}),c=[],h=0,u="",g=!1,w=()=>{if(process.platform==="win32"&&a.pid)te("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).on("error",()=>a.kill("SIGKILL"));else try{a.pid&&process.kill(-a.pid,"SIGKILL")}catch{a.kill("SIGKILL")}},S=setTimeout(()=>{g=!0,w()},r);a.stdout.on("data",l=>{h+=l.length,h>128*1024*1024?w():c.push(l)}),a.stderr.on("data",l=>{u.length<64e3&&(u+=l.toString())}),a.stdin.on("error",()=>{}),a.on("error",l=>{clearTimeout(S),o(new d("SYNC_GIT_REQUIRED",`Git could not start: ${N(l.message,e)}`,"Install Git 2.31 or newer, then run the command again: https://git-scm.com/downloads"))}),a.on("close",l=>{clearTimeout(S),s({code:g||h>128*1024*1024?124:l??1,stdout:Buffer.concat(c),stderr:N(g?"Git operation timed out":u,e)})}),a.stdin.end(i)})}async function oe(n=H){let e=await n(["--version"],{timeout:1e4}),t=/git version (\d+)\.(\d+)/.exec(e.stdout.toString());if(e.code||!t||+t[1]<2||+t[1]==2&&+t[2]<31)throw new d("SYNC_GIT_REQUIRED","This location needs Git 2.31 or newer.","Install or update Git, then run setup again: https://git-scm.com/downloads")}function ae(n){let e=/^([^/@:]+)@([^/:]+):/.exec(n);if(e)return{user:e[1],host:e[2]};try{let t=new URL(n);return{host:t.hostname||"the server",user:t.username||"git",port:t.port||void 0}}catch{return{host:"the server",user:"git"}}}function gt(n){let e=/^[^/@:]+@([^/:]+):/.exec(n);if(e)return e[1].toLowerCase();try{return new URL(n).hostname.toLowerCase()}catch{return""}}function Y(n,e){let{host:t,user:r,port:i}=ae(e),s=N(n).trim().split(`
2
+ import{a as d,g as B,k as ee}from"./chunk-YLQHY4A7.js";import{P as Z}from"./chunk-3N6IAVD5.js";import{b as A}from"./chunk-HYTBEPC2.js";import{createHash as Ie,randomBytes as F}from"crypto";import{mkdirSync as xe,mkdtempSync as P,rmSync as $,existsSync as ve,renameSync as ke}from"fs";import{tmpdir as j}from"os";import{join as _,dirname as ce}from"path";import{spawn as te}from"child_process";function N(n,e=process.env){let t=n.replace(/https?:\/\/[^\s/@]+:[^\s/@]+@/gi,"https://[redacted]@").replace(/(authorization\s*[:=])[^\r\n]+/gi,"$1 [redacted]"),r=e.KANE_SYNC_GIT_TOKEN;if(r)for(let i of[r,Buffer.from(`x-access-token:${r}`).toString("base64")])t=t.split(i).join("[redacted]");return t}function be(n,e){if(n.GIT_SSH_COMMAND)return re(n.GIT_SSH_COMMAND);if(!n.GIT_SSH)return e?re(e):"ssh -o BatchMode=yes"}function re(n){return/(^|\s)-o\s*BatchMode=yes(\s|$)/.test(n)?n:`${n} -o BatchMode=yes`}var _e=/^(?:ssh:\/\/|[^/\s@:]+@[^/\s:]+:)/i,ie=new Map;function Ae(n,e){let t=[e??"",n.GIT_CONFIG_GLOBAL??"",n.HOME??""].join("\0"),r=ie.get(t);return r===void 0&&(r=se(["config","--get","core.sshCommand"],n,e,12e4).then(i=>i.code===0&&i.stdout.toString().trim()||void 0,()=>{}),ie.set(t,r)),r}var ne=new Set(["fetch","push","clone","ls-remote"]);function Ce(n,e,t){if(t!==void 0)return t;if(!n.some(i=>ne.has(i)))return 12e4;let r=e.KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS;if(r!==void 0){if(!/^\d+$/.test(r)||Number(r)<60||Number(r)>3600)throw new Error("KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS must be 60 to 3600");return Number(r)*1e3}return 9e5}function Ne(n){if(n.some(t=>/^(--force(?:-with-lease|-if-includes)?(?:=|$)|--mirror(?:=|$)|--delete(?:=|$)|-f$)/.test(t)))throw new Error("Git location cannot force, mirror or delete");let e=n.indexOf("push");if(e>=0){let t=n.slice(e+1);if(t.length!==3||t[0]!=="--porcelain"||!/^[0-9a-f]{40,64}:refs\/(heads|kane\/probe)\/[A-Za-z0-9._/-]+$/.test(t[2]))throw new Error("Git location requires an exact commit SHA and explicit ref")}}var H=async(n,e={})=>{Ne(n);let t={...process.env,...e.env};for(let h of["GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_CONFIG_PARAMETERS"])delete t[h];e.env?.GIT_INDEX_FILE&&(t.GIT_INDEX_FILE=e.env.GIT_INDEX_FILE);let r=[["core.autocrlf","false"],["core.eol","lf"],["core.symlinks","false"],["core.hooksPath","/dev/null"],["gc.autoDetach","false"],["gc.pruneExpire","3.days.ago"],["maintenance.auto","false"],["push.followTags","false"],["push.gpgSign","false"],["commit.gpgSign","false"]],i=t.KANE_SYNC_GIT_HTTP_POST_BUFFER;if(i!==void 0){if(!/^\d+$/.test(i)||Number(i)<1048576||Number(i)>536870912)throw new Error("KANE_SYNC_GIT_HTTP_POST_BUFFER must be 1048576 to 536870912 bytes; use it only for a proxy that rejects chunked uploads");r.push(["http.postBuffer",i])}for(let h of Object.keys(t))h.startsWith("GIT_TRACE")&&delete t[h];let s=n.find(h=>h.startsWith("https://"));if(t.KANE_SYNC_GIT_TOKEN&&s){let h=new URL(s);r.push([`http.${h.origin}${h.pathname}.extraheader`,""],[`http.${h.origin}${h.pathname}.extraheader`,`AUTHORIZATION: basic ${Buffer.from(`x-access-token:${t.KANE_SYNC_GIT_TOKEN}`).toString("base64")}`],["credential.helper",""])}for(let h of Object.keys(t))/^GIT_CONFIG_(COUNT|KEY_\d+|VALUE_\d+)$/.test(h)&&delete t[h];let a=!t.GIT_SSH_COMMAND&&!t.GIT_SSH&&n.some(h=>ne.has(h))&&n.some(h=>_e.test(h))?await Ae({...t},e.cwd):void 0;r.forEach(([h,u],g)=>{t[`GIT_CONFIG_KEY_${g}`]=h,t[`GIT_CONFIG_VALUE_${g}`]=u}),t.GIT_CONFIG_COUNT=String(r.length),t.GIT_TERMINAL_PROMPT="0",t.GCM_INTERACTIVE="never",t.GIT_ASKPASS="",t.SSH_ASKPASS="";let c=be(t,a);return c!==void 0&&(t.GIT_SSH_COMMAND=c),t.GIT_NO_REPLACE_OBJECTS="1",se(n,t,e.cwd,Ce(n,t,e.timeout),e.input)};function se(n,e,t,r,i){return new Promise((s,o)=>{let a=te("git",n,{cwd:t,env:e,windowsHide:!0,detached:process.platform!=="win32",stdio:["pipe","pipe","pipe"]}),c=[],h=0,u="",g=!1,w=()=>{if(process.platform==="win32"&&a.pid)te("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).on("error",()=>a.kill("SIGKILL"));else try{a.pid&&process.kill(-a.pid,"SIGKILL")}catch{a.kill("SIGKILL")}},S=setTimeout(()=>{g=!0,w()},r);a.stdout.on("data",l=>{h+=l.length,h>128*1024*1024?w():c.push(l)}),a.stderr.on("data",l=>{u.length<64e3&&(u+=l.toString())}),a.stdin.on("error",()=>{}),a.on("error",l=>{clearTimeout(S),o(new d("SYNC_GIT_REQUIRED",`Git could not start: ${N(l.message,e)}`,"Install Git 2.31 or newer, then run the command again: https://git-scm.com/downloads"))}),a.on("close",l=>{clearTimeout(S),s({code:g||h>128*1024*1024?124:l??1,stdout:Buffer.concat(c),stderr:N(g?"Git operation timed out":u,e)})}),a.stdin.end(i)})}async function oe(n=H){let e=await n(["--version"],{timeout:1e4}),t=/git version (\d+)\.(\d+)/.exec(e.stdout.toString());if(e.code||!t||+t[1]<2||+t[1]==2&&+t[2]<31)throw new d("SYNC_GIT_REQUIRED","This location needs Git 2.31 or newer.","Install or update Git, then run setup again: https://git-scm.com/downloads")}function ae(n){let e=/^([^/@:]+)@([^/:]+):/.exec(n);if(e)return{user:e[1],host:e[2]};try{let t=new URL(n);return{host:t.hostname||"the server",user:t.username||"git",port:t.port||void 0}}catch{return{host:"the server",user:"git"}}}function gt(n){let e=/^[^/@:]+@([^/:]+):/.exec(n);if(e)return e[1].toLowerCase();try{return new URL(n).hostname.toLowerCase()}catch{return""}}function Y(n,e){let{host:t,user:r,port:i}=ae(e),s=N(n).trim().split(`
3
3
  `).slice(-2).join(" ").trim();return/Host key verification failed|REMOTE HOST IDENTIFICATION HAS CHANGED/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`this computer has not accepted ${t}'s SSH host key yet`,remedy:`in a terminal run: ssh -T ${i?`-p ${i} `:""}${r}@${t} and answer yes, then run the command again`,diagnostic:s}:/Permission denied \(publickey/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`${t} did not accept your SSH key`,remedy:"load it with ssh-add, or ask the repository owner to grant your account access",diagnostic:s}:/could not read Username|Authentication failed|Access denied|Invalid username or (password|token)|returned error: 401|returned error: 403/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`sign in is needed, or your account has no access to this repository on ${t}`,remedy:"sign in through Git, or ask the owner to grant your account access",diagnostic:s}:/Could not resolve host|Connection refused|Connection timed out|timed out|Network is unreachable|Failed to connect/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:`${t} could not be reached`,remedy:"check the address and your network, then run the command again",diagnostic:s}:/not found|does not appear to be a git repository|Repository not found/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:"no repository answered at that address, or your account cannot see it; a private repository looks missing until access is granted",remedy:"check the address, then run the command again",diagnostic:s}:{code:"SYNC_LOCATION_UNREACHABLE",message:`git could not read the repository on ${t}`,remedy:"check the address and your access, then run the command again",...s?{diagnostic:s}:{}}}function M(n,e){return(n.startsWith(e)?n:n.charAt(0).toUpperCase()+n.slice(1))+"."}function yt(n,e){let t=Y(n,e),{host:r}=ae(e),i=t.remedy.replace(/,? ?(and )?then run the command again$/,"");return i?`${M(t.message,r)} ${M(i,r)}`:M(t.message,r)}var Oe=Buffer.from(`* -text -filter -ident -working-tree-encoding
4
4
  `),Re="refs/kane/tip",Pe=/unexpected disconnect|hung up unexpectedly|Connection reset|Connection timed out|timed out|Could not resolve host|Failed to connect|RPC failed|Broken pipe|early EOF/i,$e={GIT_AUTHOR_NAME:"kane-cli context",GIT_AUTHOR_EMAIL:"context@kane-cli.invalid",GIT_COMMITTER_NAME:"kane-cli context",GIT_COMMITTER_EMAIL:"context@kane-cli.invalid"},G=class n{constructor(e){this.options=e;this.exec=e.exec??H,this.prefix=e.prefix?`${e.prefix}/`:"";let t=Ie("sha256").update(JSON.stringify([e.url,e.branch,this.prefix])).digest("hex");if(this.repo=_(e.cacheDir??_(A,"context-sync","mirrors"),`${t}.git`),this.ref=e.ref??`refs/heads/${e.branch}`,!/^refs\/(heads|kane\/probe)\/[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(this.ref)||this.ref.includes(".."))throw new Error("Invalid Git location ref")}kind="git";contractVersion=1;ceilingTier=1;exec;repo;ref;prefix;ready;tip=null;tree=new Map;async run(e,t={}){let r=await this.exec(["--git-dir",this.repo,...e],t);if(r.code)throw new Error(`Git ${e[0]} failed: ${r.stderr||"unable to read the location"}`);return r.stdout}async transfer(e){let t=await this.exec(["--git-dir",this.repo,...e]);if(t.code){let r=Y(t.stderr||"",this.options.url);throw new d(r.code,r.message,r.remedy,r.diagnostic)}return t.stdout}get name(){return this.options.name??"<name>"}takenRemedy(e){return e===1?`${this.name} holds a different history: to work on it, clone it with kane-cli context clone <descriptor of ${this.name}> <dir>; to share this store, add an empty location`:`kane-cli context pull ${this.name} --rebase`}init(){return this.ready??=(async()=>{if(await oe(this.exec),xe(ce(this.repo),{recursive:!0}),!ve(this.repo)){let e=P(_(ce(this.repo),".init-"));try{let t=await this.exec(["init","--bare",e]);if(t.code)throw new Error(`Cannot open Git cache: ${t.stderr}`);try{ke(e,this.repo)}catch(r){if(!["EEXIST","ENOTEMPTY"].includes(r.code??""))throw r}}finally{$(e,{recursive:!0,force:!0})}}if((await this.run(["rev-parse","--is-bare-repository"])).toString().trim()!=="true")throw new Error("The Git cache must be a bare repository");await this.refresh()})()}async refresh(){let t=(await this.transfer(["ls-remote",this.options.url,this.ref])).toString().trim();if(!t){this.tip=null,this.tree=new Map;return}let r=t.split(/\s+/)[0];if(!/^[0-9a-f]{40,64}$/.test(r))throw new Error("Git returned an invalid ref");if(r===this.tip)return;let i=`refs/kane/snapshots/${F(16).toString("hex")}`;await this.transfer(["fetch","--no-tags","--no-write-fetch-head",this.options.url,`${this.ref}:${i}`]);let s=(await this.run(["rev-parse",i])).toString().trim();await this.run(["update-ref",Re,s]),await this.run(["update-ref","-d",i]);let o=await this.readTree(s);this.tip=s,this.tree=o}contextKeys(e){let t=new Map;for(let[r,i]of e)r.startsWith(`${this.prefix}kane-context/`)&&t.set(r,i);return t}async readTree(e){let t=await this.run(["ls-tree","-rz","--full-tree",e]),r=new Map;for(let i of t.toString().split("\0").filter(Boolean)){let s=/^(\d+) (\w+) ([0-9a-f]+)\t([\s\S]+)$/.exec(i);if(!s)throw new Error("Git returned an invalid tree entry");if(s[4].startsWith(`${this.prefix}kane-context/`)&&(s[1]!=="100644"||s[2]!=="blob"))throw new d("SYNC_OBJECT_CORRUPT","Context storage contains a link or non-file object.","Ask the repository owner to restore the original context files.");r.set(s[4],s[3])}return r}key(e){if(!/^[a-zA-Z0-9_~./-]+$/.test(e)||e.split("/").some(t=>!t||t==="."||t===".."||t.toLowerCase()===".git"))throw new Error("Invalid context storage key");return this.prefix+e}async head(e){return await this.init(),this.tree.has(this.key(e))}async get(e){await this.init();let t=this.tree.get(this.key(e));return t?this.run(["cat-file","blob",t]):null}async list(e){return await this.init(),e&&e.replace(/\/$/,"")&&this.key(e.replace(/\/$/,"")),[...this.tree.keys()].filter(t=>t.startsWith(this.prefix+e)).map(t=>t.slice(this.prefix.length)).sort()}async beginTransaction(){await this.init();let e=new Map(this.tree),t=this.tip,r=new Map,i=!1,s=()=>{if(i)throw new Error("Git transaction is closed")},o=async a=>{s();let c=this.key(a),h=r.get(c),u=e.get(c);return h?Buffer.from(h):u?this.run(["cat-file","blob",u]):null};return{get:o,head:async a=>await o(a)!==null,stageIfAbsent:async(a,c)=>{s();let h=this.key(a);if(e.has(h)||r.has(h))return"exists";if(c.length>1e8)throw new d("SYNC_LOCATION_REFUSED_WRITE","A context object is too large for this Git location.","Use an S3 location for this context.");return r.set(h,Buffer.from(c)),"staged"},abort:async()=>{i=!0,r.clear()},commit:async()=>{s();try{if(!r.size)return{created:[]};let a=this.prefix+"kane-context/.gitattributes";e.has(a)||r.set(a,Oe);let c=new Map;for(let[l,m]of r)c.set(l,(await this.run(["hash-object","-w","--no-filters","--stdin"],{input:m})).toString().trim());let h=this.contextKeys(e),u=()=>{this.assertUnchanged(h);for(let[l,m]of this.contextKeys(this.tree))h.set(l,m)},g=!1,w="",S=0;for(let l=0;l<4;l++){u();for(let f of this.tree.keys())if(!(!f.startsWith(this.prefix)||e.has(f)||c.has(f))&&B(f.slice(this.prefix.length))!==null)throw new d("SYNC_BEHIND","the location gained records after this batch was prepared; nothing was published","run kane-cli context pull, then push again");let m=new Map;for(let[f,T]of c){let C=this.tree.get(f);if(C&&C!==T){let R=B(f.slice(this.prefix.length));throw R?new d("SYNC_POSITION_TAKEN",g?`position ${R} on ${this.name} now holds different work; an earlier publication could not be confirmed`:`position ${R} on ${this.name} was published by another writer; this batch was not published`,this.takenRemedy(R)):new d("SYNC_OBJECT_CORRUPT",`existing context object ${f} differs from the intended bytes`,"the object needs a person to look; nothing was published")}C||m.set(f,T)}if(!m.size)return await this.verifyPublication(c),{created:[]};t=this.tip;let I=await this.build(t,m);await this.checkAttributes(I,[...r.keys()]),S++;let E=await this.exec(["--git-dir",this.repo,"push","--porcelain",this.options.url,`${I}:${this.ref}`]),y=N(E.stdout.toString()+`
5
5
  `+E.stderr);w=y.trim();let O=E.code!==0&&/\[rejected\]|\[remote rejected\]/.test(y),p=E.code!==0&&(E.code===124||Pe.test(y));g||=p;try{await this.refresh()}catch{throw new d("SYNC_PUBLICATION_UNKNOWN","we could not confirm whether your context was uploaded; your local work is safe","check the connection and retry; kane-cli compares the published data before writing again")}if(u(),[...c].every(([f,T])=>this.tree.get(f)===T)){await this.verifyPublication(c);let f=E.code===0&&!E.stdout.toString().split(`
@@ -0,0 +1,8 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as h}from"./chunk-VZ7KXRXB.js";import{c as _}from"./chunk-EYOCNMUM.js";import{dirname as T,isAbsolute as F,resolve as j}from"path";var k=["db","api","js","smartui","network_query","network_assertion"];var a=class extends Error{constructor(r,o,e){super(`[${o}${e!=null?`:${e}`:""}] ${r}`);this.file=o;this.line=e;this.name="TestMdParseError"}};var R=["if","elif","else","end-if","while","end-while"];var C={"end-if":"if","end-while":"while"};function v(n,t){let r=[],o=()=>r[r.length-1];for(let s of t){let i=s.controlFlow;if(i==="if"||i==="while"){r.push({kind:i,id:s.index,branch:0,elseSeen:!1}),s.block={id:s.index,branch:0,depth:r.length};continue}if(i==="elif"||i==="else"){let c=o();if(!c||c.kind!=="if")throw new a(`@${i} outside an open @if`,n,s.headingLine);if(c.elseSeen)throw new a(`@${i} after @else`,n,s.headingLine);c.branch+=1,c.elseSeen=i==="else",s.block={id:c.id,branch:c.branch,depth:r.length};continue}if(i==="end-if"||i==="end-while"){let c=o(),d=C[i];if(!c||c.kind!==d)throw new a(`@${i} without an open @${d}`,n,s.headingLine);s.block={id:c.id,branch:-1,depth:r.length},r.pop();continue}let l=o();l&&(s.block={id:l.id,branch:l.branch,depth:r.length})}let e=o();if(e){let s=t.find(i=>i.index===e.id);throw new a(`unclosed @${e.kind} block`,n,s?.headingLine)}}var P=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),$=new Set(["mode","max_steps","timeout","global_context","local_context","variables","session_context","code_export","code_language","url","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset","os_version","device_name","on_lock_conflict","tags","assurance","dataset"]),O=new Set(["optional"]),Y=new Set(["optional","variables"]),M=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),N=new Set(["app","no_reset","os_version","device_name"]),B=new Set(["mode","on_lock_conflict","tags","assurance","dataset"]);function be(n,t){let r=t.split(`
3
+ `),{global:o,bodyStartLine:e}=I(n,r),{title:s,steps:i}=oe(n,r,e);return{path:n,title:s,global:o,steps:i}}function I(n,t){if(t[0]?.trim()!=="---")return{global:{},bodyStartLine:0};let r=-1;for(let l=1;l<t.length;l++)if(t[l].trim()==="---"){r=l;break}if(r===-1)throw new a("frontmatter is missing closing '---'",n,1);let o=t.slice(1,r).join(`
4
+ `),e;try{e=h(o)??{}}catch(l){throw new a(`invalid YAML in frontmatter: ${l.message}`,n,1)}if(E(n,e,"frontmatter",1),e.on_lock_conflict!==void 0){let l=e.on_lock_conflict;if(l!=="readonly"&&l!=="fail"&&l!=="wait")throw new a(`on_lock_conflict must be 'readonly' | 'fail' | 'wait', got: ${JSON.stringify(l)}`,n,1)}if(L(n,e,1),se(n,e,1),e.assurance!==void 0){let l=e.assurance;if(l===null||typeof l!="object"||Array.isArray(l))throw new a("assurance must be a mapping with sub-keys {id, base}",n,1);let c=l;for(let d of Object.keys(c))if(d!=="id"&&d!=="base")throw new a(`unknown assurance sub-key '${d}' \u2014 the engine block allows only {id, base}`,n,1);if(typeof c.id!="string"||c.id.length===0)throw new a("assurance.id must be a non-empty string (logical id)",n,1);if(c.base!==void 0&&!(typeof c.base=="string"&&/^sha256:[0-9a-f]+$/.test(c.base)))throw new a("assurance.base must be a 'sha256:<hex>' string",n,1)}if(e.tags!==void 0){let l=e.tags,c=Array.isArray(l)?l.map(d=>String(d)).join(","):String(l);e.tags=G(c,n,1)}if(e.target!==void 0&&(e.target=q(e.target,n,1)),e.app!==void 0&&(e.app=H(e.app,n,1)),e.no_reset!==void 0&&typeof e.no_reset!="boolean")throw new a(`no_reset must be boolean: got ${typeof e.no_reset}`,n,1);if(e.os_version!==void 0&&typeof e.os_version!="string")if(typeof e.os_version=="number")e.os_version=String(e.os_version);else throw new a(`os_version must be a string: got ${typeof e.os_version}`,n,1);let s=e.target,i=s==="emulator"||s==="simulator";if(i&&e.app===void 0)throw new a(`target: ${String(s)} needs an app \u2014 add \`app: <path-to-build | AppId>\``,n,1);if(!i&&e.app!==void 0)throw new a("app requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!i&&e.no_reset!==void 0)throw new a("no_reset requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!i&&e.os_version!==void 0)throw new a("os_version requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(e.device_name!==void 0&&typeof e.device_name!="string")throw new a(`device_name must be a string: got ${typeof e.device_name}`,n,1);if(!i&&e.device_name!==void 0)throw new a("device_name requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);return{global:e,bodyStartLine:r+1}}function G(n,t,r){let e=n.trim().replace(/^\[/,"").replace(/\]$/,"").split(",").map(s=>s.trim().toLowerCase());if(e.length===0||e.some(s=>s.length===0))throw new a("tags must be a non-empty list of non-empty strings",t,r);return[...new Set(e)]}var V=new Set(["chrome","cdp","ws","emulator","simulator"]),W="target must be one of 'chrome' | 'cdp' | 'ws' (web) or 'emulator' | 'simulator' (mobile, with a root `app:` key)";function q(n,t,r){if(typeof n=="string"&&V.has(n))return n;throw n!==null&&typeof n=="object"&&!Array.isArray(n)?new a(`the mapping form of target is no longer accepted \u2014 write flat keys:
5
+ target: emulator | simulator
6
+ app: <path-to-build | AppId>`,t,r):new a(`${W} \u2014 got: ${JSON.stringify(n)}`,t,r)}function H(n,t,r){if(typeof n!="string"||n.trim().length===0)throw new a("app must be a build (e.g. ./builds/app-debug.apk) or an app id from your cloud uploads",t,r);let o=n.trim();if(!/\.(apk|zip)$/i.test(o)&&!/^APP\d{6,}$/.test(o))throw new a(`app '${o}' is not a build \u2014 expected a path ending in .apk or .zip, or an app id from your cloud uploads.`,t,r);return z(o,t)}function z(n,t){return/^APP[0-9A-Za-z_-]+$/.test(n)||F(n)?n:j(T(t),n)}function ye(n){let t=n.target;if(!(t!=="emulator"&&t!=="simulator"))return{platform:_(t)??"",app:n.app??"",...n.no_reset!==void 0?{no_reset:n.no_reset}:{},...n.os_version!==void 0?{os_version:n.os_version}:{},...n.device_name!==void 0?{device_name:n.device_name}:{}}}function he(n){let t=n.target;return t==="chrome"||t==="cdp"||t==="ws"?t:void 0}var D=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function J(n,t,r){let o=D.exec(t);if(o)return{label:t.slice(0,o.index).trim(),verifies:o[1].split(",").map(s=>s.trim())};let e=t.lastIndexOf("@verifies");if(e>0&&/\s/.test(t[e-1])){let s=t.slice(e+9).split(/[\s,]+/).filter(i=>i.length>0);if(s.length===0||s.every(i=>i.startsWith("ac-")))throw new a("malformed @verifies directive \u2014 expected '@verifies ac-<id>[, ac-<id>\u2026]' at the end of the heading",n,r)}return{label:t,verifies:[]}}var S=k.join("|"),U=new RegExp(`^(.*\\S)\\s+@(${S})\\s*$`),Z=new RegExp(`^@(${S})\\s*$`);function Q(n,t,r,o){let e=Z.exec(t);if(e)throw new a(`replay-only marker @${e[1]} needs a step label before it (e.g. '## Step 3 @${e[1]}')`,n,r);let s=U.exec(t);if(!s)return null;let i=s[2];if(o)throw new a(`only one replay-only marker per step \u2014 found @${o} and @${i}`,n,r);return{label:s[1].trim(),replayOnly:i}}var x=R.join("|"),X=new RegExp(`^(.*\\S)\\s+@(${x})\\s*$`),ee=new RegExp(`^@(${x})\\s*$`);function ne(n,t,r,o){let e=ee.exec(t);if(e)throw new a(`control-flow marker @${e[1]} needs a step label before it (e.g. '## banner is visible @${e[1]}')`,n,r);let s=X.exec(t);if(!s)return null;let i=s[2];if(o)throw new a(`only one control-flow marker per step \u2014 found @${o} and @${i}`,n,r);return{label:s[1].trim(),controlFlow:i}}function te(n,t,r){let o=t,e,s,i=()=>{let c=Q(n,o,r,e);c&&({label:o,replayOnly:e}=c);let d=ne(n,o,r,s);d&&({label:o,controlFlow:s}=d)};i();let l=J(n,o,r);if(o=l.label,i(),e&&s)throw new a(`@${s} is a control-flow marker and @${e} a replay-only marker \u2014 a step carries one or the other`,n,r);return{label:o,verifies:l.verifies,...e?{replayOnly:e}:{},...s?{controlFlow:s}:{}}}function oe(n,t,r){let o,e=r;for(;e<t.length&&t[e].trim()==="";)e++;let s=e<t.length?/^#\s+(.+?)\s*$/.exec(t[e]):null;s&&(o=s[1],e++);let i=[];for(let c=e;c<t.length;c++)/^##\s/.test(t[c])&&i.push(c);let l=[];for(let c=0;c<i.length;c++){let d=i[c],p=i[c+1]??t.length,m=t[d].replace(/^##\s+/,"").trim(),{label:w,verifies:f,replayOnly:u,controlFlow:g}=te(n,m,d+1),b=t.slice(d+1,p),{config:A,body:y,optional:K}=re(n,d+1,b);if(u&&y.kind==="import_ref")throw new a(`@${u} is a replay-only marker for objective steps \u2014 it cannot mark an @import row`,n,d+1);if(g&&y.kind==="import_ref")throw new a(`@${g} is a control-flow marker for objective steps \u2014 it cannot mark an @import row`,n,d+1);l.push({index:c+1,heading:w,verifies:f,config:A,body:y,headingLine:d+1,optional:K,...u?{replayOnly:u}:{},...g?{controlFlow:g}:{}})}return v(n,l),{title:o,steps:l}}function re(n,t,r){let o=0;for(;o<r.length&&r[o].trim()==="";)o++;let e,s=t;if(o<r.length&&/^```yaml\s*$/.test(r[o])){let f=o;s=t+f,o++;let u=-1;for(;o<r.length;){if(/^```\s*$/.test(r[o])){u=o;break}o++}if(u===-1)throw new a("step-config fenced ```yaml block is not closed",n,s);let g=r.slice(f+1,u).join(`
7
+ `);try{e=h(g)??{}}catch(b){throw new a(`invalid YAML in step config: ${b.message}`,n,s)}o=u+1}let i=ie(r.slice(o)),l=i.filter(f=>f.trim()!=="");if(l.length>0&&/^@session\s+/.test(l[0].trim()))throw new a("@session is no longer supported (iteration 3); use @import instead",n,t);let c=/^@import\s+(\S.*)$/,p=i.filter(f=>c.test(f.trim())).length>0;if(p&&l.length!==1)throw new a("step body must be exactly one of prose / @import",n,t);let m=!1,w;if(e){if(E(n,e,p?"step config (ref)":"step config (objective)",s),L(n,e,s),typeof e.optional=="boolean")m=e.optional;else if(e.optional!==void 0)throw new a(`step config 'optional' must be boolean: got ${typeof e.optional}`,n,s);let f={...e};delete f.optional,p&&delete f.variables,!p&&Object.keys(f).length>0&&(w=f)}if(p){let u=c.exec(l[0].trim())[1].trim(),g=e?.variables;return{body:{kind:"import_ref",path:u,...g&&Object.keys(g).length>0?{bindings:g}:{}},optional:m}}return{body:{kind:"objective",text:i.join(`
8
+ `).trim()},config:w,optional:m}}function ie(n){let t=0,r=n.length;for(;t<r&&n[t].trim()==="";)t++;for(;r>t&&n[r-1].trim()==="";)r--;return n.slice(t,r)}function L(n,t,r){let o=t.variables;if(o==null)return;if(typeof o!="object"||Array.isArray(o))throw new a("variables must be an object map",n,r);let e={};for(let[s,i]of Object.entries(o))if(typeof i=="string")e[s]={value:i};else if(i&&typeof i=="object"&&!Array.isArray(i)&&typeof i.value=="string")e[s]=i;else throw new a(`variable '${s}' must be a string or { value: ... } object`,n,r);t.variables=e}function se(n,t,r){let o=t.dataset;if(o==null)return;if(typeof o=="string"){if(!o.trim())throw new a("dataset needs an id",n,r);t.dataset={id:o.trim()};return}if(typeof o!="object"||Array.isArray(o))throw new a("dataset must be an id or a mapping { id, row }",n,r);let e=o;for(let i of Object.keys(e))if(i!=="id"&&i!=="row")throw new a(`unknown dataset sub-key '${i}' \u2014 only { id, row } are allowed`,n,r);if(typeof e.id!="string"||!e.id.trim())throw new a("dataset needs an id",n,r);let s={id:e.id.trim()};if(e.row!==void 0){let i=e.row;if(!(typeof i=="string"&&i.trim().length>0&&!/^\d+$/.test(i.trim())))throw new a(`dataset row must be the row's _id as Test Manager shows it, not a position: got ${JSON.stringify(i)}`,n,r);s.row=i.trim()}t.dataset=s}function E(n,t,r,o){for(let e of Object.keys(t)){if(P.has(e))throw new a(`auth/identity keys are CLI-only: ${e}`,n,o);if(r==="frontmatter"){if(O.has(e))throw new a(`step-only key in frontmatter: ${e}`,n,o);if(!$.has(e))throw new a(`unknown config key: ${e}`,n,o)}else if(r==="step config (objective)"){if(!$.has(e)&&!O.has(e))throw new a(`unknown config key: ${e}`,n,o);if(M.has(e))throw new a(`chrome config is global-only: ${e}`,n,o);if(N.has(e))throw new a(`'${e}' is global-only: the whole run drives one app`,n,o);if(B.has(e))throw new a(`'${e}' is run-level and cannot be set per-step`,n,o)}else if(!Y.has(e))throw new a(`step config on @import may only contain 'optional' / 'variables': got ${e}`,n,o)}}export{be as a,ye as b,he as c,D as d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as Bt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Ft}from"./chunk-I7TIGB7K.js";import{a as te,c as Yt,e as Zt,f as qe,g as Qt,h as nr}from"./chunk-MLRO7OH3.js";import{a as Xt,b as rr,c as sr,d as ir,e as dt,f as or}from"./chunk-UHT5SVP5.js";import{a as ke,b as qt,c as Gt,d as Lt,e as Vt}from"./chunk-FFFB5BXL.js";import{a as zt}from"./chunk-L2TV4G56.js";import{a as Kt,b as Jt}from"./chunk-BZAGVBCX.js";import{c as Wt}from"./chunk-52WM3XYO.js";import{b as Nt}from"./chunk-YKTYVJBN.js";import{a as Ht,e as jt}from"./chunk-CRZUBDJ3.js";import{a as er}from"./chunk-GX3FPJUG.js";import{i as Mt}from"./chunk-AHXOKBVE.js";import{a as $e,b as ct}from"./chunk-ALCE5RLK.js";import{e as Ut}from"./chunk-4K5XTIJ6.js";import{a as Fe}from"./chunk-J7NRD4Q7.js";import{a as Se}from"./chunk-IE3OO5GI.js";import{c as nt}from"./chunk-5LJRZI7S.js";import{C as ee,m as be,q as Be}from"./chunk-GP7WD4UY.js";import{H as It,b as Ot}from"./chunk-3N6IAVD5.js";import{f as at}from"./chunk-FQNQVC5O.js";import{d as me}from"./chunk-AKX4VRRR.js";import{a as At}from"./chunk-5EOX4MEY.js";import{appendFileSync as wr,mkdirSync as ut,rmdirSync as br,writeFileSync as lt}from"fs";import{dirname as mr,extname as Sr,join as ce}from"path";var X=class extends Error{code;constructor(e,a){super(`${e}: ${a}`),this.name="ProposalAdapterError",this.code=e}};function cr(r){return r.version===2}var ar=8;function vr(r){let e=/^extract@(\d+)$/.exec(r??"");return e?Number.parseInt(e[1],10):null}var yr=r=>typeof r=="object"&&r!==null&&"op"in r;function Ge(r,e,a){return{anchor:r.anchor,quote:r.quote,...a||r.source_id!==e?{source_id:r.source_id}:{}}}function dr(r,e,a={}){let m=vr(a.templateVersion),x=m!==null&&m>=5,_=m!==null&&m<5,y=r.archived!=null&&r.archived.length>0&&m!==null&&m<5;if(y&&a.warn?.(`dropped ${r.archived.length} archive op(s): the bound extract template @${m} never described archiving \u2014 nothing was archived; the use-cases still land`),!x&&r.read_basis.length!==1)throw new X("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${r.read_basis.length}`);if(r.read_basis.length===0)throw new X("READ_BASIS_COUNT","read_basis must not be empty");let v=r.read_basis[0],h=r.read_basis.length>1,$=r.use_cases.map(i=>{if(_&&i.cite.length!==1)throw new X("CITE_COUNT",`${i.temp_ref}: cite must have exactly 1 element, got ${i.cite.length}`);if(i.cite.length<1||i.cite.length>ar)throw new X("CITE_COUNT",`${i.temp_ref}: 1..${ar} cites allowed, got ${i.cite.length}`);let M=(f,re)=>{if(!x&&f!==v.source_id)throw new X("SOURCE_MISMATCH",`${re}: cite source ${f} != read_basis source ${v.source_id} (single-source)`)};M(i.cite[0].source_id,i.temp_ref);let P=i.cite.map(f=>(M(f.source_id,i.temp_ref),Ge(f,v.source_id,x&&(h||f.source_id!==v.source_id)))),l=(i.updated?.criteria??[]).some(yr);if(!x&&l)throw new X("CRITERIA_OPS_UNSUPPORTED",`${i.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${a.templateVersion??"an unversioned template"}`);return{temp_ref:i.temp_ref,title:i.title,...i.description!==void 0?{description:i.description}:{},...i.summary!==void 0?{summary:i.summary}:{},...i.actors!==void 0?{actors:i.actors}:{},...i.value!==void 0?{value:i.value}:{},risk:i.risk,cite:P[0],...P.length>1?{cites:P}:{},...i.criteria!=null&&i.criteria.length>0?{criteria:i.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{},depends_on_hint:i.depends_on_hint,matches_existing:i.matches_existing,...i.conflicts_with!=null?{conflicts_with:i.conflicts_with}:{},...i.changed?{changed:!0}:{},...i.updated!=null?{updated:{...i.updated.title!=null?{title:i.updated.title}:{},...i.updated.description!=null?{description:i.updated.description}:{},...i.updated.summary!=null?{summary:i.updated.summary}:{},...i.updated.actors!=null?{actors:i.updated.actors}:{},...i.updated.value!=null?{value:i.updated.value}:{},...i.updated.risk!=null?{risk:i.updated.risk}:{},...i.updated.criteria!=null?{criteria:l?i.updated.criteria.map(f=>f.op==="set"?{op:"set",text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}:f.op==="keep"?{op:"keep",ref:f.ref,text:f.text}:{op:"remove",ref:f.ref,text:f.text,reason:f.reason}):i.updated.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.updated.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{}}}:{},...i.change_note!=null?{change_note:i.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:v.source_id,source_cid:v.source_cid},use_cases:$,...h?{sources:r.read_basis.map(i=>({source_id:i.source_id,source_cid:i.source_cid}))}:{},...r.extraction_of!=null&&r.extraction_of.length>0?{extraction_claims:r.extraction_of.map(i=>({source_id:i.source_id,completeness:i.completeness}))}:{},...r.archived!=null&&r.archived.length>0&&!y?{archived:r.archived.map(i=>({target:i.target,reason:i.reason,basis:i.basis}))}:{}}}function ur(r){let{contextDir:e,graph:a}=r,m=r.maxDigestBytes??4096,x={},_=[];for(let[h,$]of a.heads){if(x[h]=$,typeof $!="string")continue;let i=a.mediaOf($),M=a.getNode($)?.content?.blob;if(typeof M=="string")if(i.format==="image")_.push({source_id:h,cid:$,format:"image",blobRef:{path:Se(e,M),cid:M}});else{let P=$e(e,a,$)?.toString("utf8")??"";_.push({source_id:h,cid:$,format:i.format,text:P})}}_.sort((h,$)=>h.source_id<$.source_id?-1:1);let y=[];for(let h of a.byLabel(me.STYLENOTE).sort(($,i)=>$.cid<i.cid?-1:1))a.superseded.has(h.cid)||y.push(`\u2022 ${String(h.content.statement)} [${String(h.content.learned_from_kind)}]`);let v="";for(let h of y){if(Buffer.byteLength(v+h+`
2
+ import{b as Bt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Ft}from"./chunk-I7TIGB7K.js";import{a as te,c as Yt,e as Zt,f as qe,g as Qt,h as nr}from"./chunk-6DHEOPXX.js";import{a as Xt,b as rr,c as sr,d as ir,e as dt,f as or}from"./chunk-UHT5SVP5.js";import{a as ke,b as qt,c as Gt,d as Lt,e as Vt}from"./chunk-DMCEGMGB.js";import{a as zt}from"./chunk-L2TV4G56.js";import{a as Kt,b as Jt}from"./chunk-BZAGVBCX.js";import{c as Wt}from"./chunk-52WM3XYO.js";import{b as Nt}from"./chunk-YKTYVJBN.js";import{a as Ht,e as jt}from"./chunk-CRZUBDJ3.js";import{a as er}from"./chunk-GX3FPJUG.js";import{i as Mt}from"./chunk-AHXOKBVE.js";import{a as $e,b as ct}from"./chunk-ALCE5RLK.js";import{e as Ut}from"./chunk-GZ65ZA4C.js";import{a as Fe}from"./chunk-DMT3W26F.js";import{a as Se}from"./chunk-IE3OO5GI.js";import{c as nt}from"./chunk-5LJRZI7S.js";import{C as ee,m as be,q as Be}from"./chunk-GP7WD4UY.js";import{H as It,b as Ot}from"./chunk-3N6IAVD5.js";import{f as at}from"./chunk-FQNQVC5O.js";import{d as me}from"./chunk-AKX4VRRR.js";import{a as At}from"./chunk-5EOX4MEY.js";import{appendFileSync as wr,mkdirSync as ut,rmdirSync as br,writeFileSync as lt}from"fs";import{dirname as mr,extname as Sr,join as ce}from"path";var X=class extends Error{code;constructor(e,a){super(`${e}: ${a}`),this.name="ProposalAdapterError",this.code=e}};function cr(r){return r.version===2}var ar=8;function vr(r){let e=/^extract@(\d+)$/.exec(r??"");return e?Number.parseInt(e[1],10):null}var yr=r=>typeof r=="object"&&r!==null&&"op"in r;function Ge(r,e,a){return{anchor:r.anchor,quote:r.quote,...a||r.source_id!==e?{source_id:r.source_id}:{}}}function dr(r,e,a={}){let m=vr(a.templateVersion),x=m!==null&&m>=5,_=m!==null&&m<5,y=r.archived!=null&&r.archived.length>0&&m!==null&&m<5;if(y&&a.warn?.(`dropped ${r.archived.length} archive op(s): the bound extract template @${m} never described archiving \u2014 nothing was archived; the use-cases still land`),!x&&r.read_basis.length!==1)throw new X("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${r.read_basis.length}`);if(r.read_basis.length===0)throw new X("READ_BASIS_COUNT","read_basis must not be empty");let v=r.read_basis[0],h=r.read_basis.length>1,$=r.use_cases.map(i=>{if(_&&i.cite.length!==1)throw new X("CITE_COUNT",`${i.temp_ref}: cite must have exactly 1 element, got ${i.cite.length}`);if(i.cite.length<1||i.cite.length>ar)throw new X("CITE_COUNT",`${i.temp_ref}: 1..${ar} cites allowed, got ${i.cite.length}`);let M=(f,re)=>{if(!x&&f!==v.source_id)throw new X("SOURCE_MISMATCH",`${re}: cite source ${f} != read_basis source ${v.source_id} (single-source)`)};M(i.cite[0].source_id,i.temp_ref);let P=i.cite.map(f=>(M(f.source_id,i.temp_ref),Ge(f,v.source_id,x&&(h||f.source_id!==v.source_id)))),l=(i.updated?.criteria??[]).some(yr);if(!x&&l)throw new X("CRITERIA_OPS_UNSUPPORTED",`${i.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${a.templateVersion??"an unversioned template"}`);return{temp_ref:i.temp_ref,title:i.title,...i.description!==void 0?{description:i.description}:{},...i.summary!==void 0?{summary:i.summary}:{},...i.actors!==void 0?{actors:i.actors}:{},...i.value!==void 0?{value:i.value}:{},risk:i.risk,cite:P[0],...P.length>1?{cites:P}:{},...i.criteria!=null&&i.criteria.length>0?{criteria:i.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{},depends_on_hint:i.depends_on_hint,matches_existing:i.matches_existing,...i.conflicts_with!=null?{conflicts_with:i.conflicts_with}:{},...i.changed?{changed:!0}:{},...i.updated!=null?{updated:{...i.updated.title!=null?{title:i.updated.title}:{},...i.updated.description!=null?{description:i.updated.description}:{},...i.updated.summary!=null?{summary:i.updated.summary}:{},...i.updated.actors!=null?{actors:i.updated.actors}:{},...i.updated.value!=null?{value:i.updated.value}:{},...i.updated.risk!=null?{risk:i.updated.risk}:{},...i.updated.criteria!=null?{criteria:l?i.updated.criteria.map(f=>f.op==="set"?{op:"set",text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}:f.op==="keep"?{op:"keep",ref:f.ref,text:f.text}:{op:"remove",ref:f.ref,text:f.text,reason:f.reason}):i.updated.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.updated.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{}}}:{},...i.change_note!=null?{change_note:i.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:v.source_id,source_cid:v.source_cid},use_cases:$,...h?{sources:r.read_basis.map(i=>({source_id:i.source_id,source_cid:i.source_cid}))}:{},...r.extraction_of!=null&&r.extraction_of.length>0?{extraction_claims:r.extraction_of.map(i=>({source_id:i.source_id,completeness:i.completeness}))}:{},...r.archived!=null&&r.archived.length>0&&!y?{archived:r.archived.map(i=>({target:i.target,reason:i.reason,basis:i.basis}))}:{}}}function ur(r){let{contextDir:e,graph:a}=r,m=r.maxDigestBytes??4096,x={},_=[];for(let[h,$]of a.heads){if(x[h]=$,typeof $!="string")continue;let i=a.mediaOf($),M=a.getNode($)?.content?.blob;if(typeof M=="string")if(i.format==="image")_.push({source_id:h,cid:$,format:"image",blobRef:{path:Se(e,M),cid:M}});else{let P=$e(e,a,$)?.toString("utf8")??"";_.push({source_id:h,cid:$,format:i.format,text:P})}}_.sort((h,$)=>h.source_id<$.source_id?-1:1);let y=[];for(let h of a.byLabel(me.STYLENOTE).sort(($,i)=>$.cid<i.cid?-1:1))a.superseded.has(h.cid)||y.push(`\u2022 ${String(h.content.statement)} [${String(h.content.learned_from_kind)}]`);let v="";for(let h of y){if(Buffer.byteLength(v+h+`
3
3
  `,"utf8")>m)break;v+=h+`
4
4
  `}return{read_basis:x,sources:_,styleNoteDigest:v}}function lr(r,e){let a=ur({contextDir:r,graph:e}).styleNoteDigest;return a.length>0?a:void 0}function mt(r,e,a,m,x){let _=null,y=()=>_??=x&&Object.keys(x).length>0?Promise.resolve(x):Ut().catch(()=>({}));return{contextDir:r,rootSid:e,locks:at(r,e),probe:m??Ft(r,{resolveAlias:async v=>qt(v,{env:process.env,auth:await y()}),embed:async(v,h)=>Gt(v,h,{env:process.env,auth:await y()}),readVector:(v,h)=>Lt(r,v,h),writeVector:(v,h,$)=>Vt(r,v,h,$)}),...a?.length?{reservedEventIds:a}:{}}}function ht(r,e){let a=[],m=[];for(let x of r.use_cases){let _=x.matches_existing;_?.cid&&e.hasNode(_.cid)?a.push({ref:_.cid,expectedTip:e.tipOf(_.cid)}):m.push({tempRef:x.temp_ref,title:String(x.title??""),probeText:String(x.title??"")})}return{verb:"extract",ucTargets:a,newBuCandidates:m,sourcePins:[{source_id:r.source.source_id,source_cid:r.source.source_cid}],readBasis:r.read_basis??null}}function $r(r,e){let a=(r.images??[]).filter(m=>m.delivery==="selected");if(a.length!==0)return a.map(m=>({ref:m.ref,...m.page!==void 0?{page:m.page}:{},...m.loc!==void 0?{loc:m.loc}:{},media_type:m.media_type,blob_ref:{path:Se(e,m.blob),cid:m.blob}}))}function kr(r){return r.length>8&&r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71?"image/png":r.length>3&&r[0]===255&&r[1]===216&&r[2]===255?"image/jpeg":r.length>12&&r.toString("ascii",0,4)==="RIFF"&&r.toString("ascii",8,12)==="WEBP"?"image/webp":null}function Le(r){return r.toISOString().replace(/[-:]/g,"").slice(0,15)}function hr(r){return r.startsWith("su-conv-")?`conv-${Ot(Buffer.from(r,"utf8")).slice(0,8)}`:r}function pr(r){return r.source_id.startsWith("su-conv-")?"the conversation":r.source_id}function Rr(r,e,a){return`reading ${pr(r)}${a>1?` (source ${e} of ${a})`:""}`}function Re(r){return r.toLowerCase().trim().replace(/\s+/g," ")}function gr(r,e){let a=new Map,m=new Map,x=new Map;for(let{cid:y,content:v}of e.byLabel(me.USECASE)){if(e.superseded.has(y))continue;(e.trust.get(y)==="archived"?x:m).set(Re(String(v.title??"")),y)}let _=y=>e.trust.get(y)==="archived"?{cid:y,archived:!0,reason:e.archivedReason.get(y)}:{cid:y};for(let y of r.use_cases){if(y.matches_existing){let $=y.matches_existing.cid;if(e.superseded.has($)){let i=e.tipOf($);$=e.superseded.has(i)?null:i}if($!==null){a.set(y.temp_ref,_($));continue}}let v=m.get(Re(y.title));if(v){a.set(y.temp_ref,{cid:v});continue}let h=x.get(Re(y.title));h&&a.set(y.temp_ref,_(h))}return a}var fr=/^(\S+)\.criteria\[(\d+)\]/;function Cr(r,e,a){if(e.length===0||!e.every(x=>fr.test(x.detail)))return!1;let m=new Map;for(let x of e){let _=fr.exec(x.detail),y=m.get(_[1])??new Set;y.add(Number(_[2])),m.set(_[1],y)}for(let x of r.use_cases){let _=m.get(x.temp_ref);_?.size&&(x.criteria=(x.criteria??[]).filter((y,v)=>!_.has(v)),a(`${x.temp_ref}: dropped ${_.size} criteria with unverifiable cites \u2014 committed without them (criteria are hints, not oracles)`))}return!0}async function gt(r,e,a,m,x=()=>{},_,y){let v=(h,$)=>x(h,$,r.session_id);return Zt(r,e,a,m,x,{async onProposalEvent(h){let $=h,i=null,M=null;if(cr($))try{i=dr($,r.read_basis,{templateVersion:y?.()??null,warn:P=>{e.out(`warning: ${P}`),v("adapter",{warn:P})}}),v("adapter",{ok:!0,use_cases:i.use_cases.length})}catch(P){M=P instanceof X?P.message:String(P),v("adapter",{ok:!1,error:M})}else i=$;return i&&i.use_cases.length===0&&(e.out("warning: the agent proposed ZERO use-cases for this source"),e.emit?.({type:"warning",code:"ZERO_USE_CASES",message:"the agent proposed ZERO use-cases for this source"})),i&&_&&await _(i),{proposal:i,error:M}}})}var Dr=new Set(["agent","ci","override"]);async function Ss(r,e){let a=`ext-${Le(e.now?.()??new Date)}-lk${Math.random().toString(36).slice(2,8)}`,x=at(e.contextDir,a,e.now?{now:e.now}:void 0).tryAcquire([{kind:"extract"}],{hold:"session",verb:"extract"});if("contended"in x){let _=x.contended.holder,y=`another extraction is running on this context${_?` (pid ${_.pid})`:""} \u2014 retry when it finishes`;return e.out(y),e.emit?.({type:"error",message:y,code:"EXTRACT_LOCKED"}),2}try{return await Er(r,e)}finally{x.release()}}async function Er(r,e){let a=r.mode??"interactive";if(r.posture==="reconcile"){if(r.trust==="hold"){let o="error: --trust hold has no meaning here \u2014 a reconcile IS the review; drop the flag";return e.out(`${o} [TRUST_USAGE]`),e.emit?.({type:"error",message:o,code:"TRUST_USAGE"}),2}if(!r.source||!r.changeContext){let o="reconcile posture needs a pinned source and its change context \u2014 internal wiring fault";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}if(a==="ci"){let o="reconcile posture is not available under --mode ci \u2014 a held changeset needs a durable session; use --mode agent";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}}if(r.trust==="hold"&&a==="interactive")return e.out("error: --trust hold only applies to headless runs \u2014 in interactive chat you review items in-session anyway; use --mode agent to hold everything for review"),e.emit?.({type:"error",message:"error: --trust hold only applies to headless runs \u2014 use --mode agent",code:"TRUST_USAGE"}),2;if(a==="interactive"){if(!e.isTTY)return e.out("extract: --mode interactive needs a TTY (use --mode agent|ci|override headless)"),2}else if(!Dr.has(a))return e.out(`extract: unknown mode "${a}" \u2014 interactive | agent | ci | override`),2;if(r.trust!==void 0){if(a==="ci")return e.out("error: --trust is not available under --mode ci (ci is fail-closed \u2014 no trust dials)"),e.emit?.({type:"error",message:"error: --trust is not available under --mode ci",code:"TRUST_UNDER_CI"}),2;if(r.trust!=="auto"&&r.trust!=="hold")return e.out(`error: --trust must be auto | hold, got '${r.trust}'`),e.emit?.({type:"error",message:`error: --trust must be auto | hold, got '${r.trust}'`,code:"TRUST_USAGE"}),2}let m=e.telemetry?.enabled?e.telemetry:void 0,x=Le(e.now?.()??new Date),_=m?At(m.ids.context_instance_id??null,"extract",m.ids.session_id):ce(e.contextDir,"logs",`extract-${x}.log`);ut(mr(_),{recursive:!0});let y=`run-${x}-${Math.random().toString(36).slice(2,8)}`,v=o=>o==="error"||o==="failed_proposal"?"error":o==="repair_respawn"?"warn":"info",h=(o,u,s)=>{try{wr(_,JSON.stringify({ts:new Date().toISOString(),level:v(o),run_id:y,...m?{user_session_id:m.ids.session_id}:{},...s?{session_id:s}:{},kind:o,data:u})+`
5
5
  `)}catch{}m?.wireTrace(o,u,s)};{let o=e.out;e.out=u=>{h("transcript",{line:u}),o(u)}}e.chat||e.out(`trace: ${te(_)}`),e.emit?.({type:"run_start",mode:a,trace:_,...m?{session:m.ids.session_id}:{}});let $=Nt();if($&&e.out($),e.preflightTurn){let o=await e.preflightTurn();if(h("preflight",o),!o.ok)return e.out(o.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:o.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),2}let i=ee(e.contextDir),M=lr(e.contextDir,i),P=r.sources?.length?r.sources:r.source?[r.source]:[];if(P.length>0){if(r.resume){let o="error: --source cannot be combined with --resume (the resumed session already has its scope)";return e.out(o),e.emit?.({type:"error",message:o,code:"SOURCE_WITH_RESUME"}),2}for(let o of P){let u=i.heads.get(o);if(typeof u!="string"){let s=u===null?`error: --source ${o} was ingested but is retired \u2014 re-ingest it to extract again`:`error: --source ${o} is not an ingested source (kane-cli context list shows them)`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_UNKNOWN"}),2}}}let l=null,f=null;if(r.resume){try{{let c=await or(e.contextDir,r.resume,i,{verb:"extract",deps:{onWarn:C=>e.out(`note: ${C}`)}});{let C=Object.keys(c.handle.state.read_basis??{});if(C.length>1){let B=`error: session ${r.resume} spans ${C.length} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (re-run kane-cli context extract for anything remaining)`;return e.out(B),e.emit?.({type:"error",message:B,code:"MULTI_SOURCE_RESUME"}),c.handle.release(),2}f=c,h("resume_kind",{kind:c.view.pointer===null?"bare-base":c.view.pointer.at==="final"?"pause":"crash"}),l={handle:c.handle,represent:c.represent,questions:c.questions,staleBasis:c.drift.map(B=>B.subject)}}}}catch(c){let C=c instanceof Error?c.message:String(c);return e.out(`error: ${C}`),e.emit?.({type:"error",message:`error: ${C}`,...c instanceof dt?{code:c.code}:{}}),c instanceof dt?2:1}let o=f?null:Xt(l.handle.state.verb,"extract",r.resume);if(o)return e.out(o.message),e.emit?.({type:"error",message:o.message,code:o.code}),l.handle.release(),2;let u=l.handle.state.change_basis;if(u&&(i.heads.get(u.source_id)??null)!==u.new_head){let c=`error: ${u.source_id} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; re-run kane-cli maintain reconcile against the current file (session ${r.resume} is defunct and can be ignored)`;return e.out(c),e.emit?.({type:"error",message:c,code:"CHANGE_BASIS_MOVED"}),l.handle.release(),2}if(f&&f.view.pointer!==null&&f.drift.length>0){if(!await e.confirmStale(`changed since the pause: ${f.drift.map(C=>C.subject).join(", ")} \u2014 re-ground and continue against the current versions?`)){let C=`resume aborted: the context moved since the pause (${f.drift.map(B=>B.subject).join(", ")}) \u2014 session ${r.resume} is preserved`;return e.out(C),e.emit?.({type:"error",message:C,code:"RESUME_DRIFT"}),l.handle.release(),2}}else l.staleBasis.length>0&&e.out(`note: changed since the pause: ${l.staleBasis.join(", ")} \u2014 re-presented items may be stale`);let s=[...new Set([...l.handle.state.held_receipts??[],...f?.view.kane?.held_receipts??[]])];if(s.length>0)if(e.chat?.holdReceipt)for(let c of s)e.chat.holdReceipt(c);else e={...e,initialMessage:[s.join(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-RZ4F3BHX.js";import{a,b as c,e as o}from"./chunk-B2ZGG7WM.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{a,b as c,e as o}from"./chunk-HYTBEPC2.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as X}from"./chunk-BB2W35TW.js";import{a as $}from"./chunk-YKTYVJBN.js";import{C as T,n as z,o as Y,p as H}from"./chunk-GP7WD4UY.js";import{K as N,x as q}from"./chunk-3N6IAVD5.js";import{a as W,e as S,g as L}from"./chunk-FQNQVC5O.js";import{c as C}from"./chunk-UD7KKHPW.js";import{a as K,b as J}from"./chunk-B2ZGG7WM.js";var ce=3,de=1e4,Q=()=>new Promise(r=>setTimeout(r,25+Math.floor(Math.random()*50))),Z=r=>r==="design"||r==="maintain"?"session":r==="revert"||r==="shape-op"?"exclusive":"commit";function le(r,e,o){for(let s of r){for(let t of s.supersessions)if(t.kind==="node"&&(o.has(t.old)||t.new!==null&&o.has(t.new)))return!0;for(let t of s.nodes)if(t.label==="usecase"&&e.newBuCandidates.length>0||o.has(t.cid))return!0;if(s.design_generation&&e.generationTicket&&s.design_generation.uc_root===e.generationTicket.uc_root)return!0;for(let t of e.sourcePins)if(Object.prototype.hasOwnProperty.call(s.source_head_moves,t.source_id))return!0}return!1}async function De(r,e,o){let{contextDir:s,locks:t,probe:a}=r,m=r.sid??r.rootSid,f=e.newBuCandidates.map(b=>({tempRef:b.tempRef,probeText:b.probeText})),k=0,g=!0,p={hits:[],degraded:!1,probeBasis:null};for(;;){g&&(f.length>0&&(p=await a.batchSimilar(T(s),f)),g=!1);let b=T(s),_={seq:b.lastSeq,hash:b.latestHash},P=new Map,w=[],v=[],R=new Set;for(let d of e.ucTargets){let c=H(b,d.ref);if(c===null)return{ok:!1,kind:"validation",errors:[{code:"UNKNOWN_REF",detail:`${d.ref}: names no living node (unknown or tombstoned chain)`}]};d.expectedTip!==void 0&&d.expectedTip!==c.cid&&P.set(d.expectedTip,c.cid),R.add(c.cid),v.push(L(b,d.ref).key)}(e.verb==="revert"||e.verb==="shape-op")&&(v.length=0,v.push({kind:"context",mode:"exclusive"}));let y;try{y=t.acquire(S(v),{hold:Z(e.verb),verb:e.verb})}catch(d){if(d instanceof W&&(d.code==="UC_HELD"||d.code==="CONTEXT_HELD"))return{ok:!1,kind:"contended",err:d};throw d}let V=!1,M=!1;try{let d=await t.withKeySerialized(v,async()=>{let c=T(s),O=_.hash===c.latestHash?[]:N(s,_.seq,_.hash).records;for(let n of e.ucTargets){let i=H(c,n.ref);if(i===null){w.push({kind:"supersession",ref:n.ref,detail:`${n.ref} was retired while this commit staged \u2014 re-ground or abandon`});continue}for(let l of R)c.superseded.has(l)&&c.tipOf(l)===i.cid&&P.set(l,i.cid)}for(let n of e.sourcePins){let i=c.heads.get(n.source_id);i!=null&&i!==n.source_cid&&w.push({kind:"pin",ref:n.source_id,detail:`source '${n.source_id}' moved (pinned ${n.source_cid.slice(0,19)}, head ${i.slice(0,19)}) \u2014 re-ground or abandon`})}if(w.length>0)return{ok:!1,kind:"drifted",asks:w};if(e.generationTicket){let n=X(c,e.generationTicket);if(n!==null)return{ok:!1,kind:"validation",errors:[n]}}if(f.length>0&&O.length>0){let n=new Set(p.hits.map(u=>u.candidateCid)),i=a.recheckLocal(c,f,p.probeBasis,O);if(i.hits.some(u=>!n.has(u.candidateCid))||i.uncachedNewNodes.length>0)return M=!0,"restart"}if(e.verb!=="revert"&&e.verb!=="shape-op"){let n=S(e.ucTargets.map(u=>L(c,u.ref).key)),i=S(v);if(!(n.length===i.length&&n.every((u,h)=>JSON.stringify(u)===JSON.stringify(i[h]))))return"restart"}if(e.eventIds&&e.eventIds.length>0&&e.eventIds.every(n=>c.appliedEvents.has(n)))return{ok:!0,skipped:"already-applied"};let ae=Date.now()+de,j=c.latestHash,E=c;for(;;){let n={graph:E,expectPrev:j,redirects:P,probeHits:p.hits,degradedProbe:p.degraded,sid:m,eventIds:(l,u)=>{if(e.eventIds&&e.eventIds.length>0)return e.eventIds.slice(0,u);let h=Y(E,r.rootSid,l,u),U=r.reservedEventIds??[];if(U.length===0)return h;let D=`${r.rootSid}:${l}:`,A=0;for(let F of U){if(!F.startsWith(D))continue;let x=F.slice(D.length);/^\d+$/.test(x)&&(A=Math.max(A,Number.parseInt(x,10)))}if(A===0)return h;let G=Number.parseInt(h[0].slice(D.length),10);return!Number.isInteger(G)||G>A?h:Array.from({length:u},(F,x)=>z(r.rootSid,l,A+1+x))},assertLocks:()=>y.assertHeld()};if(r.revalidate){let l=r.revalidate(n);if(l.length>0)return{ok:!1,kind:"validation",errors:l}}y.assertHeld();let i;try{i=o(n)}catch(l){if(l instanceof q){let u=T(s),h=N(s,E.lastSeq,E.latestHash).records;if(!le(h,e,R)&&Date.now()<ae){await Q(),E=u,j=u.latestHash;continue}return"restart"}throw l}return"errors"in i?{ok:!1,kind:"validation",errors:i.errors}:(Z(e.verb)==="session"&&y.touch(),{ok:!0,result:i.result,record:i.record})}});if(d==="restart")V=!0;else return d}finally{y.release()}if(V){if(k+=1,k>=ce)return{ok:!1,kind:"unsettled",attempts:k};M&&(g=!0),await Q();continue}}}import{readFileSync as ue,writeFileSync as fe,renameSync as me,mkdirSync as pe}from"fs";import{dirname as he,join as ge}from"path";var B=1,be=720*60*1e3;function I(r){return ge(J,"embeddings",`alias-${r}.json`)}function ee(r,e=Date.now()){return r!==null&&e-r.fetchedAt<be}function re(r){try{let e=JSON.parse(ue(r,"utf-8"));return e.wrapperVersion!==B||typeof e.purposes!="object"||e.purposes===null?null:{wrapperVersion:B,writtenByVersion:String(e.writtenByVersion??""),purposes:e.purposes}}catch{return null}}function te(r,e,o=I(r)){let t=re(o)?.purposes?.[e];return!t||typeof t.alias!="string"||typeof t.dims!="number"||typeof t.fetchedAt!="number"?null:{alias:t.alias,dims:t.dims,fetchedAt:t.fetchedAt}}function se(r,e,o,s=I(r)){try{pe(he(s),{recursive:!0});let a=re(s)?.purposes??{};a[e]={alias:o.alias,dims:o.dims,fetchedAt:Date.now()};let m={wrapperVersion:B,writtenByVersion:K,purposes:a},f=`${s}.tmp`;fe(f,JSON.stringify(m,null,2)+`
2
+ import{d as X}from"./chunk-BB2W35TW.js";import{a as $}from"./chunk-YKTYVJBN.js";import{C as T,n as z,o as Y,p as H}from"./chunk-GP7WD4UY.js";import{K as N,x as q}from"./chunk-3N6IAVD5.js";import{a as W,e as S,g as L}from"./chunk-FQNQVC5O.js";import{c as C}from"./chunk-UD7KKHPW.js";import{a as K,b as J}from"./chunk-HYTBEPC2.js";var ce=3,de=1e4,Q=()=>new Promise(r=>setTimeout(r,25+Math.floor(Math.random()*50))),Z=r=>r==="design"||r==="maintain"?"session":r==="revert"||r==="shape-op"?"exclusive":"commit";function le(r,e,o){for(let s of r){for(let t of s.supersessions)if(t.kind==="node"&&(o.has(t.old)||t.new!==null&&o.has(t.new)))return!0;for(let t of s.nodes)if(t.label==="usecase"&&e.newBuCandidates.length>0||o.has(t.cid))return!0;if(s.design_generation&&e.generationTicket&&s.design_generation.uc_root===e.generationTicket.uc_root)return!0;for(let t of e.sourcePins)if(Object.prototype.hasOwnProperty.call(s.source_head_moves,t.source_id))return!0}return!1}async function De(r,e,o){let{contextDir:s,locks:t,probe:a}=r,m=r.sid??r.rootSid,f=e.newBuCandidates.map(b=>({tempRef:b.tempRef,probeText:b.probeText})),k=0,g=!0,p={hits:[],degraded:!1,probeBasis:null};for(;;){g&&(f.length>0&&(p=await a.batchSimilar(T(s),f)),g=!1);let b=T(s),_={seq:b.lastSeq,hash:b.latestHash},P=new Map,w=[],v=[],R=new Set;for(let d of e.ucTargets){let c=H(b,d.ref);if(c===null)return{ok:!1,kind:"validation",errors:[{code:"UNKNOWN_REF",detail:`${d.ref}: names no living node (unknown or tombstoned chain)`}]};d.expectedTip!==void 0&&d.expectedTip!==c.cid&&P.set(d.expectedTip,c.cid),R.add(c.cid),v.push(L(b,d.ref).key)}(e.verb==="revert"||e.verb==="shape-op")&&(v.length=0,v.push({kind:"context",mode:"exclusive"}));let y;try{y=t.acquire(S(v),{hold:Z(e.verb),verb:e.verb})}catch(d){if(d instanceof W&&(d.code==="UC_HELD"||d.code==="CONTEXT_HELD"))return{ok:!1,kind:"contended",err:d};throw d}let V=!1,M=!1;try{let d=await t.withKeySerialized(v,async()=>{let c=T(s),O=_.hash===c.latestHash?[]:N(s,_.seq,_.hash).records;for(let n of e.ucTargets){let i=H(c,n.ref);if(i===null){w.push({kind:"supersession",ref:n.ref,detail:`${n.ref} was retired while this commit staged \u2014 re-ground or abandon`});continue}for(let l of R)c.superseded.has(l)&&c.tipOf(l)===i.cid&&P.set(l,i.cid)}for(let n of e.sourcePins){let i=c.heads.get(n.source_id);i!=null&&i!==n.source_cid&&w.push({kind:"pin",ref:n.source_id,detail:`source '${n.source_id}' moved (pinned ${n.source_cid.slice(0,19)}, head ${i.slice(0,19)}) \u2014 re-ground or abandon`})}if(w.length>0)return{ok:!1,kind:"drifted",asks:w};if(e.generationTicket){let n=X(c,e.generationTicket);if(n!==null)return{ok:!1,kind:"validation",errors:[n]}}if(f.length>0&&O.length>0){let n=new Set(p.hits.map(u=>u.candidateCid)),i=a.recheckLocal(c,f,p.probeBasis,O);if(i.hits.some(u=>!n.has(u.candidateCid))||i.uncachedNewNodes.length>0)return M=!0,"restart"}if(e.verb!=="revert"&&e.verb!=="shape-op"){let n=S(e.ucTargets.map(u=>L(c,u.ref).key)),i=S(v);if(!(n.length===i.length&&n.every((u,h)=>JSON.stringify(u)===JSON.stringify(i[h]))))return"restart"}if(e.eventIds&&e.eventIds.length>0&&e.eventIds.every(n=>c.appliedEvents.has(n)))return{ok:!0,skipped:"already-applied"};let ae=Date.now()+de,j=c.latestHash,E=c;for(;;){let n={graph:E,expectPrev:j,redirects:P,probeHits:p.hits,degradedProbe:p.degraded,sid:m,eventIds:(l,u)=>{if(e.eventIds&&e.eventIds.length>0)return e.eventIds.slice(0,u);let h=Y(E,r.rootSid,l,u),U=r.reservedEventIds??[];if(U.length===0)return h;let D=`${r.rootSid}:${l}:`,A=0;for(let F of U){if(!F.startsWith(D))continue;let x=F.slice(D.length);/^\d+$/.test(x)&&(A=Math.max(A,Number.parseInt(x,10)))}if(A===0)return h;let G=Number.parseInt(h[0].slice(D.length),10);return!Number.isInteger(G)||G>A?h:Array.from({length:u},(F,x)=>z(r.rootSid,l,A+1+x))},assertLocks:()=>y.assertHeld()};if(r.revalidate){let l=r.revalidate(n);if(l.length>0)return{ok:!1,kind:"validation",errors:l}}y.assertHeld();let i;try{i=o(n)}catch(l){if(l instanceof q){let u=T(s),h=N(s,E.lastSeq,E.latestHash).records;if(!le(h,e,R)&&Date.now()<ae){await Q(),E=u,j=u.latestHash;continue}return"restart"}throw l}return"errors"in i?{ok:!1,kind:"validation",errors:i.errors}:(Z(e.verb)==="session"&&y.touch(),{ok:!0,result:i.result,record:i.record})}});if(d==="restart")V=!0;else return d}finally{y.release()}if(V){if(k+=1,k>=ce)return{ok:!1,kind:"unsettled",attempts:k};M&&(g=!0),await Q();continue}}}import{readFileSync as ue,writeFileSync as fe,renameSync as me,mkdirSync as pe}from"fs";import{dirname as he,join as ge}from"path";var B=1,be=720*60*1e3;function I(r){return ge(J,"embeddings",`alias-${r}.json`)}function ee(r,e=Date.now()){return r!==null&&e-r.fetchedAt<be}function re(r){try{let e=JSON.parse(ue(r,"utf-8"));return e.wrapperVersion!==B||typeof e.purposes!="object"||e.purposes===null?null:{wrapperVersion:B,writtenByVersion:String(e.writtenByVersion??""),purposes:e.purposes}}catch{return null}}function te(r,e,o=I(r)){let t=re(o)?.purposes?.[e];return!t||typeof t.alias!="string"||typeof t.dims!="number"||typeof t.fetchedAt!="number"?null:{alias:t.alias,dims:t.dims,fetchedAt:t.fetchedAt}}function se(r,e,o,s=I(r)){try{pe(he(s),{recursive:!0});let a=re(s)?.purposes??{};a[e]={alias:o.alias,dims:o.dims,fetchedAt:Date.now()};let m={wrapperVersion:B,writtenByVersion:K,purposes:a},f=`${s}.tmp`;fe(f,JSON.stringify(m,null,2)+`
3
3
  `),me(f,s)}catch(t){C(`[embed] Failed to save alias cache: ${t instanceof Error?t.message:String(t)}`,"EMBED_CACHE_WRITE_FAILED")}}function ve(r){return r.TESTMUAI_ENV==="stage"?"stage":"prod"}function oe(r){let e=r.env??process.env,o=r.auth?.TESTMUAI_BASIC_AUTH||e.TESTMUAI_BASIC_AUTH;if(o)return{authorization:`Basic ${o}`};let s=r.auth?.TESTMUAI_API_KEY||e.TESTMUAI_API_KEY;return s?{authorization:`Bearer ${s}`}:{}}async function Oe(r,e={}){let o=e.env??process.env,s=ve(o),t=e.aliasCacheFile??I(s),a=e.now??Date.now,m=te(s,r,t);if(ee(m,a()))return{alias:m.alias,dims:m.dims};let k=`${$(o)}/assurance/embed/alias?purpose=${encodeURIComponent(r)}`,g=await(e.fetchImpl??fetch)(k,{method:"GET",headers:oe(e)});if(!g.ok)throw new Error(`embed alias resolve failed: ${g.status}`);let p=await g.json();return se(s,r,{alias:p.alias,dims:p.dims},t),{alias:p.alias,dims:p.dims}}async function je(r,e,o={}){let s=o.env??process.env,t=$(s),a=await(o.fetchImpl??fetch)(`${t}/assurance/embed`,{method:"POST",headers:{...oe(o),"content-type":"application/json"},body:JSON.stringify({purpose:r,input:e})});if(!a.ok)throw new Error(`embed failed: ${a.status}`);return await a.json()}import{readFileSync as ke,writeFileSync as ye,renameSync as Ee,mkdirSync as Ae}from"fs";import{dirname as Te,join as ne}from"path";function we(r){return ne(r,"embeddings")}function xe(r){let e=r.indexOf(":");return e>=0?r.slice(e+1):r}function ie(r,e,o){let s=xe(o);return ne(we(r),e,s.slice(0,2),`${s.slice(2)}.f32`)}function We(r,e,o){try{let s=ke(ie(r,e,o)),t=new Float32Array(Math.floor(s.length/4));for(let a=0;a<t.length;a++)t[a]=s.readFloatLE(a*4);return t}catch{return null}}function qe(r,e,o,s){try{let t=ie(r,e,o);Ae(Te(t),{recursive:!0});let a=Buffer.alloc(s.length*4);for(let f=0;f<s.length;f++)a.writeFloatLE(s[f],f*4);let m=`${t}.tmp`;ye(m,a),Ee(m,t)}catch(t){C(`[embed] Failed to cache vector: ${t instanceof Error?t.message:String(t)}`,"EMBED_CACHE_WRITE_FAILED")}}export{De as a,Oe as b,je as c,We as d,qe as e};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as n}from"./chunk-B2ZGG7WM.js";import{createHash as _}from"crypto";import{existsSync as m,readFileSync as u}from"fs";import{dirname as T,join as f,resolve as o}from"path";import{fileURLToPath as E}from"url";var s=T(E(import.meta.url)),l=2;function p(e,r){let t=_("sha256");return t.update(`kane-assurance-contract
2
+ import{a as n}from"./chunk-HYTBEPC2.js";import{createHash as _}from"crypto";import{existsSync as m,readFileSync as u}from"fs";import{dirname as T,join as f,resolve as o}from"path";import{fileURLToPath as E}from"url";var s=T(E(import.meta.url)),l=2;function p(e,r){let t=_("sha256");return t.update(`kane-assurance-contract
3
3
  `),t.update(e),t.update(`
4
4
  agent_state_schema=${r}`),"sha256:"+t.digest("hex")}function d(){return[o(s,".."),o(s,"../../..")]}function i(){return"sha256:4f00de27d151118e79aafd46ebe51bb69ce7dd9fabe647124c62f2d187e11aa7"}var a=class extends Error{constructor(t,c){super(`agent/cli contract mismatch (cli ${t||"<unset>"}, agent ${c||"<unset>"}) \u2014 rebuild or reinstall the stale half`);this.expected=t;this.actual=c;this.name="PairMismatchError"}};function I(){return{TESTMUAI_CONTRACT_DIGEST:i(),TESTMUAI_CLIENT_VERSION:process.env.KANE_DEV_FORCE_CLIENT_RELEASE??`kane-cli/${n}`}}export{a,I as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as t}from"./chunk-B2ZGG7WM.js";import{join as i}from"path";function e(n=t){return i(n,"plugins")}function g(n,r=t){return i(e(r),n)}function c(n,r,o=t){return i(g(n,o),r)}function f(n,r=t){return i(g(n,r),"current")}function x(n,r=t){return i(g(n,r),"config.json")}function l(n,r=t){return i(g(n,r),".jobs")}function s(n=t){return i(n,"bin")}function h(n=t){return i(s(n),"hyperexecute")}export{e as a,g as b,c,f as d,x as e,l as f,s as g,h};
2
+ import{b as t}from"./chunk-HYTBEPC2.js";import{join as i}from"path";function e(n=t){return i(n,"plugins")}function g(n,r=t){return i(e(r),n)}function c(n,r,o=t){return i(g(n,o),r)}function f(n,r=t){return i(g(n,r),"current")}function x(n,r=t){return i(g(n,r),"config.json")}function l(n,r=t){return i(g(n,r),".jobs")}function s(n=t){return i(n,"bin")}function h(n=t){return i(s(n),"hyperexecute")}export{e as a,g as b,c,f as d,x as e,l as f,s as g,h};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-OO5GMBVI.js";import{y as t}from"./chunk-B2ZGG7WM.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
2
+ import{a as m}from"./chunk-YKYKOV6U.js";import{y as t}from"./chunk-HYTBEPC2.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b}from"./chunk-OO5GMBVI.js";import{m as d,y as o}from"./chunk-B2ZGG7WM.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as u,b as c,i as A}from"./chunk-C44QQJR4.js";import{a as D}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(d).map(i=>{let e=P(d,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(d,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(d,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
2
+ import{a as b}from"./chunk-YKYKOV6U.js";import{m as d,y as o}from"./chunk-HYTBEPC2.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as u,b as c,i as A}from"./chunk-C44QQJR4.js";import{a as D}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(d).map(i=>{let e=P(d,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(d,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(d,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{x as s}from"./chunk-B2ZGG7WM.js";function n(r="prod"){let e=s[r];return r!=="stage"?e:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??e.tmsBaseUrl,testGeneratorBaseUrl:process.env.KANE_STAGE_TCG_URL??e.testGeneratorBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost,evidenceViewerUrl:process.env.KANE_STAGE_EVIDENCE_VIEWER_URL??e.evidenceViewerUrl,mediaArtefactsHost:process.env.KANE_STAGE_MEDIA_ARTEFACTS_HOST??e.mediaArtefactsHost,mobileAppBaseUrl:process.env.KANE_STAGE_MOBILE_APP_URL??e.mobileAppBaseUrl}}export{n as a};
2
+ import{x as s}from"./chunk-HYTBEPC2.js";function n(r="prod"){let e=s[r];return r!=="stage"?e:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??e.tmsBaseUrl,testGeneratorBaseUrl:process.env.KANE_STAGE_TCG_URL??e.testGeneratorBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost,evidenceViewerUrl:process.env.KANE_STAGE_EVIDENCE_VIEWER_URL??e.evidenceViewerUrl,mediaArtefactsHost:process.env.KANE_STAGE_MEDIA_ARTEFACTS_HOST??e.mediaArtefactsHost,mobileAppBaseUrl:process.env.KANE_STAGE_MOBILE_APP_URL??e.mobileAppBaseUrl}}export{n as a};