@testmuai/kane-cli 0.7.2 → 0.8.1
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-E7QKI4LA.js → ChatSurface-U37VZDCW.js} +1 -1
- package/dist/{ChromeProfilePicker-DGDWGCZD.js → ChromeProfilePicker-AUU7JF6F.js} +1 -1
- package/dist/{CliFeedbackPrompt-SYCZXSME.js → CliFeedbackPrompt-4W74Y3UF.js} +1 -1
- package/dist/{CliUploadProgress-VDEAKXJY.js → CliUploadProgress-6HL7WTEX.js} +1 -1
- package/dist/ConfigView-6BSCZP5Y.js +2 -0
- package/dist/EvidenceViewOffer-62XHEEGW.js +2 -0
- package/dist/FolderPicker-S7U2EN2M.js +2 -0
- package/dist/{HelpView-ON6BFGJM.js → HelpView-TU7ED43J.js} +1 -1
- package/dist/{InfoBox-B23NZ6IG.js → InfoBox-JLTMKVDE.js} +1 -1
- package/dist/{LinksBox-TI26VFFH.js → LinksBox-LREUUJDV.js} +1 -1
- package/dist/{ProfilesView-CRO5AH3H.js → ProfilesView-W3GX2N2E.js} +1 -1
- package/dist/{ProjectPicker-3N7LJOXU.js → ProjectPicker-SYQUJK2J.js} +1 -1
- package/dist/{SaveSessionPrompt-UTOEC5AW.js → SaveSessionPrompt-MR5NJMRP.js} +1 -1
- package/dist/SingleShotApp-XOKVOM7C.js +2 -0
- package/dist/{SummaryBox-JK64EKC2.js → SummaryBox-UAYSVFB7.js} +1 -1
- package/dist/TestMdRunView-7UVSDAF4.js +2 -0
- package/dist/{WhoamiView-6QSLPNF6.js → WhoamiView-2YU76ASQ.js} +1 -1
- package/dist/adbkit-apkreader-ORZBGCJQ.js +184 -0
- package/dist/app-client-OEXESV4U.js +2 -0
- package/dist/app-download-AEEFQ63M.js +2 -0
- package/dist/{auth-IKFVW3NX.js → auth-HET3TBRI.js} +1 -1
- package/dist/{bind-KCUSVJXG.js → bind-STKXOUYI.js} +3 -3
- package/dist/bootstrap-44YKVWWE.js +2 -0
- package/dist/bridge-5Z3BIB77.js +2 -0
- package/dist/{changelog-AAH2ZBYO.js → changelog-7OWRHFHZ.js} +1 -1
- package/dist/{chat-committer-UUC6JTRJ.js → chat-committer-ZWWCLJFD.js} +1 -1
- package/dist/{chunk-ZUGCHQFC.js → chunk-27U4PLPX.js} +1 -1
- package/dist/{chunk-ZBOWFJB2.js → chunk-2BGUUWNF.js} +2 -2
- package/dist/chunk-2KDGIZED.js +4 -0
- package/dist/{chunk-SFII7HPP.js → chunk-3LJWYRAA.js} +1 -1
- package/dist/chunk-3PECJD6S.js +11 -0
- package/dist/{chunk-7QJ75SYR.js → chunk-3POR47RC.js} +2 -2
- package/dist/chunk-4JOD47QI.js +2 -0
- package/dist/{chunk-QIGPXYMF.js → chunk-56PAQAX5.js} +6 -6
- package/dist/{chunk-DZPGG4S6.js → chunk-65ZTD5SJ.js} +2 -2
- package/dist/chunk-6IA6QMPH.js +2 -0
- package/dist/{chunk-VT54ARGE.js → chunk-6O3DDOP2.js} +1 -1
- package/dist/chunk-6XX4LEVJ.js +2 -0
- package/dist/{chunk-4NFCAGRK.js → chunk-766WGMBU.js} +1 -1
- package/dist/{chunk-VMM4LC4V.js → chunk-7BZSCUPP.js} +3 -3
- package/dist/{chunk-PLOWZLG5.js → chunk-7JWKHKFU.js} +2 -2
- package/dist/chunk-7Q6M6P4X.js +26 -0
- package/dist/chunk-AW2XUHH4.js +2 -0
- package/dist/{chunk-7OYZR6JA.js → chunk-BRHNRCEZ.js} +1 -1
- package/dist/chunk-BRIEBB2U.js +2 -0
- package/dist/{chunk-APPYQZFK.js → chunk-C7HSWZP6.js} +1 -1
- package/dist/chunk-CTW2VQKS.js +6 -0
- package/dist/{chunk-FDIPQRX4.js → chunk-DCY6R5DP.js} +1 -1
- package/dist/{chunk-KWIK22R6.js → chunk-DO5HAO3H.js} +1 -1
- package/dist/chunk-DPUV6OSP.js +2 -0
- package/dist/{chunk-B5RS2XZU.js → chunk-DZGCXKKI.js} +3 -3
- package/dist/{chunk-JKM2PUHI.js → chunk-EDSZJZFG.js} +1 -1
- package/dist/{chunk-OIYGGEUL.js → chunk-ELM6MXGJ.js} +1 -1
- package/dist/{chunk-VHZ4S57N.js → chunk-EWCAFKLX.js} +1 -1
- package/dist/chunk-EYOCNMUM.js +2 -0
- package/dist/{chunk-GYNTNKNB.js → chunk-FEJXWJ3L.js} +1 -1
- package/dist/{chunk-UC7MNPIN.js → chunk-FMRSMN34.js} +1 -1
- package/dist/chunk-FNH55WSR.js +19 -0
- package/dist/chunk-FQLIW3LM.js +2 -0
- package/dist/{chunk-O75ZHGJG.js → chunk-G7VQCS4J.js} +1 -1
- package/dist/{chunk-2WFZIQ62.js → chunk-GCBKDX2J.js} +1 -1
- package/dist/chunk-GKYPNSQP.js +26 -0
- package/dist/chunk-GPG3FIN3.js +21 -0
- package/dist/chunk-GZPK6FRP.js +7 -0
- package/dist/{chunk-XUS4WKDS.js → chunk-HCKH44I2.js} +1 -1
- package/dist/chunk-HEAIJCGZ.js +2 -0
- package/dist/{chunk-SL6PCVM2.js → chunk-HMYMSRA4.js} +1 -1
- package/dist/chunk-IOFZSQAA.js +2 -0
- package/dist/{chunk-YTHQNN2L.js → chunk-IP2O264K.js} +1 -1
- package/dist/{chunk-AXTGYOMK.js → chunk-JJHG3BWO.js} +1 -1
- package/dist/chunk-KFSUPQAG.js +66 -0
- package/dist/chunk-KRKGZ2ZW.js +47 -0
- package/dist/{chunk-AJ56AMT6.js → chunk-KU6IXFGZ.js} +1 -1
- package/dist/chunk-L7MXYCD7.js +2 -0
- package/dist/{chunk-5ZQZOVWY.js → chunk-MA34UWKX.js} +3 -3
- package/dist/chunk-MBF3FP5P.js +5 -0
- package/dist/chunk-MSGW4JDG.js +2 -0
- package/dist/{chunk-C3T7TKAC.js → chunk-MXHHMIO2.js} +2 -2
- package/dist/{chunk-RDNFVZEB.js → chunk-NX7TM662.js} +1 -1
- package/dist/chunk-OMQCD3KR.js +2 -0
- package/dist/{chunk-OR6MCL6Z.js → chunk-OTTGS2TE.js} +1 -1
- package/dist/chunk-QGKPLOUI.js +2 -0
- package/dist/{chunk-FBHRBFHP.js → chunk-QRZRSAZH.js} +1 -1
- package/dist/{chunk-VLWMMOMF.js → chunk-QSDH5P7C.js} +1 -1
- package/dist/{chunk-VOOPWFHW.js → chunk-QW6EZC53.js} +1 -1
- package/dist/{chunk-ZRASQ63J.js → chunk-RC52N7PC.js} +1 -1
- package/dist/{chunk-M6FKJKC6.js → chunk-RFR4ZKIC.js} +3 -3
- package/dist/{chunk-AFBKGZFG.js → chunk-RLRNLIRS.js} +1 -1
- package/dist/{chunk-5FJJJNJK.js → chunk-SDPRO2LE.js} +1 -1
- package/dist/chunk-T5Y6MOLM.js +4 -0
- package/dist/{chunk-VRLUNZAK.js → chunk-TFPPEOAK.js} +1 -1
- package/dist/{chunk-5SXMV66P.js → chunk-TKGUT425.js} +1 -1
- package/dist/chunk-TYLYFERW.js +10 -0
- package/dist/chunk-TZXXJWHA.js +2 -0
- package/dist/{chunk-KQZA2QSC.js → chunk-UDIQOJEL.js} +1 -1
- package/dist/chunk-UV462FZR.js +2 -0
- package/dist/{chunk-HYSFJSIG.js → chunk-UXDL4XDL.js} +1 -1
- package/dist/{chunk-53IBTIL3.js → chunk-V2R3LCA3.js} +1 -1
- package/dist/{chunk-VFII6C46.js → chunk-W2JFDDIB.js} +1 -1
- package/dist/{chunk-4LTXE3IX.js → chunk-XO5ZH3ZR.js} +1 -1
- package/dist/{chunk-EOLFTMWF.js → chunk-YFYCCTSL.js} +1 -1
- package/dist/{chunk-JPWLGHPM.js → chunk-YJELGSKJ.js} +1 -1
- package/dist/chunk-YRFMPIU2.js +4 -0
- package/dist/{chunk-F7ISS545.js → chunk-ZGBSGZZM.js} +1 -1
- package/dist/{chunk-VWKVUOXU.js → chunk-ZIUAOEUC.js} +1 -1
- package/dist/chunk-ZVHCQMJ6.js +13 -0
- package/dist/{config-CWZV6XPT.js → config-RS47F5SC.js} +1 -1
- package/dist/{controller-client-RD2YEMAH.js → controller-client-OB4WD2C4.js} +1 -1
- package/dist/{cover-cmd-NWIRJY5Z.js → cover-cmd-HDZZWJXG.js} +1 -1
- package/dist/{credentials-YHTJGKEO.js → credentials-OH6AVI6N.js} +1 -1
- package/dist/deps-resolve-XC5S53DG.js +2 -0
- package/dist/{dispatch-WVNXB7AD.js → dispatch-SE5GY3Z2.js} +1 -1
- package/dist/doctor-FSECFZUU.js +2 -0
- package/dist/docx-convert-JMUMT5C4.js +2 -0
- package/dist/evidence-OYPHZUKI.js +2 -0
- package/dist/evolve-cmd-BCPNXAMV.js +2 -0
- package/dist/exec-P2IKJRRR.js +2 -0
- package/dist/exit-manager-3FVBTNYR.js +2 -0
- package/dist/{explain-cmd-IZEHWZV5.js → explain-cmd-3GEKR7O5.js} +1 -1
- package/dist/{explain-cmd-75MCF2ZV.js → explain-cmd-EX24XKD6.js} +1 -1
- package/dist/{extract-bind-5OWELRME.js → extract-bind-LLEASZAK.js} +3 -3
- package/dist/{extract-cmd-ZRYMJ6IC.js → extract-cmd-UZMEZMGP.js} +2 -2
- package/dist/{gaps-cmd-XBRXKXDL.js → gaps-cmd-IVXFPFAQ.js} +1 -1
- package/dist/{generate-headless-D6BISWDC.js → generate-headless-D3SVQ2AI.js} +3 -3
- package/dist/host-7GZPBA74.js +2 -0
- package/dist/index.js +85 -69
- package/dist/ingest-cmd-EAE7N5RC.js +2 -0
- package/dist/{interactive-bind-XSRD36MO.js → interactive-bind-ORMN2REX.js} +3 -3
- package/dist/{lifecycle-cmd-EQSFAZG6.js → lifecycle-cmd-O2324GN6.js} +1 -1
- package/dist/{list-cmd-IRJSUCM5.js → list-cmd-N4KMA34H.js} +1 -1
- package/dist/list-commands-MRXL5HGS.js +2 -0
- package/dist/login-flow-QJQM3RHT.js +2 -0
- package/dist/{maintenance-cmd-MVFA6H74.js → maintenance-cmd-6XSVO6FO.js} +1 -1
- package/dist/mobile-prompts-TOX35ER6.js +2 -0
- package/dist/persist-recorded-session-TLDQ5HKP.js +3 -0
- package/dist/{phase-seed-DIRETNU6.js → phase-seed-VFHIH6FL.js} +1 -1
- package/dist/pipeline-UOM4LNAI.js +2 -0
- package/dist/prepare-target-QYWIJIVQ.js +2 -0
- package/dist/reconcile-cmd-3H34KVVD.js +2 -0
- package/dist/{reconcile-deps-HTT6IPHT.js → reconcile-deps-XIH75ZLY.js} +2 -2
- package/dist/reconcile-engine-UKWPG2LV.js +2 -0
- package/dist/{recording-banner-76GCIPUN.js → recording-banner-4M7XHVGI.js} +1 -1
- package/dist/registry-PYOTKZYZ.js +2 -0
- package/dist/{require-project-folder-ACRDP5ZB.js → require-project-folder-4UPQNEBJ.js} +1 -1
- package/dist/resolve-run-intent-X72V3KJA.js +7 -0
- package/dist/{resolver-SRPCFW7P.js → resolver-UBOZLFFE.js} +1 -1
- package/dist/{review-cmd-L3V5UP5T.js → review-cmd-DQRKQUMG.js} +1 -1
- package/dist/run-2COODVX2.js +2 -0
- package/dist/run-URPGHOQM.js +2 -0
- package/dist/{run-test-md-KEHSRMCM.js → run-test-md-76ZPKXO6.js} +3 -3
- package/dist/session-target-UWROGOCY.js +2 -0
- package/dist/{sessions-cmd-ZVYGSRJ3.js → sessions-cmd-ZZIZN2VB.js} +1 -1
- package/dist/{skill-installer-HBN3A35K.js → skill-installer-CIS6GAYF.js} +1 -1
- package/dist/spawner-J67QR4QP.js +2 -0
- package/dist/{structured-answers-A43Q25CZ.js → structured-answers-5EY2AZN7.js} +1 -1
- package/dist/tcg-generate-BDTRKY2A.js +2 -0
- package/dist/testmd-actions-77ELR5UU.js +2 -0
- package/dist/token-refresh-4BPAPXKK.js +2 -0
- package/dist/types-6E2HTDKJ.js +2 -0
- package/dist/{validate-basic-ZGWPBYB6.js → validate-basic-2GVSQ2R5.js} +1 -1
- package/dist/{verdicts-SCETLY5J.js → verdicts-TRSTJLCL.js} +1 -1
- package/dist/{version-check-CJWKDAXV.js → version-check-O6PYTI4T.js} +1 -1
- package/dist/{view-cmd-SOVM64L2.js → view-cmd-KPJTP4DI.js} +1 -1
- package/dist/{walk-session-YUYRULPY.js → walk-session-CHJXHZMO.js} +1 -1
- package/dist/with-telemetry-CQCWLVOC.js +2 -0
- package/package.json +12 -6
- package/dist/ConfigView-HPKRQXMC.js +0 -2
- package/dist/EvidenceViewOffer-F5YG54OC.js +0 -2
- package/dist/FolderPicker-4NSDXQY5.js +0 -2
- package/dist/SingleShotApp-Y3YDFQSD.js +0 -2
- package/dist/TestMdRunView-O6JTHV5W.js +0 -2
- package/dist/bootstrap-NFYYRGGR.js +0 -2
- package/dist/bridge-JSKEO4N3.js +0 -2
- package/dist/chunk-23VPUWBD.js +0 -23
- package/dist/chunk-2WRBTLFN.js +0 -13
- package/dist/chunk-5WXGMXGA.js +0 -26
- package/dist/chunk-74HTO7K3.js +0 -11
- package/dist/chunk-AECMF3T2.js +0 -8
- package/dist/chunk-BXYWX4J3.js +0 -2
- package/dist/chunk-DBKNJRJG.js +0 -2
- package/dist/chunk-H32GM5G4.js +0 -2
- package/dist/chunk-J5FBU425.js +0 -62
- package/dist/chunk-MK7JUOYV.js +0 -6
- package/dist/chunk-ORQNKZ2Z.js +0 -5
- package/dist/chunk-OUJQVBUT.js +0 -7
- package/dist/chunk-QOFZSHSC.js +0 -47
- package/dist/chunk-RKWJG3WW.js +0 -19
- package/dist/chunk-STVP2XHO.js +0 -2
- package/dist/chunk-WAOCHXJ5.js +0 -2
- package/dist/docx-convert-CHLJUTFH.js +0 -2
- package/dist/evidence-IVDNXWPL.js +0 -2
- package/dist/evolve-cmd-XBX4SX5H.js +0 -2
- package/dist/exit-manager-XZL4KIJU.js +0 -2
- package/dist/ingest-cmd-YTGOICTC.js +0 -2
- package/dist/list-commands-RCYHJ5Y3.js +0 -2
- package/dist/login-flow-PYAPYCPY.js +0 -2
- package/dist/persist-recorded-session-DTYCLXTQ.js +0 -3
- package/dist/pipeline-MXFOD6ES.js +0 -2
- package/dist/reconcile-cmd-EG6BOU3A.js +0 -2
- package/dist/reconcile-engine-JQNXALNY.js +0 -2
- package/dist/run-GMZCDRDD.js +0 -2
- package/dist/run-TFRWPGXP.js +0 -2
- package/dist/spawner-GC5CFAJ7.js +0 -2
- package/dist/tcg-generate-V7YFNC5O.js +0 -2
- package/dist/testmd-actions-MNDOO76O.js +0 -2
- package/dist/token-refresh-3UYMCYG3.js +0 -2
- package/dist/with-telemetry-E7QWPGL6.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as v,b as w,d as C}from"./chunk-OS4VSIHT.js";import{b as k}from"./chunk-TRJUD3XJ.js";import{a as T}from"./chunk-JFAFKHDX.js";import{a as E}from"./chunk-JZ26R6UL.js";import{A as y,B as O}from"./chunk-TH47OOBV.js";import{d,e as g}from"./chunk-WXHQYYD5.js";var D=new Set([d.USECASE,d.SCENARIO,d.AC,d.TEST]);function p(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function b(e,t,n){let o=e.edgesFrom(t).find(s=>s.type===n);return o?e.tipOf(o.dst):null}function S(e,t,n){if(n===d.USECASE)return t;if(n===d.SCENARIO)return b(e,t,g.BELONGS_TO);if(n===d.AC){let o=b(e,t,g.SCOPED_TO);return o?e.nodeLabel.get(o)===d.USECASE?o:b(e,o,g.BELONGS_TO):null}if(n===d.TEST){let o=b(e,t,g.AUTOMATES);return o?b(e,o,g.BELONGS_TO):null}return null}function A(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[o,s]of e.names)if(e.tipOf(s)===t)return o;return t}function G(e,t){return{ucTip:t,display:A(e,t),seamRef:e.nameOf.get(t)??t}}function L(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let o=n.tip,s=e.nodeLabel.get(o);if(!s||!D.has(s))return{ok:!1,message:`'${t}' is a ${s??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let a=S(e,o,s);return!a||e.nodeLabel.get(a)!==d.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${s} chain is broken`}:e.superseded.has(a)?{ok:!1,message:`use-case ${A(e,a)} was removed \u2014 nothing to evolve`}:{ok:!0,target:G(e,a)}}function z(e,t){return h(e,t)}function h(e,t){let n=[];for(let{cid:s}of e.byLabel(d.SCENARIO)){if(!p(e,s)||!e.edgesFrom(s).some(r=>r.type===g.BELONGS_TO&&e.tipOf(r.dst)===t))continue;let a=e.edgesInto(s).filter(r=>r.type===g.AUTOMATES&&p(e,r.src));if(a.length===0)n.push({scenario:s,test:null});else for(let r of a)n.push({scenario:s,test:r.src})}let o=new Map;for(let{cid:s}of e.byLabel(d.AC)){if(!p(e,s)||S(e,s,d.AC)!==t)continue;let a=e.edgesInto(s).filter(r=>r.type===g.VERIFIES&&p(e,r.src)).map(r=>r.src).sort();o.set(s,a)}return{pairs:n,verifies:o}}function x(e,t){let n=r=>`${r.scenario}\0${r.test??""}`,o=new Set(e.pairs.map(n)),s=new Set(t.pairs.map(n)),a=[];for(let[r,i]of e.verifies){let u=t.verifies.get(r);u&&(i.length===u.length&&i.every((l,f)=>l===u[f])||a.push({ac:r,before:i,after:u}))}return{superseded:e.pairs.filter(r=>!s.has(n(r))),minted:t.pairs.filter(r=>!o.has(n(r))),retained:t.pairs.filter(r=>o.has(n(r))),moves:a}}function P(e,t,n,o,s){let a=i=>t.nameOf.get(i)??i,r=i=>` - ${a(i.scenario)} \xB7 ${i.test?a(i.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${o.before} \u2192 ${o.after}`),e.out(`superseded: ${s.superseded.length} pair(s)`);for(let i of s.superseded)e.out(r(i));e.out(`minted: ${s.minted.length} pair(s)`);for(let i of s.minted)e.out(r(i));e.out(`retained: ${s.retained.length} pair(s)`);for(let i of s.retained)e.out(r(i));if(s.moves.length===0)e.out("verifies moves: none");else{e.out("verifies moves:");for(let i of s.moves){let u=l=>l.length>0?l.map(a).join(" + "):"(none)";e.out(` - ${a(i.ac)}: ${u(i.before)} \u2192 ${u(i.after)}`)}}}async function U(e,t,n,o,s,a){let r=y(e),i=E(r,t.ucTip);if(!i)return a==="batch"?(o.out(`note: ${t.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${t.display} first`),{code:0,outcome:"no-design"}):(v(o,`nothing to evolve \u2014 run kane-cli design tests --use-case ${t.display} first (no design output)`),{code:2,outcome:"no-design"});let u=h(r,t.ucTip),l=`evolve re-designs the parent use-case ${t.display}; ${u.pairs.length} pair(s) affected`;if(n.yes)o.out(l);else if(!await o.confirm(`${l} \u2014 proceed?`))return o.out(a==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"};let f=k(e,r,t.ucTip,n.because),c=await s(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...f!==void 0?{changeDelta:f.change_delta,priorDesign:f.prior_design}:{}});if(c===3)return o.out(`design session for ${t.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:c,outcome:"paused"};if(c!==0)return v(o,`design run for ${t.display} ended with exit code ${c} \u2014 no diff to report`),{code:c,outcome:"failed"};let m=y(e),$=m.tipOf(t.ucTip),R=E(m,$)?.seq;return P(o,m,t.display,{before:i.seq,after:R??"?"},x(u,h(m,$))),{code:0,outcome:"evolved"}}function F(e){let t=new Map,n=0;for(let{cid:s,state:a}of e.staleList()){if(a==="superseded")continue;let r=e.nodeLabel.get(s);if(!r||!D.has(r)||!p(e,s)||!O(e,s))continue;let i=S(e,s,r);!i||e.nodeLabel.get(i)!==d.USECASE||e.superseded.has(i)||(n++,t.has(i)||t.set(i,G(e,i)))}return{targets:[...t.values()].sort((s,a)=>s.display<a.display?-1:s.display>a.display?1:0),staleCount:n}}function I(e,t){for(let{cid:n,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(n);if(!(!s||!D.has(s)||!p(e,n))&&O(e,n)&&S(e,n,s)===t)return!0}return!1}async function N(e,t,n,o={},s=process.cwd()){if(e&&t.fromStale)return v(n,"pass a <ref> OR --from-stale, not both"),2;if(!e&&!t.fromStale)return v(n,"evolve needs a <ref> or --from-stale"),2;let a=w(s,n);if(!a)return 2;let r=o.runDesignForUc??_;n.out(`evolving ${e??"stale use-cases"}: reading the graph\u2026`);let i=y(a),u,l=null;if(e){let c=L(i,e);if(!c.ok)return v(n,c.message),2;if(!t.because&&E(i,c.target.ucTip)&&!I(i,c.target.ucTip))return v(n,`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;u=[c.target]}else{let{targets:c,staleCount:m}=F(i);if(c.length===0)return n.out("nothing stale \u2014 nothing to evolve"),0;l=`from-stale: ${m} stale node(s) \u2192 ${c.length} use-case(s)`,u=c}if(!t.yes&&!n.isTTY)return v(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless evolution rides `kane-cli maintain reconcile`"),2;if(l&&n.out(l),e){let c=await U(a,u[0],t,n,r,"single");return c.outcome==="evolved"&&t.because&&T(a,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:t.because}),c.code}let f=0;for(let c of u){let{code:m}=await U(a,c,t,n,r,"batch");m!==0&&f===0&&(f=m)}return f}var _=async(e,t)=>{let{designTestsCommand:n}=await import("./bind-
|
|
2
|
+
import{a as v,b as w,d as C}from"./chunk-OS4VSIHT.js";import{b as k}from"./chunk-TRJUD3XJ.js";import{a as T}from"./chunk-JFAFKHDX.js";import{a as E}from"./chunk-JZ26R6UL.js";import{A as y,B as O}from"./chunk-TH47OOBV.js";import{d,e as g}from"./chunk-WXHQYYD5.js";var D=new Set([d.USECASE,d.SCENARIO,d.AC,d.TEST]);function p(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function b(e,t,n){let o=e.edgesFrom(t).find(s=>s.type===n);return o?e.tipOf(o.dst):null}function S(e,t,n){if(n===d.USECASE)return t;if(n===d.SCENARIO)return b(e,t,g.BELONGS_TO);if(n===d.AC){let o=b(e,t,g.SCOPED_TO);return o?e.nodeLabel.get(o)===d.USECASE?o:b(e,o,g.BELONGS_TO):null}if(n===d.TEST){let o=b(e,t,g.AUTOMATES);return o?b(e,o,g.BELONGS_TO):null}return null}function A(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[o,s]of e.names)if(e.tipOf(s)===t)return o;return t}function G(e,t){return{ucTip:t,display:A(e,t),seamRef:e.nameOf.get(t)??t}}function L(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let o=n.tip,s=e.nodeLabel.get(o);if(!s||!D.has(s))return{ok:!1,message:`'${t}' is a ${s??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let a=S(e,o,s);return!a||e.nodeLabel.get(a)!==d.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${s} chain is broken`}:e.superseded.has(a)?{ok:!1,message:`use-case ${A(e,a)} was removed \u2014 nothing to evolve`}:{ok:!0,target:G(e,a)}}function z(e,t){return h(e,t)}function h(e,t){let n=[];for(let{cid:s}of e.byLabel(d.SCENARIO)){if(!p(e,s)||!e.edgesFrom(s).some(r=>r.type===g.BELONGS_TO&&e.tipOf(r.dst)===t))continue;let a=e.edgesInto(s).filter(r=>r.type===g.AUTOMATES&&p(e,r.src));if(a.length===0)n.push({scenario:s,test:null});else for(let r of a)n.push({scenario:s,test:r.src})}let o=new Map;for(let{cid:s}of e.byLabel(d.AC)){if(!p(e,s)||S(e,s,d.AC)!==t)continue;let a=e.edgesInto(s).filter(r=>r.type===g.VERIFIES&&p(e,r.src)).map(r=>r.src).sort();o.set(s,a)}return{pairs:n,verifies:o}}function x(e,t){let n=r=>`${r.scenario}\0${r.test??""}`,o=new Set(e.pairs.map(n)),s=new Set(t.pairs.map(n)),a=[];for(let[r,i]of e.verifies){let u=t.verifies.get(r);u&&(i.length===u.length&&i.every((l,f)=>l===u[f])||a.push({ac:r,before:i,after:u}))}return{superseded:e.pairs.filter(r=>!s.has(n(r))),minted:t.pairs.filter(r=>!o.has(n(r))),retained:t.pairs.filter(r=>o.has(n(r))),moves:a}}function P(e,t,n,o,s){let a=i=>t.nameOf.get(i)??i,r=i=>` - ${a(i.scenario)} \xB7 ${i.test?a(i.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${o.before} \u2192 ${o.after}`),e.out(`superseded: ${s.superseded.length} pair(s)`);for(let i of s.superseded)e.out(r(i));e.out(`minted: ${s.minted.length} pair(s)`);for(let i of s.minted)e.out(r(i));e.out(`retained: ${s.retained.length} pair(s)`);for(let i of s.retained)e.out(r(i));if(s.moves.length===0)e.out("verifies moves: none");else{e.out("verifies moves:");for(let i of s.moves){let u=l=>l.length>0?l.map(a).join(" + "):"(none)";e.out(` - ${a(i.ac)}: ${u(i.before)} \u2192 ${u(i.after)}`)}}}async function U(e,t,n,o,s,a){let r=y(e),i=E(r,t.ucTip);if(!i)return a==="batch"?(o.out(`note: ${t.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${t.display} first`),{code:0,outcome:"no-design"}):(v(o,`nothing to evolve \u2014 run kane-cli design tests --use-case ${t.display} first (no design output)`),{code:2,outcome:"no-design"});let u=h(r,t.ucTip),l=`evolve re-designs the parent use-case ${t.display}; ${u.pairs.length} pair(s) affected`;if(n.yes)o.out(l);else if(!await o.confirm(`${l} \u2014 proceed?`))return o.out(a==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"};let f=k(e,r,t.ucTip,n.because),c=await s(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...f!==void 0?{changeDelta:f.change_delta,priorDesign:f.prior_design}:{}});if(c===3)return o.out(`design session for ${t.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:c,outcome:"paused"};if(c!==0)return v(o,`design run for ${t.display} ended with exit code ${c} \u2014 no diff to report`),{code:c,outcome:"failed"};let m=y(e),$=m.tipOf(t.ucTip),R=E(m,$)?.seq;return P(o,m,t.display,{before:i.seq,after:R??"?"},x(u,h(m,$))),{code:0,outcome:"evolved"}}function F(e){let t=new Map,n=0;for(let{cid:s,state:a}of e.staleList()){if(a==="superseded")continue;let r=e.nodeLabel.get(s);if(!r||!D.has(r)||!p(e,s)||!O(e,s))continue;let i=S(e,s,r);!i||e.nodeLabel.get(i)!==d.USECASE||e.superseded.has(i)||(n++,t.has(i)||t.set(i,G(e,i)))}return{targets:[...t.values()].sort((s,a)=>s.display<a.display?-1:s.display>a.display?1:0),staleCount:n}}function I(e,t){for(let{cid:n,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(n);if(!(!s||!D.has(s)||!p(e,n))&&O(e,n)&&S(e,n,s)===t)return!0}return!1}async function N(e,t,n,o={},s=process.cwd()){if(e&&t.fromStale)return v(n,"pass a <ref> OR --from-stale, not both"),2;if(!e&&!t.fromStale)return v(n,"evolve needs a <ref> or --from-stale"),2;let a=w(s,n);if(!a)return 2;let r=o.runDesignForUc??_;n.out(`evolving ${e??"stale use-cases"}: reading the graph\u2026`);let i=y(a),u,l=null;if(e){let c=L(i,e);if(!c.ok)return v(n,c.message),2;if(!t.because&&E(i,c.target.ucTip)&&!I(i,c.target.ucTip))return v(n,`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;u=[c.target]}else{let{targets:c,staleCount:m}=F(i);if(c.length===0)return n.out("nothing stale \u2014 nothing to evolve"),0;l=`from-stale: ${m} stale node(s) \u2192 ${c.length} use-case(s)`,u=c}if(!t.yes&&!n.isTTY)return v(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless evolution rides `kane-cli maintain reconcile`"),2;if(l&&n.out(l),e){let c=await U(a,u[0],t,n,r,"single");return c.outcome==="evolved"&&t.because&&T(a,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:t.because}),c.code}let f=0;for(let c of u){let{code:m}=await U(a,c,t,n,r,"batch");m!==0&&f===0&&(f=m)}return f}var _=async(e,t)=>{let{designTestsCommand:n}=await import("./bind-STKXOUYI.js"),o=()=>n({useCase:e,force:!0,...t.mode?{mode:t.mode}:t.yes?{mode:"override"}:{},...t.because?{because:t.because}:{},...t.changeDelta!==void 0?{changeDelta:t.changeDelta}:{},...t.priorDesign!==void 0?{priorDesign:t.priorDesign}:{}});if(t.mode!=="agent")return o();let s=process.stdout.write;process.stdout.write=((...a)=>!0);try{return await o()}finally{process.stdout.write=s}};async function J(e,t){return N(e,t,C(),{})}export{L as a,z as b,U as c,F as d,N as e,_ as f,J as g};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as n}from"./chunk-
|
|
2
|
+
import{a as n}from"./chunk-27U4PLPX.js";import{createHash as _}from"crypto";import{existsSync as m,readFileSync as u}from"fs";import{dirname as T,join as f,resolve as o}from"path";import{fileURLToPath as E}from"url";var s=T(E(import.meta.url)),l=2;function p(e,r){let t=_("sha256");return t.update(`kane-assurance-contract
|
|
3
3
|
`),t.update(e),t.update(`
|
|
4
4
|
agent_state_schema=${r}`),"sha256:"+t.digest("hex")}function d(){return[o(s,".."),o(s,"../../..")]}function i(){return"sha256:85dd52f33a9fd9cf22ebb81f04dfd3c05bdbeca2e62e3a7a53e8caaaa4060752"}var a=class extends Error{constructor(t,c){super(`agent/cli contract mismatch (cli ${t||"<unset>"}, agent ${c||"<unset>"}) \u2014 rebuild or reinstall the stale half`);this.expected=t;this.actual=c;this.name="PairMismatchError"}};function I(){return{TESTMUAI_CONTRACT_DIGEST:i(),TESTMUAI_CLIENT_VERSION:process.env.KANE_DEV_FORCE_CLIENT_RELEASE??`kane-cli/${n}`}}export{a,I as b};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as f,c as u}from"./chunk-EYOCNMUM.js";import{d as g,k as p}from"./chunk-27U4PLPX.js";import{readFileSync as _,writeFileSync as m,mkdirSync as b,existsSync as h}from"fs";import{dirname as v}from"path";var s={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:p,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0};function w(o){let{mobile:e,...i}=o,t={...i};delete t.target,delete t.device,delete t.app;let n=e??{};n.tui_target&&(t.target=n.tui_target);let r=n.default_target?.id?.trim();r&&(t.device=r),n.default_app&&(t.app=n.default_app);let a={};return n.no_reset!==void 0&&(a.no_reset=n.no_reset),n.appium_url!==void 0&&(a.appium_url=n.appium_url),Object.keys(a).length>0&&(t.mobile=a),t}function C(o){let e=o.mobile??{},i=typeof o.target=="string"?o.target:void 0,t=typeof o.device=="string"&&o.device.trim()!==""?o.device.trim():void 0,n=typeof o.app=="string"&&o.app!==""?o.app:void 0,r={},a=i??e.tui_target;if(a&&(r.tui_target=a),t){let d=f(a,void 0);(d.kind==="emulator"||d.kind==="simulator")&&(r.default_target={platform:u(d.kind),kind:d.kind,id:t})}else e.default_target?.id?.trim()&&(r.default_target=e.default_target);let l=n??e.default_app;return l&&(r.default_app=l),e.no_reset!==void 0&&(r.no_reset=e.no_reset),e.appium_url!==void 0&&(r.appium_url=e.appium_url),Object.keys(r).length>0?r:void 0}var c=class{constructor(e=g){this.path=e}exists(){return h(this.path)}load(){try{let e=_(this.path,"utf-8"),i=JSON.parse(e),t=C(i),{target:n,device:r,app:a,...l}=i;return{...s,...l,...t?{mobile:t}:{},code_export:{...s.code_export,...i.code_export??{}},generate:{...s.generate,...i.generate??{}}}}catch{return{...s,code_export:{...s.code_export},generate:{...s.generate}}}}write(e){try{b(v(this.path),{recursive:!0}),m(this.path,JSON.stringify(w(e),null,2)+`
|
|
3
|
+
`)}catch(i){let t=i instanceof Error?i.message:String(i);process.stderr.write(`[config] Failed to save config: ${t}
|
|
4
|
+
`)}}set(e,i){let t=this.load();t[e]=i,this.write(t)}save(e){this.write({...this.load(),...e})}getMobile(){return this.load().mobile??{}}setMobile(e){let i={...this.getMobile()};for(let t of Object.keys(e)){let n=e[t];n===void 0?delete i[t]:i[t]=n}this.set("mobile",Object.keys(i).length>0?i:void 0)}writeRaw(e){this.write(e)}};export{c as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{y as n}from"./chunk-
|
|
2
|
+
import{y as n}from"./chunk-27U4PLPX.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as S}from"./chunk-
|
|
2
|
+
import{a as S}from"./chunk-UDIQOJEL.js";import{y as o}from"./chunk-27U4PLPX.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as y,b as c,j as x}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var k=b(w(),1);var i=b(R(),1);function A(e){let t=e.decisions.filter(r=>r.kind==="replay").length,l=e.decisions.filter(r=>r.kind==="author").length,p=e.outcomes.filter(r=>r.status==="passed").length,d=e.outcomes.filter(r=>r.status==="failed").length,f=e.outcomes.filter(r=>r.status==="skipped").length,a=o.green,n;e.cancelled||e.overallStatus==="interrupted"?(a=o.orange,n="CANCELLED"):e.overallStatus==="failed"?(a=o.red,n="FAILED"):n="PASSED";let s=`${n} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${p} passed, ${d} failed, ${f} skipped)`,T=`${t} replay \xB7 ${l} author`,C=e.retryTriggered,_="yes \u2014 run recovered after a replay miss",u,h=o.dim;if(e.cancelled)u="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")u="\u2013 not committed (run failed)",h=o.red;else if(!e.shouldCommit)e.isFirstRun?u="\u2013 not committed (first run skipped commit)":e.lockHeld?u="\u2013 not committed":u="\u2013 not committed (readonly fallback / no lock)";else{let r=e.uploadResult?.testcaseId;u=r?`\u2713 pushed (testcase=${r})`:"\u2713 pushed",h=o.green}let v=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,g=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",g=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,g=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:s},breakdown:T,showRetries:C,retriesText:_,commitText:u,commitColor:h,artifactsText:v,uploadText:m,uploadColor:g}}function O(e){let t=e.decisions.filter(s=>s.kind==="replay").length,l=e.decisions.filter(s=>s.kind==="author").length,p=e.outcomes.filter(s=>s.status==="passed").length,d=e.outcomes.filter(s=>s.status==="failed").length,f=e.outcomes.filter(s=>s.status==="skipped").length,a,n=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&e.uploadResult?.testcaseId?(a="ok",n=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:p,failed:d,skipped:f,replay_decisions:t,author_decisions:l},retries:{triggered:e.retryTriggered},commit:{committed:n,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled,...e.imports&&e.imports.length>0?{imports:e.imports}:{}}}function D({data:e}){let t=A(e),l=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&l.push({label:"retries",value:(0,i.jsx)(c,{color:o.orange,children:t.retriesText})}),l.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),l.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dim,children:t.artifactsText})}),l.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:l})}function I({data:e}){let{exit:t}=x();return(0,k.useEffect)(()=>{let l=setTimeout(()=>t(),50);return()=>clearTimeout(l)},[t]),(0,i.jsx)(y,{flexDirection:"column",children:(0,i.jsx)(D,{data:e})})}export{A as a,O as b,D as c,I as d};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{d as W}from"./chunk-MSGW4JDG.js";import{d as q,e as F}from"./chunk-4JOD47QI.js";import{a as L}from"./chunk-27U4PLPX.js";import{createHash as Y}from"crypto";import{access as Q,mkdir as T,mkdtemp as Z,readdir as O,readFile as v,rename as N,rm as y,writeFile as E}from"fs/promises";import{homedir as tt}from"os";import{arch as et,platform as st}from"process";import{dirname as j,isAbsolute as nt,join as l,relative as X,resolve as rt,sep as it}from"path";var z=1,ot={emulator:"emulator",simulator:"simulator"};function Et(i){return ot[i.kind]??null}var H=class extends Error{constructor(s,e,n){super([`Managed mobile dependencies for ${s} are not installed.`,`- kaneai-mobile-deps ${s} ${e.bundleVersion}: ${e.url} (${_(e.bytes)})`,`Destination: ${n}`,"Run `kane-cli doctor --install` to download it."].join(`
|
|
3
|
+
`));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var C=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*C)return null;let t=Math.min(ct,Math.floor(i/C)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function U(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:f}=await e.read();if(c)break;f&&(n.push(f),r+=f.length,t?.(f.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var K=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,f=null,b=!1;try{await Promise.all(e.map(async(h,A)=>{let M=0,S=d=>{M+=d,a+=d,n?.(a)},V=()=>{a=Math.max(0,a-M),M=0},R=null;for(let d=0;d<K;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${h.start}-${h.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,A===0?f=await U(p,I=>{$(),S(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=h.end-h.start+1,P=await U(p,I=>{$(),S(I)});if(P.length!==D)throw new Error(`range ${h.start}-${h.end} returned ${P.length} bytes (expected ${D})`);o.set(P,h.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;V(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${h.start}-${h.end} failed after ${K} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --install\`.`)}))}catch(h){throw c.abort(),h}return f||(b?null:o)}async function ft(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return U(o,e&&(c=>{a+=c,e(a)}))}function ht(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function x(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:L,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-XC5S53DG.js")).controllerResolveBundle()(i),exec:q,now:()=>new Date,wait:F,processAlive:i=>{try{return process.kill(i,0),!0}catch{return!1}}}}var B=class extends Error{constructor(s,e,n){super(`No managed mobile dependencies are published for ${s} (kane-cli ${e}).
|
|
4
|
+
This is a packaging gap, not something to install locally \u2014 report it, or pass --appium-url to use an Appium server you manage yourself.`);this.coordinate=s;this.cause=n;this.name="NoPublishedBundleError"}},J=class{deps;constructor(t={}){this.deps={...wt(),...t}}mobileRoot(){return l(this.deps.home,".testmuai","kaneai","mobile")}depsRoot(){return l(this.mobileRoot(),"deps")}classRoot(t,s){return l(this.depsRoot(),s,t)}paths(t,s){let e=this.classRoot(t,s);return{root:e,appium:l(e,"appium"),appiumHome:l(e,"appium-home"),platformTools:l(e,"platform-tools"),wdaDir:l(e,"wda","Build","Products","Debug-iphonesimulator"),iwdpBinDir:l(e,"bin"),installManifest:l(e,"install-manifest.json")}}async status(t,s){let e=[];try{e=await O(this.depsRoot())}catch{}s&&(e=e.filter(c=>c===s));let n=null;for(let c of e){let f=this.classRoot(t,c),b=null;try{b=JSON.parse(await v(l(f,"install-manifest.json"),"utf8"))}catch{continue}b.schemaVersion===z&&(!s&&b.cliVersion!==this.deps.cliVersion||(!n||b.installedAt>n.manifest.installedAt)&&(n={manifest:b,root:f}))}if(!n)return{class:t,installed:!1};let r=this.paths(t,n.manifest.bundleVersion),o=[l(r.appium,"node_modules","appium","index.js")];t==="emulator"&&o.push(l(r.platformTools,this.deps.os==="win32"?"adb.exe":"adb")),t==="simulator"&&o.push(l(r.wdaDir,"WebDriverAgentRunner-Runner.app"));for(let c of o)if(!await x(c))return{class:t,installed:!1,version:n.manifest.bundleVersion,root:n.root,corrupt:`a bundle component is missing from disk (${X(n.root,c)})`};let a=await this.postInstallDrifted(r);return{class:t,installed:!0,version:n.manifest.bundleVersion,root:n.root,...a?{needsRepair:a}:{}}}async postInstallDrifted(t){let s=l(t.appiumHome,"node_modules",".cache","appium","extensions.yaml");if(!await x(s))return!1;let e=await v(s,"utf8");for(let n of e.split(`
|
|
5
|
+
`)){let r=/^\s*installPath:\s*(.+?)\s*$/.exec(n);if(r&&!r[1].startsWith(t.appiumHome))return!0}return!1}async environment(t){let s=await this.status(t);if(!s.installed||!s.version)return{dirs:[]};let e=this.paths(t,s.version),n=[],r={dirs:n,appiumHome:e.appiumHome};return t!=="simulator"&&(n.push(e.platformTools),r.platformToolsDir=e.platformTools),n.push(l(e.appium,"node_modules",".bin")),t==="simulator"&&(n.push(e.iwdpBinDir),r.wdaDir=e.wdaDir,r.wdaRoot=l(e.root,"wda"),r.iwdpBinDir=e.iwdpBinDir),r}async ensure(t,s){let e,n;try{e=await this.resolveOrExplain(t)}catch(a){n=a}let r=await this.status(t,e?.bundleVersion);if(r.installed&&!r.needsRepair)return e&&r.version&&await this.adoptInstall(t,r.version),r;if(!e)throw n;if(r.installed&&r.needsRepair&&r.version){let a=this.paths(t,r.version);return await this.withInstallLock(async()=>{await this.postInstall(a.root,a,s.onProgress)}),await this.adoptInstall(t,r.version),this.status(t,e.bundleVersion)}let o=e;if(!s.automatic&&!s.approved)throw new H(t,o,this.classRoot(t,o.bundleVersion));return await this.withInstallLock(async()=>{(await this.status(t,o.bundleVersion)).installed||await this.install(t,o,s.onProgress)}),this.status(t,o.bundleVersion)}async adoptInstall(t,s){try{let e=this.paths(t,s).installManifest,n=JSON.parse(await v(e,"utf8"));if(n.cliVersion===this.deps.cliVersion)return;n.cliVersion=this.deps.cliVersion;let r=l(j(e),`install-manifest-${process.pid}.json`);await E(r,`${JSON.stringify(n,null,2)}
|
|
6
|
+
`),await N(r,e)}catch{}}async resolveOrExplain(t){let s=`${this.deps.os}-${this.deps.arch}-${t}`,e;try{e=await this.deps.resolveBundle({cliVersion:this.deps.cliVersion,os:this.deps.os,arch:this.deps.arch,deviceClass:t})}catch(n){throw new B(s,this.deps.cliVersion,n)}if(!e?.url||!e.sha256||!e.bundleVersion)throw new B(s,this.deps.cliVersion);return e}async install(t,s,e){let n=this.paths(t,s.bundleVersion),r=l(this.depsRoot(),s.bundleVersion);await T(r,{recursive:!0});let o=await Z(l(r,".staging-"));try{e?.(`Downloading the ${t} dependencies ${s.bundleVersion} (${_(s.bytes)}) \u2014 this happens once\u2026`);let a=[],c=-1,f=0,b=await this.download(s,(d,u)=>{if(!u)return;let m=Math.min(d,u),w=this.deps.now().getTime();for(a.push({t:w,received:m});a.length>1&&a[0].t<w-3e3;)a.shift();let g=Math.min(100,Math.floor(m/u*20)*5);if(g===c&&w-f<2e3&&m<u)return;c=g,f=w;let $=a[0],p=(w-$.t)/1e3,D=p>0?(m-$.received)/p:0,P=D>0&&m<u?` \xB7 ${at(D)} \xB7 ${lt((u-m)/D)}`:"";e?.(`Downloading the ${t} dependencies \u2014 ${_(m)} / ${_(u)} (${g}%)${P}`)}),h=W(b),A=gt(h);for(let[d,u]of Object.entries(h)){if(d.endsWith("/"))continue;let m=A&&d.startsWith(A)?d.slice(A.length):d;if(!m)continue;let w=rt(o,m);if(!mt(o,w))throw new Error(`Unsafe path in ${s.url}: ${d}`);await T(j(w),{recursive:!0}),await E(w,u,this.deps.os!=="win32"?{mode:493}:{})}let M=await this.readBundleManifest(o,s.url,t);await this.postInstall(o,n,e),await y(n.root,{recursive:!0,force:!0}),await N(o,n.root);let S={schemaVersion:z,class:t,bundleVersion:s.bundleVersion,cliVersion:this.deps.cliVersion,os:this.deps.os,arch:this.deps.arch,sha256:s.sha256,bytes:s.bytes,sourceUrl:s.url,installedAt:this.deps.now().toISOString(),nodeAbi:M.node_abi?.node_module_version??this.deps.nodeModuleVersion,postInstall:{quarantineStripped:this.deps.os==="darwin",extensionsRewritten:!0}},V=l(r,`install-manifest-${process.pid}.json`);await E(V,`${JSON.stringify(S,null,2)}
|
|
7
|
+
`),await N(V,n.installManifest),await this.gcOldVersions(t);let R=l(this.mobileRoot(),"trees");await x(R)&&(await this.reapLegacyServers(R,e),await y(R,{recursive:!0,force:!0}),e?.("Removed the legacy per-component toolchain trees"));for(let d of["emulator","simulator"]){let u=l(this.depsRoot(),d);await x(l(u,"install-manifest.json"))||await x(u)&&(await y(u,{recursive:!0,force:!0}),e?.(`Removed the previous ${d} deps layout`))}}finally{await y(o,{recursive:!0,force:!0})}}async reapLegacyServers(t,s){if(this.deps.os==="win32")return;let e=await this.deps.exec("pgrep",["-f",t],{timeoutMs:1e4});if(e.code!==0)return;let n=e.stdout.split(`
|
|
8
|
+
`).map(r=>r.trim()).filter(r=>/^\d+$/.test(r));for(let r of n)await this.deps.exec("kill",[r],{timeoutMs:5e3});n.length>0&&s?.(`Stopped ${n.length} legacy managed server process${n.length===1?"":"es"} before removing the old toolchain trees`)}async gcOldVersions(t){let s=[];try{s=await O(this.depsRoot())}catch{return}let e=[];for(let n of s){let r=this.classRoot(t,n);try{let o=JSON.parse(await v(l(r,"install-manifest.json"),"utf8"));e.push({root:r,installedAt:o.installedAt})}catch{}}e.sort((n,r)=>n.installedAt<r.installedAt?1:-1);for(let n of e.slice(2)){await y(n.root,{recursive:!0,force:!0});let r=j(n.root);try{(await O(r)).length===0&&await y(r,{recursive:!0,force:!0})}catch{}}}async download(t,s){let e=null;for(let n=0;n<2;n+=1){let r=await ft(this.deps.fetch,t.url,t.bytes,s&&(a=>s(a,t.bytes))),o=ht(r);if(o===t.sha256)return r;e=new Error(`Checksum mismatch for ${t.url}: expected ${t.sha256}, got ${o}.`)}throw e??new Error(`Could not download ${t.url}`)}async readBundleManifest(t,s,e){let n;try{n=JSON.parse(await v(l(t,"manifest.json"),"utf8"))}catch{throw new Error(`The bundle at ${s} carries no readable manifest.json; refusing to install it.`)}if(n.platform!==this.deps.os||n.arch!==this.deps.arch)throw new Error(`The bundle at ${s} is built for ${n.platform}-${n.arch}; this host is ${this.deps.os}-${this.deps.arch}. A wrong blob was published for this coordinate.`);if(!n.supported_targets?.includes(e))throw new Error(`The bundle at ${s} does not support the ${e} device class (it supports: ${n.supported_targets?.join(", ")||"nothing"}). A wrong blob was published.`);return n}async postInstall(t,s,e){this.deps.os==="darwin"&&await this.deps.exec("xattr",["-dr","com.apple.quarantine",t],{timeoutMs:6e4});let n=l(t,"appium-home","node_modules",".cache","appium","extensions.yaml");if(await x(n)){let r=await v(n,"utf8"),o=bt(r,s.appiumHome);await E(n,o),e?.("Rewrote Appium extension paths for this machine")}}async withInstallLock(t){let s=l(this.mobileRoot(),"install.lock"),e=Date.now();for(await T(this.mobileRoot(),{recursive:!0});;)try{await T(s),await E(l(s,"owner.json"),JSON.stringify({pid:process.pid,startedAt:new Date().toISOString()}));try{return await t()}finally{await y(s,{recursive:!0,force:!0})}}catch(n){if(n.code!=="EEXIST")throw n;let r={};try{r=JSON.parse(await v(l(s,"owner.json"),"utf8"))}catch{}if(r.pid&&!this.deps.processAlive(r.pid)){await y(s,{recursive:!0,force:!0});continue}if(Date.now()-e>12e4)throw new Error(`Timed out waiting for the mobile install lock (holder pid ${r.pid??"unknown"}).`);await this.deps.wait(500)}}};function gt(i){let t=Object.keys(i).filter(e=>!e.endsWith("/")),s=new Set(t.map(e=>e.split("/")[0]));return s.size===1&&t.every(e=>e.includes("/"))?`${[...s][0]}/`:""}function bt(i,t){return i.split(`
|
|
9
|
+
`).map(s=>{let e=/^(\s*installPath:\s*)(.+?)\s*$/.exec(s);if(!e)return s;let n=e[2],r=/[\\/]node_modules[\\/]/g,o=-1;for(let a=r.exec(n);a;a=r.exec(n))o=a.index+a[0].length;return o<0?s:`${e[1]}${l(t,"node_modules",n.slice(o))}`}).join(`
|
|
10
|
+
`)}var G;function St(){return G??=new J,G}import{join as yt}from"path";function _t(i=process.env){let t=i.KANE_ANDROID_HOME?.trim();return t?{root:t,platformToolsDir:yt(t,"platform-tools")}:null}export{Et as a,H as b,St as c,_t as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var o={platform:"darwin",arch:"arm64"};function s(e=process.platform,t=process.arch){let r=`${e}/${t}`;if(e===o.platform&&t===o.arch)return{supported:!0,detected:r};let n=`mobile runs are supported on macOS (Apple Silicon) only \u2014 detected ${r}.`;return e===o.platform&&t==="x64"&&(n+=" If this is an Apple Silicon Mac, the CLI is running under Rosetta \u2014 reinstall Node as arm64 and retry."),{supported:!1,detected:r,reason:n}}function p(){return s().supported}function a(){return s().reason??""}export{s as a,p as b,a as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as u,b as x}from"./chunk-
|
|
2
|
+
import{a as u,b as x}from"./chunk-FEJXWJ3L.js";import{y as m}from"./chunk-27U4PLPX.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as f}from"./chunk-EWCAFKLX.js";import{y as t}from"./chunk-27U4PLPX.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,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-
|
|
2
|
+
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-L7MXYCD7.js";import{a as B}from"./chunk-2WVKOZ6W.js";import{a as R}from"./chunk-TFPPEOAK.js";import{a as k}from"./chunk-G7VQCS4J.js";import{y as c}from"./chunk-27U4PLPX.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=k(m),T=new B(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=k(m),s=await new B(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as jt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Bt}from"./chunk-I7TIGB7K.js";import{a as ke,c as Yt,e as Zt,f as Fe,g as Qt,h as or}from"./chunk-
|
|
2
|
+
import{b as jt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Bt}from"./chunk-I7TIGB7K.js";import{a as ke,c as Yt,e as Zt,f as Fe,g as Qt,h as or}from"./chunk-KU6IXFGZ.js";import{a as Xt,b as rr,c as sr,d as ir,e as dt,f as nr}from"./chunk-ZGBSGZZM.js";import{a as Se,b as qt,c as Gt,d as Lt,e as Vt}from"./chunk-BRHNRCEZ.js";import{a as zt}from"./chunk-L2TV4G56.js";import{a as Kt,b as Jt}from"./chunk-JFAFKHDX.js";import{c as Wt}from"./chunk-6KPPGMO2.js";import{a as Nt,e as Ht}from"./chunk-GFKCTYCA.js";import{b as Ft}from"./chunk-YKTYVJBN.js";import{a as er}from"./chunk-IMR64OCZ.js";import{d as Mt}from"./chunk-W4B5LOEX.js";import{a as be,b as ct}from"./chunk-DNNZ353O.js";import{e as Ut}from"./chunk-OMQCD3KR.js";import{a as Be}from"./chunk-SDPRO2LE.js";import{a as we}from"./chunk-NVGBE2DR.js";import{b as ot}from"./chunk-IDX3TOPY.js";import{A as Z,k as ye,o as je}from"./chunk-TH47OOBV.js";import{f as It}from"./chunk-DUAXZYAD.js";import{e as at}from"./chunk-DBIBROYW.js";import{d as de}from"./chunk-WXHQYYD5.js";import{b as Ot}from"./chunk-IAHKTEET.js";import{a as At}from"./chunk-5EOX4MEY.js";import{appendFileSync as wr,mkdirSync as ut,rmdirSync as br,writeFileSync as lt}from"fs";import{dirname as mr,extname as Sr,join as oe}from"path";var J=class extends Error{code;constructor(e,a){super(`${e}: ${a}`),this.name="ProposalAdapterError",this.code=e}};function cr(r){return r.version===2}var ar=8;function vr(r){let e=/^extract@(\d+)$/.exec(r??"");return e?Number.parseInt(e[1],10):null}var yr=r=>typeof r=="object"&&r!==null&&"op"in r;function qe(r,e,a){return{anchor:r.anchor,quote:r.quote,...a||r.source_id!==e?{source_id:r.source_id}:{}}}function dr(r,e,a={}){let m=vr(a.templateVersion),_=m!==null&&m>=5,x=m!==null&&m<5,y=r.archived!=null&&r.archived.length>0&&m!==null&&m<5;if(y&&a.warn?.(`dropped ${r.archived.length} archive op(s): the bound extract template @${m} never described archiving \u2014 nothing was archived; the use-cases still land`),!_&&r.read_basis.length!==1)throw new J("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${r.read_basis.length}`);if(r.read_basis.length===0)throw new J("READ_BASIS_COUNT","read_basis must not be empty");let v=r.read_basis[0],g=r.read_basis.length>1,k=r.use_cases.map(i=>{if(x&&i.cite.length!==1)throw new J("CITE_COUNT",`${i.temp_ref}: cite must have exactly 1 element, got ${i.cite.length}`);if(i.cite.length<1||i.cite.length>ar)throw new J("CITE_COUNT",`${i.temp_ref}: 1..${ar} cites allowed, got ${i.cite.length}`);let I=(h,Q)=>{if(!_&&h!==v.source_id)throw new J("SOURCE_MISMATCH",`${Q}: cite source ${h} != read_basis source ${v.source_id} (single-source)`)};I(i.cite[0].source_id,i.temp_ref);let P=i.cite.map(h=>(I(h.source_id,i.temp_ref),qe(h,v.source_id,_&&(g||h.source_id!==v.source_id)))),u=(i.updated?.criteria??[]).some(yr);if(!_&&u)throw new J("CRITERIA_OPS_UNSUPPORTED",`${i.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${a.templateVersion??"an unversioned template"}`);return{temp_ref:i.temp_ref,title:i.title,...i.description!==void 0?{description:i.description}:{},...i.summary!==void 0?{summary:i.summary}:{},...i.actors!==void 0?{actors:i.actors}:{},...i.value!==void 0?{value:i.value}:{},risk:i.risk,cite:P[0],...P.length>1?{cites:P}:{},...i.criteria!=null&&i.criteria.length>0?{criteria:i.criteria.map((h,Q)=>(I(h.cite.source_id,`${i.temp_ref}.criteria[${Q}]`),{text:h.text,cite:qe(h.cite,v.source_id,_&&h.cite.source_id!==v.source_id)}))}:{},depends_on_hint:i.depends_on_hint,matches_existing:i.matches_existing,...i.conflicts_with!=null?{conflicts_with:i.conflicts_with}:{},...i.changed?{changed:!0}:{},...i.updated!=null?{updated:{...i.updated.title!=null?{title:i.updated.title}:{},...i.updated.description!=null?{description:i.updated.description}:{},...i.updated.summary!=null?{summary:i.updated.summary}:{},...i.updated.actors!=null?{actors:i.updated.actors}:{},...i.updated.value!=null?{value:i.updated.value}:{},...i.updated.risk!=null?{risk:i.updated.risk}:{},...i.updated.criteria!=null?{criteria:u?i.updated.criteria.map(h=>h.op==="set"?{op:"set",text:h.text,cite:qe(h.cite,v.source_id,_&&h.cite.source_id!==v.source_id)}:h.op==="keep"?{op:"keep",ref:h.ref,text:h.text}:{op:"remove",ref:h.ref,text:h.text,reason:h.reason}):i.updated.criteria.map((h,Q)=>(I(h.cite.source_id,`${i.temp_ref}.updated.criteria[${Q}]`),{text:h.text,cite:qe(h.cite,v.source_id,_&&h.cite.source_id!==v.source_id)}))}:{}}}:{},...i.change_note!=null?{change_note:i.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:v.source_id,source_cid:v.source_cid},use_cases:k,...g?{sources:r.read_basis.map(i=>({source_id:i.source_id,source_cid:i.source_cid}))}:{},...r.extraction_of!=null&&r.extraction_of.length>0?{extraction_claims:r.extraction_of.map(i=>({source_id:i.source_id,completeness:i.completeness}))}:{},...r.archived!=null&&r.archived.length>0&&!y?{archived:r.archived.map(i=>({target:i.target,reason:i.reason,basis:i.basis}))}:{}}}function ur(r){let{contextDir:e,graph:a}=r,m=r.maxDigestBytes??4096,_={},x=[];for(let[g,k]of a.heads){if(_[g]=k,typeof k!="string")continue;let i=a.mediaOf(k),I=a.getNode(k)?.content?.blob;if(typeof I=="string")if(i.format==="image")x.push({source_id:g,cid:k,format:"image",blobRef:{path:we(e,I),cid:I}});else{let P=be(e,a,k)?.toString("utf8")??"";x.push({source_id:g,cid:k,format:i.format,text:P})}}x.sort((g,k)=>g.source_id<k.source_id?-1:1);let y=[];for(let g of a.byLabel(de.STYLENOTE).sort((k,i)=>k.cid<i.cid?-1:1))a.superseded.has(g.cid)||y.push(`\u2022 ${String(g.content.statement)} [${String(g.content.learned_from_kind)}]`);let v="";for(let g of y){if(Buffer.byteLength(v+g+`
|
|
3
3
|
`,"utf8")>m)break;v+=g+`
|
|
4
4
|
`}return{read_basis:_,sources:x,styleNoteDigest:v}}function lr(r,e){let a=ur({contextDir:r,graph:e}).styleNoteDigest;return a.length>0?a:void 0}function mt(r,e,a,m,_){let x=null,y=()=>x??=_&&Object.keys(_).length>0?Promise.resolve(_):Ut().catch(()=>({}));return{contextDir:r,rootSid:e,locks:at(r,e),probe:m??Bt(r,{resolveAlias:async v=>qt(v,{env:process.env,auth:await y()}),embed:async(v,g)=>Gt(v,g,{env:process.env,auth:await y()}),readVector:(v,g)=>Lt(r,v,g),writeVector:(v,g,k)=>Vt(r,v,g,k)}),...a?.length?{reservedEventIds:a}:{}}}function gt(r,e){let a=[],m=[];for(let _ of r.use_cases){let x=_.matches_existing;x?.cid&&e.hasNode(x.cid)?a.push({ref:x.cid,expectedTip:e.tipOf(x.cid)}):m.push({tempRef:_.temp_ref,title:String(_.title??""),probeText:String(_.title??"")})}return{verb:"extract",ucTargets:a,newBuCandidates:m,sourcePins:[{source_id:r.source.source_id,source_cid:r.source.source_cid}],readBasis:r.read_basis??null}}function kr(r,e){let a=(r.images??[]).filter(m=>m.delivery==="selected");if(a.length!==0)return a.map(m=>({ref:m.ref,...m.page!==void 0?{page:m.page}:{},...m.loc!==void 0?{loc:m.loc}:{},media_type:m.media_type,blob_ref:{path:we(e,m.blob),cid:m.blob}}))}function $r(r){return r.length>8&&r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71?"image/png":r.length>3&&r[0]===255&&r[1]===216&&r[2]===255?"image/jpeg":r.length>12&&r.toString("ascii",0,4)==="RIFF"&&r.toString("ascii",8,12)==="WEBP"?"image/webp":null}function Ge(r){return r.toISOString().replace(/[-:]/g,"").slice(0,15)}function gr(r){return r.startsWith("su-conv-")?`conv-${Ot(Buffer.from(r,"utf8")).slice(0,8)}`:r}function pr(r){return r.source_id.startsWith("su-conv-")?"the conversation":r.source_id}function Rr(r,e,a){return`reading ${pr(r)}${a>1?` (source ${e} of ${a})`:""}`}function $e(r){return r.toLowerCase().trim().replace(/\s+/g," ")}function hr(r,e){let a=new Map,m=new Map,_=new Map;for(let{cid:y,content:v}of e.byLabel(de.USECASE)){if(e.superseded.has(y))continue;(e.trust.get(y)==="archived"?_:m).set($e(String(v.title??"")),y)}let x=y=>e.trust.get(y)==="archived"?{cid:y,archived:!0,reason:e.archivedReason.get(y)}:{cid:y};for(let y of r.use_cases){if(y.matches_existing){let k=y.matches_existing.cid;if(e.superseded.has(k)){let i=e.tipOf(k);k=e.superseded.has(i)?null:i}if(k!==null){a.set(y.temp_ref,x(k));continue}}let v=m.get($e(y.title));if(v){a.set(y.temp_ref,{cid:v});continue}let g=_.get($e(y.title));g&&a.set(y.temp_ref,x(g))}return a}var fr=/^(\S+)\.criteria\[(\d+)\]/;function Cr(r,e,a){if(e.length===0||!e.every(_=>fr.test(_.detail)))return!1;let m=new Map;for(let _ of e){let x=fr.exec(_.detail),y=m.get(x[1])??new Set;y.add(Number(x[2])),m.set(x[1],y)}for(let _ of r.use_cases){let x=m.get(_.temp_ref);x?.size&&(_.criteria=(_.criteria??[]).filter((y,v)=>!x.has(v)),a(`${_.temp_ref}: dropped ${x.size} criteria with unverifiable cites \u2014 committed without them (criteria are hints, not oracles)`))}return!0}async function ht(r,e,a,m,_=()=>{},x,y){let v=(g,k)=>_(g,k,r.session_id);return Zt(r,e,a,m,_,{async onProposalEvent(g){let k=g,i=null,I=null;if(cr(k))try{i=dr(k,r.read_basis,{templateVersion:y?.()??null,warn:P=>{e.out(`warning: ${P}`),v("adapter",{warn:P})}}),v("adapter",{ok:!0,use_cases:i.use_cases.length})}catch(P){I=P instanceof J?P.message:String(P),v("adapter",{ok:!1,error:I})}else i=k;return i&&i.use_cases.length===0&&(e.out("warning: the agent proposed ZERO use-cases for this source"),e.emit?.({type:"warning",code:"ZERO_USE_CASES",message:"the agent proposed ZERO use-cases for this source"})),i&&x&&await x(i),{proposal:i,error:I}}})}var Dr=new Set(["agent","ci","override"]);async function Ss(r,e){let a=`ext-${Ge(e.now?.()??new Date)}-lk${Math.random().toString(36).slice(2,8)}`,_=at(e.contextDir,a,e.now?{now:e.now}:void 0).tryAcquire([{kind:"extract"}],{hold:"session",verb:"extract"});if("contended"in _){let x=_.contended.holder,y=`another extraction is running on this context${x?` (pid ${x.pid})`:""} \u2014 retry when it finishes`;return e.out(y),e.emit?.({type:"error",message:y,code:"EXTRACT_LOCKED"}),2}try{return await Er(r,e)}finally{_.release()}}async function Er(r,e){let a=r.mode??"interactive";if(r.posture==="reconcile"){if(r.trust==="hold"){let n="error: --trust hold has no meaning here \u2014 a reconcile IS the review; drop the flag";return e.out(`${n} [TRUST_USAGE]`),e.emit?.({type:"error",message:n,code:"TRUST_USAGE"}),2}if(!r.source||!r.changeContext){let n="reconcile posture needs a pinned source and its change context \u2014 internal wiring fault";return e.out(`error: ${n}`),e.emit?.({type:"error",message:n,code:"POSTURE_USAGE"}),2}if(a==="ci"){let n="reconcile posture is not available under --mode ci \u2014 a held changeset needs a durable session; use --mode agent";return e.out(`error: ${n}`),e.emit?.({type:"error",message:n,code:"POSTURE_USAGE"}),2}}if(r.trust==="hold"&&a==="interactive")return e.out("error: --trust hold only applies to headless runs \u2014 in interactive chat you review items in-session anyway; use --mode agent to hold everything for review"),e.emit?.({type:"error",message:"error: --trust hold only applies to headless runs \u2014 use --mode agent",code:"TRUST_USAGE"}),2;if(a==="interactive"){if(!e.isTTY)return e.out("extract: --mode interactive needs a TTY (use --mode agent|ci|override headless)"),2}else if(!Dr.has(a))return e.out(`extract: unknown mode "${a}" \u2014 interactive | agent | ci | override`),2;if(r.trust!==void 0){if(a==="ci")return e.out("error: --trust is not available under --mode ci (ci is fail-closed \u2014 no trust dials)"),e.emit?.({type:"error",message:"error: --trust is not available under --mode ci",code:"TRUST_UNDER_CI"}),2;if(r.trust!=="auto"&&r.trust!=="hold")return e.out(`error: --trust must be auto | hold, got '${r.trust}'`),e.emit?.({type:"error",message:`error: --trust must be auto | hold, got '${r.trust}'`,code:"TRUST_USAGE"}),2}let m=e.telemetry?.enabled?e.telemetry:void 0,_=Ge(e.now?.()??new Date),x=m?At(m.ids.context_instance_id??null,"extract",m.ids.session_id):oe(e.contextDir,"logs",`extract-${_}.log`);ut(mr(x),{recursive:!0});let y=`run-${_}-${Math.random().toString(36).slice(2,8)}`,v=n=>n==="error"||n==="failed_proposal"?"error":n==="repair_respawn"?"warn":"info",g=(n,d,s)=>{try{wr(x,JSON.stringify({ts:new Date().toISOString(),level:v(n),run_id:y,...m?{user_session_id:m.ids.session_id}:{},...s?{session_id:s}:{},kind:n,data:d})+`
|
|
5
5
|
`)}catch{}m?.wireTrace(n,d,s)};{let n=e.out;e.out=d=>{g("transcript",{line:d}),n(d)}}e.out(`trace: ${ke(x)}`),e.emit?.({type:"run_start",mode:a,trace:x,...m?{session:m.ids.session_id}:{}});let k=Ft();if(k&&e.out(k),e.preflightTurn){let n=await e.preflightTurn();if(g("preflight",n),!n.ok)return e.out(n.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:n.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),2}let i=Z(e.contextDir),I=lr(e.contextDir,i),P=r.sources?.length?r.sources:r.source?[r.source]:[];if(P.length>0){if(r.resume){let n="error: --source cannot be combined with --resume (the resumed session already has its scope)";return e.out(n),e.emit?.({type:"error",message:n,code:"SOURCE_WITH_RESUME"}),2}for(let n of P){let d=i.heads.get(n);if(typeof d!="string"){let s=d===null?`error: --source ${n} was ingested but is retired \u2014 re-ingest it to extract again`:`error: --source ${n} is not an ingested source (kane-cli context list shows them)`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_UNKNOWN"}),2}}}let u=null,h=null;if(r.resume){try{{let c=await nr(e.contextDir,r.resume,i,{verb:"extract",deps:{onWarn:C=>e.out(`note: ${C}`)}});{let C=Object.keys(c.handle.state.read_basis??{});if(C.length>1){let j=`error: session ${r.resume} spans ${C.length} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (re-run kane-cli context extract for anything remaining)`;return e.out(j),e.emit?.({type:"error",message:j,code:"MULTI_SOURCE_RESUME"}),c.handle.release(),2}h=c,g("resume_kind",{kind:c.view.pointer===null?"bare-base":c.view.pointer.at==="final"?"pause":"crash"}),u={handle:c.handle,represent:c.represent,questions:c.questions,staleBasis:c.drift.map(j=>j.subject)}}}}catch(c){let C=c instanceof Error?c.message:String(c);return e.out(`error: ${C}`),e.emit?.({type:"error",message:`error: ${C}`,...c instanceof dt?{code:c.code}:{}}),c instanceof dt?2:1}let n=h?null:Xt(u.handle.state.verb,"extract",r.resume);if(n)return e.out(n.message),e.emit?.({type:"error",message:n.message,code:n.code}),u.handle.release(),2;let d=u.handle.state.change_basis;if(d&&(i.heads.get(d.source_id)??null)!==d.new_head){let c=`error: ${d.source_id} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; re-run kane-cli maintain reconcile against the current file (session ${r.resume} is defunct and can be ignored)`;return e.out(c),e.emit?.({type:"error",message:c,code:"CHANGE_BASIS_MOVED"}),u.handle.release(),2}if(h&&h.view.pointer!==null&&h.drift.length>0){if(!await e.confirmStale(`changed since the pause: ${h.drift.map(C=>C.subject).join(", ")} \u2014 re-ground and continue against the current versions?`)){let C=`resume aborted: the context moved since the pause (${h.drift.map(j=>j.subject).join(", ")}) \u2014 session ${r.resume} is preserved`;return e.out(C),e.emit?.({type:"error",message:C,code:"RESUME_DRIFT"}),u.handle.release(),2}}else u.staleBasis.length>0&&e.out(`note: changed since the pause: ${u.staleBasis.join(", ")} \u2014 re-presented items may be stale`);let s=[...new Set([...u.handle.state.held_receipts??[],...h?.view.kane?.held_receipts??[]])];if(s.length>0)if(e.chat?.holdReceipt)for(let c of s)e.chat.holdReceipt(c);else e={...e,initialMessage:[s.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as D}from"./chunk-CLGC7VEO.js";import{a as y}from"./chunk-YCCUBQY4.js";import{y as r}from"./chunk-ZUGCHQFC.js";import{a as B}from"./chunk-HCBYKLMW.js";import{a as p,b as t,i as _,k as C}from"./chunk-C44QQJR4.js";import{a as W}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var a=$(B(),1);function G(e){let c=e.findIndex(d=>d.free);return c>=0?c:null}var F=60,N=100;function J({headline:e,ask:c=!1,rows:d,sel:i,focused:v,legend:s,freeText:f=null,freeTextNote:g,sublines:u=[]}){let{stdout:o}=C(),h=o?.columns??80,A=h<F,m=Math.min(h-1,N),b=l=>v&&i===l?(0,a.jsx)(t,{color:r.assuranceAccent,children:"\u276F"}):" ",x=c?`? ${e}`:e,R=Math.max(4,m-3),w=u.map((l,T)=>(0,a.jsx)(t,{color:r.dim,children:` ${l.length>R?`${l.slice(0,R-1)}\u2026`:l}`},`sub-${T}`)),k=0,E=d.map((l,T)=>l.free?f?(0,a.jsxs)(p,{flexDirection:"column",children:[(0,a.jsxs)(p,{children:[(0,a.jsxs)(t,{children:[(0,a.jsx)(t,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(t,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(y,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:l.label})]}),g?(0,a.jsx)(t,{color:r.muted,children:` ${g}`}):null]},l.key):(0,a.jsxs)(t,{children:[b(T)," ",(0,a.jsx)(t,{color:r.dim,children:`\u270E ${l.label}`})]},l.key):(k+=1,(0,a.jsxs)(t,{bold:v&&i===T,children:[b(T),` ${k}. ${l.label}`,l.detail?(0,a.jsx)(t,{color:r.dim,bold:!1,children:` \u2014 ${l.detail}`}):null]},l.key)));if(A)return(0,a.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(t,{bold:!0,color:r.assuranceAccent,children:x}),w,E,(0,a.jsx)(t,{color:r.muted,children:s})]});let M=Math.max(2,m-(3+x.length+1)),L=Math.max(2,m-(3+s.length+1));return(0,a.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,a.jsx)(t,{bold:!0,children:x}),` ${"\u2500".repeat(M)}`]}),w,(0,a.jsx)(t,{children:" "}),E,(0,a.jsx)(t,{children:" "}),(0,a.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,a.jsx)(t,{color:r.muted,children:s}),` ${"\u2500".repeat(L)}`]})]})}var S=$(B(),1),H="ctrl+t thinking \xB7 ctrl+c exit";function I(e,c){if(e.length<=c)return e;if(c<=1)return"\u2026";let d=Math.ceil((c-1)/2),i=Math.floor((c-1)/2);return`${e.slice(0,d)}\u2026${i>0?e.slice(-i):""}`}function te({verb:e,subject:c,pendingCount:d,creditsTotal:i,state:v,hints:s=H}){let{stdout:f}=C(),g=f?.columns??80,u=[];u.push(e),v&&u.push(v),i!==void 0&&u.push(`${i.toFixed(1)} credits`);let o=d?`[${d} pending]`:null,h=" \xB7 ",m=[...u,...o?[o]:[]].join(h).length,b,x=[...u,...c?[c]:[],...o?[o]:[],s].join(h);if(x.length<=g)b=x;else{let R=g-m-(c?h.length:0)-h.length-s.length;if(c&&R>=8)b=[...u,I(c,R),...o?[o]:[],s].join(h);else{let w=g-m-(c?h.length:0);b=[...u,...c&&w>=4?[I(c,w)]:[],...o?[o]:[]].join(h)}}if(v){let R=` \xB7 ${v}`,w=b.indexOf(R);if(w>=0)return(0,S.jsxs)(t,{color:r.dim,children:[b.slice(0,w+3),(0,S.jsx)(t,{color:r.assuranceAccent,children:v}),b.slice(w+R.length)]})}return(0,S.jsx)(t,{color:r.dim,children:b})}var O=$(W(),1);function re({onToggleThinking:e,onCtrlC:c,explorer:d,panel:i}){let s=(0,O.useRef)(null),f=(0,O.useRef)(""),g=()=>{s.current&&clearTimeout(s.current),s.current=null,f.current=""};return(0,O.useEffect)(()=>g,[]),_((u,o)=>{if(o.ctrl&&u==="t"){e();return}if(o.ctrl&&u==="c"){c();return}if(!o.ctrl&&u.includes("")){c();return}if(!o.ctrl&&u.includes("")){e();return}if(d&&d.isOpen()){let h=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{g(),d.onBack()},150)};if(s.current){if(o.upArrow||o.downArrow||o.return){g(),o.return?d.onEnter():d.onMove(o.upArrow?-1:1);return}if(f.current+=u,f.current==="["){h();return}let A=f.current;g();let m=/^\[([ABCD])/.exec(A);if(m){(m[1]==="A"||m[1]==="B")&&d.onMove(m[1]==="A"?-1:1);return}d.onBack();return}if(o.upArrow){d.onMove(-1);return}if(o.downArrow){d.onMove(1);return}if(o.return){d.onEnter();return}if(o.escape){f.current="",h();return}return}if(i&&i.isFocused()){let h=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{g(),i.onBack()},150)};if(s.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){g(),o.return?i.onSelect():o.leftArrow?i.onLeft?.():o.rightArrow?i.onRight?.():i.onMove(o.upArrow?-1:1);return}if(f.current+=u,f.current==="["){h();return}let A=f.current;g();let m=/^\[([ABCD])/.exec(A);if(m){m[1]==="A"||m[1]==="B"?i.onMove(m[1]==="A"?-1:1):m[1]==="C"?i.onRight?.():i.onLeft?.();return}i.onBack();return}if(o.upArrow){i.onMove(-1);return}if(o.downArrow){i.onMove(1);return}if(o.leftArrow){i.onLeft?.();return}if(o.rightArrow){i.onRight?.();return}if(o.return){i.onSelect();return}if(o.escape){f.current="",h();return}if(/^[1-9]$/.test(u)){i.onDigit(Number(u));return}if(o.tab){i.onTab?.();return}if(u===" "&&i.isMulti()){i.onSpace();return}if(u&&!o.ctrl&&!o.meta){i.onType(u);return}return}}),null}var n=$(B(),1);function V(e){return e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function P(e){let c=V(e);return e.viewDiff&&c.push({v:"view_diff",label:"view diff",detail:"full old \u2192 new"}),c}function K(e){return e.kind==="ARCHIVE"?null:P(e).length}var j={ADD:{color:r.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:r.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},q=60,Q=100;function ue({card:e,position:c,sel:d=0,focused:i=!1,freeText:v=null,editorIntent:s="steer"}){let{stdout:f}=C(),g=f?.columns??80,u=g<q,o=Math.min(g-1,Q),h=P(e),A=K(e),m=j[e.kind],b=l=>i&&d===l?(0,n.jsx)(t,{color:r.assuranceAccent,children:"\u276F"}):" ",x=e.impact,R=x&&"stale_refs"in x&&x.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${x.stale_refs.length} item(s) stale`+((x.direct_refs?.length??0)>0?` \u2014 ${x.direct_refs.length} directly touched: ${x.direct_refs.join(", ")}`:""):x&&"design_children"in x?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${x.design_children} design child(ren)`:null,w=`? reconcile \u2014 item ${c.n} of ${c.of}`,k=A!==null?"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 type = adjust \xB7 esc \xB7 nothing to undo":"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 esc \xB7 nothing to undo",E=(0,n.jsxs)(p,{flexDirection:"column",children:[(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsxs)(t,{bold:!0,children:[(0,n.jsx)(t,{color:m.color,children:`[${e.kind}]`}),` ${D(e.title)}`]})}),(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:e.why})}),e.diffSummary?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:e.diffSummary})}):(e.diff??[]).map((l,T)=>(0,n.jsx)(p,{paddingLeft:4,children:(0,n.jsx)(t,{color:l.op==="-"?"red":"green",children:`${l.op==="-"?"\u2212":"+"} ${l.field==="criteria"?"criterion":l.field}: ${l.text}`})},`d-${T}`)),e.tier?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:`match: ${e.tier}`})}):null,(e.citeLines??[]).map((l,T)=>(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:l})},`c-${T}`)),R?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:`impact: ${R}`})}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:e.provenance})}):null,(0,n.jsx)(t,{children:" "}),h.map((l,T)=>(0,n.jsxs)(t,{children:[b(T),` ${T+1}. ${l.label}`,(0,n.jsx)(t,{color:r.dim,children:` \u2014 ${l.detail}`})]},`o-${T}`)),A!==null||v&&s==="because"?v?(0,n.jsxs)(p,{flexDirection:"column",children:[(0,n.jsxs)(p,{children:[(0,n.jsxs)(t,{children:[(0,n.jsx)(t,{color:r.assuranceAccent,children:"\u276F"})," ",(0,n.jsx)(t,{color:r.dim,children:"\u270E "})]}),(0,n.jsx)(y,{value:v.value,onChange:v.onChange,onSubmit:v.onSubmit,onCancel:v.onCancel,placeholder:s==="because"?"why archive it?":"say what to adjust"})]}),(0,n.jsx)(t,{color:r.muted,children:s==="because"?" submits as: archive \xB7 your reason goes on the record":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):A!==null?(0,n.jsxs)(t,{children:[b(A)," ",(0,n.jsx)(t,{color:r.dim,children:e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(u)return(0,n.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,n.jsx)(t,{bold:!0,color:r.assuranceAccent,children:w}),E,(0,n.jsx)(t,{color:r.muted,children:k})]});let M=Math.max(2,o-(3+w.length+1)),L=Math.max(2,o-(3+k.length+1));return(0,n.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,n.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,n.jsx)(t,{bold:!0,children:w}),` ${"\u2500".repeat(M)}`]}),(0,n.jsx)(t,{children:" "}),E,(0,n.jsx)(t,{children:" "}),(0,n.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,n.jsx)(t,{color:r.muted,children:k}),` ${"\u2500".repeat(L)}`]})]})}export{G as a,J as b,te as c,re as d,V as e,P as f,K as g,ue as h};
|
|
2
|
+
import{a as D}from"./chunk-CLGC7VEO.js";import{a as y}from"./chunk-YCCUBQY4.js";import{y as r}from"./chunk-27U4PLPX.js";import{a as B}from"./chunk-HCBYKLMW.js";import{a as p,b as t,i as _,k as C}from"./chunk-C44QQJR4.js";import{a as W}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var a=$(B(),1);function G(e){let c=e.findIndex(d=>d.free);return c>=0?c:null}var F=60,N=100;function J({headline:e,ask:c=!1,rows:d,sel:i,focused:v,legend:s,freeText:f=null,freeTextNote:g,sublines:u=[]}){let{stdout:o}=C(),h=o?.columns??80,A=h<F,m=Math.min(h-1,N),b=l=>v&&i===l?(0,a.jsx)(t,{color:r.assuranceAccent,children:"\u276F"}):" ",x=c?`? ${e}`:e,R=Math.max(4,m-3),w=u.map((l,T)=>(0,a.jsx)(t,{color:r.dim,children:` ${l.length>R?`${l.slice(0,R-1)}\u2026`:l}`},`sub-${T}`)),k=0,E=d.map((l,T)=>l.free?f?(0,a.jsxs)(p,{flexDirection:"column",children:[(0,a.jsxs)(p,{children:[(0,a.jsxs)(t,{children:[(0,a.jsx)(t,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(t,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(y,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:l.label})]}),g?(0,a.jsx)(t,{color:r.muted,children:` ${g}`}):null]},l.key):(0,a.jsxs)(t,{children:[b(T)," ",(0,a.jsx)(t,{color:r.dim,children:`\u270E ${l.label}`})]},l.key):(k+=1,(0,a.jsxs)(t,{bold:v&&i===T,children:[b(T),` ${k}. ${l.label}`,l.detail?(0,a.jsx)(t,{color:r.dim,bold:!1,children:` \u2014 ${l.detail}`}):null]},l.key)));if(A)return(0,a.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(t,{bold:!0,color:r.assuranceAccent,children:x}),w,E,(0,a.jsx)(t,{color:r.muted,children:s})]});let M=Math.max(2,m-(3+x.length+1)),L=Math.max(2,m-(3+s.length+1));return(0,a.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,a.jsx)(t,{bold:!0,children:x}),` ${"\u2500".repeat(M)}`]}),w,(0,a.jsx)(t,{children:" "}),E,(0,a.jsx)(t,{children:" "}),(0,a.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,a.jsx)(t,{color:r.muted,children:s}),` ${"\u2500".repeat(L)}`]})]})}var S=$(B(),1),H="ctrl+t thinking \xB7 ctrl+c exit";function I(e,c){if(e.length<=c)return e;if(c<=1)return"\u2026";let d=Math.ceil((c-1)/2),i=Math.floor((c-1)/2);return`${e.slice(0,d)}\u2026${i>0?e.slice(-i):""}`}function te({verb:e,subject:c,pendingCount:d,creditsTotal:i,state:v,hints:s=H}){let{stdout:f}=C(),g=f?.columns??80,u=[];u.push(e),v&&u.push(v),i!==void 0&&u.push(`${i.toFixed(1)} credits`);let o=d?`[${d} pending]`:null,h=" \xB7 ",m=[...u,...o?[o]:[]].join(h).length,b,x=[...u,...c?[c]:[],...o?[o]:[],s].join(h);if(x.length<=g)b=x;else{let R=g-m-(c?h.length:0)-h.length-s.length;if(c&&R>=8)b=[...u,I(c,R),...o?[o]:[],s].join(h);else{let w=g-m-(c?h.length:0);b=[...u,...c&&w>=4?[I(c,w)]:[],...o?[o]:[]].join(h)}}if(v){let R=` \xB7 ${v}`,w=b.indexOf(R);if(w>=0)return(0,S.jsxs)(t,{color:r.dim,children:[b.slice(0,w+3),(0,S.jsx)(t,{color:r.assuranceAccent,children:v}),b.slice(w+R.length)]})}return(0,S.jsx)(t,{color:r.dim,children:b})}var O=$(W(),1);function re({onToggleThinking:e,onCtrlC:c,explorer:d,panel:i}){let s=(0,O.useRef)(null),f=(0,O.useRef)(""),g=()=>{s.current&&clearTimeout(s.current),s.current=null,f.current=""};return(0,O.useEffect)(()=>g,[]),_((u,o)=>{if(o.ctrl&&u==="t"){e();return}if(o.ctrl&&u==="c"){c();return}if(!o.ctrl&&u.includes("")){c();return}if(!o.ctrl&&u.includes("")){e();return}if(d&&d.isOpen()){let h=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{g(),d.onBack()},150)};if(s.current){if(o.upArrow||o.downArrow||o.return){g(),o.return?d.onEnter():d.onMove(o.upArrow?-1:1);return}if(f.current+=u,f.current==="["){h();return}let A=f.current;g();let m=/^\[([ABCD])/.exec(A);if(m){(m[1]==="A"||m[1]==="B")&&d.onMove(m[1]==="A"?-1:1);return}d.onBack();return}if(o.upArrow){d.onMove(-1);return}if(o.downArrow){d.onMove(1);return}if(o.return){d.onEnter();return}if(o.escape){f.current="",h();return}return}if(i&&i.isFocused()){let h=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{g(),i.onBack()},150)};if(s.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){g(),o.return?i.onSelect():o.leftArrow?i.onLeft?.():o.rightArrow?i.onRight?.():i.onMove(o.upArrow?-1:1);return}if(f.current+=u,f.current==="["){h();return}let A=f.current;g();let m=/^\[([ABCD])/.exec(A);if(m){m[1]==="A"||m[1]==="B"?i.onMove(m[1]==="A"?-1:1):m[1]==="C"?i.onRight?.():i.onLeft?.();return}i.onBack();return}if(o.upArrow){i.onMove(-1);return}if(o.downArrow){i.onMove(1);return}if(o.leftArrow){i.onLeft?.();return}if(o.rightArrow){i.onRight?.();return}if(o.return){i.onSelect();return}if(o.escape){f.current="",h();return}if(/^[1-9]$/.test(u)){i.onDigit(Number(u));return}if(o.tab){i.onTab?.();return}if(u===" "&&i.isMulti()){i.onSpace();return}if(u&&!o.ctrl&&!o.meta){i.onType(u);return}return}}),null}var n=$(B(),1);function V(e){return e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function P(e){let c=V(e);return e.viewDiff&&c.push({v:"view_diff",label:"view diff",detail:"full old \u2192 new"}),c}function K(e){return e.kind==="ARCHIVE"?null:P(e).length}var j={ADD:{color:r.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:r.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},q=60,Q=100;function ue({card:e,position:c,sel:d=0,focused:i=!1,freeText:v=null,editorIntent:s="steer"}){let{stdout:f}=C(),g=f?.columns??80,u=g<q,o=Math.min(g-1,Q),h=P(e),A=K(e),m=j[e.kind],b=l=>i&&d===l?(0,n.jsx)(t,{color:r.assuranceAccent,children:"\u276F"}):" ",x=e.impact,R=x&&"stale_refs"in x&&x.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${x.stale_refs.length} item(s) stale`+((x.direct_refs?.length??0)>0?` \u2014 ${x.direct_refs.length} directly touched: ${x.direct_refs.join(", ")}`:""):x&&"design_children"in x?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${x.design_children} design child(ren)`:null,w=`? reconcile \u2014 item ${c.n} of ${c.of}`,k=A!==null?"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 type = adjust \xB7 esc \xB7 nothing to undo":"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 esc \xB7 nothing to undo",E=(0,n.jsxs)(p,{flexDirection:"column",children:[(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsxs)(t,{bold:!0,children:[(0,n.jsx)(t,{color:m.color,children:`[${e.kind}]`}),` ${D(e.title)}`]})}),(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:e.why})}),e.diffSummary?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:e.diffSummary})}):(e.diff??[]).map((l,T)=>(0,n.jsx)(p,{paddingLeft:4,children:(0,n.jsx)(t,{color:l.op==="-"?"red":"green",children:`${l.op==="-"?"\u2212":"+"} ${l.field==="criteria"?"criterion":l.field}: ${l.text}`})},`d-${T}`)),e.tier?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:`match: ${e.tier}`})}):null,(e.citeLines??[]).map((l,T)=>(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:l})},`c-${T}`)),R?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:`impact: ${R}`})}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:e.provenance})}):null,(0,n.jsx)(t,{children:" "}),h.map((l,T)=>(0,n.jsxs)(t,{children:[b(T),` ${T+1}. ${l.label}`,(0,n.jsx)(t,{color:r.dim,children:` \u2014 ${l.detail}`})]},`o-${T}`)),A!==null||v&&s==="because"?v?(0,n.jsxs)(p,{flexDirection:"column",children:[(0,n.jsxs)(p,{children:[(0,n.jsxs)(t,{children:[(0,n.jsx)(t,{color:r.assuranceAccent,children:"\u276F"})," ",(0,n.jsx)(t,{color:r.dim,children:"\u270E "})]}),(0,n.jsx)(y,{value:v.value,onChange:v.onChange,onSubmit:v.onSubmit,onCancel:v.onCancel,placeholder:s==="because"?"why archive it?":"say what to adjust"})]}),(0,n.jsx)(t,{color:r.muted,children:s==="because"?" submits as: archive \xB7 your reason goes on the record":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):A!==null?(0,n.jsxs)(t,{children:[b(A)," ",(0,n.jsx)(t,{color:r.dim,children:e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(u)return(0,n.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,n.jsx)(t,{bold:!0,color:r.assuranceAccent,children:w}),E,(0,n.jsx)(t,{color:r.muted,children:k})]});let M=Math.max(2,o-(3+w.length+1)),L=Math.max(2,o-(3+k.length+1));return(0,n.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,n.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,n.jsx)(t,{bold:!0,children:w}),` ${"\u2500".repeat(M)}`]}),(0,n.jsx)(t,{children:" "}),E,(0,n.jsx)(t,{children:" "}),(0,n.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,n.jsx)(t,{color:r.muted,children:k}),` ${"\u2500".repeat(L)}`]})]})}export{G as a,J as b,te as c,re as d,V as e,P as f,K as g,ue as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as t}from"./chunk-
|
|
2
|
+
import{a as t}from"./chunk-766WGMBU.js";async function l(e){let o=e.credentials.expires_at,i=e.thresholdSeconds??300;if(o-Date.now()/1e3>=i)return null;let r=e.creds.loadClient(e.profile,e.env);if(!r)return null;let n=await new t(e.env).refreshToken(e.credentials.refresh_token,r.client_id),s=Math.floor(Date.now()/1e3)+n.expires_in;return e.creds.saveCredentials(e.profile,e.env,{access_token:n.access_token,refresh_token:n.refresh_token,expires_at:s,scope:n.scope}),{accessToken:n.access_token,refreshToken:n.refresh_token,expiresAt:s,scope:n.scope}}export{l as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{Q as
|
|
2
|
+
import{O,Q as S}from"./chunk-ZVHCQMJ6.js";import{c as L}from"./chunk-RFHMDQXZ.js";import{m as P,n as R}from"./chunk-56PAQAX5.js";import{y as s}from"./chunk-27U4PLPX.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-OTTGS2TE.js";import{a as f}from"./chunk-XO5ZH3ZR.js";import{a as m}from"./chunk-G7VQCS4J.js";var o=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function k(c){let{creds:i,env:a,usernameFlag:l,accessKeyFlag:p,log:t}=c,e=null,u=null;if(l&&p)e={username:l,access_key:p},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=i.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=i.getActiveCredentials();if(!r)throw new o("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await f({creds:i,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let d=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:d}),new o(`Token refresh failed: ${d}`,"refresh_failed")}}let v=m(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,g=new h(v.controllerBaseUrl,b,y,t),s=await g.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:g,resolvedCreds:s}}export{o as a,k as b};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as u,d as f,e as l}from"./chunk-FNH55WSR.js";import{a as p}from"./chunk-TZXXJWHA.js";function d(t,r,e){return{id:`${t}.internal`,label:r,required:!0,status:"fail",detail:e instanceof Error?e.message:String(e)}}async function $(t,r={}){let e=p();if(!e.supported)return{sections:[{platform:"host",checks:[{id:"host.platform",label:"host",required:!0,status:"fail",detail:e.reason}],targets:[]}]};let n=t?u().filter(s=>s.toLowerCase()===t.toLowerCase()):u(),c=[];for(let s of n){let o=f(s);if(!o)continue;let i;try{i=await o.checks(r)}catch(h){i=[d(s,"toolchain check",h)]}let a=[];if(r.targets)try{a=await l(s)}catch{}c.push({platform:s,checks:i,targets:a})}return{sections:c}}function g(t){return t==="pass"?"\u2713":t==="fail"?"\u2717":"\u2139"}function m(t){return t.charAt(0).toUpperCase()+t.slice(1)}function k(t){if(t.state==="stopped")return`${t.kind==="simulator"?"simulator":"virtual device"}, stopped (bootable)`;let r=t.kind==="simulator"?"simulator":"emulator";return t.state==="ready"?`${r}, ready`:t.state==="unauthorized"?`${r}, UNAUTHORIZED \u2192 accept the USB-debugging prompt on the device`:`${r}, offline \u2192 reconnect the device, then re-run`}function x(t){return t.state==="ready"||t.state==="stopped"?"\u2713":"\u2717"}function y(t,r={}){let e=[];if(t.sections.length===0)return"No mobile platforms are supported on this host.";for(let n of t.sections){e.length>0&&e.push(""),e.push(`${m(n.platform)} toolchain`);let c=r.verbose?n.checks:n.checks.filter(o=>o.status!=="info"),s=new Set;for(let o of c){let i=o.detail?` \u2014 ${o.detail}`:"";if(e.push(` ${g(o.status)} ${o.label}${i}`),o.status==="fail"&&o.fixText&&!s.has(o.fixText)){s.add(o.fixText);for(let a of o.fixText.split(`
|
|
3
|
+
`))e.push(` fix: ${a}`)}}if(n.targets.length>0){e.push(" Targets");for(let o of n.targets){let i=o.id===o.displayName?o.displayName:`${o.displayName} (${o.id})`;e.push(` ${x(o)} ${i} \u2014 ${k(o)}`)}}}return e.join(`
|
|
4
|
+
`)}function T(t){return t.sections.length===0?!0:t.sections.every(r=>r.checks.some(e=>e.required&&e.status==="fail"&&!e.fixedByBundle))}function C(t){for(let r of t.sections)for(let e of r.checks)if(e.required&&e.status!=="pass")return 2;return 0}export{$ as a,y as b,T as c,C as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as N}from"./chunk-L2TV4G56.js";import{b as y,c as E,d as $,f as O,g as A,h as V,i as I,j as T}from"./chunk-GFKCTYCA.js";import{
|
|
2
|
+
import{b as N}from"./chunk-L2TV4G56.js";import{b as y,c as E,d as $,f as O,g as A,h as V,i as I,j as T}from"./chunk-GFKCTYCA.js";import{c as x}from"./chunk-IDX3TOPY.js";import{a as C,f as P}from"./chunk-DUAXZYAD.js";var G={extract:e=>`kane-cli context extract --resume ${e}`,design:e=>`kane-cli design tests --resume ${e}`};function Q(e,n,s){if(e===void 0||e===n)return null;if(e==="extract"||e==="design"){let a=G[e](s);return{code:"WRONG_VERB",message:`error: session ${s} is a ${e} session \u2014 resume it with ${a}`,next:[{cmd:a,why:`this session belongs to a ${e} run`}]}}return{code:"WRONG_VERB",message:`error: session ${s} belongs to a ${e} run \u2014 this command cannot resume it`,next:[]}}import{existsSync as K}from"fs";import{join as M}from"path";function ne(e){return{id:e.id,text:e.question,risk:["high","med","low"].includes(e.risk)?e.risk:"med",rationale:e.rationale,options:e.options.map(n=>({label:n.label,detail:n.description??""})),recommended_index:e.recommendedOptionIndex,allow_free_text:e.allowFreeText,kind:e.kind,consequence:e.consequence,evidence_count:e.evidence_count,multi_select:e.multiSelect}}function B(e){return{id:e.id,header:e.kind??"question",question:e.text,kind:e.kind??"clarify",multiSelect:e.multi_select??!1,options:e.options.map((n,s)=>({id:`o${s}`,label:n.label,description:n.detail||void 0})),recommendedOptionIndex:e.recommended_index,risk:e.risk,rationale:e.rationale,consequence:e.consequence??"",evidence_count:e.evidence_count,allowFreeText:e.allow_free_text}}function se(e,n){e.save({agent_state:n.agent_state,pending:{questions:n.pending.questions.map(B),proposals:n.pending.proposals??[]},assumed:n.assumed.map(s=>({questionId:s.question_id,optionId:s.option_id,flagged:!0,eventId:`assumed:${n.sid}:${s.question_id}`}))}),e.release(),$(e.state.sid)}function te(e){return{persist(n){let s=e.seqBase(),a={seq:n.seq+s,turn_id:n.turn_id,at:n.at,agent_state_schema:n.agent_state_schema,delta_items:n.delta_items,binding:n.binding,usage_total:n.usage_total,...n.base_fingerprint!==void 0?{base_fingerprint:n.base_fingerprint}:{}},l={applied_events:[...new Set([...e.handle.state.applied_events,...V(e.contextDir,e.handle.state.sid)])].sort(),held_receipts:e.peekHeldReceipts?.()??[],pending:{questions:n.at!=="turn"?(n.pending_questions??[]).map(B):[],proposals:e.stagedProposals?.()??[]},parent_asks:[],read_basis:e.readBasis(),corpus_cursor:e.corpusCursor(),store_watermark:P(e.contextDir),...(()=>{let o=e.ingestRegistry?e.ingestRegistry():e.handle.state.ingest_registry??[],p=e.ingestSchedule?e.ingestSchedule():e.handle.state.ingest_schedule??[];return{...o.length?{ingest_registry:o}:{},...p.length?{ingest_schedule:p}:{}}})()};return O(e.contextDir,e.handle,a,l,{...e.onSoftCap?{onSoftCap:e.onSoftCap}:{},...e.onStat?{onStat:e.onStat}:{},...e.now?{now:e.now}:{}})}}}var m=class extends Error{constructor(s,a,l=[]){super(`${s}: ${a}`);this.code=s;this.next=l}};async function ie(e,n,s,a={}){let l=a.deps??{},o=x(e,n);try{let p=o.state.checkpoint??null,w=K(M(e,"sessions",n,y,E)),j=!p&&o.state.agent_state.items.length>0;if(!p&&!w||j)throw new m("SESSION_V1",`session ${n} predates durable checkpoints \u2014 this build cannot resume it; abandon it with kane-cli context sessions clean ${n} and start a fresh run (committed work is untouched)`,[{cmd:`kane-cli context sessions clean ${n}`,why:"abandon the pre-checkpoint session, then start a fresh run"}]);!p&&w&&l.onWarn?.(`session ${n}: checkpoint chain present with no pointer \u2014 recovering from the chain`);let c=A(e,n);c.orphans.length>0&&T(e,n,c.orphans),c.fallback&&l.onWarn?.(`session ${n}: chain truncated to checkpoint ${c.fallback.resumableAt} \u2014 ${c.fallback.turnsLost} turn(s) lost to a corrupt record`);let r=c.base;if(a.verb){let i=Q(r.verb,a.verb,n);if(i)throw new m("WRONG_VERB",i.message,i.next)}if(a.useCase!==void 0&&a.useCase!==r.use_case&&!await(l.confirmRetarget?.(r.use_case,a.useCase)??!1))throw new m("RESUME_RETARGET_DECLINED",r.use_case?`session ${n} was designing ${r.use_case}; resuming onto ${a.useCase} needs an explicit retarget`:`session ${n} has no recorded use-case; adopting ${a.useCase} needs an explicit retarget`,r.use_case?[{cmd:`kane-cli design tests --resume ${n}`,why:`continue on ${r.use_case} (the session's own subject)`}]:[]);let d=c.kane,f=[],H=d?.read_basis??Object.fromEntries(Object.entries(o.state.read_basis));for(let[i,t]of Object.entries(H)){let u=s.heads.get(i)??null;u!==t&&f.push({subject:i,pinned:t,live:u})}r.uc_tip!==void 0&&l.liveUcTip!==void 0&&l.liveUcTip!==r.uc_tip&&f.push({subject:r.use_case??"use-case",pinned:r.uc_tip,live:l.liveUcTip}),l.locks?.reacquire?.(n);let _={...r.run_config,checkpoints:!0};delete _.resume;let R;if(c.pointer===null||c.agent===null)R=_;else{if(!c.agent.base_fingerprint)throw new m("CHECKPOINT_PROTOCOL",`session ${n}: chain carries no base fingerprint \u2014 cannot attest the seed rebuild`);R={..._,resume:{schema:2,binding:c.agent.binding,base_fingerprint:c.agent.base_fingerprint,delta_items:c.agent.delta_items,last_seq:c.pointer.seq}}}let S=d?.pending.questions??[],b=i=>{let t=`resolveq:${n}:${i}`,u=`assumed:${n}:${i}`;return s.appliedEvents.has(t)||s.appliedEvents.has(u)||o.isApplied(t)||o.isApplied(u)},W=d&&S.length>0?S.filter(i=>!b(i.id)):o.state.pending.questions.filter(i=>!b(i.id)),v={redeliverReceipts:[],recommit:[]},h,k;if(d){let i={...d,applied_events:[...new Set([...d.applied_events,...o.state.applied_events])].sort()},t;try{t=I(e,n,i,s,{verb:r.verb==="design"?"design":"extract",...r.use_case?{ucRef:r.use_case}:{},composeReceipt:(g,q,D)=>N(g,q,D),onNote:l.onWarn})}catch(g){throw g instanceof C?new m("CHECKPOINT_PROTOCOL",`store reconciliation refused: ${g.message}`,[{cmd:`kane-cli context sessions clean ${n}`,why:"abandon the session if the store was rebuilt"}]):g}v={redeliverReceipts:t.redeliverReceipts,recommit:t.recommit},k=t.prunedPending;let u=d.pending.proposals??[];h=(u.length>0?u:o.state.pending.proposals).filter(g=>!(typeof g.event_id=="string"&&s.appliedEvents.has(g.event_id))),(t.newlyApplied.length>0||t.prunedPending.length>0)&&o.reconcileSave({appliedEvents:t.newlyApplied,heldReceipts:[...o.state.held_receipts??[],...t.redeliverReceipts],pending:{questions:o.state.pending.questions,proposals:h}})}else{let i=o.state.pending.proposals;k=i.filter(t=>typeof t.event_id=="string"&&s.appliedEvents.has(t.event_id)),h=i.filter(t=>!(typeof t.event_id=="string"&&s.appliedEvents.has(t.event_id)))}return{kind:"v2",handle:o,base:r,view:c,kane:d,spawnConfig:R,drift:f,reconcile:v,questions:W,represent:h,prunedPending:k}}catch(p){throw o.release(),p}}export{Q as a,ne as b,se as c,te as d,m as e,ie as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{e as $e}from"./chunk-CTW2VQKS.js";import{a as te}from"./chunk-EWCAFKLX.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-UDIQOJEL.js";import{a as ve}from"./chunk-FEJXWJ3L.js";import{y as i}from"./chunk-27U4PLPX.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};
|