@testmuai/kane-cli 0.8.15 → 0.8.16
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-2GPR4S7I.js → ChatSurface-5JEEFY34.js} +1 -1
- package/dist/{ChromeProfilePicker-XAZGCJKR.js → ChromeProfilePicker-6IVAYCWJ.js} +1 -1
- package/dist/{CliFeedbackPrompt-4SILDU7S.js → CliFeedbackPrompt-K4IN7S6J.js} +1 -1
- package/dist/{CliUploadProgress-OAQBY55Y.js → CliUploadProgress-MI4H4LKT.js} +1 -1
- package/dist/{ConfigView-FDBMJC26.js → ConfigView-CJY5MB6H.js} +1 -1
- package/dist/{EvidenceViewOffer-YSNRKKPC.js → EvidenceViewOffer-ABKTGD4K.js} +1 -1
- package/dist/FolderPicker-RQIVS7ZR.js +2 -0
- package/dist/{InfoBox-ZPUBB7J4.js → InfoBox-RP6RDCG7.js} +1 -1
- package/dist/{LinksBox-MNNNOH23.js → LinksBox-QOQJ3S2I.js} +1 -1
- package/dist/{ProfilesView-GY5QCIT3.js → ProfilesView-BZEBT6R5.js} +1 -1
- package/dist/{ProjectPicker-UCHMCNFV.js → ProjectPicker-J42MEJRQ.js} +1 -1
- package/dist/{SaveSessionPrompt-ATVHKAHN.js → SaveSessionPrompt-MKAIUVX7.js} +1 -1
- package/dist/SingleShotApp-TZZ2J7ZO.js +2 -0
- package/dist/{SummaryBox-2DTNE25L.js → SummaryBox-JQJKGYDM.js} +1 -1
- package/dist/TestMdRunView-2YVGGFLU.js +2 -0
- package/dist/{TestrunEvidenceTable-6UE5EMON.js → TestrunEvidenceTable-FYDS3ZVU.js} +1 -1
- package/dist/{WhoamiView-TFCHIOW5.js → WhoamiView-F4PPB7SN.js} +1 -1
- package/dist/{app-download-N7MLJQ42.js → app-download-RA4CGTC5.js} +1 -1
- package/dist/{auth-IQPCVCZK.js → auth-TAT427C3.js} +1 -1
- package/dist/{binary-VML7EGV4.js → binary-OFPMBJ34.js} +1 -1
- package/dist/{bind-YV6V5AI6.js → bind-LY362KX7.js} +2 -2
- package/dist/{bootstrap-KCPWDBLX.js → bootstrap-RCDB5OWA.js} +1 -1
- package/dist/bridge-E2NGMJYM.js +2 -0
- package/dist/{changelog-CJFWGRIL.js → changelog-ZC3LHV2Z.js} +1 -1
- package/dist/{chunk-MLYNVJNH.js → chunk-23MVD7GY.js} +1 -1
- package/dist/{chunk-5HTSKF5K.js → chunk-2GWMENG5.js} +1 -1
- package/dist/{chunk-ORQGQSWG.js → chunk-3AVBUEBL.js} +2 -2
- package/dist/chunk-3LXN6AV5.js +5 -0
- package/dist/{chunk-EDQZIEPJ.js → chunk-3MVEGB2I.js} +1 -1
- package/dist/{chunk-FXO7JKMZ.js → chunk-4LVZLLTN.js} +3 -3
- package/dist/{chunk-3D5MKSG3.js → chunk-4PWYSDZR.js} +1 -1
- package/dist/{chunk-SIYSKT6I.js → chunk-4WEVTED6.js} +1 -1
- package/dist/{chunk-7EGIX6Y4.js → chunk-5ACSALRU.js} +3 -3
- package/dist/{chunk-WNB2IYHY.js → chunk-5VZAWKDF.js} +1 -1
- package/dist/{chunk-3GELV4IN.js → chunk-6HCY5LJO.js} +14 -14
- package/dist/{chunk-JFUFWICY.js → chunk-7P6FSGRD.js} +2 -2
- package/dist/{chunk-QXRT6HSV.js → chunk-7QUFOWMU.js} +1 -1
- package/dist/{chunk-KUS324VE.js → chunk-7XMDCGIZ.js} +1 -1
- package/dist/{chunk-EJXBKCNF.js → chunk-AAT4O22C.js} +1 -1
- package/dist/{chunk-DMCEGMGB.js → chunk-AGKE5WF3.js} +1 -1
- package/dist/{chunk-EPE2ELDH.js → chunk-BCJNIDS3.js} +1 -1
- package/dist/{chunk-6L5RV62W.js → chunk-BK42G6RI.js} +1 -1
- package/dist/{chunk-OWGFFJKK.js → chunk-BY2MU3ZS.js} +1 -1
- package/dist/{chunk-IAHOLH5W.js → chunk-C6JFTSIQ.js} +1 -1
- package/dist/{chunk-YAAQER2L.js → chunk-CDWUZ54U.js} +1 -1
- package/dist/{chunk-7WDPU33M.js → chunk-CR7UWQ76.js} +1 -1
- package/dist/{chunk-ZCSEBT2W.js → chunk-CVNHUDT4.js} +1 -1
- package/dist/{chunk-6DHEOPXX.js → chunk-DSWHEEHN.js} +1 -1
- package/dist/{chunk-UHSNUUX3.js → chunk-E44OHYDS.js} +2 -2
- package/dist/{chunk-RI4ILZZC.js → chunk-ECIGXPLN.js} +1 -1
- package/dist/{chunk-WFBJNVMQ.js → chunk-EMAKLNDV.js} +1 -1
- package/dist/{chunk-HYTBEPC2.js → chunk-F2XTOZTN.js} +1 -1
- package/dist/{chunk-XXE7W5AV.js → chunk-FQFVAFWK.js} +1 -1
- package/dist/{chunk-VZDLRJ5N.js → chunk-FWPRUGJJ.js} +1 -1
- package/dist/{chunk-GZ65ZA4C.js → chunk-FYJ62EVY.js} +1 -1
- package/dist/{chunk-74FHTDEE.js → chunk-G2ZMNVYN.js} +1 -1
- package/dist/{chunk-DMT3W26F.js → chunk-GCMJDOAE.js} +1 -1
- package/dist/{chunk-6GLFQHSW.js → chunk-GGD7NKPL.js} +2 -2
- package/dist/{chunk-Z73ZYROU.js → chunk-H6S7L2I2.js} +1 -1
- package/dist/{chunk-TVELOH5A.js → chunk-HBMNUT6E.js} +1 -1
- package/dist/{chunk-KALEPJAV.js → chunk-HYCOX7AB.js} +2 -2
- package/dist/{chunk-A557OSRS.js → chunk-ICUTARPB.js} +1 -1
- package/dist/{chunk-BMVE73M7.js → chunk-IJTSA34Q.js} +1 -1
- package/dist/chunk-IQDZ6YMY.js +18 -0
- package/dist/{chunk-OFWJBOGT.js → chunk-IYOPWIG4.js} +2 -2
- package/dist/{chunk-YGMUNNKH.js → chunk-IZ5CTC6M.js} +1 -1
- package/dist/{chunk-N3CVR4Z2.js → chunk-J2LWXO55.js} +1 -1
- package/dist/{chunk-TEHZUSUY.js → chunk-KPL2XHYF.js} +1 -1
- package/dist/{chunk-2WRBCTNM.js → chunk-KYZKPNPQ.js} +1 -1
- package/dist/chunk-L45HDSJ7.js +15 -0
- package/dist/{chunk-SHSXOYKT.js → chunk-MD3S2RXN.js} +1 -1
- package/dist/{chunk-JGAMMOUC.js → chunk-MU3I453X.js} +1 -1
- package/dist/{chunk-YZVR7ESF.js → chunk-MZYPDLD3.js} +1 -1
- package/dist/{chunk-JCMHB4KH.js → chunk-NADKZKGS.js} +1 -1
- package/dist/{chunk-W77SZLFC.js → chunk-NMBFAIXZ.js} +1 -1
- package/dist/{chunk-XSUJJB7Z.js → chunk-NN6UG2BE.js} +1 -1
- package/dist/chunk-NPKB7EK3.js +7 -0
- package/dist/{chunk-OGDAWNFY.js → chunk-O3ZKP4DY.js} +1 -1
- package/dist/{chunk-JL3L6KOG.js → chunk-OUWOLCCS.js} +1 -1
- package/dist/{chunk-Z3YYMZHT.js → chunk-OYY566GN.js} +1 -1
- package/dist/{chunk-AYJ2YZP5.js → chunk-PDTFQGQF.js} +1 -1
- package/dist/{chunk-HLCETZ73.js → chunk-Q7LZ5QJV.js} +1 -1
- package/dist/{chunk-T4R26WER.js → chunk-QMZLIHBS.js} +2 -2
- package/dist/chunk-QXUPBIV3.js +93 -0
- package/dist/{chunk-PGXJ275T.js → chunk-RCYYE6ED.js} +1 -1
- package/dist/{chunk-NLEA6NPU.js → chunk-SF5QPR6T.js} +1 -1
- package/dist/{chunk-4TMQTSIO.js → chunk-TBYYPGHF.js} +1 -1
- package/dist/{chunk-NUJVYAI4.js → chunk-TGBXIV7O.js} +1 -1
- package/dist/{chunk-Q77QO3PC.js → chunk-TWZ6NZWE.js} +4 -4
- package/dist/{chunk-CNPIJFZM.js → chunk-U466V5JN.js} +1 -1
- package/dist/{chunk-YKYKOV6U.js → chunk-U7BVK5IX.js} +1 -1
- package/dist/{chunk-NWNG5UWD.js → chunk-UAFCBZ3P.js} +1 -1
- package/dist/{chunk-7X4R6464.js → chunk-UEG4LJD6.js} +1 -1
- package/dist/{chunk-XUJXGE42.js → chunk-ULGFPKC7.js} +1 -1
- package/dist/{chunk-ZEVU2OT3.js → chunk-V4JR5JCK.js} +1 -1
- package/dist/{chunk-M36MOFJW.js → chunk-VATOIZYG.js} +1 -1
- package/dist/{chunk-27ERHOW3.js → chunk-VWOAEF7J.js} +1 -1
- package/dist/{chunk-GSDXZS4U.js → chunk-W4Y3PG7F.js} +1 -1
- package/dist/{chunk-R7QMZBBH.js → chunk-WECVT7WE.js} +1 -1
- package/dist/{chunk-UZIMYV5U.js → chunk-WML5KSGQ.js} +1 -1
- package/dist/{chunk-RQILLYSP.js → chunk-WPNNRMTP.js} +1 -1
- package/dist/{chunk-ZKCCG3GK.js → chunk-XGL3RSI5.js} +1 -1
- package/dist/{chunk-QVLYK5JL.js → chunk-Z2GDSCPS.js} +1 -1
- package/dist/{chunk-JVEZBJJ7.js → chunk-Z4KRSLAM.js} +1 -1
- package/dist/{chunk-D6GBOFK5.js → chunk-Z5DGFN7R.js} +1 -1
- package/dist/{chunk-LJGAXIDU.js → chunk-ZLIYWELJ.js} +1 -1
- package/dist/{chunk-EFTRH35G.js → chunk-ZYEFWJNZ.js} +1 -1
- package/dist/{config-UGCWZGH5.js → config-WETHR632.js} +1 -1
- package/dist/{cover-cmd-SWJ2NZUZ.js → cover-cmd-J3CTQT3R.js} +1 -1
- package/dist/{credentials-GWLYYRTL.js → credentials-RQPAP5KY.js} +1 -1
- package/dist/{deps-bundle-VNGC2UG6.js → deps-bundle-F47ZDYIM.js} +1 -1
- package/dist/{deps-resolve-YLCEU6I7.js → deps-resolve-URKD4QCB.js} +1 -1
- package/dist/{dispatch-OMQCT7WO.js → dispatch-KOZAJQDW.js} +1 -1
- package/dist/{doctor-B4Z6RPKQ.js → doctor-J44UKALC.js} +1 -1
- package/dist/{evidence-XJGXVLO5.js → evidence-KRNDKDCT.js} +1 -1
- package/dist/{evolve-cmd-QQQPPGL3.js → evolve-cmd-CEYGGIWA.js} +1 -1
- package/dist/{explain-cmd-XVE6Z67Q.js → explain-cmd-USGRZFBY.js} +1 -1
- package/dist/{extract-bind-7IDQS4QP.js → extract-bind-X4QRQX53.js} +2 -2
- package/dist/{extract-cmd-KIEOBRIT.js → extract-cmd-RKEE32FN.js} +1 -1
- package/dist/{gaps-cmd-RGIPUSIR.js → gaps-cmd-WL6P6YKS.js} +1 -1
- package/dist/{generate-headless-XGRIDD6O.js → generate-headless-LSQHOR3G.js} +2 -2
- package/dist/index.js +144 -144
- package/dist/{ingest-cmd-R5H5SF5K.js → ingest-cmd-TQ4ARSDE.js} +1 -1
- package/dist/install-47CRHVU6.js +2 -0
- package/dist/{interactive-bind-X5DVLRRW.js → interactive-bind-FPC4RYEW.js} +3 -3
- package/dist/{lifecycle-cmd-6R2PR2HM.js → lifecycle-cmd-DB5EFO2O.js} +1 -1
- package/dist/{list-cmd-QCIYKWYQ.js → list-cmd-UWGJRGKF.js} +1 -1
- package/dist/{list-commands-VRRCVWKO.js → list-commands-Q77CAQJ2.js} +1 -1
- package/dist/login-flow-RSNR5HY2.js +2 -0
- package/dist/{maintenance-cmd-GZ4EMT3V.js → maintenance-cmd-EJ2RAMWB.js} +1 -1
- package/dist/{mobile-prompts-CMIVWDHQ.js → mobile-prompts-PPPPKRS2.js} +1 -1
- package/dist/{objective-variable-gate-EEYJ6B3X.js → objective-variable-gate-BCKULIFQ.js} +1 -1
- package/dist/{open-provider-UFSCTIQQ.js → open-provider-XIGABCD3.js} +1 -1
- package/dist/{persist-recorded-session-JXL5E53A.js → persist-recorded-session-MK4HCDOY.js} +1 -1
- package/dist/{pipeline-RSCRNNPW.js → pipeline-XDWHEZ5S.js} +1 -1
- package/dist/prepare-target-NR3MTLLI.js +2 -0
- package/dist/{reconcile-cmd-4VRTUM2D.js → reconcile-cmd-VJPEY7YD.js} +1 -1
- package/dist/{reconcile-deps-ZCJ2QCK5.js → reconcile-deps-T5YX6HRG.js} +2 -2
- package/dist/{reconcile-engine-IVLZCYZB.js → reconcile-engine-GELPXSLV.js} +1 -1
- package/dist/{recording-banner-SRLPSTFP.js → recording-banner-3ET3PMSV.js} +1 -1
- package/dist/registry-3XMA4FOC.js +2 -0
- package/dist/{require-project-folder-SKEZMSN7.js → require-project-folder-ZLKONKKP.js} +1 -1
- package/dist/{resolve-run-intent-THC3EPAX.js → resolve-run-intent-3SXUS676.js} +1 -1
- package/dist/{resolver-2NUNLK7N.js → resolver-G7NGWACO.js} +1 -1
- package/dist/{review-cmd-BMJQZ6XJ.js → review-cmd-6DNGXV5E.js} +1 -1
- package/dist/{run-UDP5VPYS.js → run-MUVZVTTC.js} +1 -1
- package/dist/{run-TURFDLC6.js → run-UJLRTKTO.js} +1 -1
- package/dist/{run-test-md-MRYNFNPO.js → run-test-md-RI5RXVFU.js} +2 -2
- package/dist/{skill-installer-CVJ5VTEJ.js → skill-installer-CAO2NJZP.js} +1 -1
- package/dist/{spawner-7FUA3JXA.js → spawner-H6IDWY5U.js} +1 -1
- package/dist/{store-guard-XQ5MSUB2.js → store-guard-PIA2DYZX.js} +1 -1
- package/dist/{sync-cmd-5INKTZN2.js → sync-cmd-VFVTFIIJ.js} +1 -1
- package/dist/{sync-setup-4R54VRAO.js → sync-setup-R7BZDE24.js} +1 -1
- package/dist/tcg-generate-QADJKNYZ.js +2 -0
- package/dist/testmd-actions-EXSVQRHQ.js +2 -0
- package/dist/{testmd-sync-HYZI6NRM.js → testmd-sync-2CXNIPJ7.js} +1 -1
- package/dist/token-refresh-5TVNSL4U.js +2 -0
- package/dist/{validate-basic-OKLJLDML.js → validate-basic-MN5NDCT2.js} +1 -1
- package/dist/{variable-receipt-CMCDUJI2.js → variable-receipt-SIABUC74.js} +1 -1
- package/dist/{verdicts-EMCYGQWM.js → verdicts-ZXXBKTOZ.js} +1 -1
- package/dist/{version-check-4DQJBSXW.js → version-check-TDGK5REB.js} +1 -1
- package/dist/{view-cmd-P3XRFORJ.js → view-cmd-RLO7AP4X.js} +1 -1
- package/dist/{walk-session-MUGS6CZY.js → walk-session-ATWNUGHX.js} +1 -1
- package/dist/{with-telemetry-3T53GIQC.js → with-telemetry-CLSDKQAG.js} +1 -1
- package/package.json +11 -11
- package/dist/FolderPicker-XCTJ5447.js +0 -2
- package/dist/SingleShotApp-IPNZBFXB.js +0 -2
- package/dist/TestMdRunView-2FQIEI5W.js +0 -2
- package/dist/bridge-5UKX7YIO.js +0 -2
- package/dist/chunk-6K4FDYMH.js +0 -89
- package/dist/chunk-JQCOKL6U.js +0 -15
- package/dist/chunk-JSS22MFY.js +0 -17
- package/dist/chunk-O66WXOOC.js +0 -5
- package/dist/chunk-S4JUCBCT.js +0 -7
- package/dist/install-W3VPVPAQ.js +0 -2
- package/dist/login-flow-5HL2QYEL.js +0 -2
- package/dist/prepare-target-XZ3FTVBW.js +0 -2
- package/dist/registry-CPQHW2L2.js +0 -2
- package/dist/tcg-generate-2BOPGRM6.js +0 -2
- package/dist/testmd-actions-2CPJZAC2.js +0 -2
- package/dist/token-refresh-NTE4LQRN.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as $e}from"./chunk-
|
|
2
|
+
import{e as $e}from"./chunk-OYY566GN.js";import{a as te}from"./chunk-2GWMENG5.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-IZ5CTC6M.js";import{a as ve}from"./chunk-FQFVAFWK.js";import{y as i}from"./chunk-F2XTOZTN.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{a as k}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as Te,k as ee}from"./chunk-C44QQJR4.js";import{a as V}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var A=R(V(),1);var C=R(V(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function we(e){let t=$e(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,C.useState)(0),[a,u]=(0,C.useState)("idle"),c=(0,C.useRef)("idle"),v=(0,C.useRef)(0),S=(0,C.useRef)(!1),T=(0,C.useRef)(null),d=(0,C.useRef)(null),L=(0,C.useCallback)(h=>{c.current=h,u(h)},[]),O=(0,C.useCallback)(async h=>{let b=await e.getNextConfig(h);if(!b){L("done"),e.onAllComplete?.();return}let B=h?v.current+1:0;v.current=B,l(B),e.onStepStart?.(b,B),T.current=null,d.current=null,L("running"),await t.startRun(b,e.spawnOpts)},[t,e,L]);(0,C.useEffect)(()=>{S.current||(S.current=!0,O(null))},[]),(0,C.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===T.current||c.current!=="running")return;T.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let h=t.lastRunEnd,b=de(t.steps),B=t.bifurcationInfo,F={status:h.status==="passed"?"passed":"failed",duration_s:h.duration??0,reason:h.reason,runEnd:h,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:B&&!B.isSingleFlow?B.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(F,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(F)},[t.lastRunEnd]),(0,C.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let h=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:h.passed,stepsFailed:h.failed,stepsTotal:h.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(b)},[t.runError,t.lastRunEnd]);let y=(0,C.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:y}}var pe=R(V(),1);var ne=R(k(),1),Ee=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ke({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);K(()=>{l(v=>(v+1)%Ee.length)},80),K(()=>{u(v=>(v+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ee[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Ie(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var I=R(V(),1);var Ce=R(V(),1);var re=R(k(),1),He="#ffc580",Ue="#ffd9a8",Le="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Ce.useState)(0),a=4;if(K(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Le,children:e});let u=e.split("").map((c,v)=>{let S=n-a,T=Math.abs(v-S-a/2),d;return T<=a/2?d=He:T<=a?d=Ue:d=Le,(0,re.jsx)(o,{color:d,children:c},v)});return(0,re.jsx)(o,{children:u})}var _=R(k(),1),We={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=We[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Ve={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function Oe(e){return Ve[e]??"\u25CF"}var q=R(k(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let v=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return v?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(T=>(0,q.jsx)(s,{marginLeft:2,children:l(T,`${S}-${T.childId??"p"}-${T.index}`)},`${S}-${T.childId??"p"}-${T.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var H=R(k(),1);function Pe({label:e,shimmer:t=!1}){return(0,H.jsxs)(s,{marginLeft:6,children:[(0,H.jsx)(te,{}),(0,H.jsx)(o,{children:" "}),t?(0,H.jsx)(oe,{text:e,active:!0}):(0,H.jsx)(o,{color:i.dim,children:e})]})}var De=R(V(),1);var me=R(k(),1);function ze(e,t){let n=[];for(let l of e.split(`
|
|
3
3
|
`)){if(l===""){n.push("");continue}let a="";for(let u of l.split(" ")){let c=u;for(;c.length>t;)a&&(n.push(a),a=""),n.push(c.slice(0,t)),c=c.slice(t);a===""?a=c:a.length+1+c.length<=t?a+=" "+c:(n.push(a),a=c)}n.push(a)}return n}function je({text:e,maxLines:t=3}){let{stdout:n}=ee(),l=Math.max(20,(n?.columns??80)-7),a=!e.trim(),[u,c]=(0,De.useState)(!0);K(()=>c(T=>!T),500);let v=(a?"Thinking\u2026":e)+(u?"\u258C":" "),S=ze(v,l).slice(-t);for(;S.length<t;)S.push("");return(0,me.jsx)(s,{borderStyle:"round",borderColor:i.muted,paddingX:1,marginLeft:3,flexDirection:"column",children:S.map((T,d)=>(0,me.jsx)(o,{color:a?i.dim:i.secondary,wrap:"truncate-end",children:T.length?T:" "},d))})}var U=R(k(),1);function se({activity:e,describe:t,describeVisible:n}){return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(Pe,{label:e.label,shimmer:e.shimmer}):null,n?(0,U.jsx)(je,{text:t??""}):null]})}var r=R(k(),1);function le(e){for(let t of e){if(t.children&&t.children.length>0){let n=le(t.children);if(n)return n}if(t.status==="running")return t}}function z(e){return e.status==="running"&&!e.branchObjective&&(!e.children||e.children.length===0)}function Fe(e){let t=[];for(let n of e)z(n)||(n.children&&n.children.length>0?t.push({...n,children:Fe(n.children)}):t.push(n));return t}function ge(e,t){if(!e)return null;let n=e.objective??"";return n.length>0&&!/^Step \d+$/.test(n)?{label:n+"\u2026",shimmer:!1}:{label:t?"Looking at the screen\u2026":"Deciding next action\u2026",shimmer:!0}}function P({step:e,indent:t=2}){let n=e.actionType?Oe(e.actionType):null,l=e.status==="running",a=e.status==="passed",u=e.status==="failed",c=e.status==="pending"||e.status==="stopped",{stdout:v}=ee(),S=v?.columns??80,T=Math.max(20,S-t-21),d=e.objective??"",L=d.length>T?d.slice(0,T-1)+"\u2026":d,O=(e.duration??0)*1e3,y=e.duration!=null?O<1e3?`${Math.round(O)}ms`:`${(O/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsxs)(s,{marginLeft:t,children:[(0,r.jsx)(s,{width:4,children:(0,r.jsxs)(o,{color:i.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(s,{width:3,children:l?(0,r.jsx)(te,{}):a?(0,r.jsx)(o,{color:i.green,bold:!0,children:"\u2713"}):u?(0,r.jsx)(o,{color:i.red,bold:!0,children:"\u2717"}):(0,r.jsx)(o,{color:i.muted,children:"\u25CB"})}),(0,r.jsx)(s,{flexGrow:1,children:l?(0,r.jsx)(oe,{text:L,active:!0}):u?(0,r.jsx)(o,{color:i.red,children:L}):c?(0,r.jsx)(o,{color:i.dim,children:L}):(0,r.jsx)(o,{color:i.dim,children:L})}),(a||u)&&n?(0,r.jsx)(s,{width:3,marginLeft:1,children:(0,r.jsx)(o,{color:i.muted,children:n})}):(0,r.jsx)(s,{width:3,marginLeft:1}),(0,r.jsx)(s,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(o,{color:i.dim,children:y})})]}),e.children&&e.children.length>0&&(0,r.jsx)(s,{flexDirection:"column",children:e.children.map((h,b)=>(0,r.jsx)(P,{step:h,indent:t+2},`child-${b}`))})]})}function Xe(e){return e.type==="cm_init"?(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(P,{step:e.step})})}function _e({steps:e,bifurcated:t,flows:n,cmInitCounts:l,maxSteps:a=50,staticSteps:u=!1,onStepCommit:c,describe:v,describeVisible:S,describeRevealing:T}){let d=(0,I.useRef)(new Set),L=(0,I.useRef)(!1),O=(0,I.useRef)(new Set),y=(0,I.useRef)(!1),h=(0,I.useRef)(new Set),b=(0,I.useRef)(0);(0,I.useEffect)(()=>{e.length===0&&b.current>0&&(d.current.clear(),L.current=!1,O.current.clear(),y.current=!1,h.current.clear()),b.current=e.length},[e.length]);let B=e.flatMap(p=>[p,...p.children??[]]),F=B.some(p=>p.status==="running"),M=B.some(p=>p.status==="failed"),X=B.length===0||B.every(p=>p.status==="pending"),Y=B.filter(p=>p.status==="passed"||p.status==="failed").length,N;X?N="starting":F?N="running":M?N="failed":N="passed";let J=(0,I.useRef)(null),[ce,he]=(0,I.useState)(0);(0,I.useEffect)(()=>{B.length===0||X?(J.current=null,he(0)):F&&J.current==null&&(J.current=Date.now())},[F,X,B.length]),(0,I.useEffect)(()=>{if(!F)return;let p=setInterval(()=>{J.current!=null&&he((Date.now()-J.current)/1e3)},500);return()=>clearInterval(p)},[F]);let ae=(0,I.useRef)(new Set),[,xe]=(0,I.useState)(0),be=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c||!u||t)return;let p=[];!be.current&&l&&l[0]!=null&&(be.current=!0,l[0]>0&&p.push({key:"cm_init_0",type:"cm_init",count:l[0]}));for(let g of e)(g.status==="passed"||g.status==="failed")&&!ae.current.has(g.index)&&(ae.current.add(g.index),p.push({key:`step_${g.index}`,type:"step",step:{...g,children:g.children?[...g.children]:void 0}}));if(p.length>0){for(let g of p)c(Xe(g));xe(g=>g+1)}},[e,t,l,u,c]),(0,I.useEffect)(()=>{if(!c||u)return;let p=d.current.size;if(!t&&!y.current&&l&&l[0]!=null&&(y.current=!0,l[0]>0&&c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25A0 Generated task with ",l[0]," checkpoints"]})}))),t&&n&&!L.current&&(L.current=!0,c((0,r.jsx)(o,{color:i.purple,children:"\u2501\u2501 Bifurcated into "+n.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),t){let g=e.flatMap((x,f)=>{let m=x.children??[];return!O.current.has(f)&&m.length>0&&(O.current.add(f),c((0,r.jsx)(o,{color:i.purple,children:" Flow "+(f+1)+": "+(n?.[f]??"")})),l?.[f]!=null&&l[f]>0&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})})))),l?.[f]!=null&&l[f]>0&&O.current.has(f)&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})}))),m});for(let x of g){let f=`${x.childId??"p"}-${x.index}-${x.objective}`;if(!!x.branchObjective){d.current.has(f)||(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...x,children:void 0}})})));for(let $ of x.children??[]){let w=`child-${x.childId??"p"}-${x.index}-${$.childId??"p"}-${$.index}-${$.objective}`;d.current.has(w)||($.status==="passed"||$.status==="failed"||$.status==="stopped")&&(d.current.add(w),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:$})})))}continue}d.current.has(f)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:x})})))}}else for(let g of e){let x=`${g.index}-${g.objective}`,f=!!g.branchObjective;f&&!d.current.has(x)&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})));for(let m of g.children??[]){let $=`child-${g.index}-${m.childId??"p"}-${m.index}-${m.objective}`;d.current.has($)||(m.status==="passed"||m.status==="failed"||m.status==="stopped")&&(d.current.add($),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:m})})))}!f&&!d.current.has(x)&&(g.status==="passed"||g.status==="failed"||g.status==="stopped")&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})))}d.current.size>p&&xe(g=>g+1)},[e,c,t,n,l]);let G=[];if(u&&!t)for(let p of e)ae.current.has(p.index)||G.push(p);else if(c&&!u)if(t)for(let p of e){let g=p.children??[],x=[];for(let f of g){let m=`${f.childId??"p"}-${f.index}-${f.objective}`,$=d.current.has(m);if(f.branchObjective){let w=(f.children??[]).filter(Q=>{let ue=`child-${f.childId??"p"}-${f.index}-${Q.childId??"p"}-${Q.index}-${Q.objective}`;return!d.current.has(ue)});(!$||w.length>0)&&x.push({...f,children:w})}else $||x.push(f)}x.length>0&&G.push({...p,children:x})}else for(let p of e){let g=`${p.index}-${p.objective}`,x=d.current.has(g),f=(p.children??[]).filter(m=>{let $=`child-${p.index}-${m.childId??"p"}-${m.index}-${m.objective}`;return!d.current.has($)});x?f.length>0&&G.push({...p,children:f}):G.push({...p,children:f})}if(!u){let p=c?G:e,g=le(p),x=ge(g,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[t?c?p.length>0?(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:p.map((m,$)=>(0,r.jsx)(s,{flexDirection:"column",marginTop:$>0?1:0,children:m.children&&m.children.length>0?m.children.map(w=>{if(z(w))return null;let Q=!!w.branchObjective,ue=`${w.childId??"p"}-${w.index}-${w.objective}`,Ke=d.current.has(ue);return Q?(0,r.jsxs)(s,{flexDirection:"column",children:[!Ke&&(0,r.jsx)(P,{step:{...w,children:void 0}}),(w.children??[]).filter(Z=>!z(Z)).map(Z=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:Z})},`f${$}-${w.index}-${Z.childId??"p"}-${Z.index}`))]},`f${$}-host-${w.childId??"p"}-${w.index}`):(0,r.jsx)(P,{step:w},`f${$}-${w.childId??"p"}-${w.index}`)}):m.status==="pending"&&(0,r.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})},$))}):null:(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(m,$)=>z(m)?null:(0,r.jsx)(P,{step:m},$)}):(0,r.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!c&&l&&l[0]!=null&&(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",l[0]," checkpoints"]}),p.filter(m=>!(m.status==="running"&&(!m.children||m.children.length===0))).map(m=>{let $=`${m.index}-${m.objective}`;return c&&d.current.has($)?(0,r.jsx)(s,{flexDirection:"column",children:(m.children??[]).filter(w=>!z(w)).map(w=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:w})},`${w.childId??"p"}-${w.index}`))},`branch-children-${m.index}`):(0,r.jsx)(P,{step:m},m.index)})]}),(0,r.jsx)(se,{activity:x,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}if(t){let p=le(e),g=ge(p,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(x,f)=>z(x)?null:(0,r.jsx)(P,{step:x},f)}),(0,r.jsx)(se,{activity:g,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}let Ne=le(G),Ge=ge(Ne,T),Re=Fe(G);return(0,r.jsxs)(s,{flexDirection:"column",children:[Re.length>0&&(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:Re.map(p=>(0,r.jsx)(P,{step:p},p.index))}),(0,r.jsx)(se,{activity:Ge,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}var W=R(k(),1);function Ae({runner:e,runKey:t,onStepCommit:n}){let l=Ie({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,W.jsxs)(W.Fragment,{children:[l&&(0,W.jsx)(ke,{label:l.label,hasBifurcation:l.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,W.jsx)(_e,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:n},`run-${t}`)]})}var D=R(k(),1),Ye=64;function Je(e){return e.split(`
|
|
4
4
|
`).map(t=>t.replace(/^[-–•]\s*/,"").trim()).filter(t=>t.length>0)}function qe({status:e,summary:t,duration:n,steps:l,stepsPassed:a,stepsFailed:u,reason:c,creditsConsumed:v}){let S=e==="passed",T=S?i.green:i.red,d=S?"\u2713":"\u2717",L=e.toUpperCase(),O=a??(S?l:Math.max(0,l-1)),y=u??(S?0:1),h=y>0?`${l} steps (${O} passed, ${y} failed)`:`${l} steps`,b=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`,B=Je(t);return(0,D.jsx)(s,{flexDirection:"column",marginTop:1,children:(0,D.jsxs)(s,{borderStyle:"round",borderColor:T,flexDirection:"column",paddingX:2,paddingY:1,width:Ye+6,children:[(0,D.jsxs)(s,{flexDirection:"column",children:[(0,D.jsxs)(o,{bold:!0,color:T,children:[d," ",L]}),(0,D.jsxs)(o,{color:i.dim,wrap:"wrap",children:[h," \xB7 ",b,typeof v=="number"&&v>0?` \xB7 ${parseFloat(v.toFixed(4))} credits`:""]})]}),B.length>0&&(0,D.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:B.map((F,M)=>(0,D.jsxs)(s,{marginBottom:M<B.length-1?1:0,children:[(0,D.jsx)(o,{color:i.orange,children:"\u25CF "}),(0,D.jsx)(s,{flexShrink:1,children:(0,D.jsx)(o,{wrap:"wrap",children:F})})]},M))}),c&&!S&&(0,D.jsx)(s,{marginTop:1,children:(0,D.jsxs)(o,{color:i.red,wrap:"wrap",children:["Reason: ",c]})})]})})}var j=R(k(),1);function Me({message:e,code:t,remediation:n,docsUrl:l}){return(0,j.jsx)(ve,{title:"Error",variant:"error",children:(0,j.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,j.jsxs)(o,{color:i.red,bold:!0,children:[" \u2717 ",e]}),t&&(0,j.jsxs)(s,{marginTop:0,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Code: "}),(0,j.jsx)(o,{color:i.dim,children:t})]}),n&&(0,j.jsxs)(s,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.green,bold:!0,children:"Fix:"}),(0,j.jsxs)(o,{color:i.orange,children:["$ ",n]})]}),l&&(0,j.jsxs)(s,{marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Docs: "}),(0,j.jsx)(o,{color:i.orange,underline:!0,children:l})]})]})})}var E=R(k(),1);function un(e){let{exit:t}=Te(),{append:n}=ye(),l=(0,A.useRef)(!1);(0,A.useEffect)(()=>{l.current||(l.current=!0,n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsxs)(s,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,E.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.orange,children:e.topBanner.model}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.dim,children:e.topBanner.auth})]})})),n((0,E.jsx)(Qe,{data:e.globalConfig})),e.priorAttemptRollup&&n((0,E.jsx)(o,{color:i.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let a=(0,A.useRef)(null),u=(0,A.useCallback)(async y=>{let h=await e.getNextStep(y);return h?(a.current=h,h.config):(a.current=null,null)},[e]),c=(0,A.useCallback)((y,h)=>{let b=a.current;if(!b)return;let B=b.mode==="replay"?"cyan":"#dc4e08",F=b.modeReason?` (${b.modeReason})`:"",M=b.perStepOverrides?Object.entries(b.perStepOverrides):[];n((0,E.jsxs)(s,{flexDirection:"column",marginBottom:0,children:[(0,E.jsxs)(o,{children:[(0,E.jsxs)(o,{color:i.dim,children:[b.banner.stepLabel," "]}),(0,E.jsxs)(o,{color:B,children:["[",b.mode,"]"]}),(0,E.jsx)(o,{color:i.dim,children:F})]}),(0,E.jsx)(o,{color:i.dim,children:b.banner.objective}),M.length>0&&(0,E.jsxs)(o,{color:i.dim,children:["overrides: ",M.map(([X,Y])=>`${X}=${Y}`).join(", ")]})]}))},[n]),v=(0,A.useRef)(0),S=(0,A.useRef)(!1),T=(0,A.useCallback)((y,h)=>(y.hadError?n((0,E.jsx)(Me,{message:y.reason??"Runner error",code:"RUNNER_ERROR"})):n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsx)(qe,{status:y.status,summary:y.runEnd?.summary??"",duration:y.runEnd?.duration??0,steps:y.stepsTotal,stepsPassed:y.stepsPassed,stepsFailed:y.stepsFailed,reason:y.runEnd?.reason,creditsConsumed:y.runEnd?.credits_consumed})})),e.onStepEnd?.(y,h)??!0),[n,e]),d=we({getNextConfig:u,onStepStart:c,onStepEnd:T,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>t())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),L=250,O=5e3;return Se((y,h)=>{if(h.ctrl&&y==="c"){let b=Date.now(),B=b-v.current;if(B<L)return;S.current&&B<O?(d.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>t())):(S.current=!0,n((0,E.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),v.current=b}}),(0,E.jsx)(s,{flexDirection:"column",children:d.phase!=="done"&&(0,E.jsx)(Ae,{runner:d.runner,runKey:d.currentStepIndex,onStepCommit:n})})}function Qe({data:e}){return(0,E.jsx)(Be,{title:"test.md run",titleColor:"#ff9500",borderColor:i.dim,rows:[{label:"source",value:e.source},{label:"steps",value:`${e.steps.total} (${e.steps.replay} replay, ${e.steps.author} author per walker)`},{label:"model",value:e.model},{label:"viewport",value:`${e.viewport.width} x ${e.viewport.height}`},{label:"chrome",value:e.chrome},{label:"session",value:e.session},{label:"variables",value:`${e.variables.count} (${e.variables.secrets} secret)`},{label:"flags",value:e.flags.length>0?e.flags.join(" "):"(none)"}]})}export{_e as a,ke as b,Ie as c,de as d,qe as e,Me as f,un as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as S}from"./chunk-I7TIGB7K.js";import{a as x,b as P,c as C,d as V,e as j}from"./chunk-
|
|
2
|
+
import{a as S}from"./chunk-I7TIGB7K.js";import{a as x,b as P,c as C,d as V,e as j}from"./chunk-AGKE5WF3.js";import{a as R,b as D}from"./chunk-ALCE5RLK.js";import{C as y,c as b,r as f,s as k}from"./chunk-GP7WD4UY.js";import{f as w}from"./chunk-FQNQVC5O.js";function I(o,t){return{contextDir:o,rootSid:t,locks:w(o,t),probe:S(o,{resolveAlias:i=>P(i),embed:(i,s)=>C(i,s),readVector:(i,s)=>V(o,i,s),writeVector:(i,s,n)=>j(o,i,s,n)})}}var N=new Set(["archive"]);async function Y(o,t,i,s){let n=y(o.contextDir);if(i.v==="defer")return{outcome:"deferred"};if(t.kind==="MODIFY_HELD"){if(!t.heldPayload)return{outcome:"failed",detail:`${t.ref} carries no held payload`};let e=t.heldPayload;if(i.v==="keep_current"){if(!e.event_id)return{outcome:"failed",detail:`this held row has no durable event id \u2014 resume the owner to drop it: kane-cli context extract --resume ${e.sid}`};let{commitChatTurn:r}=await import("./chat-committer-HDE3TP5I.js"),u=r({contextDir:o.contextDir,graph:n,ops:[{kind:"resolve_question",questionId:`drop-held:${e.sid}:${e.tempRef}`,resolution:"deferred",eventId:e.event_id}],by:s});return u.errors?{outcome:"failed",detail:u.errors.map(d=>`${d.code}: ${d.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"held-dropped"}),{outcome:"committed",detail:"held payload dropped (recorded) \u2014 the owner's resume will not re-present it"})}if(i.v==="approve"){let r=e.content._held??null;if(!r?.source_id||!r.source_cid||!r.anchor||!r.quote)return{outcome:"failed",detail:`this held row carries no committable provenance \u2014 resume the owner to apply it: kane-cli context extract --resume ${e.sid}`};{let a=n.mediaOf(r.source_cid),m=R(o.contextDir,n,r.source_cid),g=a.format==="image"?null:m?D(m):null;if(a.format!=="image"&&g===null)return{outcome:"failed",detail:`the pinned source ${r.source_id} (${r.source_cid.slice(0,19)}) has no citable text to verify this held row against \u2014 resume the owner: kane-cli context extract --resume ${e.sid}`};let _=b(a,{anchor:r.anchor,quote:r.quote},g);if(_.length>0)return{outcome:"failed",detail:`held provenance does not verify against the pinned source (${_.map($=>`${$.code}: ${$.detail}`).join("; ")}) \u2014 resume the owner: kane-cli context extract --resume ${e.sid}`}}let{commitProposal:u}=await import("./committer-IYQPXG6C.js"),{_held:d,...c}=e.content,q={version:1,read_basis:n.latestHash,source:{source_id:r.source_id,source_cid:r.source_cid},use_cases:[{temp_ref:e.tempRef,title:String(c.title??e.tempRef),...c.summary!==void 0?{summary:c.summary}:{},risk:String(c.risk??"med"),cite:{anchor:r.anchor,quote:r.quote},depends_on_hint:[],matches_existing:null}]},l=await x(I(o.contextDir,o.rootSid??`review-${process.pid}`),{verb:"maintain",ucTargets:[],newBuCandidates:[{tempRef:e.tempRef,title:String(c.title??e.tempRef),probeText:`${String(c.title??"")} ${String(c.summary??"")}`.trim()}],sourcePins:[{source_id:r.source_id,source_cid:r.source_cid}],readBasis:n.latestHash,...e.event_id?{eventIds:[e.event_id]}:{}},a=>{let m=u({contextDir:o.contextDir,graph:a.graph,proposal:q,proposalId:null,verdicts:new Map([[e.tempRef,{resolution:"skipped"}]]),by:s,autoName:!0,allowStaleBasis:!0,eventIds:e.event_id?[e.event_id]:a.eventIds("maintain",1),sid:a.sid,probeHits:a.probeHits});return m.errors!==null?{errors:m.errors}:{result:m,record:m.record}}),h=l.ok&&"result"in l?l.result:{record:null,errors:l.ok?null:l.kind==="validation"?l.errors:[{code:l.kind==="contended"?l.err.code:"UNSETTLED",detail:l.kind==="contended"?`held by ${l.err.holder?.owner_sid??"another session"}`:"concurrent activity kept moving the store"}]};return h.errors?{outcome:"failed",detail:h.errors.map(a=>`${a.code}: ${a.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"held-applied"}),{outcome:"committed",detail:`held payload committed (derived) by ${s.id}`})}return{outcome:"failed",detail:`verdict ${i.v} does not apply to a MODIFY_HELD card`}}let v=n.resolve(t.ref);if(!v)return{outcome:"failed",detail:`${t.ref} names nothing in the graph`};let p=n.tipOf(v.cid);if(i.v==="archive"){if(!i.because||!i.because.trim())return{outcome:"failed",detail:"archive requires --because (a reason the record keeps)"};let e=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"rejected",reason:i.because}]]),by:s});return e.errors?{outcome:"failed",detail:e.errors.map(r=>`${r.code}: ${r.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"archived",reason:i.because}),{outcome:"retired"})}if(i.v==="approve"){let e=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"approved"}]]),by:s});return e.errors?{outcome:"failed",detail:e.errors.map(r=>`${r.code}: ${r.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"approved"}),{outcome:"applied"})}if(i.v==="merge"||i.v==="keep_both"){if(t.kind!=="PAIR"||!t.pair)return{outcome:"failed",detail:`${t.ref} is not a PAIR card`};let e=n.resolve(t.pair.candidate_cid);if(!e)return{outcome:"failed",detail:`pair candidate ${t.pair.candidate_ref} names nothing`};let r=n.tipOf(e.cid);if(i.v==="merge"){let d=k({contextDir:o.contextDir,graph:n,survivor:r,merged:p,reason:`pair merge: duplicate of ${t.pair.candidate_ref} (score ${t.pair.score})`,by:s});return d.errors?{outcome:"failed",detail:d.errors.map(c=>`${c.code}: ${c.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"pair-merged",reason:t.pair.candidate_ref}),{outcome:"committed",detail:`merged into ${t.pair.candidate_ref} \u2014 survivor stays derived`})}let u=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"approved"}],[r,{resolution:"approved"}]]),by:s});return u.errors?{outcome:"failed",detail:u.errors.map(d=>`${d.code}: ${d.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"pair-kept-both",reason:t.pair.candidate_ref}),{outcome:"applied",detail:"both promoted as distinct"})}return{outcome:"failed",detail:`verdict ${i.v} does not apply to a ${t.kind} card`}}export{I as a,N as b,Y as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as g,e as p}from"./chunk-
|
|
2
|
+
import{a as g,e as p}from"./chunk-Z4KRSLAM.js";import{existsSync as f}from"fs";import{isAbsolute as m,join as d,relative as v}from"path";function c(t){let n=f(d(t,".context"))?"assurance.json":"variables.json";return d(".testmuai","variables",n)}function h(t,n){if(!m(t))return t;let e=v(n,t);return e.startsWith("..")?t:e}function w(t,n){let e=t.used_by;if(e.length===0||e.every(s=>s.file===p))return"";if(n===void 0||!e.every(s=>s.file===n))return e.map(s=>`${s.file} step ${s.step}`).join(" \xB7 ");let a=[...new Set(e.map(s=>s.step))].sort((s,i)=>s-i);return a.length===1?`step ${a[0]}`:`steps ${a.join(", ")}`}function b(t,n){let e=new Map,a=new Map,s={header:"Not in any variables file",rows:[],declare:!0};for(let i of t){if(i.reason==="not_a_dataset_column"){let l=i.dataset??"",u=a.get(l);u||(u={header:`Not a column of dataset ${l}`.trimEnd(),rows:[],declare:!1},a.set(l,u)),u.rows.push(i);continue}if(i.reason!=="value_missing"){s.rows.push(i);continue}let r=h(i.file??c(n),n),o=e.get(r);o||(o={header:r===g?"Waiting for a value passed with --variables":`Waiting for a value in ${r}`,rows:[],declare:!1},e.set(r,o)),o.rows.push(i)}return[...e.values(),...a.values(),...s.rows.length>0?[s]:[]]}function $(t,n){let e=c(n);if(f(d(n,e)))return["",` Add ${t.length===1?"it":"them"} to ${e}`];let a=t.map(r=>`${JSON.stringify(r.name)}:`),s=Math.max(...a.map(r=>r.length))+1,i=a.map((r,o)=>` ${r.padEnd(s)}{ "value": "" }${o<a.length-1?",":""}`);return["",` Create ${e}:`,""," {",...i," }"]}function _(t,n){let e=t.length,a=`warning: ${e} variable${e===1?" has":"s have"} no value`,s=Math.max(...t.map(r=>r.name.length),8)+2,i=b(t,n.cwd).map(r=>{let o=[` ${r.header}`];for(let l of r.rows)o.push(` ${l.name.padEnd(s)}${w(l,n.entryFile)}`.trimEnd());return r.declare&&o.push(...$(r.rows,n.cwd)),o.join(`
|
|
3
3
|
`)});return`${a}
|
|
4
4
|
|
|
5
5
|
${i.join(`
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{e as z}from"./chunk-EHN5HTUD.js";import{b as X,c as v,e as W,i as Y,j as Z,k as ee,l as te,m as E,o as ne}from"./chunk-L45HDSJ7.js";import{a as Q}from"./chunk-CAOZKSQ3.js";import{d as q}from"./chunk-F2XTOZTN.js";import{copyFileSync as Se,cpSync as Re,existsSync as P,mkdirSync as xe,readFileSync as qe,readdirSync as Ie,rmSync as ze,writeFileSync as Qe}from"fs";import{dirname as Xe,isAbsolute as Ye,join as R,relative as Ze,resolve as et}from"path";import{writeFileSync as we,mkdirSync as ve,readFileSync as Pe}from"fs";import{dirname as je,basename as se}from"path";function ie(e){let t=e.outPath??v(e.sourcePath);ve(je(t),{recursive:!0});let n=[];n.push("---"),n.push(`test: ../${se(e.sourcePath)}`),n.push(`status: ${e.overallStatus}`),n.push(`started: ${e.startedISO}`),n.push(`duration_s: ${e.durationS}`),n.push(`session_id: ${e.sessionId}`),n.push("---",""),n.push(`# ${e.title??se(e.sourcePath)} \u2014 Result`,"");for(let r=0;r<e.rootSteps.length;r++){let o=e.rootSteps[r],s=e.outcomes.find(l=>l.rootStepIndex===r+1);if(n.push(De(o,s)),s?.stepMd5&&n.push(`md5: ${s.stepMd5}`),s?.status==="failed"&&s.reason&&n.push(`Reason: ${s.reason}`),s?.softFailures?.length)for(let l of s.softFailures){let a=l.reason?`: ${l.reason}`:"";n.push(`\u26A0 optional sub-step ${l.subStepIndex} failed${a}`)}o.body.kind==="objective"&&s?.status!=="skipped"&&n.push(o.body.text),n.push("")}return we(t,n.join(`
|
|
3
|
+
`),"utf8"),t}function De(e,t){if(!t)return`## ${e.heading} (no outcome)`;let n=t.duration_s!=null?`${t.duration_s}s`:"\u2014";if(t.status==="skipped")return`## ${e.heading} \u23ED skipped`;let r=t.softFailed?" (optional)":"";if(t.refKind&&t.status==="passed"){let o=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2713 passed (via @${t.refKind} ${t.refLabel} \u2014 ${t.inlinedCount} inlined steps, ${n}${o})`}if(t.refKind&&t.status==="failed"){let o=t.failedSubStepIndex&&t.failedSubStepIndex.length>0?` \u2014 at sub-step ${t.failedSubStepIndex.join(" \u2192 sub-step ")}`:"",s=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2717 failed${r} (via @${t.refKind} ${t.refLabel}${o}, ${n}${s})`}return t.status==="passed"?`## ${e.heading} \u2713 passed (${n})`:`## ${e.heading} \u2717 failed${r} (${n})`}var $e=/^##\s+(.+?)\s+(✓ passed|✗ failed(?:\s+\(optional\))?|⏭ skipped)(?:\s+\((.*)\))?\s*$/,Fe=/via\s+@\w+\s+(\S+).*?(?:→\s+(\S+))?\s*$/,Oe=/^md5:\s+([a-f0-9]{32})\s*$/;function re(e,t){for(let n=t;n<e.length&&!/^##\s/.test(e[n]);n++){if(e[n].trim()==="")continue;let r=Oe.exec(e[n]);return r?r[1]:null}return null}function D(e){let n=Pe(e,"utf8").split(`
|
|
4
|
+
`),r="passed";if(n[0]?.trim()==="---")for(let s=1;s<n.length&&n[s].trim()!=="---";s++){let l=/^status:\s+(passed|failed|interrupted)\s*$/.exec(n[s]);l&&(r=l[1])}let o=[];for(let s=0;s<n.length;s++){let l=$e.exec(n[s]);if(!l)continue;let a=l[1],i=l[2],c=l[3]??"",f=i.startsWith("\u2713")?"passed":i.startsWith("\u23ED")?"skipped":"failed";if(/via\s+@/.test(c)){let m=Fe.exec(c),w=m?.[1]??"",x=m?.[2]??null;o.push({kind:"import",heading:a,status:f,md5:re(n,s+1),importPath:w,helperResultRelPath:x})}else o.push({kind:"objective",heading:a,status:f,md5:re(n,s+1)})}return{overallStatus:r,steps:o}}import{copyFileSync as oe,existsSync as H,mkdirSync as _e,writeFileSync as ae,promises as at}from"fs";import{join as $,dirname as de,basename as Ae}from"path";async function pe(e){for(let t=0;t<e.totalRunDirs;t++){let n=e.runIndex+t,r=$(e.sessionDir,"runs",String(n)),o=$(e.stagingStepDir,"flows",String(t));_e(o,{recursive:!0});let s=$(o,"actions.ndjson");if(e.packTestDir){let i=$(e.packTestDir,"logs",`${n}-actions.ndjson`);if(H(i)){oe(i,s);continue}let c=de(de(e.packTestDir)),f=Ae(e.packTestDir),S=H(c)?await z(c,`tests/${f}/logs/${n}-actions.ndjson`).catch(()=>null):null;ae(s,S??"");continue}let l=[$(r,"run-test","actions.ndjson"),$(r,"actions.ndjson")],a=!1;for(let i of l)if(H(i)){oe(i,s),a=!0;break}a||ae(s,"")}}import{existsSync as ue,readFileSync as ce,readdirSync as Ke}from"fs";import{join as F}from"path";function Te(e){if(e.action_type!=="upload_files")return null;let t=e.action_params?.media;if(!t||typeof t!="object")return null;let n=typeof t.media_id=="string"?t.media_id:"",r=typeof t.name=="string"?t.name:"",o=typeof t.media_url=="string"?t.media_url:"";if(!n||!r||!o)return null;let s=typeof t.type=="string"&&t.type?t.type:"doc";return{media_id:n,name:r,media_url:o,type:s}}function Ee(e){let t=e.action_params?.file_paths,n=Array.isArray(t)?t[0]:t;return typeof n=="string"&&n.length>0?n:null}function Le(e){let t={};for(let[n,r]of Object.entries(e??{}))t[n]={...r,refs:[...r.refs??[]]};return t}function Ue(e,t){if(!t)return!1;let n=t.endsWith("/")?t:t+"/";return e.startsWith(n)}function le(e,t,n,r={}){let o=Le(e);for(let s of t){let l=Te(s);if(!l)continue;let a=o[l.media_id]??={name:l.name,media_url:l.media_url,type:l.type,refs:[],recorded_at:n};a.recorded_at=n;let i=Ee(s);if(!(!i||Ue(i,r.ignoreAliasUnder))){for(let[c,f]of Object.entries(o))c!==l.media_id&&(f.refs=f.refs.filter(S=>S!==i));a.refs.includes(i)||a.refs.push(i)}}return o}function ut(e){let t=e?.media;if(!t||typeof t!="object")return[];let n=[];for(let[r,o]of Object.entries(t)){if(!r||!o||typeof o!="object")continue;let s=o;typeof s.name!="string"||!s.name||typeof s.media_url!="string"||!s.media_url||n.push({media_id:r,name:s.name,media_url:s.media_url,type:typeof s.type=="string"&&s.type?s.type:"doc",refs:Array.isArray(s.refs)?s.refs.filter(l=>typeof l=="string"&&l.length>0):[]})}return n}function Ne(e){let t=[];for(let n of e){let r;try{r=ce(n,"utf8")}catch{continue}for(let o of r.split(`
|
|
5
|
+
`)){let s=o.trim();if(s)try{let l=JSON.parse(s);l&&typeof l=="object"&&t.push(l)}catch{}}}return t}function V(e){try{return Ke(e,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,n)=>t.localeCompare(n,void 0,{numeric:!0}))}catch{return[]}}function yt(e){if(!e)return[];let t=[];for(let n of V(F(e,"runs")))for(let r of[F(e,"runs",n,"run-test","actions.ndjson"),F(e,"runs",n,"actions.ndjson")])if(ue(r)){t.push(r);break}return t}function fe(e){let t=[],n=F(e,".internal","steps");for(let r of V(n)){let o=F(n,r,"flows");for(let s of V(o)){let l=F(o,s,"actions.ndjson");ue(l)&&t.push(l)}}return t}function Ce(e){try{let n=JSON.parse(ce(e,"utf8"))?.media;return n&&typeof n=="object"?n:void 0}catch{return}}function me(e){let t=Ce(e.priorMetaPath),n=Ne(e.recordFiles),r=le(t,n,e.now??new Date().toISOString(),{ignoreAliasUnder:e.ignoreAliasUnder??q});return Object.keys(r).length>0?r:void 0}import{existsSync as L,readdirSync as We}from"fs";import{dirname as He,join as O,basename as B}from"path";function Mt(e,t){let n=[];return e.steps.forEach((r,o)=>{let s=t[o];r.block||!r.replayOnly||!s||s.kind!=="author"||n.push({flatIndex:r.flatIndex,file:r.owningFile,heading:r.trace[r.trace.length-1].heading,kind:r.replayOnly,reason:s.reason})}),n}function wt(e){let t=[],n=new Set,r=new Map;function o(i){if(r.has(i))return r.get(i);let c=v(i),f=L(c)?D(c):null;return r.set(i,f),f}let s=new Map;function l(i){if(s.has(i))return s.get(i);let c=O(i,"Result.md"),f=L(c)?D(c):null;return s.set(i,f),f}function a(i){for(let c=1;c<i.trace.length;c++){let f=i.trace[c-1],S=o(f.file);if(!S)continue;let m=S.steps[f.stepIndex-1];if(m){if(m.kind!=="import")return{kind:"author",reason:"structure-mismatch"};if(B(m.importPath)!==B(i.trace[c].file))return{kind:"author",reason:"structure-mismatch"};if(m.md5!=null&&m.md5!==f.rowMd5)return{kind:"author",reason:"structure-mismatch"}}}return null}for(let i of e.steps){let c=i.trace[i.trace.length-1].stepIndex,f=i.replayOnly;if(i.block){let g=o(i.owningFile)?.steps[c-1],j=i.controlFlow!==void 0,A=g?.kind==="objective"&&g.status==="skipped";if(j||A){t.push({kind:"replay",recordingDir:"",flowCount:0,unrecorded:!0,...f?{replayOnly:f}:{}});continue}}let S=n.has(i.owningFile);for(let g=0;g<i.trace.length-1&&!S;g++)n.has(i.trace[g].file)&&(S=!0);if(S&&!f){t.push({kind:"author",reason:o(i.owningFile)===null?"no-result-md":"downstream-of-divergence"});continue}let m=a(i);if(m){for(let g=0;g<i.trace.length;g++)n.add(i.trace[g].file);if(!f){t.push(m);continue}}let w=o(i.owningFile),x;if(w===null&&i.trace.length>1){let g=J(i.trace);x=ge(i,l(g),c,g)}else x=ge(i,w,c);if(f&&x.kind==="replay"&&(x={...x,replayOnly:f}),t.push(x),x.kind==="author"){n.add(i.owningFile);for(let g=0;g<i.trace.length-1;g++)n.add(i.trace[g].file)}}return t}function ge(e,t,n,r=null){if(!t)return{kind:"author",reason:"no-result-md"};let o=t.steps[n-1];if(!o)return{kind:"author",reason:"no-result-md"};if(o.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(o.status!=="passed")return{kind:"author",reason:"recorded-failed"};let s=E(e);if(s!==o.md5)return{kind:"author",reason:"md5-mismatch"};let l=r===null?ee(e.owningFile,n,s.slice(0,8)):O(r,".internal","steps",`${n}-${s.slice(0,8)}`),a=Ve(l);return a===0?{kind:"author",reason:"missing-recording"}:{kind:"replay",recordingDir:l,flowCount:a}}function Ve(e){let t=O(e,"flows");if(!L(t))return 0;let n;try{n=We(t,{withFileTypes:!0}).filter(o=>o.isDirectory()&&/^\d+$/.test(o.name)).map(o=>parseInt(o.name,10))}catch{return 0}if(n.length===0)return 0;let r=Math.max(...n);for(let o=0;o<=r;o++)if(!L(O(t,String(o),"actions.ndjson")))return 0;return r+1}function vt(e){return e.some(t=>t.kind==="author")}function Pt(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function J(e){let t=s=>{let l=B(s);return l.endsWith("_test.md")?l.slice(0,-8):l.endsWith(".md")?l.slice(0,-3):l},n=t(e[0].file),r=t(e[e.length-1].file),o=e.slice(0,-1).map(s=>String(s.stepIndex));return O(He(e[e.length-1].file),`helper-output-${r}-${n}-${o.join("-")}`)}function jt(e){return Array.from({length:e.flowCount},(t,n)=>O(e.recordingDir,"flows",String(n),"actions.ndjson"))}import{existsSync as he,mkdirSync as Be,rmSync as Je,cpSync as Ge}from"fs";function ye(e,t){he(e)&&(he(t)&&Je(t,{recursive:!0,force:!0}),Be(t,{recursive:!0}),Ge(e,t,{recursive:!0}))}async function Ht(e){let t=new Map;for(let a of e.stepRunRecords)t.set(a.testmdStepIndex,a);let n=e.authoredFlatIdx??new Set,r=[],o=[],s=new Map,l=a=>{if(s.has(a))return s.get(a);let i=R(a,"Result.md"),c=P(i)?D(i):null;return s.set(a,c),c};for(let a of e.resolvedTest.unitFiles){let i=a.file===e.resolvedTest.rootPath,c=Q(a.file,qe(a.file,"utf8")),f=v(a.file),S=P(f)?D(f):null,m=[],w=[],x=[],g=[];if(!i)for(let p of e.resolvedTest.steps){if(p.owningFile!==a.file||p.trace.length<2)continue;let d=J(p.trace);g.includes(d)||g.push(d)}let j=p=>{if(S!==null)return null;for(let d of g){let M=l(d)?.steps[p-1];if(M)return{row:M,dir:d}}return null},A=[],U=!1,G=!1,K=!1,N=!1;for(let p of c.steps){let d=p.index,u=S?.steps[d-1];if(p.body.kind==="objective"){let h=e.resolvedTest.steps.filter(y=>y.owningFile===a.file&&y.trace[y.trace.length-1].stepIndex===d&&t.has(y.flatIndex)),I=h.length>0?h[h.length-1]:null;if(I){U=!0,n.has(I.flatIndex)&&(G=!0);let y=E(I),k;i?k=e.outcomes.find(Me=>Me.rootStepIndex===d)??{rootStepIndex:d,status:"skipped"}:k={rootStepIndex:d,status:ke(I,e.outcomes)},k.status==="failed"&&(K=!0),k.stepMd5==null&&(k.stepMd5=y),m.push(k),w.push({stepIndex:d,md5:y,rec:t.get(I.flatIndex)}),(!u||u.kind!=="objective"||u.status!==k.status||k.status==="passed"&&u.md5!==y)&&(N=!0)}else if(u&&u.kind==="objective")m.push({rootStepIndex:d,status:u.status,...u.md5?{stepMd5:u.md5}:{}}),x.push(d);else if(!i&&j(d)?.row.kind==="objective"){let y=j(d),k=y.row;m.push({rootStepIndex:d,status:k.status,...k.md5?{stepMd5:k.md5}:{}}),A.push({psIdx:d,dir:y.dir})}else i?m.push(e.outcomes.find(y=>y.rootStepIndex===d)??{rootStepIndex:d,status:"skipped"}):m.push({rootStepIndex:d,status:"skipped"});continue}let M=Ye(p.body.path)?p.body.path:et(Xe(a.file),p.body.path),T=te({path:p.body.path,bindings:p.body.bindings,optional:p.optional??!1}),C=Ze(X(a.file),v(M)),_=e.resolvedTest.steps.filter(h=>h.trace.some((I,y)=>y<h.trace.length-1&&I.file===a.file&&I.stepIndex===d)&&t.has(h.flatIndex));if(_.length>0){U=!0;let h;if(i)h=e.outcomes.find(I=>I.rootStepIndex===d)??{rootStepIndex:d,status:"passed",refKind:"import",refLabel:p.body.path};else{let I=_.some(y=>ke(y,e.outcomes)==="failed");h={rootStepIndex:d,status:I?"failed":"passed",refKind:"import",refLabel:p.body.path,inlinedCount:_.length}}h.status==="failed"&&(K=!0),h.stepMd5==null&&(h.stepMd5=T),h.helperResultRelPath==null&&(h.helperResultRelPath=C),m.push(h),(!u||u.kind!=="import"||u.status!==h.status||u.md5!==T)&&(N=!0)}else if(u&&u.kind==="import")m.push({rootStepIndex:d,status:u.status,refKind:"import",refLabel:u.importPath,...u.md5?{stepMd5:u.md5}:{},...u.helperResultRelPath?{helperResultRelPath:u.helperResultRelPath}:{}});else if(!i&&j(d)?.row.kind==="import"){let h=j(d).row;m.push({rootStepIndex:d,status:h.status,refKind:"import",refLabel:p.body.path})}else i?m.push(e.outcomes.find(h=>h.rootStepIndex===d)??{rootStepIndex:d,status:"skipped",refKind:"import",refLabel:p.body.path}):m.push({rootStepIndex:d,status:"skipped",refKind:"import",refLabel:p.body.path})}if(!(i||U&&(G||K||S===null||N)))continue;r.push(a.file);let b=Y(a.file);xe(R(b,".internal"),{recursive:!0});for(let p of w){let d=R(b,".internal","steps",`${p.stepIndex}-${p.md5.slice(0,8)}`);xe(d,{recursive:!0}),await pe({sessionDir:e.sessionDir,runIndex:p.rec.runIndex,totalRunDirs:p.rec.totalRunDirs,stagingStepDir:d,packTestDir:e.packTestDir})}if(x.length>0){let p=Z(a.file);if(P(p))for(let d of Ie(p)){let u=parseInt(d.split("-")[0]??"",10);!Number.isNaN(u)&&x.includes(u)&&Re(R(p,d),R(b,".internal","steps",d),{recursive:!0})}}for(let p of A){let d=R(p.dir,".internal","steps");if(P(d))for(let u of Ie(d))parseInt(u.split("-")[0]??"",10)===p.psIdx&&Re(R(d,u),R(b,".internal","steps",u),{recursive:!0})}let be=m.some(p=>p.status==="failed");if(ie({sourcePath:a.file,title:c.title,rootSteps:c.steps,outcomes:m,overallStatus:i?e.overallStatus:be?"failed":"passed",startedISO:e.startedISO,durationS:i?e.durationS:0,sessionId:e.sessionId,outPath:R(b,"Result.md")}),i){let p={};e.commitId&&(p.commit_id=e.commitId),e.tmsIds.testId&&(p.test_id=e.tmsIds.testId),e.tmsIds.testcaseId&&(p.testcase_id=e.tmsIds.testcaseId),e.tmsIds.projectId&&(p.project_id=e.tmsIds.projectId),e.tmsIds.folderId&&(p.folder_id=e.tmsIds.folderId),e.tmsIds.orgId&&(p.org_id=e.tmsIds.orgId),e.tmsIds.sessionName&&(p.session_name=e.tmsIds.sessionName);let d=me({priorMetaPath:W(a.file),recordFiles:fe(b)});d&&(p.media=d);let u=ne(a.file);u&&(p.tc_id=u),Qe(R(b,".internal","meta.json"),JSON.stringify(p,null,2)+`
|
|
6
|
+
`,"utf8");let M=R(e.sessionDir,"execution.json");if(P(M))try{Se(M,R(b,".internal","execution.json"))}catch{}if(e.codeExportDir){let T=e.codeExportLanguage??"python",C=e.codeExportFramework??"playwright",_=R(b,`${C}-${T}-code`);try{ye(e.codeExportDir,_)}catch(h){process.stderr.write(`warn: codegen copy failed: ${h.message}
|
|
7
|
+
`)}}}else if(a.kind==="test"||a.kind==="module"){let p=W(a.file);if(P(p))try{Se(p,R(b,".internal","meta.json"))}catch{}}!i&&g.length>0&&m.every(d=>d.status!=="skipped")&&o.push({unitFile:a.file,dirs:g.filter(d=>P(d))})}return{changedUnitFiles:r,legacySweep:o}}function Vt(e){for(let t of e)try{ze(t,{recursive:!0,force:!0})}catch{}}function ke(e,t){let n=e.trace[0].stepIndex,r=t.find(a=>a.rootStepIndex===n);if(!r)return"skipped";if(r.status==="passed")return"passed";if(r.status==="skipped")return"skipped";let o=e.trace.slice(1).map(a=>a.stepIndex),s=r.failedSubStepIndex??[],l=Math.min(o.length,s.length);for(let a=0;a<l;a++)if(o[a]!==s[a])return o[a]<s[a]?"passed":"skipped";return o.length===s.length?"failed":o.length<s.length?"passed":"skipped"}export{ie as a,Mt as b,wt as c,vt as d,Pt as e,jt as f,ut as g,yt as h,me as i,ye as j,Ht as k,Vt as l};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-
|
|
2
|
+
import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-KPL2XHYF.js";import{a as C}from"./chunk-UAFCBZ3P.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-F2XTOZTN.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
|
|
3
3
|
Please open this URL manually: ${e}
|
|
4
4
|
`)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
|
|
5
5
|
<html lang="en">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as R}from"./chunk-TDPWFYTJ.js";import{a as x}from"./chunk-
|
|
2
|
+
import{a as R}from"./chunk-TDPWFYTJ.js";import{a as x}from"./chunk-23MVD7GY.js";import{d as S}from"./chunk-ICUTARPB.js";import{a as y}from"./chunk-MMBBQ4OZ.js";import{a as p}from"./chunk-BCJNIDS3.js";import{d as g,i as E}from"./chunk-F2XTOZTN.js";import{spawn as M,execSync as h}from"child_process";import{appendFileSync as b,existsSync as m,mkdirSync as C}from"fs";import{homedir as L}from"os";import{join as V,resolve as s,dirname as v,delimiter as T}from"path";import{fileURLToPath as U}from"url";import{createInterface as I}from"readline";async function*A(e){let n=I({input:e,crlfDelay:1/0});for await(let r of n){let o=r.trim();if(o)try{let i=JSON.parse(o);i&&typeof i.type=="string"&&(yield i)}catch{}}}function O(e){return e==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function w(e){return e?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function N(e){return e==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var c=v(U(import.meta.url));function k(){for(let e of["python3","python"])try{return h(`${e} --version`,{stdio:"ignore"}),e}catch{}return null}function D(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",r={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},o=`${process.platform}-${process.arch}`,i=r[o];if(i)for(let t of i){let a=[s(c,"..","node_modules",t,"bin",n),s(c,"..","..","node_modules",t,"bin",n),s(c,"..","..","..","node_modules",t,"bin",n),s(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(m(u))return{cmd:u,args:[]}}let d=[s(c,"bin",n),s(c,"..","bin",n),s(c,"..","..","..","..","v16-runner","dist",n),s(c,"..","..","..","v16-runner","dist",n),s(c,"..","..","v16-runner","dist",n),s(process.cwd(),"v16-runner","dist",n),s(process.cwd(),"..","v16-runner","dist",n)];for(let t of d)if(m(t))return{cmd:t,args:[]};let l=[s(c,"..","..","v16-runner"),s(c,"..","..","..","..","v16-runner"),s(c,"..","..","..","v16-runner"),s(process.cwd(),"v16-runner"),s(process.cwd(),"..","v16-runner")];for(let t of l)if(m(s(t,"main.py"))){for(let u of[s(t,".venv","bin","python"),s(t,"..",".venv","bin","python"),s(t,"..","browser-agent",".venv","bin","python")])if(m(u))return{cmd:u,args:["main.py"],cwd:t};let a=k();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function P(e){return e?V(L(),".testmuai","kaneai","sessions",e,"runner-stderr.log"):null}function K(e){let n=M(e.runner.cmd,e.runner.args,{stdio:["pipe","pipe","pipe"],env:e.env,cwd:e.runner.cwd});n.stdin.on("error",()=>{});let r=P(e.sessionId);if(r)try{C(v(r),{recursive:!0})}catch{}let o=1e5,i="";n.stderr.on("data",u=>{if(i+=u.toString(),i.length>o&&(i=i.slice(-o)),r)try{b(r,u)}catch{}}),n.on("error",u=>{e.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:u.message})});let d=null,l=null,t=new Promise(u=>{n.on("close",(f,_)=>{d=f,l=_?String(_):null,e.log?.("info","RUNNER_EXIT","Runner exited",{code:f,signal:l??"none"}),u({code:f,signal:l})})}),a=A(n.stdout);return{child:n,events:a,getStderr:()=>i,getExitCode:()=>d,getExitSignal:()=>l,exited:t}}async function B(e,n){if(!n?.platform||!n.target_kind)return;let r=await S(n.platform)?.toolEnv(n.target_kind)??{dirs:[]};if(r.dirs.length>0&&(e.PATH=[...r.dirs,e.PATH??""].filter(Boolean).join(T)),r.appiumHome&&(e.APPIUM_HOME=r.appiumHome),r.wdaRoot&&(e.TESTMU_IOS_WDA_DERIVED_DATA=r.wdaRoot),n.platform==="android"){let o=y();o&&(e.PATH=[o.platformToolsDir,e.PATH??""].filter(Boolean).join(T),e.ANDROID_HOME=o.root,e.ANDROID_SDK_ROOT=o.root)}}function H(e){let n={...process.env};e.environment&&(n.TESTMUAI_ENV=e.environment),n.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(n.PYTHONIOENCODING="utf-8",n.PYTHONUTF8="1");let r=p(e.environment);n.V16_SERVER_API_HOST=r.v16ServerHost,n.ATMS_URL=r.tmsBaseUrl.replace(/\/api\/?$/,""),e.username&&e.accessKey&&(n.LT_USERNAME=e.username,n.LT_ACCESS_KEY=e.accessKey),e.sessionId&&(n.TESTMUAI_SESSION_ID=e.sessionId);let o=O(e.mode??"testing");Object.assign(n,o.set);for(let a of o.unset)delete n[a];let i=new x().load(),d=N(e.assertionMode??(i.assertion_mode==="visual"?"visual":"dom"));Object.assign(n,d.set);for(let a of d.unset)delete n[a];let l=e.finalValidation??i.final_validation,t=w(l);Object.assign(n,t.set);for(let a of t.unset)delete n[a];return n}function G(e,n){let r=p(n?.environment),o=R();o!==void 0&&e.ap_mode===void 0&&(e.ap_mode=o),e.telemetry_proxy_url===void 0&&process.env.KANE_TELEMETRY!=="0"&&(e.telemetry_proxy_url=E),e.media_upload===void 0&&e.org_id&&e.username&&e.access_key&&(e.media_upload={url:r.shareApiBaseUrl.replace(/\/$/,"")+"/mfs/v1.0/media/upload",artefacts_host:r.mediaArtefactsHost,org_id:e.org_id,media_dir:g})}async function oe(e,n){let r=D();if(!r)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(r)}
|
|
3
3
|
`);let o=H({environment:n?.environment,mode:n?.mode,assertionMode:n?.assertionMode,finalValidation:n?.finalValidation,username:e.username,accessKey:e.access_key,sessionId:e.session_id});e.device?.platform&&await B(o,e.device),G(e,{environment:n?.environment});let i=K({env:o,runner:r,log:n?.log,sessionId:e.session_id}),d=i.child;d.stdin.write(JSON.stringify(e)+`
|
|
4
4
|
`);let l=P(e.session_id);if(l)try{C(v(l),{recursive:!0}),b(l,`--- runner spawn ${new Date().toISOString()} run_index=${e.run_index} ---
|
|
5
5
|
`)}catch{}return{child:d,events:i.events,sendUserResponse(t){let a=JSON.stringify({type:"user_response",answer:t});try{d.stdin.write(a+`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Y,b as Z,c as nn,d as en,e as tn}from"./chunk-
|
|
2
|
+
import{a as Y,b as Z,c as nn,d as en,e as tn}from"./chunk-OUWOLCCS.js";import{b as rn,c as sn}from"./chunk-P7YZ3PU3.js";import{n as X,p as P}from"./chunk-RSSOJ3L2.js";import{a as jn}from"./chunk-6YGTRKDT.js";import{e as Pn}from"./chunk-UR6MHSHU.js";function on(i){return{command:"start",...i}}function an(i,e,o){return{command:"run",run_id:i,kind:e,...o}}function un(i){return{command:"cancel",...i?{run_id:i}:{}}}function dn(i){return{command:"ask_user_response",answer:i}}function ln(){return{command:"shutdown"}}var z=Symbol("run-queue-end"),G=class{items=[];waiting=null;ended=!1;error=null;push(e){if(this.waiting){let{resolve:o}=this.waiting;this.waiting=null,o(e)}else this.items.push(e)}end(){if(this.ended=!0,this.waiting){let{resolve:e}=this.waiting;this.waiting=null,e(z)}}fail(e){if(this.error=e,this.waiting){let{reject:o}=this.waiting;this.waiting=null,o(e)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(z):new Promise((e,o)=>{this.waiting={resolve:e,reject:o}})}},D=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;exited;constructor(e){this.env=e.env,this.runner=e.runner,this.log=e.log,this.sessionId=e.sessionId,this.spawnFn=e.spawn??Z;let o;this.exited=new Promise(c=>{o=c}),this.exitResolve=o}async start(e){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let o=new Promise((c,g)=>{this.pendingReady={resolve:c,reject:g}});this.writeCommand(on(e)),await o}async*run(e,o,c){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${e}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new G,w={runId:e,queue:g};this.activeRun=w,this.writeCommand(an(e,o,c));try{for(;;){let v=await g.next();if(v===z||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===e)))break}}finally{this.activeRun===w&&(this.activeRun=null)}}sendUserResponse(e){this.writeCommand(dn(e))}cancel(e){this.writeCommand(un(e))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(){this.shuttingDown=!0,this.proc&&(this.writeCommand(ln()),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(e){let o=JSON.stringify(e)+`
|
|
3
3
|
`;try{this.proc?.child.stdin?.write(o)}catch{}}async consume(){if(!this.proc)return;try{for await(let c of this.proc.events){if(c.type==="ready"){this.onReady();continue}this.routeEvent(c)}}catch(c){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:c instanceof Error?c.message:String(c)})}let{code:e,signal:o}=await this.proc.exited;this.onExit(e,o)}onReady(){if(this.pendingReady){let{resolve:e}=this.pendingReady;this.pendingReady=null,e()}}routeEvent(e){let o=this.activeRun;if(!o){this.log?.("warn","PERSISTENT_RUNNER_ORPHAN_EVENT","Runner event with no active run",{event_type:e.type});return}o.queue.push(e)}onExit(e,o){if(!this.finalized){if(this.finalized=!0,this.exitInfo={code:e,signal:o},this.shuttingDown||(this.exitedUnexpectedly=!0),this.exitResolve({code:e,signal:o}),this.pendingReady){let{reject:c}=this.pendingReady;this.pendingReady=null,c(new Error(`v16-runner exited before ready (code=${e}, signal=${o??"none"})`))}if(this.activeRun){let{queue:c}=this.activeRun;if(this.activeRun=null,this.shuttingDown)c.end();else{let g=this.proc?.getStderr()?.slice(-500)??"";c.fail(new Error(`v16-runner exited unexpectedly mid-run (code=${e}, signal=${o??"none"})${g?`
|
|
4
4
|
${g}`:""}`))}}}}};var p=Pn(jn(),1);function cn(i){let e={cdp_endpoint:i.cdp_endpoint,ws_endpoint:i.ws_endpoint,width:i.width,height:i.height,headless:i.headless,model:i.model,max_steps:i.max_steps,network_ws:i.network_ws,network_sse:i.network_sse,session_id:i.session_id};return i.device&&(e.device=i.device),i.auth&&(e.auth=i.auth),i.disable_ask_user&&(e.disable_ask_user=!0),i.username&&(e.username=i.username),i.access_key&&(e.access_key=i.access_key),e}function j(i,e){let o=null,c=(g,w)=>{for(let v=0;v<g.length;v++){let _=g[v],h=[...w,v];e(_)&&(o===null||h.length>o.length)&&(o=h),_.children&&_.children.length>0&&c(_.children,h)}};return c(i,[]),o}function N(i,e,o){if(e.length===0)return[...i];let c=e[0],g=[...i],w=g[c];if(e.length===1)g[c]=o(w);else{let v=e.slice(1),_=N(w.children??[],v,o);g[c]={...w,children:_}}return g}function pn(){return{steps:[],maxOrdinal:0}}function Nn(i,e){if(e.type==="run_start"&&e.child_id)return e.environment?.resolution?{...i,resolution:e.environment.resolution}:i;if(e.type==="run_start"){let o=sn(i.runnerEnvironment,rn(e.environment));if(o)return{...i,runnerEnvironment:o,...o.resolution?{resolution:o.resolution}:{}}}if(e.type==="step_end"&&typeof e.ordinal=="number"&&e.id){let o={id:e.id,ordinal:e.ordinal,status:e.status,...e.kind?{kind:e.kind}:{},...typeof e.duration=="number"?{duration_ms:Math.round(e.duration*1e3)}:{},...typeof e.action_id=="string"&&e.action_id?{action_id:e.action_id}:{}};return{...i,steps:[...i.steps,o],maxOrdinal:Math.max(i.maxOrdinal,e.ordinal)}}return i}function K(i){let e=i.indexOf(": ");return e>0&&e<15?i.slice(e+2):i}function V(i){return i.map(e=>{let o=e.children?V(e.children):e.children;return e.status==="running"?{...e,status:"stopped",phase:void 0,children:o}:o!==e.children?{...e,children:o}:e})}function Gn(i,e,o,c,g){let[w,v]=(0,p.useState)(!1),[_,h]=(0,p.useState)([]),[hn,T]=(0,p.useState)(null),[fn,B]=(0,p.useState)(null),[mn,k]=(0,p.useState)(null),[vn,W]=(0,p.useState)(null),[gn,J]=(0,p.useState)([]),[Rn,H]=(0,p.useState)(null),[Sn,yn]=(0,p.useState)(void 0),[wn,$]=(0,p.useState)(0),y=(0,p.useRef)(null),E=(0,p.useRef)(null),S=(0,p.useRef)(null),b=(0,p.useRef)(0),F=(0,p.useRef)(!1),U=(0,p.useRef)(pn()),O=(0,p.useRef)(null),xn=(0,p.useCallback)(async(m,x)=>{let Q=O.current;if(Q)try{await Q}catch{}h([]),T(null),B(null),k(null),W(null),J([]),H(null),yn(m.max_steps),v(!0),S.current=null,b.current=0,U.current=pn();let I=y.current;if(I&&E.current!==m.session_id){try{I.kill()}catch{}y.current=null,E.current=null,$(n=>n+1),I=null}if(!I){let n=Y();if(!n){k("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available."),v(!1);return}let d=en({environment:x?.environment,mode:x?.mode,assertionMode:x?.assertionMode,finalValidation:x?.finalValidation,username:m.username,accessKey:m.access_key,sessionId:m.session_id});m.device?.platform&&await nn(d,m.device);let u=new D({env:d,runner:n,log:x?.log,sessionId:m.session_id});y.current=u,E.current=m.session_id,I=u,X("runner",()=>{try{u.kill()}catch{}});let s=cn(m);try{await u.start(s)}catch(a){k(a instanceof Error?a.message:String(a)),v(!1),P("runner","Runner start failed"),y.current=null,E.current=null,$(t=>t+1);return}}let M={...m};delete M.run_id,tn(M,{environment:x?.environment});let In=`run-${m.run_index}`,Cn=m.mode==="replay"?"replay":"author",L=I,q=(async()=>{F.current=!1;for await(let n of L.run(In,Cn,M)){if(F.current)break;switch(U.current=Nn(U.current,n),n.type){case"run_start":if(n.child_id)break;if(S.current&&!S.current.isSingleFlow){let d=b.current;b.current++,h(u=>u.map((s,a)=>a===d?{...s,status:"running"}:s.status==="running"&&!s.children?.some(t=>t.status==="running")?{...s,status:s.children?.some(t=>t.status==="failed")?"failed":"passed"}:s))}break;case"bifurcation":{let d=n.flows??[],u=n.count??d.length,s={flows:d,isSingleFlow:n.is_single_flow??u<=1};W(s),S.current=s,b.current=0,h(d.map((a,t)=>({index:t+1,objective:a??`Flow ${t+1}`,status:"pending"})));break}case"step_start":{e?.("STEP_START",`Step ${n.index} started`,{index:n.index,objective:n.objective,child_id:n.child_id});let d=n.index,u=n.objective??`Step ${d}`,s=n.child_id,a=S.current&&!S.current.isSingleFlow;if(s)h(t=>{let r=j(t,l=>l.branchChildId===s)??j(t,l=>l.status==="running");return r?N(t,r,l=>{let f=(l.children??[]).map(R=>R.status==="running"&&R.childId===s?{...R,status:"stopped",phase:void 0}:R);return f.push({index:d,objective:u,status:"running",childId:s}),{...l,children:f}}):t});else if(a){let t=Math.max(0,b.current-1);h(r=>{let l=[...r];if(t>=l.length)return r;let f={...l[t]},C=[...f.children??[]].map(A=>A.status==="running"&&A.childId===void 0?{...A,status:"stopped",phase:void 0}:A);return C.push({index:d,objective:u,status:"running"}),f.children=C,f.status="running",l[t]=f,l})}else h(t=>{let r=V(t);return r.some(f=>f.index===d)?r.map(f=>f.index===d?{...f,status:"running",objective:u}:f):[...r,{index:d,objective:u,status:"running"}]});break}case"step_event":{e?.("STEP_EVENT",`Step ${n.index} ${n.event}`,{index:n.index,phase:n.event,action_type:n.action_type,detail:n.detail,child_id:n.child_id});let d=n.child_id,u=S.current&&!S.current.isSingleFlow;if(n.event==="cm_init"&&n.checkpoint_count!=null){J(s=>[...s,n.checkpoint_count]);break}if(n.event==="replay_started"){H({recordingLength:n.recording_length??0});break}if(n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&o?.(n.detail),d){let s=t=>{if(t.index!==n.index||t.childId!==d)return t;let r={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(r.objective=n.detail),n.action_type&&(r.actionType=n.action_type),{...t,...r}},a=t=>t.map(r=>{let l=s(r);return l!==r?l:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let s=Math.max(0,b.current-1);h(a=>{let t=[...a];if(s>=t.length)return a;let r={...t[s]},l=[...r.children??[]];if(!l.some(R=>R.index===n.index&&R.childId===void 0))l.push({index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type});else for(let R=0;R<l.length;R++){if(l[R].index!==n.index||l[R].childId!==void 0)continue;let C={phase:n.event};n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(C.objective=n.detail),n.action_type&&(C.actionType=n.action_type),l[R]={...l[R],...C}}return r.children=l,t[s]=r,t})}else h(s=>s.some(t=>t.index===n.index)?s.map(t=>{if(t.index!==n.index)return t;let r={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(r.objective=n.detail),n.action_type&&(r.actionType=n.action_type),{...t,...r}}):[...V(s),{index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type}]);break}case"step_end":{e?.("STEP_END",`Step ${n.index} ${n.status}`,{index:n.index,status:n.status,duration:n.duration,summary:n.summary,child_id:n.child_id}),c?.();let d=n.child_id,u=S.current&&!S.current.isSingleFlow;if(d){let s=t=>t.index===n.index&&t.childId===d?{...t,status:n.status,duration:n.duration,phase:void 0,objective:t.objective.startsWith("Step ")?K(n.summary||t.objective):t.objective}:t,a=t=>t.map(r=>{let l=s(r);return l!==r?l:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let s=Math.max(0,b.current-1);h(a=>{let t=[...a];if(s>=t.length)return a;let r={...t[s]},l=(r.children??[]).map(f=>f.index===n.index&&f.childId===void 0?{...f,status:n.status,duration:n.duration,phase:void 0,objective:f.objective.startsWith("Step ")?K(n.summary||f.objective):f.objective}:f);return r.children=l,t[s]=r,t})}else h(s=>s.map(a=>a.index===n.index?{...a,status:n.status,duration:n.duration,phase:void 0,objective:a.objective.startsWith("Step ")?K(n.summary||a.objective):a.objective}:a));{let a=S.current&&!S.current.isSingleFlow?Math.max(0,b.current-1):0,t=typeof n.ordinal=="number"&&n.id?{ordinal:n.ordinal,id:n.id}:void 0;i?.(n.index,a,n.child_id,t)}break}case"child_agent_start":{let d=n.objective??"",u=n.child_id;h(s=>{let a=j(s,t=>t.status==="running");return a?N(s,a,t=>({...t,objective:`${d} (branch)`,phase:`child: ${d.slice(0,50)}`,branchObjective:d,branchChildId:u})):s});break}case"child_agent_end":{let d=n.child_id,u=`child ${n.success?"done":"failed"}`;h(s=>{let a=j(s,t=>t.branchChildId===d);return a?N(s,a,t=>({...t,phase:u})):s.map(t=>t.phase?.startsWith("child:")?{...t,phase:u}:t)});break}case"describe_trigger":g?.(n);break;case"ask_user":T(n.question??"");break;case"run_end":h(d=>d.map(u=>u.status==="running"?{...u,status:n.status,phase:void 0}:u)),v(!1),B(n);break;case"error":v(!1),k(n.message??"Runner error"),h(d=>d.map(u=>u.status==="running"?{...u,status:"failed",phase:void 0}:u));break}}})().catch(n=>{if(y.current!==L)return;let u=[n instanceof Error?n.message:String(n)],s=L.stderr;s&&!u.join(`
|
|
5
5
|
`).includes(s)&&u.push(s),k(u.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Ve}from"./chunk-
|
|
2
|
+
import{a as Ve}from"./chunk-23MVD7GY.js";import{a as Ye}from"./chunk-MD3S2RXN.js";import{a as We}from"./chunk-YCCUBQY4.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{a as be}from"./chunk-U7BVK5IX.js";import{a as Ge}from"./chunk-KPL2XHYF.js";import{a as He}from"./chunk-BCJNIDS3.js";import{b as Le,y as u}from"./chunk-F2XTOZTN.js";import{a as re}from"./chunk-HCBYKLMW.js";import{a as h,b as f,h as Fe,i as Se,k as Ne}from"./chunk-C44QQJR4.js";import{a as we}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var je=$(we(),1);import{readFileSync as ct,writeFileSync as ut,mkdirSync as ft}from"fs";import{dirname as dt,join as ze}from"path";var mt=ze(Le,"command-history.json"),Dt=ze(Le,"generate-history.json"),ht=200,De=class{entries;filePath;max;constructor(t=mt,e=ht){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),o=[];for(let s=this.entries.length-1;s>=0;s--)this.entries[s].toLowerCase().includes(e)&&o.push(this.entries[s]);return o}_load(){if(this.filePath===null)return[];try{let t=ct(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){if(this.filePath!==null)try{ft(dt(this.filePath),{recursive:!0}),ut(this.filePath,JSON.stringify(this.entries)+`
|
|
3
3
|
`)}catch{}}};function kt(n){let t=(0,je.useRef)(null);return t.current||(t.current=new De(n)),t.current}var D=$(we(),1);var ke=$(we(),1);var Z=$(re(),1);function Xe({history:n,onSelect:t,onClose:e}){let[o,s]=(0,ke.useState)(""),[l,m]=(0,ke.useState)(0),v=o?n.search(o).slice(0,8):[];return Se((b,d)=>{if(d.escape){e();return}if(d.return){v.length>0&&v[l]?t(v[l]):e();return}if(d.upArrow){m(S=>Math.max(0,S-1));return}if(d.downArrow){m(S=>Math.min(v.length-1,S+1));return}if(d.backspace||d.delete){s(S=>S.slice(0,-1)),m(0);return}b&&!d.ctrl&&!d.meta&&(s(S=>S+b),m(0))}),(0,Z.jsxs)(h,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,Z.jsx)(f,{color:u.muted,bold:!0,children:"reverse search"}),(0,Z.jsxs)(h,{gap:1,children:[(0,Z.jsx)(f,{color:u.dim,children:"search:"}),(0,Z.jsx)(f,{children:o}),(0,Z.jsx)(f,{color:u.orange,children:"\u2588"})]}),v.length>0&&(0,Z.jsx)(f,{children:" "}),v.map((b,d)=>(0,Z.jsx)(h,{marginLeft:2,children:(0,Z.jsxs)(f,{color:d===l?u.orange:u.dim,bold:d===l,children:[d===l?"\u25B8 ":" ",b]})},`${d}-${b}`))]})}var X=$(re(),1);function Je({commands:n,selectedIndex:t}){return n.length===0?null:(0,X.jsx)(h,{flexDirection:"column",marginBottom:0,children:n.map((e,o)=>{let s=o===t;return e.disabled?(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:u.dim,children:["/",e.name]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.disabledReason??e.description]})]},e.name):(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:s?u.orange:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:s?u.orange:void 0,bold:s,children:["/",e.name]}),e.args&&(0,X.jsxs)(f,{color:u.dim,children:[" ",e.args]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.description]})]},e.name)})})}var Ze=$(we(),1);var q=$(re(),1),et={scenario:"Scenarios",case:"Test Cases",file:"Files",artifact:"Artifact candidates",installed:"Installed on device"};function Qe(n){let t={scenario:0,case:0,file:0,artifact:0,installed:0};for(let e of n)t[e.kind]++;return["scenario","case","file","artifact","installed"].filter(e=>t[e]>0).map(e=>`${t[e]} ${et[e]}`).join(" \xB7 ")}var Pe=7;function tt({items:n,selectedIndex:t,accent:e=u.orange}){let o=n.length;if(o===0)return null;let s=Math.floor(Pe/2),l=o<=Pe?0:Math.max(0,Math.min(t-s,o-Pe)),m=Math.min(o,l+Pe),v=l,b=o-m;return(0,q.jsxs)(h,{flexDirection:"column",marginBottom:0,children:[v>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${v} above \u2014 ${Qe(n.slice(0,l))}`})}),n.slice(l,m).map((d,S)=>{let U=l+S,F=d.selectable!==!1,E=U===t&&F,R=S===0||n[U-1].kind!==d.kind;return(0,q.jsxs)(Ze.default.Fragment,{children:[R&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:et[d.kind]})}),(0,q.jsxs)(h,{children:[(0,q.jsx)(f,{color:E?e:u.dim,children:E?"\u276F ":" "}),(0,q.jsxs)(f,{color:E?e:F?void 0:u.dim,bold:E,children:[d.label,d.reason?` \u2014 ${d.reason}`:""]})]})]},`${d.kind}:${d.value}:${U}`)}),b>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${b} more \u2014 ${Qe(n.slice(m))}`})})]})}var Be=$(we(),1);var gt=27,pt=127,xt=11;function bt(n){return n>=64&&n<=126}function Tt(n,t){n===xt&&t({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(n)})}function vt(n,t){n===pt&&t({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function wt(n,t){let e=n.map(s=>String.fromCharCode(s)).join(""),o=/^\[1;([0-9]+)([A-D])$/.exec(e);if(o){let s=parseInt(o[1],10),l=o[2],m={raw:"\x1B"+e};if(s===2)m.shift=!0;else if(s===3)m.meta=!0;else if(s===5)m.ctrl=!0;else return;l==="A"?m.arrowUp=!0:l==="B"?m.arrowDown=!0:l==="C"?m.arrowRight=!0:l==="D"&&(m.arrowLeft=!0),t(m);return}if(e==="[H"||e==="[1~"||e==="[7~"){t({home:!0,raw:"\x1B"+e});return}if(e==="[F"||e==="[4~"||e==="[8~"){t({end:!0,raw:"\x1B"+e});return}if(e==="[3;5~"){t({delete:!0,ctrl:!0,raw:"\x1B"+e});return}if(e==="[3;3~"){t({delete:!0,meta:!0,raw:"\x1B"+e});return}}function St(n,t){n===72?t({home:!0,raw:"\x1BO"+String.fromCharCode(n)}):n===70&&t({end:!0,raw:"\x1BO"+String.fromCharCode(n)})}function Et(){let n="IDLE",t=[];function e(){n="IDLE",t=[]}return{feed(o,s){for(let l of o)n==="IDLE"?l===gt?(n="ESC",t=[]):Tt(l,s):n==="ESC"?l===91?(n="CSI",t=[]):l===79?(n="SS3",t=[]):(vt(l,s),e()):n==="CSI"?(t.push(l),bt(l)&&(wt([91,...t],s),e())):n==="SS3"&&(St(l,s),e())},flushIdle(o){n==="ESC"&&t.length===0&&o({raw:"\x1B"}),e()}}}function nt(n,t={}){let e=(0,Be.useRef)(n);e.current=n;let{stdin:o}=Fe();(0,Be.useEffect)(()=>{if(t.isActive===!1||!o)return;let s=Et(),l=null,m=v=>{l&&(clearTimeout(l),l=null);let b=Buffer.isBuffer(v)?v:Buffer.from(v,"binary");s.feed(b,d=>e.current(d)),l=setTimeout(()=>{s.flushIdle(d=>e.current(d)),l=null},50)};return o.on("data",m),()=>{o.removeListener("data",m),l&&clearTimeout(l)}},[t.isActive,o])}var w=$(re(),1);function yt(n,t){let e=t-1;for(;e>=0&&n[e]!=="@"&&n[e]!==" "&&n[e]!==`
|
|
4
4
|
`;)e--;return e<0||n[e]!=="@"||e>0&&n[e-1]!==" "&&n[e-1]!==`
|
|
5
5
|
`?null:{at:e,query:n.slice(e+1,t).join("")}}function rt(n,t,e){for(let o=t+e;o>=0&&o<n.length;o+=e)if(n[o]?.selectable!==!1)return o;return t}function At(n){let t=n.findIndex(e=>e.selectable!==!1);return t===-1?0:t}var Oe=10;function Rt(n){return n.replace(/\x1b?\[200~/g,"").replace(/\x1b?\[201~/g,"").replace(/\r\n/g,`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-
|
|
2
|
+
import{a as f}from"./chunk-2GWMENG5.js";import{y as t}from"./chunk-F2XTOZTN.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as n}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as c}from"./chunk-UR6MHSHU.js";var p=c(R(),1);var e=c(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,i){return s.map(l=>l.name===o?{...l,status:d,detail:i}:l)}function D(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),i=Math.round(o%60);return`${d}m ${i}s`}function w(s){let[o,d]=(0,p.useState)(0),i=p.default.useRef(Date.now());return(0,p.useEffect)(()=>{if(!s)return;i.current=Date.now();let l=setInterval(()=>{d(Date.now()-i.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:i}){let l=w(o==="uploading");return o==="uploading"?(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",D(l)]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:s.filter(r=>r.status!=="skipped"||r.detail).map((r,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=r.status==="done",m=r.status==="running",g=r.status==="failed",B=r.status==="skipped";return(0,e.jsxs)(a,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(a,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):B?(0,e.jsx)(n,{color:t.muted,children:"\u2013"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:r.label}),r.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",r.detail]})]},r.name)})}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(a,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{v as a,U as b,h as c};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as N,b as U,c as Y,d as L}from"./chunk-
|
|
2
|
+
import{a as N,b as U,c as Y,d as L}from"./chunk-TWZ6NZWE.js";import{l as R,m as D,o as P}from"./chunk-AHXOKBVE.js";import{g as A}from"./chunk-55YDTPB7.js";import{i as G}from"./chunk-YCH7H7JX.js";import{T as S,W as k,X as C}from"./chunk-E44OHYDS.js";import{c as E}from"./chunk-H6TNBKGR.js";import{a as h}from"./chunk-CH273NAE.js";import{C as y}from"./chunk-GP7WD4UY.js";import{t as T}from"./chunk-3N6IAVD5.js";import{existsSync as H}from"fs";import{basename as Z}from"path";import{appendFileSync as W,mkdirSync as B}from"fs";import{homedir as X}from"os";import{dirname as K,join as V}from"path";function F(d,a){let t=/^(DOCX_[A-Z_]+):/.exec(a)?.[1];if(t)try{let u=process.env.KANE_CONTEXT_REFUSAL_LOG??V(X(),".testmuai","kaneai","context-refusals.log");B(K(u),{recursive:!0}),W(u,`${new Date().toISOString()} ${t} ${d}
|
|
3
3
|
`)}catch{}}function j(d){return d?.outcome==="added"?"added .context/ to .gitignore":d?.outcome==="failed"?`warning: could not add .context/ to .gitignore: ${d.reason}`:null}async function x(d,a,t,u=process.cwd(),f){let l=h(u),g=[];if(a.as!==void 0&&d.length>1)return(t.err??t.out)(`error: --as names ONE source identity \u2014 pass a single file (got ${d.length})`,"AS_SINGLE_SOURCE"),{code:2,results:g};for(let i of d){if(Y(i)){let e=L(i);if(e===null)return(t.err??t.out)(`error: ${i}: unsupported remote URL \u2014 supported: ${U.map(c=>c.hint).join("; ")}`,"UNSUPPORTED_URL"),{code:1,results:g};let o=await e.ingest(i,a.as,t,l,f);if(o.code!==0)return{code:o.code,results:g};if(o.result){let c=j(o.result.gitignore);c&&t.out(c),g.push({status:o.result.status==="versioned"?"versioned":o.result.status==="unchanged"?"unchanged":"created",source_id:o.result.source_id,source_cid:o.result.source_cid,...o.result.gitignore?{gitignore:o.result.gitignore}:{}})}continue}let m=a.as,p;if(m===void 0&&H(l)){let e=R(i),o=D(e);if(o){let c=y(l);c.heads.get(o)!=null&&c.heads.get(e)==null&&(p=o,t.isTTY&&await t.confirm(`${e} looks like a new version of existing source '${o}' \u2014 ingest as '${o}' (replaces the current version; items built on it go stale)?`)&&(m=o))}}let n;try{n=await P({contextDir:l,filePath:i,asId:m,confirmSameSource:t.isTTY?e=>t.confirm(`identical bytes already ingested as ${e} \u2014 treat as the same source?`):void 0,converters:{pdf:A,docx:G}})}catch(e){let o=e instanceof Error?e.message:String(e);return e instanceof T?((t.err??t.out)(`error: ${o}`,e.code),(t.err??t.out)(`next: ${e.remedy}`,e.code),{code:2,results:g}):(F(i,o),(t.err??t.out)(`error: ${i}: ${o}`,"INGEST_FAILED"),{code:1,results:g})}t.out(N(t.isTTY,n,Z(i)));for(let e of n.warnings??[])t.out(`warning: ${e}`);let _=j(n.gitignore);if(_&&t.out(_),n.composite&&(n.composite.delivered>0||n.composite.omitted>0)){let e=n.composite.pages!==void 0?` ${n.composite.pages} pages,`:"";t.out(`${n.source_id}: ${n.composite.kind},${e} ${n.composite.delivered} images delivered (${n.composite.omitted} omitted)`)}let v;if(!t.isTTY&&n.status==="created"){let e=y(l);for(let[o,c]of e.heads.entries())if(!(o===n.source_id||c==null)&&e.getNode(c)?.content.blob===n.blob){v=o,t.out(`hint: identical bytes already ingested as ${o} \u2014 merged later via review`);break}}g.push({status:n.status,source_id:n.source_id,source_cid:n.cid,...n.warnings?.length?{warnings:n.warnings}:{},...n.composite?{media:{kind:n.composite.kind,...n.composite.pages!==void 0?{pages:n.composite.pages}:{},delivered:n.composite.delivered,omitted:n.composite.omitted}}:{},...v?{duplicate_of:v}:{},...p&&m===void 0?{lineage_candidate:p}:{},...n.gitignore?{gitignore:n.gitignore}:{}})}return{code:0,results:g}}async function le(d,a,t,u=process.cwd(),f){return(await x(d,a,t,u,f)).code}async function fe(d,a){if(a.mode!=null&&!["interactive","agent","ci","override"].includes(a.mode)){let{makeHeadlessIO:r,agentRefusal:s}=await import("./headless-io-3A3BZVQ5.js");return s(r("ndjson","extract"),`ingest: --mode must be interactive | agent | ci | override, got '${a.mode}'`,"MODE_USAGE")}let t=E();if(a.mode==="interactive"&&!t)return process.stderr.write(`ingest: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
4
4
|
`),2;let u=a.mode??(t?"interactive":void 0),f=u==="interactive"||u==="agent"||u==="override";if(!f&&(a.plan||a.force||a.trust!==void 0))return process.stderr.write(`ingest: --plan/--force/--trust steer the extraction \u2014 not available when only landing (use --mode agent to extract headless)
|
|
5
5
|
`),2;let{createInterface:l}=await import("readline/promises"),g=u==="agent",i=g?(await import("./headless-io-3A3BZVQ5.js")).makeHeadlessIO("ndjson","extract"):null,m=H(h(process.cwd()))?k(h(process.cwd())):null;if(m)return i?(i.event(C(m)),i.done(2,"refused")):(process.stderr.write(`error: ${m.text}
|
|
6
6
|
next: ${m.remedy}
|
|
7
7
|
`),2);let p=[],n=()=>{for(let r of p.splice(0))i.event({type:"error",message:r.message,...r.code?{code:r.code}:{}})},_=r=>{for(let s of r)i.event({type:"ingested",source_id:s.source_id,status:s.status,cid:s.source_cid,...s.warnings?.length?{warnings:s.warnings}:{},...s.media?{media:s.media}:{},...s.duplicate_of?{duplicate_of:s.duplicate_of}:{},...s.lineage_candidate?{lineage_candidate:s.lineage_candidate}:{}})},v=r=>{for(let s of r)s.gitignore?.outcome==="added"?i.event({type:"gitignore_updated",path:".gitignore"}):s.gitignore?.outcome==="failed"&&i.event({type:"warning",message:`could not add .context/ to .gitignore: ${s.gitignore.reason}`})},e=i?{out:()=>{},err:(r,s)=>p.push({message:r.replace(/^error: /,""),...s?{code:s}:{}}),isTTY:!1,confirm:async()=>!1}:{out:r=>process.stdout.write(r+`
|
|
8
8
|
`),err:r=>process.stderr.write(r+`
|
|
9
|
-
`),isTTY:t,confirm:async r=>{let s=l({input:process.stdin,output:process.stdout});try{let O=await s.question(`${r} [Y/n] `);return!/^n(o)?$/i.test(O.trim())}finally{s.close()}}};if(!f){let{withTelemetry:r}=await import("./with-telemetry-
|
|
9
|
+
`),isTTY:t,confirm:async r=>{let s=l({input:process.stdin,output:process.stdout});try{let O=await s.question(`${r} [Y/n] `);return!/^n(o)?$/i.test(O.trim())}finally{s.close()}}};if(!f){let{withTelemetry:r}=await import("./with-telemetry-CLSDKQAG.js");return r("ingest",async()=>{await S(h(process.cwd()),I=>(e.err??e.out)(I));let{code:s,results:O}=await x(d,{as:a.as},e,void 0,void 0);if(s!==0)return s;let b=O.filter(I=>I.status!=="unchanged").length;return b>0&&(e.err??e.out)(`landed ${b} source(s) \u2014 run kane-cli context extract to extract them`),0},{write:!0})}let o;try{o=i?await(await import("./run-channel-RGH4WIQX.js")).runWithChannel({event:i.event},()=>x(d,{as:a.as},e,void 0,void 0)):await x(d,{as:a.as},e,void 0,void 0)}catch(r){if(i)return n(),i.event({type:"error",message:r instanceof Error?r.message:String(r),code:"INGEST_FAILED"}),i.done(1,"error");throw r}let{code:c,results:w}=o;if(i&&v(w),c!==0)return i?(_(w),n(),i.done(c,c===2?"refused":"error")):c;if(w.length===0)return i?i.done(0):0;let{extractCommand:q}=await import("./extract-cmd-RKEE32FN.js"),M=[...new Set(w.map(r=>r.source_id))],$=await q({...a.mode!==void 0?{mode:a.mode}:{},...a.plan?{plan:!0}:{},...a.force?{force:!0}:{},...a.trust!==void 0?{trust:a.trust}:{},sources:M,landed:w});if($===2&&!g){let r=w.filter(s=>s.status!=="unchanged").length;r>0&&(e.err??e.out)(`note: the ${r} landed source(s) are safe \u2014 extract later with kane-cli context extract`)}return $}export{x as a,le as b,fe as c};
|