@testmuai/kane-cli 0.6.10 → 0.7.0
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-PMEOJBZG.js +8 -0
- package/dist/{ChromeProfilePicker-IDKFTIHW.js → ChromeProfilePicker-DK2A3NYY.js} +1 -1
- package/dist/{CliFeedbackPrompt-SZOU5FGZ.js → CliFeedbackPrompt-D5QDOBE2.js} +1 -1
- package/dist/{CliUploadProgress-W2FC33Q4.js → CliUploadProgress-AIZL7N6Z.js} +1 -1
- package/dist/{ConfigView-JB2NSZ2N.js → ConfigView-SDBCTYUU.js} +1 -1
- package/dist/{EvidenceViewOffer-5YST67KY.js → EvidenceViewOffer-EOKJE2B6.js} +1 -1
- package/dist/{FolderPicker-SPNZESAR.js → FolderPicker-IVBHPPMW.js} +1 -1
- package/dist/{HelpView-XBDXXHFB.js → HelpView-YYYX4RKI.js} +1 -1
- package/dist/{InfoBox-2T7GYSFT.js → InfoBox-MQV3XBT4.js} +1 -1
- package/dist/{LinksBox-2NNZZDQT.js → LinksBox-NCFNBUMW.js} +1 -1
- package/dist/{ProfilesView-KJZVGU5B.js → ProfilesView-6GXF6CP2.js} +1 -1
- package/dist/{ProjectPicker-AUTZNEPE.js → ProjectPicker-W6XDGNDJ.js} +1 -1
- package/dist/{SaveSessionPrompt-LHLSJQSQ.js → SaveSessionPrompt-QF3P7ERS.js} +1 -1
- package/dist/SingleShotApp-T673X7BS.js +2 -0
- package/dist/{SummaryBox-5G7WULUN.js → SummaryBox-4SZI4XSO.js} +1 -1
- package/dist/TestMdRunView-SNYEO6CS.js +2 -0
- package/dist/{WhoamiView-XNWBDMQR.js → WhoamiView-N3HAJ3TN.js} +1 -1
- package/dist/auth-RXNBQZI2.js +2 -0
- package/dist/{bind-FEOGBJ2O.js → bind-NSGW5BBZ.js} +2 -2
- package/dist/{bootstrap-T6DSUI34.js → bootstrap-RPT3JOGD.js} +1 -1
- package/dist/{bridge-WMGH3O3B.js → bridge-BTSWCJ3B.js} +1 -1
- package/dist/{changelog-AGFDNTTW.js → changelog-MI3IPBJS.js} +1 -1
- package/dist/{chat-committer-4ENYH3RC.js → chat-committer-OS7ULZMH.js} +1 -1
- package/dist/chat-controller-QLORQWJZ.js +2 -0
- package/dist/{chunk-JHPZXF77.js → chunk-3CJIMPQK.js} +2 -2
- package/dist/{chunk-SKRZN25J.js → chunk-3RZ63RBO.js} +1 -1
- package/dist/{chunk-YOFKDRY4.js → chunk-44IWSV6L.js} +1 -1
- package/dist/{chunk-7LWXIRI3.js → chunk-4BAMZSFU.js} +1 -1
- package/dist/{chunk-TW3K2DKB.js → chunk-4GLYNAK7.js} +1 -1
- package/dist/{chunk-7APDXIKI.js → chunk-4SJC64KQ.js} +9 -9
- package/dist/{chunk-5Z7GAIPP.js → chunk-4XSW6WZD.js} +2 -2
- package/dist/{chunk-6NWPK2MS.js → chunk-5WE4DHXL.js} +1 -1
- package/dist/chunk-5YHVK2EO.js +6 -0
- package/dist/{chunk-TLL7KFLY.js → chunk-67SSEGDO.js} +1 -1
- package/dist/{chunk-L4JIMNKW.js → chunk-6HYW5RFX.js} +1 -1
- package/dist/{chunk-A46NBRAP.js → chunk-6W6AIDLJ.js} +1 -1
- package/dist/{chunk-VYQMCLKG.js → chunk-77WMTCUQ.js} +1 -1
- package/dist/{chunk-SDRFTIRU.js → chunk-7E24OCGX.js} +1 -1
- package/dist/chunk-7YPK6EDR.js +4 -0
- package/dist/{chunk-RH4GCEFX.js → chunk-A2IQRVPR.js} +1 -1
- package/dist/{chunk-YVXC46DY.js → chunk-AIMINJVP.js} +1 -1
- package/dist/{chunk-C3OGWCII.js → chunk-AV6E6WLY.js} +2 -2
- package/dist/{chunk-5LTUYXMP.js → chunk-AYY7RYMK.js} +1 -1
- package/dist/chunk-B4LLKQTK.js +2 -0
- package/dist/{chunk-FYDBD7Q4.js → chunk-BCH3JCND.js} +1 -1
- package/dist/{chunk-SACSQY3Q.js → chunk-CH3VWCRZ.js} +1 -1
- package/dist/{chunk-WSZ7IENQ.js → chunk-CSGQIY7X.js} +3 -3
- package/dist/{chunk-QGBLC4ZJ.js → chunk-DFDDUMG5.js} +1 -1
- package/dist/{chunk-JTCW76YG.js → chunk-DGIPQINV.js} +1 -1
- package/dist/chunk-E5PWL3BG.js +7 -0
- package/dist/{chunk-6MTVGARW.js → chunk-EN7NW7DU.js} +1 -1
- package/dist/{chunk-QPT4ERGK.js → chunk-F7WKDMX7.js} +1 -1
- package/dist/{chunk-7Z64BL5D.js → chunk-FCHTL74E.js} +1 -1
- package/dist/{chunk-OSALXGD4.js → chunk-FMR2KPSK.js} +1 -1
- package/dist/{chunk-RGDQMKNJ.js → chunk-FRBYGSGJ.js} +1 -1
- package/dist/{chunk-KA7Q5IIC.js → chunk-GQ3NCBYR.js} +1 -1
- package/dist/{chunk-XZW3TBOV.js → chunk-HOOXUO3X.js} +1 -1
- package/dist/{chunk-7C6G4V43.js → chunk-IQODWB32.js} +1 -1
- package/dist/{chunk-MBXWXBDM.js → chunk-J2KSZUOO.js} +1 -1
- package/dist/{chunk-W54W762O.js → chunk-J3EMJ7US.js} +1 -1
- package/dist/{chunk-ZFFRHV5U.js → chunk-JSF5JYZC.js} +1 -1
- package/dist/{chunk-MSK7AC4E.js → chunk-K4VIM4RM.js} +2 -2
- package/dist/{chunk-2H3XNXL3.js → chunk-KCBS57IF.js} +1 -1
- package/dist/chunk-KHQHVSZ6.js +5 -0
- package/dist/{chunk-DHF3VO2R.js → chunk-LGVHW4ZA.js} +1 -1
- package/dist/{chunk-KK7DYHK6.js → chunk-MAO5BAQI.js} +1 -1
- package/dist/{chunk-6CGNLFSN.js → chunk-MTHCUBDF.js} +1 -1
- package/dist/{chunk-3KN2UW37.js → chunk-MV4UYTZT.js} +1 -1
- package/dist/{chunk-Z25FKS3Y.js → chunk-N4LMQR7C.js} +1 -1
- package/dist/{chunk-5F7PU5AJ.js → chunk-NR23HZU4.js} +1 -1
- package/dist/chunk-QBCS57EO.js +62 -0
- package/dist/{chunk-J4WS2SXT.js → chunk-QQUZF2DZ.js} +1 -1
- package/dist/{chunk-WV42KKEU.js → chunk-RCTM7NGT.js} +1 -1
- package/dist/{chunk-76I6NJBX.js → chunk-RODHDQU3.js} +1 -1
- package/dist/{chunk-AYDUHTPA.js → chunk-RQYS3KGU.js} +1 -1
- package/dist/{chunk-MJF3USZF.js → chunk-SBZWFULF.js} +2 -2
- package/dist/{chunk-6JTEWZ75.js → chunk-T7ZPMTGS.js} +1 -1
- package/dist/chunk-TDPWFYTJ.js +2 -0
- package/dist/{chunk-OESHJ4J2.js → chunk-UXPQRALY.js} +2 -2
- package/dist/chunk-V3UE6RJP.js +2 -0
- package/dist/chunk-VJFFMOUA.js +2 -0
- package/dist/{chunk-GWJ76BLF.js → chunk-VYMCE7UR.js} +2 -2
- package/dist/{chunk-YJIESLN6.js → chunk-WREVEATJ.js} +1 -1
- package/dist/{chunk-XY5KWIRF.js → chunk-WTXHOWUP.js} +1 -1
- package/dist/{chunk-LPBAQQ7E.js → chunk-X5P2T7MA.js} +1 -1
- package/dist/{chunk-6ZJ7ZFEX.js → chunk-XIXR63FI.js} +1 -1
- package/dist/{chunk-ECFOND7B.js → chunk-XLKRV2JH.js} +1 -1
- package/dist/{chunk-FEF75YKV.js → chunk-YHQFYZJ5.js} +1 -1
- package/dist/chunk-Z2JSEL3I.js +4 -0
- package/dist/{config-7WI6TBDV.js → config-5GOFF5F4.js} +1 -1
- package/dist/{cover-cmd-J2ZJUL6P.js → cover-cmd-SV3I23UM.js} +1 -1
- package/dist/{credentials-MX5ABDPF.js → credentials-GXDXVMXW.js} +1 -1
- package/dist/docx-convert-ZBVQO2LG.js +2 -0
- package/dist/{dossier-UVTGCL7T.js → dossier-KJSJPWOW.js} +1 -1
- package/dist/{evidence-TZYIOSPG.js → evidence-VDNZ3K23.js} +1 -1
- package/dist/{evolve-cmd-IDS5ZIUY.js → evolve-cmd-BLSVVW4I.js} +1 -1
- package/dist/{explain-VTRHEVUQ.js → explain-EBVIUS2X.js} +1 -1
- package/dist/{explain-cmd-NPKN63XL.js → explain-cmd-DBUTPZHA.js} +1 -1
- package/dist/{explain-cmd-R3WCNR2A.js → explain-cmd-NWIYH5MI.js} +1 -1
- package/dist/{extract-bind-CISTQFI3.js → extract-bind-3SWPBZX6.js} +3 -3
- package/dist/{extract-cmd-HG3DHHSL.js → extract-cmd-HEX7F4IS.js} +1 -1
- package/dist/{gaps-cmd-XLVUFSTY.js → gaps-cmd-CKCHH3HQ.js} +1 -1
- package/dist/{generate-headless-4VJMAHCU.js → generate-headless-LZ4HRSQ4.js} +2 -2
- package/dist/index.js +52 -52
- package/dist/ingest-FIIO67ZN.js +2 -0
- package/dist/ingest-cmd-KRPZVB7W.js +7 -0
- package/dist/{interactive-bind-IXFRXBBL.js → interactive-bind-PTAZVCE7.js} +3 -3
- package/dist/{lifecycle-cmd-VTFZ3TF2.js → lifecycle-cmd-32LG364Q.js} +1 -1
- package/dist/{list-cmd-KXL4WQII.js → list-cmd-UTZ2PQUK.js} +1 -1
- package/dist/{list-commands-BJYJ34HT.js → list-commands-WIVODSEL.js} +1 -1
- package/dist/{logical-ids-LMBNMENR.js → logical-ids-I7B3VJEH.js} +1 -1
- package/dist/login-flow-GX7CTVWN.js +2 -0
- package/dist/{maintenance-cmd-UJG4LPWD.js → maintenance-cmd-BZAGSYGI.js} +1 -1
- package/dist/{persist-recorded-session-QR7RVAXR.js → persist-recorded-session-J6Z2SCTT.js} +1 -1
- package/dist/pipeline-HT7FCEXA.js +2 -0
- package/dist/readmodel-S5RAQH3F.js +2 -0
- package/dist/{reconcile-cmd-E2MMQM7Z.js → reconcile-cmd-2VHBKFA5.js} +1 -1
- package/dist/{recording-banner-QAIKLV6E.js → recording-banner-IRFMIZSJ.js} +1 -1
- package/dist/{require-project-folder-OANMHOVE.js → require-project-folder-XSBJGIVF.js} +1 -1
- package/dist/{revert-FRXNIP5R.js → revert-RQJE56HF.js} +1 -1
- package/dist/{review-cmd-2FCGP55U.js → review-cmd-7LXGYHHQ.js} +1 -1
- package/dist/run-4LTYFTF2.js +2 -0
- package/dist/run-YGJZ2SXX.js +2 -0
- package/dist/{run-test-md-5E53A5DT.js → run-test-md-QCERS7FQ.js} +2 -2
- package/dist/{skill-installer-LGEIIQ4Q.js → skill-installer-WAVEVCSG.js} +1 -1
- package/dist/{spawner-6FHAXNOA.js → spawner-YNYB4Z7K.js} +1 -1
- package/dist/tcg-generate-D35EMRMQ.js +2 -0
- package/dist/{testmd-actions-2OFH5GRJ.js → testmd-actions-NB5Z6QJ3.js} +1 -1
- package/dist/token-refresh-OY3WLAKD.js +2 -0
- package/dist/{validate-basic-Z46MAH2G.js → validate-basic-IJKKRQRU.js} +1 -1
- package/dist/{version-check-64M5JQQ7.js → version-check-O5GYZYTP.js} +1 -1
- package/dist/{view-cmd-PG66UQK7.js → view-cmd-GQBFCPDL.js} +1 -1
- package/dist/{walk-session-7PM2RXEF.js → walk-session-OPAEV4WR.js} +1 -1
- package/package.json +6 -6
- package/dist/ChatSurface-PLXUGRBV.js +0 -8
- package/dist/SingleShotApp-Z2HGSZXG.js +0 -2
- package/dist/TestMdRunView-B4IZHRDT.js +0 -2
- package/dist/chat-controller-M4QYRH7Y.js +0 -2
- package/dist/chunk-26H3PDVN.js +0 -4
- package/dist/chunk-2KS2YRIS.js +0 -2
- package/dist/chunk-2OQLMW3F.js +0 -7
- package/dist/chunk-4OSW2WEN.js +0 -61
- package/dist/chunk-GLS46X7N.js +0 -5
- package/dist/chunk-JHHMXU76.js +0 -2
- package/dist/chunk-KFUZYEHX.js +0 -2
- package/dist/chunk-RLZA4VJT.js +0 -4
- package/dist/chunk-ZPENY2Q3.js +0 -4
- package/dist/docx-convert-IAX54REO.js +0 -2
- package/dist/ingest-UAIKHOB4.js +0 -2
- package/dist/ingest-cmd-7HJLRLMG.js +0 -4
- package/dist/login-flow-KW5T7WRJ.js +0 -2
- package/dist/pipeline-L6V24KGN.js +0 -2
- package/dist/readmodel-AGAPK2AI.js +0 -2
- package/dist/run-FYJZCWYS.js +0 -2
- package/dist/run-IOBBB7GN.js +0 -2
- package/dist/tcg-generate-CEDA6DZJ.js +0 -2
- package/dist/token-refresh-R75DGT4X.js +0 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as Lt,b as ae,c as Ot,d as Je}from"./chunk-VJFFMOUA.js";import{a as _t}from"./chunk-IQODWB32.js";import{a as Ae}from"./chunk-7YPK6EDR.js";import{b as Dt,c as Mt}from"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import{a as Bt,b as At,c as Et}from"./chunk-67SSEGDO.js";import{a as St}from"./chunk-5Y2G4NC7.js";import"./chunk-NVGBE2DR.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import{a as Ct}from"./chunk-YCCUBQY4.js";import{a as It}from"./chunk-5WE4DHXL.js";import{b as Rt}from"./chunk-DFS4RMVP.js";import{y as r}from"./chunk-B4LLKQTK.js";import{a as V}from"./chunk-HCBYKLMW.js";import{a as S,b as n,k as Be}from"./chunk-C44QQJR4.js";import{a as Cn}from"./chunk-6YGTRKDT.js";import{e as U}from"./chunk-UR6MHSHU.js";var k=U(Cn(),1);var c=U(V(),1),Bn=60,An=100;function Ye(e,s){let i=e.options.length,a=i,d=e.multi_select?a++:null,g=e.allow_free_text?a++:null,u=s?a++:null;return{optionCount:i,doneIdx:d,freeIdx:g,batchIdx:u,maxSel:a-1}}var En="\xA0",Dn={high:{text:`\u203C${En}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function Mn(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Ln(e,s,i){let a=m=>e[m].length+6,d=a(s),g=s,u=s;for(;;){let m=u+1<e.length?a(u+1):1/0,h=g-1>=0?a(g-1):1/0;if(m===1/0&&h===1/0)break;if(m<=h){if(d+m>i)break;d+=m,u+=1}else{if(d+h>i)break;d+=h,g-=1}}return{lo:g,hi:u}}function Pt({batch:e,qView:s,sel:i=0,focused:a=!1,freeText:d=null,multiSelFor:g}){let{stdout:u}=Be(),m=u?.columns??80,h=m<Bn,I=Math.min(m-1,An),f=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),p=e.questions[f],L=e.resolution[f],A=e.resolution.filter(F=>!F).length,w=e.questions.length-A,R=Ae(e),C=Ye(p,R!==""),v=g?g(f):[],E=Dn[p.risk],x=F=>a&&i===F?(0,c.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",N=`? the agent needs ${A===1?"one answer":`${A} answers`}`,_=e.questions.length>1?` \xB7 ${f+1} of ${e.questions.length} \xB7 ${w} answered`:"",q=(0,c.jsxs)(S,{flexDirection:"column",children:[(0,c.jsx)(S,{paddingLeft:2,children:(0,c.jsxs)(n,{bold:!0,children:[p.text,E?(0,c.jsx)(n,{color:E.color,bold:!1,children:` ${E.text}`}):null]})}),(0,c.jsx)(S,{paddingLeft:2,children:(0,c.jsx)(n,{color:r.dim,children:p.rationale})}),(0,c.jsx)(n,{children:" "}),p.options.map((F,O)=>{let H=a&&i===O;return(0,c.jsxs)(S,{flexDirection:"column",children:[(0,c.jsxs)(n,{children:[x(O)," ",p.multi_select?(0,c.jsx)(n,{color:v.includes(O)?r.green:r.dim,children:v.includes(O)?"[x] ":"[ ] "}):null,(0,c.jsx)(n,{color:H?r.assuranceAccent:void 0,children:`${O+1}. ${F.label}`}),O===p.recommended_index?(0,c.jsx)(n,{color:r.dim,children:" (recommended)"}):null,L?.selected_index===O?(0,c.jsx)(n,{color:r.dim,children:" (current)"}):null]}),F.detail?(0,c.jsx)(S,{paddingLeft:5,children:(0,c.jsx)(n,{color:r.dim,children:F.detail})}):null]},`o-${O}`)}),p.multi_select&&C.doneIdx!=null?(0,c.jsxs)(n,{children:[x(C.doneIdx)," ",(0,c.jsx)(n,{color:r.green,children:"\u2714"}),(0,c.jsx)(n,{color:a&&i===C.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,p.allow_free_text?(0,c.jsx)(n,{children:" "}):null,p.allow_free_text?d?(0,c.jsxs)(S,{children:[(0,c.jsxs)(n,{children:[(0,c.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,c.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,c.jsx)(Ct,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"Tell me what to do"})]}):(0,c.jsxs)(n,{children:[C.freeIdx!=null?x(C.freeIdx):" "," ",(0,c.jsx)(n,{color:a&&C.freeIdx!=null&&i===C.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null]}),de=R!==""?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n,{children:" "}),(0,c.jsxs)(n,{children:[a&&C.batchIdx!=null&&i===C.batchIdx?(0,c.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,c.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,c.jsx)(n,{bold:!0,color:a&&C.batchIdx!=null&&i===C.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),A>=5?(0,c.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${A} open`}):null,(0,c.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(h)return(0,c.jsxs)(S,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,c.jsx)(n,{color:r.assuranceAccent,bold:!0,children:N}),e.questions.length>1?(0,c.jsx)(n,{color:r.dim,children:_.replace(/^ · /,"")}):null,(0,c.jsx)(n,{children:" "}),q,de,(0,c.jsx)(S,{paddingLeft:2,children:(0,c.jsx)(n,{color:r.muted,children:"\u2191\u2193 \u23CE \xB7 \u2190 \u2192 questions \xB7 esc back"})})]});let _e=`\u2500\u2500 ${N}${_} `,Oe=Math.max(2,I-_e.length),me="\u2191\u2193 select \xB7 \u23CE confirm \xB7 \u2190 \u2192 questions \xB7 type = your words \xB7 esc back",ge=`\u2500\u2500 ${me} `,te=Math.max(2,I-ge.length),K=e.questions.map(F=>Mn(F)),D=e.questions.length>1?Ln(K,f,I-8):null;return(0,c.jsxs)(S,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,c.jsxs)(n,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,c.jsx)(n,{bold:!0,children:N}),_?(0,c.jsx)(n,{color:r.dim,children:_}):null,` ${"\u2500".repeat(Oe)}`]}),D?(0,c.jsx)(S,{marginTop:1,children:(0,c.jsxs)(n,{children:[D.lo>0?(0,c.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",e.questions.slice(D.lo,D.hi+1).map((F,O)=>{let H=D.lo+O,we=O>0?" ":"";return H===f?(0,c.jsxs)(n,{children:[we,(0,c.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${K[H]} `})]},F.id):(0,c.jsxs)(n,{children:[we,e.resolution[H]?(0,c.jsxs)(n,{children:[(0,c.jsx)(n,{color:r.green,children:"\u2713 "}),(0,c.jsx)(n,{color:r.dim,children:K[H]})]}):(0,c.jsx)(n,{color:r.dim,children:`\u25CB ${K[H]}`})]},F.id)}),D.hi<e.questions.length-1?(0,c.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,c.jsx)(n,{children:" "}),q,de,(0,c.jsx)(n,{children:" "}),(0,c.jsxs)(n,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,c.jsx)(n,{color:r.muted,children:me}),` ${"\u2500".repeat(te)}`]})]})}var M=U(V(),1),qt={high:0,med:1,low:2},_n={high:r.red,med:"yellow",low:r.dim};function On(e){return e.map((s,i)=>({r:s,i})).sort((s,i)=>(qt[s.r.risk??"zz"]??3)-(qt[i.r.risk??"zz"]??3)||s.i-i.i).map(({r:s})=>s)}var ne=(e,s)=>e.length<=s?e:s<=1?"\u2026":`${e.slice(0,s-1)}\u2026`,Ee=(e,s)=>e+" ".repeat(Math.max(0,s-e.length));function Ft({rows:e,width:s=120,badgeHeader:i="risk"}){if(e.length===0)return null;let a=On(e),d=v=>v.staged||!v.id?"(staged)":_t(v.id),g=Math.max(2,...a.map(v=>d(v).length)),u=Math.max(i.length,...a.map(v=>(v.badge??"").length)),m=s>=96&&a.some(v=>v.summary),I=s-(m?13:10)-g-u,f=Math.max(...a.map(v=>Math.max(v.title.length,(v.marker??"").length)),5),p=Math.max(5,m?Math.min(f,Math.max(16,Math.floor(I*.5))):Math.min(f,I)),L=m?Math.max(7,I-p):0,A=(v,E,x,N)=>v+N.map(_=>`\u2500${"\u2500".repeat(_.length)}\u2500`).join(E)+x,w=(v,E,x,N)=>[Ee(ne(v,g),g),Ee(ne(E,p),p),Ee(ne(x,u),u),...m?[Ee(ne(N,L),L)]:[]],R=w("id","title",i,"summary"),C=[];C.push((0,M.jsx)(n,{color:r.dim,children:A("\u250C","\u252C","\u2510",R)},"t")),C.push((0,M.jsxs)(n,{children:[R.map((v,E)=>(0,M.jsxs)(n,{children:[(0,M.jsx)(n,{color:r.dim,children:E===0?"\u2502 ":" \u2502 "}),(0,M.jsx)(n,{bold:!0,children:v})]},E)),(0,M.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),C.push((0,M.jsx)(n,{color:r.dim,children:A("\u251C","\u253C","\u2524",R)},"m"));for(let[v,E]of a.entries()){let x=w(d(E),ne(E.title,p),ne(E.badge??"",u),ne(E.summary??"",L)),N=E.badgeColor??_n[E.badge??""]??r.dim;if(C.push((0,M.jsxs)(n,{children:[(0,M.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,M.jsx)(n,{color:r.assuranceAccent,children:x[0]}),(0,M.jsx)(n,{color:r.dim,children:" \u2502 "}),x[1],(0,M.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,M.jsx)(n,{color:N,children:x[2]}),m?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(n,{color:r.dim,children:" \u2502 "}),x[3]]}):null,(0,M.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${v}`)),E.marker){let _=w("",ne(E.marker,p),"","");C.push((0,M.jsx)(n,{color:r.dim,children:`\u2502 ${_.join(" \u2502 ")} \u2502`},`mk-${v}`))}}return C.push((0,M.jsx)(n,{color:r.dim,children:A("\u2514","\u2534","\u2518",R)},"b")),(0,M.jsx)(M.Fragment,{children:C})}var Pn={"use-case":"use-cases",ac:"ACs",scenario:"scenarios",test:"tests",gap:"gaps"},ee=e=>Pn[e]??`${e}s`,Nt=e=>e==="ac"?"AC":e==="use-case"?"use-case":e,Ze=e=>e.kind??"use-case",Wt=e=>`${Ze(e)}:${e.temp_ref}`;function jt(e){let s=e,i=s.badge??e.risk??null,a=s.why??e.summary??e.description??null;return JSON.stringify([e.title,i,a,s.extra??null,e.depends_on_hint??null])}function Ut(e){return e.filter(s=>s.role==="agent"&&typeof s.turnIndex=="number"&&Array.isArray(s.items)&&s.items.length>0)}function se(e){let s=new Map,i=1;for(let g of Ut(e)){let u=new Set;for(let m of g.items){let h=Wt(m);if(u.has(h))continue;u.add(h);let I=s.get(h);s.set(h,{num:I?.num??i++,ref:m.temp_ref,kind:Ze(m),item:m,turnIndex:g.turnIndex,fingerprint:jt(m)})}}let a=[...s.values()].sort((g,u)=>g.num-u.num),d=[];for(let g of a){let u=d.find(m=>m.kind===g.kind);u?u.count++:d.push({kind:g.kind,label:ee(g.kind),count:1})}return{entries:a,byRef:s,counts:d}}function Vt(e,s){let a=Ut(e).find(w=>w.turnIndex===s);if(!a)return null;let d=e.filter(w=>w.role!=="agent"||typeof w.turnIndex!="number"||w.turnIndex<=s),g=se(d),u=se(e.filter(w=>w.role!=="agent"||typeof w.turnIndex!="number"||w.turnIndex<s)),m=[],h=new Map,I=new Map,f=new Map,p=new Set;for(let w of a.items){let R=Wt(w);if(p.has(R))continue;p.add(R);let C=u.byRef.get(R),v=w.changed===!0,E=g.byRef.get(R).num,x=Ze(w);if(C&&!v&&C.fingerprint===jt(w)){h.set(x,(h.get(x)??0)+1);continue}let N=!!C||v,_=N?f:I;_.set(x,(_.get(x)??0)+1),m.push({item:w,num:E,updated:N})}let L=[...h.entries()].map(([w,R])=>({label:ee(w),count:R})),A=[...[...I.entries()].map(([w,R])=>`${R} new ${R===1?Nt(w):ee(w)}`),...[...f.entries()].map(([w,R])=>`${R} updated ${R===1?Nt(w):ee(w)}`)].join(" \xB7 ");return{fresh:m,unchanged:L,headerStats:A}}function et(e,s){let i=e.entries.filter(g=>g.turnIndex===s);if(i.length===0)return e;let a=new Map(i.map(g=>[g.ref,g])),d=[];for(let g of i){let u=d.find(m=>m.kind===g.kind);u?u.count+=1:d.push({kind:g.kind,label:ee(g.kind),count:1})}return{entries:i,byRef:a,counts:d}}var b=U(V(),1);function qn(e){let s=e.form==="assumed"?" (flagged)":e.form==="deferred"?"":" (you)",i=e.note?` \u2014 ${e.note}`:"";return e.form==="deferred"?`\u21B3 deferred q${e.qNum} ${e.stub}${i}`:e.form==="changed"?`\u21B3 changed q${e.qNum} ${e.stub}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${s}${i}`:`\u21B3 ${e.form} q${e.qNum} ${e.stub}: ${e.choice??"?"}${s}${i}`}var Fn=Math.min(process.stdout?.columns??100,120)-2;function Kt({block:e,annotations:s}){switch(e.kind){case"banner":return(0,b.jsx)(S,{marginTop:1,children:(0,b.jsx)(n,{color:r.dim,children:` \u2500\u2500 ${e.text} \u2500\u2500`})});case"user":return(0,b.jsxs)(S,{marginTop:1,children:[(0,b.jsx)(n,{color:r.orange,children:"\u276F "}),(0,b.jsx)(n,{children:e.text})]});case"note":return(0,b.jsx)(n,{color:r.dim,children:` ${e.text}`});case"agent":return(0,b.jsx)(S,{marginTop:1,children:(0,b.jsx)(At,{text:e.text,accent:r.assuranceAccent})});case"thinking":return(0,b.jsx)(S,{marginTop:1,children:(0,b.jsx)(n,{color:r.dim,children:` thought for ${(e.tookMs/1e3).toFixed(1)}s`})});case"tool":return(0,b.jsx)(n,{color:r.dim,children:` ${Dt({name:e.name,status:e.status==="ok"?"done":e.status,detail:e.detail})}`});case"usage":return(0,b.jsx)(n,{color:r.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let i=s??null,a=i?i.fresh:e.items.map((f,p)=>({item:f,num:p+1,updated:!1})),d={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},g=f=>f.kind??"use-case",u=new Map;for(let f of a){let p=f.item,L=g(f.item),A=p.risk==="high"||p.risk==="med"||p.risk==="low"?p.risk:void 0,w={id:p.logical_id??"",staged:!p.logical_id,title:p.title,badge:p.badge??p.risk??"",summary:p.why??p.summary??p.description??"",...A?{risk:A}:{},...f.updated?{marker:"\u21B3 changed"}:{}},R=u.get(L)??[];R.push(w),u.set(L,R)}let m=a.some(f=>!!f.item.kind),h=(i?.unchanged??[]).reduce((f,p)=>f+p.count,0),I=i?.headerStats?` \u2014 ${i.headerStats}${h>0?` (${h} unchanged)`:""}`:"";return(0,b.jsxs)(S,{flexDirection:"column",marginLeft:2,children:[(0,b.jsxs)(n,{bold:!0,children:[m?"design":e.heading,I?(0,b.jsx)(n,{bold:!1,color:r.dim,children:I}):null]}),[...u.entries()].map(([f,p])=>(0,b.jsxs)(S,{flexDirection:"column",children:[u.size>1?(0,b.jsx)(n,{color:r.dim,children:`${ee(f)} \xB7 ${p.length}`}):null,(0,b.jsx)(Ft,{rows:p,width:Fn,badgeHeader:d[f]??"info"})]},f)),i&&i.unchanged.length>0&&(0,b.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${i.unchanged.map(f=>`${f.count} ${f.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,b.jsx)(n,{color:r.dim,children:qn(e.receipt)});case"continued":return(0,b.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"commit":return(0,b.jsxs)(S,{flexDirection:"column",children:[(0,b.jsx)(n,{color:e.ok?r.green:r.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),(e.warnings??[]).map((i,a)=>(0,b.jsx)(n,{color:r.dim,children:` \u26A0 ${i}`},`w-${a}`))]});case"error":return(0,b.jsxs)(It,{variant:"error",paddingX:1,children:[(0,b.jsx)(n,{color:r.red,children:e.title}),e.detail.map((i,a)=>(0,b.jsx)(n,{color:r.dim,children:i},`d-${a}`))]});case"interrupted":return(0,b.jsxs)(S,{flexDirection:"column",children:[(0,b.jsx)(n,{color:r.red,children:"interrupted \u2014 session not saved"}),e.detail?(0,b.jsx)(n,{color:r.dim,children:e.detail}):null]});case"pause":return(0,b.jsxs)(S,{flexDirection:"column",children:[(0,b.jsx)(n,{children:`paused: session ${e.sid} saved`}),e.expires_at?(0,b.jsx)(n,{color:r.dim,children:`expires: ${e.expires_at}`}):null,(0,b.jsx)(n,{children:`resume: ${e.resume}`}),e.messageForm?(0,b.jsx)(n,{children:`or say something on the way in: ${e.messageForm}`}):null]});case"summary":return(0,b.jsxs)(S,{flexDirection:"column",children:[(0,b.jsx)(n,{bold:!0,children:"session summary"}),e.lines.map((i,a)=>(0,b.jsx)(n,{children:` ${i}`},`s-${a}`))]})}}var ue=U(V(),1);function Qt({item:e}){return(0,ue.jsxs)(S,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,i)=>(0,ue.jsx)(n,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${i}`)),(e.depends_on_hint??[]).length>0&&(0,ue.jsx)(n,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,i])=>(0,ue.jsx)(n,{dimColor:!0,children:`${s}: ${i}`},`extra-${s}`))]})}var $=U(V(),1),tt=(e,s)=>Math.max(0,Math.min(s,e));function Me(e,s,i){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:tt(e.cursor+s.delta,Math.max(0,i-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Xt={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function zt(e,s){if(e.level==="detail")return{level:"detail",cursor:tt(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let i=s.entries.findIndex(a=>Xt[a.kind]===e.section);if(i>=0)return{level:"list",cursor:i}}return{level:"list",cursor:0}}function Nn(e){let s=[];for(let i of e.entries){let a=s.find(d=>d.kind===i.kind);a?a.entries.push(i):s.push({kind:i.kind,entries:[i]})}return s}var Ht=3;function Wn({items:e,cursor:s,verb:i,more:a}){let d=`view \xB7 ${i} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,g=e.entries[s];return(0,$.jsxs)(S,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,$.jsx)(n,{bold:!0,children:d}),Nn(e).map(({kind:u,entries:m})=>{let h=g?.kind===u,I=h?m.findIndex(A=>A.ref===g.ref):-1,f=h?tt(I-1,Math.max(0,m.length-Ht)):0,p=m.slice(f,f+(h?Ht:1)),L=m.length-p.length;return(0,$.jsxs)(S,{flexDirection:"column",children:[(0,$.jsx)(n,{color:r.dim,children:`${Xt[u]??ee(u)} \xB7 ${m.length}`}),p.map(A=>{let w=h&&A.ref===g.ref,R=A.item.badge;return(0,$.jsxs)(n,{children:[(0,$.jsx)(n,{color:r.assuranceAccent,children:w?"\u203A ":" "}),(0,$.jsx)(n,{children:`${A.num} \xB7 ${A.item.title}`}),R?(0,$.jsx)(n,{color:r.dim,children:` \xB7 ${R}`}):null]},`${A.kind}:${A.ref}`)}),L>0&&(0,$.jsx)(n,{color:r.dim,children:` \u22EE ${L} more`})]},u)}),a?(0,$.jsxs)(n,{children:[(0,$.jsx)(n,{color:r.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,$.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${a.hidden} more from earlier turns`})]}):null,(0,$.jsx)(n,{color:r.dim,children:"\u2191\u2193 move \xB7 \u21B5 detail \xB7 esc back"})]})}var De=14;function jn({items:e,cursor:s,explain:i,grandTotal:a,dossier:d,scroll:g=0}){let u=e.entries[s];if(!u)return(0,$.jsx)(n,{color:r.dim,children:"nothing to show"});if(d){let h=Math.max(0,Math.min(g,Math.max(0,d.lines.length-De))),I=d.lines.slice(h,h+De);return(0,$.jsxs)(S,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,$.jsxs)(n,{bold:!0,children:[`view \xB7 ${d.id}`,d.id.toLowerCase()!==d.rawId?(0,$.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${d.rawId}`}):null]}),(0,$.jsx)(n,{bold:!0,children:d.title}),h>0?(0,$.jsx)(n,{color:r.muted,children:`\u22EE ${h} above`}):null,I.map((f,p)=>(0,$.jsx)(n,{color:f.dim?r.dim:void 0,children:f.text},`dl-${p}`)),d.lines.length>h+De?(0,$.jsx)(n,{color:r.muted,children:`\u22EE ${d.lines.length-h-De} more`}):null,(0,$.jsx)(n,{color:r.dim,children:"\u2191\u2193 scroll \xB7 esc back"})]})}let m=u.item;return(0,$.jsxs)(S,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,$.jsx)(n,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${a??e.entries.length}`}),(0,$.jsx)(n,{children:u.item.title}),m.badge?(0,$.jsx)(n,{color:r.dim,children:`kind: ${m.badge}`}):null,m.why?(0,$.jsx)(n,{color:r.dim,children:m.why}):null,(0,$.jsx)(Qt,{item:u.item}),i?.map((h,I)=>(0,$.jsx)(n,{color:r.dim,children:h},`ex-${I}`)),(0,$.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"}),(0,$.jsx)(n,{color:r.dim,children:"\u2191\u2193 prev/next \xB7 esc back to list"})]})}function Gt({items:e,state:s,verb:i,more:a,explain:d,grandTotal:g,dossier:u=null}){return s.level==="list"?(0,$.jsx)(Wn,{items:e,cursor:s.cursor,verb:i,more:a}):(0,$.jsx)(jn,{items:e,cursor:s.cursor,explain:d,grandTotal:g,dossier:u,scroll:s.scroll??0})}var Un={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function Jt(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let a=parseInt(s,10);return a>=1?{level:"detail",num:a}:{error:"items are numbered from 1 \u2014 /view 1"}}let i=Un[s];return i?{level:"list",section:i}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var B=U(V(),1),Vn=6,Yt=12;function Kn(e,s,i){let a=Math.max(20,s),d=[];for(let u of e.split(`
|
|
3
|
+
`)){if(u.length<=a){d.push(u);continue}let m="";for(let h of u.split(" "))m&&m.length+1+h.length>a?(d.push(m),m=h):m=m?`${m} ${h}`:h;d.push(m)}let g=Math.max(0,d.length-i);return{body:d.slice(-i).join(`
|
|
4
|
+
`),hidden:g}}var Le=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Zt(e){let s={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},i={key:"keep",label:"keep the existing design",detail:"back to the list"};return e.designed==="stale"?[{...s,detail:"the use-case changed since it was designed"},i]:[i,s]}function _r({controller:e,verb:s="extract",onCtrlC:i,chain:a=null,inspect:d=null}){let[,g]=(0,k.useState)(0),[u,m]=(0,k.useState)(!1),[h,I]=(0,k.useState)(null),[f,p]=(0,k.useState)(null),L=(0,k.useRef)(null),[A,w]=(0,k.useState)(null),R=(0,k.useRef)(null),C=t=>{R.current=t,w(t)},v=t=>{L.current=t,p(t),t===null&&C(null)},E=(0,k.useRef)([]),[x,N]=(0,k.useState)(null),_=(0,k.useRef)(null),q=t=>{_.current=t,N(t)},de=Rt(),{stdout:_e}=Be(),Oe=_e?.columns??80,me=(0,k.useRef)(0),ge=(0,k.useRef)(0);(0,k.useEffect)(()=>{let t=()=>{let o=e.state.ledger;for(let y=me.current;y<o.length;y++){let T=o[y],P=T.kind==="turn"?Vt(e.state.turns,T.turnIndex):void 0;de.append((0,B.jsx)(Kt,{block:T,annotations:P},`lg-${y}`))}me.current=o.length};t();let l=e.subscribe(()=>{t();let o=e.state;L.current&&(o.pending||o.status==="pausing")&&(v(null),o.pending&&I("questions arrived \u2014 back to chat")),g(y=>y+1)});return g(o=>o+1),l},[e,de]);let{thinking:te,status:K,pending:D,confirm:F,ledger:O,activeTurn:H,stream:we,notice:$e}=e.state,nt=(we?.text??"").trimEnd(),rt=nt.length>0,en=u&&(te.liveThinking.length>0||te.thinkingLog.length>0),tn=Kn(te.liveThinking||te.thinkingLog.map(t=>t.text).join(`
|
|
5
|
+
`),Oe-6,Yt),st=rt?nt.split(`
|
|
6
|
+
`).slice(-Vn):[];H&&(ge.current=H.turnIndex);let nn=D?D.resolution.filter(t=>!t).length:0,it;for(let t=O.length-1;t>=0;t--){if(E.current.some(o=>o.end!=null&&t>=o.start&&t<o.end))continue;let l=O[t];if(l.kind==="banner"&&!l.text.startsWith("kane")){it=l.text;break}}let fe=te.activity[te.activity.length-1],Pe=fe?fe.status==="decision"?fe.label:Mt({name:fe.name,status:fe.status}):void 0,ot=K==="streaming"||K==="working",[lt,rn]=(0,k.useState)(0);St(()=>rn(t=>t+1),ot||x?.kind==="running"?120:null);let sn=e.state.busySince?Math.floor((Date.now()-e.state.busySince)/1e3):0,on=rt?"Writing\u2026":Pe?`${Pe.charAt(0).toUpperCase()}${Pe.slice(1)}\u2026`:e.state.workingLabel??(s==="design"?"Designing\u2026":"Thinking\u2026"),ln=e.state.turns.some(t=>t.role==="agent"),[cn,an]=(0,k.useState)(0),[un,dn]=(0,k.useState)(!1),[ct,mn]=(0,k.useState)(null),pe=(0,k.useRef)(0),at=(0,k.useRef)(!1),ut=(0,k.useRef)(null),he=t=>{pe.current=t,an(t)},dt=t=>{at.current=t,dn(t)},ie=t=>{ut.current=t,mn(t)},[qe,gn]=(0,k.useState)(0),Q=(0,k.useRef)(0),xe=t=>{Q.current=t,gn(t)},mt=D?D.questions[0]?.id??"b":null;(0,k.useEffect)(()=>{D&&xe(D.cursor<0?0:D.cursor)},[mt,D?.cursor]);let Fe=()=>{let t=z.current;if(!t)return;let l=t.questions.length;for(let o=1;o<=l;o++){let y=(Q.current+o)%l;if(!t.resolution[y]){xe(y);return}}},gt=D?D.questions[Math.max(0,Math.min(D.questions.length-1,qe))]:void 0,X=(0,k.useRef)(gt);X.current=gt;let z=(0,k.useRef)(D);z.current=D;let fn=D?`${mt}:${qe}`:null;(0,k.useEffect)(()=>{if(ie(null),X.current){dt(!0);let t=z.current?.resolution[Q.current]?.selected_index;he(t??X.current.recommended_index??0)}else dt(!1)},[fn]);let ve=t=>{let l=z.current;return Ye(t,l?Ae(l)!=="":!1)},pn={isFocused:()=>at.current&&X.current!=null&&ut.current==null||_.current!=null&&_.current.kind!=="running"||G.current&&$t.current==null,onMove:t=>{let l=X.current;if(l){he(Math.max(0,Math.min(ve(l).maxSel,pe.current+t)));return}let o=_.current;if(o?.kind==="picker"){q({...o,sel:Math.max(0,Math.min(o.items.length-1,o.sel+t))});return}if(o?.kind==="ask"||o?.kind==="confirm"||o?.kind==="failed"){let y=(o.kind==="ask"?Ie.current.length:o.kind==="failed"?Re.current.length:2)-1;q({...o,sel:Math.max(0,Math.min(y,o.sel+t))});return}o&&!G.current||G.current&&le(Math.max(0,Math.min(Te.current.length-1,ze.current+t)))},onSelect:()=>{let t=X.current,l=z.current;if(!t||!l){let T=_.current;if(T?.kind==="picker"){let W=T.items[T.sel];W&&(W.designed?q({kind:"confirm",item:W,sel:0}):Ke(W,!1));return}if(T?.kind==="confirm"){Zt(T.item)[T.sel]?.key==="redesign"?Ke(T.item,!0):Ve();return}if(T?.kind==="ask"){let W=Ie.current[T.sel]?.key;W==="another"?Ve():W==="view"?Ge(""):q(null);return}if(T?.kind==="failed"){let W=Re.current[T.sel]?.key;W==="retry"?Ke(T.item,T.force):W==="view"?Ge(""):q(null);return}if(T&&!G.current||!G.current)return;switch(Te.current[ze.current]?.key){case"finish":e.completeSession();return;case"continue":e.continueParked();return;case"design-chain":Ve();return;case"view":Ge("",ge.current);return;case"free":ce("");return}return}let o=ve(t),y=pe.current;if(o.batchIdx!=null&&y===o.batchIdx){e.goWithRecommendations();return}if(o.freeIdx!=null&&y===o.freeIdx){ie("");return}if(o.doneIdx!=null&&y===o.doneIdx){e.confirmMulti(Q.current),Fe();return}if(t.multi_select){e.toggleOption(Q.current,y);return}e.submitAnswer(Q.current,y),Fe()},onLeft:()=>{z.current&&xe(Math.max(0,Q.current-1))},onRight:()=>{let t=z.current;t&&xe(Math.min(t.questions.length-1,Q.current+1))},onDigit:t=>{let l=X.current;if(l){t-1<l.options.length&&he(t-1);return}let o=_.current;if(o?.kind==="picker"){t-1<o.items.length&&q({...o,sel:t-1});return}if(o?.kind==="ask"){t-1<Ie.current.length&&q({...o,sel:t-1});return}if(o?.kind==="failed"){t-1<Re.current.length&&q({...o,sel:t-1});return}if(o?.kind==="confirm"){t-1<2&&q({...o,sel:t-1});return}if(!(o&&!G.current)&&G.current){let y=Te.current,T=0;for(let P=0;P<y.length;P++)if(!y[P].free&&(T+=1,T===t)){le(P);return}}},isMulti:()=>{let t=X.current;return!!t?.multi_select&&pe.current<(t?.options.length??0)},onSpace:()=>{z.current&&e.toggleOption(Q.current,pe.current)},onTab:()=>{let t=X.current;if(!t)return;let l=ve(t);l.batchIdx!=null&&he(l.batchIdx)},onType:t=>{let l=X.current;if(l){if(!l.allow_free_text)return;let o=ve(l);he(o.freeIdx??0),ie(t);return}if(!(_.current&&!G.current)&&G.current){let o=Lt(Te.current);if(o==null)return;le(o),ce(t)}},onBack:()=>{let t=_.current;if(t&&t.kind!=="running"){q(null);return}let l=z.current;if(l){for(let o=Q.current-1;o>=0;o--)if(l.resolution[o]){xe(o);return}}}},hn=ct!=null?{value:ct,onChange:t=>ie(t),onSubmit:t=>{ie(null),t.trim()&&z.current&&(e.submitFreeText(Q.current,t),Fe())},onCancel:()=>ie(null)}:null,ft=i??(()=>e.requestPause()),re=e.state.checkpoint,ke=x?.kind==="running"&&K==="idle",be=K==="idle"&&ln&&!D&&!f&&(!x||ke),G=(0,k.useRef)(!1);G.current=be;let J=se(e.state.turns).entries.length,ye,Y;for(let t=O.length-1;t>=0;t--){if(E.current.some(o=>o.end!=null&&t>=o.start&&t<o.end))continue;let l=O[t];if(!ye&&l.kind==="commit"&&l.ok&&(ye=l.line),!Y&&l.kind==="banner"&&l.text.startsWith("designing: ")&&(Y=l.text.slice(11)),ye&&Y)break}let Ne;for(let t=O.length-1;t>=0;t--){let l=O[t];if(l.kind==="user")break;if(l.kind==="commit"&&l.ok&&/\bapplied\b/.test(l.line)){Ne=l.line;break}}let Z=Y?{"acceptance criteria":"scenarios",scenarios:"acceptance criteria + exercises","acceptance criteria + exercises":"tests + gaps"}[Y]:void 0,pt={"acceptance criteria":"the promises every path of this use-case must keep",scenarios:"the concrete user journeys that exercise those promises","acceptance criteria + exercises":"the wiring pass \u2014 per-journey checks, tied to the promises each journey exercises","tests + gaps":"runnable browser tests \u2014 anything unautomatable is recorded as a gap"},ht=Y?pt[Y]:void 0,xt=Z?pt[Z]:void 0,xn="phases: acceptance criteria \u2192 scenarios \u2192 wiring \u2192 tests \xB7 stop anytime with finish",kn=(()=>{for(let t=O.length-1;t>=0;t--){let l=O[t];if(l.kind==="agent")return l.text}return null})(),oe=/\?\s*$/.test((kn??"").trimEnd()),kt=s==="design"&&!re&&(oe||Z!==void 0),bt=Y==="tests + gaps",Se=x?.kind==="running"?x.title:"the design",yt=!!e.state.error&&!e.senderAlive(),bn=F?"the agent needs a clarification before it can apply that":ke&&!re?oe?`${Se} \u2014 the agent asked a question`:Ne?`${Se} \u2014 ${Ne}`:bt?`${Se} \u2014 design complete`:`${Se} \u2014 the agent is waiting on you`:re?Y?`${Y} done${Z?` \u2014 next: ${Z}`:""}`:ye??"phase done":yt?"the agent stopped \u2014 the session is view-only":kt?oe?"the agent asked a question \u2014 answer or continue":`design incomplete \u2014 ${Z} not started`:ye??"waiting on you",We=F?[{key:"free",label:"clarify \u2014 type which one you meant",free:!0}]:ke&&!re?bt&&!oe?[{key:"finish",label:"finish this design"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:[{key:"continue",label:oe?"continue \u2014 go with your suggestion":"continue designing"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"finish",label:"finish this design"},{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:re?[{key:"continue",label:Z?`continue to ${Z}`:"continue"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"finish",label:"finish here"},{key:"free",label:"adjust \u2014 tell me what to change",free:!0}]:yt?[...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"tell me what to change",free:!0}]:kt?[{key:"continue",label:oe?"continue \u2014 go with your suggestion":`continue \u2014 ${Z} next`},...J>0?[{key:"view",label:"view the design"}]:[],{key:"finish",label:"finish anyway"},{key:"free",label:"reply \u2014 answer and continue",free:!0}]:[{key:"finish",label:s==="design"?"finish":"looks good \u2014 finish the session"},...a?[{key:"design-chain",label:"design tests for a use-case\u2026"}]:[],...J>0?[{key:"view",label:s==="design"?"view the design":`view the ${J} draft${J===1?"":"s"}`}]:[],{key:"free",label:s==="design"?"keep adjusting \u2014 tell me what to change":"tell me what to change",free:!0}],je=[{key:"another",label:"design another use-case\u2026"},...J>0?[{key:"view",label:"view what was designed"}]:[],{key:"back",label:"done \u2014 back"}],Ie=(0,k.useRef)(je);Ie.current=je;let Ue=[{key:"retry",label:"try again"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"back",label:"back"}],Re=(0,k.useRef)(Ue);Re.current=Ue;let Ve=()=>{let t=a?.listUcs()??[];if(t.length===0){I("no use-cases to design yet");return}q({kind:"picker",items:t,sel:0})},Ke=(t,l)=>{let o={start:e.state.ledger.length,end:null};E.current.push(o);let y=()=>{o.end=e.state.ledger.length};q({kind:"running",title:t.title,item:t,force:l,startedAt:Date.now()}),a.runDesignChild(t.key,l).then(T=>{y(),T===0?(e.ledger({kind:"commit",ok:!0,line:`designed ${t.title}`}),q({kind:"ask",title:t.title,sel:0})):(e.ledger({kind:"commit",ok:!1,line:`design for ${t.title} failed \u2014 child exited ${T}`}),q({kind:"failed",item:t,force:l,detail:`child exited ${T}`,sel:0}))}).catch(T=>{y();let P=T instanceof Error?T.message:String(T);e.ledger({kind:"commit",ok:!1,line:`design for ${t.title} failed \u2014 ${P}`}),q({kind:"failed",item:t,force:l,detail:P,sel:0})})},Te=(0,k.useRef)(We);Te.current=We;let Qe=be&&re&&ht!==void 0,He=E.current.find(t=>t.end==null)?.start??"top",Tt=(0,k.useRef)(new Set),[yn,wt]=(0,k.useState)(!1);(0,k.useEffect)(()=>{Qe?Tt.current.has(He)||(Tt.current.add(He),wt(!0)):wt(!1)},[Qe,He]);let Tn=Qe?[...yn?[xn]:[],`${ht}${xt?` \xB7 next: ${xt}`:""}`]:[],[wn,$n]=(0,k.useState)(0),[Xe,vn]=(0,k.useState)(null),ze=(0,k.useRef)(0),$t=(0,k.useRef)(null),le=t=>{ze.current=t,$n(t)},ce=t=>{$t.current=t,vn(t)},Sn=`${be}:${re}:${ge.current}`;(0,k.useEffect)(()=>{le(0),ce(null)},[Sn]);let In=Xe!=null?{value:Xe,onChange:t=>ce(t),onSubmit:t=>{ce(null),le(0);let l=t.trim();l&&(I(null),e.submit(l))},onCancel:()=>{ce(null),le(0)}}:null,Ge=(t,l)=>{if(/^(uc|sc|ac|t|gap|sty)-\d+$/i.test(t.trim())){let P=t.trim().toLowerCase(),Ce=se(e.state.turns).entries.findIndex(j=>(j.item.logical_id??"").toLowerCase()===P);if(Ce<0){I(`${t.trim().toUpperCase()} isn't in this session's items \u2014 view lists what this session minted`);return}v({level:"detail",cursor:Ce,scroll:0}),C(null);return}let o=Jt(t);if("error"in o){I(o.error);return}let y=se(e.state.turns);if(y.entries.length===0){I("nothing proposed yet \u2014 the first turn is still coming");return}if(o.level==="detail"&&o.num>y.entries.length){I(`no item ${o.num} \u2014 the set has ${y.entries.length} item${y.entries.length===1?"":"s"}`);return}let T=l!=null?et(y,l):y;v(zt(o,T)),C(l!=null&&T.entries.length<y.entries.length?l:null)},vt=(0,B.jsx)(Ot,{verb:s,subject:it,pendingCount:nn,creditsTotal:e.state.credits?.total,state:ke?"waiting on you":D||be||f||x&&x.kind!=="running"?"idle":void 0});if(f){let t=se(e.state.turns),l=A!=null?et(t,A):t,o=t.entries.length-l.entries.length,y=f.level==="list"&&o>0,T=l.entries.length+(y?1:0),P=l.entries[f.cursor],W=f.level==="detail"&&P?e.explainLines(P.item.slug??P.item.temp_ref):null,Ce=f.level==="detail"&&P&&d?d(P.item.logical_id??e.aliasOf(P.item.temp_ref)??P.item.temp_ref):null;return(0,B.jsxs)(S,{flexDirection:"column",children:[(0,B.jsx)(Je,{onToggleThinking:()=>m(j=>!j),onCtrlC:ft,explorer:{isOpen:()=>L.current!==null,onMove:j=>v(L.current&&Me(L.current,{type:"move",delta:j},T)),onEnter:()=>{let j=L.current;if(j){if(j.level==="list"&&y&&j.cursor===l.entries.length){C(null);return}v(Me(j,{type:"enter"},T))}},onBack:()=>{v(L.current&&Me(L.current,{type:"back"},T)),setTimeout(()=>g(j=>j+1),0)}}}),(0,B.jsx)(Gt,{items:l,state:f,verb:s,more:y?{hidden:o}:null,explain:W,grandTotal:t.entries.length,dossier:Ce}),($e??h)&&($e??h).split(`
|
|
7
|
+
`).map((j,Rn)=>(0,B.jsx)(n,{color:r.orange,children:j},`nt-${Rn}`)),vt]})}return(0,B.jsxs)(S,{flexDirection:"column",children:[(0,B.jsx)(Je,{onToggleThinking:()=>m(t=>!t),onCtrlC:ft,panel:pn}),en&&(0,B.jsx)(Et,{thinking:tn.body,expanded:!0,thinkingDone:K!=="streaming",maxLines:Yt+1}),st.length>0&&(0,B.jsx)(S,{flexDirection:"column",children:st.map((t,l)=>(0,B.jsx)(n,{children:Bt(t).map((o,y)=>(0,B.jsx)(n,{bold:o.bold,italic:o.italic,color:o.code?r.dim:void 0,children:o.text},y))},`st-${l}`))}),D&&(0,B.jsx)(Pt,{batch:D,qView:qe,sel:cn,focused:un,freeText:hn,multiSelFor:t=>e.multiSelection(t)}),F&&(0,B.jsx)(n,{color:"yellow",children:F.prompt}),($e??h)&&($e??h).split(`
|
|
8
|
+
`).map((t,l)=>(0,B.jsx)(n,{color:r.orange,children:t},`nt-${l}`)),ot&&!D&&(0,B.jsxs)(n,{color:r.assuranceAccent,children:[`${Le[lt%Le.length]} ${on} `,(0,B.jsx)(n,{color:r.dim,children:`(${sn}s)`})]}),be&&(0,B.jsx)(ae,{headline:bn,rows:We,sel:wn,focused:Xe==null,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 type = your own words",freeText:In,sublines:Tn}),x?.kind==="picker"&&(0,B.jsx)(ae,{ask:!0,headline:"design tests for which use-case?",rows:x.items.map(t=>({key:t.key,label:t.title,detail:t.badge})),sel:x.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),x?.kind==="confirm"&&(0,B.jsx)(ae,{ask:!0,headline:`${x.item.title} is already designed${x.item.designed==="stale"?" \u2014 and the use-case has changed since":""}`,rows:Zt(x.item).map(t=>({key:t.key,label:t.label,detail:t.detail})),sel:x.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),x?.kind==="running"&&!ke&&(0,B.jsxs)(n,{color:r.assuranceAccent,children:[`${Le[lt%Le.length]} Designing ${x.title}\u2026 `,(0,B.jsx)(n,{color:r.dim,children:`(${Math.floor((Date.now()-x.startedAt)/1e3)}s)`})]}),x?.kind==="ask"&&(0,B.jsx)(ae,{headline:`designed ${x.title}`,rows:je,sel:x.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),x?.kind==="failed"&&(0,B.jsx)(ae,{headline:`design failed \u2014 ${x.item.title} (${x.detail})`,rows:Ue,sel:x.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),K==="pausing"&&(0,B.jsx)(n,{color:r.dim,children:"pausing \u2014 saving session\u2026 (ctrl+c again = force quit)"}),vt]})}export{_r as ChatSurface,Kn as tailVisualRows};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-
|
|
2
|
+
import{a,b,c}from"./chunk-MTHCUBDF.js";import"./chunk-4GLYNAK7.js";import"./chunk-B4LLKQTK.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-X5P2T7MA.js";import"./chunk-4GLYNAK7.js";import"./chunk-B4LLKQTK.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-QQUZF2DZ.js";import"./chunk-AIMINJVP.js";import"./chunk-5Y2G4NC7.js";import"./chunk-B4LLKQTK.js";import{a as c}from"./chunk-HCBYKLMW.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as p,b as l,c as n}from"./chunk-
|
|
2
|
+
import{a as p,b as l,c as n}from"./chunk-5WE4DHXL.js";import{y as o}from"./chunk-B4LLKQTK.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a,j as c}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var b=t(R(),1);var e=t(g(),1);function A({model:d,authLabel:v,profile:x,env:w,defaultUrl:u,projectId:r,projectName:s,folderId:i,folderName:f,windowSize:B,chromeProfile:C}){let h=r?s?`${s} (${r})`:r:"(none)",D=i?f?`${f} (${i})`:i:"(none)",{exit:m}=c();return(0,b.useEffect)(()=>{let P=setTimeout(()=>m(),50);return()=>clearTimeout(P)},[m]),(0,e.jsx)(a,{flexDirection:"column",children:(0,e.jsx)(p,{title:"Configuration",children:(0,e.jsxs)(a,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:v}),(0,e.jsx)(l,{label:" profile",value:x}),(0,e.jsx)(l,{label:" env",value:w}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:u??"(none)",valueColor:u?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:d}),(0,e.jsx)(l,{label:" window",value:B}),(0,e.jsx)(l,{label:" project",value:h}),(0,e.jsx)(l,{label:" folder",value:D}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dim})]})})})}export{A as ConfigView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-GQ3NCBYR.js";import"./chunk-RFHMDQXZ.js";import"./chunk-UXPQRALY.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-A2IQRVPR.js";import"./chunk-B4LLKQTK.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-4BAMZSFU.js";import"./chunk-YCCUBQY4.js";import"./chunk-RQYS3KGU.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-4GLYNAK7.js";import"./chunk-B4LLKQTK.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f,b as r,y as t}from"./chunk-
|
|
2
|
+
import{a as f,b as r,y as t}from"./chunk-B4LLKQTK.js";import{a as T}from"./chunk-HCBYKLMW.js";import{a as s,b as o,j as x,k as p}from"./chunk-C44QQJR4.js";import{a as v}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var w=h(v(),1);var e=h(T(),1),b="https://www.testmuai.com/support/docs/kane-cli-introduction",S="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:c}=x(),{stdout:a}=p(),l=a?.columns??80;return(0,w.useEffect)(()=>{let m=setTimeout(()=>c(),50);return()=>clearTimeout(m)},[c]),(0,e.jsxs)(s,{flexDirection:"column",children:[(0,e.jsxs)(s,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.orange,bold:!0,children:r}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",f]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsxs)(d,{title:"USAGE",children:[(0,e.jsx)(g,{cmd:`${r}`,desc:"Single-shot prompt (no args, TTY)"}),(0,e.jsx)(g,{cmd:`${r} --tui`,desc:"Full interactive TUI",highlight:!0}),(0,e.jsx)(g,{cmd:`${r} run "<objective>"`,desc:"Inline objective"}),(0,e.jsx)(g,{cmd:`${r} testmd run <path>.md`,desc:"Replay a saved *_test.md file"})]}),(0,e.jsxs)(d,{title:"HELP",children:[(0,e.jsx)(g,{cmd:`${r} --help`,desc:"Show this help (long form)"}),(0,e.jsx)(g,{cmd:`${r} -h`,desc:"Show this help (short form)"}),(0,e.jsx)(g,{cmd:`${r} help`,desc:"Show this help (subcommand form)"}),(0,e.jsxs)(s,{marginLeft:2,marginTop:0,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["These are the only supported help invocations. Anything else (e.g. ",(0,e.jsx)(o,{color:t.orange,children:"-help"}),") is an unknown flag."]}),(0,e.jsxs)(o,{color:t.dim,children:["Terminal tab-completion is a shell feature; ",r," does not ship shell-completion scripts, so any flag your shell suggests is a generic guess \u2014 not from ",r,"."]})]})]}),(0,e.jsxs)(d,{title:"COMMANDS",children:[(0,e.jsx)(i,{cmd:"run",args:"<objective>",desc:"Run an objective (inline string)",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd",args:"run|list|status|delete|export",desc:"Manage *_test.md files"}),(0,e.jsx)(i,{cmd:"testrun",args:"run",desc:"Run M *_test.md files as one sealed execution"}),(0,e.jsx)(i,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(i,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(i,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(i,{cmd:"config",args:"show|set-mode|set-assertion-mode|\u2026",desc:"Chrome, run & generate settings"}),(0,e.jsx)(i,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"}),(0,e.jsx)(i,{cmd:"evidence",args:"validate|serve|merge",desc:"Validate, serve (viewer) or merge evidence packs"}),(0,e.jsx)(i,{cmd:"changelog",args:"[--all]",desc:"Show recent release notes"}),(0,e.jsx)(i,{cmd:"context",args:"ingest|extract|list|review|sessions|\u2026",desc:"Build & manage the assurance context store"}),(0,e.jsx)(i,{cmd:"design",args:"tests --use-case <ref>",desc:"Design tests from the context store"})]}),(0,e.jsxs)(d,{title:"TESTMD ACTIONS",children:[(0,e.jsx)(i,{cmd:"testmd run",args:"<path>",desc:"Replay a saved *_test.md file",highlight:!0}),(0,e.jsx)(i,{cmd:"testmd list",desc:"List *_test.md files in cwd (recursive)"}),(0,e.jsx)(i,{cmd:"testmd status",args:"<path>",desc:"Print local meta.json for a test"}),(0,e.jsx)(i,{cmd:"testmd delete",args:"<path>",desc:"Remove output-<stem>/ and the source file"}),(0,e.jsx)(i,{cmd:"testmd export",args:"<path> --language <py|js>",desc:"Generate standalone Playwright code"})]}),(0,e.jsxs)(d,{title:"RUN FLAGS",children:[(0,e.jsx)(n,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(n,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(n,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(n,{long:"--mode",arg:"<action|testing>",desc:"Run mode (default: testing)"}),(0,e.jsx)(n,{long:"--name",arg:"<name>",desc:"Persist session under this name"}),(0,e.jsx)(n,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(n,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(n,{long:"--session-context",arg:"<json>",desc:"Prior runs context JSON"}),(0,e.jsx)(n,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(n,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(n,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(n,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(n,{long:"--task-skills",desc:"Domain-specific task skills (experimental)"}),(0,e.jsx)(n,{long:"--code-export",desc:"Generate code export after upload"}),(0,e.jsx)(n,{long:"--code-language",arg:"<lang>",desc:"Code export language: python | javascript"}),(0,e.jsx)(n,{long:"--skip-code-validation",desc:"Skip post-codegen validation"}),(0,e.jsx)(n,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(n,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(n,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(n,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(d,{title:"EXAMPLES",children:[(0,e.jsx)(u,{label:"Inline objective",cmd:`${r} run "Search for laptop"`}),(0,e.jsx)(u,{label:"Replay a saved test",cmd:`${r} testmd run smoke_test.md`}),(0,e.jsx)(u,{label:"Variables",cmd:`${r} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(u,{label:"Agent mode (NDJSON)",cmd:`${r} run "Add to cart" --agent | jq .status`})]}),(0,e.jsx)(d,{title:"TEST FILES",children:(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:[(0,e.jsx)(o,{color:t.orange,children:"*_test.md"})," \u2014 markdown test files with YAML frontmatter and ",(0,e.jsx)(o,{color:t.orange,children:"## "}),"step headings."]}),(0,e.jsxs)(o,{color:t.dim,children:["Run with ",(0,e.jsxs)(o,{color:t.orange,children:[r," testmd run path/to/foo_test.md"]}),". (`.md` paths are not accepted by `",r," run`.)"]}),(0,e.jsxs)(o,{color:t.dim,children:["Sessions you run in TUI auto-save to ",(0,e.jsx)(o,{color:t.orange,children:"<cwd>/.testmuai/tests/<name>_test.md"})," (testing mode prompts on exit)."]})]})}),(0,e.jsxs)(s,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(l-2,70))}),(0,e.jsxs)(s,{gap:3,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Docs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:b})]}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{color:t.dim,children:"Bugs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:S})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function d({title:c,children:a}){return(0,e.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(s,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dim,children:c})}),a]})}function g({cmd:c,desc:a,highlight:l}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:40,children:[(0,e.jsx)(o,{color:t.dim,children:"$ "}),(0,e.jsx)(o,{color:l?t.orange:t.orange,children:c})]}),(0,e.jsx)(o,{color:t.dim,children:a})]})}function i({cmd:c,args:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsx)(s,{width:16,children:(0,e.jsx)(o,{color:m?t.orange:t.green,bold:!0,children:c})}),(0,e.jsx)(s,{width:32,children:a?(0,e.jsx)(o,{color:t.dim,children:a}):null}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function n({long:c,arg:a,desc:l,highlight:m}){return(0,e.jsxs)(s,{marginLeft:2,children:[(0,e.jsxs)(s,{width:30,children:[(0,e.jsx)(o,{color:m?t.orange:t.orange,children:c}),a&&(0,e.jsxs)(o,{color:t.dim,children:[" ",a]})]}),(0,e.jsx)(o,{color:t.dim,children:l})]})}function u({label:c,cmd:a}){return(0,e.jsxs)(s,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["# ",c]}),(0,e.jsxs)(o,{color:t.orange,children:["$ ",a]})]})}export{L as HelpView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-J3EMJ7US.js";import"./chunk-5WE4DHXL.js";import"./chunk-B4LLKQTK.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-XLKRV2JH.js";import"./chunk-B4LLKQTK.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-YHQFYZJ5.js";import"./chunk-4GLYNAK7.js";import"./chunk-B4LLKQTK.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-CH3VWCRZ.js";import"./chunk-YCCUBQY4.js";import"./chunk-RQYS3KGU.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-4GLYNAK7.js";import"./chunk-B4LLKQTK.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-RODHDQU3.js";import"./chunk-S3DAAAE5.js";import"./chunk-J3EMJ7US.js";import"./chunk-5WE4DHXL.js";import"./chunk-B4LLKQTK.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-KCBS57IF.js";import"./chunk-77WMTCUQ.js";import"./chunk-4SJC64KQ.js";import"./chunk-TDPWFYTJ.js";import"./chunk-T7ZPMTGS.js";import"./chunk-NR23HZU4.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-CH3VWCRZ.js";import"./chunk-4BAMZSFU.js";import"./chunk-YCCUBQY4.js";import"./chunk-RQYS3KGU.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-VE3SUJMA.js";import"./chunk-WREVEATJ.js";import"./chunk-4GLYNAK7.js";import"./chunk-B4LLKQTK.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-BCH3JCND.js";import"./chunk-J3EMJ7US.js";import"./chunk-5WE4DHXL.js";import"./chunk-B4LLKQTK.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-LGVHW4ZA.js";import"./chunk-5YHVK2EO.js";import"./chunk-E5PWL3BG.js";import"./chunk-TDPWFYTJ.js";import"./chunk-T7ZPMTGS.js";import"./chunk-AIMINJVP.js";import"./chunk-5Y2G4NC7.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-A2IQRVPR.js";import"./chunk-J3EMJ7US.js";import"./chunk-5WE4DHXL.js";import"./chunk-DFS4RMVP.js";import"./chunk-B4LLKQTK.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b,b as r}from"./chunk-
|
|
2
|
+
import{a as b,b as r}from"./chunk-5WE4DHXL.js";import{y as o}from"./chunk-B4LLKQTK.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as i,b as l,j as s}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var f=a(T(),1);var e=a(p(),1);function V({profile:g,env:v,authenticated:n,authMethod:h,username:c,tokenStatus:t,expiresAt:d,serverStatus:u,detail:m}){let{exit:x}=s();return(0,f.useEffect)(()=>{let B=setTimeout(()=>x(),50);return()=>clearTimeout(B)},[x]),(0,e.jsx)(i,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Identity",variant:n?"success":"warning",children:(0,e.jsxs)(i,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{children:u==="rejected"?(0,e.jsx)(l,{color:o.red,bold:!0,children:"\u2717 Not authenticated"}):u==="unreachable"?(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Couldn't verify"}):n?(0,e.jsx)(l,{color:o.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(r,{label:"Profile",value:g}),(0,e.jsx)(r,{label:"Environment",value:v}),(0,e.jsx)(r,{label:"Method",value:h}),c&&(0,e.jsx)(r,{label:"User",value:c}),t&&(0,e.jsx)(r,{label:"Token",value:t,valueColor:t==="valid"?o.green:t==="expired"?o.red:o.dim}),d&&(0,e.jsx)(r,{label:"Expires",value:d}),m&&(0,e.jsx)(r,{label:"Detail",value:m})]})]})})})}export{V as WhoamiView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import"./chunk-UR6MHSHU.js";async function i(e){try{let[{CredentialsManager:n},{AuthResolver:a},{getEnvironment:s}]=await Promise.all([import("./credentials-GXDXVMXW.js"),import("./resolver-IDCGRPFJ.js"),import("./config-5GOFF5F4.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-YNYB4Z7K.js")).resolveAgentAuthEnv()))();if(s.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH)return s;let t=n.TESTMUAI_ENV==="stage"?"stage":"prod",o=await(e.exchange??i)(t);return o?{...s,TESTMUAI_BASIC_AUTH:o}:s}export{u as resolveLisAuthEnv};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as w}from"./chunk-
|
|
2
|
+
import{a as w}from"./chunk-MAO5BAQI.js";import"./chunk-3RZ63RBO.js";import"./chunk-KHU7C6EE.js";import"./chunk-JSF5JYZC.js";import"./chunk-J44RN3FB.js";import"./chunk-JFAFKHDX.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import"./chunk-DNNZ353O.js";import"./chunk-FHKDTM5L.js";import"./chunk-ZPDM6FO7.js";import{a as u}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-5EOX4MEY.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";import{existsSync as y}from"fs";var O=new Set(["interactive","agent","ci","override"]);function C(e){return e.mode!=null&&!O.has(e.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`}:e.strength!=null&&e.strength!=="pairwise"&&e.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${e.strength}'`}:e.max!=null&&(!Number.isInteger(e.max)||e.max<1)?{error:"design: --max must be a positive integer"}:!e.useCase&&!e.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:e.useCase,max:e.max,strength:e.strength,mode:e.mode,force:e.force,resume:e.resume,plan:e.plan,message:e.message,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function _(e){let g=async(r,n)=>{if(process.stderr.write(r+`
|
|
3
3
|
`),e.mode!=="agent")return 2;let{makeHeadlessIO:i,agentRefusal:o}=await import("./headless-io-PWW6YKH2.js");return o(i("ndjson","design"),r,n)},m=C(e);if("error"in m)return g(m.error);let a=m;{let{validateResumeMessage:r}=await import("./headless-io-PWW6YKH2.js"),n=r(a,"design");if(n)return g(n)}if(!y(u(process.cwd())))return g("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");let t=null;try{if(!a.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
|
|
4
4
|
`),2;let r=a.mode??"interactive";if(r==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`design: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
5
|
-
`),2;let{bindDesignInteractive:s}=await import("./interactive-bind-
|
|
5
|
+
`),2;let{bindDesignInteractive:s}=await import("./interactive-bind-PTAZVCE7.js");return await s(a)}let{resolveAgentAuthEnv:n}=await import("./spawner-YNYB4Z7K.js"),{runAgent:i}=await import("./bridge-BTSWCJ3B.js"),{preflightTurn:o}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:h}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:v}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:T,resolveEncoding:x,guardedChannels:D}=await import("./headless-io-PWW6YKH2.js");t=T(x(r),"design");let{telemetryBootstrap:b,telemetryEnvName:E}=await import("./bootstrap-RPT3JOGD.js"),c=b({verb:"design",mode:r,contextRoot:u(process.cwd()),env:E(),resumeSid:a.resume,write:!0,longSession:!0}),l={...await n(),...c.spawnEnv()},p=v();p&&t.out(p);let d=h(i,s=>t.out(s)),f=D(t,()=>d.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let s=await w({...a,mode:r},{contextDir:u(process.cwd()),agent:d.agent,preflightTurn:()=>o(l),ask:async()=>[],out:f.out,emit:f.emit,progress:t.progress,isTTY:!1,auth:l,telemetry:c});return d.interrupted()&&s!==3?(t.out("interrupted \u2014 no session saved"),await c.end({exit_code:130}),t.done(130)):(s===1&&t.out(c.supportFooter()),await c.end({exit_code:s}),t.done(s))}finally{d.dispose()}}catch(r){let n=r instanceof Error?r.message:String(r);t?.event({type:"error",message:`error: design failed: ${n}`});let i=t?o=>t.out(o):o=>process.stderr.write(o+`
|
|
6
6
|
`);return i(`error: design failed: ${n}`),(process.env.ASSURANCE_LOG_LEVEL??"").toLowerCase()==="debug"&&r instanceof Error&&r.stack&&i(r.stack),i("hint: per-run trace logs live under .context/logs/ (design-*.log)"),t?t.done(1):1}}export{_ as designTestsCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-WTXHOWUP.js";import"./chunk-FHKDTM5L.js";import"./chunk-2XMJ6YAE.js";import"./chunk-BKM2LWU2.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-N4LMQR7C.js";import"./chunk-RCTM7NGT.js";import"./chunk-UR6MHSHU.js";export{a as runAgent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as l}from"./chunk-RZ4F3BHX.js";import{c as i,g as c}from"./chunk-
|
|
2
|
+
import{a as l}from"./chunk-RZ4F3BHX.js";import{c as i,g as c}from"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
|
|
3
3
|
`).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
|
|
4
4
|
`)}export{A as fetchChangelog,v as formatChangelog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as V,c as te}from"./chunk-JFAFKHDX.js";import{a as
|
|
2
|
+
import{a as V,c as te}from"./chunk-JFAFKHDX.js";import{a as ne}from"./chunk-427OQS2N.js";import{a as w,b as ee}from"./chunk-FMR2KPSK.js";import{d as Z}from"./chunk-NVGBE2DR.js";import{a as X}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import{c as Y,d as z,n as Q}from"./chunk-6W6AIDLJ.js";import{a as j,b as F}from"./chunk-6HYW5RFX.js";import{c as J,e as W}from"./chunk-J2KSZUOO.js";import{e as L,f as A,g as P,h as x}from"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";var de=new Set(["approve","edit","reject"]);function ye(k){let{contextDir:f,graph:s,ops:oe,by:l}=k,N=k.mintable??ne(),T=J(f);if(s.latestHash!==T)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(s.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]};let C=[],h=[],M=new Set;for(let e of oe){if(s.appliedEvents.has(e.eventId)||M.has(e.eventId)){C.push(e.eventId);continue}M.add(e.eventId),h.push(e)}if(h.length===0)return{record:null,errors:null,applied:[],skipped:C,minted:[],staleDelta:[]};let o=[],$=[],y=[],m=[],I=[],O=[],_=[...k.judgements??[]],D=[],q=new Map,B=new Set,G=[],b=new Set,se=new Set(N),H=new Set;for(let e of h){if(!de.has(e.kind))continue;let n=e.target,t=s.resolve(n)?.cid??n;H.has(t)&&o.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${n} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),H.add(t)}let E=(e,n,t)=>{let i=s.resolve(n);if(!i)return o.push({code:"UNKNOWN_NODE",detail:`${e}: ${n} names nothing in the graph`}),null;let p=s.tipOf(i.cid);return p!==t||s.superseded.has(t)?(o.push({code:"EXPECTED_CID_MOVED",detail:`${e}: ${n} moved or was archived since it was displayed`,data:{tip:p}}),null):t};for(let e of h)if(e.kind==="approve"){let n=E("approve",e.target,e.expectedCid);n&&m.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l})}else if(e.kind==="reject"){let n=E("reject",e.target,e.expectedCid);if(!n)continue;if(m.push({id:n,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:l}),e.redirectTo!==void 0){let t=s.resolve(e.redirectTo);if(!t||t.superseded){o.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}I.push({kind:"node",old:n,new:t.cid,reason:e.reason,by:l})}}else if(e.kind==="edit"){let n=E("edit",e.target,e.expectedCid);if(!n)continue;let t=s.getNode(n);if(!t){o.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let i={...t.content};for(let[c,u]of Object.entries(e.edit))u!==void 0&&(i[c]=u);if(typeof i.title=="string"&&!i.title.trim()){o.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let p=A(t.label,i);if(p.length>0){for(let c of p)o.push({code:c.code,detail:`edit ${e.target}: ${c.detail}`});continue}let d=j(t.label,i);if(d===n){m.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l});continue}$.push({cid:d,label:t.label,content:i}),I.push({kind:"node",old:n,new:d,reason:e.reason??"edited in chat",by:l}),m.push({id:d,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:l})}else if(e.kind==="enhance"){if(!E("enhance",e.target,e.expectedCid))continue;for(let t of e.edges){let i=s.nodeLabel.get(t.src)??"(unknown)",p=s.nodeLabel.get(t.dst)??"(unknown)";for(let r of x(t.type,i,p,t.props))o.push({code:r.code,detail:`enhance ${e.target}: ${r.detail}`});let d=F(t.type,t.src,t.dst,t.props);if(s.edgesFrom(t.src).some(r=>r.ecid===d)||y.some(r=>r.ecid===d))continue;let c=Y(s,t.type,t.src,t.dst,G);c&&o.push(c);let u=z(s,t.type,t.src,t.dst);u&&o.push(u);let a=P(t.type)?.cardinality;if(a==="one-live-per-src"||a==="one-live-per-src-and-dst"){let r=`${t.type}|${t.src}`;b.has(r)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${t.src}: two one-live edges in one turn`}),b.add(r)}if(a==="one-live-per-src-and-dst"){let r=`${t.type}|dst|${t.dst}`;b.has(r)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${t.dst}: two one-live edges in one turn (strict 1:1)`}),b.add(r)}y.push({ecid:d,type:t.type,src:t.src,dst:t.dst,props:t.props}),G.push({src:t.src,dst:t.dst,type:t.type})}}else if(e.kind==="add"){if(!se.has(e.label)){o.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${N.join("|")})`,data:{gate:[...N]}});continue}let n=s.heads.get(e.convSourceId),t=s.convChains.get(e.convSourceId);if(typeof n!="string"||!t){o.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}let i=s.getNode(n)?.content?.blob,p=typeof i=="string"?Z(f,i)?.toString("utf8")??"":"",d=ee(p,e.cite.turn);if(d===null){o.push({code:"BAD_ANCHOR",detail:`add: ${w(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!d.includes(e.cite.quote)){o.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${w(e.cite.turn)}`});continue}let c={...e.content,derived:!0},u=A(e.label,c);if(u.length>0){for(let g of u)o.push({code:g.code,detail:`add: ${g.detail}`});continue}let a=j(e.label,c),r={source_id:e.convSourceId,source_cid:n,anchor:w(e.cite.turn),quote:e.cite.quote};for(let g of x(L.DERIVES,"source",e.label,r))o.push({code:g.code,detail:`add: ${g.detail}`});$.push({cid:a,label:e.label,content:c}),y.push({ecid:F("DERIVES",n,a,r),type:L.DERIVES,src:n,dst:a,props:r}),e.rationale&&_.push({about:a,rationale:e.rationale,by:l});let v=Q(e.label,g=>B.has(g),s.names.keys());v!==null&&(B.add(v),O.push({cid:a,slug:v,by:l})),D.push({cid:a,...v!==null?{slug:v}:{}}),q.set(e.eventId,a)}if(o.length)return{record:null,errors:o};let U=new Date().toISOString();for(let e of h){if(e.kind==="add"){let n=q.get(e.eventId);n&&V(f,{ts:U,command:"extract-chat",id:n,verdict:"add",polarity:"preference",tag:e.label,by:l,event_id:e.eventId,target:n});continue}for(let n of te(e,{ts:U,command:"extract-chat",by:l}))V(f,n)}let K=h.map(e=>e.eventId).sort(),re=W(f,{ts:new Date().toISOString(),proposal_id:null,nodes:$,edges:y,review:m,supersessions:I,...O.length>0?{names:O}:{},..._.length>0?{judgements:_}:{},event_ids:K,source_head_moves:{}},{expectPrev:T}),R=X(f),S=new Set;for(let e of I)if(e.kind==="node"){S.add(e.old);for(let n of R.edgesInto(e.old))S.add(n.src)}for(let e of D)S.add(e.cid);let ie=[...S].map(e=>({cid:e,state:R.stale(R.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:re.record,errors:null,applied:K,skipped:C,minted:D,staleDelta:ie}}export{ye as commitChatTurn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c}from"./chunk-7YPK6EDR.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import"./chunk-NVGBE2DR.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{c as makeChatController,b as questionStub,a as recommendationPicks};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as j}from"./chunk-
|
|
2
|
+
import{b as j}from"./chunk-4XSW6WZD.js";import{a as U}from"./chunk-DNNZ353O.js";import{d as F}from"./chunk-QM4S2APK.js";import{a as x}from"./chunk-7E24OCGX.js";import{a as D,b as M,e as G,f as N}from"./chunk-6W6AIDLJ.js";import{b as V}from"./chunk-J2KSZUOO.js";import{d as b,e as $,g as P}from"./chunk-5YPBPZUR.js";function W(e,n,t,i,o){let d=t.rows.filter(p=>{let u=i.get(p.temp_ref);return u!==void 0&&u!=="reject"});if(d.length===0)return{record:null,errors:null};let s={version:1,read_basis:n.latestHash,source:{source_id:t.source_id,source_cid:n.heads.get(t.source_id)??""},use_cases:d.map(p=>p.uc)},g=new Map;for(let p of d){let u=i.get(p.temp_ref);typeof u=="object"?g.set(p.temp_ref,{resolution:"edited",edit:u.edited}):g.set(p.temp_ref,{resolution:p.uc.matches_existing&&p.uc.changed?"edited":"approved"})}let l=ee(s,n,t.staged_source_cid);if(l.errors!==null)return{record:null,errors:l.errors};let r=l.proposal,f=s.source.source_cid?L(e,n,s.source.source_cid):null;if(f!==null){r=Z(r,f);let p=G(r,z(f),n);if(p.length>0)return{record:null,errors:[{code:"HELD_CITES_STALE",detail:"the source moved after this plan staged \u2014 its quotes no longer verify against the current head; re-run kane-cli maintain reconcile to re-stage"},...p]}}let m=`held-${(n.latestHash??"root").slice(-12)}-${d.length}`;return N({contextDir:e,graph:n,proposal:r,proposalId:m,verdicts:g,by:o,autoName:!0})}function z(e){return e.replace(/\n$/,"").split(`
|
|
3
3
|
`).map((t,i)=>`${String(i+1).padStart(4,"0")}| ${t}`).join(`
|
|
4
4
|
`)}function Z(e,n){let t=n.replace(/\n$/,""),i=z(n),o=d=>{if(!d?.quote)return d;let s=M(i,d.anchor);if(s!==null&&s.includes(d.quote))return d;let g=t.indexOf(d.quote);if(g===-1||t.indexOf(d.quote,g+1)!==-1)return d;let l=t.slice(0,g).split(`
|
|
5
5
|
`).length,r=l+d.quote.replace(/\n$/,"").split(`
|
|
@@ -9,6 +9,6 @@ import{b as j}from"./chunk-5Z7GAIPP.js";import{a as U}from"./chunk-DNNZ353O.js";
|
|
|
9
9
|
`),o=0;for(;o<t.length&&o<i.length&&t[o]===i[o];)o++;let d=t.length,s=i.length;for(;d>o&&s>o&&t[d-1]===i[s-1];)d--,s--;if(d===o&&s===o)return"";let g=t.slice(o,d),l=i.slice(o,s),f=ie(g,l,2e3),m=[];if(f===null)m.push(`@@ old L${o+1}-L${d} \u2192 new L${o+1}-L${s} @@`,...g.map(p=>`- ${p}`),...l.map(p=>`+ ${p}`));else{let p=f.map((c,h)=>c.op==="="?-1:h).filter(c=>c>=0),u=0;for(;u<p.length;){let c=u;for(;c+1<p.length&&p[c+1]-p[c]<=3;)c++;let h=Math.max(p[u]-1,0),E=Math.min(p[c]+1,f.length-1),v=f.slice(h,E+1),S=o+(v[0].ai??0)+1,w=o+(v[0].bi??0)+1,a=v.filter(R=>R.op!=="+").length,_=v.filter(R=>R.op!=="-").length;m.push(`@@ old L${S}-L${S+Math.max(a-1,0)} \u2192 new L${w}-L${w+Math.max(_-1,0)} @@`);for(let R of v)m.push(R.op==="="?` ${R.line}`:`${R.op} ${R.line}`);u=c+1}}return m.join(`
|
|
10
10
|
`)}function ie(e,n,t){let i=e.length,o=n.length,d=Math.min(i+o,t),s=new Map([[1,0]]),g=[],l=!1;for(let p=0;p<=d&&!l;p++){g.push(new Map(s));for(let u=-p;u<=p;u+=2){let c=u===-p||u!==p&&(s.get(u-1)??0)<(s.get(u+1)??0)?s.get(u+1)??0:(s.get(u-1)??0)+1,h=c-u;for(;c<i&&h<o&&e[c]===n[h];)c++,h++;if(s.set(u,c),c>=i&&h>=o){l=!0;break}}}if(!l)return null;let r=i,f=o,m=[];for(let p=g.length-1;p>0;p--){let u=g[p],c=r-f,h=c===-p||c!==p&&(u.get(c-1)??0)<(u.get(c+1)??0)?c+1:c-1,E=u.get(h)??0,v=E-h;for(;r>E&&f>v;)m.push({op:"=",line:e[r-1],ai:r-1,bi:f-1}),r--,f--;p>0&&(r===E?(m.push({op:"+",line:n[f-1],ai:r,bi:f-1}),f--):(m.push({op:"-",line:e[r-1],ai:r-1,bi:f}),r--))}for(;r>0&&f>0;)m.push({op:"=",line:e[r-1],ai:r-1,bi:f-1}),r--,f--;for(;r>0;)m.push({op:"-",line:e[r-1],ai:r-1,bi:0}),r--;for(;f>0;)m.push({op:"+",line:n[f-1],ai:0,bi:f-1}),f--;return m.reverse()}function ce(e){let n=Buffer.byteLength(e,"utf8");if(n<=K+X)return{diff:e,truncated:!1};let t=Buffer.from(e,"utf8"),i=K;for(;i>0&&(t[i]&192)===128;)i--;let o=n-X;for(;o<n&&(t[o]&192)===128;)o++;let d=t.subarray(0,i).toString("utf8"),s=t.subarray(o).toString("utf8");return{diff:`${d}
|
|
11
11
|
\u2026 [diff truncated: ${n-i-(n-o)} bytes omitted] \u2026
|
|
12
|
-
${s}`,truncated:!0}}function ae(e,n){let t=x(e),i=t.heads.get(n);if(typeof i!="string")return null;let o=[];for(let u of V(e).records){let c=u.source_head_moves?.[n];c!==void 0&&c!==o[o.length-1]&&o.push(c)}let d=o.lastIndexOf(i),s=d>0?o[d-1]:null;if(typeof s!="string"||s===i)return null;let g=L(e,t,s),l=L(e,t,i);if(g===null||l===null)return null;let{diff:r,truncated:f}=ce(oe(g,l)),m=new Set,p=[];for(let u of t.edgesFrom(s))u.type!==$.DERIVES||t.nodeLabel.get(u.dst)!==b.USECASE||m.has(u.dst)||(m.add(u.dst),p.push({id:u.dst,title:String(t.getNode(u.dst)?.content.title??"")}));return{source_id:n,old_head:s,new_head:i,diff:r,...f?{truncated:!0}:{},prior_ucs:p}}function de(e,n,t){let i=e.getNode(n)?.content??{},o=e.getNode(t)?.content??{},s=[...new Set([...Object.keys(i),...Object.keys(o)])].sort().filter(g=>JSON.stringify(i[g])!==JSON.stringify(o[g]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function le(e,n,t,i,o,d,s){let g=new Set((s?.rows??[]).map(c=>c.matched_cid).filter(c=>!!c)),l=[];for(let[c,h]of t.superseded)h===null||c===h||n.superseded.has(c)||t.nodeLabel.get(c)===b.USECASE&&l.push({kind:"MODIFY",ref:y(t,c),old_cid:c,new_cid:h,summary:de(t,c,h)});let r=d.map(c=>({kind:"ADD",ref:y(t,c),cid:c}));for(let c of s?.rows??[])c.kind==="MODIFY"&&c.matched_cid?l.push({kind:"MODIFY",ref:y(t,c.matched_cid),old_cid:c.matched_cid,new_cid:null,summary:`${c.why} (staged)`}):c.kind==="ADD"&&r.push({kind:"ADD",ref:c.title,cid:null});let f=[],m=L(e,t,o),p=new Map;for(let{cid:c}of t.byLabel(b.USECASE)){if(!T(t,c)||g.has(c))continue;let h=t.derivesInto(c),E=h.filter(w=>String(w.props.source_id)===i);E.length===0||E.some(w=>w.props.source_cid===o)||E.some(w=>{let a=String(w.props.anchor),_=D(a);return _?.kind==="img-whole"?!1:_?.kind==="img-part"?se(t,w,o):m!==null&&re(e,t,w,m,p)})||h.some(w=>{let a=String(w.props.source_id);if(a===i)return!1;let _=t.heads.get(a);return _!=null})||f.push({kind:"ARCHIVE",ref:y(t,c),cid:c,why:`evidence decayed: no quote from ${i} relocates into @${C(o)}, no other live source, no fresh evidence this run`,impact:J(t,t.tipOf(c))})}let u=(c,h)=>c.ref<h.ref?-1:c.ref>h.ref?1:0;return[...l.sort(u),...r.sort(u),...f.sort(u)]}function Ee(e,n,t,i,o){let d=n.rows.find(u=>u.temp_ref===t);if(!d)return{ok:!1,message:`held item ${t} missing from the plan artifact`};let s=d,g=x(e);if(s.matched_cid){let u=g.tipOf(s.matched_cid);if(g.superseded.get(u)===null)return{ok:!1,message:`use-case for "${s.title}" was retired meanwhile \u2014 nothing to update`};u!==s.matched_cid&&(s={...s,matched_cid:u,uc:{...s.uc,matches_existing:{cid:u}}})}let l=o?{edited:o}:"approve",r=W(e,g,{source_id:n.source_id,...n.staged_source_cid!==void 0?{staged_source_cid:n.staged_source_cid}:{},rows:[s]},new Map([[s.temp_ref,l]]),i);if(r.errors)return{ok:!1,message:r.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let f=x(e),m=s.matched_cid?f.tipOf(s.matched_cid):r.record?.nodes.find(u=>u.label==="usecase")?.cid??r.record?.review[0]?.id;return{ok:!0,ref:m?y(f,m):s.title,kind:s.kind}}async function ve(e,n,t,i={}){let o=x(e),d=o.heads.get(n)??null,s=new Set(o.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),g=await t.reingest(n);if(g.status==="unchanged"&&!i.resumeHeld)return{source_id:n,changed:!1,head:{status:g.status,before:d,after:g.cid},note:`nothing to reconcile \u2014 ${n} is unchanged`,skipped_arms:B,changeset:[],rows:[]};let l=i.resumeHeld?{minted:[],matched:[],held:i.resumeHeld}:await t.reextract(n),r=x(e),f=l.minted.map(a=>{let _=y(r,a);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${n}`,provenance:`extraction commit \u2014 DERIVES ${n} @ ${C(g.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=r.staleList().filter(a=>a.state==="stale"&&!s.has(a.cid)&&T(r,a.cid)).map(a=>a.cid),p=m.map(a=>{let _=y(r,a),R=ne.has(r.nodeLabel.get(a)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:q(r,a),action:R?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],c=[];for(let a of l.held?.rows??[])if(a.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${C(g.cid)}`,action:"approve to commit + design"});else{let _=a.matched_cid?r.tipOf(a.matched_cid):null,R=_?r.getNode(_)?.content.criteria??[]:[],I=(a.uc.updated?.criteria??[]).map(k=>typeof k=="string"?k:k.text),Q=[...I.filter(k=>!R.includes(k)),...a.uc.updated?.criteria!==void 0?R.filter(k=>!I.includes(k)):[]],H=_?J(r,_,Q):void 0;c.push({kind:"MODIFY",origin:"content-change",ref:a.matched_cid?y(r,a.matched_cid):a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${C(g.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...H?{impact:H}:{}})}let h=new Set;for(let a of[...l.minted,...l.matched])h.add(r.tipOf(a));for(let a of l.held?.rows??[])a.matched_cid&&h.add(r.tipOf(a.matched_cid));for(let a of m){let _=Y(r,r.tipOf(a));_&&r.nodeLabel.get(_)===b.USECASE&&h.add(r.tipOf(_))}let E=[];for(let a of await F(r,"design")){if(a.kind!=="no-verifies")continue;let _=r.resolve(a.ref);if(!_)continue;let R=Y(r,_.tip);!R||!h.has(r.tipOf(R))||E.push({kind:"ADD",origin:"content-change",ref:a.ref,reason:a.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${y(r,R)}`,action:a.ready_command})}let v=[];for(let{cid:a}of r.byLabel(b.USECASE))T(r,a)&&r.stale(a)==="orphaned"&&v.push({kind:"REMOVE",ref:y(r,a),reason:"orphaned \u2014 no live source evidences this use-case",provenance:q(r,a),action:"plan-only \u2014 REMOVE is not executed in this release"});let S=new Set,w=[...f.sort(O),...u.sort(O),...E.sort(O),...c.sort(O),...p.sort(O),...v.sort(O)].filter(a=>{let _=`${a.kind}\0${a.ref}`;return S.has(_)?!1:(S.add(_),!0)});return{source_id:n,changed:!0,head:{status:g.status,before:d,after:g.cid},note:te,skipped_arms:B,changeset:le(e,o,r,n,g.cid,l.minted,l.held),rows:w,...l.held?{held:l.held}:{}}}function be(e,n){return async t=>{let{ingestFile:i}=await import("./ingest-
|
|
12
|
+
${s}`,truncated:!0}}function ae(e,n){let t=x(e),i=t.heads.get(n);if(typeof i!="string")return null;let o=[];for(let u of V(e).records){let c=u.source_head_moves?.[n];c!==void 0&&c!==o[o.length-1]&&o.push(c)}let d=o.lastIndexOf(i),s=d>0?o[d-1]:null;if(typeof s!="string"||s===i)return null;let g=L(e,t,s),l=L(e,t,i);if(g===null||l===null)return null;let{diff:r,truncated:f}=ce(oe(g,l)),m=new Set,p=[];for(let u of t.edgesFrom(s))u.type!==$.DERIVES||t.nodeLabel.get(u.dst)!==b.USECASE||m.has(u.dst)||(m.add(u.dst),p.push({id:u.dst,title:String(t.getNode(u.dst)?.content.title??"")}));return{source_id:n,old_head:s,new_head:i,diff:r,...f?{truncated:!0}:{},prior_ucs:p}}function de(e,n,t){let i=e.getNode(n)?.content??{},o=e.getNode(t)?.content??{},s=[...new Set([...Object.keys(i),...Object.keys(o)])].sort().filter(g=>JSON.stringify(i[g])!==JSON.stringify(o[g]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function le(e,n,t,i,o,d,s){let g=new Set((s?.rows??[]).map(c=>c.matched_cid).filter(c=>!!c)),l=[];for(let[c,h]of t.superseded)h===null||c===h||n.superseded.has(c)||t.nodeLabel.get(c)===b.USECASE&&l.push({kind:"MODIFY",ref:y(t,c),old_cid:c,new_cid:h,summary:de(t,c,h)});let r=d.map(c=>({kind:"ADD",ref:y(t,c),cid:c}));for(let c of s?.rows??[])c.kind==="MODIFY"&&c.matched_cid?l.push({kind:"MODIFY",ref:y(t,c.matched_cid),old_cid:c.matched_cid,new_cid:null,summary:`${c.why} (staged)`}):c.kind==="ADD"&&r.push({kind:"ADD",ref:c.title,cid:null});let f=[],m=L(e,t,o),p=new Map;for(let{cid:c}of t.byLabel(b.USECASE)){if(!T(t,c)||g.has(c))continue;let h=t.derivesInto(c),E=h.filter(w=>String(w.props.source_id)===i);E.length===0||E.some(w=>w.props.source_cid===o)||E.some(w=>{let a=String(w.props.anchor),_=D(a);return _?.kind==="img-whole"?!1:_?.kind==="img-part"?se(t,w,o):m!==null&&re(e,t,w,m,p)})||h.some(w=>{let a=String(w.props.source_id);if(a===i)return!1;let _=t.heads.get(a);return _!=null})||f.push({kind:"ARCHIVE",ref:y(t,c),cid:c,why:`evidence decayed: no quote from ${i} relocates into @${C(o)}, no other live source, no fresh evidence this run`,impact:J(t,t.tipOf(c))})}let u=(c,h)=>c.ref<h.ref?-1:c.ref>h.ref?1:0;return[...l.sort(u),...r.sort(u),...f.sort(u)]}function Ee(e,n,t,i,o){let d=n.rows.find(u=>u.temp_ref===t);if(!d)return{ok:!1,message:`held item ${t} missing from the plan artifact`};let s=d,g=x(e);if(s.matched_cid){let u=g.tipOf(s.matched_cid);if(g.superseded.get(u)===null)return{ok:!1,message:`use-case for "${s.title}" was retired meanwhile \u2014 nothing to update`};u!==s.matched_cid&&(s={...s,matched_cid:u,uc:{...s.uc,matches_existing:{cid:u}}})}let l=o?{edited:o}:"approve",r=W(e,g,{source_id:n.source_id,...n.staged_source_cid!==void 0?{staged_source_cid:n.staged_source_cid}:{},rows:[s]},new Map([[s.temp_ref,l]]),i);if(r.errors)return{ok:!1,message:r.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let f=x(e),m=s.matched_cid?f.tipOf(s.matched_cid):r.record?.nodes.find(u=>u.label==="usecase")?.cid??r.record?.review[0]?.id;return{ok:!0,ref:m?y(f,m):s.title,kind:s.kind}}async function ve(e,n,t,i={}){let o=x(e),d=o.heads.get(n)??null,s=new Set(o.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),g=await t.reingest(n);if(g.status==="unchanged"&&!i.resumeHeld)return{source_id:n,changed:!1,head:{status:g.status,before:d,after:g.cid},note:`nothing to reconcile \u2014 ${n} is unchanged`,skipped_arms:B,changeset:[],rows:[]};let l=i.resumeHeld?{minted:[],matched:[],held:i.resumeHeld}:await t.reextract(n),r=x(e),f=l.minted.map(a=>{let _=y(r,a);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${n}`,provenance:`extraction commit \u2014 DERIVES ${n} @ ${C(g.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=r.staleList().filter(a=>a.state==="stale"&&!s.has(a.cid)&&T(r,a.cid)).map(a=>a.cid),p=m.map(a=>{let _=y(r,a),R=ne.has(r.nodeLabel.get(a)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:q(r,a),action:R?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],c=[];for(let a of l.held?.rows??[])if(a.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${C(g.cid)}`,action:"approve to commit + design"});else{let _=a.matched_cid?r.tipOf(a.matched_cid):null,R=_?r.getNode(_)?.content.criteria??[]:[],I=(a.uc.updated?.criteria??[]).map(k=>typeof k=="string"?k:k.text),Q=[...I.filter(k=>!R.includes(k)),...a.uc.updated?.criteria!==void 0?R.filter(k=>!I.includes(k)):[]],H=_?J(r,_,Q):void 0;c.push({kind:"MODIFY",origin:"content-change",ref:a.matched_cid?y(r,a.matched_cid):a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${C(g.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...H?{impact:H}:{}})}let h=new Set;for(let a of[...l.minted,...l.matched])h.add(r.tipOf(a));for(let a of l.held?.rows??[])a.matched_cid&&h.add(r.tipOf(a.matched_cid));for(let a of m){let _=Y(r,r.tipOf(a));_&&r.nodeLabel.get(_)===b.USECASE&&h.add(r.tipOf(_))}let E=[];for(let a of await F(r,"design")){if(a.kind!=="no-verifies")continue;let _=r.resolve(a.ref);if(!_)continue;let R=Y(r,_.tip);!R||!h.has(r.tipOf(R))||E.push({kind:"ADD",origin:"content-change",ref:a.ref,reason:a.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${y(r,R)}`,action:a.ready_command})}let v=[];for(let{cid:a}of r.byLabel(b.USECASE))T(r,a)&&r.stale(a)==="orphaned"&&v.push({kind:"REMOVE",ref:y(r,a),reason:"orphaned \u2014 no live source evidences this use-case",provenance:q(r,a),action:"plan-only \u2014 REMOVE is not executed in this release"});let S=new Set,w=[...f.sort(O),...u.sort(O),...E.sort(O),...c.sort(O),...p.sort(O),...v.sort(O)].filter(a=>{let _=`${a.kind}\0${a.ref}`;return S.has(_)?!1:(S.add(_),!0)});return{source_id:n,changed:!0,head:{status:g.status,before:d,after:g.cid},note:te,skipped_arms:B,changeset:le(e,o,r,n,g.cid,l.minted,l.held),rows:w,...l.held?{held:l.held}:{}}}function be(e,n){return async t=>{let{ingestFile:i}=await import("./ingest-FIIO67ZN.js"),{convertPdf:o}=await import("./pdf-convert-S7VYE6AV.js"),{convertDocx:d}=await import("./docx-convert-ZBVQO2LG.js"),s=await i({contextDir:e,filePath:n,asId:t,converters:{pdf:o,docx:d}});return{status:s.status,cid:s.cid}}}function Re(e,n={}){return async t=>{let i=[],[{runExtract:o},{resolveAgentAuthEnv:d},{runAgent:s},{preflightTurn:g}]=await Promise.all([import("./run-YGJZ2SXX.js"),import("./spawner-YNYB4Z7K.js"),import("./bridge-BTSWCJ3B.js"),import("./turn-preflight-JGYT7LXP.js")]),l=await d(),r=new Set(x(e).byLabel(b.USECASE).map(S=>S.cid)),f=ae(e,t)??void 0,m=0,p=await o({mode:"override",...f?{changeContext:f}:{}},{contextDir:e,agent:s,preflightTurn:()=>g(l),ask:async()=>[],review:async S=>{if(!n.stage)return new Map(S.map(a=>[a.temp_ref,{resolution:a.matches_existing&&a.changed?"edited":"skipped"}]));let w=new Map;for(let a of S){if(a.matches_existing&&!a.changed){w.set(a.temp_ref,{resolution:"skipped"});continue}i.push({kind:a.matches_existing?"MODIFY":"ADD",temp_ref:a.temp_ref,title:a.title,why:a.matches_existing?`updated: ${Object.keys(a.updated??{}).join(", ")||"content"}`:`newly extracted from ${t}`,...a.matches_existing?{matched_cid:a.matches_existing.cid,updated:a.updated}:{},uc:a}),w.set(a.temp_ref,{resolution:"rejected"})}return w},confirmStale:async()=>!1,out:S=>process.stderr.write(S+`
|
|
13
13
|
`),progress:S=>process.stderr.write(S+`
|
|
14
14
|
`),emit:S=>{S.type==="commit"&&typeof S.assumed=="number"&&(m+=S.assumed)},isTTY:!1,auth:l});if(p!==0)throw new Error(`reconcile: re-extract of ${t} failed (exit ${p})`);let u=x(e),c=u.heads.get(t),h=[],E=[];if(typeof c=="string"){let S=new Set;for(let w of u.edgesFrom(c))w.type!==$.DERIVES||u.nodeLabel.get(w.dst)!==b.USECASE||S.has(w.dst)||(S.add(w.dst),!(n.stage&&u.trust.get(w.dst)==="archived")&&(r.has(w.dst)?E:h).push(w.dst))}let v=x(e).heads.get(t);return{minted:h,matched:E,defaultsTaken:m,...n.stage?{held:{source_id:t,...v!=null?{staged_source_cid:v}:{},rows:i}}:{}}}}export{Ee as a,ve as b,be as c,Re as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as M,f as R,h as j,i as y}from"./chunk-ZPDM6FO7.js";import{j as k}from"./chunk-
|
|
2
|
+
import{e as M,f as R,h as j,i as y}from"./chunk-ZPDM6FO7.js";import{j as k}from"./chunk-6W6AIDLJ.js";import{existsSync as A,mkdirSync as W,readdirSync as B,readFileSync as N,renameSync as E,writeFileSync as G}from"fs";import{join as p}from"path";var P=/^@import\s+(\S+)\s*$/;function O(e,n){let s=e.resolve(n),l=s?String(e.getNode(s.tip)?.content.title??""):"";return l&&k(l,()=>!1)||n}function D(e){return p(e,".testmuai","tests")}function L(e){let n=new Map;if(!A(e))return n;for(let s of B(e)){if(!s.endsWith("_test.md"))continue;let l=p(e,s);try{let r=y(N(l,"utf8"))?.id;r&&n.set(r,[...n.get(r)??[],l])}catch{}}return n}function q(e,n){let s=`${e}.tmp-mint`;G(s,n),E(s,e)}function U(e){let{graph:n,cids:s,cwd:l}=e,r=D(l),w=[],d=[],m=L(r),$=new Set,b=(t,f)=>{let c=m.get(t);if(c&&c.length>1)return d.push({id:t,reason:`two files claim assurance.id ${t}: ${c.join(" \xB7 ")} \u2014 resolve the duplicate first`}),null;if($.has(t))return I(t);if(f.includes(t))return I(t)??`${O(n,t)}_test.md`;let S=n.resolve(t),v=S?n.getNode(S.tip):void 0,x=v?.content.test_md_blob,F=v?.content.definitionId;if(!x||!F)return d.push({id:t,reason:`${t} has no test definition in the graph`}),null;let h=x.split(`
|
|
3
3
|
`).map(o=>{let i=P.exec(o.trim());if(!i)return o;let u=i[1];if(!n.resolve(u))return o;let _=b(u,[...f,t]);if(!_)throw new g(`dependency ${u} could not be minted/located`);return`@import ./${_}`}).join(`
|
|
4
4
|
`),T=`---
|
|
5
5
|
assurance:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
function l(r){let{isAgent:c,log:m}=r,a=r.stdout??process.stderr,s=r.stdin??process.stdin,p=t=>{c&&process.stdout.write(JSON.stringify(t)+`
|
|
3
|
-
`)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-
|
|
3
|
+
`)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-SNYEO6CS.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{waitUntilExit:d}=o(e.createElement(n,null,e.createElement(i,t)),{stdout:a,stdin:s,exitOnCtrlC:!1});await d()},async runUpload(t,e){let{renderUploadProgress:o}=await import("./CliUploadProgress-AIZL7N6Z.js");return await o(t,e)},async onSummary(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{AutoExitSummaryBox:i}=await import("./SummaryBox-4SZI4XSO.js"),{waitUntilExit:n}=o(e.createElement(i,{data:t}),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(e)})}},async onLinks(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{LinksBox:i}=await import("./LinksBox-NCFNBUMW.js"),{waitUntilExit:n}=o(e.createElement(i,t),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(e)})}},onLockState(t){p({type:"test_md_lock_state",...t})},onRetryAttempt(t){p({type:"test_md_retry_attempt",...t})},onAgentEvent(t){p(t)}}}export{l as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-
|
|
2
|
+
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-RQYS3KGU.js";import{a as k}from"./chunk-2WVKOZ6W.js";import{a as B}from"./chunk-A2IQRVPR.js";import{a as R}from"./chunk-4GLYNAK7.js";import{y as c}from"./chunk-B4LLKQTK.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=B(m),s=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{y as n}from"./chunk-
|
|
2
|
+
import{y as n}from"./chunk-B4LLKQTK.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as m}from"./chunk-L5LI2JF4.js";import{c as
|
|
3
|
-
`)}function
|
|
4
|
-
\u26A0 Failed to create ${
|
|
2
|
+
import{a as _}from"./chunk-TDPWFYTJ.js";import{b as m}from"./chunk-L5LI2JF4.js";import{c as h}from"./chunk-B4LLKQTK.js";import{randomUUID as F}from"crypto";import{mkdirSync as A,writeFileSync as v,appendFileSync as O,existsSync as b}from"fs";import{join as u}from"path";import{writeFileSync as x,mkdirSync as I,existsSync as j}from"fs";import{join as p,relative as L}from"path";function f(n){let t=Object.keys(n.frontmatter).length>0?m(n.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${n.heading}`,""),n.steps.forEach((i,r)=>{s.push(`## Step ${r+1}`,i,"")}),s.join(`
|
|
3
|
+
`)}function T(n,e){let t={},s={},i=e;for(let[r,l]of Object.entries(n)){if(r.startsWith("global.")||r.startsWith("secrets.user.")||r.startsWith("environment.")){let o=r.startsWith("secrets.user.");t[r]={value:l.value,secret:o,syntax:`{{${r}}}`,type:o?"secret":r.startsWith("environment.")?"environment":"global"},s[r]=r;continue}if(l.secret){let o=`secrets.user.${r}`;t[o]={value:l.value,secret:!0,syntax:`{{secrets.user.${r}}}`,type:"secret"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{secrets.user.${r}}}`)}else{let o=`global.${r}`;t[o]={value:l.value,secret:!1,syntax:`{{global.${r}}}`,type:"global"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{global.${r}}}`)}}return{variables:t,objective:i,keyMap:s}}var w=/\{\{\s*(?:global|secrets\.user|environment)\.([^{}]+?)\s*\}\}/g;function c(n){return typeof n!="string"||!n.includes("{{")?n:n.replace(w,"{{$1}}")}function d(n){if(typeof n=="string")return c(n);if(Array.isArray(n))return n.map(e=>d(e));if(n&&typeof n=="object"){let e={};for(let[t,s]of Object.entries(n))e[t]=d(s);return e}return n}var N=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),$=new Set(["model","env"]),g=class{constructor(e){this.opts=e}objectives=[];flushed=!1;lastWrittenPath=null;lastCollisionSuffixed=!1;appendObjective(e){this.objectives.push(e)}flush(){if(this.flushed||(this.flushed=!0,this.objectives.length===0))return;let e=this.opts.getName();if(!e)return;let t=p(this.opts.cwd,".testmuai","tests");try{I(t,{recursive:!0})}catch(a){process.stderr.write(`
|
|
4
|
+
\u26A0 Failed to create ${L(this.opts.cwd,t)}/
|
|
5
5
|
${a.message}
|
|
6
6
|
Your test recording was NOT saved.
|
|
7
7
|
|
|
8
|
-
`);return}let s=
|
|
8
|
+
`);return}let s=p(t,`${e}_test.md`),i=2,r=!1;for(;j(s);)s=p(t,`${e}-${i}_test.md`),i++,r=!0;let l=d(E(this.opts.getResolvedGlobal())),o=f({frontmatter:l,heading:`Session: ${e}`,steps:this.objectives.map(c)});try{x(s,o,"utf8")}catch(a){process.stderr.write(`
|
|
9
9
|
\u26A0 Failed to save your test recording.
|
|
10
10
|
${a.message}
|
|
11
11
|
Path: ${s}
|
|
12
12
|
|
|
13
|
-
`);return}this.lastWrittenPath=s,this.lastCollisionSuffixed=r}};function
|
|
14
|
-
`)}}start(e){if(!this._started){this._started=!0,this._model=e.model,this._environment=e.environment,this._profile=e.profile,this._startedAt=new Date().toISOString();try{
|
|
15
|
-
`)}catch{}this._log(`SESSION START session_id=${this.sessionId}`),this._log(`CONFIG model=${e.model} env=${e.environment} profile=${e.profile}`),this._earlyLogBuffer.push({level:"info",event:"SESSION_START",message:"Session started",context:{session_id:this.sessionId}},{level:"info",event:"CONFIG",message:"Session config",context:{model:e.model,environment:e.environment,profile:e.profile}})}}setPlan(e){this._plan=e;let t={level:"info",event:"SESSION_INFO",message:"Session info",context:{session_id:this.sessionId,plan:e??null}};this._remoteLogger?this._remoteLogger.log(t.level,t.event,t.message,t.context):this._earlyLogBuffer.push(t)}get plan(){return this._plan}setRemoteLogger(e){this._remoteLogger=e;for(let t of this._earlyLogBuffer)e.log(t.level,t.event,t.message,t.context);this._earlyLogBuffer=[]}get hasRemoteLogger(){return this._remoteLogger!==null}setAuteurVariables(e){Object.assign(this._auteurVariables,e)}get auteurVariables(){return this._auteurVariables}setScreenshotSas(e){this._screenshotSas=e}get screenshotSas(){return this._screenshotSas}get screenshotBaseUrl(){return this._screenshotSas?`${this._screenshotSas.base_url}/${this._screenshotSas.container}`:""}get startedAt(){return this._startedAt||new Date().toISOString()}log(e,t,s,i){if(t===void 0){this._log(e);let o=e.indexOf(" "),a=o>0?e.slice(0,o):e,
|
|
16
|
-
`),this.flushRecorder(),this._recorder=null}nextRunIndex(){return this._nextIndex}addRunResult(e,t){this.runs.push(e),this._nextIndex+=t??1,this._recordingEnabled&&this._recorder?.appendObjective(e.objective)}getContext(){return{prior_runs:this.runs.map(e=>({index:e.index,objective:e.objective,summary:e.summary,status:e.status,memory:e.context.memory,variables:e.context.variables,pointer:e.context.pointer}))}}addFlow(e){let t={...e,index:this._flows.length+1};return this._flows.push(t),t}getFlows(){return[...this._flows]}getFlow(e){return this._flows.find(t=>t.index===e)}clearFlows(){this._flows=[]}recordStepRun(e){this._stepRunRecords.push(e)}getStepRunRecords(){return[...this._stepRunRecords]}getRunsAsStepRecords(){return this.runs.map((e,t)=>({testmdStepIndex:t+1,runIndex:e.index,totalRunDirs:e.run_dirs?.length??1}))}snapshot(){return{runsLen:this.runs.length,nextRunIndex:this._nextIndex,stepRunRecordsLen:this._stepRunRecords.length}}rollback(e){this.runs.length=e.runsLen,this._nextIndex=e.nextRunIndex,this._stepRunRecords.length=e.stepRunRecordsLen}setTestId(e){this._testId=e}get testId(){return this._testId}setTestcaseId(e){this._testcaseId=e}get testcaseId(){return this._testcaseId}setProjectId(e){this._projectId=e}setOrgId(e){this._orgId=e}get orgId(){return this._orgId}setUserIdentity(e,t){e&&(this._userName=e),t&&(this._userEmail=t)}get userName(){return this._userName}get userEmail(){return this._userEmail}setFirstRun(e,t){this._firstObjective||(this._firstObjective=e,this._firstUrl=t)}get firstObjective(){return this._firstObjective}get firstUrl(){return this._firstUrl}getRunDirs(){let e=[];for(let t of this.runs)t.run_dirs&&t.run_dirs.length>0?e.push(...t.run_dirs):t.run_dir&&e.push(t.run_dir);return e}getRunObjectives(){let e=[];for(let t of this.runs)t.flow_objectives&&t.flow_objectives.length>0?e.push(...t.flow_objectives):e.push(t.objective);return e}getRunMetadata(){let e=[];for(let t of this.runs)if(t.perFlowMetadata&&t.perFlowMetadata.length>0)e.push(...t.perFlowMetadata);else{let s={resultCode:t.resultCode,reasonCode:t.reasonCode,errorMessage:t.status==="failed"?t.summary??null:null,summary:t.summary,oneLiner:t.oneLiner},i=t.run_dirs?.length??1;for(let r=0;r<i;r++)e.push(s)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e,t){if(!(!this._started||!
|
|
17
|
-
`)}catch{}}};export{
|
|
13
|
+
`);return}this.lastWrittenPath=s,this.lastCollisionSuffixed=r}};function E(n){let e={};for(let[t,s]of Object.entries(n))N.has(t)||$.has(t)||(e[t]=s);return e}var D=u(h,"sessions"),R=class{sessionId;sessionDir;runs=[];_flows=[];_nextIndex=0;_started=!1;_testId=null;_testcaseId=null;_projectId=null;_orgId=null;_userName=null;_userEmail=null;_uploadStatus="pending";_uploadAttempts=0;_uploadError=null;_firstObjective=null;_firstUrl=null;_auteurVariables={};_screenshotSas=null;_model="";_environment="";_profile=null;_plan=null;_startedAt="";_remoteLogger=null;_earlyLogBuffer=[];_recorder=null;_resolvedGlobal={};_sessionName=null;_recordingEnabled=!0;_stepRunRecords=[];constructor(e){this.sessionId=F();let t=e?.baseDir?u(e.baseDir,"sessions"):D;this.sessionDir=u(t,this.sessionId)}setResolvedGlobal(e){this._resolvedGlobal={...this._resolvedGlobal,...e}}setSessionName(e){this._sessionName=e}get sessionName(){return this._sessionName}setRecordingEnabled(e){this._recordingEnabled=e}get recorder(){return this._recorder}flushRecorder(){try{this._recorder?.flush()}catch(e){process.stderr.write(`[recorder] flush failed: ${e.message}
|
|
14
|
+
`)}}start(e){if(!this._started){this._started=!0,this._model=e.model,this._environment=e.environment,this._profile=e.profile,this._startedAt=new Date().toISOString();try{A(this.sessionDir,{recursive:!0}),this._recorder=new g({cwd:process.cwd(),getResolvedGlobal:()=>this._resolvedGlobal,getName:()=>this._sessionName});let t={session_id:this.sessionId,started_at:this._startedAt,model:e.model,environment:e.environment,profile:e.profile,plan:this._plan,objectives:[],runs:[],status:"in_progress"};v(u(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
|
|
15
|
+
`)}catch{}this._log(`SESSION START session_id=${this.sessionId}`),this._log(`CONFIG model=${e.model} env=${e.environment} profile=${e.profile}`),this._earlyLogBuffer.push({level:"info",event:"SESSION_START",message:"Session started",context:{session_id:this.sessionId}},{level:"info",event:"CONFIG",message:"Session config",context:{model:e.model,environment:e.environment,profile:e.profile}})}}setPlan(e){this._plan=e;let t={level:"info",event:"SESSION_INFO",message:"Session info",context:{session_id:this.sessionId,plan:e??null}};this._remoteLogger?this._remoteLogger.log(t.level,t.event,t.message,t.context):this._earlyLogBuffer.push(t)}get plan(){return this._plan}get apMode(){return _()??"v2"}setRemoteLogger(e){this._remoteLogger=e;for(let t of this._earlyLogBuffer)e.log(t.level,t.event,t.message,t.context);this._earlyLogBuffer=[]}get hasRemoteLogger(){return this._remoteLogger!==null}setAuteurVariables(e){Object.assign(this._auteurVariables,e)}get auteurVariables(){return this._auteurVariables}setScreenshotSas(e){this._screenshotSas=e}get screenshotSas(){return this._screenshotSas}get screenshotBaseUrl(){return this._screenshotSas?`${this._screenshotSas.base_url}/${this._screenshotSas.container}`:""}get startedAt(){return this._startedAt||new Date().toISOString()}log(e,t,s,i){if(t===void 0){this._log(e);let o=e.indexOf(" "),a=o>0?e.slice(0,o):e,S=o>0?e.slice(o+1):"",y=/fail|error/i.test(e)?"error":"info";this._remoteLogger?.log(y,a,S||e);return}let r=e,l=s;this._log(`${t} ${l}`,i),this._remoteLogger?.log(r,t,l,i)}logStep(e,t,s){this._log(`${e} ${t}`,s);let i=this._nextIndex>0?this._nextIndex-1:0;this._remoteLogger?.logStep(i,e,t,s)}logCommand(e){this._log(`COMMAND ${e}`)}logRunStart(e,t,s){this._log(`RUN ${e} START objective="${t.slice(0,100)}" url=${s}`),this._remoteLogger?.setRunIndex(e),this._remoteLogger?.log("info","RUN_START",`Run ${e} started`,{run_index:e,objective:t,url:s})}logRunEnd(e,t,s,i,r){let l=(s??0).toFixed(1),o=(i??"").slice(0,100),a=r==null||r===""||Number.isNaN(Number(r))?null:Number(r);this._log(`RUN ${e} END status=${t} duration=${l}s summary="${o}"`,a!=null?{result_code:a}:void 0),this._remoteLogger?.log("info","RUN_END",`Run ${e} ended`,{run_index:e,status:t,duration:s??0,summary:i??"",result_code:a}),t!=="failed"&&t!=="error"&&this._remoteLogger?.discardSteps(e)}escalateRun(e){this._remoteLogger?.escalate(e)}logChromeLaunch(e,t){this._log(`CHROME LAUNCH port=${e} endpoint=${t}`),this._remoteLogger?.log("info","CHROME_LAUNCH","Chrome launched",{port:e,cdp_endpoint:t})}async finish(e="complete"){this._log(`SESSION END status=${e} total_runs=${this.runs.length}`),this._remoteLogger?.log("info","SESSION_END","Session ended",{status:e,total_runs:this.runs.length}),await this._remoteLogger?.shutdown();let t={session_id:this.sessionId,started_at:this._startedAt,ended_at:new Date().toISOString(),model:this._model,environment:this._environment,profile:this._profile,plan:this._plan,status:e,total_runs:this.runs.length,test_id:this._testId,testcase_id:this._testcaseId,commit_id:this.sessionId,project_id:this._projectId,upload_status:this._uploadStatus,upload_attempts:this._uploadAttempts,last_upload_attempt:this._uploadAttempts>0?new Date().toISOString():null,upload_error:this._uploadError,runs:this.runs.map(s=>({index:s.index,objective:s.objective,status:s.status,summary:s.summary,run_dir:s.run_dir}))};b(this.sessionDir)&&v(u(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
|
|
16
|
+
`),this.flushRecorder(),this._recorder=null}nextRunIndex(){return this._nextIndex}addRunResult(e,t){this.runs.push(e),this._nextIndex+=t??1,this._recordingEnabled&&this._recorder?.appendObjective(e.objective)}getContext(){return{prior_runs:this.runs.map(e=>({index:e.index,objective:e.objective,summary:e.summary,status:e.status,memory:e.context.memory,variables:e.context.variables,pointer:e.context.pointer}))}}addFlow(e){let t={...e,index:this._flows.length+1};return this._flows.push(t),t}getFlows(){return[...this._flows]}getFlow(e){return this._flows.find(t=>t.index===e)}clearFlows(){this._flows=[]}recordStepRun(e){this._stepRunRecords.push(e)}getStepRunRecords(){return[...this._stepRunRecords]}getRunsAsStepRecords(){return this.runs.map((e,t)=>({testmdStepIndex:t+1,runIndex:e.index,totalRunDirs:e.run_dirs?.length??1}))}snapshot(){return{runsLen:this.runs.length,nextRunIndex:this._nextIndex,stepRunRecordsLen:this._stepRunRecords.length}}rollback(e){this.runs.length=e.runsLen,this._nextIndex=e.nextRunIndex,this._stepRunRecords.length=e.stepRunRecordsLen}setTestId(e){this._testId=e}get testId(){return this._testId}setTestcaseId(e){this._testcaseId=e}get testcaseId(){return this._testcaseId}setProjectId(e){this._projectId=e}setOrgId(e){this._orgId=e}get orgId(){return this._orgId}setUserIdentity(e,t){e&&(this._userName=e),t&&(this._userEmail=t)}get userName(){return this._userName}get userEmail(){return this._userEmail}setFirstRun(e,t){this._firstObjective||(this._firstObjective=e,this._firstUrl=t)}get firstObjective(){return this._firstObjective}get firstUrl(){return this._firstUrl}getRunDirs(){let e=[];for(let t of this.runs)t.run_dirs&&t.run_dirs.length>0?e.push(...t.run_dirs):t.run_dir&&e.push(t.run_dir);return e}getRunObjectives(){let e=[];for(let t of this.runs)t.flow_objectives&&t.flow_objectives.length>0?e.push(...t.flow_objectives):e.push(t.objective);return e}getRunMetadata(){let e=[];for(let t of this.runs)if(t.perFlowMetadata&&t.perFlowMetadata.length>0)e.push(...t.perFlowMetadata);else{let s={resultCode:t.resultCode,reasonCode:t.reasonCode,errorMessage:t.status==="failed"?t.summary??null:null,summary:t.summary,oneLiner:t.oneLiner},i=t.run_dirs?.length??1;for(let r=0;r<i;r++)e.push(s)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e,t){if(!(!this._started||!b(this.sessionDir)))try{let s=new Date().toISOString().slice(0,19).replace("T"," "),i=u(this.sessionDir,"tui.log"),r=t&&Object.keys(t).length>0?` ${JSON.stringify(t)}`:"";O(i,`[${s}] ${e}${r}
|
|
17
|
+
`)}catch{}}};export{f as a,T as b,R as c};
|