@testmuai/kane-cli 0.6.10 → 0.6.11

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 (154) hide show
  1. package/dist/ChatSurface-TZ554O4U.js +8 -0
  2. package/dist/{ChromeProfilePicker-IDKFTIHW.js → ChromeProfilePicker-54CAJDUF.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-SZOU5FGZ.js → CliFeedbackPrompt-TCAH4AHL.js} +1 -1
  4. package/dist/{CliUploadProgress-W2FC33Q4.js → CliUploadProgress-UURZ63VQ.js} +1 -1
  5. package/dist/{ConfigView-JB2NSZ2N.js → ConfigView-5QGB7MUS.js} +1 -1
  6. package/dist/{EvidenceViewOffer-5YST67KY.js → EvidenceViewOffer-SSAM4RRP.js} +1 -1
  7. package/dist/{FolderPicker-SPNZESAR.js → FolderPicker-Y5MAYFIJ.js} +1 -1
  8. package/dist/{HelpView-XBDXXHFB.js → HelpView-S3GJGSCE.js} +1 -1
  9. package/dist/{InfoBox-2T7GYSFT.js → InfoBox-LYTNNMVJ.js} +1 -1
  10. package/dist/{LinksBox-2NNZZDQT.js → LinksBox-5MSEKNSV.js} +1 -1
  11. package/dist/{ProfilesView-KJZVGU5B.js → ProfilesView-LTHE5UIO.js} +1 -1
  12. package/dist/{ProjectPicker-AUTZNEPE.js → ProjectPicker-XMXIGHSE.js} +1 -1
  13. package/dist/{SaveSessionPrompt-LHLSJQSQ.js → SaveSessionPrompt-VQDEA4WA.js} +1 -1
  14. package/dist/SingleShotApp-A6PCNPLM.js +2 -0
  15. package/dist/{SummaryBox-5G7WULUN.js → SummaryBox-WWF3G263.js} +1 -1
  16. package/dist/TestMdRunView-MQ7ZPFN2.js +2 -0
  17. package/dist/{WhoamiView-XNWBDMQR.js → WhoamiView-PDURYP7E.js} +1 -1
  18. package/dist/auth-I4RB4KO3.js +2 -0
  19. package/dist/{bind-FEOGBJ2O.js → bind-QJT726NE.js} +2 -2
  20. package/dist/{bootstrap-T6DSUI34.js → bootstrap-566PPFCC.js} +1 -1
  21. package/dist/{bridge-WMGH3O3B.js → bridge-QCMEOQDD.js} +1 -1
  22. package/dist/{changelog-AGFDNTTW.js → changelog-OKYH4F7I.js} +1 -1
  23. package/dist/{chat-committer-4ENYH3RC.js → chat-committer-OS7ULZMH.js} +1 -1
  24. package/dist/chat-controller-QLORQWJZ.js +2 -0
  25. package/dist/{chunk-FYDBD7Q4.js → chunk-2WKX3RMA.js} +1 -1
  26. package/dist/{chunk-6JTEWZ75.js → chunk-3AZTXJY4.js} +1 -1
  27. package/dist/{chunk-SKRZN25J.js → chunk-3RZ63RBO.js} +1 -1
  28. package/dist/{chunk-5F7PU5AJ.js → chunk-4CJ55EUY.js} +1 -1
  29. package/dist/{chunk-5Z7GAIPP.js → chunk-54IB6CXK.js} +2 -2
  30. package/dist/{chunk-JHPZXF77.js → chunk-54VQ46U2.js} +2 -2
  31. package/dist/{chunk-KK7DYHK6.js → chunk-55Y65VPA.js} +1 -1
  32. package/dist/{chunk-L4JIMNKW.js → chunk-6HYW5RFX.js} +1 -1
  33. package/dist/{chunk-A46NBRAP.js → chunk-6W6AIDLJ.js} +1 -1
  34. package/dist/{chunk-XY5KWIRF.js → chunk-73OQDAXF.js} +1 -1
  35. package/dist/{chunk-SDRFTIRU.js → chunk-7E24OCGX.js} +1 -1
  36. package/dist/{chunk-W54W762O.js → chunk-7MRBMDZ5.js} +1 -1
  37. package/dist/{chunk-76I6NJBX.js → chunk-7NLQ3QQD.js} +1 -1
  38. package/dist/chunk-7YPK6EDR.js +4 -0
  39. package/dist/{chunk-WSZ7IENQ.js → chunk-DSOA6L73.js} +3 -3
  40. package/dist/{chunk-6CGNLFSN.js → chunk-EAUUULJQ.js} +1 -1
  41. package/dist/{chunk-QPT4ERGK.js → chunk-F7WKDMX7.js} +1 -1
  42. package/dist/{chunk-7Z64BL5D.js → chunk-FCHTL74E.js} +1 -1
  43. package/dist/{chunk-OSALXGD4.js → chunk-FMR2KPSK.js} +1 -1
  44. package/dist/{chunk-RGDQMKNJ.js → chunk-FRBYGSGJ.js} +1 -1
  45. package/dist/{chunk-LPBAQQ7E.js → chunk-FSB3FTIQ.js} +1 -1
  46. package/dist/{chunk-AYDUHTPA.js → chunk-GIMTSDNC.js} +1 -1
  47. package/dist/{chunk-SACSQY3Q.js → chunk-GLA6QL3T.js} +1 -1
  48. package/dist/{chunk-TLL7KFLY.js → chunk-H2W2UNTN.js} +1 -1
  49. package/dist/{chunk-WV42KKEU.js → chunk-HLRLP6TQ.js} +1 -1
  50. package/dist/{chunk-6ZJ7ZFEX.js → chunk-HMM5FJJO.js} +1 -1
  51. package/dist/{chunk-GWJ76BLF.js → chunk-HOQEMPMQ.js} +2 -2
  52. package/dist/{chunk-2H3XNXL3.js → chunk-ICGHBZFZ.js} +1 -1
  53. package/dist/{chunk-7C6G4V43.js → chunk-IQODWB32.js} +1 -1
  54. package/dist/{chunk-MBXWXBDM.js → chunk-J2KSZUOO.js} +1 -1
  55. package/dist/{chunk-OESHJ4J2.js → chunk-JXKRO2ZJ.js} +2 -2
  56. package/dist/{chunk-RH4GCEFX.js → chunk-KHJXOFDM.js} +1 -1
  57. package/dist/chunk-KHQHVSZ6.js +5 -0
  58. package/dist/{chunk-ECFOND7B.js → chunk-KSZ72BSC.js} +1 -1
  59. package/dist/{chunk-TW3K2DKB.js → chunk-KXUSG5ZI.js} +1 -1
  60. package/dist/{chunk-YJIESLN6.js → chunk-LHDNJJGE.js} +1 -1
  61. package/dist/{chunk-Z25FKS3Y.js → chunk-M5PJQ5Y3.js} +1 -1
  62. package/dist/{chunk-VYQMCLKG.js → chunk-MFOH7EYR.js} +1 -1
  63. package/dist/{chunk-QGBLC4ZJ.js → chunk-MJBCBQC2.js} +1 -1
  64. package/dist/{chunk-2KS2YRIS.js → chunk-MMPFU2YC.js} +1 -1
  65. package/dist/{chunk-ZFFRHV5U.js → chunk-MR7CX5VT.js} +1 -1
  66. package/dist/{chunk-J4WS2SXT.js → chunk-MRP54NCJ.js} +1 -1
  67. package/dist/{chunk-JTCW76YG.js → chunk-MTNUZEO7.js} +1 -1
  68. package/dist/{chunk-XZW3TBOV.js → chunk-NJAHRITS.js} +1 -1
  69. package/dist/{chunk-FEF75YKV.js → chunk-NTGYFYBP.js} +1 -1
  70. package/dist/{chunk-DHF3VO2R.js → chunk-NTNAHN25.js} +1 -1
  71. package/dist/{chunk-KA7Q5IIC.js → chunk-NUQ423YE.js} +1 -1
  72. package/dist/{chunk-RLZA4VJT.js → chunk-OGWC3J3C.js} +1 -1
  73. package/dist/{chunk-5LTUYXMP.js → chunk-POYZ6SAI.js} +1 -1
  74. package/dist/{chunk-6NWPK2MS.js → chunk-QJIJC3KC.js} +1 -1
  75. package/dist/{chunk-YOFKDRY4.js → chunk-RFJAYURU.js} +1 -1
  76. package/dist/chunk-RGJIRS3B.js +2 -0
  77. package/dist/{chunk-4OSW2WEN.js → chunk-RZJVQUBA.js} +3 -3
  78. package/dist/{chunk-7LWXIRI3.js → chunk-SURF5Z7Y.js} +1 -1
  79. package/dist/chunk-TDPWFYTJ.js +2 -0
  80. package/dist/chunk-V3UE6RJP.js +2 -0
  81. package/dist/{chunk-MSK7AC4E.js → chunk-XSKLH2MC.js} +2 -2
  82. package/dist/{chunk-C3OGWCII.js → chunk-XWSAKVEY.js} +2 -2
  83. package/dist/{chunk-YVXC46DY.js → chunk-XXMNUJX4.js} +1 -1
  84. package/dist/{chunk-6MTVGARW.js → chunk-XZRIQ3GF.js} +1 -1
  85. package/dist/chunk-YSSTGJ7O.js +7 -0
  86. package/dist/chunk-Z2JSEL3I.js +4 -0
  87. package/dist/{chunk-7APDXIKI.js → chunk-ZNHXIRCM.js} +9 -9
  88. package/dist/{chunk-MJF3USZF.js → chunk-ZP4S5WGW.js} +1 -1
  89. package/dist/{chunk-3KN2UW37.js → chunk-ZPCU6546.js} +1 -1
  90. package/dist/{config-7WI6TBDV.js → config-QISRENF5.js} +1 -1
  91. package/dist/{cover-cmd-J2ZJUL6P.js → cover-cmd-SV3I23UM.js} +1 -1
  92. package/dist/{credentials-MX5ABDPF.js → credentials-OGLK7MPV.js} +1 -1
  93. package/dist/docx-convert-ZBVQO2LG.js +2 -0
  94. package/dist/{dossier-UVTGCL7T.js → dossier-KJSJPWOW.js} +1 -1
  95. package/dist/{evidence-TZYIOSPG.js → evidence-HDD7T7DX.js} +1 -1
  96. package/dist/{evolve-cmd-IDS5ZIUY.js → evolve-cmd-UE2BIMXK.js} +1 -1
  97. package/dist/{explain-VTRHEVUQ.js → explain-EBVIUS2X.js} +1 -1
  98. package/dist/{explain-cmd-NPKN63XL.js → explain-cmd-DBUTPZHA.js} +1 -1
  99. package/dist/{explain-cmd-R3WCNR2A.js → explain-cmd-NWIYH5MI.js} +1 -1
  100. package/dist/{extract-bind-CISTQFI3.js → extract-bind-6MQYKN3G.js} +3 -3
  101. package/dist/{extract-cmd-HG3DHHSL.js → extract-cmd-2RUIWFZG.js} +1 -1
  102. package/dist/{gaps-cmd-XLVUFSTY.js → gaps-cmd-CKCHH3HQ.js} +1 -1
  103. package/dist/{generate-headless-4VJMAHCU.js → generate-headless-TUA3HGRX.js} +2 -2
  104. package/dist/index.js +13 -13
  105. package/dist/ingest-FIIO67ZN.js +2 -0
  106. package/dist/ingest-cmd-CRMY46YC.js +7 -0
  107. package/dist/{interactive-bind-IXFRXBBL.js → interactive-bind-53FCRK34.js} +3 -3
  108. package/dist/{lifecycle-cmd-VTFZ3TF2.js → lifecycle-cmd-32LG364Q.js} +1 -1
  109. package/dist/{list-cmd-KXL4WQII.js → list-cmd-UTZ2PQUK.js} +1 -1
  110. package/dist/{list-commands-BJYJ34HT.js → list-commands-F53ZNYOZ.js} +1 -1
  111. package/dist/{logical-ids-LMBNMENR.js → logical-ids-I7B3VJEH.js} +1 -1
  112. package/dist/login-flow-D7KBR7XR.js +2 -0
  113. package/dist/{maintenance-cmd-UJG4LPWD.js → maintenance-cmd-BZAGSYGI.js} +1 -1
  114. package/dist/{persist-recorded-session-QR7RVAXR.js → persist-recorded-session-5ZFS5SMZ.js} +1 -1
  115. package/dist/pipeline-MX3ZR5B3.js +2 -0
  116. package/dist/readmodel-S5RAQH3F.js +2 -0
  117. package/dist/{reconcile-cmd-E2MMQM7Z.js → reconcile-cmd-4377PWF5.js} +1 -1
  118. package/dist/{recording-banner-QAIKLV6E.js → recording-banner-ZZUF2MGT.js} +1 -1
  119. package/dist/{require-project-folder-OANMHOVE.js → require-project-folder-NQBZFUPF.js} +1 -1
  120. package/dist/{revert-FRXNIP5R.js → revert-RQJE56HF.js} +1 -1
  121. package/dist/{review-cmd-2FCGP55U.js → review-cmd-7LXGYHHQ.js} +1 -1
  122. package/dist/run-2AIQUJ55.js +2 -0
  123. package/dist/run-YH5SCBYD.js +2 -0
  124. package/dist/{run-test-md-5E53A5DT.js → run-test-md-XOSCYVSS.js} +2 -2
  125. package/dist/{skill-installer-LGEIIQ4Q.js → skill-installer-VYIIWAK7.js} +1 -1
  126. package/dist/{spawner-6FHAXNOA.js → spawner-7KXVKAD5.js} +1 -1
  127. package/dist/tcg-generate-U6OCCS2E.js +2 -0
  128. package/dist/{testmd-actions-2OFH5GRJ.js → testmd-actions-RPALXRZK.js} +1 -1
  129. package/dist/token-refresh-S7CYBZTE.js +2 -0
  130. package/dist/{validate-basic-Z46MAH2G.js → validate-basic-LP3S5PK7.js} +1 -1
  131. package/dist/{version-check-64M5JQQ7.js → version-check-XP62HWLJ.js} +1 -1
  132. package/dist/{view-cmd-PG66UQK7.js → view-cmd-GQBFCPDL.js} +1 -1
  133. package/dist/{walk-session-7PM2RXEF.js → walk-session-YIKHE6PT.js} +1 -1
  134. package/package.json +6 -6
  135. package/dist/ChatSurface-PLXUGRBV.js +0 -8
  136. package/dist/SingleShotApp-Z2HGSZXG.js +0 -2
  137. package/dist/TestMdRunView-B4IZHRDT.js +0 -2
  138. package/dist/chat-controller-M4QYRH7Y.js +0 -2
  139. package/dist/chunk-26H3PDVN.js +0 -4
  140. package/dist/chunk-2OQLMW3F.js +0 -7
  141. package/dist/chunk-GLS46X7N.js +0 -5
  142. package/dist/chunk-JHHMXU76.js +0 -2
  143. package/dist/chunk-KFUZYEHX.js +0 -2
  144. package/dist/chunk-ZPENY2Q3.js +0 -4
  145. package/dist/docx-convert-IAX54REO.js +0 -2
  146. package/dist/ingest-UAIKHOB4.js +0 -2
  147. package/dist/ingest-cmd-7HJLRLMG.js +0 -4
  148. package/dist/login-flow-KW5T7WRJ.js +0 -2
  149. package/dist/pipeline-L6V24KGN.js +0 -2
  150. package/dist/readmodel-AGAPK2AI.js +0 -2
  151. package/dist/run-FYJZCWYS.js +0 -2
  152. package/dist/run-IOBBB7GN.js +0 -2
  153. package/dist/tcg-generate-CEDA6DZJ.js +0 -2
  154. package/dist/token-refresh-R75DGT4X.js +0 -2
@@ -0,0 +1,8 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as Lt,b as ae,c as Ot,d as Je}from"./chunk-RGJIRS3B.js";import{a as _t}from"./chunk-IQODWB32.js";import{a as Ae}from"./chunk-7YPK6EDR.js";import{b as Dt,c as Mt}from"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import{a as Bt,b as At,c as Et}from"./chunk-H2W2UNTN.js";import{a as St}from"./chunk-5Y2G4NC7.js";import"./chunk-NVGBE2DR.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import{a as Ct}from"./chunk-YCCUBQY4.js";import{a as It}from"./chunk-QJIJC3KC.js";import{b as Rt}from"./chunk-DFS4RMVP.js";import{y as r}from"./chunk-MMPFU2YC.js";import{a as V}from"./chunk-HCBYKLMW.js";import{a as S,b as n,k as Be}from"./chunk-C44QQJR4.js";import{a as Cn}from"./chunk-6YGTRKDT.js";import{e as U}from"./chunk-UR6MHSHU.js";var k=U(Cn(),1);var c=U(V(),1),Bn=60,An=100;function Ye(e,s){let i=e.options.length,a=i,d=e.multi_select?a++:null,g=e.allow_free_text?a++:null,u=s?a++:null;return{optionCount:i,doneIdx:d,freeIdx:g,batchIdx:u,maxSel:a-1}}var En="\xA0",Dn={high:{text:`\u203C${En}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Mn(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Ln(e,s,i){let a=m=>e[m].length+6,d=a(s),g=s,u=s;for(;;){let m=u+1<e.length?a(u+1):1/0,h=g-1>=0?a(g-1):1/0;if(m===1/0&&h===1/0)break;if(m<=h){if(d+m>i)break;d+=m,u+=1}else{if(d+h>i)break;d+=h,g-=1}}return{lo:g,hi:u}}function Pt({batch:e,qView:s,sel:i=0,focused:a=!1,freeText:d=null,multiSelFor:g}){let{stdout:u}=Be(),m=u?.columns??80,h=m<Bn,I=Math.min(m-1,An),f=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),p=e.questions[f],L=e.resolution[f],A=e.resolution.filter(F=>!F).length,w=e.questions.length-A,R=Ae(e),C=Ye(p,R!==""),v=g?g(f):[],E=Dn[p.risk],x=F=>a&&i===F?(0,c.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",N=`? the agent needs ${A===1?"one answer":`${A} answers`}`,_=e.questions.length>1?` \xB7 ${f+1} of ${e.questions.length} \xB7 ${w} answered`:"",q=(0,c.jsxs)(S,{flexDirection:"column",children:[(0,c.jsx)(S,{paddingLeft:2,children:(0,c.jsxs)(n,{bold:!0,children:[p.text,E?(0,c.jsx)(n,{color:E.color,bold:!1,children:` ${E.text}`}):null]})}),(0,c.jsx)(S,{paddingLeft:2,children:(0,c.jsx)(n,{color:r.dim,children:p.rationale})}),(0,c.jsx)(n,{children:" "}),p.options.map((F,O)=>{let H=a&&i===O;return(0,c.jsxs)(S,{flexDirection:"column",children:[(0,c.jsxs)(n,{children:[x(O)," ",p.multi_select?(0,c.jsx)(n,{color:v.includes(O)?r.green:r.dim,children:v.includes(O)?"[x] ":"[ ] "}):null,(0,c.jsx)(n,{color:H?r.assuranceAccent:void 0,children:`${O+1}. ${F.label}`}),O===p.recommended_index?(0,c.jsx)(n,{color:r.dim,children:" (recommended)"}):null,L?.selected_index===O?(0,c.jsx)(n,{color:r.dim,children:" (current)"}):null]}),F.detail?(0,c.jsx)(S,{paddingLeft:5,children:(0,c.jsx)(n,{color:r.dim,children:F.detail})}):null]},`o-${O}`)}),p.multi_select&&C.doneIdx!=null?(0,c.jsxs)(n,{children:[x(C.doneIdx)," ",(0,c.jsx)(n,{color:r.green,children:"\u2714"}),(0,c.jsx)(n,{color:a&&i===C.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,p.allow_free_text?(0,c.jsx)(n,{children:" "}):null,p.allow_free_text?d?(0,c.jsxs)(S,{children:[(0,c.jsxs)(n,{children:[(0,c.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,c.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,c.jsx)(Ct,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"Tell me what to do"})]}):(0,c.jsxs)(n,{children:[C.freeIdx!=null?x(C.freeIdx):" "," ",(0,c.jsx)(n,{color:a&&C.freeIdx!=null&&i===C.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null]}),de=R!==""?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n,{children:" "}),(0,c.jsxs)(n,{children:[a&&C.batchIdx!=null&&i===C.batchIdx?(0,c.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,c.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,c.jsx)(n,{bold:!0,color:a&&C.batchIdx!=null&&i===C.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),A>=5?(0,c.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${A} open`}):null,(0,c.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(h)return(0,c.jsxs)(S,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,c.jsx)(n,{color:r.assuranceAccent,bold:!0,children:N}),e.questions.length>1?(0,c.jsx)(n,{color:r.dim,children:_.replace(/^ · /,"")}):null,(0,c.jsx)(n,{children:" "}),q,de,(0,c.jsx)(S,{paddingLeft:2,children:(0,c.jsx)(n,{color:r.muted,children:"\u2191\u2193 \u23CE \xB7 \u2190 \u2192 questions \xB7 esc back"})})]});let _e=`\u2500\u2500 ${N}${_} `,Oe=Math.max(2,I-_e.length),me="\u2191\u2193 select \xB7 \u23CE confirm \xB7 \u2190 \u2192 questions \xB7 type = your words \xB7 esc back",ge=`\u2500\u2500 ${me} `,te=Math.max(2,I-ge.length),K=e.questions.map(F=>Mn(F)),D=e.questions.length>1?Ln(K,f,I-8):null;return(0,c.jsxs)(S,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,c.jsxs)(n,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,c.jsx)(n,{bold:!0,children:N}),_?(0,c.jsx)(n,{color:r.dim,children:_}):null,` ${"\u2500".repeat(Oe)}`]}),D?(0,c.jsx)(S,{marginTop:1,children:(0,c.jsxs)(n,{children:[D.lo>0?(0,c.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",e.questions.slice(D.lo,D.hi+1).map((F,O)=>{let H=D.lo+O,we=O>0?" ":"";return H===f?(0,c.jsxs)(n,{children:[we,(0,c.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${K[H]} `})]},F.id):(0,c.jsxs)(n,{children:[we,e.resolution[H]?(0,c.jsxs)(n,{children:[(0,c.jsx)(n,{color:r.green,children:"\u2713 "}),(0,c.jsx)(n,{color:r.dim,children:K[H]})]}):(0,c.jsx)(n,{color:r.dim,children:`\u25CB ${K[H]}`})]},F.id)}),D.hi<e.questions.length-1?(0,c.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,c.jsx)(n,{children:" "}),q,de,(0,c.jsx)(n,{children:" "}),(0,c.jsxs)(n,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,c.jsx)(n,{color:r.muted,children:me}),` ${"\u2500".repeat(te)}`]})]})}var M=U(V(),1),qt={high:0,med:1,low:2},_n={high:r.red,med:"yellow",low:r.dim};function On(e){return e.map((s,i)=>({r:s,i})).sort((s,i)=>(qt[s.r.risk??"zz"]??3)-(qt[i.r.risk??"zz"]??3)||s.i-i.i).map(({r:s})=>s)}var ne=(e,s)=>e.length<=s?e:s<=1?"\u2026":`${e.slice(0,s-1)}\u2026`,Ee=(e,s)=>e+" ".repeat(Math.max(0,s-e.length));function Ft({rows:e,width:s=120,badgeHeader:i="risk"}){if(e.length===0)return null;let a=On(e),d=v=>v.staged||!v.id?"(staged)":_t(v.id),g=Math.max(2,...a.map(v=>d(v).length)),u=Math.max(i.length,...a.map(v=>(v.badge??"").length)),m=s>=96&&a.some(v=>v.summary),I=s-(m?13:10)-g-u,f=Math.max(...a.map(v=>Math.max(v.title.length,(v.marker??"").length)),5),p=Math.max(5,m?Math.min(f,Math.max(16,Math.floor(I*.5))):Math.min(f,I)),L=m?Math.max(7,I-p):0,A=(v,E,x,N)=>v+N.map(_=>`\u2500${"\u2500".repeat(_.length)}\u2500`).join(E)+x,w=(v,E,x,N)=>[Ee(ne(v,g),g),Ee(ne(E,p),p),Ee(ne(x,u),u),...m?[Ee(ne(N,L),L)]:[]],R=w("id","title",i,"summary"),C=[];C.push((0,M.jsx)(n,{color:r.dim,children:A("\u250C","\u252C","\u2510",R)},"t")),C.push((0,M.jsxs)(n,{children:[R.map((v,E)=>(0,M.jsxs)(n,{children:[(0,M.jsx)(n,{color:r.dim,children:E===0?"\u2502 ":" \u2502 "}),(0,M.jsx)(n,{bold:!0,children:v})]},E)),(0,M.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),C.push((0,M.jsx)(n,{color:r.dim,children:A("\u251C","\u253C","\u2524",R)},"m"));for(let[v,E]of a.entries()){let x=w(d(E),ne(E.title,p),ne(E.badge??"",u),ne(E.summary??"",L)),N=E.badgeColor??_n[E.badge??""]??r.dim;if(C.push((0,M.jsxs)(n,{children:[(0,M.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,M.jsx)(n,{color:r.assuranceAccent,children:x[0]}),(0,M.jsx)(n,{color:r.dim,children:" \u2502 "}),x[1],(0,M.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,M.jsx)(n,{color:N,children:x[2]}),m?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(n,{color:r.dim,children:" \u2502 "}),x[3]]}):null,(0,M.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${v}`)),E.marker){let _=w("",ne(E.marker,p),"","");C.push((0,M.jsx)(n,{color:r.dim,children:`\u2502 ${_.join(" \u2502 ")} \u2502`},`mk-${v}`))}}return C.push((0,M.jsx)(n,{color:r.dim,children:A("\u2514","\u2534","\u2518",R)},"b")),(0,M.jsx)(M.Fragment,{children:C})}var Pn={"use-case":"use-cases",ac:"ACs",scenario:"scenarios",test:"tests",gap:"gaps"},ee=e=>Pn[e]??`${e}s`,Nt=e=>e==="ac"?"AC":e==="use-case"?"use-case":e,Ze=e=>e.kind??"use-case",Wt=e=>`${Ze(e)}:${e.temp_ref}`;function jt(e){let s=e,i=s.badge??e.risk??null,a=s.why??e.summary??e.description??null;return JSON.stringify([e.title,i,a,s.extra??null,e.depends_on_hint??null])}function Ut(e){return e.filter(s=>s.role==="agent"&&typeof s.turnIndex=="number"&&Array.isArray(s.items)&&s.items.length>0)}function se(e){let s=new Map,i=1;for(let g of Ut(e)){let u=new Set;for(let m of g.items){let h=Wt(m);if(u.has(h))continue;u.add(h);let I=s.get(h);s.set(h,{num:I?.num??i++,ref:m.temp_ref,kind:Ze(m),item:m,turnIndex:g.turnIndex,fingerprint:jt(m)})}}let a=[...s.values()].sort((g,u)=>g.num-u.num),d=[];for(let g of a){let u=d.find(m=>m.kind===g.kind);u?u.count++:d.push({kind:g.kind,label:ee(g.kind),count:1})}return{entries:a,byRef:s,counts:d}}function Vt(e,s){let a=Ut(e).find(w=>w.turnIndex===s);if(!a)return null;let d=e.filter(w=>w.role!=="agent"||typeof w.turnIndex!="number"||w.turnIndex<=s),g=se(d),u=se(e.filter(w=>w.role!=="agent"||typeof w.turnIndex!="number"||w.turnIndex<s)),m=[],h=new Map,I=new Map,f=new Map,p=new Set;for(let w of a.items){let R=Wt(w);if(p.has(R))continue;p.add(R);let C=u.byRef.get(R),v=w.changed===!0,E=g.byRef.get(R).num,x=Ze(w);if(C&&!v&&C.fingerprint===jt(w)){h.set(x,(h.get(x)??0)+1);continue}let N=!!C||v,_=N?f:I;_.set(x,(_.get(x)??0)+1),m.push({item:w,num:E,updated:N})}let L=[...h.entries()].map(([w,R])=>({label:ee(w),count:R})),A=[...[...I.entries()].map(([w,R])=>`${R} new ${R===1?Nt(w):ee(w)}`),...[...f.entries()].map(([w,R])=>`${R} updated ${R===1?Nt(w):ee(w)}`)].join(" \xB7 ");return{fresh:m,unchanged:L,headerStats:A}}function et(e,s){let i=e.entries.filter(g=>g.turnIndex===s);if(i.length===0)return e;let a=new Map(i.map(g=>[g.ref,g])),d=[];for(let g of i){let u=d.find(m=>m.kind===g.kind);u?u.count+=1:d.push({kind:g.kind,label:ee(g.kind),count:1})}return{entries:i,byRef:a,counts:d}}var b=U(V(),1);function qn(e){let s=e.form==="assumed"?" (flagged)":e.form==="deferred"?"":" (you)",i=e.note?` \u2014 ${e.note}`:"";return e.form==="deferred"?`\u21B3 deferred q${e.qNum} ${e.stub}${i}`:e.form==="changed"?`\u21B3 changed q${e.qNum} ${e.stub}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${s}${i}`:`\u21B3 ${e.form} q${e.qNum} ${e.stub}: ${e.choice??"?"}${s}${i}`}var Fn=Math.min(process.stdout?.columns??100,120)-2;function Kt({block:e,annotations:s}){switch(e.kind){case"banner":return(0,b.jsx)(S,{marginTop:1,children:(0,b.jsx)(n,{color:r.dim,children:` \u2500\u2500 ${e.text} \u2500\u2500`})});case"user":return(0,b.jsxs)(S,{marginTop:1,children:[(0,b.jsx)(n,{color:r.orange,children:"\u276F "}),(0,b.jsx)(n,{children:e.text})]});case"note":return(0,b.jsx)(n,{color:r.dim,children:` ${e.text}`});case"agent":return(0,b.jsx)(S,{marginTop:1,children:(0,b.jsx)(At,{text:e.text,accent:r.assuranceAccent})});case"thinking":return(0,b.jsx)(S,{marginTop:1,children:(0,b.jsx)(n,{color:r.dim,children:` thought for ${(e.tookMs/1e3).toFixed(1)}s`})});case"tool":return(0,b.jsx)(n,{color:r.dim,children:` ${Dt({name:e.name,status:e.status==="ok"?"done":e.status,detail:e.detail})}`});case"usage":return(0,b.jsx)(n,{color:r.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let i=s??null,a=i?i.fresh:e.items.map((f,p)=>({item:f,num:p+1,updated:!1})),d={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},g=f=>f.kind??"use-case",u=new Map;for(let f of a){let p=f.item,L=g(f.item),A=p.risk==="high"||p.risk==="med"||p.risk==="low"?p.risk:void 0,w={id:p.logical_id??"",staged:!p.logical_id,title:p.title,badge:p.badge??p.risk??"",summary:p.why??p.summary??p.description??"",...A?{risk:A}:{},...f.updated?{marker:"\u21B3 changed"}:{}},R=u.get(L)??[];R.push(w),u.set(L,R)}let m=a.some(f=>!!f.item.kind),h=(i?.unchanged??[]).reduce((f,p)=>f+p.count,0),I=i?.headerStats?` \u2014 ${i.headerStats}${h>0?` (${h} unchanged)`:""}`:"";return(0,b.jsxs)(S,{flexDirection:"column",marginLeft:2,children:[(0,b.jsxs)(n,{bold:!0,children:[m?"design":e.heading,I?(0,b.jsx)(n,{bold:!1,color:r.dim,children:I}):null]}),[...u.entries()].map(([f,p])=>(0,b.jsxs)(S,{flexDirection:"column",children:[u.size>1?(0,b.jsx)(n,{color:r.dim,children:`${ee(f)} \xB7 ${p.length}`}):null,(0,b.jsx)(Ft,{rows:p,width:Fn,badgeHeader:d[f]??"info"})]},f)),i&&i.unchanged.length>0&&(0,b.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${i.unchanged.map(f=>`${f.count} ${f.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,b.jsx)(n,{color:r.dim,children:qn(e.receipt)});case"continued":return(0,b.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"commit":return(0,b.jsxs)(S,{flexDirection:"column",children:[(0,b.jsx)(n,{color:e.ok?r.green:r.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),(e.warnings??[]).map((i,a)=>(0,b.jsx)(n,{color:r.dim,children:` \u26A0 ${i}`},`w-${a}`))]});case"error":return(0,b.jsxs)(It,{variant:"error",paddingX:1,children:[(0,b.jsx)(n,{color:r.red,children:e.title}),e.detail.map((i,a)=>(0,b.jsx)(n,{color:r.dim,children:i},`d-${a}`))]});case"interrupted":return(0,b.jsxs)(S,{flexDirection:"column",children:[(0,b.jsx)(n,{color:r.red,children:"interrupted \u2014 session not saved"}),e.detail?(0,b.jsx)(n,{color:r.dim,children:e.detail}):null]});case"pause":return(0,b.jsxs)(S,{flexDirection:"column",children:[(0,b.jsx)(n,{children:`paused: session ${e.sid} saved`}),e.expires_at?(0,b.jsx)(n,{color:r.dim,children:`expires: ${e.expires_at}`}):null,(0,b.jsx)(n,{children:`resume: ${e.resume}`}),e.messageForm?(0,b.jsx)(n,{children:`or say something on the way in: ${e.messageForm}`}):null]});case"summary":return(0,b.jsxs)(S,{flexDirection:"column",children:[(0,b.jsx)(n,{bold:!0,children:"session summary"}),e.lines.map((i,a)=>(0,b.jsx)(n,{children:` ${i}`},`s-${a}`))]})}}var ue=U(V(),1);function Qt({item:e}){return(0,ue.jsxs)(S,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,i)=>(0,ue.jsx)(n,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${i}`)),(e.depends_on_hint??[]).length>0&&(0,ue.jsx)(n,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,i])=>(0,ue.jsx)(n,{dimColor:!0,children:`${s}: ${i}`},`extra-${s}`))]})}var $=U(V(),1),tt=(e,s)=>Math.max(0,Math.min(s,e));function Me(e,s,i){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:tt(e.cursor+s.delta,Math.max(0,i-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Xt={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function zt(e,s){if(e.level==="detail")return{level:"detail",cursor:tt(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let i=s.entries.findIndex(a=>Xt[a.kind]===e.section);if(i>=0)return{level:"list",cursor:i}}return{level:"list",cursor:0}}function Nn(e){let s=[];for(let i of e.entries){let a=s.find(d=>d.kind===i.kind);a?a.entries.push(i):s.push({kind:i.kind,entries:[i]})}return s}var Ht=3;function Wn({items:e,cursor:s,verb:i,more:a}){let d=`view \xB7 ${i} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,g=e.entries[s];return(0,$.jsxs)(S,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,$.jsx)(n,{bold:!0,children:d}),Nn(e).map(({kind:u,entries:m})=>{let h=g?.kind===u,I=h?m.findIndex(A=>A.ref===g.ref):-1,f=h?tt(I-1,Math.max(0,m.length-Ht)):0,p=m.slice(f,f+(h?Ht:1)),L=m.length-p.length;return(0,$.jsxs)(S,{flexDirection:"column",children:[(0,$.jsx)(n,{color:r.dim,children:`${Xt[u]??ee(u)} \xB7 ${m.length}`}),p.map(A=>{let w=h&&A.ref===g.ref,R=A.item.badge;return(0,$.jsxs)(n,{children:[(0,$.jsx)(n,{color:r.assuranceAccent,children:w?"\u203A ":" "}),(0,$.jsx)(n,{children:`${A.num} \xB7 ${A.item.title}`}),R?(0,$.jsx)(n,{color:r.dim,children:` \xB7 ${R}`}):null]},`${A.kind}:${A.ref}`)}),L>0&&(0,$.jsx)(n,{color:r.dim,children:` \u22EE ${L} more`})]},u)}),a?(0,$.jsxs)(n,{children:[(0,$.jsx)(n,{color:r.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,$.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${a.hidden} more from earlier turns`})]}):null,(0,$.jsx)(n,{color:r.dim,children:"\u2191\u2193 move \xB7 \u21B5 detail \xB7 esc back"})]})}var De=14;function jn({items:e,cursor:s,explain:i,grandTotal:a,dossier:d,scroll:g=0}){let u=e.entries[s];if(!u)return(0,$.jsx)(n,{color:r.dim,children:"nothing to show"});if(d){let h=Math.max(0,Math.min(g,Math.max(0,d.lines.length-De))),I=d.lines.slice(h,h+De);return(0,$.jsxs)(S,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,$.jsxs)(n,{bold:!0,children:[`view \xB7 ${d.id}`,d.id.toLowerCase()!==d.rawId?(0,$.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${d.rawId}`}):null]}),(0,$.jsx)(n,{bold:!0,children:d.title}),h>0?(0,$.jsx)(n,{color:r.muted,children:`\u22EE ${h} above`}):null,I.map((f,p)=>(0,$.jsx)(n,{color:f.dim?r.dim:void 0,children:f.text},`dl-${p}`)),d.lines.length>h+De?(0,$.jsx)(n,{color:r.muted,children:`\u22EE ${d.lines.length-h-De} more`}):null,(0,$.jsx)(n,{color:r.dim,children:"\u2191\u2193 scroll \xB7 esc back"})]})}let m=u.item;return(0,$.jsxs)(S,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,$.jsx)(n,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${a??e.entries.length}`}),(0,$.jsx)(n,{children:u.item.title}),m.badge?(0,$.jsx)(n,{color:r.dim,children:`kind: ${m.badge}`}):null,m.why?(0,$.jsx)(n,{color:r.dim,children:m.why}):null,(0,$.jsx)(Qt,{item:u.item}),i?.map((h,I)=>(0,$.jsx)(n,{color:r.dim,children:h},`ex-${I}`)),(0,$.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"}),(0,$.jsx)(n,{color:r.dim,children:"\u2191\u2193 prev/next \xB7 esc back to list"})]})}function Gt({items:e,state:s,verb:i,more:a,explain:d,grandTotal:g,dossier:u=null}){return s.level==="list"?(0,$.jsx)(Wn,{items:e,cursor:s.cursor,verb:i,more:a}):(0,$.jsx)(jn,{items:e,cursor:s.cursor,explain:d,grandTotal:g,dossier:u,scroll:s.scroll??0})}var Un={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function Jt(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let a=parseInt(s,10);return a>=1?{level:"detail",num:a}:{error:"items are numbered from 1 \u2014 /view 1"}}let i=Un[s];return i?{level:"list",section:i}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var B=U(V(),1),Vn=6,Yt=12;function Kn(e,s,i){let a=Math.max(20,s),d=[];for(let u of e.split(`
3
+ `)){if(u.length<=a){d.push(u);continue}let m="";for(let h of u.split(" "))m&&m.length+1+h.length>a?(d.push(m),m=h):m=m?`${m} ${h}`:h;d.push(m)}let g=Math.max(0,d.length-i);return{body:d.slice(-i).join(`
4
+ `),hidden:g}}var Le=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Zt(e){let s={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},i={key:"keep",label:"keep the existing design",detail:"back to the list"};return e.designed==="stale"?[{...s,detail:"the use-case changed since it was designed"},i]:[i,s]}function _r({controller:e,verb:s="extract",onCtrlC:i,chain:a=null,inspect:d=null}){let[,g]=(0,k.useState)(0),[u,m]=(0,k.useState)(!1),[h,I]=(0,k.useState)(null),[f,p]=(0,k.useState)(null),L=(0,k.useRef)(null),[A,w]=(0,k.useState)(null),R=(0,k.useRef)(null),C=t=>{R.current=t,w(t)},v=t=>{L.current=t,p(t),t===null&&C(null)},E=(0,k.useRef)([]),[x,N]=(0,k.useState)(null),_=(0,k.useRef)(null),q=t=>{_.current=t,N(t)},de=Rt(),{stdout:_e}=Be(),Oe=_e?.columns??80,me=(0,k.useRef)(0),ge=(0,k.useRef)(0);(0,k.useEffect)(()=>{let t=()=>{let o=e.state.ledger;for(let y=me.current;y<o.length;y++){let T=o[y],P=T.kind==="turn"?Vt(e.state.turns,T.turnIndex):void 0;de.append((0,B.jsx)(Kt,{block:T,annotations:P},`lg-${y}`))}me.current=o.length};t();let l=e.subscribe(()=>{t();let o=e.state;L.current&&(o.pending||o.status==="pausing")&&(v(null),o.pending&&I("questions arrived \u2014 back to chat")),g(y=>y+1)});return g(o=>o+1),l},[e,de]);let{thinking:te,status:K,pending:D,confirm:F,ledger:O,activeTurn:H,stream:we,notice:$e}=e.state,nt=(we?.text??"").trimEnd(),rt=nt.length>0,en=u&&(te.liveThinking.length>0||te.thinkingLog.length>0),tn=Kn(te.liveThinking||te.thinkingLog.map(t=>t.text).join(`
5
+ `),Oe-6,Yt),st=rt?nt.split(`
6
+ `).slice(-Vn):[];H&&(ge.current=H.turnIndex);let nn=D?D.resolution.filter(t=>!t).length:0,it;for(let t=O.length-1;t>=0;t--){if(E.current.some(o=>o.end!=null&&t>=o.start&&t<o.end))continue;let l=O[t];if(l.kind==="banner"&&!l.text.startsWith("kane")){it=l.text;break}}let fe=te.activity[te.activity.length-1],Pe=fe?fe.status==="decision"?fe.label:Mt({name:fe.name,status:fe.status}):void 0,ot=K==="streaming"||K==="working",[lt,rn]=(0,k.useState)(0);St(()=>rn(t=>t+1),ot||x?.kind==="running"?120:null);let sn=e.state.busySince?Math.floor((Date.now()-e.state.busySince)/1e3):0,on=rt?"Writing\u2026":Pe?`${Pe.charAt(0).toUpperCase()}${Pe.slice(1)}\u2026`:e.state.workingLabel??(s==="design"?"Designing\u2026":"Thinking\u2026"),ln=e.state.turns.some(t=>t.role==="agent"),[cn,an]=(0,k.useState)(0),[un,dn]=(0,k.useState)(!1),[ct,mn]=(0,k.useState)(null),pe=(0,k.useRef)(0),at=(0,k.useRef)(!1),ut=(0,k.useRef)(null),he=t=>{pe.current=t,an(t)},dt=t=>{at.current=t,dn(t)},ie=t=>{ut.current=t,mn(t)},[qe,gn]=(0,k.useState)(0),Q=(0,k.useRef)(0),xe=t=>{Q.current=t,gn(t)},mt=D?D.questions[0]?.id??"b":null;(0,k.useEffect)(()=>{D&&xe(D.cursor<0?0:D.cursor)},[mt,D?.cursor]);let Fe=()=>{let t=z.current;if(!t)return;let l=t.questions.length;for(let o=1;o<=l;o++){let y=(Q.current+o)%l;if(!t.resolution[y]){xe(y);return}}},gt=D?D.questions[Math.max(0,Math.min(D.questions.length-1,qe))]:void 0,X=(0,k.useRef)(gt);X.current=gt;let z=(0,k.useRef)(D);z.current=D;let fn=D?`${mt}:${qe}`:null;(0,k.useEffect)(()=>{if(ie(null),X.current){dt(!0);let t=z.current?.resolution[Q.current]?.selected_index;he(t??X.current.recommended_index??0)}else dt(!1)},[fn]);let ve=t=>{let l=z.current;return Ye(t,l?Ae(l)!=="":!1)},pn={isFocused:()=>at.current&&X.current!=null&&ut.current==null||_.current!=null&&_.current.kind!=="running"||G.current&&$t.current==null,onMove:t=>{let l=X.current;if(l){he(Math.max(0,Math.min(ve(l).maxSel,pe.current+t)));return}let o=_.current;if(o?.kind==="picker"){q({...o,sel:Math.max(0,Math.min(o.items.length-1,o.sel+t))});return}if(o?.kind==="ask"||o?.kind==="confirm"||o?.kind==="failed"){let y=(o.kind==="ask"?Ie.current.length:o.kind==="failed"?Re.current.length:2)-1;q({...o,sel:Math.max(0,Math.min(y,o.sel+t))});return}o&&!G.current||G.current&&le(Math.max(0,Math.min(Te.current.length-1,ze.current+t)))},onSelect:()=>{let t=X.current,l=z.current;if(!t||!l){let T=_.current;if(T?.kind==="picker"){let W=T.items[T.sel];W&&(W.designed?q({kind:"confirm",item:W,sel:0}):Ke(W,!1));return}if(T?.kind==="confirm"){Zt(T.item)[T.sel]?.key==="redesign"?Ke(T.item,!0):Ve();return}if(T?.kind==="ask"){let W=Ie.current[T.sel]?.key;W==="another"?Ve():W==="view"?Ge(""):q(null);return}if(T?.kind==="failed"){let W=Re.current[T.sel]?.key;W==="retry"?Ke(T.item,T.force):W==="view"?Ge(""):q(null);return}if(T&&!G.current||!G.current)return;switch(Te.current[ze.current]?.key){case"finish":e.completeSession();return;case"continue":e.continueParked();return;case"design-chain":Ve();return;case"view":Ge("",ge.current);return;case"free":ce("");return}return}let o=ve(t),y=pe.current;if(o.batchIdx!=null&&y===o.batchIdx){e.goWithRecommendations();return}if(o.freeIdx!=null&&y===o.freeIdx){ie("");return}if(o.doneIdx!=null&&y===o.doneIdx){e.confirmMulti(Q.current),Fe();return}if(t.multi_select){e.toggleOption(Q.current,y);return}e.submitAnswer(Q.current,y),Fe()},onLeft:()=>{z.current&&xe(Math.max(0,Q.current-1))},onRight:()=>{let t=z.current;t&&xe(Math.min(t.questions.length-1,Q.current+1))},onDigit:t=>{let l=X.current;if(l){t-1<l.options.length&&he(t-1);return}let o=_.current;if(o?.kind==="picker"){t-1<o.items.length&&q({...o,sel:t-1});return}if(o?.kind==="ask"){t-1<Ie.current.length&&q({...o,sel:t-1});return}if(o?.kind==="failed"){t-1<Re.current.length&&q({...o,sel:t-1});return}if(o?.kind==="confirm"){t-1<2&&q({...o,sel:t-1});return}if(!(o&&!G.current)&&G.current){let y=Te.current,T=0;for(let P=0;P<y.length;P++)if(!y[P].free&&(T+=1,T===t)){le(P);return}}},isMulti:()=>{let t=X.current;return!!t?.multi_select&&pe.current<(t?.options.length??0)},onSpace:()=>{z.current&&e.toggleOption(Q.current,pe.current)},onTab:()=>{let t=X.current;if(!t)return;let l=ve(t);l.batchIdx!=null&&he(l.batchIdx)},onType:t=>{let l=X.current;if(l){if(!l.allow_free_text)return;let o=ve(l);he(o.freeIdx??0),ie(t);return}if(!(_.current&&!G.current)&&G.current){let o=Lt(Te.current);if(o==null)return;le(o),ce(t)}},onBack:()=>{let t=_.current;if(t&&t.kind!=="running"){q(null);return}let l=z.current;if(l){for(let o=Q.current-1;o>=0;o--)if(l.resolution[o]){xe(o);return}}}},hn=ct!=null?{value:ct,onChange:t=>ie(t),onSubmit:t=>{ie(null),t.trim()&&z.current&&(e.submitFreeText(Q.current,t),Fe())},onCancel:()=>ie(null)}:null,ft=i??(()=>e.requestPause()),re=e.state.checkpoint,ke=x?.kind==="running"&&K==="idle",be=K==="idle"&&ln&&!D&&!f&&(!x||ke),G=(0,k.useRef)(!1);G.current=be;let J=se(e.state.turns).entries.length,ye,Y;for(let t=O.length-1;t>=0;t--){if(E.current.some(o=>o.end!=null&&t>=o.start&&t<o.end))continue;let l=O[t];if(!ye&&l.kind==="commit"&&l.ok&&(ye=l.line),!Y&&l.kind==="banner"&&l.text.startsWith("designing: ")&&(Y=l.text.slice(11)),ye&&Y)break}let Ne;for(let t=O.length-1;t>=0;t--){let l=O[t];if(l.kind==="user")break;if(l.kind==="commit"&&l.ok&&/\bapplied\b/.test(l.line)){Ne=l.line;break}}let Z=Y?{"acceptance criteria":"scenarios",scenarios:"acceptance criteria + exercises","acceptance criteria + exercises":"tests + gaps"}[Y]:void 0,pt={"acceptance criteria":"the promises every path of this use-case must keep",scenarios:"the concrete user journeys that exercise those promises","acceptance criteria + exercises":"the wiring pass \u2014 per-journey checks, tied to the promises each journey exercises","tests + gaps":"runnable browser tests \u2014 anything unautomatable is recorded as a gap"},ht=Y?pt[Y]:void 0,xt=Z?pt[Z]:void 0,xn="phases: acceptance criteria \u2192 scenarios \u2192 wiring \u2192 tests \xB7 stop anytime with finish",kn=(()=>{for(let t=O.length-1;t>=0;t--){let l=O[t];if(l.kind==="agent")return l.text}return null})(),oe=/\?\s*$/.test((kn??"").trimEnd()),kt=s==="design"&&!re&&(oe||Z!==void 0),bt=Y==="tests + gaps",Se=x?.kind==="running"?x.title:"the design",yt=!!e.state.error&&!e.senderAlive(),bn=F?"the agent needs a clarification before it can apply that":ke&&!re?oe?`${Se} \u2014 the agent asked a question`:Ne?`${Se} \u2014 ${Ne}`:bt?`${Se} \u2014 design complete`:`${Se} \u2014 the agent is waiting on you`:re?Y?`${Y} done${Z?` \u2014 next: ${Z}`:""}`:ye??"phase done":yt?"the agent stopped \u2014 the session is view-only":kt?oe?"the agent asked a question \u2014 answer or continue":`design incomplete \u2014 ${Z} not started`:ye??"waiting on you",We=F?[{key:"free",label:"clarify \u2014 type which one you meant",free:!0}]:ke&&!re?bt&&!oe?[{key:"finish",label:"finish this design"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:[{key:"continue",label:oe?"continue \u2014 go with your suggestion":"continue designing"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"finish",label:"finish this design"},{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:re?[{key:"continue",label:Z?`continue to ${Z}`:"continue"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"finish",label:"finish here"},{key:"free",label:"adjust \u2014 tell me what to change",free:!0}]:yt?[...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"tell me what to change",free:!0}]:kt?[{key:"continue",label:oe?"continue \u2014 go with your suggestion":`continue \u2014 ${Z} next`},...J>0?[{key:"view",label:"view the design"}]:[],{key:"finish",label:"finish anyway"},{key:"free",label:"reply \u2014 answer and continue",free:!0}]:[{key:"finish",label:s==="design"?"finish":"looks good \u2014 finish the session"},...a?[{key:"design-chain",label:"design tests for a use-case\u2026"}]:[],...J>0?[{key:"view",label:s==="design"?"view the design":`view the ${J} draft${J===1?"":"s"}`}]:[],{key:"free",label:s==="design"?"keep adjusting \u2014 tell me what to change":"tell me what to change",free:!0}],je=[{key:"another",label:"design another use-case\u2026"},...J>0?[{key:"view",label:"view what was designed"}]:[],{key:"back",label:"done \u2014 back"}],Ie=(0,k.useRef)(je);Ie.current=je;let Ue=[{key:"retry",label:"try again"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"back",label:"back"}],Re=(0,k.useRef)(Ue);Re.current=Ue;let Ve=()=>{let t=a?.listUcs()??[];if(t.length===0){I("no use-cases to design yet");return}q({kind:"picker",items:t,sel:0})},Ke=(t,l)=>{let o={start:e.state.ledger.length,end:null};E.current.push(o);let y=()=>{o.end=e.state.ledger.length};q({kind:"running",title:t.title,item:t,force:l,startedAt:Date.now()}),a.runDesignChild(t.key,l).then(T=>{y(),T===0?(e.ledger({kind:"commit",ok:!0,line:`designed ${t.title}`}),q({kind:"ask",title:t.title,sel:0})):(e.ledger({kind:"commit",ok:!1,line:`design for ${t.title} failed \u2014 child exited ${T}`}),q({kind:"failed",item:t,force:l,detail:`child exited ${T}`,sel:0}))}).catch(T=>{y();let P=T instanceof Error?T.message:String(T);e.ledger({kind:"commit",ok:!1,line:`design for ${t.title} failed \u2014 ${P}`}),q({kind:"failed",item:t,force:l,detail:P,sel:0})})},Te=(0,k.useRef)(We);Te.current=We;let Qe=be&&re&&ht!==void 0,He=E.current.find(t=>t.end==null)?.start??"top",Tt=(0,k.useRef)(new Set),[yn,wt]=(0,k.useState)(!1);(0,k.useEffect)(()=>{Qe?Tt.current.has(He)||(Tt.current.add(He),wt(!0)):wt(!1)},[Qe,He]);let Tn=Qe?[...yn?[xn]:[],`${ht}${xt?` \xB7 next: ${xt}`:""}`]:[],[wn,$n]=(0,k.useState)(0),[Xe,vn]=(0,k.useState)(null),ze=(0,k.useRef)(0),$t=(0,k.useRef)(null),le=t=>{ze.current=t,$n(t)},ce=t=>{$t.current=t,vn(t)},Sn=`${be}:${re}:${ge.current}`;(0,k.useEffect)(()=>{le(0),ce(null)},[Sn]);let In=Xe!=null?{value:Xe,onChange:t=>ce(t),onSubmit:t=>{ce(null),le(0);let l=t.trim();l&&(I(null),e.submit(l))},onCancel:()=>{ce(null),le(0)}}:null,Ge=(t,l)=>{if(/^(uc|sc|ac|t|gap|sty)-\d+$/i.test(t.trim())){let P=t.trim().toLowerCase(),Ce=se(e.state.turns).entries.findIndex(j=>(j.item.logical_id??"").toLowerCase()===P);if(Ce<0){I(`${t.trim().toUpperCase()} isn't in this session's items \u2014 view lists what this session minted`);return}v({level:"detail",cursor:Ce,scroll:0}),C(null);return}let o=Jt(t);if("error"in o){I(o.error);return}let y=se(e.state.turns);if(y.entries.length===0){I("nothing proposed yet \u2014 the first turn is still coming");return}if(o.level==="detail"&&o.num>y.entries.length){I(`no item ${o.num} \u2014 the set has ${y.entries.length} item${y.entries.length===1?"":"s"}`);return}let T=l!=null?et(y,l):y;v(zt(o,T)),C(l!=null&&T.entries.length<y.entries.length?l:null)},vt=(0,B.jsx)(Ot,{verb:s,subject:it,pendingCount:nn,creditsTotal:e.state.credits?.total,state:ke?"waiting on you":D||be||f||x&&x.kind!=="running"?"idle":void 0});if(f){let t=se(e.state.turns),l=A!=null?et(t,A):t,o=t.entries.length-l.entries.length,y=f.level==="list"&&o>0,T=l.entries.length+(y?1:0),P=l.entries[f.cursor],W=f.level==="detail"&&P?e.explainLines(P.item.slug??P.item.temp_ref):null,Ce=f.level==="detail"&&P&&d?d(P.item.logical_id??e.aliasOf(P.item.temp_ref)??P.item.temp_ref):null;return(0,B.jsxs)(S,{flexDirection:"column",children:[(0,B.jsx)(Je,{onToggleThinking:()=>m(j=>!j),onCtrlC:ft,explorer:{isOpen:()=>L.current!==null,onMove:j=>v(L.current&&Me(L.current,{type:"move",delta:j},T)),onEnter:()=>{let j=L.current;if(j){if(j.level==="list"&&y&&j.cursor===l.entries.length){C(null);return}v(Me(j,{type:"enter"},T))}},onBack:()=>{v(L.current&&Me(L.current,{type:"back"},T)),setTimeout(()=>g(j=>j+1),0)}}}),(0,B.jsx)(Gt,{items:l,state:f,verb:s,more:y?{hidden:o}:null,explain:W,grandTotal:t.entries.length,dossier:Ce}),($e??h)&&($e??h).split(`
7
+ `).map((j,Rn)=>(0,B.jsx)(n,{color:r.orange,children:j},`nt-${Rn}`)),vt]})}return(0,B.jsxs)(S,{flexDirection:"column",children:[(0,B.jsx)(Je,{onToggleThinking:()=>m(t=>!t),onCtrlC:ft,panel:pn}),en&&(0,B.jsx)(Et,{thinking:tn.body,expanded:!0,thinkingDone:K!=="streaming",maxLines:Yt+1}),st.length>0&&(0,B.jsx)(S,{flexDirection:"column",children:st.map((t,l)=>(0,B.jsx)(n,{children:Bt(t).map((o,y)=>(0,B.jsx)(n,{bold:o.bold,italic:o.italic,color:o.code?r.dim:void 0,children:o.text},y))},`st-${l}`))}),D&&(0,B.jsx)(Pt,{batch:D,qView:qe,sel:cn,focused:un,freeText:hn,multiSelFor:t=>e.multiSelection(t)}),F&&(0,B.jsx)(n,{color:"yellow",children:F.prompt}),($e??h)&&($e??h).split(`
8
+ `).map((t,l)=>(0,B.jsx)(n,{color:r.orange,children:t},`nt-${l}`)),ot&&!D&&(0,B.jsxs)(n,{color:r.assuranceAccent,children:[`${Le[lt%Le.length]} ${on} `,(0,B.jsx)(n,{color:r.dim,children:`(${sn}s)`})]}),be&&(0,B.jsx)(ae,{headline:bn,rows:We,sel:wn,focused:Xe==null,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 type = your own words",freeText:In,sublines:Tn}),x?.kind==="picker"&&(0,B.jsx)(ae,{ask:!0,headline:"design tests for which use-case?",rows:x.items.map(t=>({key:t.key,label:t.title,detail:t.badge})),sel:x.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),x?.kind==="confirm"&&(0,B.jsx)(ae,{ask:!0,headline:`${x.item.title} is already designed${x.item.designed==="stale"?" \u2014 and the use-case has changed since":""}`,rows:Zt(x.item).map(t=>({key:t.key,label:t.label,detail:t.detail})),sel:x.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),x?.kind==="running"&&!ke&&(0,B.jsxs)(n,{color:r.assuranceAccent,children:[`${Le[lt%Le.length]} Designing ${x.title}\u2026 `,(0,B.jsx)(n,{color:r.dim,children:`(${Math.floor((Date.now()-x.startedAt)/1e3)}s)`})]}),x?.kind==="ask"&&(0,B.jsx)(ae,{headline:`designed ${x.title}`,rows:je,sel:x.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),x?.kind==="failed"&&(0,B.jsx)(ae,{headline:`design failed \u2014 ${x.item.title} (${x.detail})`,rows:Ue,sel:x.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),K==="pausing"&&(0,B.jsx)(n,{color:r.dim,children:"pausing \u2014 saving session\u2026 (ctrl+c again = force quit)"}),vt]})}export{_r as ChatSurface,Kn as tailVisualRows};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-6CGNLFSN.js";import"./chunk-TW3K2DKB.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
2
+ import{a,b,c}from"./chunk-EAUUULJQ.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as r}from"./chunk-LPBAQQ7E.js";import"./chunk-TW3K2DKB.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
2
+ import{a as r}from"./chunk-FSB3FTIQ.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P,b as g,c as f}from"./chunk-J4WS2SXT.js";import"./chunk-YVXC46DY.js";import"./chunk-5Y2G4NC7.js";import"./chunk-2KS2YRIS.js";import{a as c}from"./chunk-HCBYKLMW.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
2
+ import{a as P,b as g,c as f}from"./chunk-MRP54NCJ.js";import"./chunk-XXMNUJX4.js";import"./chunk-5Y2G4NC7.js";import"./chunk-MMPFU2YC.js";import{a as c}from"./chunk-HCBYKLMW.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as p,b as l,c as n}from"./chunk-6NWPK2MS.js";import{y as o}from"./chunk-2KS2YRIS.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a,j as c}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var b=t(R(),1);var e=t(g(),1);function A({model:d,authLabel:v,profile:x,env:w,defaultUrl:u,projectId:r,projectName:s,folderId:i,folderName:f,windowSize:B,chromeProfile:C}){let h=r?s?`${s} (${r})`:r:"(none)",D=i?f?`${f} (${i})`:i:"(none)",{exit:m}=c();return(0,b.useEffect)(()=>{let P=setTimeout(()=>m(),50);return()=>clearTimeout(P)},[m]),(0,e.jsx)(a,{flexDirection:"column",children:(0,e.jsx)(p,{title:"Configuration",children:(0,e.jsxs)(a,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:v}),(0,e.jsx)(l,{label:" profile",value:x}),(0,e.jsx)(l,{label:" env",value:w}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:u??"(none)",valueColor:u?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:d}),(0,e.jsx)(l,{label:" window",value:B}),(0,e.jsx)(l,{label:" project",value:h}),(0,e.jsx)(l,{label:" folder",value:D}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dim})]})})})}export{A as ConfigView};
2
+ import{a as p,b as l,c as n}from"./chunk-QJIJC3KC.js";import{y as o}from"./chunk-MMPFU2YC.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a,j as c}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var b=t(R(),1);var e=t(g(),1);function A({model:d,authLabel:v,profile:x,env:w,defaultUrl:u,projectId:r,projectName:s,folderId:i,folderName:f,windowSize:B,chromeProfile:C}){let h=r?s?`${s} (${r})`:r:"(none)",D=i?f?`${f} (${i})`:i:"(none)",{exit:m}=c();return(0,b.useEffect)(()=>{let P=setTimeout(()=>m(),50);return()=>clearTimeout(P)},[m]),(0,e.jsx)(a,{flexDirection:"column",children:(0,e.jsx)(p,{title:"Configuration",children:(0,e.jsxs)(a,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:v}),(0,e.jsx)(l,{label:" profile",value:x}),(0,e.jsx)(l,{label:" env",value:w}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:u??"(none)",valueColor:u?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:d}),(0,e.jsx)(l,{label:" window",value:B}),(0,e.jsx)(l,{label:" project",value:h}),(0,e.jsx)(l,{label:" folder",value:D}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dim})]})})})}export{A as ConfigView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-KA7Q5IIC.js";import"./chunk-RFHMDQXZ.js";import"./chunk-OESHJ4J2.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-SDRFTIRU.js";import"./chunk-RGDQMKNJ.js";import"./chunk-A46NBRAP.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-RH4GCEFX.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
2
+ import{a}from"./chunk-NUQ423YE.js";import"./chunk-RFHMDQXZ.js";import"./chunk-JXKRO2ZJ.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-KHJXOFDM.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-7LWXIRI3.js";import"./chunk-YCCUBQY4.js";import"./chunk-AYDUHTPA.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RH4GCEFX.js";import"./chunk-TW3K2DKB.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
2
+ import{a,b}from"./chunk-SURF5Z7Y.js";import"./chunk-YCCUBQY4.js";import"./chunk-GIMTSDNC.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f,b as r,y as t}from"./chunk-2KS2YRIS.js";import{a as T}from"./chunk-HCBYKLMW.js";import{a as s,b as o,j as x,k as p}from"./chunk-C44QQJR4.js";import{a as v}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var w=h(v(),1);var e=h(T(),1),b="https://www.testmuai.com/support/docs/kane-cli-introduction",S="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:c}=x(),{stdout:a}=p(),l=a?.columns??80;return(0,w.useEffect)(()=>{let m=setTimeout(()=>c(),50);return()=>clearTimeout(m)},[c]),(0,e.jsxs)(s,{flexDirection:"column",children:[(0,e.jsxs)(s,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.orange,bold:!0,children:r}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",f]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsxs)(d,{title:"USAGE",children:[(0,e.jsx)(g,{cmd:`${r}`,desc:"Single-shot prompt (no args, TTY)"}),(0,e.jsx)(g,{cmd:`${r} --tui`,desc:"Full interactive TUI",highlight:!0}),(0,e.jsx)(g,{cmd:`${r} run "<objective>"`,desc:"Inline objective"}),(0,e.jsx)(g,{cmd:`${r} testmd run <path>.md`,desc:"Replay a saved *_test.md file"})]}),(0,e.jsxs)(d,{title:"HELP",children:[(0,e.jsx)(g,{cmd:`${r} --help`,desc:"Show this help (long form)"}),(0,e.jsx)(g,{cmd:`${r} -h`,desc:"Show this help (short form)"}),(0,e.jsx)(g,{cmd:`${r} help`,desc:"Show this help (subcommand form)"}),(0,e.jsxs)(s,{marginLeft:2,marginTop:0,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["These are the only supported help invocations. Anything else (e.g. ",(0,e.jsx)(o,{color:t.orange,children:"-help"}),") is an unknown flag."]}),(0,e.jsxs)(o,{color:t.dim,children:["Terminal tab-completion is a shell feature; ",r," does not ship shell-completion scripts, so any flag your shell suggests is a generic guess \u2014 not from ",r,"."]})]})]}),(0,e.jsxs)(d,{title:"COMMANDS",children:[(0,e.jsx)(i,{cmd:"run",args:"<objective>",desc:"Run an objective (inline string)",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd",args:"run|list|status|delete|export",desc:"Manage *_test.md files"}),(0,e.jsx)(i,{cmd:"testrun",args:"run",desc:"Run M *_test.md files as one sealed execution"}),(0,e.jsx)(i,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(i,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(i,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(i,{cmd:"config",args:"show|set-mode|set-assertion-mode|\u2026",desc:"Chrome, run & generate settings"}),(0,e.jsx)(i,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"}),(0,e.jsx)(i,{cmd:"evidence",args:"validate|serve|merge",desc:"Validate, serve (viewer) or merge evidence packs"}),(0,e.jsx)(i,{cmd:"changelog",args:"[--all]",desc:"Show recent release notes"}),(0,e.jsx)(i,{cmd:"context",args:"ingest|extract|list|review|sessions|\u2026",desc:"Build & manage the assurance context store"}),(0,e.jsx)(i,{cmd:"design",args:"tests --use-case <ref>",desc:"Design tests from the context store"})]}),(0,e.jsxs)(d,{title:"TESTMD ACTIONS",children:[(0,e.jsx)(i,{cmd:"testmd run",args:"<path>",desc:"Replay a saved *_test.md file",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd list",desc:"List *_test.md files in cwd (recursive)"}),(0,e.jsx)(i,{cmd:"testmd status",args:"<path>",desc:"Print local meta.json for a test"}),(0,e.jsx)(i,{cmd:"testmd delete",args:"<path>",desc:"Remove output-<stem>/ and the source file"}),(0,e.jsx)(i,{cmd:"testmd export",args:"<path> --language <py|js>",desc:"Generate standalone Playwright code"})]}),(0,e.jsxs)(d,{title:"RUN FLAGS",children:[(0,e.jsx)(n,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(n,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(n,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(n,{long:"--mode",arg:"<action|testing>",desc:"Run mode (default: testing)"}),(0,e.jsx)(n,{long:"--name",arg:"<name>",desc:"Persist session under this name"}),(0,e.jsx)(n,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(n,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(n,{long:"--session-context",arg:"<json>",desc:"Prior runs context JSON"}),(0,e.jsx)(n,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(n,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(n,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(n,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(n,{long:"--task-skills",desc:"Domain-specific task skills (experimental)"}),(0,e.jsx)(n,{long:"--code-export",desc:"Generate code export after upload"}),(0,e.jsx)(n,{long:"--code-language",arg:"<lang>",desc:"Code export language: python | javascript"}),(0,e.jsx)(n,{long:"--skip-code-validation",desc:"Skip post-codegen validation"}),(0,e.jsx)(n,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(n,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(n,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(n,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(d,{title:"EXAMPLES",children:[(0,e.jsx)(u,{label:"Inline objective",cmd:`${r} run "Search for laptop"`}),(0,e.jsx)(u,{label:"Replay a saved test",cmd:`${r} testmd run smoke_test.md`}),(0,e.jsx)(u,{label:"Variables",cmd:`${r} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(u,{label:"Agent mode (NDJSON)",cmd:`${r} run "Add to cart" --agent | jq .status`})]}),(0,e.jsx)(d,{title:"TEST FILES",children:(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:[(0,e.jsx)(o,{color:t.orange,children:"*_test.md"})," \u2014 markdown test files with YAML frontmatter and ",(0,e.jsx)(o,{color:t.orange,children:"## "}),"step headings."]}),(0,e.jsxs)(o,{color:t.dim,children:["Run with ",(0,e.jsxs)(o,{color:t.orange,children:[r," testmd run path/to/foo_test.md"]}),". (`.md` paths are not accepted by `",r," run`.)"]}),(0,e.jsxs)(o,{color:t.dim,children:["Sessions you run in TUI auto-save to ",(0,e.jsx)(o,{color:t.orange,children:"<cwd>/.testmuai/tests/<name>_test.md"})," (testing mode prompts on exit)."]})]})}),(0,e.jsxs)(s,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(l-2,70))}),(0,e.jsxs)(s,{gap:3,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Docs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:b})]}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Bugs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:S})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function d({title:c,children:a}){return(0,e.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(s,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dim,children:c})}),a]})}function g({cmd:c,desc:a,highlight:l}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:40,children:[(0,e.jsx)(o,{color:t.dim,children:"$ "}),(0,e.jsx)(o,{color:l?t.orange:t.orange,children:c})]}),(0,e.jsx)(o,{color:t.dim,children:a})]})}function i({cmd:c,args:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsx)(s,{width:16,children:(0,e.jsx)(o,{color:m?t.orange:t.green,bold:!0,children:c})}),(0,e.jsx)(s,{width:32,children:a?(0,e.jsx)(o,{color:t.dim,children:a}):null}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function n({long:c,arg:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:30,children:[(0,e.jsx)(o,{color:m?t.orange:t.orange,children:c}),a&&(0,e.jsxs)(o,{color:t.dim,children:[" ",a]})]}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function u({label:c,cmd:a}){return(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["# ",c]}),(0,e.jsxs)(o,{color:t.orange,children:["$ ",a]})]})}export{L as HelpView};
2
+ import{a as f,b as r,y as t}from"./chunk-MMPFU2YC.js";import{a as T}from"./chunk-HCBYKLMW.js";import{a as s,b as o,j as x,k as p}from"./chunk-C44QQJR4.js";import{a as v}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var w=h(v(),1);var e=h(T(),1),b="https://www.testmuai.com/support/docs/kane-cli-introduction",S="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:c}=x(),{stdout:a}=p(),l=a?.columns??80;return(0,w.useEffect)(()=>{let m=setTimeout(()=>c(),50);return()=>clearTimeout(m)},[c]),(0,e.jsxs)(s,{flexDirection:"column",children:[(0,e.jsxs)(s,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.orange,bold:!0,children:r}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",f]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsxs)(d,{title:"USAGE",children:[(0,e.jsx)(g,{cmd:`${r}`,desc:"Single-shot prompt (no args, TTY)"}),(0,e.jsx)(g,{cmd:`${r} --tui`,desc:"Full interactive TUI",highlight:!0}),(0,e.jsx)(g,{cmd:`${r} run "<objective>"`,desc:"Inline objective"}),(0,e.jsx)(g,{cmd:`${r} testmd run <path>.md`,desc:"Replay a saved *_test.md file"})]}),(0,e.jsxs)(d,{title:"HELP",children:[(0,e.jsx)(g,{cmd:`${r} --help`,desc:"Show this help (long form)"}),(0,e.jsx)(g,{cmd:`${r} -h`,desc:"Show this help (short form)"}),(0,e.jsx)(g,{cmd:`${r} help`,desc:"Show this help (subcommand form)"}),(0,e.jsxs)(s,{marginLeft:2,marginTop:0,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["These are the only supported help invocations. Anything else (e.g. ",(0,e.jsx)(o,{color:t.orange,children:"-help"}),") is an unknown flag."]}),(0,e.jsxs)(o,{color:t.dim,children:["Terminal tab-completion is a shell feature; ",r," does not ship shell-completion scripts, so any flag your shell suggests is a generic guess \u2014 not from ",r,"."]})]})]}),(0,e.jsxs)(d,{title:"COMMANDS",children:[(0,e.jsx)(i,{cmd:"run",args:"<objective>",desc:"Run an objective (inline string)",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd",args:"run|list|status|delete|export",desc:"Manage *_test.md files"}),(0,e.jsx)(i,{cmd:"testrun",args:"run",desc:"Run M *_test.md files as one sealed execution"}),(0,e.jsx)(i,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(i,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(i,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(i,{cmd:"config",args:"show|set-mode|set-assertion-mode|\u2026",desc:"Chrome, run & generate settings"}),(0,e.jsx)(i,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"}),(0,e.jsx)(i,{cmd:"evidence",args:"validate|serve|merge",desc:"Validate, serve (viewer) or merge evidence packs"}),(0,e.jsx)(i,{cmd:"changelog",args:"[--all]",desc:"Show recent release notes"}),(0,e.jsx)(i,{cmd:"context",args:"ingest|extract|list|review|sessions|\u2026",desc:"Build & manage the assurance context store"}),(0,e.jsx)(i,{cmd:"design",args:"tests --use-case <ref>",desc:"Design tests from the context store"})]}),(0,e.jsxs)(d,{title:"TESTMD ACTIONS",children:[(0,e.jsx)(i,{cmd:"testmd run",args:"<path>",desc:"Replay a saved *_test.md file",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd list",desc:"List *_test.md files in cwd (recursive)"}),(0,e.jsx)(i,{cmd:"testmd status",args:"<path>",desc:"Print local meta.json for a test"}),(0,e.jsx)(i,{cmd:"testmd delete",args:"<path>",desc:"Remove output-<stem>/ and the source file"}),(0,e.jsx)(i,{cmd:"testmd export",args:"<path> --language <py|js>",desc:"Generate standalone Playwright code"})]}),(0,e.jsxs)(d,{title:"RUN FLAGS",children:[(0,e.jsx)(n,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(n,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(n,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(n,{long:"--mode",arg:"<action|testing>",desc:"Run mode (default: testing)"}),(0,e.jsx)(n,{long:"--name",arg:"<name>",desc:"Persist session under this name"}),(0,e.jsx)(n,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(n,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(n,{long:"--session-context",arg:"<json>",desc:"Prior runs context JSON"}),(0,e.jsx)(n,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(n,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(n,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(n,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(n,{long:"--task-skills",desc:"Domain-specific task skills (experimental)"}),(0,e.jsx)(n,{long:"--code-export",desc:"Generate code export after upload"}),(0,e.jsx)(n,{long:"--code-language",arg:"<lang>",desc:"Code export language: python | javascript"}),(0,e.jsx)(n,{long:"--skip-code-validation",desc:"Skip post-codegen validation"}),(0,e.jsx)(n,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(n,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(n,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(n,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(d,{title:"EXAMPLES",children:[(0,e.jsx)(u,{label:"Inline objective",cmd:`${r} run "Search for laptop"`}),(0,e.jsx)(u,{label:"Replay a saved test",cmd:`${r} testmd run smoke_test.md`}),(0,e.jsx)(u,{label:"Variables",cmd:`${r} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(u,{label:"Agent mode (NDJSON)",cmd:`${r} run "Add to cart" --agent | jq .status`})]}),(0,e.jsx)(d,{title:"TEST FILES",children:(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:[(0,e.jsx)(o,{color:t.orange,children:"*_test.md"})," \u2014 markdown test files with YAML frontmatter and ",(0,e.jsx)(o,{color:t.orange,children:"## "}),"step headings."]}),(0,e.jsxs)(o,{color:t.dim,children:["Run with ",(0,e.jsxs)(o,{color:t.orange,children:[r," testmd run path/to/foo_test.md"]}),". (`.md` paths are not accepted by `",r," run`.)"]}),(0,e.jsxs)(o,{color:t.dim,children:["Sessions you run in TUI auto-save to ",(0,e.jsx)(o,{color:t.orange,children:"<cwd>/.testmuai/tests/<name>_test.md"})," (testing mode prompts on exit)."]})]})}),(0,e.jsxs)(s,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(l-2,70))}),(0,e.jsxs)(s,{gap:3,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Docs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:b})]}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Bugs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:S})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function d({title:c,children:a}){return(0,e.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(s,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dim,children:c})}),a]})}function g({cmd:c,desc:a,highlight:l}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:40,children:[(0,e.jsx)(o,{color:t.dim,children:"$ "}),(0,e.jsx)(o,{color:l?t.orange:t.orange,children:c})]}),(0,e.jsx)(o,{color:t.dim,children:a})]})}function i({cmd:c,args:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsx)(s,{width:16,children:(0,e.jsx)(o,{color:m?t.orange:t.green,bold:!0,children:c})}),(0,e.jsx)(s,{width:32,children:a?(0,e.jsx)(o,{color:t.dim,children:a}):null}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function n({long:c,arg:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:30,children:[(0,e.jsx)(o,{color:m?t.orange:t.orange,children:c}),a&&(0,e.jsxs)(o,{color:t.dim,children:[" ",a]})]}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function u({label:c,cmd:a}){return(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["# ",c]}),(0,e.jsxs)(o,{color:t.orange,children:["$ ",a]})]})}export{L as HelpView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-W54W762O.js";import"./chunk-6NWPK2MS.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
2
+ import{a}from"./chunk-7MRBMDZ5.js";import"./chunk-QJIJC3KC.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-ECFOND7B.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
2
+ import{a}from"./chunk-KSZ72BSC.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-FEF75YKV.js";import"./chunk-TW3K2DKB.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
2
+ import{a,b}from"./chunk-NTGYFYBP.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-SACSQY3Q.js";import"./chunk-YCCUBQY4.js";import"./chunk-AYDUHTPA.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RH4GCEFX.js";import"./chunk-TW3K2DKB.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
2
+ import{a,b}from"./chunk-GLA6QL3T.js";import"./chunk-YCCUBQY4.js";import"./chunk-GIMTSDNC.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-76I6NJBX.js";import"./chunk-S3DAAAE5.js";import"./chunk-W54W762O.js";import"./chunk-6NWPK2MS.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SaveSessionPrompt,b as defaultSessionTimestamp,c as renderSavePrompt};
2
+ import{a,b,c}from"./chunk-7NLQ3QQD.js";import"./chunk-S3DAAAE5.js";import"./chunk-7MRBMDZ5.js";import"./chunk-QJIJC3KC.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SaveSessionPrompt,b as defaultSessionTimestamp,c as renderSavePrompt};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-ICGHBZFZ.js";import"./chunk-MFOH7EYR.js";import"./chunk-ZNHXIRCM.js";import"./chunk-TDPWFYTJ.js";import"./chunk-3AZTXJY4.js";import"./chunk-4CJ55EUY.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-GLA6QL3T.js";import"./chunk-SURF5Z7Y.js";import"./chunk-YCCUBQY4.js";import"./chunk-GIMTSDNC.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-VE3SUJMA.js";import"./chunk-LHDNJJGE.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-FYDBD7Q4.js";import"./chunk-W54W762O.js";import"./chunk-6NWPK2MS.js";import"./chunk-2KS2YRIS.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{d as AutoExitSummaryBox,c as SummaryBox,b as buildSummaryEvent,a as buildSummaryRendered};
2
+ import{a,b,c,d}from"./chunk-2WKX3RMA.js";import"./chunk-7MRBMDZ5.js";import"./chunk-QJIJC3KC.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{d as AutoExitSummaryBox,c as SummaryBox,b as buildSummaryEvent,a as buildSummaryRendered};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{g as a}from"./chunk-NTNAHN25.js";import"./chunk-OGWC3J3C.js";import"./chunk-YSSTGJ7O.js";import"./chunk-TDPWFYTJ.js";import"./chunk-3AZTXJY4.js";import"./chunk-XXMNUJX4.js";import"./chunk-5Y2G4NC7.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-KHJXOFDM.js";import"./chunk-7MRBMDZ5.js";import"./chunk-QJIJC3KC.js";import"./chunk-DFS4RMVP.js";import"./chunk-MMPFU2YC.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b,b as r}from"./chunk-6NWPK2MS.js";import{y as o}from"./chunk-2KS2YRIS.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as i,b as l,j as s}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var f=a(T(),1);var e=a(p(),1);function V({profile:g,env:v,authenticated:n,authMethod:h,username:c,tokenStatus:t,expiresAt:d,serverStatus:u,detail:m}){let{exit:x}=s();return(0,f.useEffect)(()=>{let B=setTimeout(()=>x(),50);return()=>clearTimeout(B)},[x]),(0,e.jsx)(i,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Identity",variant:n?"success":"warning",children:(0,e.jsxs)(i,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{children:u==="rejected"?(0,e.jsx)(l,{color:o.red,bold:!0,children:"\u2717 Not authenticated"}):u==="unreachable"?(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Couldn't verify"}):n?(0,e.jsx)(l,{color:o.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(r,{label:"Profile",value:g}),(0,e.jsx)(r,{label:"Environment",value:v}),(0,e.jsx)(r,{label:"Method",value:h}),c&&(0,e.jsx)(r,{label:"User",value:c}),t&&(0,e.jsx)(r,{label:"Token",value:t,valueColor:t==="valid"?o.green:t==="expired"?o.red:o.dim}),d&&(0,e.jsx)(r,{label:"Expires",value:d}),m&&(0,e.jsx)(r,{label:"Detail",value:m})]})]})})})}export{V as WhoamiView};
2
+ import{a as b,b as r}from"./chunk-QJIJC3KC.js";import{y as o}from"./chunk-MMPFU2YC.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as i,b as l,j as s}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var f=a(T(),1);var e=a(p(),1);function V({profile:g,env:v,authenticated:n,authMethod:h,username:c,tokenStatus:t,expiresAt:d,serverStatus:u,detail:m}){let{exit:x}=s();return(0,f.useEffect)(()=>{let B=setTimeout(()=>x(),50);return()=>clearTimeout(B)},[x]),(0,e.jsx)(i,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Identity",variant:n?"success":"warning",children:(0,e.jsxs)(i,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{children:u==="rejected"?(0,e.jsx)(l,{color:o.red,bold:!0,children:"\u2717 Not authenticated"}):u==="unreachable"?(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Couldn't verify"}):n?(0,e.jsx)(l,{color:o.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(r,{label:"Profile",value:g}),(0,e.jsx)(r,{label:"Environment",value:v}),(0,e.jsx)(r,{label:"Method",value:h}),c&&(0,e.jsx)(r,{label:"User",value:c}),t&&(0,e.jsx)(r,{label:"Token",value:t,valueColor:t==="valid"?o.green:t==="expired"?o.red:o.dim}),d&&(0,e.jsx)(r,{label:"Expires",value:d}),m&&(0,e.jsx)(r,{label:"Detail",value:m})]})]})})})}export{V as WhoamiView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-OGLK7MPV.js"),import("./resolver-IDCGRPFJ.js"),import("./config-QISRENF5.js")]),t=new n,o=t.getActiveProfile()??"default",c=t.loadCredentials(o,e);if(typeof c?.access_token!="string")return null;let r=await new a(s(e).controllerBaseUrl,async()=>c.access_token,null).resolve();return typeof r?.username!="string"||!r.username||typeof r.access_key!="string"||!r.access_key?null:Buffer.from(`${r.username}:${r.access_key}`,"utf8").toString("base64")}catch{return null}}async function u(e={}){let n=e.env??process.env,s=await(e.resolveBase??(async()=>(await import("./spawner-7KXVKAD5.js")).resolveAgentAuthEnv()))();if(s.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH)return s;let t=n.TESTMUAI_ENV==="stage"?"stage":"prod",o=await(e.exchange??i)(t);return o?{...s,TESTMUAI_BASIC_AUTH:o}:s}export{u as resolveLisAuthEnv};
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as w}from"./chunk-KK7DYHK6.js";import"./chunk-KHU7C6EE.js";import"./chunk-SKRZN25J.js";import"./chunk-ZFFRHV5U.js";import"./chunk-JFAFKHDX.js";import"./chunk-J44RN3FB.js";import"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-OSALXGD4.js";import"./chunk-DNNZ353O.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-FHKDTM5L.js";import"./chunk-ZPDM6FO7.js";import{a as u}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-L5LI2JF4.js";import"./chunk-SDRFTIRU.js";import"./chunk-RGDQMKNJ.js";import"./chunk-A46NBRAP.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-5EOX4MEY.js";import"./chunk-2KS2YRIS.js";import"./chunk-UR6MHSHU.js";import{existsSync as y}from"fs";var O=new Set(["interactive","agent","ci","override"]);function C(e){return e.mode!=null&&!O.has(e.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`}:e.strength!=null&&e.strength!=="pairwise"&&e.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${e.strength}'`}:e.max!=null&&(!Number.isInteger(e.max)||e.max<1)?{error:"design: --max must be a positive integer"}:!e.useCase&&!e.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:e.useCase,max:e.max,strength:e.strength,mode:e.mode,force:e.force,resume:e.resume,plan:e.plan,message:e.message,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function _(e){let g=async(r,n)=>{if(process.stderr.write(r+`
2
+ import{a as w}from"./chunk-55Y65VPA.js";import"./chunk-3RZ63RBO.js";import"./chunk-KHU7C6EE.js";import"./chunk-MR7CX5VT.js";import"./chunk-J44RN3FB.js";import"./chunk-JFAFKHDX.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import"./chunk-DNNZ353O.js";import"./chunk-FHKDTM5L.js";import"./chunk-ZPDM6FO7.js";import{a as u}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-5EOX4MEY.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";import{existsSync as y}from"fs";var O=new Set(["interactive","agent","ci","override"]);function C(e){return e.mode!=null&&!O.has(e.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`}:e.strength!=null&&e.strength!=="pairwise"&&e.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${e.strength}'`}:e.max!=null&&(!Number.isInteger(e.max)||e.max<1)?{error:"design: --max must be a positive integer"}:!e.useCase&&!e.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:e.useCase,max:e.max,strength:e.strength,mode:e.mode,force:e.force,resume:e.resume,plan:e.plan,message:e.message,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function _(e){let g=async(r,n)=>{if(process.stderr.write(r+`
3
3
  `),e.mode!=="agent")return 2;let{makeHeadlessIO:i,agentRefusal:o}=await import("./headless-io-PWW6YKH2.js");return o(i("ndjson","design"),r,n)},m=C(e);if("error"in m)return g(m.error);let a=m;{let{validateResumeMessage:r}=await import("./headless-io-PWW6YKH2.js"),n=r(a,"design");if(n)return g(n)}if(!y(u(process.cwd())))return g("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");let t=null;try{if(!a.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
4
4
  `),2;let r=a.mode??"interactive";if(r==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`design: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
5
- `),2;let{bindDesignInteractive:s}=await import("./interactive-bind-IXFRXBBL.js");return await s(a)}let{resolveAgentAuthEnv:n}=await import("./spawner-6FHAXNOA.js"),{runAgent:i}=await import("./bridge-WMGH3O3B.js"),{preflightTurn:o}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:h}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:v}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:T,resolveEncoding:x,guardedChannels:D}=await import("./headless-io-PWW6YKH2.js");t=T(x(r),"design");let{telemetryBootstrap:b,telemetryEnvName:E}=await import("./bootstrap-T6DSUI34.js"),c=b({verb:"design",mode:r,contextRoot:u(process.cwd()),env:E(),resumeSid:a.resume,write:!0,longSession:!0}),l={...await n(),...c.spawnEnv()},p=v();p&&t.out(p);let d=h(i,s=>t.out(s)),f=D(t,()=>d.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let s=await w({...a,mode:r},{contextDir:u(process.cwd()),agent:d.agent,preflightTurn:()=>o(l),ask:async()=>[],out:f.out,emit:f.emit,progress:t.progress,isTTY:!1,auth:l,telemetry:c});return d.interrupted()&&s!==3?(t.out("interrupted \u2014 no session saved"),await c.end({exit_code:130}),t.done(130)):(s===1&&t.out(c.supportFooter()),await c.end({exit_code:s}),t.done(s))}finally{d.dispose()}}catch(r){let n=r instanceof Error?r.message:String(r);t?.event({type:"error",message:`error: design failed: ${n}`});let i=t?o=>t.out(o):o=>process.stderr.write(o+`
5
+ `),2;let{bindDesignInteractive:s}=await import("./interactive-bind-53FCRK34.js");return await s(a)}let{resolveAgentAuthEnv:n}=await import("./spawner-7KXVKAD5.js"),{runAgent:i}=await import("./bridge-QCMEOQDD.js"),{preflightTurn:o}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:h}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:v}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:T,resolveEncoding:x,guardedChannels:D}=await import("./headless-io-PWW6YKH2.js");t=T(x(r),"design");let{telemetryBootstrap:b,telemetryEnvName:E}=await import("./bootstrap-566PPFCC.js"),c=b({verb:"design",mode:r,contextRoot:u(process.cwd()),env:E(),resumeSid:a.resume,write:!0,longSession:!0}),l={...await n(),...c.spawnEnv()},p=v();p&&t.out(p);let d=h(i,s=>t.out(s)),f=D(t,()=>d.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let s=await w({...a,mode:r},{contextDir:u(process.cwd()),agent:d.agent,preflightTurn:()=>o(l),ask:async()=>[],out:f.out,emit:f.emit,progress:t.progress,isTTY:!1,auth:l,telemetry:c});return d.interrupted()&&s!==3?(t.out("interrupted \u2014 no session saved"),await c.end({exit_code:130}),t.done(130)):(s===1&&t.out(c.supportFooter()),await c.end({exit_code:s}),t.done(s))}finally{d.dispose()}}catch(r){let n=r instanceof Error?r.message:String(r);t?.event({type:"error",message:`error: design failed: ${n}`});let i=t?o=>t.out(o):o=>process.stderr.write(o+`
6
6
  `);return i(`error: design failed: ${n}`),(process.env.ASSURANCE_LOG_LEVEL??"").toLowerCase()==="debug"&&r instanceof Error&&r.stack&&i(r.stack),i("hint: per-run trace logs live under .context/logs/ (design-*.log)"),t?t.done(1):1}}export{_ as designTestsCommand};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-XY5KWIRF.js";import"./chunk-FHKDTM5L.js";import"./chunk-2XMJ6YAE.js";import"./chunk-BKM2LWU2.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-2KS2YRIS.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
2
+ import{a,b}from"./chunk-73OQDAXF.js";import"./chunk-FHKDTM5L.js";import"./chunk-2XMJ6YAE.js";import"./chunk-BKM2LWU2.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-Z25FKS3Y.js";import"./chunk-WV42KKEU.js";import"./chunk-UR6MHSHU.js";export{a as runAgent};
2
+ import{a}from"./chunk-M5PJQ5Y3.js";import"./chunk-HLRLP6TQ.js";import"./chunk-UR6MHSHU.js";export{a as runAgent};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-RZ4F3BHX.js";import{c as i,g as c}from"./chunk-2KS2YRIS.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{c as i,g as c}from"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
3
3
  `).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
4
4
  `)}export{A as fetchChangelog,v as formatChangelog};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as V,c as te}from"./chunk-JFAFKHDX.js";import{a as w,b as ee}from"./chunk-OSALXGD4.js";import{a as ne}from"./chunk-427OQS2N.js";import{d as Z}from"./chunk-NVGBE2DR.js";import{a as X}from"./chunk-SDRFTIRU.js";import"./chunk-RGDQMKNJ.js";import{c as Y,d as z,n as Q}from"./chunk-A46NBRAP.js";import{a as j,b as F}from"./chunk-L4JIMNKW.js";import{c as J,e as W}from"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import{e as L,f as A,g as P,h as x}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var de=new Set(["approve","edit","reject"]);function ye(k){let{contextDir:f,graph:s,ops:oe,by:l}=k,N=k.mintable??ne(),T=J(f);if(s.latestHash!==T)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(s.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]};let C=[],h=[],M=new Set;for(let e of oe){if(s.appliedEvents.has(e.eventId)||M.has(e.eventId)){C.push(e.eventId);continue}M.add(e.eventId),h.push(e)}if(h.length===0)return{record:null,errors:null,applied:[],skipped:C,minted:[],staleDelta:[]};let o=[],$=[],y=[],m=[],I=[],O=[],_=[...k.judgements??[]],D=[],q=new Map,B=new Set,G=[],b=new Set,se=new Set(N),H=new Set;for(let e of h){if(!de.has(e.kind))continue;let n=e.target,t=s.resolve(n)?.cid??n;H.has(t)&&o.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${n} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),H.add(t)}let E=(e,n,t)=>{let i=s.resolve(n);if(!i)return o.push({code:"UNKNOWN_NODE",detail:`${e}: ${n} names nothing in the graph`}),null;let p=s.tipOf(i.cid);return p!==t||s.superseded.has(t)?(o.push({code:"EXPECTED_CID_MOVED",detail:`${e}: ${n} moved or was archived since it was displayed`,data:{tip:p}}),null):t};for(let e of h)if(e.kind==="approve"){let n=E("approve",e.target,e.expectedCid);n&&m.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l})}else if(e.kind==="reject"){let n=E("reject",e.target,e.expectedCid);if(!n)continue;if(m.push({id:n,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:l}),e.redirectTo!==void 0){let t=s.resolve(e.redirectTo);if(!t||t.superseded){o.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}I.push({kind:"node",old:n,new:t.cid,reason:e.reason,by:l})}}else if(e.kind==="edit"){let n=E("edit",e.target,e.expectedCid);if(!n)continue;let t=s.getNode(n);if(!t){o.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let i={...t.content};for(let[c,u]of Object.entries(e.edit))u!==void 0&&(i[c]=u);if(typeof i.title=="string"&&!i.title.trim()){o.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let p=A(t.label,i);if(p.length>0){for(let c of p)o.push({code:c.code,detail:`edit ${e.target}: ${c.detail}`});continue}let d=j(t.label,i);if(d===n){m.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l});continue}$.push({cid:d,label:t.label,content:i}),I.push({kind:"node",old:n,new:d,reason:e.reason??"edited in chat",by:l}),m.push({id:d,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:l})}else if(e.kind==="enhance"){if(!E("enhance",e.target,e.expectedCid))continue;for(let t of e.edges){let i=s.nodeLabel.get(t.src)??"(unknown)",p=s.nodeLabel.get(t.dst)??"(unknown)";for(let r of x(t.type,i,p,t.props))o.push({code:r.code,detail:`enhance ${e.target}: ${r.detail}`});let d=F(t.type,t.src,t.dst,t.props);if(s.edgesFrom(t.src).some(r=>r.ecid===d)||y.some(r=>r.ecid===d))continue;let c=Y(s,t.type,t.src,t.dst,G);c&&o.push(c);let u=z(s,t.type,t.src,t.dst);u&&o.push(u);let a=P(t.type)?.cardinality;if(a==="one-live-per-src"||a==="one-live-per-src-and-dst"){let r=`${t.type}|${t.src}`;b.has(r)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${t.src}: two one-live edges in one turn`}),b.add(r)}if(a==="one-live-per-src-and-dst"){let r=`${t.type}|dst|${t.dst}`;b.has(r)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${t.dst}: two one-live edges in one turn (strict 1:1)`}),b.add(r)}y.push({ecid:d,type:t.type,src:t.src,dst:t.dst,props:t.props}),G.push({src:t.src,dst:t.dst,type:t.type})}}else if(e.kind==="add"){if(!se.has(e.label)){o.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${N.join("|")})`,data:{gate:[...N]}});continue}let n=s.heads.get(e.convSourceId),t=s.convChains.get(e.convSourceId);if(typeof n!="string"||!t){o.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}let i=s.getNode(n)?.content?.blob,p=typeof i=="string"?Z(f,i)?.toString("utf8")??"":"",d=ee(p,e.cite.turn);if(d===null){o.push({code:"BAD_ANCHOR",detail:`add: ${w(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!d.includes(e.cite.quote)){o.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${w(e.cite.turn)}`});continue}let c={...e.content,derived:!0},u=A(e.label,c);if(u.length>0){for(let g of u)o.push({code:g.code,detail:`add: ${g.detail}`});continue}let a=j(e.label,c),r={source_id:e.convSourceId,source_cid:n,anchor:w(e.cite.turn),quote:e.cite.quote};for(let g of x(L.DERIVES,"source",e.label,r))o.push({code:g.code,detail:`add: ${g.detail}`});$.push({cid:a,label:e.label,content:c}),y.push({ecid:F("DERIVES",n,a,r),type:L.DERIVES,src:n,dst:a,props:r}),e.rationale&&_.push({about:a,rationale:e.rationale,by:l});let v=Q(e.label,g=>B.has(g),s.names.keys());v!==null&&(B.add(v),O.push({cid:a,slug:v,by:l})),D.push({cid:a,...v!==null?{slug:v}:{}}),q.set(e.eventId,a)}if(o.length)return{record:null,errors:o};let U=new Date().toISOString();for(let e of h){if(e.kind==="add"){let n=q.get(e.eventId);n&&V(f,{ts:U,command:"extract-chat",id:n,verdict:"add",polarity:"preference",tag:e.label,by:l,event_id:e.eventId,target:n});continue}for(let n of te(e,{ts:U,command:"extract-chat",by:l}))V(f,n)}let K=h.map(e=>e.eventId).sort(),re=W(f,{ts:new Date().toISOString(),proposal_id:null,nodes:$,edges:y,review:m,supersessions:I,...O.length>0?{names:O}:{},..._.length>0?{judgements:_}:{},event_ids:K,source_head_moves:{}},{expectPrev:T}),R=X(f),S=new Set;for(let e of I)if(e.kind==="node"){S.add(e.old);for(let n of R.edgesInto(e.old))S.add(n.src)}for(let e of D)S.add(e.cid);let ie=[...S].map(e=>({cid:e,state:R.stale(R.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:re.record,errors:null,applied:K,skipped:C,minted:D,staleDelta:ie}}export{ye as commitChatTurn};
2
+ import{a as V,c as te}from"./chunk-JFAFKHDX.js";import{a as ne}from"./chunk-427OQS2N.js";import{a as w,b as ee}from"./chunk-FMR2KPSK.js";import{d as Z}from"./chunk-NVGBE2DR.js";import{a as X}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import{c as Y,d as z,n as Q}from"./chunk-6W6AIDLJ.js";import{a as j,b as F}from"./chunk-6HYW5RFX.js";import{c as J,e as W}from"./chunk-J2KSZUOO.js";import{e as L,f as A,g as P,h as x}from"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";var de=new Set(["approve","edit","reject"]);function ye(k){let{contextDir:f,graph:s,ops:oe,by:l}=k,N=k.mintable??ne(),T=J(f);if(s.latestHash!==T)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(s.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]};let C=[],h=[],M=new Set;for(let e of oe){if(s.appliedEvents.has(e.eventId)||M.has(e.eventId)){C.push(e.eventId);continue}M.add(e.eventId),h.push(e)}if(h.length===0)return{record:null,errors:null,applied:[],skipped:C,minted:[],staleDelta:[]};let o=[],$=[],y=[],m=[],I=[],O=[],_=[...k.judgements??[]],D=[],q=new Map,B=new Set,G=[],b=new Set,se=new Set(N),H=new Set;for(let e of h){if(!de.has(e.kind))continue;let n=e.target,t=s.resolve(n)?.cid??n;H.has(t)&&o.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${n} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),H.add(t)}let E=(e,n,t)=>{let i=s.resolve(n);if(!i)return o.push({code:"UNKNOWN_NODE",detail:`${e}: ${n} names nothing in the graph`}),null;let p=s.tipOf(i.cid);return p!==t||s.superseded.has(t)?(o.push({code:"EXPECTED_CID_MOVED",detail:`${e}: ${n} moved or was archived since it was displayed`,data:{tip:p}}),null):t};for(let e of h)if(e.kind==="approve"){let n=E("approve",e.target,e.expectedCid);n&&m.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l})}else if(e.kind==="reject"){let n=E("reject",e.target,e.expectedCid);if(!n)continue;if(m.push({id:n,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:l}),e.redirectTo!==void 0){let t=s.resolve(e.redirectTo);if(!t||t.superseded){o.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}I.push({kind:"node",old:n,new:t.cid,reason:e.reason,by:l})}}else if(e.kind==="edit"){let n=E("edit",e.target,e.expectedCid);if(!n)continue;let t=s.getNode(n);if(!t){o.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let i={...t.content};for(let[c,u]of Object.entries(e.edit))u!==void 0&&(i[c]=u);if(typeof i.title=="string"&&!i.title.trim()){o.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let p=A(t.label,i);if(p.length>0){for(let c of p)o.push({code:c.code,detail:`edit ${e.target}: ${c.detail}`});continue}let d=j(t.label,i);if(d===n){m.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l});continue}$.push({cid:d,label:t.label,content:i}),I.push({kind:"node",old:n,new:d,reason:e.reason??"edited in chat",by:l}),m.push({id:d,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:l})}else if(e.kind==="enhance"){if(!E("enhance",e.target,e.expectedCid))continue;for(let t of e.edges){let i=s.nodeLabel.get(t.src)??"(unknown)",p=s.nodeLabel.get(t.dst)??"(unknown)";for(let r of x(t.type,i,p,t.props))o.push({code:r.code,detail:`enhance ${e.target}: ${r.detail}`});let d=F(t.type,t.src,t.dst,t.props);if(s.edgesFrom(t.src).some(r=>r.ecid===d)||y.some(r=>r.ecid===d))continue;let c=Y(s,t.type,t.src,t.dst,G);c&&o.push(c);let u=z(s,t.type,t.src,t.dst);u&&o.push(u);let a=P(t.type)?.cardinality;if(a==="one-live-per-src"||a==="one-live-per-src-and-dst"){let r=`${t.type}|${t.src}`;b.has(r)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${t.src}: two one-live edges in one turn`}),b.add(r)}if(a==="one-live-per-src-and-dst"){let r=`${t.type}|dst|${t.dst}`;b.has(r)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${t.dst}: two one-live edges in one turn (strict 1:1)`}),b.add(r)}y.push({ecid:d,type:t.type,src:t.src,dst:t.dst,props:t.props}),G.push({src:t.src,dst:t.dst,type:t.type})}}else if(e.kind==="add"){if(!se.has(e.label)){o.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${N.join("|")})`,data:{gate:[...N]}});continue}let n=s.heads.get(e.convSourceId),t=s.convChains.get(e.convSourceId);if(typeof n!="string"||!t){o.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}let i=s.getNode(n)?.content?.blob,p=typeof i=="string"?Z(f,i)?.toString("utf8")??"":"",d=ee(p,e.cite.turn);if(d===null){o.push({code:"BAD_ANCHOR",detail:`add: ${w(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!d.includes(e.cite.quote)){o.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${w(e.cite.turn)}`});continue}let c={...e.content,derived:!0},u=A(e.label,c);if(u.length>0){for(let g of u)o.push({code:g.code,detail:`add: ${g.detail}`});continue}let a=j(e.label,c),r={source_id:e.convSourceId,source_cid:n,anchor:w(e.cite.turn),quote:e.cite.quote};for(let g of x(L.DERIVES,"source",e.label,r))o.push({code:g.code,detail:`add: ${g.detail}`});$.push({cid:a,label:e.label,content:c}),y.push({ecid:F("DERIVES",n,a,r),type:L.DERIVES,src:n,dst:a,props:r}),e.rationale&&_.push({about:a,rationale:e.rationale,by:l});let v=Q(e.label,g=>B.has(g),s.names.keys());v!==null&&(B.add(v),O.push({cid:a,slug:v,by:l})),D.push({cid:a,...v!==null?{slug:v}:{}}),q.set(e.eventId,a)}if(o.length)return{record:null,errors:o};let U=new Date().toISOString();for(let e of h){if(e.kind==="add"){let n=q.get(e.eventId);n&&V(f,{ts:U,command:"extract-chat",id:n,verdict:"add",polarity:"preference",tag:e.label,by:l,event_id:e.eventId,target:n});continue}for(let n of te(e,{ts:U,command:"extract-chat",by:l}))V(f,n)}let K=h.map(e=>e.eventId).sort(),re=W(f,{ts:new Date().toISOString(),proposal_id:null,nodes:$,edges:y,review:m,supersessions:I,...O.length>0?{names:O}:{},..._.length>0?{judgements:_}:{},event_ids:K,source_head_moves:{}},{expectPrev:T}),R=X(f),S=new Set;for(let e of I)if(e.kind==="node"){S.add(e.old);for(let n of R.edgesInto(e.old))S.add(n.src)}for(let e of D)S.add(e.cid);let ie=[...S].map(e=>({cid:e,state:R.stale(R.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:re.record,errors:null,applied:K,skipped:C,minted:D,staleDelta:ie}}export{ye as commitChatTurn};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-7YPK6EDR.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import"./chunk-NVGBE2DR.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{c as makeChatController,b as questionStub,a as recommendationPicks};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as S}from"./chunk-W54W762O.js";import{y as o}from"./chunk-2KS2YRIS.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as y,b as c,j as x}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var k=b(w(),1);var i=b(R(),1);function A(e){let t=e.decisions.filter(r=>r.kind==="replay").length,l=e.decisions.filter(r=>r.kind==="author").length,p=e.outcomes.filter(r=>r.status==="passed").length,d=e.outcomes.filter(r=>r.status==="failed").length,f=e.outcomes.filter(r=>r.status==="skipped").length,a=o.green,n;e.cancelled||e.overallStatus==="interrupted"?(a=o.orange,n="CANCELLED"):e.overallStatus==="failed"?(a=o.red,n="FAILED"):n="PASSED";let s=`${n} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${p} passed, ${d} failed, ${f} skipped)`,T=`${t} replay \xB7 ${l} author`,C=e.retryTriggered,_="yes \u2014 run recovered after a replay miss",u,h=o.dim;if(e.cancelled)u="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")u="\u2013 not committed (run failed)",h=o.red;else if(!e.shouldCommit)e.isFirstRun?u="\u2013 not committed (first run skipped commit)":e.lockHeld?u="\u2013 not committed":u="\u2013 not committed (readonly fallback / no lock)";else{let r=e.uploadResult?.testcaseId;u=r?`\u2713 pushed (testcase=${r})`:"\u2713 pushed",h=o.green}let v=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,g=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",g=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,g=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:s},breakdown:T,showRetries:C,retriesText:_,commitText:u,commitColor:h,artifactsText:v,uploadText:m,uploadColor:g}}function O(e){let t=e.decisions.filter(s=>s.kind==="replay").length,l=e.decisions.filter(s=>s.kind==="author").length,p=e.outcomes.filter(s=>s.status==="passed").length,d=e.outcomes.filter(s=>s.status==="failed").length,f=e.outcomes.filter(s=>s.status==="skipped").length,a,n=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&e.uploadResult?.testcaseId?(a="ok",n=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:p,failed:d,skipped:f,replay_decisions:t,author_decisions:l},retries:{triggered:e.retryTriggered},commit:{committed:n,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled,...e.imports&&e.imports.length>0?{imports:e.imports}:{}}}function D({data:e}){let t=A(e),l=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&l.push({label:"retries",value:(0,i.jsx)(c,{color:o.orange,children:t.retriesText})}),l.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),l.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dim,children:t.artifactsText})}),l.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:l})}function I({data:e}){let{exit:t}=x();return(0,k.useEffect)(()=>{let l=setTimeout(()=>t(),50);return()=>clearTimeout(l)},[t]),(0,i.jsx)(y,{flexDirection:"column",children:(0,i.jsx)(D,{data:e})})}export{A as a,O as b,D as c,I as d};
2
+ import{a as S}from"./chunk-7MRBMDZ5.js";import{y as o}from"./chunk-MMPFU2YC.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as y,b as c,j as x}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var k=b(w(),1);var i=b(R(),1);function A(e){let t=e.decisions.filter(r=>r.kind==="replay").length,l=e.decisions.filter(r=>r.kind==="author").length,p=e.outcomes.filter(r=>r.status==="passed").length,d=e.outcomes.filter(r=>r.status==="failed").length,f=e.outcomes.filter(r=>r.status==="skipped").length,a=o.green,n;e.cancelled||e.overallStatus==="interrupted"?(a=o.orange,n="CANCELLED"):e.overallStatus==="failed"?(a=o.red,n="FAILED"):n="PASSED";let s=`${n} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${p} passed, ${d} failed, ${f} skipped)`,T=`${t} replay \xB7 ${l} author`,C=e.retryTriggered,_="yes \u2014 run recovered after a replay miss",u,h=o.dim;if(e.cancelled)u="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")u="\u2013 not committed (run failed)",h=o.red;else if(!e.shouldCommit)e.isFirstRun?u="\u2013 not committed (first run skipped commit)":e.lockHeld?u="\u2013 not committed":u="\u2013 not committed (readonly fallback / no lock)";else{let r=e.uploadResult?.testcaseId;u=r?`\u2713 pushed (testcase=${r})`:"\u2713 pushed",h=o.green}let v=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,g=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",g=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,g=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:s},breakdown:T,showRetries:C,retriesText:_,commitText:u,commitColor:h,artifactsText:v,uploadText:m,uploadColor:g}}function O(e){let t=e.decisions.filter(s=>s.kind==="replay").length,l=e.decisions.filter(s=>s.kind==="author").length,p=e.outcomes.filter(s=>s.status==="passed").length,d=e.outcomes.filter(s=>s.status==="failed").length,f=e.outcomes.filter(s=>s.status==="skipped").length,a,n=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&e.uploadResult?.testcaseId?(a="ok",n=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:p,failed:d,skipped:f,replay_decisions:t,author_decisions:l},retries:{triggered:e.retryTriggered},commit:{committed:n,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled,...e.imports&&e.imports.length>0?{imports:e.imports}:{}}}function D({data:e}){let t=A(e),l=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&l.push({label:"retries",value:(0,i.jsx)(c,{color:o.orange,children:t.retriesText})}),l.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),l.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dim,children:t.artifactsText})}),l.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:l})}function I({data:e}){let{exit:t}=x();return(0,k.useEffect)(()=>{let l=setTimeout(()=>t(),50);return()=>clearTimeout(l)},[t]),(0,i.jsx)(y,{flexDirection:"column",children:(0,i.jsx)(D,{data:e})})}export{A as a,O as b,D as c,I as d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as s,k as l}from"./chunk-2KS2YRIS.js";import{readFileSync as g,writeFileSync as o,mkdirSync as i,existsSync as p}from"fs";import{dirname as a}from"path";var n={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:l,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},c=class{constructor(r=s){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...n,...e,code_export:{...n.code_export,...e.code_export??{}},generate:{...n.generate,...e.generate??{}}}}catch{return{...n,code_export:{...n.code_export},generate:{...n.generate}}}}set(r,e){try{let t=this.load();t[r]=e,i(a(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
2
+ import{d as s,k as l}from"./chunk-MMPFU2YC.js";import{readFileSync as g,writeFileSync as o,mkdirSync as i,existsSync as p}from"fs";import{dirname as a}from"path";var n={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:l,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},c=class{constructor(r=s){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...n,...e,code_export:{...n.code_export,...e.code_export??{}},generate:{...n.generate,...e.generate??{}}}}catch{return{...n,code_export:{...n.code_export},generate:{...n.generate}}}}set(r,e){try{let t=this.load();t[r]=e,i(a(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
3
3
  `)}catch(t){let d=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${d}
4
4
  `)}}save(r){try{let t={...this.load(),...r};i(a(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
5
5
  `)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`[config] Failed to save config: ${t}
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as M,f as R,h as j,i as y}from"./chunk-ZPDM6FO7.js";import{j as k}from"./chunk-A46NBRAP.js";import{existsSync as A,mkdirSync as W,readdirSync as B,readFileSync as N,renameSync as E,writeFileSync as G}from"fs";import{join as p}from"path";var P=/^@import\s+(\S+)\s*$/;function O(e,n){let s=e.resolve(n),l=s?String(e.getNode(s.tip)?.content.title??""):"";return l&&k(l,()=>!1)||n}function D(e){return p(e,".testmuai","tests")}function L(e){let n=new Map;if(!A(e))return n;for(let s of B(e)){if(!s.endsWith("_test.md"))continue;let l=p(e,s);try{let r=y(N(l,"utf8"))?.id;r&&n.set(r,[...n.get(r)??[],l])}catch{}}return n}function q(e,n){let s=`${e}.tmp-mint`;G(s,n),E(s,e)}function U(e){let{graph:n,cids:s,cwd:l}=e,r=D(l),w=[],d=[],m=L(r),$=new Set,b=(t,f)=>{let c=m.get(t);if(c&&c.length>1)return d.push({id:t,reason:`two files claim assurance.id ${t}: ${c.join(" \xB7 ")} \u2014 resolve the duplicate first`}),null;if($.has(t))return I(t);if(f.includes(t))return I(t)??`${O(n,t)}_test.md`;let S=n.resolve(t),v=S?n.getNode(S.tip):void 0,x=v?.content.test_md_blob,F=v?.content.definitionId;if(!x||!F)return d.push({id:t,reason:`${t} has no test definition in the graph`}),null;let h=x.split(`
2
+ import{e as M,f as R,h as j,i as y}from"./chunk-ZPDM6FO7.js";import{j as k}from"./chunk-6W6AIDLJ.js";import{existsSync as A,mkdirSync as W,readdirSync as B,readFileSync as N,renameSync as E,writeFileSync as G}from"fs";import{join as p}from"path";var P=/^@import\s+(\S+)\s*$/;function O(e,n){let s=e.resolve(n),l=s?String(e.getNode(s.tip)?.content.title??""):"";return l&&k(l,()=>!1)||n}function D(e){return p(e,".testmuai","tests")}function L(e){let n=new Map;if(!A(e))return n;for(let s of B(e)){if(!s.endsWith("_test.md"))continue;let l=p(e,s);try{let r=y(N(l,"utf8"))?.id;r&&n.set(r,[...n.get(r)??[],l])}catch{}}return n}function q(e,n){let s=`${e}.tmp-mint`;G(s,n),E(s,e)}function U(e){let{graph:n,cids:s,cwd:l}=e,r=D(l),w=[],d=[],m=L(r),$=new Set,b=(t,f)=>{let c=m.get(t);if(c&&c.length>1)return d.push({id:t,reason:`two files claim assurance.id ${t}: ${c.join(" \xB7 ")} \u2014 resolve the duplicate first`}),null;if($.has(t))return I(t);if(f.includes(t))return I(t)??`${O(n,t)}_test.md`;let S=n.resolve(t),v=S?n.getNode(S.tip):void 0,x=v?.content.test_md_blob,F=v?.content.definitionId;if(!x||!F)return d.push({id:t,reason:`${t} has no test definition in the graph`}),null;let h=x.split(`
3
3
  `).map(o=>{let i=P.exec(o.trim());if(!i)return o;let u=i[1];if(!n.resolve(u))return o;let _=b(u,[...f,t]);if(!_)throw new g(`dependency ${u} could not be minted/located`);return`@import ./${_}`}).join(`
4
4
  `),T=`---
5
5
  assurance:
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as n}from"./chunk-RZ4F3BHX.js";import{a as c}from"./chunk-RH4GCEFX.js";import{v as s,w as a}from"./chunk-2KS2YRIS.js";import{createHash as h,randomBytes as g}from"crypto";var l=class{authBaseUrl;consentUrl;constructor(t="prod"){let e=c(t);this.authBaseUrl=e.authBaseUrl,this.consentUrl=e.consentUrl}static generatePkce(){let t=g(96).toString("base64url").slice(0,128),e=h("sha256").update(t).digest("base64url");return[t,e]}buildAuthorizationUrl(t,e,r,o){let i=new URLSearchParams({response_type:"code",client_id:t,redirect_uri:o,scope:a,code_challenge:e,code_challenge_method:"S256",state:r});return`${this.consentUrl}/oauth2?${i.toString()}`}async registerClient(t){let e=await n(`${this.authBaseUrl}/oauth2/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:s,redirect_uris:[t],grant_types:["authorization_code"],response_types:["code"],client_type:"public",application_type:"native"})});if(!e.ok)throw new Error(`DCR failed: ${e.status} ${await e.text()}`);return e.json()}async exchangeCode(t,e,r,o){let i=await n(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:t,redirect_uri:o,client_id:e,code_verifier:r})});if(!i.ok)throw new Error(`Token exchange failed: ${i.status}`);return i.json()}async refreshToken(t,e){let r=await n(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:t,client_id:e})});if(!r.ok)throw new Error(`Token refresh failed: ${r.status}`);return r.json()}async revokeToken(t,e,r="access_token"){await n(`${this.authBaseUrl}/oauth2/revoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,token_type_hint:r,client_id:e})})}async validateToken(t){let e=new AbortController,r=setTimeout(()=>e.abort(),1e4);try{let o=await n(`${this.authBaseUrl}/api/user`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json","Content-Type":"application/json"},signal:e.signal});return clearTimeout(r),o.ok}catch{return clearTimeout(r),!1}}};export{l as a};
2
+ import{a as n}from"./chunk-RZ4F3BHX.js";import{a as c}from"./chunk-KHJXOFDM.js";import{v as s,w as a}from"./chunk-MMPFU2YC.js";import{createHash as h,randomBytes as g}from"crypto";var l=class{authBaseUrl;consentUrl;constructor(t="prod"){let e=c(t);this.authBaseUrl=e.authBaseUrl,this.consentUrl=e.consentUrl}static generatePkce(){let t=g(96).toString("base64url").slice(0,128),e=h("sha256").update(t).digest("base64url");return[t,e]}buildAuthorizationUrl(t,e,r,o){let i=new URLSearchParams({response_type:"code",client_id:t,redirect_uri:o,scope:a,code_challenge:e,code_challenge_method:"S256",state:r});return`${this.consentUrl}/oauth2?${i.toString()}`}async registerClient(t){let e=await n(`${this.authBaseUrl}/oauth2/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:s,redirect_uris:[t],grant_types:["authorization_code"],response_types:["code"],client_type:"public",application_type:"native"})});if(!e.ok)throw new Error(`DCR failed: ${e.status} ${await e.text()}`);return e.json()}async exchangeCode(t,e,r,o){let i=await n(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:t,redirect_uri:o,client_id:e,code_verifier:r})});if(!i.ok)throw new Error(`Token exchange failed: ${i.status}`);return i.json()}async refreshToken(t,e){let r=await n(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:t,client_id:e})});if(!r.ok)throw new Error(`Token refresh failed: ${r.status}`);return r.json()}async revokeToken(t,e,r="access_token"){await n(`${this.authBaseUrl}/oauth2/revoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,token_type_hint:r,client_id:e})})}async validateToken(t){let e=new AbortController,r=setTimeout(()=>e.abort(),1e4);try{let o=await n(`${this.authBaseUrl}/api/user`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json","Content-Type":"application/json"},signal:e.signal});return clearTimeout(r),o.ok}catch{return clearTimeout(r),!1}}};export{l as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as S,b as A,d as P}from"./chunk-GRB66C5S.js";import{a as U}from"./chunk-JFAFKHDX.js";import{a as O}from"./chunk-3C5GMAM4.js";import{a as G}from"./chunk-DNNZ353O.js";import{a as E,b as $}from"./chunk-SDRFTIRU.js";import{b as T}from"./chunk-A46NBRAP.js";import{d as g,e as m}from"./chunk-5YPBPZUR.js";var v=(e,t,n=new Set)=>{let o=e.nameOf.get(t);if(o!==void 0)return o;if(n.has(t))return t;n.add(t);for(let[s,r]of e.superseded){if(r!==t)continue;let c=v(e,s,n);if(c!==s)return c}return t};function M(e,t){let n=e.stale(t);if(n==="fresh")return;if(n==="orphaned")return"orphaned \u2014 no live source evidences this item";let o=[],s=new Map;for(let r of e.derivesInto(t))s.set(String(r.props.source_id),r);for(let[r,c]of s){let i=e.heads.get(r);if(i==null||i===c.props.source_cid)continue;let u=e.convChains.get(r)?.chain;u&&u.includes(String(c.props.source_cid))||o.push(`DERIVES pin ${r}@${String(c.props.source_cid).slice(0,19)} broke \u2014 the source head moved`)}for(let r of e.edgesFrom(t)){if(r.type===m.DERIVES||!e.superseded.has(r.dst))continue;let c=e.tipOf(r.dst);if(e.superseded.has(c)){o.push(`${r.type} pin \u2192 ${v(e,r.dst)} \u2014 target retired`);continue}let i=L(e,r.dst,c);o.push(i.length>0?`${v(e,r.dst)} updated: ${i.map(u=>u.field).join(", ")}`:`${r.type} pin \u2192 ${v(e,r.dst)} \u2014 target superseded`)}return o.length>0?o.join("; "):"stale \u2014 a pinned dependency moved"}function L(e,t,n){let o=e.getNode(t)?.content??{},s=e.getNode(n)?.content??{},r=i=>i===void 0?"":Array.isArray(i)?i.map(String).join(" \xB7 "):typeof i=="object"?JSON.stringify(i):String(i),c=[];for(let i of[...new Set([...Object.keys(o),...Object.keys(s)])].sort())JSON.stringify(o[i])!==JSON.stringify(s[i])&&c.push({field:i,old:r(o[i]),new:r(s[i])});return c}function V(e,t){let n=[];for(let{cid:o}of e.byLabel(g.SCENARIO))e.superseded.has(o)||e.edgesFrom(o).some(s=>s.type===m.BELONGS_TO&&e.tipOf(s.dst)===t)&&n.push(o);return n}function R(e,t){let n=[],o=[],s=[],r=V(e,t),c=new Set(r),i=(u,f)=>{let a=M(e,f);return a===void 0?u:{...u,stale:!0,stale_reason:a}};for(let u of r){let f=e.getNode(u)?.content??{};n.push(i({ref:v(e,u),title:String(f.title??""),case_type:String(f.case_type??""),intent:String(f.intent??"")},u));for(let a of e.edgesInto(u)){if(a.type!==m.AUTOMATES||e.superseded.has(a.src))continue;let d=e.getNode(a.src)?.content??{},l=e.edgesFrom(a.src).filter(p=>p.type===m.VERIFIES&&!e.superseded.has(p.dst)).map(p=>v(e,p.dst));o.push(i({ref:v(e,a.src),title:String(d.title??""),check:d.check,verifies:l},a.src))}}for(let{cid:u}of e.byLabel(g.AC)){if(e.superseded.has(u))continue;let f=e.edgesFrom(u).find(p=>p.type===m.SCOPED_TO);if(!f)continue;let a=e.tipOf(f.dst);if(!(a===t||c.has(a)))continue;let l=e.getNode(u)?.content??{};s.push(i({ref:v(e,u),text:String(l.text??""),kind:String(l.kind??""),scope:a===t?"use-case":v(e,a)},u))}return{scenarios:n,tests:o,acs:s}}function I(e,t,n){let o=G(e,t,n);return o===null?null:o.toString("utf8")}function q(e,t){let n=t.split(`
2
+ import{a as S,b as A,d as P}from"./chunk-GRB66C5S.js";import{a as U}from"./chunk-JFAFKHDX.js";import{a as O}from"./chunk-3C5GMAM4.js";import{a as G}from"./chunk-DNNZ353O.js";import{a as E,b as $}from"./chunk-7E24OCGX.js";import{b as T}from"./chunk-6W6AIDLJ.js";import{d as g,e as m}from"./chunk-5YPBPZUR.js";var v=(e,t,n=new Set)=>{let o=e.nameOf.get(t);if(o!==void 0)return o;if(n.has(t))return t;n.add(t);for(let[s,r]of e.superseded){if(r!==t)continue;let c=v(e,s,n);if(c!==s)return c}return t};function M(e,t){let n=e.stale(t);if(n==="fresh")return;if(n==="orphaned")return"orphaned \u2014 no live source evidences this item";let o=[],s=new Map;for(let r of e.derivesInto(t))s.set(String(r.props.source_id),r);for(let[r,c]of s){let i=e.heads.get(r);if(i==null||i===c.props.source_cid)continue;let u=e.convChains.get(r)?.chain;u&&u.includes(String(c.props.source_cid))||o.push(`DERIVES pin ${r}@${String(c.props.source_cid).slice(0,19)} broke \u2014 the source head moved`)}for(let r of e.edgesFrom(t)){if(r.type===m.DERIVES||!e.superseded.has(r.dst))continue;let c=e.tipOf(r.dst);if(e.superseded.has(c)){o.push(`${r.type} pin \u2192 ${v(e,r.dst)} \u2014 target retired`);continue}let i=L(e,r.dst,c);o.push(i.length>0?`${v(e,r.dst)} updated: ${i.map(u=>u.field).join(", ")}`:`${r.type} pin \u2192 ${v(e,r.dst)} \u2014 target superseded`)}return o.length>0?o.join("; "):"stale \u2014 a pinned dependency moved"}function L(e,t,n){let o=e.getNode(t)?.content??{},s=e.getNode(n)?.content??{},r=i=>i===void 0?"":Array.isArray(i)?i.map(String).join(" \xB7 "):typeof i=="object"?JSON.stringify(i):String(i),c=[];for(let i of[...new Set([...Object.keys(o),...Object.keys(s)])].sort())JSON.stringify(o[i])!==JSON.stringify(s[i])&&c.push({field:i,old:r(o[i]),new:r(s[i])});return c}function V(e,t){let n=[];for(let{cid:o}of e.byLabel(g.SCENARIO))e.superseded.has(o)||e.edgesFrom(o).some(s=>s.type===m.BELONGS_TO&&e.tipOf(s.dst)===t)&&n.push(o);return n}function R(e,t){let n=[],o=[],s=[],r=V(e,t),c=new Set(r),i=(u,f)=>{let a=M(e,f);return a===void 0?u:{...u,stale:!0,stale_reason:a}};for(let u of r){let f=e.getNode(u)?.content??{};n.push(i({ref:v(e,u),title:String(f.title??""),case_type:String(f.case_type??""),intent:String(f.intent??"")},u));for(let a of e.edgesInto(u)){if(a.type!==m.AUTOMATES||e.superseded.has(a.src))continue;let d=e.getNode(a.src)?.content??{},l=e.edgesFrom(a.src).filter(p=>p.type===m.VERIFIES&&!e.superseded.has(p.dst)).map(p=>v(e,p.dst));o.push(i({ref:v(e,a.src),title:String(d.title??""),check:d.check,verifies:l},a.src))}}for(let{cid:u}of e.byLabel(g.AC)){if(e.superseded.has(u))continue;let f=e.edgesFrom(u).find(p=>p.type===m.SCOPED_TO);if(!f)continue;let a=e.tipOf(f.dst);if(!(a===t||c.has(a)))continue;let l=e.getNode(u)?.content??{};s.push(i({ref:v(e,u),text:String(l.text??""),kind:String(l.kind??""),scope:a===t?"use-case":v(e,a)},u))}return{scenarios:n,tests:o,acs:s}}function I(e,t,n){let o=G(e,t,n);return o===null?null:o.toString("utf8")}function q(e,t){let n=t.split(`
3
3
  `).map(s=>s.replace(/^\d+\| /,"")),o=[];for(let s of e.split(`
4
4
  `)){let r=s.trim();if(r.length===0)continue;let c=n.find(i=>i.includes(r));c!==void 0&&!o.includes(c.trim())&&o.push(c.trim())}return o.length>0?o.join(`
5
- `):{removed:!0}}function J(e,t,n,o){if(o!==void 0&&o.trim().length>0)return{kind:"user-directive",text:o.trim()};let s=[n,...R(t,n).acs.map(u=>t.resolve(u.ref)?.cid??"")].filter(Boolean),r=[],c=new Set;for(let u of s){let f=new Map;for(let a of t.derivesInto(u))f.set(String(a.props.source_id),a);for(let[a,d]of f){let l=t.heads.get(a);if(l==null||l===d.props.source_cid)continue;let p=String(d.props.anchor),b=`${a}\0${p}`;if(c.has(b)||p==="img#whole")continue;c.add(b);let k=I(e,t,String(d.props.source_cid)),w=k===null?null:T(k,p);if(w===null)continue;let x=I(e,t,l);r.push({source_id:a,anchor:p,old_anchor_text:w,new_anchor_text:x===null?{removed:!0}:q(w,x)})}}let i;for(let[u,f]of t.superseded){if(f!==n||t.nodeLabel.get(u)!==g.USECASE)continue;let a=L(t,u,n);a.length>0&&(i=a);break}return{kind:"source-change",changes:r,...i?{uc_updated:i}:{}}}function N(e,t,n,o){let s=R(t,n);if(s.scenarios.length===0&&s.tests.length===0&&s.acs.length===0)return;let r=J(e,t,n,o);if(!(r.kind==="source-change"&&r.changes.length===0&&!r.uc_updated))return{prior_design:s,change_delta:r}}var _=new Set([g.USECASE,g.SCENARIO,g.AC,g.TEST]);function h(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function y(e,t,n){let o=e.edgesFrom(t).find(s=>s.type===n);return o?e.tipOf(o.dst):null}function D(e,t,n){if(n===g.USECASE)return t;if(n===g.SCENARIO)return y(e,t,m.BELONGS_TO);if(n===g.AC){let o=y(e,t,m.SCOPED_TO);return o?e.nodeLabel.get(o)===g.USECASE?o:y(e,o,m.BELONGS_TO):null}if(n===g.TEST){let o=y(e,t,m.AUTOMATES);return o?y(e,o,m.BELONGS_TO):null}return null}function j(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[o,s]of e.names)if(e.tipOf(s)===t)return o;return t}function B(e,t){return{ucTip:t,display:j(e,t),seamRef:e.nameOf.get(t)??t}}function Y(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let o=n.tip,s=e.nodeLabel.get(o);if(!s||!_.has(s))return{ok:!1,message:`'${t}' is a ${s??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let r=D(e,o,s);return!r||e.nodeLabel.get(r)!==g.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${s} chain is broken`}:e.superseded.has(r)?{ok:!1,message:`use-case ${j(e,r)} was removed \u2014 nothing to evolve`}:{ok:!0,target:B(e,r)}}function ae(e,t){return C(e,t)}function C(e,t){let n=[];for(let{cid:s}of e.byLabel(g.SCENARIO)){if(!h(e,s)||!e.edgesFrom(s).some(c=>c.type===m.BELONGS_TO&&e.tipOf(c.dst)===t))continue;let r=e.edgesInto(s).filter(c=>c.type===m.AUTOMATES&&h(e,c.src));if(r.length===0)n.push({scenario:s,test:null});else for(let c of r)n.push({scenario:s,test:c.src})}let o=new Map;for(let{cid:s}of e.byLabel(g.AC)){if(!h(e,s)||D(e,s,g.AC)!==t)continue;let r=e.edgesInto(s).filter(c=>c.type===m.VERIFIES&&h(e,c.src)).map(c=>c.src).sort();o.set(s,r)}return{pairs:n,verifies:o}}function H(e,t){let n=c=>`${c.scenario}\0${c.test??""}`,o=new Set(e.pairs.map(n)),s=new Set(t.pairs.map(n)),r=[];for(let[c,i]of e.verifies){let u=t.verifies.get(c);u&&(i.length===u.length&&i.every((f,a)=>f===u[a])||r.push({ac:c,before:i,after:u}))}return{superseded:e.pairs.filter(c=>!s.has(n(c))),minted:t.pairs.filter(c=>!o.has(n(c))),retained:t.pairs.filter(c=>o.has(n(c))),moves:r}}function z(e,t,n,o,s){let r=i=>t.nameOf.get(i)??i,c=i=>` - ${r(i.scenario)} \xB7 ${i.test?r(i.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${o.before} \u2192 ${o.after}`),e.out(`superseded: ${s.superseded.length} pair(s)`);for(let i of s.superseded)e.out(c(i));e.out(`minted: ${s.minted.length} pair(s)`);for(let i of s.minted)e.out(c(i));e.out(`retained: ${s.retained.length} pair(s)`);for(let i of s.retained)e.out(c(i));if(s.moves.length===0)e.out("verifies moves: none");else{e.out("verifies moves:");for(let i of s.moves){let u=f=>f.length>0?f.map(r).join(" + "):"(none)";e.out(` - ${r(i.ac)}: ${u(i.before)} \u2192 ${u(i.after)}`)}}}async function F(e,t,n,o,s,r){let c=E(e),i=O(c,t.ucTip);if(!i)return r==="batch"?(o.out(`note: ${t.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${t.display} first`),{code:0,outcome:"no-design"}):(S(o,`nothing to evolve \u2014 run kane-cli design tests --use-case ${t.display} first (no design output)`),{code:2,outcome:"no-design"});let u=C(c,t.ucTip),f=`evolve re-designs the parent use-case ${t.display}; ${u.pairs.length} pair(s) affected`;if(n.yes)o.out(f);else if(!await o.confirm(`${f} \u2014 proceed?`))return o.out(r==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"};let a=N(e,c,t.ucTip,n.because),d=await s(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...a!==void 0?{changeDelta:a.change_delta,priorDesign:a.prior_design}:{}});if(d===3)return o.out(`design session for ${t.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:d,outcome:"paused"};if(d!==0)return S(o,`design run for ${t.display} ended with exit code ${d} \u2014 no diff to report`),{code:d,outcome:"failed"};let l=E(e),p=l.tipOf(t.ucTip),b=O(l,p)?.seq;return z(o,l,t.display,{before:i.seq,after:b??"?"},H(u,C(l,p))),{code:0,outcome:"evolved"}}function K(e){let t=new Map,n=0;for(let{cid:s,state:r}of e.staleList()){if(r==="superseded")continue;let c=e.nodeLabel.get(s);if(!c||!_.has(c)||!h(e,s)||!$(e,s))continue;let i=D(e,s,c);!i||e.nodeLabel.get(i)!==g.USECASE||e.superseded.has(i)||(n++,t.has(i)||t.set(i,B(e,i)))}return{targets:[...t.values()].sort((s,r)=>s.display<r.display?-1:s.display>r.display?1:0),staleCount:n}}function Q(e,t){for(let{cid:n,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(n);if(!(!s||!_.has(s)||!h(e,n))&&$(e,n)&&D(e,n,s)===t)return!0}return!1}async function W(e,t,n,o={},s=process.cwd()){if(e&&t.fromStale)return S(n,"pass a <ref> OR --from-stale, not both"),2;if(!e&&!t.fromStale)return S(n,"evolve needs a <ref> or --from-stale"),2;let r=A(s,n);if(!r)return 2;let c=o.runDesignForUc??X;n.out(`evolving ${e??"stale use-cases"}: reading the graph\u2026`);let i=E(r),u,f=null;if(e){let d=Y(i,e);if(!d.ok)return S(n,d.message),2;if(!t.because&&O(i,d.target.ucTip)&&!Q(i,d.target.ucTip))return S(n,`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;u=[d.target]}else{let{targets:d,staleCount:l}=K(i);if(d.length===0)return n.out("nothing stale \u2014 nothing to evolve"),0;f=`from-stale: ${l} stale node(s) \u2192 ${d.length} use-case(s)`,u=d}if(!t.yes&&!n.isTTY)return S(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless evolution rides `kane-cli maintain reconcile`"),2;if(f&&n.out(f),e){let d=await F(r,u[0],t,n,c,"single");return d.outcome==="evolved"&&t.because&&U(r,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:t.because}),d.code}let a=0;for(let d of u){let{code:l}=await F(r,d,t,n,c,"batch");l!==0&&a===0&&(a=l)}return a}var X=async(e,t)=>{let{designTestsCommand:n}=await import("./bind-FEOGBJ2O.js"),o=()=>n({useCase:e,force:!0,...t.mode?{mode:t.mode}:t.yes?{mode:"override"}:{},...t.because?{because:t.because}:{},...t.changeDelta!==void 0?{changeDelta:t.changeDelta}:{},...t.priorDesign!==void 0?{priorDesign:t.priorDesign}:{}});if(t.mode!=="agent")return o();let s=process.stdout.write;process.stdout.write=((...r)=>!0);try{return await o()}finally{process.stdout.write=s}};async function de(e,t){return W(e,t,P(),{})}export{Y as a,ae as b,F as c,K as d,W as e,X as f,de as g};
5
+ `):{removed:!0}}function J(e,t,n,o){if(o!==void 0&&o.trim().length>0)return{kind:"user-directive",text:o.trim()};let s=[n,...R(t,n).acs.map(u=>t.resolve(u.ref)?.cid??"")].filter(Boolean),r=[],c=new Set;for(let u of s){let f=new Map;for(let a of t.derivesInto(u))f.set(String(a.props.source_id),a);for(let[a,d]of f){let l=t.heads.get(a);if(l==null||l===d.props.source_cid)continue;let p=String(d.props.anchor),b=`${a}\0${p}`;if(c.has(b)||p==="img#whole")continue;c.add(b);let k=I(e,t,String(d.props.source_cid)),w=k===null?null:T(k,p);if(w===null)continue;let x=I(e,t,l);r.push({source_id:a,anchor:p,old_anchor_text:w,new_anchor_text:x===null?{removed:!0}:q(w,x)})}}let i;for(let[u,f]of t.superseded){if(f!==n||t.nodeLabel.get(u)!==g.USECASE)continue;let a=L(t,u,n);a.length>0&&(i=a);break}return{kind:"source-change",changes:r,...i?{uc_updated:i}:{}}}function N(e,t,n,o){let s=R(t,n);if(s.scenarios.length===0&&s.tests.length===0&&s.acs.length===0)return;let r=J(e,t,n,o);if(!(r.kind==="source-change"&&r.changes.length===0&&!r.uc_updated))return{prior_design:s,change_delta:r}}var _=new Set([g.USECASE,g.SCENARIO,g.AC,g.TEST]);function h(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function y(e,t,n){let o=e.edgesFrom(t).find(s=>s.type===n);return o?e.tipOf(o.dst):null}function D(e,t,n){if(n===g.USECASE)return t;if(n===g.SCENARIO)return y(e,t,m.BELONGS_TO);if(n===g.AC){let o=y(e,t,m.SCOPED_TO);return o?e.nodeLabel.get(o)===g.USECASE?o:y(e,o,m.BELONGS_TO):null}if(n===g.TEST){let o=y(e,t,m.AUTOMATES);return o?y(e,o,m.BELONGS_TO):null}return null}function j(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[o,s]of e.names)if(e.tipOf(s)===t)return o;return t}function B(e,t){return{ucTip:t,display:j(e,t),seamRef:e.nameOf.get(t)??t}}function Y(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let o=n.tip,s=e.nodeLabel.get(o);if(!s||!_.has(s))return{ok:!1,message:`'${t}' is a ${s??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let r=D(e,o,s);return!r||e.nodeLabel.get(r)!==g.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${s} chain is broken`}:e.superseded.has(r)?{ok:!1,message:`use-case ${j(e,r)} was removed \u2014 nothing to evolve`}:{ok:!0,target:B(e,r)}}function ae(e,t){return C(e,t)}function C(e,t){let n=[];for(let{cid:s}of e.byLabel(g.SCENARIO)){if(!h(e,s)||!e.edgesFrom(s).some(c=>c.type===m.BELONGS_TO&&e.tipOf(c.dst)===t))continue;let r=e.edgesInto(s).filter(c=>c.type===m.AUTOMATES&&h(e,c.src));if(r.length===0)n.push({scenario:s,test:null});else for(let c of r)n.push({scenario:s,test:c.src})}let o=new Map;for(let{cid:s}of e.byLabel(g.AC)){if(!h(e,s)||D(e,s,g.AC)!==t)continue;let r=e.edgesInto(s).filter(c=>c.type===m.VERIFIES&&h(e,c.src)).map(c=>c.src).sort();o.set(s,r)}return{pairs:n,verifies:o}}function H(e,t){let n=c=>`${c.scenario}\0${c.test??""}`,o=new Set(e.pairs.map(n)),s=new Set(t.pairs.map(n)),r=[];for(let[c,i]of e.verifies){let u=t.verifies.get(c);u&&(i.length===u.length&&i.every((f,a)=>f===u[a])||r.push({ac:c,before:i,after:u}))}return{superseded:e.pairs.filter(c=>!s.has(n(c))),minted:t.pairs.filter(c=>!o.has(n(c))),retained:t.pairs.filter(c=>o.has(n(c))),moves:r}}function z(e,t,n,o,s){let r=i=>t.nameOf.get(i)??i,c=i=>` - ${r(i.scenario)} \xB7 ${i.test?r(i.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${o.before} \u2192 ${o.after}`),e.out(`superseded: ${s.superseded.length} pair(s)`);for(let i of s.superseded)e.out(c(i));e.out(`minted: ${s.minted.length} pair(s)`);for(let i of s.minted)e.out(c(i));e.out(`retained: ${s.retained.length} pair(s)`);for(let i of s.retained)e.out(c(i));if(s.moves.length===0)e.out("verifies moves: none");else{e.out("verifies moves:");for(let i of s.moves){let u=f=>f.length>0?f.map(r).join(" + "):"(none)";e.out(` - ${r(i.ac)}: ${u(i.before)} \u2192 ${u(i.after)}`)}}}async function F(e,t,n,o,s,r){let c=E(e),i=O(c,t.ucTip);if(!i)return r==="batch"?(o.out(`note: ${t.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${t.display} first`),{code:0,outcome:"no-design"}):(S(o,`nothing to evolve \u2014 run kane-cli design tests --use-case ${t.display} first (no design output)`),{code:2,outcome:"no-design"});let u=C(c,t.ucTip),f=`evolve re-designs the parent use-case ${t.display}; ${u.pairs.length} pair(s) affected`;if(n.yes)o.out(f);else if(!await o.confirm(`${f} \u2014 proceed?`))return o.out(r==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"};let a=N(e,c,t.ucTip,n.because),d=await s(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...a!==void 0?{changeDelta:a.change_delta,priorDesign:a.prior_design}:{}});if(d===3)return o.out(`design session for ${t.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:d,outcome:"paused"};if(d!==0)return S(o,`design run for ${t.display} ended with exit code ${d} \u2014 no diff to report`),{code:d,outcome:"failed"};let l=E(e),p=l.tipOf(t.ucTip),b=O(l,p)?.seq;return z(o,l,t.display,{before:i.seq,after:b??"?"},H(u,C(l,p))),{code:0,outcome:"evolved"}}function K(e){let t=new Map,n=0;for(let{cid:s,state:r}of e.staleList()){if(r==="superseded")continue;let c=e.nodeLabel.get(s);if(!c||!_.has(c)||!h(e,s)||!$(e,s))continue;let i=D(e,s,c);!i||e.nodeLabel.get(i)!==g.USECASE||e.superseded.has(i)||(n++,t.has(i)||t.set(i,B(e,i)))}return{targets:[...t.values()].sort((s,r)=>s.display<r.display?-1:s.display>r.display?1:0),staleCount:n}}function Q(e,t){for(let{cid:n,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(n);if(!(!s||!_.has(s)||!h(e,n))&&$(e,n)&&D(e,n,s)===t)return!0}return!1}async function W(e,t,n,o={},s=process.cwd()){if(e&&t.fromStale)return S(n,"pass a <ref> OR --from-stale, not both"),2;if(!e&&!t.fromStale)return S(n,"evolve needs a <ref> or --from-stale"),2;let r=A(s,n);if(!r)return 2;let c=o.runDesignForUc??X;n.out(`evolving ${e??"stale use-cases"}: reading the graph\u2026`);let i=E(r),u,f=null;if(e){let d=Y(i,e);if(!d.ok)return S(n,d.message),2;if(!t.because&&O(i,d.target.ucTip)&&!Q(i,d.target.ucTip))return S(n,`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;u=[d.target]}else{let{targets:d,staleCount:l}=K(i);if(d.length===0)return n.out("nothing stale \u2014 nothing to evolve"),0;f=`from-stale: ${l} stale node(s) \u2192 ${d.length} use-case(s)`,u=d}if(!t.yes&&!n.isTTY)return S(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless evolution rides `kane-cli maintain reconcile`"),2;if(f&&n.out(f),e){let d=await F(r,u[0],t,n,c,"single");return d.outcome==="evolved"&&t.because&&U(r,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:t.because}),d.code}let a=0;for(let d of u){let{code:l}=await F(r,d,t,n,c,"batch");l!==0&&a===0&&(a=l)}return a}var X=async(e,t)=>{let{designTestsCommand:n}=await import("./bind-QJT726NE.js"),o=()=>n({useCase:e,force:!0,...t.mode?{mode:t.mode}:t.yes?{mode:"override"}:{},...t.because?{because:t.because}:{},...t.changeDelta!==void 0?{changeDelta:t.changeDelta}:{},...t.priorDesign!==void 0?{priorDesign:t.priorDesign}:{}});if(t.mode!=="agent")return o();let s=process.stdout.write;process.stdout.write=((...r)=>!0);try{return await o()}finally{process.stdout.write=s}};async function de(e,t){return W(e,t,P(),{})}export{Y as a,ae as b,F as c,K as d,W as e,X as f,de as g};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as j}from"./chunk-5Z7GAIPP.js";import{a as U}from"./chunk-DNNZ353O.js";import{d as F}from"./chunk-QM4S2APK.js";import{a as x}from"./chunk-SDRFTIRU.js";import{a as D,b as M,e as G,f as N}from"./chunk-A46NBRAP.js";import{b as V}from"./chunk-MBXWXBDM.js";import{d as b,e as $,g as P}from"./chunk-5YPBPZUR.js";function W(e,n,t,i,o){let d=t.rows.filter(p=>{let u=i.get(p.temp_ref);return u!==void 0&&u!=="reject"});if(d.length===0)return{record:null,errors:null};let s={version:1,read_basis:n.latestHash,source:{source_id:t.source_id,source_cid:n.heads.get(t.source_id)??""},use_cases:d.map(p=>p.uc)},g=new Map;for(let p of d){let u=i.get(p.temp_ref);typeof u=="object"?g.set(p.temp_ref,{resolution:"edited",edit:u.edited}):g.set(p.temp_ref,{resolution:p.uc.matches_existing&&p.uc.changed?"edited":"approved"})}let l=ee(s,n,t.staged_source_cid);if(l.errors!==null)return{record:null,errors:l.errors};let r=l.proposal,f=s.source.source_cid?L(e,n,s.source.source_cid):null;if(f!==null){r=Z(r,f);let p=G(r,z(f),n);if(p.length>0)return{record:null,errors:[{code:"HELD_CITES_STALE",detail:"the source moved after this plan staged \u2014 its quotes no longer verify against the current head; re-run kane-cli maintain reconcile to re-stage"},...p]}}let m=`held-${(n.latestHash??"root").slice(-12)}-${d.length}`;return N({contextDir:e,graph:n,proposal:r,proposalId:m,verdicts:g,by:o,autoName:!0})}function z(e){return e.replace(/\n$/,"").split(`
2
+ import{b as j}from"./chunk-54IB6CXK.js";import{a as U}from"./chunk-DNNZ353O.js";import{d as F}from"./chunk-QM4S2APK.js";import{a as x}from"./chunk-7E24OCGX.js";import{a as D,b as M,e as G,f as N}from"./chunk-6W6AIDLJ.js";import{b as V}from"./chunk-J2KSZUOO.js";import{d as b,e as $,g as P}from"./chunk-5YPBPZUR.js";function W(e,n,t,i,o){let d=t.rows.filter(p=>{let u=i.get(p.temp_ref);return u!==void 0&&u!=="reject"});if(d.length===0)return{record:null,errors:null};let s={version:1,read_basis:n.latestHash,source:{source_id:t.source_id,source_cid:n.heads.get(t.source_id)??""},use_cases:d.map(p=>p.uc)},g=new Map;for(let p of d){let u=i.get(p.temp_ref);typeof u=="object"?g.set(p.temp_ref,{resolution:"edited",edit:u.edited}):g.set(p.temp_ref,{resolution:p.uc.matches_existing&&p.uc.changed?"edited":"approved"})}let l=ee(s,n,t.staged_source_cid);if(l.errors!==null)return{record:null,errors:l.errors};let r=l.proposal,f=s.source.source_cid?L(e,n,s.source.source_cid):null;if(f!==null){r=Z(r,f);let p=G(r,z(f),n);if(p.length>0)return{record:null,errors:[{code:"HELD_CITES_STALE",detail:"the source moved after this plan staged \u2014 its quotes no longer verify against the current head; re-run kane-cli maintain reconcile to re-stage"},...p]}}let m=`held-${(n.latestHash??"root").slice(-12)}-${d.length}`;return N({contextDir:e,graph:n,proposal:r,proposalId:m,verdicts:g,by:o,autoName:!0})}function z(e){return e.replace(/\n$/,"").split(`
3
3
  `).map((t,i)=>`${String(i+1).padStart(4,"0")}| ${t}`).join(`
4
4
  `)}function Z(e,n){let t=n.replace(/\n$/,""),i=z(n),o=d=>{if(!d?.quote)return d;let s=M(i,d.anchor);if(s!==null&&s.includes(d.quote))return d;let g=t.indexOf(d.quote);if(g===-1||t.indexOf(d.quote,g+1)!==-1)return d;let l=t.slice(0,g).split(`
5
5
  `).length,r=l+d.quote.replace(/\n$/,"").split(`
@@ -9,6 +9,6 @@ import{b as j}from"./chunk-5Z7GAIPP.js";import{a as U}from"./chunk-DNNZ353O.js";
9
9
  `),o=0;for(;o<t.length&&o<i.length&&t[o]===i[o];)o++;let d=t.length,s=i.length;for(;d>o&&s>o&&t[d-1]===i[s-1];)d--,s--;if(d===o&&s===o)return"";let g=t.slice(o,d),l=i.slice(o,s),f=ie(g,l,2e3),m=[];if(f===null)m.push(`@@ old L${o+1}-L${d} \u2192 new L${o+1}-L${s} @@`,...g.map(p=>`- ${p}`),...l.map(p=>`+ ${p}`));else{let p=f.map((c,h)=>c.op==="="?-1:h).filter(c=>c>=0),u=0;for(;u<p.length;){let c=u;for(;c+1<p.length&&p[c+1]-p[c]<=3;)c++;let h=Math.max(p[u]-1,0),E=Math.min(p[c]+1,f.length-1),v=f.slice(h,E+1),S=o+(v[0].ai??0)+1,w=o+(v[0].bi??0)+1,a=v.filter(R=>R.op!=="+").length,_=v.filter(R=>R.op!=="-").length;m.push(`@@ old L${S}-L${S+Math.max(a-1,0)} \u2192 new L${w}-L${w+Math.max(_-1,0)} @@`);for(let R of v)m.push(R.op==="="?` ${R.line}`:`${R.op} ${R.line}`);u=c+1}}return m.join(`
10
10
  `)}function ie(e,n,t){let i=e.length,o=n.length,d=Math.min(i+o,t),s=new Map([[1,0]]),g=[],l=!1;for(let p=0;p<=d&&!l;p++){g.push(new Map(s));for(let u=-p;u<=p;u+=2){let c=u===-p||u!==p&&(s.get(u-1)??0)<(s.get(u+1)??0)?s.get(u+1)??0:(s.get(u-1)??0)+1,h=c-u;for(;c<i&&h<o&&e[c]===n[h];)c++,h++;if(s.set(u,c),c>=i&&h>=o){l=!0;break}}}if(!l)return null;let r=i,f=o,m=[];for(let p=g.length-1;p>0;p--){let u=g[p],c=r-f,h=c===-p||c!==p&&(u.get(c-1)??0)<(u.get(c+1)??0)?c+1:c-1,E=u.get(h)??0,v=E-h;for(;r>E&&f>v;)m.push({op:"=",line:e[r-1],ai:r-1,bi:f-1}),r--,f--;p>0&&(r===E?(m.push({op:"+",line:n[f-1],ai:r,bi:f-1}),f--):(m.push({op:"-",line:e[r-1],ai:r-1,bi:f}),r--))}for(;r>0&&f>0;)m.push({op:"=",line:e[r-1],ai:r-1,bi:f-1}),r--,f--;for(;r>0;)m.push({op:"-",line:e[r-1],ai:r-1,bi:0}),r--;for(;f>0;)m.push({op:"+",line:n[f-1],ai:0,bi:f-1}),f--;return m.reverse()}function ce(e){let n=Buffer.byteLength(e,"utf8");if(n<=K+X)return{diff:e,truncated:!1};let t=Buffer.from(e,"utf8"),i=K;for(;i>0&&(t[i]&192)===128;)i--;let o=n-X;for(;o<n&&(t[o]&192)===128;)o++;let d=t.subarray(0,i).toString("utf8"),s=t.subarray(o).toString("utf8");return{diff:`${d}
11
11
  \u2026 [diff truncated: ${n-i-(n-o)} bytes omitted] \u2026
12
- ${s}`,truncated:!0}}function ae(e,n){let t=x(e),i=t.heads.get(n);if(typeof i!="string")return null;let o=[];for(let u of V(e).records){let c=u.source_head_moves?.[n];c!==void 0&&c!==o[o.length-1]&&o.push(c)}let d=o.lastIndexOf(i),s=d>0?o[d-1]:null;if(typeof s!="string"||s===i)return null;let g=L(e,t,s),l=L(e,t,i);if(g===null||l===null)return null;let{diff:r,truncated:f}=ce(oe(g,l)),m=new Set,p=[];for(let u of t.edgesFrom(s))u.type!==$.DERIVES||t.nodeLabel.get(u.dst)!==b.USECASE||m.has(u.dst)||(m.add(u.dst),p.push({id:u.dst,title:String(t.getNode(u.dst)?.content.title??"")}));return{source_id:n,old_head:s,new_head:i,diff:r,...f?{truncated:!0}:{},prior_ucs:p}}function de(e,n,t){let i=e.getNode(n)?.content??{},o=e.getNode(t)?.content??{},s=[...new Set([...Object.keys(i),...Object.keys(o)])].sort().filter(g=>JSON.stringify(i[g])!==JSON.stringify(o[g]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function le(e,n,t,i,o,d,s){let g=new Set((s?.rows??[]).map(c=>c.matched_cid).filter(c=>!!c)),l=[];for(let[c,h]of t.superseded)h===null||c===h||n.superseded.has(c)||t.nodeLabel.get(c)===b.USECASE&&l.push({kind:"MODIFY",ref:y(t,c),old_cid:c,new_cid:h,summary:de(t,c,h)});let r=d.map(c=>({kind:"ADD",ref:y(t,c),cid:c}));for(let c of s?.rows??[])c.kind==="MODIFY"&&c.matched_cid?l.push({kind:"MODIFY",ref:y(t,c.matched_cid),old_cid:c.matched_cid,new_cid:null,summary:`${c.why} (staged)`}):c.kind==="ADD"&&r.push({kind:"ADD",ref:c.title,cid:null});let f=[],m=L(e,t,o),p=new Map;for(let{cid:c}of t.byLabel(b.USECASE)){if(!T(t,c)||g.has(c))continue;let h=t.derivesInto(c),E=h.filter(w=>String(w.props.source_id)===i);E.length===0||E.some(w=>w.props.source_cid===o)||E.some(w=>{let a=String(w.props.anchor),_=D(a);return _?.kind==="img-whole"?!1:_?.kind==="img-part"?se(t,w,o):m!==null&&re(e,t,w,m,p)})||h.some(w=>{let a=String(w.props.source_id);if(a===i)return!1;let _=t.heads.get(a);return _!=null})||f.push({kind:"ARCHIVE",ref:y(t,c),cid:c,why:`evidence decayed: no quote from ${i} relocates into @${C(o)}, no other live source, no fresh evidence this run`,impact:J(t,t.tipOf(c))})}let u=(c,h)=>c.ref<h.ref?-1:c.ref>h.ref?1:0;return[...l.sort(u),...r.sort(u),...f.sort(u)]}function Ee(e,n,t,i,o){let d=n.rows.find(u=>u.temp_ref===t);if(!d)return{ok:!1,message:`held item ${t} missing from the plan artifact`};let s=d,g=x(e);if(s.matched_cid){let u=g.tipOf(s.matched_cid);if(g.superseded.get(u)===null)return{ok:!1,message:`use-case for "${s.title}" was retired meanwhile \u2014 nothing to update`};u!==s.matched_cid&&(s={...s,matched_cid:u,uc:{...s.uc,matches_existing:{cid:u}}})}let l=o?{edited:o}:"approve",r=W(e,g,{source_id:n.source_id,...n.staged_source_cid!==void 0?{staged_source_cid:n.staged_source_cid}:{},rows:[s]},new Map([[s.temp_ref,l]]),i);if(r.errors)return{ok:!1,message:r.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let f=x(e),m=s.matched_cid?f.tipOf(s.matched_cid):r.record?.nodes.find(u=>u.label==="usecase")?.cid??r.record?.review[0]?.id;return{ok:!0,ref:m?y(f,m):s.title,kind:s.kind}}async function ve(e,n,t,i={}){let o=x(e),d=o.heads.get(n)??null,s=new Set(o.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),g=await t.reingest(n);if(g.status==="unchanged"&&!i.resumeHeld)return{source_id:n,changed:!1,head:{status:g.status,before:d,after:g.cid},note:`nothing to reconcile \u2014 ${n} is unchanged`,skipped_arms:B,changeset:[],rows:[]};let l=i.resumeHeld?{minted:[],matched:[],held:i.resumeHeld}:await t.reextract(n),r=x(e),f=l.minted.map(a=>{let _=y(r,a);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${n}`,provenance:`extraction commit \u2014 DERIVES ${n} @ ${C(g.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=r.staleList().filter(a=>a.state==="stale"&&!s.has(a.cid)&&T(r,a.cid)).map(a=>a.cid),p=m.map(a=>{let _=y(r,a),R=ne.has(r.nodeLabel.get(a)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:q(r,a),action:R?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],c=[];for(let a of l.held?.rows??[])if(a.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${C(g.cid)}`,action:"approve to commit + design"});else{let _=a.matched_cid?r.tipOf(a.matched_cid):null,R=_?r.getNode(_)?.content.criteria??[]:[],I=(a.uc.updated?.criteria??[]).map(k=>typeof k=="string"?k:k.text),Q=[...I.filter(k=>!R.includes(k)),...a.uc.updated?.criteria!==void 0?R.filter(k=>!I.includes(k)):[]],H=_?J(r,_,Q):void 0;c.push({kind:"MODIFY",origin:"content-change",ref:a.matched_cid?y(r,a.matched_cid):a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${C(g.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...H?{impact:H}:{}})}let h=new Set;for(let a of[...l.minted,...l.matched])h.add(r.tipOf(a));for(let a of l.held?.rows??[])a.matched_cid&&h.add(r.tipOf(a.matched_cid));for(let a of m){let _=Y(r,r.tipOf(a));_&&r.nodeLabel.get(_)===b.USECASE&&h.add(r.tipOf(_))}let E=[];for(let a of await F(r,"design")){if(a.kind!=="no-verifies")continue;let _=r.resolve(a.ref);if(!_)continue;let R=Y(r,_.tip);!R||!h.has(r.tipOf(R))||E.push({kind:"ADD",origin:"content-change",ref:a.ref,reason:a.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${y(r,R)}`,action:a.ready_command})}let v=[];for(let{cid:a}of r.byLabel(b.USECASE))T(r,a)&&r.stale(a)==="orphaned"&&v.push({kind:"REMOVE",ref:y(r,a),reason:"orphaned \u2014 no live source evidences this use-case",provenance:q(r,a),action:"plan-only \u2014 REMOVE is not executed in this release"});let S=new Set,w=[...f.sort(O),...u.sort(O),...E.sort(O),...c.sort(O),...p.sort(O),...v.sort(O)].filter(a=>{let _=`${a.kind}\0${a.ref}`;return S.has(_)?!1:(S.add(_),!0)});return{source_id:n,changed:!0,head:{status:g.status,before:d,after:g.cid},note:te,skipped_arms:B,changeset:le(e,o,r,n,g.cid,l.minted,l.held),rows:w,...l.held?{held:l.held}:{}}}function be(e,n){return async t=>{let{ingestFile:i}=await import("./ingest-UAIKHOB4.js"),{convertPdf:o}=await import("./pdf-convert-S7VYE6AV.js"),{convertDocx:d}=await import("./docx-convert-IAX54REO.js"),s=await i({contextDir:e,filePath:n,asId:t,converters:{pdf:o,docx:d}});return{status:s.status,cid:s.cid}}}function Re(e,n={}){return async t=>{let i=[],[{runExtract:o},{resolveAgentAuthEnv:d},{runAgent:s},{preflightTurn:g}]=await Promise.all([import("./run-FYJZCWYS.js"),import("./spawner-6FHAXNOA.js"),import("./bridge-WMGH3O3B.js"),import("./turn-preflight-JGYT7LXP.js")]),l=await d(),r=new Set(x(e).byLabel(b.USECASE).map(S=>S.cid)),f=ae(e,t)??void 0,m=0,p=await o({mode:"override",...f?{changeContext:f}:{}},{contextDir:e,agent:s,preflightTurn:()=>g(l),ask:async()=>[],review:async S=>{if(!n.stage)return new Map(S.map(a=>[a.temp_ref,{resolution:a.matches_existing&&a.changed?"edited":"skipped"}]));let w=new Map;for(let a of S){if(a.matches_existing&&!a.changed){w.set(a.temp_ref,{resolution:"skipped"});continue}i.push({kind:a.matches_existing?"MODIFY":"ADD",temp_ref:a.temp_ref,title:a.title,why:a.matches_existing?`updated: ${Object.keys(a.updated??{}).join(", ")||"content"}`:`newly extracted from ${t}`,...a.matches_existing?{matched_cid:a.matches_existing.cid,updated:a.updated}:{},uc:a}),w.set(a.temp_ref,{resolution:"rejected"})}return w},confirmStale:async()=>!1,out:S=>process.stderr.write(S+`
12
+ ${s}`,truncated:!0}}function ae(e,n){let t=x(e),i=t.heads.get(n);if(typeof i!="string")return null;let o=[];for(let u of V(e).records){let c=u.source_head_moves?.[n];c!==void 0&&c!==o[o.length-1]&&o.push(c)}let d=o.lastIndexOf(i),s=d>0?o[d-1]:null;if(typeof s!="string"||s===i)return null;let g=L(e,t,s),l=L(e,t,i);if(g===null||l===null)return null;let{diff:r,truncated:f}=ce(oe(g,l)),m=new Set,p=[];for(let u of t.edgesFrom(s))u.type!==$.DERIVES||t.nodeLabel.get(u.dst)!==b.USECASE||m.has(u.dst)||(m.add(u.dst),p.push({id:u.dst,title:String(t.getNode(u.dst)?.content.title??"")}));return{source_id:n,old_head:s,new_head:i,diff:r,...f?{truncated:!0}:{},prior_ucs:p}}function de(e,n,t){let i=e.getNode(n)?.content??{},o=e.getNode(t)?.content??{},s=[...new Set([...Object.keys(i),...Object.keys(o)])].sort().filter(g=>JSON.stringify(i[g])!==JSON.stringify(o[g]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function le(e,n,t,i,o,d,s){let g=new Set((s?.rows??[]).map(c=>c.matched_cid).filter(c=>!!c)),l=[];for(let[c,h]of t.superseded)h===null||c===h||n.superseded.has(c)||t.nodeLabel.get(c)===b.USECASE&&l.push({kind:"MODIFY",ref:y(t,c),old_cid:c,new_cid:h,summary:de(t,c,h)});let r=d.map(c=>({kind:"ADD",ref:y(t,c),cid:c}));for(let c of s?.rows??[])c.kind==="MODIFY"&&c.matched_cid?l.push({kind:"MODIFY",ref:y(t,c.matched_cid),old_cid:c.matched_cid,new_cid:null,summary:`${c.why} (staged)`}):c.kind==="ADD"&&r.push({kind:"ADD",ref:c.title,cid:null});let f=[],m=L(e,t,o),p=new Map;for(let{cid:c}of t.byLabel(b.USECASE)){if(!T(t,c)||g.has(c))continue;let h=t.derivesInto(c),E=h.filter(w=>String(w.props.source_id)===i);E.length===0||E.some(w=>w.props.source_cid===o)||E.some(w=>{let a=String(w.props.anchor),_=D(a);return _?.kind==="img-whole"?!1:_?.kind==="img-part"?se(t,w,o):m!==null&&re(e,t,w,m,p)})||h.some(w=>{let a=String(w.props.source_id);if(a===i)return!1;let _=t.heads.get(a);return _!=null})||f.push({kind:"ARCHIVE",ref:y(t,c),cid:c,why:`evidence decayed: no quote from ${i} relocates into @${C(o)}, no other live source, no fresh evidence this run`,impact:J(t,t.tipOf(c))})}let u=(c,h)=>c.ref<h.ref?-1:c.ref>h.ref?1:0;return[...l.sort(u),...r.sort(u),...f.sort(u)]}function Ee(e,n,t,i,o){let d=n.rows.find(u=>u.temp_ref===t);if(!d)return{ok:!1,message:`held item ${t} missing from the plan artifact`};let s=d,g=x(e);if(s.matched_cid){let u=g.tipOf(s.matched_cid);if(g.superseded.get(u)===null)return{ok:!1,message:`use-case for "${s.title}" was retired meanwhile \u2014 nothing to update`};u!==s.matched_cid&&(s={...s,matched_cid:u,uc:{...s.uc,matches_existing:{cid:u}}})}let l=o?{edited:o}:"approve",r=W(e,g,{source_id:n.source_id,...n.staged_source_cid!==void 0?{staged_source_cid:n.staged_source_cid}:{},rows:[s]},new Map([[s.temp_ref,l]]),i);if(r.errors)return{ok:!1,message:r.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let f=x(e),m=s.matched_cid?f.tipOf(s.matched_cid):r.record?.nodes.find(u=>u.label==="usecase")?.cid??r.record?.review[0]?.id;return{ok:!0,ref:m?y(f,m):s.title,kind:s.kind}}async function ve(e,n,t,i={}){let o=x(e),d=o.heads.get(n)??null,s=new Set(o.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),g=await t.reingest(n);if(g.status==="unchanged"&&!i.resumeHeld)return{source_id:n,changed:!1,head:{status:g.status,before:d,after:g.cid},note:`nothing to reconcile \u2014 ${n} is unchanged`,skipped_arms:B,changeset:[],rows:[]};let l=i.resumeHeld?{minted:[],matched:[],held:i.resumeHeld}:await t.reextract(n),r=x(e),f=l.minted.map(a=>{let _=y(r,a);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${n}`,provenance:`extraction commit \u2014 DERIVES ${n} @ ${C(g.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=r.staleList().filter(a=>a.state==="stale"&&!s.has(a.cid)&&T(r,a.cid)).map(a=>a.cid),p=m.map(a=>{let _=y(r,a),R=ne.has(r.nodeLabel.get(a)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:q(r,a),action:R?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],c=[];for(let a of l.held?.rows??[])if(a.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${C(g.cid)}`,action:"approve to commit + design"});else{let _=a.matched_cid?r.tipOf(a.matched_cid):null,R=_?r.getNode(_)?.content.criteria??[]:[],I=(a.uc.updated?.criteria??[]).map(k=>typeof k=="string"?k:k.text),Q=[...I.filter(k=>!R.includes(k)),...a.uc.updated?.criteria!==void 0?R.filter(k=>!I.includes(k)):[]],H=_?J(r,_,Q):void 0;c.push({kind:"MODIFY",origin:"content-change",ref:a.matched_cid?y(r,a.matched_cid):a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${C(g.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...H?{impact:H}:{}})}let h=new Set;for(let a of[...l.minted,...l.matched])h.add(r.tipOf(a));for(let a of l.held?.rows??[])a.matched_cid&&h.add(r.tipOf(a.matched_cid));for(let a of m){let _=Y(r,r.tipOf(a));_&&r.nodeLabel.get(_)===b.USECASE&&h.add(r.tipOf(_))}let E=[];for(let a of await F(r,"design")){if(a.kind!=="no-verifies")continue;let _=r.resolve(a.ref);if(!_)continue;let R=Y(r,_.tip);!R||!h.has(r.tipOf(R))||E.push({kind:"ADD",origin:"content-change",ref:a.ref,reason:a.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${y(r,R)}`,action:a.ready_command})}let v=[];for(let{cid:a}of r.byLabel(b.USECASE))T(r,a)&&r.stale(a)==="orphaned"&&v.push({kind:"REMOVE",ref:y(r,a),reason:"orphaned \u2014 no live source evidences this use-case",provenance:q(r,a),action:"plan-only \u2014 REMOVE is not executed in this release"});let S=new Set,w=[...f.sort(O),...u.sort(O),...E.sort(O),...c.sort(O),...p.sort(O),...v.sort(O)].filter(a=>{let _=`${a.kind}\0${a.ref}`;return S.has(_)?!1:(S.add(_),!0)});return{source_id:n,changed:!0,head:{status:g.status,before:d,after:g.cid},note:te,skipped_arms:B,changeset:le(e,o,r,n,g.cid,l.minted,l.held),rows:w,...l.held?{held:l.held}:{}}}function be(e,n){return async t=>{let{ingestFile:i}=await import("./ingest-FIIO67ZN.js"),{convertPdf:o}=await import("./pdf-convert-S7VYE6AV.js"),{convertDocx:d}=await import("./docx-convert-ZBVQO2LG.js"),s=await i({contextDir:e,filePath:n,asId:t,converters:{pdf:o,docx:d}});return{status:s.status,cid:s.cid}}}function Re(e,n={}){return async t=>{let i=[],[{runExtract:o},{resolveAgentAuthEnv:d},{runAgent:s},{preflightTurn:g}]=await Promise.all([import("./run-YH5SCBYD.js"),import("./spawner-7KXVKAD5.js"),import("./bridge-QCMEOQDD.js"),import("./turn-preflight-JGYT7LXP.js")]),l=await d(),r=new Set(x(e).byLabel(b.USECASE).map(S=>S.cid)),f=ae(e,t)??void 0,m=0,p=await o({mode:"override",...f?{changeContext:f}:{}},{contextDir:e,agent:s,preflightTurn:()=>g(l),ask:async()=>[],review:async S=>{if(!n.stage)return new Map(S.map(a=>[a.temp_ref,{resolution:a.matches_existing&&a.changed?"edited":"skipped"}]));let w=new Map;for(let a of S){if(a.matches_existing&&!a.changed){w.set(a.temp_ref,{resolution:"skipped"});continue}i.push({kind:a.matches_existing?"MODIFY":"ADD",temp_ref:a.temp_ref,title:a.title,why:a.matches_existing?`updated: ${Object.keys(a.updated??{}).join(", ")||"content"}`:`newly extracted from ${t}`,...a.matches_existing?{matched_cid:a.matches_existing.cid,updated:a.updated}:{},uc:a}),w.set(a.temp_ref,{resolution:"rejected"})}return w},confirmStale:async()=>!1,out:S=>process.stderr.write(S+`
13
13
  `),progress:S=>process.stderr.write(S+`
14
14
  `),emit:S=>{S.type==="commit"&&typeof S.assumed=="number"&&(m+=S.assumed)},isTTY:!1,auth:l});if(p!==0)throw new Error(`reconcile: re-extract of ${t} failed (exit ${p})`);let u=x(e),c=u.heads.get(t),h=[],E=[];if(typeof c=="string"){let S=new Set;for(let w of u.edgesFrom(c))w.type!==$.DERIVES||u.nodeLabel.get(w.dst)!==b.USECASE||S.has(w.dst)||(S.add(w.dst),!(n.stage&&u.trust.get(w.dst)==="archived")&&(r.has(w.dst)?E:h).push(w.dst))}let v=x(e).heads.get(t);return{minted:h,matched:E,defaultsTaken:m,...n.stage?{held:{source_id:t,...v!=null?{staged_source_cid:v}:{},rows:i}}:{}}}}export{Ee as a,ve as b,be as c,Re as d};