@testmuai/kane-cli 0.8.3 → 0.8.5
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.
- package/dist/{ChatSurface-FJSO3IKR.js → ChatSurface-HAIVTS4J.js} +1 -1
- package/dist/{ChromeProfilePicker-NTZ2RN3L.js → ChromeProfilePicker-5ILSVC2K.js} +1 -1
- package/dist/{CliFeedbackPrompt-BCHUH24C.js → CliFeedbackPrompt-LFKEYMKP.js} +1 -1
- package/dist/{CliUploadProgress-QVAJJRUW.js → CliUploadProgress-Y7ITY2I7.js} +1 -1
- package/dist/{ConfigView-LAKAQN7O.js → ConfigView-OECNNCXC.js} +1 -1
- package/dist/EvidenceViewOffer-FODRAS6Z.js +2 -0
- package/dist/FolderPicker-5U3RHHBE.js +2 -0
- package/dist/{InfoBox-46C7AHDE.js → InfoBox-HWMHNWPM.js} +1 -1
- package/dist/{LinksBox-KFJXZDUJ.js → LinksBox-TAGYCFFO.js} +1 -1
- package/dist/{ProfilesView-FV3KFVBX.js → ProfilesView-QJBR3RCM.js} +1 -1
- package/dist/{ProjectPicker-MCH35VEF.js → ProjectPicker-PP75ILZU.js} +1 -1
- package/dist/{SaveSessionPrompt-RXHP3YW6.js → SaveSessionPrompt-UCRET3II.js} +1 -1
- package/dist/SingleShotApp-XWOPGLKZ.js +2 -0
- package/dist/{SummaryBox-33K2MMUW.js → SummaryBox-SLM3OFS2.js} +1 -1
- package/dist/TestMdRunView-6BY3IUH5.js +2 -0
- package/dist/TestrunEvidenceTable-PTIBYAXO.js +2 -0
- package/dist/{WhoamiView-HUPBB5AQ.js → WhoamiView-WPHMNYUV.js} +1 -1
- package/dist/{app-download-3O7NJNGG.js → app-download-GYQYLGT3.js} +1 -1
- package/dist/{auth-OMWFVDL2.js → auth-3DLNMZC2.js} +1 -1
- package/dist/binary-XJ3RF3VO.js +2 -0
- package/dist/{bind-NXXKFJMA.js → bind-2N4Q6YKH.js} +2 -2
- package/dist/{bootstrap-MMRPAHWE.js → bootstrap-5IHKW5SE.js} +1 -1
- package/dist/bridge-LOBTHY3P.js +2 -0
- package/dist/{changelog-VZ5HFHYM.js → changelog-WCCTI47M.js} +1 -1
- package/dist/{chunk-4G4RWARU.js → chunk-2K2BX23I.js} +1 -1
- package/dist/{chunk-SQDKYSWT.js → chunk-2WSOPZJU.js} +1 -1
- package/dist/{chunk-ITTZYA2G.js → chunk-35EUIBYJ.js} +1 -1
- package/dist/chunk-3AJ3QSF5.js +15 -0
- package/dist/{chunk-AVH3BEEU.js → chunk-4D3DNCQY.js} +1 -1
- package/dist/{chunk-5OVEBP4D.js → chunk-4UMQDH52.js} +1 -1
- package/dist/{chunk-CJJXT5DO.js → chunk-5GUD3CIH.js} +1 -1
- package/dist/{chunk-KZVEFBH5.js → chunk-5NSYHRDN.js} +1 -1
- package/dist/{chunk-DVYO4CR2.js → chunk-5S46D5AJ.js} +1 -1
- package/dist/{chunk-CDB3SYZG.js → chunk-66BSTNLD.js} +1 -1
- package/dist/{chunk-2N4SZOWN.js → chunk-6BTZ2Q4P.js} +1 -1
- package/dist/{chunk-CJP7RX3E.js → chunk-6DTWVLSJ.js} +1 -1
- package/dist/{chunk-XO45NGSN.js → chunk-7JUUNZQP.js} +1 -1
- package/dist/chunk-7PADFQ5S.js +71 -0
- package/dist/{chunk-WMMJXI5O.js → chunk-AJPLHW4T.js} +1 -1
- package/dist/{chunk-5BVOF4UW.js → chunk-AMULIFC5.js} +1 -1
- package/dist/{chunk-EBJD2V4Z.js → chunk-BAL7E4OH.js} +1 -1
- package/dist/chunk-BG66IAO6.js +19 -0
- package/dist/{chunk-3S5DDQLP.js → chunk-BJHII5SD.js} +1 -1
- package/dist/chunk-BVKDHHPK.js +5 -0
- package/dist/chunk-CCUGKBIH.js +2 -0
- package/dist/{chunk-2ERQYYSJ.js → chunk-CGYSFLM2.js} +1 -1
- package/dist/{chunk-LP3BSP74.js → chunk-CNNJ4U2L.js} +1 -1
- package/dist/{chunk-FPAJURPL.js → chunk-DCUT3GJA.js} +1 -1
- package/dist/{chunk-VK3NU742.js → chunk-DEZ7CXGM.js} +1 -1
- package/dist/chunk-DJ7T7BMV.js +2 -0
- package/dist/{chunk-TRVB7RSW.js → chunk-E3BXNQYE.js} +1 -1
- package/dist/{chunk-DN42IM2Z.js → chunk-EFRJNPBZ.js} +2 -2
- package/dist/chunk-EKCGZXZE.js +2 -0
- package/dist/{chunk-2ZDXNTZT.js → chunk-FDWEL5HR.js} +1 -1
- package/dist/chunk-FRSHEJUS.js +2 -0
- package/dist/{chunk-WCF2Z4SE.js → chunk-FTZPWXF7.js} +1 -1
- package/dist/{chunk-IEOHAHZO.js → chunk-G4AFOZKU.js} +1 -1
- package/dist/{chunk-AF572MQG.js → chunk-GYF4CH62.js} +3 -3
- package/dist/{chunk-GR35ZFM2.js → chunk-GZ4X53ZA.js} +2 -2
- package/dist/{chunk-JANVTG62.js → chunk-HFCDUFV3.js} +1 -1
- package/dist/{chunk-6G5YKTVN.js → chunk-HQWLSA5M.js} +1 -1
- package/dist/{chunk-DJR3M7XO.js → chunk-JJWQUQJ2.js} +1 -1
- package/dist/chunk-JN2DP4R2.js +37 -0
- package/dist/{chunk-37ZWKLEN.js → chunk-JRQKUQWL.js} +1 -1
- package/dist/chunk-K2QV7FGP.js +2 -0
- package/dist/{chunk-7YZMUTJA.js → chunk-K7UYWAZH.js} +1 -1
- package/dist/chunk-KBMQGNKO.js +26 -0
- package/dist/{chunk-NWJOPZ7P.js → chunk-KWKUMBHS.js} +2 -2
- package/dist/{chunk-YJNGBZ42.js → chunk-KX2GOJ4C.js} +2 -2
- package/dist/{chunk-KOMKHFC4.js → chunk-LA2EMSHE.js} +1 -1
- package/dist/{chunk-LSZVSYAP.js → chunk-M335FQYJ.js} +2 -2
- package/dist/{chunk-LNQCZ5DS.js → chunk-MJ56GUKS.js} +1 -1
- package/dist/{chunk-NVGM5ISX.js → chunk-MUGMUKSZ.js} +1 -1
- package/dist/{chunk-ZNNRCUHH.js → chunk-NHOHQBIF.js} +1 -1
- package/dist/{chunk-3MFTTLOF.js → chunk-NLECZCMZ.js} +1 -1
- package/dist/{chunk-QJTXNQV5.js → chunk-NYSMQ7UY.js} +1 -1
- package/dist/{chunk-NNCMMV6P.js → chunk-O3AY6JHJ.js} +29 -23
- package/dist/{chunk-IVYXXZEE.js → chunk-OWTEHU6B.js} +1 -1
- package/dist/{chunk-6IA6QMPH.js → chunk-P7YZ3PU3.js} +1 -1
- package/dist/{chunk-UBTNWAKK.js → chunk-PB3GADUD.js} +1 -1
- package/dist/{chunk-APETOVZK.js → chunk-PCOSE5SW.js} +2 -2
- package/dist/{chunk-HJ6AXOCR.js → chunk-PEI2566X.js} +1 -1
- package/dist/{chunk-LCU2P3CH.js → chunk-PQUMOFT5.js} +1 -1
- package/dist/chunk-PUFJEU46.js +2 -0
- package/dist/{chunk-IWWQTXGK.js → chunk-PWYEOBXV.js} +1 -1
- package/dist/chunk-Q6JHBDW2.js +2 -0
- package/dist/chunk-R7OGNE3W.js +2 -0
- package/dist/{chunk-5CKQTZMG.js → chunk-RY6TFVAX.js} +1 -1
- package/dist/{chunk-GIQURCTO.js → chunk-T3XDMR5B.js} +1 -1
- package/dist/{chunk-ZH64GOBG.js → chunk-T5LKD2OB.js} +1 -1
- package/dist/{chunk-KGSVOTLG.js → chunk-TCK3QMKY.js} +1 -1
- package/dist/chunk-TJZMYU2W.js +2 -0
- package/dist/{chunk-NXXJ56QA.js → chunk-TYI4MLFJ.js} +1 -1
- package/dist/chunk-ULGZPRKU.js +2 -0
- package/dist/{chunk-BRIEBB2U.js → chunk-UOMRMCMI.js} +1 -1
- package/dist/{chunk-TUTDSX7T.js → chunk-UX3KPYTI.js} +1 -1
- package/dist/chunk-V444REBC.js +11 -0
- package/dist/{chunk-DSXSU5MH.js → chunk-VT2XNEOD.js} +4 -4
- package/dist/{chunk-L5LI2JF4.js → chunk-VZ7KXRXB.js} +11 -11
- package/dist/{chunk-4FQI643D.js → chunk-W27F2NWA.js} +1 -1
- package/dist/{chunk-CVCVBQP6.js → chunk-WLOGO44E.js} +1 -1
- package/dist/chunk-WYST42WI.js +7 -0
- package/dist/{chunk-XMYCRE5K.js → chunk-YFLKS4UV.js} +3 -3
- package/dist/{chunk-SPQPOUUR.js → chunk-Z2T7E5HM.js} +2 -2
- package/dist/{chunk-IHAHCFFG.js → chunk-ZFZ7YXEU.js} +1 -1
- package/dist/{chunk-SA2LQSYP.js → chunk-ZIRMSWKS.js} +1 -1
- package/dist/{chunk-KHU7C6EE.js → chunk-ZKSN2SJ7.js} +1 -1
- package/dist/{chunk-ZPDM6FO7.js → chunk-ZSXDZI56.js} +2 -2
- package/dist/{config-OTUKOTHM.js → config-OKTAPFOT.js} +1 -1
- package/dist/cover-cmd-7JILZJUK.js +3 -0
- package/dist/{credentials-A3RU25MJ.js → credentials-SO3DSQEM.js} +1 -1
- package/dist/{deps-bundle-RIBEQC2R.js → deps-bundle-FRM65BQO.js} +1 -1
- package/dist/{deps-resolve-7SWSUDRX.js → deps-resolve-RPZORKUN.js} +1 -1
- package/dist/{dispatch-RHSWJJLC.js → dispatch-OZRMWY25.js} +1 -1
- package/dist/doctor-VWGEQYBB.js +2 -0
- package/dist/evidence-5AUZMKE3.js +2 -0
- package/dist/evidence-presentation-XF23B7F2.js +2 -0
- package/dist/{evolve-cmd-FFF3F3HO.js → evolve-cmd-TWYJL4EG.js} +1 -1
- package/dist/{explain-cmd-3GEKR7O5.js → explain-cmd-2TKO7GRW.js} +1 -1
- package/dist/{extract-bind-VIPNGK2H.js → extract-bind-EW7XUDLQ.js} +2 -2
- package/dist/{extract-cmd-5J47Q4XU.js → extract-cmd-HOVGMBGM.js} +1 -1
- package/dist/{gaps-cmd-WPCJPLGB.js → gaps-cmd-3ZX3PZF4.js} +1 -1
- package/dist/{generate-headless-AJI2OVRG.js → generate-headless-FYTJULPG.js} +2 -2
- package/dist/index.js +168 -88
- package/dist/{ingest-cmd-2LK7DWDW.js → ingest-cmd-RJLTFNMN.js} +1 -1
- package/dist/install-46S4VOZ4.js +2 -0
- package/dist/{interactive-bind-PI3HY623.js → interactive-bind-PSEYAL54.js} +3 -3
- package/dist/{list-commands-7Y5XV5FK.js → list-commands-2SVSEAP6.js} +1 -1
- package/dist/login-flow-U43QVFPH.js +2 -0
- package/dist/{mobile-prompts-O5ALU3QU.js → mobile-prompts-T6HZ2YLY.js} +1 -1
- package/dist/{persist-recorded-session-TKSU4HOA.js → persist-recorded-session-O2NCYTSD.js} +1 -1
- package/dist/pipeline-BHEA7ODT.js +2 -0
- package/dist/prepare-target-27UN4KNO.js +2 -0
- package/dist/{reconcile-cmd-VHEW2DY5.js → reconcile-cmd-FU3JIHTO.js} +1 -1
- package/dist/{reconcile-deps-UJ6KVUIS.js → reconcile-deps-SUKZA2FL.js} +2 -2
- package/dist/{reconcile-engine-NUQJSIFX.js → reconcile-engine-ILL4M3NW.js} +1 -1
- package/dist/{recording-banner-GO2PP53Y.js → recording-banner-5VXVKCV4.js} +1 -1
- package/dist/{registry-KYPVINS2.js → registry-BKV3EDTK.js} +1 -1
- package/dist/replay-policy-CVQ6OJX5.js +2 -0
- package/dist/{require-project-folder-NUQMH224.js → require-project-folder-2IO6IX5W.js} +1 -1
- package/dist/resolve-run-intent-ZML3HKG7.js +2 -0
- package/dist/{resolver-HHLYRR5W.js → resolver-CBTWTZZR.js} +1 -1
- package/dist/run-EXIYK6PU.js +2 -0
- package/dist/{run-OPLOL3PZ.js → run-R7GND73C.js} +1 -1
- package/dist/{run-test-md-3BA56ZYF.js → run-test-md-664ASWRQ.js} +2 -2
- package/dist/{skill-installer-O7JYVZXD.js → skill-installer-QLQK4JJE.js} +1 -1
- package/dist/{spawner-OZ4OE44T.js → spawner-ANLF7OX3.js} +1 -1
- package/dist/tcg-generate-VBC5ODDI.js +2 -0
- package/dist/{testmd-actions-YJ7O43Z6.js → testmd-actions-QZD3N4EH.js} +1 -1
- package/dist/token-refresh-PIUX5OFA.js +2 -0
- package/dist/{types-6E2HTDKJ.js → types-VYEOJ6U2.js} +1 -1
- package/dist/{validate-basic-HWYK3CU6.js → validate-basic-D7IJUFUQ.js} +1 -1
- package/dist/{verdicts-KFPMRADV.js → verdicts-EO5TZ5BW.js} +1 -1
- package/dist/{version-check-3ECNG5V2.js → version-check-JRLPWQ6T.js} +1 -1
- package/dist/{walk-session-MZCMXVZB.js → walk-session-IODOH7QU.js} +1 -1
- package/dist/{with-telemetry-Q6V6THIF.js → with-telemetry-ASNQQBGP.js} +1 -1
- package/package.json +11 -11
- package/dist/EvidenceViewOffer-POKUWAPS.js +0 -2
- package/dist/FolderPicker-GR6FZMUJ.js +0 -2
- package/dist/HelpView-JFFVHQAW.js +0 -2
- package/dist/SingleShotApp-BK5QNXGG.js +0 -2
- package/dist/TestMdRunView-AT26LOSG.js +0 -2
- package/dist/bridge-UH32UGR5.js +0 -2
- package/dist/chunk-5NQ3TI4S.js +0 -13
- package/dist/chunk-A5FFLJVL.js +0 -26
- package/dist/chunk-C5UNZ6ZY.js +0 -2
- package/dist/chunk-D5VYMHSO.js +0 -2
- package/dist/chunk-D6FYCAIA.js +0 -2
- package/dist/chunk-DOG7S7R6.js +0 -2
- package/dist/chunk-DXI5TXNL.js +0 -19
- package/dist/chunk-IFIXY3YG.js +0 -2
- package/dist/chunk-IOD3HQVW.js +0 -11
- package/dist/chunk-RUCSRS4C.js +0 -5
- package/dist/chunk-ZUYPPPC5.js +0 -66
- package/dist/cover-cmd-HDZZWJXG.js +0 -3
- package/dist/doctor-XP7YDE3J.js +0 -2
- package/dist/evidence-K7R7OG2K.js +0 -2
- package/dist/login-flow-Z45G34DM.js +0 -2
- package/dist/pipeline-HZUV7IMT.js +0 -2
- package/dist/prepare-target-DBYKQ7HW.js +0 -2
- package/dist/replay-policy-6USQBT3E.js +0 -2
- package/dist/resolve-run-intent-H3HX5KUC.js +0 -7
- package/dist/run-67ONKMGR.js +0 -2
- package/dist/tcg-generate-EG2MXRJ7.js +0 -2
- package/dist/token-refresh-K7CANKFQ.js +0 -2
- /package/dist/{lifecycle-cmd-HO5VL7AM.js → lifecycle-cmd-O2324GN6.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as wn,b as me,c as It,d as $n,e as Dt,g as rt,h as it,i as Cn,j as Rn,l as Sn,m as Bt,n as In}from"./chunk-HJ6AXOCR.js";import{a as le,b as Oe,c as vn}from"./chunk-6J5T5FEY.js";import{b as Rt}from"./chunk-UJZZDPDY.js";import{a as yn}from"./chunk-CLGC7VEO.js";import{a as tt}from"./chunk-LQQXPY5B.js";import{a as nt,d as _e,e as Tn,f as St}from"./chunk-RKXHVP2Z.js";import{a as xn,b as kn,c as bn}from"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-6KPPGMO2.js";import{a as gn,b as hn,c as pn}from"./chunk-GIQURCTO.js";import"./chunk-NVGBE2DR.js";import{a as dn}from"./chunk-5Y2G4NC7.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as et}from"./chunk-YCCUBQY4.js";import{a as mn}from"./chunk-LCU2P3CH.js";import{y as r}from"./chunk-D6FYCAIA.js";import{b as fn}from"./chunk-DFS4RMVP.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as k,b as n,k as Ze}from"./chunk-C44QQJR4.js";import{a as Mr}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var m=V(Mr(),1);var a=V(Q(),1),Ar=60,Lr=100;function Et(t,o){let l=t.options.length,u=l,g=t.multi_select?u++:null,x=t.allow_free_text?u++:null,f=o?u++:null;return{optionCount:l,doneIdx:g,freeIdx:x,batchIdx:f,maxSel:u-1}}var Or="\xA0",_r={high:{text:`\u203C${Or}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Pr(t){let o=(t.header??t.text.split(/\s+/).slice(0,3).join(" ")).trim();return o.length>16?`${o.slice(0,15)}\u2026`:o}function qr(t,o,l){let u=p=>t[p].length+6,g=u(o),x=o,f=o;for(;;){let p=f+1<t.length?u(f+1):1/0,C=x-1>=0?u(x-1):1/0;if(p===1/0&&C===1/0)break;if(p<=C){if(g+p>l)break;g+=p,f+=1}else{if(g+C>l)break;g+=C,x-=1}}return{lo:x,hi:f}}function Dn({batch:t,qView:o,sel:l=0,focused:u=!1,freeText:g=null,optionText:x=null,attach:f=null,multiSelFor:p,childPrefix:C}){let{stdout:M}=Ze(),v=M?.columns??80,T=v<Ar,W=Math.min(v-1,Lr),$=Math.max(0,Math.min(t.questions.length-1,o??(t.cursor<0?0:t.cursor))),I=t.questions[$],N=t.resolution[$],L=t.resolution.filter(D=>!D).length,B=t.questions.length-L,P=tt(t),O=Et(I,P!==""),H=p?p($):[],K=_r[I.risk],re=D=>u&&l===D?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",S=`? ${C??""}the agent needs ${L===1?"one answer":`${L} answers`}`,$e=t.questions.length>1?` \xB7 ${$+1} of ${t.questions.length} \xB7 ${B} answered`:"",z=(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsxs)(n,{bold:!0,children:[I.text,K?(0,a.jsx)(n,{color:K.color,bold:!1,children:` ${K.text}`}):null]})}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:I.rationale})}),(0,a.jsx)(n,{children:" "}),I.options.map((D,w)=>{let X=u&&l===w;return x&&x.optionIndex===w?(0,a.jsx)(k,{flexDirection:"column",children:(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:`${w+1}. ${D.label}`}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:x.value,onChange:x.onChange,onSubmit:x.onSubmit,onCancel:x.onCancel,placeholder:D.detail||"type your answer"})]})},`o-${w}`):(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsxs)(n,{children:[re(w)," ",I.multi_select?(0,a.jsx)(n,{color:H.includes(w)?r.green:r.dim,children:H.includes(w)?"[x] ":"[ ] "}):null,(0,a.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${w+1}. ${D.label}`}),w===I.recommended_index?(0,a.jsx)(n,{color:r.dim,children:" (recommended)"}):null,N?.selected_index===w?(0,a.jsx)(n,{color:r.dim,children:" (current)"}):null]}),D.detail?(0,a.jsx)(k,{paddingLeft:5,children:(0,a.jsx)(n,{color:r.dim,children:D.detail})}):null]},`o-${w}`)}),I.multi_select&&O.doneIdx!=null?(0,a.jsxs)(n,{children:[re(O.doneIdx)," ",(0,a.jsx)(n,{color:r.green,children:"\u2714"}),(0,a.jsx)(n,{color:u&&l===O.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,a.jsx)(n,{children:" "}):null,I.allow_free_text?g?(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(et,{value:g.value,onChange:g.onChange,onSubmit:g.onSubmit,onCancel:g.onCancel,placeholder:"Tell me what to do"})]}):(0,a.jsxs)(n,{children:[O.freeIdx!=null?re(O.freeIdx):" "," ",(0,a.jsx)(n,{color:u&&O.freeIdx!=null&&l===O.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,f?(0,a.jsxs)(k,{flexDirection:"column",marginTop:1,children:[(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:"path or URL"})]}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),j=P!==""?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{children:" "}),(0,a.jsxs)(n,{children:[u&&O.batchIdx!=null&&l===O.batchIdx?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,a.jsx)(n,{bold:!0,color:u&&O.batchIdx!=null&&l===O.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,a.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,a.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(T)return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(n,{color:r.assuranceAccent,bold:!0,children:S}),t.questions.length>1?(0,a.jsx)(n,{color:r.dim,children:$e.replace(/^ · /,"")}):null,(0,a.jsx)(n,{children:" "}),z,j]});let h=t.questions.map(D=>Pr(D)),ce=t.questions.length>1?qr(h,$,W-8):null;return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(n,{color:r.assuranceAccent,children:[(0,a.jsx)(n,{bold:!0,children:S}),$e?(0,a.jsx)(n,{color:r.dim,children:$e}):null]}),ce?(0,a.jsx)(k,{marginTop:1,children:(0,a.jsxs)(n,{children:[ce.lo>0?(0,a.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",t.questions.slice(ce.lo,ce.hi+1).map((D,w)=>{let X=ce.lo+w,Pe=w>0?" ":"";return X===$?(0,a.jsxs)(n,{children:[Pe,(0,a.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[X]} `})]},D.id):(0,a.jsxs)(n,{children:[Pe,t.resolution[X]?(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.green,children:"\u2713 "}),(0,a.jsx)(n,{color:r.dim,children:h[X]})]}):(0,a.jsx)(n,{color:r.dim,children:`\u25CB ${h[X]}`})]},D.id)}),ce.hi<t.questions.length-1?(0,a.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,a.jsx)(n,{children:" "}),z,j]})}var A=V(Q(),1),Bn={high:0,med:1,low:2},jr={high:r.red,med:"yellow",low:r.dim};function Fr(t){return t.map((o,l)=>({r:o,i:l})).sort((o,l)=>(Bn[o.r.risk??"zz"]??3)-(Bn[l.r.risk??"zz"]??3)||o.i-l.i).map(({r:o})=>o)}function En({rows:t,width:o=120,badgeHeader:l="risk"}){if(t.length===0)return null;let u=Fr(t),g=B=>B.staged||!B.id?"(staged)":yn(B.id),x=Math.max(2,...u.map(B=>g(B).length)),f=Math.max(l.length,...u.map(B=>(B.badge??"").length)),p=o>=84&&u.some(B=>B.summary),M=o-(p?13:10)-x-f,v=Math.max(...u.map(B=>Math.max(B.title.length,(B.marker??"").length)),5),T=Math.max(5,p?Math.min(v,Math.max(16,Math.floor(M*.5))):Math.min(v,M)),W=p?Math.max(7,M-T):0,$=(B,P,O,H)=>vn(B,P,O,H.map(K=>K.length)),I=(B,P,O,H)=>[Oe(le(B,x),x),Oe(le(P,T),T),Oe(le(O,f),f),...p?[Oe(le(H,W),W)]:[]],N=I("id","title",l,"summary"),L=[];L.push((0,A.jsx)(n,{color:r.dim,children:$("\u250C","\u252C","\u2510",N)},"t")),L.push((0,A.jsxs)(n,{children:[N.map((B,P)=>(0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:P===0?"\u2502 ":" \u2502 "}),(0,A.jsx)(n,{bold:!0,children:B})]},P)),(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,A.jsx)(n,{color:r.dim,children:$("\u251C","\u253C","\u2524",N)},"m"));for(let[B,P]of u.entries()){let O=I(g(P),le(P.title,T),le(P.badge??"",f),le(P.summary??"",W)),H=P.badgeColor??jr[P.badge??""]??r.dim;if(L.push((0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,A.jsx)(n,{color:r.assuranceAccent,children:O[0]}),(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[1],(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,A.jsx)(n,{color:H,children:O[2]}),p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[3]]}):null,(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${B}`)),P.marker){let K=I("",le(P.marker,T),"","");L.push((0,A.jsx)(n,{color:r.dim,children:`\u2502 ${K.join(" \u2502 ")} \u2502`},`mk-${B}`))}}return L.push((0,A.jsx)(n,{color:r.dim,children:$("\u2514","\u2534","\u2518",N)},"b")),(0,A.jsx)(A.Fragment,{children:L})}var y=V(Q(),1);function Wr(t){let o=t.form==="assumed"?" (assumed)":t.form==="deferred"?"":" (you)",l=t.note?` \u2014 ${t.note}`:"";return t.form==="deferred"?`\u21B3 deferred q${t.qNum} ${t.stub}${l}`:t.form==="changed"?`\u21B3 changed q${t.qNum} ${t.stub}: ${t.prev??"?"} \u2192 ${t.choice??"?"}${o}${l}`:`\u21B3 ${t.form} q${t.qNum} ${t.stub}: ${t.choice??"?"}${o}${l}`}var Vr=()=>(process.stdout?.columns??100)-12;function Mn({block:t,annotations:o}){let l=t.era??0,u=Nr(t,o??null);return l>0?(0,y.jsx)(k,{marginLeft:l*2,children:u}):u}function Nr(t,o){switch(t.kind){case"banner":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{bold:!0,color:r.assuranceAccent,children:` ${t.text}`})});case"user":return(0,y.jsxs)(k,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:t.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${t.text}`});case"agent":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(hn,{text:t.text,accent:r.assuranceAccent})});case"worked":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2699 ${bn(t.durS,t.toolCalls,t.tools)}`})});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.credits.toFixed(1)} credits \u2014 total ${t.total.toFixed(1)}`});case"turn":{let l=o,u=l?l.fresh:t.items.map((v,T)=>({item:v,num:T+1,updated:!1})),g={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},x=v=>v.kind??"use-case",f=new Map;for(let v of u){let T=v.item,W=x(v.item),$=T.risk==="high"||T.risk==="med"||T.risk==="low"?T.risk:void 0,I={id:T.logical_id??"",staged:!T.logical_id,title:T.title,badge:T.badge??T.risk??"",summary:T.why??T.summary??T.description??"",...$?{risk:$}:{},...v.updated?{marker:"\u21B3 changed"}:{}},N=f.get(W)??[];N.push(I),f.set(W,N)}let p=u.some(v=>!!v.item.kind),C=(l?.unchanged??[]).reduce((v,T)=>v+T.count,0),M=l?.headerStats?` \u2014 ${l.headerStats}${C>0?` (${C} unchanged)`:""}`:"";return(0,y.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[p?"design":t.heading,M?(0,y.jsx)(n,{bold:!1,color:r.dim,children:M}):null]}),[...f.entries()].map(([v,T])=>(0,y.jsxs)(k,{flexDirection:"column",children:[f.size>1?(0,y.jsx)(n,{color:r.dim,children:`${nt(v)} \xB7 ${T.length}`}):null,(0,y.jsx)(En,{rows:T,width:Vr(),badgeHeader:g[v]??"info"})]},v)),l&&l.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${l.unchanged.map(v=>`${v.count} ${v.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Wr(t.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"childOpen":{let{ing:l}=Rt(t.verb);return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsxs)(n,{color:r.assuranceAccent,children:[`\u25CF ${l} ${t.subject}`,t.sid?(0,y.jsx)(n,{color:r.dim,children:` \u2014 ${t.sid}`}):null,t.note?(0,y.jsx)(n,{color:r.dim,children:` ${t.note}`}):null]})})}case"childClose":{let{ed:l}=Rt(t.verb);if(!t.ok)return(0,y.jsxs)(n,{color:r.red,children:[`\u25CF ${t.verb} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}`,t.fixCmd?(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.fixCmd}`}):null]});let u=[kn(t.durS),...t.results?[t.results]:[],...t.credits!==void 0?[`${t.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,y.jsx)(n,{color:r.green,children:`\u25CF ${l} ${t.subject} \u2014 ${u}`})}case"childBack":return(0,y.jsx)(n,{color:r.dim,children:`back with ${t.parentVerb} \u2014 ${t.context}`});case"commit":return(0,y.jsxs)(k,{flexDirection:"column",children:[(0,y.jsx)(n,{color:t.ok?r.green:r.red,children:` ${t.ok?"\u2714":"\u2717"} ${t.line}`}),(t.warnings??[]).map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${l}`},`w-${u}`))]});case"error":return(0,y.jsxs)(mn,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:t.title}),t.detail.map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:l},`d-${u}`))]})}}var Te=V(Q(),1);function An({item:t}){return(0,Te.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(t.cite??[]).map((o,l)=>(0,Te.jsx)(n,{dimColor:!0,children:`cite ${o.anchor??"conv"} \u2014 "${o.quote??""}"`},`cite-${l}`)),(t.depends_on_hint??[]).length>0&&(0,Te.jsx)(n,{dimColor:!0,children:`depends on: ${(t.depends_on_hint??[]).join(", ")}`}),Object.entries(t.extra??{}).map(([o,l])=>(0,Te.jsx)(n,{dimColor:!0,children:`${o}: ${l}`},`extra-${o}`))]})}var R=V(Q(),1),Mt=(t,o)=>Math.max(0,Math.min(o,t));function ot(t,o,l){switch(o.type){case"move":return t.level==="detail"?{...t,scroll:Math.max(0,(t.scroll??0)+o.delta)}:{...t,cursor:Mt(t.cursor+o.delta,Math.max(0,l-1))};case"enter":return t.level==="list"?{...t,level:"detail",scroll:0}:t;case"back":return t.level==="detail"?{...t,level:"list",scroll:0}:null}}var On={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function _n(t,o){if(t.level==="detail")return{level:"detail",cursor:Mt(t.num-1,Math.max(0,o.entries.length-1))};if(t.section){let l=o.entries.findIndex(u=>On[u.kind]===t.section);if(l>=0)return{level:"list",cursor:l}}return{level:"list",cursor:0}}function Kr(t){let o=[];for(let l of t.entries){let u=o.find(g=>g.kind===l.kind);u?u.entries.push(l):o.push({kind:l.kind,entries:[l]})}return o}var Ln=3;function Ur({items:t,cursor:o,verb:l,more:u}){let g=`view \xB7 ${l} so far \xB7 ${t.counts.map(f=>`${f.count} ${f.count===1?f.label.replace(/s$/,""):f.label}`).join(" \xB7 ")}`,x=t.entries[o];return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,color:r.assuranceAccent,children:g}),Kr(t).map(({kind:f,entries:p})=>{let C=x?.kind===f,M=C?p.findIndex($=>$.ref===x.ref):-1,v=C?Mt(M-1,Math.max(0,p.length-Ln)):0,T=p.slice(v,v+(C?Ln:1)),W=p.length-T.length;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{color:r.dim,children:`${On[f]??nt(f)} \xB7 ${p.length}`}),T.map($=>{let I=C&&$.ref===x.ref,N=$.item.badge;return(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:I?"\u203A ":" "}),(0,R.jsx)(n,{children:`${$.num} \xB7 ${$.item.title}`}),N?(0,R.jsx)(n,{color:r.dim,children:` \xB7 ${N}`}):null]},`${$.kind}:${$.ref}`)}),W>0&&(0,R.jsx)(n,{color:r.dim,children:` \u22EE ${W} more`})]},f)}),u?(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:o===t.entries.length?"\u203A ":" "}),(0,R.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${u.hidden} more from earlier turns`})]}):null]})}var st=14;function Qr({items:t,cursor:o,explain:l,grandTotal:u,dossier:g,scroll:x=0}){let f=t.entries[o];if(!f)return(0,R.jsx)(n,{color:r.dim,children:"nothing to show"});if(g){let C=Math.max(0,Math.min(x,Math.max(0,g.lines.length-st))),M=g.lines.slice(C,C+st);return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsxs)(n,{bold:!0,children:[`view \xB7 ${g.id}`,g.id.toLowerCase()!==g.rawId?(0,R.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${g.rawId}`}):null]}),(0,R.jsx)(n,{bold:!0,children:g.title}),C>0?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${C} above`}):null,M.map((v,T)=>(0,R.jsx)(n,{color:v.dim?r.dim:void 0,children:v.text},`dl-${T}`)),g.lines.length>C+st?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${g.lines.length-C-st} more`}):null]})}let p=f.item;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,children:`view \xB7 ${f.kind} ${f.num} of ${u??t.entries.length}`}),(0,R.jsx)(n,{children:f.item.title}),p.badge?(0,R.jsx)(n,{color:r.dim,children:`kind: ${p.badge}`}):null,p.why?(0,R.jsx)(n,{color:r.dim,children:p.why}):null,(0,R.jsx)(An,{item:f.item}),l?.map((C,M)=>(0,R.jsx)(n,{color:r.dim,children:C},`ex-${M}`)),(0,R.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"})]})}function Pn({items:t,state:o,verb:l,more:u,explain:g,grandTotal:x,dossier:f=null}){return o.level==="list"?(0,R.jsx)(Ur,{items:t,cursor:o.cursor,verb:l,more:u}):(0,R.jsx)(Qr,{items:t,cursor:o.cursor,explain:g,grandTotal:x,dossier:f,scroll:o.scroll??0})}var J=V(Q(),1),At=14;function Hr(t){let o=[],l=null;for(let u of t)u.field!==l&&(l=u.field,o.push({kind:"field",field:l})),o.push({kind:"line",field:l,line:u});return o}function qn({title:t,lines:o,offset:l=0}){let u=Hr(o),g=Math.max(0,Math.min(l,Math.max(0,u.length-At))),x=u.slice(g,g+At),f=g,p=Math.max(0,u.length-g-At),C=`view \xB7 diff \xB7 ${t} \xB7 current \u2192 proposed`;return(0,J.jsxs)(k,{flexDirection:"column",children:[(0,J.jsx)(n,{bold:!0,color:r.assuranceAccent,children:C}),f>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${f} above`})}):null,x.map((M,v)=>M.kind==="field"?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:M.field==="criteria"?"criteria":M.field})},`r-${g+v}`):(0,J.jsx)(k,{paddingLeft:4,children:(0,J.jsx)(n,{color:M.line.op==="-"?"red":"green",children:`${M.line.op==="-"?"\u2212":"+"} ${M.line.text}`})},`r-${g+v}`)),p>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${p} more`})}):null]})}var zr={"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 jn(t){let o=(t??"").trim().toLowerCase();if(!o)return{level:"list"};if(/^\d+$/.test(o)){let u=parseInt(o,10);return u>=1?{level:"detail",num:u}:{error:"items are numbered from 1 \u2014 /view 1"}}let l=zr[o];return l?{level:"list",section:l}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var E=V(Q(),1),Xr=6,Fn=12;function Gr(t,o,l){let u=Math.max(20,o),g=[];for(let f of t.split(`
|
|
2
|
+
import{a as wn,b as me,c as It,d as $n,e as Dt,g as rt,h as it,i as Cn,j as Rn,l as Sn,m as Bt,n as In}from"./chunk-PEI2566X.js";import{a as le,b as Oe,c as vn}from"./chunk-6J5T5FEY.js";import{b as Rt}from"./chunk-UJZZDPDY.js";import{a as yn}from"./chunk-CLGC7VEO.js";import{a as tt}from"./chunk-LQQXPY5B.js";import{a as nt,d as _e,e as Tn,f as St}from"./chunk-RKXHVP2Z.js";import{a as xn,b as kn,c as bn}from"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-6KPPGMO2.js";import{a as gn,b as hn,c as pn}from"./chunk-T3XDMR5B.js";import"./chunk-NVGBE2DR.js";import{a as dn}from"./chunk-5Y2G4NC7.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as et}from"./chunk-YCCUBQY4.js";import{a as mn}from"./chunk-PQUMOFT5.js";import{x as r}from"./chunk-CCUGKBIH.js";import{b as fn}from"./chunk-DFS4RMVP.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as k,b as n,k as Ze}from"./chunk-C44QQJR4.js";import{a as Mr}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var m=V(Mr(),1);var a=V(Q(),1),Ar=60,Lr=100;function Et(t,o){let l=t.options.length,u=l,g=t.multi_select?u++:null,x=t.allow_free_text?u++:null,f=o?u++:null;return{optionCount:l,doneIdx:g,freeIdx:x,batchIdx:f,maxSel:u-1}}var Or="\xA0",_r={high:{text:`\u203C${Or}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Pr(t){let o=(t.header??t.text.split(/\s+/).slice(0,3).join(" ")).trim();return o.length>16?`${o.slice(0,15)}\u2026`:o}function qr(t,o,l){let u=p=>t[p].length+6,g=u(o),x=o,f=o;for(;;){let p=f+1<t.length?u(f+1):1/0,C=x-1>=0?u(x-1):1/0;if(p===1/0&&C===1/0)break;if(p<=C){if(g+p>l)break;g+=p,f+=1}else{if(g+C>l)break;g+=C,x-=1}}return{lo:x,hi:f}}function Dn({batch:t,qView:o,sel:l=0,focused:u=!1,freeText:g=null,optionText:x=null,attach:f=null,multiSelFor:p,childPrefix:C}){let{stdout:M}=Ze(),v=M?.columns??80,T=v<Ar,W=Math.min(v-1,Lr),$=Math.max(0,Math.min(t.questions.length-1,o??(t.cursor<0?0:t.cursor))),I=t.questions[$],N=t.resolution[$],L=t.resolution.filter(D=>!D).length,B=t.questions.length-L,P=tt(t),O=Et(I,P!==""),H=p?p($):[],K=_r[I.risk],re=D=>u&&l===D?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",S=`? ${C??""}the agent needs ${L===1?"one answer":`${L} answers`}`,$e=t.questions.length>1?` \xB7 ${$+1} of ${t.questions.length} \xB7 ${B} answered`:"",z=(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsxs)(n,{bold:!0,children:[I.text,K?(0,a.jsx)(n,{color:K.color,bold:!1,children:` ${K.text}`}):null]})}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:I.rationale})}),(0,a.jsx)(n,{children:" "}),I.options.map((D,w)=>{let X=u&&l===w;return x&&x.optionIndex===w?(0,a.jsx)(k,{flexDirection:"column",children:(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:`${w+1}. ${D.label}`}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:x.value,onChange:x.onChange,onSubmit:x.onSubmit,onCancel:x.onCancel,placeholder:D.detail||"type your answer"})]})},`o-${w}`):(0,a.jsxs)(k,{flexDirection:"column",children:[(0,a.jsxs)(n,{children:[re(w)," ",I.multi_select?(0,a.jsx)(n,{color:H.includes(w)?r.green:r.dim,children:H.includes(w)?"[x] ":"[ ] "}):null,(0,a.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${w+1}. ${D.label}`}),w===I.recommended_index?(0,a.jsx)(n,{color:r.dim,children:" (recommended)"}):null,N?.selected_index===w?(0,a.jsx)(n,{color:r.dim,children:" (current)"}):null]}),D.detail?(0,a.jsx)(k,{paddingLeft:5,children:(0,a.jsx)(n,{color:r.dim,children:D.detail})}):null]},`o-${w}`)}),I.multi_select&&O.doneIdx!=null?(0,a.jsxs)(n,{children:[re(O.doneIdx)," ",(0,a.jsx)(n,{color:r.green,children:"\u2714"}),(0,a.jsx)(n,{color:u&&l===O.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,a.jsx)(n,{children:" "}):null,I.allow_free_text?g?(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(et,{value:g.value,onChange:g.onChange,onSubmit:g.onSubmit,onCancel:g.onCancel,placeholder:"Tell me what to do"})]}):(0,a.jsxs)(n,{children:[O.freeIdx!=null?re(O.freeIdx):" "," ",(0,a.jsx)(n,{color:u&&O.freeIdx!=null&&l===O.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,f?(0,a.jsxs)(k,{flexDirection:"column",marginTop:1,children:[(0,a.jsxs)(k,{children:[(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,a.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,a.jsx)(et,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:"path or URL"})]}),(0,a.jsx)(k,{paddingLeft:2,children:(0,a.jsx)(n,{color:r.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),j=P!==""?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{children:" "}),(0,a.jsxs)(n,{children:[u&&O.batchIdx!=null&&l===O.batchIdx?(0,a.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,a.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,a.jsx)(n,{bold:!0,color:u&&O.batchIdx!=null&&l===O.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,a.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,a.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(T)return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(n,{color:r.assuranceAccent,bold:!0,children:S}),t.questions.length>1?(0,a.jsx)(n,{color:r.dim,children:$e.replace(/^ · /,"")}):null,(0,a.jsx)(n,{children:" "}),z,j]});let h=t.questions.map(D=>Pr(D)),ce=t.questions.length>1?qr(h,$,W-8):null;return(0,a.jsxs)(k,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(n,{color:r.assuranceAccent,children:[(0,a.jsx)(n,{bold:!0,children:S}),$e?(0,a.jsx)(n,{color:r.dim,children:$e}):null]}),ce?(0,a.jsx)(k,{marginTop:1,children:(0,a.jsxs)(n,{children:[ce.lo>0?(0,a.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",t.questions.slice(ce.lo,ce.hi+1).map((D,w)=>{let X=ce.lo+w,Pe=w>0?" ":"";return X===$?(0,a.jsxs)(n,{children:[Pe,(0,a.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[X]} `})]},D.id):(0,a.jsxs)(n,{children:[Pe,t.resolution[X]?(0,a.jsxs)(n,{children:[(0,a.jsx)(n,{color:r.green,children:"\u2713 "}),(0,a.jsx)(n,{color:r.dim,children:h[X]})]}):(0,a.jsx)(n,{color:r.dim,children:`\u25CB ${h[X]}`})]},D.id)}),ce.hi<t.questions.length-1?(0,a.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,a.jsx)(n,{children:" "}),z,j]})}var A=V(Q(),1),Bn={high:0,med:1,low:2},jr={high:r.red,med:"yellow",low:r.dim};function Fr(t){return t.map((o,l)=>({r:o,i:l})).sort((o,l)=>(Bn[o.r.risk??"zz"]??3)-(Bn[l.r.risk??"zz"]??3)||o.i-l.i).map(({r:o})=>o)}function En({rows:t,width:o=120,badgeHeader:l="risk"}){if(t.length===0)return null;let u=Fr(t),g=B=>B.staged||!B.id?"(staged)":yn(B.id),x=Math.max(2,...u.map(B=>g(B).length)),f=Math.max(l.length,...u.map(B=>(B.badge??"").length)),p=o>=84&&u.some(B=>B.summary),M=o-(p?13:10)-x-f,v=Math.max(...u.map(B=>Math.max(B.title.length,(B.marker??"").length)),5),T=Math.max(5,p?Math.min(v,Math.max(16,Math.floor(M*.5))):Math.min(v,M)),W=p?Math.max(7,M-T):0,$=(B,P,O,H)=>vn(B,P,O,H.map(K=>K.length)),I=(B,P,O,H)=>[Oe(le(B,x),x),Oe(le(P,T),T),Oe(le(O,f),f),...p?[Oe(le(H,W),W)]:[]],N=I("id","title",l,"summary"),L=[];L.push((0,A.jsx)(n,{color:r.dim,children:$("\u250C","\u252C","\u2510",N)},"t")),L.push((0,A.jsxs)(n,{children:[N.map((B,P)=>(0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:P===0?"\u2502 ":" \u2502 "}),(0,A.jsx)(n,{bold:!0,children:B})]},P)),(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,A.jsx)(n,{color:r.dim,children:$("\u251C","\u253C","\u2524",N)},"m"));for(let[B,P]of u.entries()){let O=I(g(P),le(P.title,T),le(P.badge??"",f),le(P.summary??"",W)),H=P.badgeColor??jr[P.badge??""]??r.dim;if(L.push((0,A.jsxs)(n,{children:[(0,A.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,A.jsx)(n,{color:r.assuranceAccent,children:O[0]}),(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[1],(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,A.jsx)(n,{color:H,children:O[2]}),p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(n,{color:r.dim,children:" \u2502 "}),O[3]]}):null,(0,A.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${B}`)),P.marker){let K=I("",le(P.marker,T),"","");L.push((0,A.jsx)(n,{color:r.dim,children:`\u2502 ${K.join(" \u2502 ")} \u2502`},`mk-${B}`))}}return L.push((0,A.jsx)(n,{color:r.dim,children:$("\u2514","\u2534","\u2518",N)},"b")),(0,A.jsx)(A.Fragment,{children:L})}var y=V(Q(),1);function Wr(t){let o=t.form==="assumed"?" (assumed)":t.form==="deferred"?"":" (you)",l=t.note?` \u2014 ${t.note}`:"";return t.form==="deferred"?`\u21B3 deferred q${t.qNum} ${t.stub}${l}`:t.form==="changed"?`\u21B3 changed q${t.qNum} ${t.stub}: ${t.prev??"?"} \u2192 ${t.choice??"?"}${o}${l}`:`\u21B3 ${t.form} q${t.qNum} ${t.stub}: ${t.choice??"?"}${o}${l}`}var Vr=()=>(process.stdout?.columns??100)-12;function Mn({block:t,annotations:o}){let l=t.era??0,u=Nr(t,o??null);return l>0?(0,y.jsx)(k,{marginLeft:l*2,children:u}):u}function Nr(t,o){switch(t.kind){case"banner":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{bold:!0,color:r.assuranceAccent,children:` ${t.text}`})});case"user":return(0,y.jsxs)(k,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:t.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${t.text}`});case"agent":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(hn,{text:t.text,accent:r.assuranceAccent})});case"worked":return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2699 ${bn(t.durS,t.toolCalls,t.tools)}`})});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.credits.toFixed(1)} credits \u2014 total ${t.total.toFixed(1)}`});case"turn":{let l=o,u=l?l.fresh:t.items.map((v,T)=>({item:v,num:T+1,updated:!1})),g={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},x=v=>v.kind??"use-case",f=new Map;for(let v of u){let T=v.item,W=x(v.item),$=T.risk==="high"||T.risk==="med"||T.risk==="low"?T.risk:void 0,I={id:T.logical_id??"",staged:!T.logical_id,title:T.title,badge:T.badge??T.risk??"",summary:T.why??T.summary??T.description??"",...$?{risk:$}:{},...v.updated?{marker:"\u21B3 changed"}:{}},N=f.get(W)??[];N.push(I),f.set(W,N)}let p=u.some(v=>!!v.item.kind),C=(l?.unchanged??[]).reduce((v,T)=>v+T.count,0),M=l?.headerStats?` \u2014 ${l.headerStats}${C>0?` (${C} unchanged)`:""}`:"";return(0,y.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[p?"design":t.heading,M?(0,y.jsx)(n,{bold:!1,color:r.dim,children:M}):null]}),[...f.entries()].map(([v,T])=>(0,y.jsxs)(k,{flexDirection:"column",children:[f.size>1?(0,y.jsx)(n,{color:r.dim,children:`${nt(v)} \xB7 ${T.length}`}):null,(0,y.jsx)(En,{rows:T,width:Vr(),badgeHeader:g[v]??"info"})]},v)),l&&l.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${l.unchanged.map(v=>`${v.count} ${v.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Wr(t.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"childOpen":{let{ing:l}=Rt(t.verb);return(0,y.jsx)(k,{marginTop:1,children:(0,y.jsxs)(n,{color:r.assuranceAccent,children:[`\u25CF ${l} ${t.subject}`,t.sid?(0,y.jsx)(n,{color:r.dim,children:` \u2014 ${t.sid}`}):null,t.note?(0,y.jsx)(n,{color:r.dim,children:` ${t.note}`}):null]})})}case"childClose":{let{ed:l}=Rt(t.verb);if(!t.ok)return(0,y.jsxs)(n,{color:r.red,children:[`\u25CF ${t.verb} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}`,t.fixCmd?(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${t.fixCmd}`}):null]});let u=[kn(t.durS),...t.results?[t.results]:[],...t.credits!==void 0?[`${t.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,y.jsx)(n,{color:r.green,children:`\u25CF ${l} ${t.subject} \u2014 ${u}`})}case"childBack":return(0,y.jsx)(n,{color:r.dim,children:`back with ${t.parentVerb} \u2014 ${t.context}`});case"commit":return(0,y.jsxs)(k,{flexDirection:"column",children:[(0,y.jsx)(n,{color:t.ok?r.green:r.red,children:` ${t.ok?"\u2714":"\u2717"} ${t.line}`}),(t.warnings??[]).map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${l}`},`w-${u}`))]});case"error":return(0,y.jsxs)(mn,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:t.title}),t.detail.map((l,u)=>(0,y.jsx)(n,{color:r.dim,children:l},`d-${u}`))]})}}var Te=V(Q(),1);function An({item:t}){return(0,Te.jsxs)(k,{flexDirection:"column",marginLeft:2,children:[(t.cite??[]).map((o,l)=>(0,Te.jsx)(n,{dimColor:!0,children:`cite ${o.anchor??"conv"} \u2014 "${o.quote??""}"`},`cite-${l}`)),(t.depends_on_hint??[]).length>0&&(0,Te.jsx)(n,{dimColor:!0,children:`depends on: ${(t.depends_on_hint??[]).join(", ")}`}),Object.entries(t.extra??{}).map(([o,l])=>(0,Te.jsx)(n,{dimColor:!0,children:`${o}: ${l}`},`extra-${o}`))]})}var R=V(Q(),1),Mt=(t,o)=>Math.max(0,Math.min(o,t));function ot(t,o,l){switch(o.type){case"move":return t.level==="detail"?{...t,scroll:Math.max(0,(t.scroll??0)+o.delta)}:{...t,cursor:Mt(t.cursor+o.delta,Math.max(0,l-1))};case"enter":return t.level==="list"?{...t,level:"detail",scroll:0}:t;case"back":return t.level==="detail"?{...t,level:"list",scroll:0}:null}}var On={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function _n(t,o){if(t.level==="detail")return{level:"detail",cursor:Mt(t.num-1,Math.max(0,o.entries.length-1))};if(t.section){let l=o.entries.findIndex(u=>On[u.kind]===t.section);if(l>=0)return{level:"list",cursor:l}}return{level:"list",cursor:0}}function Kr(t){let o=[];for(let l of t.entries){let u=o.find(g=>g.kind===l.kind);u?u.entries.push(l):o.push({kind:l.kind,entries:[l]})}return o}var Ln=3;function Ur({items:t,cursor:o,verb:l,more:u}){let g=`view \xB7 ${l} so far \xB7 ${t.counts.map(f=>`${f.count} ${f.count===1?f.label.replace(/s$/,""):f.label}`).join(" \xB7 ")}`,x=t.entries[o];return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,color:r.assuranceAccent,children:g}),Kr(t).map(({kind:f,entries:p})=>{let C=x?.kind===f,M=C?p.findIndex($=>$.ref===x.ref):-1,v=C?Mt(M-1,Math.max(0,p.length-Ln)):0,T=p.slice(v,v+(C?Ln:1)),W=p.length-T.length;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{color:r.dim,children:`${On[f]??nt(f)} \xB7 ${p.length}`}),T.map($=>{let I=C&&$.ref===x.ref,N=$.item.badge;return(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:I?"\u203A ":" "}),(0,R.jsx)(n,{children:`${$.num} \xB7 ${$.item.title}`}),N?(0,R.jsx)(n,{color:r.dim,children:` \xB7 ${N}`}):null]},`${$.kind}:${$.ref}`)}),W>0&&(0,R.jsx)(n,{color:r.dim,children:` \u22EE ${W} more`})]},f)}),u?(0,R.jsxs)(n,{children:[(0,R.jsx)(n,{color:r.assuranceAccent,children:o===t.entries.length?"\u203A ":" "}),(0,R.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${u.hidden} more from earlier turns`})]}):null]})}var st=14;function Qr({items:t,cursor:o,explain:l,grandTotal:u,dossier:g,scroll:x=0}){let f=t.entries[o];if(!f)return(0,R.jsx)(n,{color:r.dim,children:"nothing to show"});if(g){let C=Math.max(0,Math.min(x,Math.max(0,g.lines.length-st))),M=g.lines.slice(C,C+st);return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsxs)(n,{bold:!0,children:[`view \xB7 ${g.id}`,g.id.toLowerCase()!==g.rawId?(0,R.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${g.rawId}`}):null]}),(0,R.jsx)(n,{bold:!0,children:g.title}),C>0?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${C} above`}):null,M.map((v,T)=>(0,R.jsx)(n,{color:v.dim?r.dim:void 0,children:v.text},`dl-${T}`)),g.lines.length>C+st?(0,R.jsx)(n,{color:r.muted,children:`\u22EE ${g.lines.length-C-st} more`}):null]})}let p=f.item;return(0,R.jsxs)(k,{flexDirection:"column",children:[(0,R.jsx)(n,{bold:!0,children:`view \xB7 ${f.kind} ${f.num} of ${u??t.entries.length}`}),(0,R.jsx)(n,{children:f.item.title}),p.badge?(0,R.jsx)(n,{color:r.dim,children:`kind: ${p.badge}`}):null,p.why?(0,R.jsx)(n,{color:r.dim,children:p.why}):null,(0,R.jsx)(An,{item:f.item}),l?.map((C,M)=>(0,R.jsx)(n,{color:r.dim,children:C},`ex-${M}`)),(0,R.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"})]})}function Pn({items:t,state:o,verb:l,more:u,explain:g,grandTotal:x,dossier:f=null}){return o.level==="list"?(0,R.jsx)(Ur,{items:t,cursor:o.cursor,verb:l,more:u}):(0,R.jsx)(Qr,{items:t,cursor:o.cursor,explain:g,grandTotal:x,dossier:f,scroll:o.scroll??0})}var J=V(Q(),1),At=14;function Hr(t){let o=[],l=null;for(let u of t)u.field!==l&&(l=u.field,o.push({kind:"field",field:l})),o.push({kind:"line",field:l,line:u});return o}function qn({title:t,lines:o,offset:l=0}){let u=Hr(o),g=Math.max(0,Math.min(l,Math.max(0,u.length-At))),x=u.slice(g,g+At),f=g,p=Math.max(0,u.length-g-At),C=`view \xB7 diff \xB7 ${t} \xB7 current \u2192 proposed`;return(0,J.jsxs)(k,{flexDirection:"column",children:[(0,J.jsx)(n,{bold:!0,color:r.assuranceAccent,children:C}),f>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${f} above`})}):null,x.map((M,v)=>M.kind==="field"?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:M.field==="criteria"?"criteria":M.field})},`r-${g+v}`):(0,J.jsx)(k,{paddingLeft:4,children:(0,J.jsx)(n,{color:M.line.op==="-"?"red":"green",children:`${M.line.op==="-"?"\u2212":"+"} ${M.line.text}`})},`r-${g+v}`)),p>0?(0,J.jsx)(k,{paddingLeft:2,children:(0,J.jsx)(n,{color:r.dim,children:`\u22EE ${p} more`})}):null]})}var zr={"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 jn(t){let o=(t??"").trim().toLowerCase();if(!o)return{level:"list"};if(/^\d+$/.test(o)){let u=parseInt(o,10);return u>=1?{level:"detail",num:u}:{error:"items are numbered from 1 \u2014 /view 1"}}let l=zr[o];return l?{level:"list",section:l}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var E=V(Q(),1),Xr=6,Fn=12;function Gr(t,o,l){let u=Math.max(20,o),g=[];for(let f of t.split(`
|
|
3
3
|
`)){if(f.length<=u){g.push(f);continue}let p="";for(let C of f.split(" "))p&&p.length+1+C.length>u?(g.push(p),p=C):p=p?`${p} ${C}`:C;g.push(p)}let x=Math.max(0,g.length-l);return{body:g.slice(-l).join(`
|
|
4
4
|
`),hidden:x}}function Wn(t){let o={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},l={key:"keep",label:"keep the existing design",detail:"back to the list"};return t.designed==="stale"?[{...o,detail:"the use-case changed since it was designed"},l]:[l,o]}function Xi({controller:t,verb:o="extract",onCtrlC:l,chain:u=null,inspect:g=null,reconcile:x=null,autoReview:f=!1,onReviewExit:p,meta:C=null}){let[,M]=(0,m.useState)(0),[v,T]=(0,m.useState)(!1),[W,$]=(0,m.useState)(null),[I,N]=(0,m.useState)(null),L=(0,m.useRef)(null),[B,P]=(0,m.useState)(null),O=(0,m.useRef)(null),H=e=>{O.current=e,P(e)},K=e=>{L.current=e,N(e),e===null&&H(null)},re=(0,m.useRef)([]),[S,$e]=(0,m.useState)(null),z=(0,m.useRef)(null),j=e=>{z.current=e,$e(e)},[h,ce]=(0,m.useState)(null),D=(0,m.useRef)(null),w=e=>{D.current=e,ce(e)},[X,Pe]=(0,m.useState)(null),Lt=(0,m.useRef)(null),he=e=>{Lt.current=e,Pe(e)},lt=(0,m.useRef)({approved:0,rejected:0,deferred:0}),Ce=(0,m.useRef)(!1),ae=(0,m.useRef)(null),Ot=fn(),{stdout:Vn}=Ze(),Nn=Vn?.columns??80,_t=(0,m.useRef)(0),ct=(0,m.useRef)(0);(0,m.useEffect)(()=>{let e=()=>{let i=t.state.ledger;for(let c=_t.current;c<i.length;c++){let d=i[c],b=d.kind==="turn"?Tn(t.state.turns,d.turnIndex):void 0;Ot.append((0,E.jsx)(Mn,{block:d,annotations:b},`lg-${c}`))}_t.current=i.length};e();let s=t.subscribe(()=>{e();let i=t.state;L.current&&(i.pending||i.status==="pausing")&&(K(null),i.pending&&$("questions arrived \u2014 back to chat")),M(c=>c+1)});return M(i=>i+1),s},[t,Ot]);let{thinking:ue,status:de,pending:_,confirm:qe,ledger:ie,activeTurn:Pt,stream:Kn,notice:je}=t.state,qt=(Kn?.text??"").trimEnd(),jt=qt.length>0,Un=v&&(ue.liveThinking.length>0||ue.thinkingLog.length>0),Qn=Gr(ue.liveThinking||ue.thinkingLog.map(e=>e.text).join(`
|
|
5
5
|
`),Nn-6,Fn),Ft=jt?qt.split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-
|
|
2
|
+
import{a,b,c}from"./chunk-MJ56GUKS.js";import"./chunk-ZIRMSWKS.js";import"./chunk-CCUGKBIH.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-
|
|
2
|
+
import{a as r}from"./chunk-6BTZ2Q4P.js";import"./chunk-ZIRMSWKS.js";import"./chunk-CCUGKBIH.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-
|
|
2
|
+
import{a as P,b as g,c as f}from"./chunk-NLECZCMZ.js";import"./chunk-5NSYHRDN.js";import"./chunk-5Y2G4NC7.js";import"./chunk-CCUGKBIH.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 b,b as l,c as n}from"./chunk-
|
|
2
|
+
import{a as b,b as l,c as n}from"./chunk-PQUMOFT5.js";import{x as o}from"./chunk-CCUGKBIH.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as u,j as v}from"./chunk-C44QQJR4.js";import{a as S}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var C=a(S(),1);var e=a(p(),1);function O({model:x,authLabel:w,profile:B,env:h,defaultUrl:s,projectId:i,projectName:d,folderId:t,folderName:f,windowSize:D,chromeProfile:P,target:r,deviceLabel:m,appLabel:g}){let R=i?d?`${d} (${i})`:i:"(none)",V=t?f?`${f} (${t})`:t:"(none)",{exit:c}=v();return(0,C.useEffect)(()=>{let $=setTimeout(()=>c(),50);return()=>clearTimeout($)},[c]),(0,e.jsx)(u,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Configuration",children:(0,e.jsxs)(u,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:w}),(0,e.jsx)(l,{label:" profile",value:B}),(0,e.jsx)(l,{label:" env",value:h}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:s??"(none)",valueColor:s?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:x}),(0,e.jsx)(l,{label:" window",value:D}),(0,e.jsx)(l,{label:" project",value:R}),(0,e.jsx)(l,{label:" folder",value:V}),r!==void 0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" target",value:r}),r!=="desktop"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l,{label:" device",value:m??"(not set)",valueColor:m?void 0:o.dim}),(0,e.jsx)(l,{label:" app",value:g??"(not set)",valueColor:g?void 0:o.dim})]})]}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:P,valueColor:o.dim})]})})})}export{O as ConfigView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a}from"./chunk-K2QV7FGP.js";import"./chunk-3AJ3QSF5.js";import"./chunk-5DBK6QNS.js";import"./chunk-TJZMYU2W.js";import"./chunk-5GUD3CIH.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZSXDZI56.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-VZ7KXRXB.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-KX2GOJ4C.js";import"./chunk-RFHMDQXZ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-Z2T7E5HM.js";import"./chunk-MSGW4JDG.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4JOD47QI.js";import"./chunk-WLOGO44E.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-E3BXNQYE.js";import"./chunk-YCCUBQY4.js";import"./chunk-LA2EMSHE.js";import"./chunk-BPMSNGXQ.js";import"./chunk-ZIRMSWKS.js";import"./chunk-WLOGO44E.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.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}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-NHOHQBIF.js";import"./chunk-PQUMOFT5.js";import"./chunk-CCUGKBIH.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-
|
|
2
|
+
import{a}from"./chunk-BAL7E4OH.js";import"./chunk-CCUGKBIH.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-
|
|
2
|
+
import{a,b}from"./chunk-NYSMQ7UY.js";import"./chunk-ZIRMSWKS.js";import"./chunk-CCUGKBIH.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-
|
|
2
|
+
import{a,b}from"./chunk-K7UYWAZH.js";import"./chunk-YCCUBQY4.js";import"./chunk-LA2EMSHE.js";import"./chunk-BPMSNGXQ.js";import"./chunk-ZIRMSWKS.js";import"./chunk-WLOGO44E.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.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-
|
|
2
|
+
import{a,b,c}from"./chunk-RY6TFVAX.js";import"./chunk-S3DAAAE5.js";import"./chunk-NHOHQBIF.js";import"./chunk-PQUMOFT5.js";import"./chunk-CCUGKBIH.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-HQWLSA5M.js";import"./chunk-PWYEOBXV.js";import"./chunk-TCK3QMKY.js";import"./chunk-CGYSFLM2.js";import"./chunk-VZ7KXRXB.js";import"./chunk-TDPWFYTJ.js";import"./chunk-6DTWVLSJ.js";import"./chunk-JRQKUQWL.js";import"./chunk-K7UYWAZH.js";import"./chunk-E3BXNQYE.js";import"./chunk-YCCUBQY4.js";import"./chunk-LA2EMSHE.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4D3DNCQY.js";import"./chunk-TAOHYWEO.js";import"./chunk-ZIRMSWKS.js";import"./chunk-PB3GADUD.js";import"./chunk-WLOGO44E.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-4UMQDH52.js";import"./chunk-CCUGKBIH.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-
|
|
2
|
+
import{a,b,c,d}from"./chunk-PUFJEU46.js";import"./chunk-NHOHQBIF.js";import"./chunk-PQUMOFT5.js";import"./chunk-CCUGKBIH.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-JJWQUQJ2.js";import"./chunk-OWTEHU6B.js";import"./chunk-AMULIFC5.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TDPWFYTJ.js";import"./chunk-6DTWVLSJ.js";import"./chunk-5NSYHRDN.js";import"./chunk-5Y2G4NC7.js";import"./chunk-BG66IAO6.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-Z2T7E5HM.js";import"./chunk-MSGW4JDG.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4JOD47QI.js";import"./chunk-WLOGO44E.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-NHOHQBIF.js";import"./chunk-PQUMOFT5.js";import"./chunk-CCUGKBIH.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-R7OGNE3W.js";import"./chunk-TJZMYU2W.js";import"./chunk-RFHMDQXZ.js";import"./chunk-WLOGO44E.js";import"./chunk-PQUMOFT5.js";import"./chunk-CCUGKBIH.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as buildServeMap,b as renderTestrunEvidenceTable};
|
|
@@ -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-
|
|
2
|
+
import{a as b,b as r}from"./chunk-PQUMOFT5.js";import{x as o}from"./chunk-CCUGKBIH.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as a,c as b}from"./chunk-
|
|
2
|
+
import{b as a,c as b}from"./chunk-4D3DNCQY.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{a as isAppId,b as resolveCloudApp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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-
|
|
2
|
+
import"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-SO3DSQEM.js"),import("./resolver-CBTWTZZR.js"),import("./config-OKTAPFOT.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-ANLF7OX3.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b}from"./chunk-DJ7T7BMV.js";import"./chunk-Q6JHBDW2.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{b as ensureHyperexecuteBinary,a as hyperexecuteDownloadUrl};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as _}from"./chunk-
|
|
2
|
+
import{a as _}from"./chunk-O3AY6JHJ.js";import"./chunk-ZKSN2SJ7.js";import"./chunk-3Q6WAK6P.js";import"./chunk-AFPHLUQ5.js";import"./chunk-JZ26R6UL.js";import"./chunk-AJPLHW4T.js";import"./chunk-EFRJNPBZ.js";import"./chunk-ZGBSGZZM.js";import"./chunk-W27F2NWA.js";import"./chunk-BB2W35TW.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-6KPPGMO2.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-UX3KPYTI.js";import"./chunk-VT2XNEOD.js";import"./chunk-2UIHS2FH.js";import"./chunk-YKTYVJBN.js";import"./chunk-GFKCTYCA.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import"./chunk-X2FM67OM.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-R7QAS6LZ.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-V444REBC.js";import"./chunk-5DT7PIGB.js";import"./chunk-ZSXDZI56.js";import"./chunk-NVGBE2DR.js";import{a as m}from"./chunk-CH273NAE.js";import"./chunk-VZ7KXRXB.js";import"./chunk-IDX3TOPY.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-5EOX4MEY.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";import{existsSync as O}from"fs";var P=new Set(["interactive","agent","ci","override"]);function H(e){return e.mode!=null&&!P.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,phase:e.phase,allowUnreviewed:e.allowUnreviewed,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function B(e){let p=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
|
|
3
3
|
`),2;let{makeHeadlessIO:s,agentRefusal:d}=await import("./headless-io-66RG5NN5.js");return d(s("ndjson","design"),t,r)};if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-66RG5NN5.js");return r(t("ndjson","design"),`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}let T=H(e);if("error"in T)return p(T.error);let o=T;{let{validateResumeMessage:t}=await import("./headless-io-66RG5NN5.js"),r=t(o,"design");if(r)return p(r)}{let{gateStructuredFlags:t}=await import("./structured-answers-5EY2AZN7.js"),r=t(e,"design");if(r)return p(r,"STRUCTURED_FLAGS_USAGE")}if(!O(m(process.cwd())))return p("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");let y=!!o.resume;if(o.useCase&&o.resume&&!e.allowUnreviewed)try{let{peekSession:t}=await import("./sessions-GIEXOCE4.js"),r=t(m(process.cwd()),o.resume);y=!!(r&&r.use_case===o.useCase)}catch{y=!1}if(o.useCase&&!y&&!e.allowUnreviewed)try{let[{openGraph:t},{designEntryCheck:r}]=await Promise.all([import("./readmodel-XOYGGQ3S.js"),import("./trust-gate-EX7R2P4Y.js")]),s=r(t(m(process.cwd())),o.useCase);if(!s.ok&&(s.code==="UC_UNREVIEWED"||s.code==="UC_ARCHIVED"))if((o.mode??"interactive")==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY){let{createInterface:l}=await import("readline/promises"),c=l({input:process.stdin,output:process.stderr}),f=(await c.question(`design: ${s.detail}
|
|
4
4
|
Design against it anyway? (y/N) `)).trim().toLowerCase();if(c.close(),f!=="y"&&f!=="yes")return process.stderr.write(`aborted \u2014 approve it first: ${s.reviewCmd}
|
|
5
5
|
`),2}else if(e.mode==="agent"){let{makeHeadlessIO:l}=await import("./headless-io-66RG5NN5.js"),c=l("ndjson","design");return c.event({type:"error",code:s.code,message:`design: ${s.detail}`,next:[s.reviewCmd]}),c.event({type:"done",status:"refused",exit_code:2,next:[s.reviewCmd,`kane-cli design tests --use-case ${o.useCase} --mode agent --allow-unreviewed`]}),2}else return process.stderr.write(`design: ${s.detail} (${s.reviewCmd})
|
|
6
6
|
`),2}catch(t){process.env.KANE_DEBUG&&process.stderr.write(`trust gate skipped: ${String(t)}
|
|
7
7
|
`)}let i=null,x=null;try{if(!o.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
|
|
8
8
|
`),2;let t=o.mode??"interactive";if(t==="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)
|
|
9
|
-
`),2;let{bindDesignInteractive:n}=await import("./interactive-bind-
|
|
9
|
+
`),2;let{bindDesignInteractive:n}=await import("./interactive-bind-PSEYAL54.js");return await n(o)}let{resolveAgentAuthEnv:r}=await import("./spawner-ANLF7OX3.js"),{runAgent:s}=await import("./bridge-LOBTHY3P.js"),{preflightTurn:d}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:l}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:f,resolveEncoding:D,guardedChannels:R}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:A,prepareStructuredResume:U}=await import("./structured-answers-5EY2AZN7.js");i=A(f(D(t),"design"));let{runWithChannel:$}=await import("./run-channel-RGH4WIQX.js"),w=i,I=D(t)==="ndjson"?n=>$({event:g=>w.event(g)},n):n=>n(),E=n=>{w.out(n),w.event({type:"note",text:n})},{telemetryBootstrap:N,telemetryEnvName:G}=await import("./bootstrap-5IHKW5SE.js"),u=N({verb:"design",mode:t,contextRoot:m(process.cwd()),env:G(),resumeSid:o.resume,write:!0,longSession:!0});x=n=>u.end(n);let a=U({opts:e,contextDir:m(process.cwd()),verb:"design"});if(a.kind==="refuse")return i.out(a.error),t==="agent"&&i.event({type:"error",message:a.error,code:a.code}),await u.end({exit_code:2}),t==="agent"?i.done(2,"refused"):2;let C;if(a.kind==="apply"){for(let n of a.notes)E(n);if(a.matchedQids.length>0){E(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let n of a.matchedQids)i.event({type:"panel_resolved",id:n,by:"user",via:"flag"})}a.statement&&(C=[o.message,a.statement].filter(Boolean).join(`
|
|
10
10
|
|
|
11
11
|
`))}let b=c();b&&E(b);let v=l(s,n=>i.out(n)),k=R(i,()=>v.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let n=t==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY?async h=>{let{createInterface:Y}=await import("readline/promises"),S=Y({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await S.question(`${h} [y/N] `)).trim())}finally{S.close()}}:void 0,g=await I(async()=>{let h={...await r(),...u.spawnEnv()};return _({...o,mode:t,...C!==void 0?{message:C}:{},...n?{confirmRetarget:n}:{}},{contextDir:m(process.cwd()),agent:v.agent,preflightTurn:()=>d(h),ask:async()=>[],out:k.out,emit:k.emit,progress:w.progress,isTTY:!1,auth:h,telemetry:u})});return v.interrupted()&&g!==3?(i.out("interrupted \u2014 no session saved"),await u.end({exit_code:130}),i.done(130)):(g===1&&i.out(u.supportFooter()),await u.end({exit_code:g}),i.done(g))}finally{v.dispose()}}catch(t){x&&await x({exit_code:1}).catch(()=>{});let r=t instanceof Error?t.message:String(t);i?.event({type:"error",message:`error: design failed: ${r}`});let s=i?d=>i.out(d):d=>process.stderr.write(d+`
|
|
12
12
|
`);return s(`error: design failed: ${r}`),(process.env.ASSURANCE_LOG_LEVEL??"").toLowerCase()==="debug"&&t instanceof Error&&t.stack&&s(t.stack),s('hint: the full trace is in the file named on the "trace:" line at the start of this run'),i?i.done(1):1}}export{B as designTestsCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-CNNJ4U2L.js";import"./chunk-R5T4RLF5.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a}from"./chunk-5S46D5AJ.js";import"./chunk-7JUUNZQP.js";import"./chunk-UX3KPYTI.js";import"./chunk-UD7KKHPW.js";import"./chunk-CCUGKBIH.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{
|
|
2
|
+
import{a as l}from"./chunk-RZ4F3BHX.js";import{b as i,f as c}from"./chunk-CCUGKBIH.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{d as Y,f as q,h as H}from"./chunk-
|
|
2
|
+
import{d as Y,f as q,h as H}from"./chunk-KX2GOJ4C.js";import{a as O,b as j,c as z}from"./chunk-35EUIBYJ.js";import{d as B,f as R}from"./chunk-BG66IAO6.js";import{b as N,c as _,j as M}from"./chunk-Z2T7E5HM.js";import{a as L}from"./chunk-TZXXJWHA.js";import{m as b}from"./chunk-56PAQAX5.js";import{a as K,b as C,c as G}from"./chunk-4D3DNCQY.js";import{h as J}from"./chunk-TAOHYWEO.js";import{a as F,b as $}from"./chunk-UOMRMCMI.js";import{b as E}from"./chunk-CCUGKBIH.js";import{createHash as be}from"crypto";import{readdir as Ce,stat as Te}from"fs/promises";import{basename as f,extname as Ie,join as Ae,relative as ke}from"path";import{createHash as de}from"crypto";import{createReadStream as le}from"fs";import{mkdir as ce,readFile as ue,rename as fe,writeFile as ge}from"fs/promises";import{dirname as me,join as he}from"path";var we=60,ve=5;function V(){return{entries:[]}}function X(){return he(E,"mobile","app-cache.json")}async function T(e){let r=de("sha256");for await(let t of le(e))r.update(t);return r.digest("hex")}function ye(){return{readFile:e=>ue(e,"utf8"),writeFile:async(e,r)=>{await ce(me(e),{recursive:!0});let t=`${e}.tmp`;await ge(t,r),await fe(t,e)},hashFile:T,now:()=>new Date}}function I(e){if(!e)return;let r=/\/(\d{4})\/(\d{2})\/(\d{2})\//.exec(e);if(!r)return;let[,t,o,s]=r,n=new Date(`${t}-${o}-${s}T00:00:00Z`);return Number.isNaN(n.getTime())?void 0:n.toISOString()}function Pe(e,r){if(!e.storedAt)return!0;let t=new Date(e.storedAt).getTime();return Number.isNaN(t)?!0:(r.getTime()-t)/864e5>=we-ve}var u=class{deps;constructor(r={}){this.deps={...ye(),...r}}async read(){try{let r=JSON.parse(await this.deps.readFile(X()));if(!r||typeof r!="object")return V();let t=r;return{entries:Array.isArray(t.entries)?t.entries:[]}}catch{return V()}}async write(r){await this.deps.writeFile(X(),JSON.stringify(r,null,2))}async hashOf(r){return this.deps.hashFile(r)}async lookup(r){return(await this.read()).entries.find(o=>o.sha256===r.sha256&&o.env===r.env&&o.orgId===r.orgId&&o.type===r.type)}async remember(r){let t=await this.read();t.entries=[...t.entries.filter(o=>!(o.sha256===r.sha256&&o.env===r.env&&o.orgId===r.orgId&&o.type===r.type)),r],await this.write(t)}async forget(r){let t=await this.read(),o=t.entries.length;t.entries=t.entries.filter(s=>!(s.sha256===r.sha256&&s.env===r.env&&s.orgId===r.orgId&&s.type===r.type)),t.entries.length!==o&&await this.write(t)}isNearExpiry(r){return Pe(r,this.deps.now())}};var Z={emulator:[".apk"],simulator:[".zip"]};function Q(e){return e.skipped===!0}function De(e,r){let t=Ie(e).toLowerCase();return t===".ipa"?`${f(e)} is a device build \u2014 .ipa is not accepted for ${r} runs.`:Z[r].includes(t)?null:`${f(e)} cannot be uploaded for a ${r} run \u2014 expected one of ${Z[r].join(", ")}.`}async function A(e,r){if(!(await Te(e)).isDirectory())return r.hashOf(e);let o=[],s=async i=>{for(let a of await Ce(i,{withFileTypes:!0})){let p=Ae(i,a.name);a.isDirectory()?await s(p):a.isFile()&&o.push(p)}};await s(e),o.sort();let n=be("sha256");for(let i of o)n.update(ke(e,i)),n.update("\0"),n.update(await T(i)),n.update("\0");return n.digest("hex")}async function W(e){let r=De(e.path,e.type);if(r)return{skipped:!0,reason:r};let t=e.cache??new u,o=e.client??new J(e.baseUrl,{...e.auth,orgId:e.orgId}),s;try{s=await A(e.path,t)}catch(a){return{skipped:!0,reason:`could not read ${f(e.path)}: ${a.message}`}}let n={sha256:s,env:e.env,orgId:e.orgId,type:e.type},i=await t.lookup(n);if(i){if(await o.liveness(i.appId)!=="gone")return{appId:i.appId,...i.appUrl?{appUrl:i.appUrl}:{},fromCache:!0};e.onProgress?.(`${i.appId} is no longer in the cloud \u2014 uploading again`),await t.forget(n)}try{e.onProgress?.(`uploading ${f(e.path)}\u2026`);let a=await o.upload(e.path,e.type);return await t.remember({sha256:s,env:e.env,orgId:e.orgId,type:e.type,appId:a.appId,...a.appUrl?{appUrl:a.appUrl}:{},...I(a.url)?{storedAt:I(a.url)}:{},sourcePath:e.path}),e.onProgress?.(a.cached?`${f(e.path)} already in the cloud (${a.appId})`:`${f(e.path)} uploaded (${a.appId})`),{appId:a.appId,...a.appUrl?{appUrl:a.appUrl}:{},fromCache:!1}}catch(a){return{skipped:!0,reason:a.message}}}function h(e){return`${e.platform}|${F(e)}`}var g=new Map,ee=new Set;function re(e){return ee.has(h(e))}function We(e,r,t){r.state==="stopped"&&(g.has(h(r))||oe(e,r,t))}async function te(e,r,t){let o=g.get(h(r));return o?(t?.(`waiting for ${r.displayName} to finish booting\u2026`),o):oe(e,r,t)}function oe(e,r,t){let o=h(r),s=e.prepare(r,t);g.set(o,s),r.state==="stopped"&&s.then(()=>ee.add(o),()=>{});let n=()=>{g.get(o)===s&&g.delete(o)};return s.then(n,n),s.catch(()=>{}),s}import{basename as xe}from"path";import{spawnSync as Ue}from"child_process";async function Se(e,r,t){if(!e.teardownPlan||!t.appPackage&&!t.shutdown)return;let o;try{o=await e.teardownPlan(r,t)}catch{return}o.length!==0&&b(`device:${r.id}`,()=>{Y({udid:r.id,displayName:r.displayName});for(let s of o)try{Ue(s.file,s.args,{timeout:3e4,stdio:"ignore"})}catch{}})}var ae={emulator:[".apk"],simulator:[".zip"]};async function Ee(e,r,t,o){if(e.kind==="package")return e;if(e.kind==="app_id"){let s=r.cloudUpload;if(!s)throw new Error(`${e.value} is an app id, which needs an account to download it. Log in, or pass a path to a local build instead.`);let n=await G({appId:e.value,baseUrl:s.baseUrl,auth:s.auth,...ae[t]?{accepts:ae[t]}:{},...o?{onProgress:o}:{}}),i=D(n.path);if(!i||i.kind==="app_id")throw new Error(`${n.name} is not a build this CLI can install (from ${e.value}).`);return i}try{let s=new u,n=await A(e.value,s),i=new K;await i.find(n)||o?.(`copying ${xe(e.value)} into the local app store\u2026`);let p=await i.put({key:n,sourcePath:e.value,source:"local"});return{...e,value:p.path}}catch{return e}}function Fe(e){b(`appium:${e}`,()=>{H({deviceClass:e,owner:process.pid})})}var k=class extends Error{constructor(r){super(r),this.name="MobileHostUnsupportedError"}},w=class extends Error{constructor(t,o){super(t);this.doctorText=o;this.name="MobilePreflightError"}};async function $e(e,r,t){let o=t.cloudUpload,s=await W({path:e,type:r,env:o.env,orgId:o.orgId,userId:o.userId,auth:o.auth,baseUrl:o.baseUrl,...t.onProgress?{onProgress:t.onProgress}:{}});if(Q(s)){t.onProgress?.(`app not uploaded \u2014 ${s.reason}`);return}return s.appId}var Ne="app must be a build (.apk for an emulator, .zip of the .app bundle for a simulator) or an app id from your cloud uploads \u2014 a package id names something already installed on one device, so it cannot be uploaded, exported as code, or run anywhere else.",se=/\.(apk|zip)$/i;function D(e){let r=e.trim();if(C(r))return{kind:"app_id",value:r};let t=se.exec(r)?.[1]?.toLowerCase();return t?{kind:t,value:r}:null}function _e(e){return!!e&&(se.test(e)||C(e.trim()))}function Me(e){return e.filter(r=>r.required&&r.status==="fail")}function Be(e,r){return!!r&&e.platform===r.platform&&e.kind===r.kind&&(e.id===r.id||e.virtualName===r.id)}async function mr(e){let r=L();if(!r.supported)throw new k(r.reason);let t=e.appiumUrl??e.defaults?.appium_url,o=!!(e.agent||!e.interactive),s=M();o&&e.platform?.toLowerCase()!=="ios"&&((await s.status("emulator")).installed||await s.ensure("emulator",{automatic:!0,onProgress:e.onProgress}));let n=await O(e.platform,{appiumUrl:t});if(z(n)){let d=n.sections.flatMap(P=>Me(P.checks)).map(P=>P.label).join(", ");throw new w(`Mobile toolchain not ready (${d}). Run \`kane-cli doctor --target ${e.platform?.toLowerCase()==="ios"?"simulator":e.platform?.toLowerCase()==="android"?"emulator":"<emulator|simulator>"}\` for details.`,j(n))}let i=await R({device:e.device,platform:e.platform,defaultTarget:e.defaults?.default_target,interactive:e.interactive}),a;if(i.ok)a=i.target;else if(i.reason==="needs-picker"&&e.pickTarget){let d=await e.pickTarget(i.candidates);if(!d)throw new Error("Target selection cancelled");a=d}else throw new Error(i.message);let p=B(a.platform);if(!p)throw new Error(`No provider for platform "${a.platform}"`);let l=N(a);if(!l)throw new Error(`No managed dependencies serve ${a.platform} ${a.kind} targets yet.`);try{await s.ensure(l,{automatic:o,onProgress:e.onProgress})}catch(d){throw d instanceof _?new w(d.message,d.message):d}let ie=a.state!=="ready"||re(a);a=await te(p,a,e.onProgress);let ne=await q(l,{...t?{appiumUrl:t}:{},device:{udid:a.id,displayName:a.displayName},onProgress:e.onProgress});Fe(l);let x=Be(a,e.defaults?.default_target)?e.defaults?.default_app:void 0,m=e.app??(_e(x)?x:void 0);if(e.app&&!D(e.app))throw new Error(`${e.app}: ${Ne}`);let c=m?D(m):null,U=c?await Ee(c,e,l,e.onProgress):null,v=U?await p.ensureApp(a,U,e.onProgress):void 0,y=c?.kind==="app_id"?c.value:e.cloudUpload&&c&&m?await $e(c.value,l,e):void 0;await Se(p,a,{shutdown:ie,...v?{appPackage:v}:{}});let pe=$(a,v,{noReset:e.noReset??e.defaults?.no_reset,appiumUrl:ne.url}),S=y??m;return{device:pe,target:a,provider:p,...y?{appId:y}:{},...S?{appRef:S}:{}}}export{We as a,te as b,k as c,w as d,Ne as e,D as f,_e as g,mr as h};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as Bt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Ft}from"./chunk-I7TIGB7K.js";import{a as te,c as Yt,e as Zt,f as qe,g as Qt,h as nr}from"./chunk-
|
|
2
|
+
import{b as Bt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Ft}from"./chunk-I7TIGB7K.js";import{a as te,c as Yt,e as Zt,f as qe,g as Qt,h as nr}from"./chunk-AJPLHW4T.js";import{a as Xt,b as rr,c as sr,d as ir,e as dt,f as or}from"./chunk-ZGBSGZZM.js";import{a as ke,b as qt,c as Gt,d as Lt,e as Vt}from"./chunk-W27F2NWA.js";import{a as zt}from"./chunk-L2TV4G56.js";import{a as Kt,b as Jt}from"./chunk-JFAFKHDX.js";import{c as Wt}from"./chunk-6KPPGMO2.js";import{e as Ut}from"./chunk-7JUUNZQP.js";import{a as Fe}from"./chunk-UX3KPYTI.js";import{b as Nt}from"./chunk-YKTYVJBN.js";import{a as Ht,e as jt}from"./chunk-GFKCTYCA.js";import{a as er}from"./chunk-IMR64OCZ.js";import{e as Mt}from"./chunk-X2FM67OM.js";import{a as $e,b as ct}from"./chunk-DNNZ353O.js";import{a as Se}from"./chunk-NVGBE2DR.js";import{b as nt}from"./chunk-IDX3TOPY.js";import{A as ee,k as be,o as Be}from"./chunk-TH47OOBV.js";import{f as It}from"./chunk-DUAXZYAD.js";import{e as at}from"./chunk-DBIBROYW.js";import{d as me}from"./chunk-WXHQYYD5.js";import{b as Ot}from"./chunk-IAHKTEET.js";import{a as At}from"./chunk-5EOX4MEY.js";import{appendFileSync as wr,mkdirSync as ut,rmdirSync as br,writeFileSync as lt}from"fs";import{dirname as mr,extname as Sr,join as ce}from"path";var X=class extends Error{code;constructor(e,a){super(`${e}: ${a}`),this.name="ProposalAdapterError",this.code=e}};function cr(r){return r.version===2}var ar=8;function vr(r){let e=/^extract@(\d+)$/.exec(r??"");return e?Number.parseInt(e[1],10):null}var yr=r=>typeof r=="object"&&r!==null&&"op"in r;function Ge(r,e,a){return{anchor:r.anchor,quote:r.quote,...a||r.source_id!==e?{source_id:r.source_id}:{}}}function dr(r,e,a={}){let m=vr(a.templateVersion),x=m!==null&&m>=5,_=m!==null&&m<5,y=r.archived!=null&&r.archived.length>0&&m!==null&&m<5;if(y&&a.warn?.(`dropped ${r.archived.length} archive op(s): the bound extract template @${m} never described archiving \u2014 nothing was archived; the use-cases still land`),!x&&r.read_basis.length!==1)throw new X("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${r.read_basis.length}`);if(r.read_basis.length===0)throw new X("READ_BASIS_COUNT","read_basis must not be empty");let v=r.read_basis[0],h=r.read_basis.length>1,$=r.use_cases.map(i=>{if(_&&i.cite.length!==1)throw new X("CITE_COUNT",`${i.temp_ref}: cite must have exactly 1 element, got ${i.cite.length}`);if(i.cite.length<1||i.cite.length>ar)throw new X("CITE_COUNT",`${i.temp_ref}: 1..${ar} cites allowed, got ${i.cite.length}`);let M=(f,re)=>{if(!x&&f!==v.source_id)throw new X("SOURCE_MISMATCH",`${re}: cite source ${f} != read_basis source ${v.source_id} (single-source)`)};M(i.cite[0].source_id,i.temp_ref);let P=i.cite.map(f=>(M(f.source_id,i.temp_ref),Ge(f,v.source_id,x&&(h||f.source_id!==v.source_id)))),l=(i.updated?.criteria??[]).some(yr);if(!x&&l)throw new X("CRITERIA_OPS_UNSUPPORTED",`${i.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${a.templateVersion??"an unversioned template"}`);return{temp_ref:i.temp_ref,title:i.title,...i.description!==void 0?{description:i.description}:{},...i.summary!==void 0?{summary:i.summary}:{},...i.actors!==void 0?{actors:i.actors}:{},...i.value!==void 0?{value:i.value}:{},risk:i.risk,cite:P[0],...P.length>1?{cites:P}:{},...i.criteria!=null&&i.criteria.length>0?{criteria:i.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{},depends_on_hint:i.depends_on_hint,matches_existing:i.matches_existing,...i.conflicts_with!=null?{conflicts_with:i.conflicts_with}:{},...i.changed?{changed:!0}:{},...i.updated!=null?{updated:{...i.updated.title!=null?{title:i.updated.title}:{},...i.updated.description!=null?{description:i.updated.description}:{},...i.updated.summary!=null?{summary:i.updated.summary}:{},...i.updated.actors!=null?{actors:i.updated.actors}:{},...i.updated.value!=null?{value:i.updated.value}:{},...i.updated.risk!=null?{risk:i.updated.risk}:{},...i.updated.criteria!=null?{criteria:l?i.updated.criteria.map(f=>f.op==="set"?{op:"set",text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}:f.op==="keep"?{op:"keep",ref:f.ref,text:f.text}:{op:"remove",ref:f.ref,text:f.text,reason:f.reason}):i.updated.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.updated.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{}}}:{},...i.change_note!=null?{change_note:i.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:v.source_id,source_cid:v.source_cid},use_cases:$,...h?{sources:r.read_basis.map(i=>({source_id:i.source_id,source_cid:i.source_cid}))}:{},...r.extraction_of!=null&&r.extraction_of.length>0?{extraction_claims:r.extraction_of.map(i=>({source_id:i.source_id,completeness:i.completeness}))}:{},...r.archived!=null&&r.archived.length>0&&!y?{archived:r.archived.map(i=>({target:i.target,reason:i.reason,basis:i.basis}))}:{}}}function ur(r){let{contextDir:e,graph:a}=r,m=r.maxDigestBytes??4096,x={},_=[];for(let[h,$]of a.heads){if(x[h]=$,typeof $!="string")continue;let i=a.mediaOf($),M=a.getNode($)?.content?.blob;if(typeof M=="string")if(i.format==="image")_.push({source_id:h,cid:$,format:"image",blobRef:{path:Se(e,M),cid:M}});else{let P=$e(e,a,$)?.toString("utf8")??"";_.push({source_id:h,cid:$,format:i.format,text:P})}}_.sort((h,$)=>h.source_id<$.source_id?-1:1);let y=[];for(let h of a.byLabel(me.STYLENOTE).sort(($,i)=>$.cid<i.cid?-1:1))a.superseded.has(h.cid)||y.push(`\u2022 ${String(h.content.statement)} [${String(h.content.learned_from_kind)}]`);let v="";for(let h of y){if(Buffer.byteLength(v+h+`
|
|
3
3
|
`,"utf8")>m)break;v+=h+`
|
|
4
4
|
`}return{read_basis:x,sources:_,styleNoteDigest:v}}function lr(r,e){let a=ur({contextDir:r,graph:e}).styleNoteDigest;return a.length>0?a:void 0}function mt(r,e,a,m,x){let _=null,y=()=>_??=x&&Object.keys(x).length>0?Promise.resolve(x):Ut().catch(()=>({}));return{contextDir:r,rootSid:e,locks:at(r,e),probe:m??Ft(r,{resolveAlias:async v=>qt(v,{env:process.env,auth:await y()}),embed:async(v,h)=>Gt(v,h,{env:process.env,auth:await y()}),readVector:(v,h)=>Lt(r,v,h),writeVector:(v,h,$)=>Vt(r,v,h,$)}),...a?.length?{reservedEventIds:a}:{}}}function ht(r,e){let a=[],m=[];for(let x of r.use_cases){let _=x.matches_existing;_?.cid&&e.hasNode(_.cid)?a.push({ref:_.cid,expectedTip:e.tipOf(_.cid)}):m.push({tempRef:x.temp_ref,title:String(x.title??""),probeText:String(x.title??"")})}return{verb:"extract",ucTargets:a,newBuCandidates:m,sourcePins:[{source_id:r.source.source_id,source_cid:r.source.source_cid}],readBasis:r.read_basis??null}}function $r(r,e){let a=(r.images??[]).filter(m=>m.delivery==="selected");if(a.length!==0)return a.map(m=>({ref:m.ref,...m.page!==void 0?{page:m.page}:{},...m.loc!==void 0?{loc:m.loc}:{},media_type:m.media_type,blob_ref:{path:Se(e,m.blob),cid:m.blob}}))}function kr(r){return r.length>8&&r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71?"image/png":r.length>3&&r[0]===255&&r[1]===216&&r[2]===255?"image/jpeg":r.length>12&&r.toString("ascii",0,4)==="RIFF"&&r.toString("ascii",8,12)==="WEBP"?"image/webp":null}function Le(r){return r.toISOString().replace(/[-:]/g,"").slice(0,15)}function hr(r){return r.startsWith("su-conv-")?`conv-${Ot(Buffer.from(r,"utf8")).slice(0,8)}`:r}function pr(r){return r.source_id.startsWith("su-conv-")?"the conversation":r.source_id}function Rr(r,e,a){return`reading ${pr(r)}${a>1?` (source ${e} of ${a})`:""}`}function Re(r){return r.toLowerCase().trim().replace(/\s+/g," ")}function gr(r,e){let a=new Map,m=new Map,x=new Map;for(let{cid:y,content:v}of e.byLabel(me.USECASE)){if(e.superseded.has(y))continue;(e.trust.get(y)==="archived"?x:m).set(Re(String(v.title??"")),y)}let _=y=>e.trust.get(y)==="archived"?{cid:y,archived:!0,reason:e.archivedReason.get(y)}:{cid:y};for(let y of r.use_cases){if(y.matches_existing){let $=y.matches_existing.cid;if(e.superseded.has($)){let i=e.tipOf($);$=e.superseded.has(i)?null:i}if($!==null){a.set(y.temp_ref,_($));continue}}let v=m.get(Re(y.title));if(v){a.set(y.temp_ref,{cid:v});continue}let h=x.get(Re(y.title));h&&a.set(y.temp_ref,_(h))}return a}var fr=/^(\S+)\.criteria\[(\d+)\]/;function Cr(r,e,a){if(e.length===0||!e.every(x=>fr.test(x.detail)))return!1;let m=new Map;for(let x of e){let _=fr.exec(x.detail),y=m.get(_[1])??new Set;y.add(Number(_[2])),m.set(_[1],y)}for(let x of r.use_cases){let _=m.get(x.temp_ref);_?.size&&(x.criteria=(x.criteria??[]).filter((y,v)=>!_.has(v)),a(`${x.temp_ref}: dropped ${_.size} criteria with unverifiable cites \u2014 committed without them (criteria are hints, not oracles)`))}return!0}async function gt(r,e,a,m,x=()=>{},_,y){let v=(h,$)=>x(h,$,r.session_id);return Zt(r,e,a,m,x,{async onProposalEvent(h){let $=h,i=null,M=null;if(cr($))try{i=dr($,r.read_basis,{templateVersion:y?.()??null,warn:P=>{e.out(`warning: ${P}`),v("adapter",{warn:P})}}),v("adapter",{ok:!0,use_cases:i.use_cases.length})}catch(P){M=P instanceof X?P.message:String(P),v("adapter",{ok:!1,error:M})}else i=$;return i&&i.use_cases.length===0&&(e.out("warning: the agent proposed ZERO use-cases for this source"),e.emit?.({type:"warning",code:"ZERO_USE_CASES",message:"the agent proposed ZERO use-cases for this source"})),i&&_&&await _(i),{proposal:i,error:M}}})}var Dr=new Set(["agent","ci","override"]);async function Ss(r,e){let a=`ext-${Le(e.now?.()??new Date)}-lk${Math.random().toString(36).slice(2,8)}`,x=at(e.contextDir,a,e.now?{now:e.now}:void 0).tryAcquire([{kind:"extract"}],{hold:"session",verb:"extract"});if("contended"in x){let _=x.contended.holder,y=`another extraction is running on this context${_?` (pid ${_.pid})`:""} \u2014 retry when it finishes`;return e.out(y),e.emit?.({type:"error",message:y,code:"EXTRACT_LOCKED"}),2}try{return await Er(r,e)}finally{x.release()}}async function Er(r,e){let a=r.mode??"interactive";if(r.posture==="reconcile"){if(r.trust==="hold"){let o="error: --trust hold has no meaning here \u2014 a reconcile IS the review; drop the flag";return e.out(`${o} [TRUST_USAGE]`),e.emit?.({type:"error",message:o,code:"TRUST_USAGE"}),2}if(!r.source||!r.changeContext){let o="reconcile posture needs a pinned source and its change context \u2014 internal wiring fault";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}if(a==="ci"){let o="reconcile posture is not available under --mode ci \u2014 a held changeset needs a durable session; use --mode agent";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}}if(r.trust==="hold"&&a==="interactive")return e.out("error: --trust hold only applies to headless runs \u2014 in interactive chat you review items in-session anyway; use --mode agent to hold everything for review"),e.emit?.({type:"error",message:"error: --trust hold only applies to headless runs \u2014 use --mode agent",code:"TRUST_USAGE"}),2;if(a==="interactive"){if(!e.isTTY)return e.out("extract: --mode interactive needs a TTY (use --mode agent|ci|override headless)"),2}else if(!Dr.has(a))return e.out(`extract: unknown mode "${a}" \u2014 interactive | agent | ci | override`),2;if(r.trust!==void 0){if(a==="ci")return e.out("error: --trust is not available under --mode ci (ci is fail-closed \u2014 no trust dials)"),e.emit?.({type:"error",message:"error: --trust is not available under --mode ci",code:"TRUST_UNDER_CI"}),2;if(r.trust!=="auto"&&r.trust!=="hold")return e.out(`error: --trust must be auto | hold, got '${r.trust}'`),e.emit?.({type:"error",message:`error: --trust must be auto | hold, got '${r.trust}'`,code:"TRUST_USAGE"}),2}let m=e.telemetry?.enabled?e.telemetry:void 0,x=Le(e.now?.()??new Date),_=m?At(m.ids.context_instance_id??null,"extract",m.ids.session_id):ce(e.contextDir,"logs",`extract-${x}.log`);ut(mr(_),{recursive:!0});let y=`run-${x}-${Math.random().toString(36).slice(2,8)}`,v=o=>o==="error"||o==="failed_proposal"?"error":o==="repair_respawn"?"warn":"info",h=(o,u,s)=>{try{wr(_,JSON.stringify({ts:new Date().toISOString(),level:v(o),run_id:y,...m?{user_session_id:m.ids.session_id}:{},...s?{session_id:s}:{},kind:o,data:u})+`
|
|
5
5
|
`)}catch{}m?.wireTrace(o,u,s)};{let o=e.out;e.out=u=>{h("transcript",{line:u}),o(u)}}e.chat||e.out(`trace: ${te(_)}`),e.emit?.({type:"run_start",mode:a,trace:_,...m?{session:m.ids.session_id}:{}});let $=Nt();if($&&e.out($),e.preflightTurn){let o=await e.preflightTurn();if(h("preflight",o),!o.ok)return e.out(o.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:o.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),2}let i=ee(e.contextDir),M=lr(e.contextDir,i),P=r.sources?.length?r.sources:r.source?[r.source]:[];if(P.length>0){if(r.resume){let o="error: --source cannot be combined with --resume (the resumed session already has its scope)";return e.out(o),e.emit?.({type:"error",message:o,code:"SOURCE_WITH_RESUME"}),2}for(let o of P){let u=i.heads.get(o);if(typeof u!="string"){let s=u===null?`error: --source ${o} was ingested but is retired \u2014 re-ingest it to extract again`:`error: --source ${o} is not an ingested source (kane-cli context list shows them)`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_UNKNOWN"}),2}}}let l=null,f=null;if(r.resume){try{{let c=await or(e.contextDir,r.resume,i,{verb:"extract",deps:{onWarn:C=>e.out(`note: ${C}`)}});{let C=Object.keys(c.handle.state.read_basis??{});if(C.length>1){let B=`error: session ${r.resume} spans ${C.length} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (re-run kane-cli context extract for anything remaining)`;return e.out(B),e.emit?.({type:"error",message:B,code:"MULTI_SOURCE_RESUME"}),c.handle.release(),2}f=c,h("resume_kind",{kind:c.view.pointer===null?"bare-base":c.view.pointer.at==="final"?"pause":"crash"}),l={handle:c.handle,represent:c.represent,questions:c.questions,staleBasis:c.drift.map(B=>B.subject)}}}}catch(c){let C=c instanceof Error?c.message:String(c);return e.out(`error: ${C}`),e.emit?.({type:"error",message:`error: ${C}`,...c instanceof dt?{code:c.code}:{}}),c instanceof dt?2:1}let o=f?null:Xt(l.handle.state.verb,"extract",r.resume);if(o)return e.out(o.message),e.emit?.({type:"error",message:o.message,code:o.code}),l.handle.release(),2;let u=l.handle.state.change_basis;if(u&&(i.heads.get(u.source_id)??null)!==u.new_head){let c=`error: ${u.source_id} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; re-run kane-cli maintain reconcile against the current file (session ${r.resume} is defunct and can be ignored)`;return e.out(c),e.emit?.({type:"error",message:c,code:"CHANGE_BASIS_MOVED"}),l.handle.release(),2}if(f&&f.view.pointer!==null&&f.drift.length>0){if(!await e.confirmStale(`changed since the pause: ${f.drift.map(C=>C.subject).join(", ")} \u2014 re-ground and continue against the current versions?`)){let C=`resume aborted: the context moved since the pause (${f.drift.map(B=>B.subject).join(", ")}) \u2014 session ${r.resume} is preserved`;return e.out(C),e.emit?.({type:"error",message:C,code:"RESUME_DRIFT"}),l.handle.release(),2}}else l.staleBasis.length>0&&e.out(`note: changed since the pause: ${l.staleBasis.join(", ")} \u2014 re-presented items may be stale`);let s=[...new Set([...l.handle.state.held_receipts??[],...f?.view.kane?.held_receipts??[]])];if(s.length>0)if(e.chat?.holdReceipt)for(let c of s)e.chat.holdReceipt(c);else e={...e,initialMessage:[s.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as f,d as l}from"./chunk-
|
|
2
|
+
import{b as f,d as l}from"./chunk-BG66IAO6.js";import{a as p}from"./chunk-TZXXJWHA.js";function d(t,e,o){return{id:`${t}.internal`,label:e,required:!0,status:"fail",detail:o instanceof Error?o.message:String(o)}}async function k(t,e={}){let o=p();if(!o.supported)return{sections:[{platform:"host",checks:[{id:"host.platform",label:"host",required:!0,status:"fail",detail:o.reason}]}]};let n=t?f().filter(r=>r.toLowerCase()===t.toLowerCase()):f(),{managedDeps:i}=await import("./deps-bundle-FRM65BQO.js"),s=n.flatMap(r=>r==="android"?["emulator"]:r==="ios"?["simulator"]:[]);await Promise.allSettled(s.map(r=>i().warmResolveCache(r)));let c=[];for(let r of n){let u=l(r);if(!u)continue;let a;try{a=await u.checks(e)}catch(h){a=[d(r,"toolchain check",h)]}c.push({platform:r,checks:a})}return{sections:c}}function m(t){return t==="pass"?"\u2713":t==="fail"?"\u2717":"\u2139"}function x(t){return t.charAt(0).toUpperCase()+t.slice(1)}function C(t){let e=[];if(t.sections.length===0)return"No mobile platforms are supported on this host.";for(let o of t.sections){e.length>0&&e.push(""),e.push(`${x(o.platform)} toolchain`);let n=o.checks.filter(s=>s.status!=="info"),i=new Set;for(let s of n){let c=s.detail?` \u2014 ${s.detail}`:"";if(e.push(` ${m(s.status)} ${s.label}${c}`),s.status==="fail"&&s.fixText&&!i.has(s.fixText)){i.add(s.fixText);for(let r of s.fixText.split(`
|
|
3
3
|
`))e.push(` fix: ${r}`)}}}return e.join(`
|
|
4
4
|
`)}function w(t){return t.sections.length===0?!0:t.sections.every(e=>e.checks.some(o=>o.required&&o.status==="fail"&&!o.fixedByBundle))}function b(t){for(let e of t.sections)for(let o of e.checks)if(o.required&&o.status!=="pass")return 2;return 0}export{k as a,C as b,w as c,b as d};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{d as lt,g as pt}from"./chunk-5DBK6QNS.js";import{b as pe,c as B,d as fe,e as me}from"./chunk-TJZMYU2W.js";import{b as h,c as ce,d as rt,f as de,g as ue}from"./chunk-5GUD3CIH.js";import{a as nt,e as A,f as it,g as ot,h as V,i as st,j as K,k as D,l as at}from"./chunk-ZSXDZI56.js";import{a as N,b as T,d as tt}from"./chunk-EHN5HTUD.js";import{d as ft}from"./chunk-NVGBE2DR.js";import{a as J}from"./chunk-CH273NAE.js";import{b as P,c as v}from"./chunk-VZ7KXRXB.js";import{a as se,c as Ze,d as Qe,e as et,f as ae}from"./chunk-P7YZ3PU3.js";import{A as w}from"./chunk-TH47OOBV.js";import{b as q}from"./chunk-VAYBKR76.js";import{a as dt}from"./chunk-CUM23TLF.js";import{b as ut,f as U,i as W}from"./chunk-DUAXZYAD.js";import{d as le,f as ct}from"./chunk-WXHQYYD5.js";import{a as Je,b as Xe}from"./chunk-KX2GOJ4C.js";import{a as qe}from"./chunk-CCUGKBIH.js";function C(t){if(t===null)return"broken";let e=Math.floor(t/100);return e===1?"passed":e===7?"failed":e===2?"skipped":"broken"}var $={failed:3,broken:2,passed:1,skipped:0};function ge(t){let e="skipped";for(let r of t)$[r]>$[e]&&(e=r);return e}import{createHash as Ut}from"crypto";import{basename as Wt}from"path";function he(t){let e=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return e.length>0?e:"session"}function ve(t){return Ut("sha256").update(t).digest("hex").slice(0,8)}function ye(t){let e=Wt(t).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${he(e)}-${ve(t)}`}function we(t,e){return`${he(t)}-${ve(e)}`}function xe(t){let e={};for(let[r,n]of Object.entries(t))typeof n=="string"&&n.length>0&&(e[r]=n);return e}function qt(t,e){return{pack_test_dir:t,ordinal_offset:e}}import{promises as k}from"fs";import{join as S}from"path";function _e(t){let e={evidence:"0.1",run_id:t.execution_id,status:"running",title:t.title,started:t.started,environment:{producer:{name:"kane-cli",version:t.producerVersion},...t.surfaces?{surfaces:t.surfaces}:{},run_kind:t.run_kind,origin:t.origin,pid:t.pid},...t.credits!==void 0?{metrics:{credits:{value:t.credits,type:"count"}}}:{}};return v(e,{lineWidth:-1})}async function ke(t,e,r,n=process.cwd(),i){let s=i??h(t.execution_id,n),o=S(s,"tests",e);return await k.mkdir(S(s,"coverage"),{recursive:!0}),await k.writeFile(S(s,"coverage",".keep"),""),await k.mkdir(o,{recursive:!0}),await k.writeFile(S(s,"run.yaml"),_e(t)),r&&await k.writeFile(S(o,r.path),r.content),s}async function Jt(t,e=process.cwd()){let r=h(t.execution_id,e);await k.mkdir(S(r,"coverage"),{recursive:!0}),await k.writeFile(S(r,"coverage",".keep"),"");let n=P(_e(t));return n.environment&&delete n.environment.run_kind,await k.writeFile(S(r,"run.yaml"),v(n,{lineWidth:-1})),r}async function Xt(t,e=process.cwd()){return T(h(t,e),new Date().toISOString())}async function be(t,e=process.cwd()){await k.rm(h(t,e),{recursive:!0,force:!0})}import{promises as Se}from"fs";import{join as Ie}from"path";function X(t){let e={evidence:"0.1",test:t.testId,status:t.status,...t.durationMs!==void 0?{duration_ms:t.durationMs}:{},...t.attempts&&t.attempts.length?{attempts:t.attempts}:{},...t.flaky!==void 0?{flaky:t.flaky}:{},...t.adaptiveHeal?{adaptive_heal:t.adaptiveHeal}:{},...t.definitionPath?{definition:{path:t.definitionPath}}:{},...t.definitionId?{definition_id:t.definitionId}:{},...t.assuranceId?{assurance_id:t.assuranceId}:{},...Object.keys(t.externalId).length?{external_id:t.externalId}:{},...t.tags&&t.tags.length?{tags:t.tags}:{},...Object.keys(t.environment).length?{environment:t.environment}:{},steps:t.steps};return v(e,{lineWidth:-1})}function Ee(t){return v({logs:t},{lineWidth:-1})}async function Re(t,e,r){await Se.writeFile(Ie(t,"tests",e,"result.yaml"),r)}async function Pe(t,e,r){let n=Ie(t,"tests",e,"logs");await Se.mkdir(n,{recursive:!0}),await Se.writeFile(Ie(n,"meta.yaml"),r)}import{promises as Z}from"fs";import{join as mt}from"path";function gt(t){return mt(t,".internal","meta.json")}async function ht(t){let e;try{e=await Z.readFile(gt(t),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(e);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function Ae(t,e){let r;try{r=await ht(t)??{}}catch(o){console.warn(`evidence: meta.json at ${t} unreadable \u2014 skipping execution-pointer append to preserve identity`,o);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(e),r.executions=n,await Z.mkdir(mt(t,".internal"),{recursive:!0});let i=gt(t),s=`${i}.tmp-${process.pid}-${Date.now()}`;await Z.writeFile(s,JSON.stringify(r,null,2)+`
|
|
3
|
+
`),await Z.rename(s,i)}async function Zt(t){try{let e=await ht(t);return e&&Array.isArray(e.executions)?e.executions:[]}catch{return[]}}async function Qt(t,e,r=process.cwd()){let n=await de(t,r);if(!n){let s=`evidence: no pack found for "${t}"`;return e.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:t})):console.error(s),2}let i=await N(n,e.profile??"L1");return e.json?console.log(JSON.stringify({valid:i.valid,status:i.status,diagnostics:i.diagnostics})):console.log(`evidence: ${i.valid?"valid":"INVALID"} (${e.profile??"L1"}, status ${i.status})`),i.valid?0:1}function De(t){let e=[];for(let r of t){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)e.push(C(i))}return ge(e)}function er(t){let e=null;for(let r of t){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)i!=null&&(e==null||$[C(i)]>$[C(e)]||$[C(i)]===$[C(e)]&&i>e)&&(e=i)}return e}import{promises as tr}from"fs";import{extname as vt,basename as rr}from"path";var nr={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function $e(t){let e;try{e=await tr.readdir(t)}catch{return[]}return e.filter(r=>r!=="meta.yaml").sort().map(r=>({name:rr(r,vt(r)),file:r,format:nr[vt(r)]??"txt"}))}import{mkdirSync as ir,appendFileSync as or}from"fs";import{join as yt}from"path";function Ce(t,e){return yt(t,"tests",e,"logs")}function Le(t,e,r,n={},i){try{i?.(e,r,r,n)}catch{}if(t)try{ir(t,{recursive:!0});let s=JSON.stringify({ts:new Date().toISOString(),level:e,event:r,...n})+`
|
|
4
|
+
`;or(yt(t,"diagnostics.ndjson"),s)}catch{}}import{promises as I}from"fs";import{dirname as mr,join as L}from"path";import{statSync as sr}from"fs";import{promises as Fe}from"fs";import{basename as ar,join as cr}from"path";var dr=1e6,ur=2e6;function lr(){return Je.map(t=>Xe(t))}function wt(t=lr()){return t.map(e=>{let r=0;try{r=sr(e).size}catch{}return{path:e,offset:r}})}var pr=/\x1b\[[0-9;]*[A-Za-z]/g;async function fr(t,e,r){let n;try{n=await Fe.open(t,"r");let i=(await n.stat()).size,s=e<=i?e:0,o=i-s;if(o<=0)return null;let a=o>r?i-r:s,c=Buffer.alloc(Math.min(o,r));return await n.read(c,0,c.length,a),c.toString("utf8")}catch{return null}finally{await n?.close().catch(()=>{})}}async function xt(t,e){let r=e.caps?.stderr??dr,n=e.caps?.appium??ur,i=[];e.runnerStderrPath&&i.push({src:e.runnerStderrPath,from:0,cap:r});for(let s of e.appiumMarks??[])i.push({src:s.path,from:s.offset,cap:n});for(let s of i){let o=await fr(s.src,s.from,s.cap);if(o===null)continue;let a=o.replace(pr,"");if(a!=="")try{await Fe.mkdir(t,{recursive:!0}),await Fe.writeFile(cr(t,ar(s.src)),a)}catch{}}}async function gr(t){try{let e=L(t,"tests"),r=await I.readdir(e).catch(()=>[]);for(let n of r){let i=L(e,n,"steps"),s=await I.readdir(i).catch(()=>[]);for(let o of s){let a=await I.readFile(L(i,o,"failure.yaml"),"utf8").catch(()=>null);if(a!=null)try{let c=P(a);if(c&&typeof c=="object"&&c.triage)return!0}catch{}}}}catch{}return!1}async function _t(t,e,r,n={}){let i=L(t,"tests",e,"logs");if(r)try{await I.mkdir(i,{recursive:!0}),await I.copyFile(r,L(i,"tui.log"))}catch{}await xt(i,{runnerStderrPath:r?L(mr(r),"runner-stderr.log"):void 0,appiumMarks:n.appiumMarks});let s=await $e(i);if(!s.length&&n.requireRealLog)throw new Error(`evidence test ${e} has no real log to declare`);s.length&&await Pe(t,e,Ee(s))}async function Oe(t){let e=t.cwd??process.cwd(),r=t.packDir??h(t.executionId,e);if(!t.saved&&!t.packDir)return await be(t.executionId,e),{sealed:!1};await _t(r,t.testId,t.tuiLogPath,{requireRealLog:t.requireRealLog,appiumMarks:t.appiumMarks});let n=L(r,"run.yaml"),i=P(await I.readFile(n,"utf8"));i.environment={...i.environment??{},saved:t.saved,run_kind:t.runKind},await I.writeFile(n,v(i,{lineWidth:-1}));let s=await I.open(n,"r+");try{await s.sync()}finally{await s.close()}let o=await gr(r);await T(r,new Date().toISOString());let a;try{let l=await N(r,"L1");a=l.valid;let d=(l.diagnostics??[]).filter(u=>String(u?.code??"").includes("failure.status_disagrees"));if(d.length>0)if(t.expectStatusDisagrees||o){let u=t.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${d.length} status_disagrees advisory(ies) \u2014 ${u}`)}else console.warn(`evidence: ${d.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,d);if(!l.valid){console.warn(`evidence: sealed pack ${t.executionId} failed L1 validation`,l.diagnostics);let u=String(l.diagnostics?.[0]?.code??"");Le(Ce(r,t.testId),"warn","EVIDENCE_INVALID",{execution_id:t.executionId,first_code:u,surface:t.surface??"testmd"},t.log)}}catch(l){console.warn(`evidence: validation error for ${t.executionId}`,l)}let c;if(t.saved&&t.packDir)try{c=await rt(r,t.executionId,e)}catch(l){console.warn(`evidence: store install failed for ${t.executionId}`,l)}if(t.outputStemDir)try{await Ae(t.outputStemDir,{execution_id:t.executionId,run_kind:t.runKind,status:t.verdict,valid:a,at:new Date().toISOString()})}catch(l){console.warn(`evidence: execution-pointer append failed for ${t.executionId} (pack is sealed)`,l)}return{sealed:!0,valid:a,storePath:c}}import{release as Et}from"os";import{execFileSync as hr}from"child_process";import{promises as kt}from"fs";import{join as bt}from"path";function St(t){return t.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}async function It(t){try{let e=bt(t,"steps"),r=(await kt.readdir(e,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort((n,i)=>(parseInt(n,10)||0)-(parseInt(i,10)||0));for(let n of r)try{let i=await kt.readFile(bt(e,n,"step.json"),"utf8"),o=JSON.parse(i).basis?.window;if(Array.isArray(o)&&o.length===2&&Number.isFinite(Number(o[0]))&&Number.isFinite(Number(o[1]))&&Number(o[0])>0&&Number(o[1])>0)return`${Math.round(Number(o[0]))}x${Math.round(Number(o[1]))}`}catch{}return}catch{return}}var Rt=!1,Q;function vr(){if(!Rt)if(Rt=!0,process.platform==="darwin")try{Q=hr("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{Q=Et()||void 0}else Q=Et()||void 0;return Q}function Me(t){let e={os:se(process.platform)},r=vr();if(r&&(e.os_version=r),t.cdpBrowser){let i=/^([A-Za-z]+)\/(\d+)/.exec(t.cdpBrowser);i&&(e.browser=i[1].replace(/^Headless/,""),e.browser_version=i[2])}t.resolution&&(e.resolution=t.resolution);let n=Qe(e,t.runnerEnvironment);if(!n.native_platform)return n;if(t.deviceName&&(n.device=t.deviceName),t.deviceModel){let i=St(t.deviceModel);i&&(n.device_slug=i)}return t.pixelResolution&&(n.viewport=n.resolution??yr(t.pixelResolution,n.pixel_ratio)??t.pixelResolution,n.resolution=t.pixelResolution),n}function yr(t,e){if(!e||!Number.isFinite(e)||e<=0)return;let r=/^(\d+)x(\d+)$/.exec(t);if(r)return`${Math.round(Number(r[1])/e)}x${Math.round(Number(r[2])/e)}`}async function Pt(t){if(t)try{let e=await fetch(`${t}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!e.ok)return;let r=await e.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function wr(t){let e;return()=>(e||(e=Pt(t)),e)}import{promises as E,existsSync as R,readFileSync as br}from"fs";import{basename as Sr,join as m}from"path";import{readFileSync as xr}from"fs";import{dirname as _r,resolve as kr}from"path";function At(t,e){let r=kr(t),n=xr(r,"utf8");return A(e?V(n,K(_r(r),e)):n)}var z=class t{constructor(e){this.opts=e}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_attempts=[];_packDirOverride;_attached=!1;appiumMarks=wt();get attached(){return this._attached}static async attach(e){let r=Sr(e.packDir).replace(/\.evidence$/,""),n=new t({origin:"testrun",runKind:"author",pid:process.pid,title:e.testId,started:new Date().toISOString(),producerVersion:qe,cwd:e.cwd});n.executionId=r,n.testId=e.testId,n._packDirOverride=e.packDir,n._attached=!0;let i=m(e.packDir,"tests",e.testId);return await E.mkdir(i,{recursive:!0}),e.definition&&(await E.writeFile(m(i,e.definition.path),e.definition.content),n.definitionPath=e.definition.path,n.definitionContent=e.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=ce(),this.testId=this.opts.testmdRelPath?ye(this.opts.testmdRelPath):we(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let e=this.opts.definition??null;return await ke({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{}},this.testId,e,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),e&&(this.definitionPath=e.path,this.definitionContent=e.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?m(this.opts.packRootDir,`${this.executionId}.evidence`):h(this.executionId,this.opts.cwd)}get packTestDir(){return m(this.pack,"tests",this.testId)}async writeDefinition(e,r="test.md"){await E.writeFile(m(this.packTestDir,r),e),this.definitionPath=r,this.definitionContent=e}computeAssuranceId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let e=m(this.opts.cwd,this.opts.testmdRelPath);if(R(e))return D(br(e,"utf8"))?.id}}catch{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let e=m(this.opts.cwd,this.opts.testmdRelPath),r=m(this.opts.cwd,".context"),n=R(r)?w(r):void 0;if(R(e))return At(e,n)}if(this.definitionContent!=null)return A(this.definitionContent)}catch{}}noteSpawn(e){this.accumulatedSteps.push(...e.steps),this.maxOrdinal=Math.max(this.maxOrdinal,e.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}get attempts(){return this._attempts}async archiveAttempt(e,r){let n=this._attempts.length+1,i=m(this.packTestDir,String(n)),s;try{await E.mkdir(i,{recursive:!0});for(let a of["steps","logs","v16-trajectory"]){let c=m(this.packTestDir,a);R(c)&&await E.rename(c,m(i,a))}this.definitionPath&&R(m(this.packTestDir,this.definitionPath))&&await E.copyFile(m(this.packTestDir,this.definitionPath),m(i,this.definitionPath));let o=m(i,"steps");if(R(o)){for(let a of await E.readdir(o))if(R(m(o,a,"failure.yaml"))){s=`${n}/steps/${a}/failure.yaml`;break}}}catch{}return this._attempts.push({n,status:e,steps:this.accumulatedSteps,...r!==void 0?{failedAt:r}:{},...s?{failure:s}:{}}),this.accumulatedSteps=[],this.maxOrdinal=0,n}async writeResult(e){let r=De(e.spawns),n=this._attempts.length?[...this._attempts.map(u=>({status:u.status})),{status:r,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{}}]:void 0,i=n?new Set(n.map(u=>u.status)).size>1:void 0,s=this._attempts.length?{triggered:!0,outcome:r==="passed"?"healed":"exhausted",attempts:this._attempts.map(u=>({n:u.n,status:u.status,failed_at:u.failedAt??-1,...u.failure?{failure:u.failure}:{}}))}:void 0,o=this.pack,a=xe(e.externalIdInput),c=ae(e.runnerEnv,e.intentEnv),l=this.computeDefinitionId(),p=this.computeAssuranceId();await Re(o,this.testId,X({testId:this.testId,status:r,durationMs:e.durationMs,definitionPath:this.definitionPath,definitionId:l,assuranceId:p,externalId:a,environment:c,steps:e.steps,tags:e.tags,attempts:n,flaky:i,adaptiveHeal:s}));for(let u of this._attempts){let f=m(this.packTestDir,String(u.n));R(f)&&await E.writeFile(m(f,"result.yaml"),X({testId:this.testId,status:u.status,definitionPath:this.definitionPath,definitionId:l,assuranceId:p,externalId:a,environment:c,steps:u.steps,tags:e.tags}))}let d=e.externalIdInput;return e.log&&(d.commit_id||d.test_id||d.testcase_id)&&e.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:d.commit_id??null,test_id:d.test_id??null,testcase_id:d.testcase_id??null,project_id:d.project_id??null,session_id:d.session_id??null,session_name:d.session_name??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function Ir(t,e,r=ue){try{let n=await r(t);if(n.aborted.length>0||n.removed.length>0)try{e?.("info","EVIDENCE_RECOVERY","Startup evidence recovery swept incomplete packs",{aborted:n.aborted,removed:n.removed,origin:"startup"})}catch{}return n}catch(n){return console.warn("evidence: startup recovery failed",n),{aborted:[],removed:[]}}}import{promises as Ur}from"fs";import{existsSync as Te,mkdirSync as Vr,readdirSync as Br,readFileSync as zr,rmSync as Gr,statSync as Yr,writeFileSync as Hr}from"fs";import{join as O}from"path";import{mkdirSync as Er,renameSync as Rr,rmSync as Pr,writeFileSync as Ar}from"fs";import{join as Dt}from"path";var Dr=5e6;function $t(t,e,r){let n=Dt(t,"coverage","sources"),i=new Map,s=!1;try{for(let o of r.usecases)for(let a of o.sources){if(i.has(a.id)){a.file=i.get(a.id);continue}if(!a.cid)continue;let c=ft(e,a.cid);if(c===null||c.byteLength>Dr)continue;s||(Er(n,{recursive:!0}),s=!0);let l=Dt(n,a.id),p=`${l}.tmp-${process.pid}`;Ar(p,c),Rr(p,l);let d=`coverage/sources/${a.id}`;i.set(a.id,d),a.file=d}}catch{for(let o of r.usecases)for(let a of o.sources)delete a.file;if(s)try{Pr(n,{recursive:!0,force:!0})}catch{}}}import{existsSync as ee,readFileSync as F,renameSync as Fr,writeFileSync as Or}from"fs";import{dirname as Ne,isAbsolute as te,resolve as re}from"path";var $r=new Set(["inline","testmd","testrun"]),Cr=new Set(["inferred","authored","runtime-derived"]),je=new Set(["passed","failed","broken","skipped"]);function Ct(t,e,r){if(r.facts.length===0)return{record:null,errors:[{code:"EMPTY_EXECUTIONS",detail:"a run with no designed units attaches no facts \u2014 skip the call"}]};let n=e;for(let i=0;;i++){let s=U(t);if(n.latestHash!==s){if(i>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(n.latestHash)} but chain head is ${String(s)} \u2014 retry budget exhausted`}]};n=w(t);continue}let o=Lr(t,n,r);if(o!=="cas")return o;if(i>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:"concurrent appends kept moving the head \u2014 retry budget exhausted"}]};n=w(t)}}function Lr(t,e,r){let n=[],i=[];for(let o of r.facts){let a=`executions[${o.ref}]`,c=e.resolve(o.ref),l=c?e.tipOf(c.cid):null;if(!c||!l||e.superseded.has(l)){n.push({code:"UNKNOWN_REF",detail:`${a}: '${o.ref}' is not a live committed node`});continue}if(e.nodeLabel.get(l)!==le.TEST){n.push({code:"ILLEGAL_TARGET",detail:`${a}: execution facts attach to tests \u2014 '${o.ref}' is a ${e.nodeLabel.get(l)}`});continue}if(!$r.has(o.mode)){n.push({code:"BAD_MODE",detail:`${a}: mode '${o.mode}' not in inline|testmd|testrun`});continue}if(!je.has(o.verdict)){n.push({code:"BAD_VERDICT",detail:`${a}: verdict '${o.verdict}' not in ${[...je].join("|")}`});continue}if(!Cr.has(o.oracle_mode)){n.push({code:"BAD_ORACLE_MODE",detail:`${a}: oracle_mode '${o.oracle_mode}' not in inferred|authored|runtime-derived`});continue}if(typeof o.drift_flag!="boolean"||typeof o.stale_at_run!="boolean"){n.push({code:"MISSING_FIELD",detail:`${a}: drift_flag and stale_at_run are required booleans`});continue}if(!o.execution_id||!o.started_at||!o.definition_id_at_run){n.push({code:"MISSING_FIELD",detail:`${a}: execution_id, started_at and definition_id_at_run are required`});continue}let p=[];for(let d of o.per_ac??[]){let u=e.resolve(d.ac_ref),f=u?e.tipOf(u.cid):null;if(!u||!f||e.superseded.has(f)||e.nodeLabel.get(f)!==le.AC){n.push({code:"UNKNOWN_REF",detail:`${a}.per_ac: '${d.ac_ref}' is not a live AC`});continue}if(!je.has(d.verdict)){n.push({code:"BAD_VERDICT",detail:`${a}.per_ac['${d.ac_ref}']: verdict '${d.verdict}'`});continue}p.push({ac_ref:e.nameOf.get(f)??f,verdict:d.verdict})}i.push({about:l,definition_id_at_run:o.definition_id_at_run,verdict:o.verdict,...p.length?{per_ac:p}:{},drift_flag:o.drift_flag,oracle_mode:o.oracle_mode,stale_at_run:o.stale_at_run,...o.unresolved_acs?.length?{unresolved_acs:o.unresolved_acs}:{},execution_id:o.execution_id,...o.evidence_id?{evidence_id:o.evidence_id}:{},...o.duration_ms!==void 0?{duration_ms:o.duration_ms}:{},started_at:o.started_at,mode:o.mode,local:o.local,...o.via_parent?{via_parent:o.via_parent}:{}})}if(n.length>0)return{record:null,errors:n};let s;try{s=W(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:i,...r.eventIds&&r.eventIds.length>0?{event_ids:r.eventIds}:{},source_head_moves:{}},{expectPrev:e.latestHash})}catch(o){if(o instanceof ut)return"cas";throw o}return q(t),{record:s.record,errors:null}}function Mt(t){let e={failed:3,broken:2,skipped:1,passed:0},r=new Map;for(let n of t)for(let i of n.verifies??[]){let s=r.get(i);(s===void 0||(e[n.status]??0)>(e[s]??0))&&r.set(i,n.status)}return[...r.entries()].map(([n,i])=>({ref:n,verdict:i}))}function jt(t){let e=[],r=J(t.cwd);if(!ee(r))return{synced:0,superseded:0,skipped:"no-context",warnings:e};let n=t.by??{kind:"ai",id:"exec-sync"},i=w(r),s=[],o=0,a=new Set,c=new Set(t.members.map(d=>te(d.path)?d.path:re(t.cwd,d.path))),l=new Map;for(let d of t.members){let u=te(d.path)?d.path:re(t.cwd,d.path);for(let f of Mr(u)){if(a.has(f.path))continue;let y=f.path===u,_=!y&&c.has(f.path),b=y?void 0:D(F(u,"utf8"))?.id,G=F(f.path,"utf8"),x=D(G);if(!x?.id){a.add(f.path);continue}let ie=i.resolve(x.id),M=ie?i.tipOf(ie.cid):null;if(!ie||!M||i.superseded.has(M)){a.add(f.path),e.push(`sync: ${x.id} does not resolve to a live test \u2014 skipped (foreign store?)`);continue}let Y=A(V(G,K(Ne(f.path),i))),Kt=String(i.getNode(M)?.content.test_md_blob??""),H=A(V(Kt,st(i))),j=!1,oe=M;if(Y===H)x.base!==H&&Ot(f.path,G,H,e);else if(x.base===H){let g=Nr(r,i,M,G,Y,Ne(f.path),n);g.error?(e.push(`sync: could not supersede ${x.id}: ${g.error}`),j=!0):(o++,oe=g.newCid,j=g.oracleTier,Ot(f.path,F(f.path,"utf8"),Y,e),i=w(r))}else j=!0,e.push(x.base?`sync: ${x.id} was edited from an older version \u2014 graph kept; reconcile via a redesign or maintain`:`sync: ${x.id} carries no base pin (hand-copied file?) \u2014 fact attached with drift flag`);if(_){j&&l.set(f.path,!0);continue}a.add(f.path);let He=i.getNode(oe)?.content.check,Ke=y?d.acs??[]:[],Ue=Ke.filter(g=>Lt(i,g.ref)),We=Ke.filter(g=>!Lt(i,g.ref)).map(g=>g.ref);s.push({ref:x.id,definition_id_at_run:Y,verdict:d.verdict,...Ue.length?{per_ac:Ue.map(g=>({ac_ref:g.ref,verdict:g.verdict}))}:{},drift_flag:j||l.get(f.path)===!0||y&&d.driftFlag===!0,oracle_mode:He?.expected_mode??(nt(He?.operand)?"runtime-derived":"inferred"),stale_at_run:i.stale(oe)!=="fresh",...We.length?{unresolved_acs:We}:{},execution_id:d.executionId,...d.evidenceId?{evidence_id:d.evidenceId}:{},...d.durationMs!==void 0?{duration_ms:d.durationMs}:{},started_at:d.startedAt,mode:d.mode,local:d.local,...b?{via_parent:b}:{}})}}if(s.length===0)return{synced:0,superseded:o,warnings:e};let p=Ct(r,w(r),{facts:s,by:n});return p.errors?(e.push(...p.errors.map(d=>`sync facts: ${d.code}: ${d.detail}`)),{synced:0,superseded:o,warnings:e}):{synced:s.length,superseded:o,warnings:e}}function Mr(t){let e=[],r=new Set,n=i=>{if(r.has(i)||!ee(i))return;r.add(i);let s=F(i,"utf8");for(let o of s.split(`
|
|
5
|
+
`)){let a=/^@import\s+(\S+)\s*$/.exec(o.trim());if(!a)continue;let c=te(a[1])?a[1]:re(Ne(i),a[1]);ee(c)&&D(F(c,"utf8"))?.id&&n(c)}e.push({path:i})};return n(t),e}function Lt(t,e){let r=t.resolve(e),n=r?t.tipOf(r.cid):null;return!!(r&&n&&!t.superseded.has(n)&&t.nodeLabel.get(n)==="ac")}function jr(t,e,r){let n=t.split(`
|
|
6
|
+
`),i=ot(n);return n.map((s,o)=>{let a=it.exec(s.trim());if(!a||i.has(o))return s;let c=a[1];if(r.resolve(c))return s;let l=te(c)?c:re(e,c);if(!ee(l))return s;let p=D(F(l,"utf8"))?.id;return!p||!r.resolve(p)?s:`@import ${p}`}).join(`
|
|
7
|
+
`)}function Nr(t,e,r,n,i,s,o){let a=e.getNode(r);if(!a)return{oracleTier:!1,error:"tip unreadable"};let c=jr(at(n),s,e),l=String(a.content.test_md_blob??""),p=/^#\s+(.+?)\s*$/m.exec(c)?.[1]??String(a.content.title??""),d={...a.content,test_md_blob:c,definitionId:i,title:p},u=ct("test",d);if(u.length>0)return{oracleTier:!1,error:u.map(b=>b.detail).join("; ")};let f=dt("test",d);if(f===r)return{newCid:r,oracleTier:!1};let y=Ft(l)!==Ft(c),_=U(t);if(e.latestHash!==_)return{oracleTier:y,error:`store advanced under the sync (basis ${String(e.latestHash)} vs head ${String(_)}) \u2014 re-run to retry`};try{W(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:f,label:"test",content:d}],edges:[],review:[{id:f,kind:"review-item",resolution:"edited",edit:null,reason:"edited on disk (run sync)",by:o}],supersessions:[{kind:"node",old:r,new:f,reason:"edited on disk (run sync)",by:o}],source_head_moves:{}},{expectPrev:_})}catch(b){return{oracleTier:y,error:b instanceof Error?b.message:String(b)}}return q(t),{newCid:f,oracleTier:y}}var Tr=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function Ft(t){let e=[],r=t.split(`
|
|
8
|
+
`),n=!1;for(let i of r){if(/^##\s/.test(i)){n=/\bassert\b/i.test(i);let s=Tr.exec(i);s&&e.push(`v:${s[1].trim()}`);continue}n&&i.trim()!==""&&e.push(i.trim())}return e.join(`
|
|
9
|
+
`)}function Ot(t,e,r,n){try{let i=e.split(`
|
|
10
|
+
`),s=-1;if(i[0]?.trim()==="---"){for(let c=1;c<i.length;c++)if(i[c].trim()==="---"){s=c;break}}if(s<0)return;let o=!1;for(let c=1;c<s;c++){if(/^\s+base:\s*sha256:[0-9a-f]+\s*$/.test(i[c])){i[c]=i[c].replace(/sha256:[0-9a-f]+/,r),o=!0;break}if(/^assurance:\s*$/.test(i[c])&&!i.slice(c,Math.min(c+3,s)).some(l=>/^\s+base:/.test(l))){i.splice(c+2,0,` base: ${r}`),o=!0;break}}if(!o)return;let a=`${t}.tmp-sync`;Or(a,i.join(`
|
|
11
|
+
`)),Fr(a,t)}catch(i){n.push(`sync: pin refresh failed for ${t} (${i instanceof Error?i.message:String(i)}) \u2014 next run self-heals`)}}var Kr={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"},Nt=(t,e)=>{try{if(!Te(e))return{status:"skipped",reason:"no context store at the project root"};let r=O(t,"tests");if(!Te(r))return{status:"skipped",reason:"pack has no tests/"};let n=new Map;for(let a of Br(r)){let c=O(r,a,"result.yaml");if(!Te(c)||!Yr(O(r,a)).isDirectory())continue;let l=P(zr(c,"utf8"));if(!l?.definition_id&&!l?.assurance_id)continue;let p=Mt(l.steps??[]),d={testShortId:String(l.test??a),execution:Kr[String(l.status)]??"not-run",...p.length?{acs:p}:{}};l.assurance_id&&n.set(`id:${l.assurance_id}`,d),l.definition_id&&n.set(`def:${l.definition_id}`,d)}let i=pt(w(e),n,{scope:"run"}),s=lt(i);$t(t,e,i);let o=v({...i,rollup:s},{lineWidth:-1});return Vr(O(t,"coverage"),{recursive:!0}),Hr(O(t,"coverage","usecases.yaml"),o),{status:"written"}}catch(r){try{Gr(O(t,"coverage","sources"),{recursive:!0,force:!0})}catch{}return{status:"skipped",reason:r instanceof Error?r.message:String(r)}}};async function Wr(t){try{let e=new z({origin:"inline",runKind:"author",pid:t.pid,title:t.title,started:new Date().toISOString(),producerVersion:t.producerVersion,surfaces:t.surfaces,objectiveOrName:t.objectiveOrName,sessionId:t.sessionId,cwd:t.cwd,packRootDir:t.packRootDir}),r=await e.start();return{session:e,...r,packDir:e.pack,spawns:[],startedAtMs:Date.now(),cwd:t.cwd}}catch(e){return console.warn("evidence: inline pack creation failed",e),null}}function qr(t,e,r){if(!t)return;t.session.noteSpawn(e),e.resolution&&(t.resolution=e.resolution),t.runnerEnvironment=Ze(t.runnerEnvironment,e.runnerEnvironment);let n=(r?.per_flow_metadata??[]).map(i=>({resultCode:i?.result_code!=null?Number(i.result_code):null}));t.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function Jr(t){if(t)return{packTestDir:t.packTestDir,ordinalOffset:t.session.nextOrdinalOffset()}}async function Xr(t,e){if(!t)return null;if(t.finalized)return t.finalized;let r=(n,i,s)=>e.log?e.log("warn",n,i,s):console.warn(`evidence: ${i}`,s??"");try{if(e.recordedTestPath)try{await t.session.writeDefinition(await Ur.readFile(e.recordedTestPath,"utf8"))}catch(o){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(o)})}let n=e.cdpBrowserCapture?await e.cdpBrowserCapture():void 0,i=await t.session.writeResult({steps:t.session.steps,spawns:t.spawns.length?t.spawns:[{resultCode:null}],externalIdInput:{...e.externalIdInput,execution_id:t.executionId},runnerEnv:Me({cdpBrowser:n,resolution:t.resolution,runnerEnvironment:t.runnerEnvironment,deviceName:e.deviceName,deviceModel:e.deviceModel,pixelResolution:await It(t.packTestDir)}),intentEnv:et(e.model,t.runnerEnvironment),durationMs:e.durationMs??Date.now()-t.startedAtMs,log:e.log});try{if(e.recordedTestPath){let o=jt({cwd:e.cwd??t.cwd??process.cwd(),members:[{path:e.recordedTestPath,verdict:i,executionId:t.executionId,startedAt:new Date(t.startedAtMs).toISOString(),mode:"inline",local:e.local??!1}]});for(let a of o.warnings)r("EXEC_SYNC",a)}}catch(o){r("EXEC_SYNC","exec-sync failed",{error:String(o)})}try{let o=(e.coverageWriter??Nt)(t.packDir,J(e.cwd??t.cwd??process.cwd()));o.status==="skipped"&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${o.reason}`)}catch(o){r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(o)})}let s=await Oe({executionId:t.executionId,testId:t.testId,saved:e.saved,runKind:"author",verdict:i,cwd:e.cwd??t.cwd,packDir:t.packDir,tuiLogPath:e.tuiLogPath,log:e.log,surface:"inline",requireRealLog:!!t.runnerEnvironment?.native_platform,appiumMarks:t.session.appiumMarks});return t.finalized=s,e.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:t.executionId,verdict:i,valid:s.valid,pack:t.packDir,store_copy:s.storePath??null}),s}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as Zr,openSync as Qr,readSync as en,closeSync as tn}from"fs";import{basename as rn,resolve as nn}from"path";async function on(t,e,r={}){let n=r.out??(p=>process.stdout.write(p+`
|
|
12
|
+
`)),i=p=>(n(`error: ${p}`),2);if(e.env!=="prod"&&e.env!=="stage")return i(`invalid --env: ${String(e.env)}`);if(e.port!==void 0&&(!Number.isInteger(e.port)||e.port<1||e.port>65535))return i("invalid --port: expected an integer 1-65535");let s;try{s=B(e.env,e.viewerUrl),new URL(s)}catch{return i(`invalid --viewer-url: ${e.viewerUrl}`)}if(t.length===0)return i("no pack paths given");let o=new Map;for(let p of t){let d=nn(p),u;try{u=Zr(d)}catch{return i(`${p}: not found`)}if(u.isDirectory())return i(`${p}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!u.isFile())return i(`${p}: not a regular file`);let f=Buffer.alloc(2),y=Qr(d,"r");try{en(y,f,0,2,0)}finally{tn(y)}if(f.toString("latin1")!=="PK")return i(`${p}: not a sealed evidence pack (zip magic missing)`);let _=rn(d);if(o.has(_))return i(`duplicate pack basename: ${_} (URL names collide \u2014 rename one)`);o.set(_,d)}let a=r.log??((p,d,u)=>process.stderr.write(`warn: ${d} reason=${u.reason} path=${u.path}
|
|
13
|
+
`)),c;try{c=await pe({packs:o,allowedOrigins:[new URL(s).origin],port:e.port,log:a})}catch(p){return i(`could not bind 127.0.0.1${e.port?`:${e.port}`:""} \u2014 ${p.message}`)}n(`serving ${o.size} pack${o.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let p of o.keys()){let d=c.urlFor(p);n(p),n(` pack ${d}`),n(` viewer ${fe(d,s)}`)}return n("press Ctrl-C to stop"),await(r.hold??sn)(),await c.close(),0}function sn(){return new Promise(t=>{let e=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of e)process.on("SIGINT",r);t()})})}import{promises as ne}from"fs";import{tmpdir as un}from"os";import{join as Bt,resolve as Be}from"path";var an=["error","prefer_first","prefer_latest","discard"],cn=["external_id.commit_id","external_id.test_id"];function Tt(t){let e=t.replace(/-/g,"_");return an.includes(e)?e:null}function Vt(t){let e=t==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...cn],on_same:t??"nest",on_different:t?"error":"split"}};return v({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:e,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function Ve(t){try{if(!t.isTTY){t.log(me(t.packPath));return}let e=B(t.env);await(t.renderPrompt??dn)(t.packPath,e)}catch(e){try{t.log(`evidence view failed \u2014 ${e.message}`)}catch{}}}async function dn(t,e){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-FODRAS6Z.js");await new Promise(s=>{let o=n(r.default.createElement(i,{packPath:t,viewerBase:e,onDone:()=>{o.unmount(),s()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function ln(t,e,r=process.cwd(),n={}){let i=n.out??(u=>process.stdout.write(u+`
|
|
14
|
+
`)),s=n.err??(u=>process.stderr.write(u+`
|
|
15
|
+
`)),o=u=>(s(`evidence merge: ${u}`),2);if(!e.runId)return o("--run-id is required (merged identity is the caller's fact)");if(e.rules&&e.onCollision)return o("--rules and --on-collision are mutually exclusive");let a;if(e.onCollision!==void 0){let u=Tt(e.onCollision);if(!u)return o(`invalid --on-collision: ${e.onCollision} (expected error | prefer-first | prefer-latest | discard)`);a=u}let c=[];for(let u of t){let f=await pn(u,r);if(!f)return o(`no pack found for "${u}"`);c.push(f)}let l=e.out?Be(r,e.out):h(e.runId,r),p=null,d;e.rules?d=Be(r,e.rules):(p=await ne.mkdtemp(Bt(un(),"kane-merge-rules-")),d=Bt(p,"merge-rules.yaml"),await ne.writeFile(d,Vt(a)));try{let u=await(n.mergeFn??tt)(c,{runId:e.runId,out:l,rulesPath:d,title:e.title,finalize:e.finalize});return e.json?i(JSON.stringify(u)):fn(i,u),u.output.finalized&&!e.json&&await(n.offer??Ve)({packPath:l,env:e.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:s}),0}catch(u){let f=u instanceof Error?u.message:String(u);return u?.code==="ABORT"?(s(`evidence merge: aborted \u2014 ${f}`),1):o(f)}finally{p&&await ne.rm(p,{recursive:!0,force:!0}).catch(()=>{})}}async function pn(t,e){let r=Be(e,t);if(await zt(r))return r;let n=h(t,e);return await zt(n)?n:null}async function zt(t){try{return await ne.stat(t),!0}catch{return!1}}function fn(t,e){let{packs:r,tests:n,output:i}=e;t(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${i.path} (${i.finalized?"sealed":"live"})`);for(let s of r.skipped)t(` skipped ${s.runId}: ${s.rule} \u2014 ${s.reason}`);for(let s of n.collisions){let o;s.action==="nest"?o=`nested into ${s.folder}, latest ${s.winner}`:s.action==="split"?o=`split into ${s.folder}`:o=`winner ${s.winner}`,t(` collision ${s.test}: ${o} (${s.rule})`)}for(let s of n.discarded)t(` discarded ${s}`)}import{copyFileSync as mn,existsSync as ze,mkdirSync as gn}from"fs";import{join as Gt}from"path";function hn(t,e,r){try{let n=Gt(t,"auteur","execution.json");if(ze(n))return!0;for(let i of e)if(!(!i||!ze(i)))return gn(Gt(t,"auteur"),{recursive:!0}),mn(i,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:e.find(i=>i&&ze(i))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as vn}from"fs";import{join as yn}from"path";function Ye(t){let e=[],r=!0,n=s=>{if(s===null||typeof s!="object")return;let o=s;if(Array.isArray(o.operations))for(let a of o.operations){let c=a?.operation_id;typeof c=="string"&&c&&e.push(c)}if(Array.isArray(o.children)){o.content_type!=="generative_block"&&(r=!1);for(let a of o.children)n(a)}if(Array.isArray(o.branches)){r=!1;for(let a of o.branches){let c=a?.children;if(Array.isArray(c))for(let l of c)n(l)}}},i=t?.instructions;if(Array.isArray(i))for(let s of i)n(s);return{ids:e,linear:r}}function wn(t){return Ye(t).ids}function Ge(t,e){let r=new Set(e.map(a=>a.action_id).filter(Boolean)),n=-1;for(let a of r){let c=t.indexOf(a);c>n&&(n=c)}let i=e.reduce((a,c)=>Math.max(a,c.ordinal),0),s=new Set,o=[];for(let a of t.slice(n+1))r.has(a)||s.has(a)||(s.add(a),o.push({id:a,ordinal:++i,status:"skipped",action_id:a}));return o}function Yt(t,e){let r=new Set(e),n=t.filter(s=>s.action_id);if(n.some(s=>r.has(s.action_id))||n.length>e.length)return null;let i=0;return t.map(s=>s.action_id?{...s,action_id:e[i++]}:s)}function xn(t,e){if(t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(e[r]!==t[r].action_id)return!1;return!0}function _n(t,e,r,n=!0){if(e.length===0)return{steps:t,tail:[]};let i=(r&&n?Yt(t,e):null)??t,s=i.filter(a=>a.action_id),o=new Set(e);return s.length>0&&s.every(a=>o.has(a.action_id))?{steps:i,tail:Ge(e,i)}:s.length>0&&!xn(s,e)?{steps:i,tail:[],unjoined:!0}:{steps:i,tail:Ge(e,i)}}function Ht(t){try{let e=vn(yn(t,"auteur","execution.json"),"utf8");return Ye(JSON.parse(e))}catch{return{ids:[],linear:!0}}}function kn(t){return Ht(t).ids}export{C as a,ge as b,he as c,ve as d,ye as e,we as f,xe as g,qt as h,_e as i,ke as j,Jt as k,Xt as l,be as m,X as n,Ee as o,Re as p,Pe as q,Ae as r,Zt as s,Qt as t,De as u,er as v,$e as w,Ce as x,Le as y,_t as z,Oe as A,It as B,Me as C,Pt as D,wr as E,z as F,Ir as G,Mt as H,jt as I,Nt as J,Wr as K,qr as L,Jr as M,Xr as N,on as O,Vt as P,Ve as Q,ln as R,hn as S,Ye as T,wn as U,Ge as V,Yt as W,_n as X,Ht as Y,kn as Z};
|