@testmuai/kane-cli 0.8.5 → 0.8.6
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-HAIVTS4J.js → ChatSurface-S2P7WMBI.js} +1 -1
- package/dist/{ChromeProfilePicker-5ILSVC2K.js → ChromeProfilePicker-7DTJK2QW.js} +1 -1
- package/dist/{CliFeedbackPrompt-LFKEYMKP.js → CliFeedbackPrompt-Y3OYZX54.js} +1 -1
- package/dist/{CliUploadProgress-Y7ITY2I7.js → CliUploadProgress-I3N5WDNJ.js} +1 -1
- package/dist/{ConfigView-OECNNCXC.js → ConfigView-EOYCKYJS.js} +1 -1
- package/dist/{EvidenceViewOffer-FODRAS6Z.js → EvidenceViewOffer-AQ3KB3EN.js} +1 -1
- package/dist/FolderPicker-RCHRYYC4.js +2 -0
- package/dist/{InfoBox-HWMHNWPM.js → InfoBox-QBXPPMM2.js} +1 -1
- package/dist/{LinksBox-TAGYCFFO.js → LinksBox-L24KON4U.js} +1 -1
- package/dist/{ProfilesView-QJBR3RCM.js → ProfilesView-H6XCTIXI.js} +1 -1
- package/dist/{ProjectPicker-PP75ILZU.js → ProjectPicker-F6JGF2B3.js} +1 -1
- package/dist/{SaveSessionPrompt-UCRET3II.js → SaveSessionPrompt-QGO65DZN.js} +1 -1
- package/dist/SingleShotApp-AY3XFEYT.js +2 -0
- package/dist/{SummaryBox-SLM3OFS2.js → SummaryBox-OZIZQY4B.js} +1 -1
- package/dist/TestMdRunView-RPW4MIJA.js +2 -0
- package/dist/{TestrunEvidenceTable-PTIBYAXO.js → TestrunEvidenceTable-A7WTTKTV.js} +1 -1
- package/dist/{WhoamiView-WPHMNYUV.js → WhoamiView-EB5AV27X.js} +1 -1
- package/dist/{app-download-GYQYLGT3.js → app-download-SQ4RDY3E.js} +1 -1
- package/dist/{auth-3DLNMZC2.js → auth-TW24FZQF.js} +1 -1
- package/dist/{binary-XJ3RF3VO.js → binary-5LMQJ3CZ.js} +1 -1
- package/dist/{bind-2N4Q6YKH.js → bind-SJ6DOVQ4.js} +2 -2
- package/dist/{bootstrap-5IHKW5SE.js → bootstrap-BTEXO6HX.js} +1 -1
- package/dist/bridge-GQJ35GTL.js +2 -0
- package/dist/{changelog-WCCTI47M.js → changelog-JLSLSA3Y.js} +1 -1
- package/dist/chunk-2DCNCH32.js +4 -0
- package/dist/{chunk-PEI2566X.js → chunk-2R7KL7YG.js} +1 -1
- package/dist/{chunk-T3XDMR5B.js → chunk-3LEVCW6R.js} +1 -1
- package/dist/{chunk-NLECZCMZ.js → chunk-3UUPP5W3.js} +1 -1
- package/dist/{chunk-PCOSE5SW.js → chunk-4NSP2NPT.js} +1 -1
- package/dist/{chunk-FTZPWXF7.js → chunk-4ONGF4NT.js} +1 -1
- package/dist/{chunk-ZFZ7YXEU.js → chunk-5COGCNED.js} +1 -1
- package/dist/{chunk-DCUT3GJA.js → chunk-7VZCXW74.js} +1 -1
- package/dist/{chunk-CGYSFLM2.js → chunk-A44G533S.js} +1 -1
- package/dist/{chunk-ZIRMSWKS.js → chunk-AO3PBE2V.js} +1 -1
- package/dist/{chunk-AJPLHW4T.js → chunk-ATWDQCDA.js} +1 -1
- package/dist/{chunk-UX3KPYTI.js → chunk-AWD56KGX.js} +1 -1
- package/dist/{chunk-YFLKS4UV.js → chunk-B4Q6FMIP.js} +3 -3
- package/dist/chunk-B5QGIUJA.js +26 -0
- package/dist/chunk-BN6AHQL7.js +17 -0
- package/dist/chunk-BRTARADN.js +4 -0
- package/dist/{chunk-BAL7E4OH.js → chunk-C4WTZSX4.js} +1 -1
- package/dist/{chunk-TCK3QMKY.js → chunk-CLLQQPBZ.js} +1 -1
- package/dist/{chunk-LA2EMSHE.js → chunk-CZUOGGUK.js} +1 -1
- package/dist/{chunk-FRSHEJUS.js → chunk-D4SRHIJ5.js} +1 -1
- package/dist/{chunk-Z2T7E5HM.js → chunk-DN3E6RT6.js} +2 -2
- package/dist/{chunk-PUFJEU46.js → chunk-DZCG7FFP.js} +1 -1
- package/dist/{chunk-CNNJ4U2L.js → chunk-E5S4BASB.js} +1 -1
- package/dist/{chunk-HQWLSA5M.js → chunk-ESC7AOCX.js} +1 -1
- package/dist/{chunk-W27F2NWA.js → chunk-EXERQHXV.js} +1 -1
- package/dist/{chunk-PWYEOBXV.js → chunk-FJYDEWOA.js} +1 -1
- package/dist/{chunk-35EUIBYJ.js → chunk-FMUCZWS3.js} +1 -1
- package/dist/{chunk-PB3GADUD.js → chunk-FUNKVREV.js} +1 -1
- package/dist/{chunk-GZ4X53ZA.js → chunk-FYS5VIOG.js} +2 -2
- package/dist/{chunk-HFCDUFV3.js → chunk-GC5U55MW.js} +1 -1
- package/dist/{chunk-RY6TFVAX.js → chunk-GELPKSLC.js} +1 -1
- package/dist/{chunk-5S46D5AJ.js → chunk-IGJIDN4U.js} +1 -1
- package/dist/{chunk-K2QV7FGP.js → chunk-INK66XQS.js} +1 -1
- package/dist/{chunk-EFRJNPBZ.js → chunk-IWM5EZC3.js} +2 -2
- package/dist/chunk-JCD6FP7A.js +5 -0
- package/dist/{chunk-M335FQYJ.js → chunk-JN44V63O.js} +2 -2
- package/dist/{chunk-GYF4CH62.js → chunk-KDXQNLVV.js} +2 -2
- package/dist/{chunk-O3AY6JHJ.js → chunk-KLTKEGDH.js} +1 -1
- package/dist/{chunk-MJ56GUKS.js → chunk-KQ2MYMOS.js} +1 -1
- package/dist/chunk-LN7233E2.js +20 -0
- package/dist/{chunk-KWKUMBHS.js → chunk-MKSTP2XN.js} +2 -2
- package/dist/{chunk-NHOHQBIF.js → chunk-NT3UETTV.js} +1 -1
- package/dist/{chunk-CCUGKBIH.js → chunk-OFW3ZVTP.js} +1 -1
- package/dist/{chunk-WLOGO44E.js → chunk-OYJBABRV.js} +1 -1
- package/dist/{chunk-JJWQUQJ2.js → chunk-P3RKXL3V.js} +1 -1
- package/dist/{chunk-MUGMUKSZ.js → chunk-PT7V5WDQ.js} +1 -1
- package/dist/chunk-Q4V2GK5U.js +2 -0
- package/dist/{chunk-3AJ3QSF5.js → chunk-QBG7XEGQ.js} +2 -2
- package/dist/{chunk-E3BXNQYE.js → chunk-QISE272H.js} +1 -1
- package/dist/{chunk-G4AFOZKU.js → chunk-QQAAPFIR.js} +1 -1
- package/dist/{chunk-PQUMOFT5.js → chunk-RDNKYRKY.js} +1 -1
- package/dist/{chunk-5NSYHRDN.js → chunk-RX5TZZNQ.js} +1 -1
- package/dist/{chunk-TJZMYU2W.js → chunk-RZLD7TPG.js} +1 -1
- package/dist/{chunk-66BSTNLD.js → chunk-S66MCU2Y.js} +1 -1
- package/dist/{chunk-WYST42WI.js → chunk-SORVX3KI.js} +1 -1
- package/dist/{chunk-KX2GOJ4C.js → chunk-SQC4P2Q7.js} +1 -1
- package/dist/{chunk-JRQKUQWL.js → chunk-SQGBFCFO.js} +1 -1
- package/dist/{chunk-T5LKD2OB.js → chunk-SS5TOK2J.js} +1 -1
- package/dist/{chunk-DJ7T7BMV.js → chunk-TDS6LG6T.js} +1 -1
- package/dist/{chunk-7JUUNZQP.js → chunk-TKYJTXWL.js} +1 -1
- package/dist/{chunk-JN2DP4R2.js → chunk-TQKIE7AX.js} +1 -1
- package/dist/{chunk-K7UYWAZH.js → chunk-TZFT7R7B.js} +1 -1
- package/dist/{chunk-AMULIFC5.js → chunk-USI2WMAK.js} +1 -1
- package/dist/{chunk-NYSMQ7UY.js → chunk-VMCSRLRC.js} +1 -1
- package/dist/{chunk-7PADFQ5S.js → chunk-VOBXYDJW.js} +2 -2
- package/dist/{chunk-R7OGNE3W.js → chunk-WMQJBEQP.js} +1 -1
- package/dist/{chunk-OWTEHU6B.js → chunk-XJILZ2WN.js} +1 -1
- package/dist/{chunk-2K2BX23I.js → chunk-XQFITNA3.js} +1 -1
- package/dist/{chunk-4D3DNCQY.js → chunk-XY325HDJ.js} +1 -1
- package/dist/{chunk-Q6JHBDW2.js → chunk-YEQVJWEF.js} +1 -1
- package/dist/{chunk-6BTZ2Q4P.js → chunk-YHTYPTDD.js} +1 -1
- package/dist/{chunk-2WSOPZJU.js → chunk-YZ45OEH3.js} +1 -1
- package/dist/{chunk-BJHII5SD.js → chunk-Z35BUPZT.js} +1 -1
- package/dist/{chunk-4UMQDH52.js → chunk-ZLSWHCWO.js} +1 -1
- package/dist/{chunk-FDWEL5HR.js → chunk-ZRKPZLLG.js} +1 -1
- package/dist/{config-OKTAPFOT.js → config-6TQIMTNB.js} +1 -1
- package/dist/{credentials-SO3DSQEM.js → credentials-ZSNM4BTD.js} +1 -1
- package/dist/{deps-bundle-FRM65BQO.js → deps-bundle-D2ZC2SPT.js} +1 -1
- package/dist/{deps-resolve-RPZORKUN.js → deps-resolve-VRBMFUTX.js} +1 -1
- package/dist/{dispatch-OZRMWY25.js → dispatch-2PBSJ7YW.js} +1 -1
- package/dist/doctor-OWRRDA4Z.js +2 -0
- package/dist/{evidence-5AUZMKE3.js → evidence-NDAKCCHQ.js} +1 -1
- package/dist/{evolve-cmd-TWYJL4EG.js → evolve-cmd-DIA5EWUT.js} +1 -1
- package/dist/{extract-bind-EW7XUDLQ.js → extract-bind-TJ2STXV5.js} +2 -2
- package/dist/{extract-cmd-HOVGMBGM.js → extract-cmd-FLOYO6HL.js} +1 -1
- package/dist/{generate-headless-FYTJULPG.js → generate-headless-DBT4MKQT.js} +2 -2
- package/dist/index.js +69 -69
- package/dist/{ingest-4447MYLF.js → ingest-JO5NJENZ.js} +1 -1
- package/dist/{ingest-cmd-RJLTFNMN.js → ingest-cmd-T6HM3AHK.js} +1 -1
- package/dist/install-NIVU4XVS.js +2 -0
- package/dist/{interactive-bind-PSEYAL54.js → interactive-bind-7UDJY4CF.js} +3 -3
- package/dist/{list-commands-2SVSEAP6.js → list-commands-DA4ZXOPJ.js} +1 -1
- package/dist/login-flow-NHBJVDW6.js +2 -0
- package/dist/{mobile-prompts-T6HZ2YLY.js → mobile-prompts-JS7GPVKS.js} +1 -1
- package/dist/{persist-recorded-session-O2NCYTSD.js → persist-recorded-session-LE3LGFOS.js} +1 -1
- package/dist/pipeline-MTAZDCZR.js +2 -0
- package/dist/prepare-target-YK2DLDWB.js +2 -0
- package/dist/{reconcile-cmd-FU3JIHTO.js → reconcile-cmd-CYRYVS5B.js} +1 -1
- package/dist/{reconcile-deps-SUKZA2FL.js → reconcile-deps-FYXRAMF2.js} +2 -2
- package/dist/{reconcile-engine-ILL4M3NW.js → reconcile-engine-6AT6EVGS.js} +1 -1
- package/dist/{recording-banner-5VXVKCV4.js → recording-banner-YMKWR3M3.js} +1 -1
- package/dist/{registry-BKV3EDTK.js → registry-V45ZQ6Q5.js} +1 -1
- package/dist/{require-project-folder-2IO6IX5W.js → require-project-folder-3KS7KTME.js} +1 -1
- package/dist/resolve-run-intent-W32G6WM6.js +2 -0
- package/dist/{resolver-CBTWTZZR.js → resolver-V5VP5FLT.js} +1 -1
- package/dist/{run-EXIYK6PU.js → run-26IR3CKX.js} +1 -1
- package/dist/{run-R7GND73C.js → run-5IYI2TJI.js} +1 -1
- package/dist/{run-test-md-664ASWRQ.js → run-test-md-FO2RNNOD.js} +2 -2
- package/dist/{skill-installer-QLQK4JJE.js → skill-installer-W4TT5MST.js} +1 -1
- package/dist/{spawner-ANLF7OX3.js → spawner-ZSYJQGQW.js} +1 -1
- package/dist/tcg-generate-ONLV5GXG.js +2 -0
- package/dist/{testmd-actions-QZD3N4EH.js → testmd-actions-NPILETCQ.js} +1 -1
- package/dist/token-refresh-G2CSTY4B.js +2 -0
- package/dist/{types-VYEOJ6U2.js → types-O23GN2YM.js} +1 -1
- package/dist/{validate-basic-D7IJUFUQ.js → validate-basic-727KRHX6.js} +1 -1
- package/dist/{verdicts-EO5TZ5BW.js → verdicts-TDJLJJ3F.js} +1 -1
- package/dist/{version-check-JRLPWQ6T.js → version-check-A2JQYRI2.js} +1 -1
- package/dist/{walk-session-IODOH7QU.js → walk-session-HB3OOWVR.js} +1 -1
- package/dist/{with-telemetry-ASNQQBGP.js → with-telemetry-HSD6CXDS.js} +1 -1
- package/package.json +11 -11
- package/dist/FolderPicker-5U3RHHBE.js +0 -2
- package/dist/SingleShotApp-XWOPGLKZ.js +0 -2
- package/dist/TestMdRunView-6BY3IUH5.js +0 -2
- package/dist/bridge-LOBTHY3P.js +0 -2
- package/dist/chunk-6DTWVLSJ.js +0 -4
- package/dist/chunk-BG66IAO6.js +0 -19
- package/dist/chunk-BVKDHHPK.js +0 -5
- package/dist/chunk-KBMQGNKO.js +0 -26
- package/dist/chunk-UOMRMCMI.js +0 -2
- package/dist/chunk-VT2XNEOD.js +0 -10
- package/dist/chunk-X2FM67OM.js +0 -4
- package/dist/doctor-VWGEQYBB.js +0 -2
- package/dist/install-46S4VOZ4.js +0 -2
- package/dist/login-flow-U43QVFPH.js +0 -2
- package/dist/pipeline-BHEA7ODT.js +0 -2
- package/dist/prepare-target-27UN4KNO.js +0 -2
- package/dist/resolve-run-intent-ZML3HKG7.js +0 -2
- package/dist/tcg-generate-VBC5ODDI.js +0 -2
- package/dist/token-refresh-PIUX5OFA.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as B,c as S,d as T}from"./chunk-
|
|
2
|
+
import{b as B,c as S,d as T}from"./chunk-RZLD7TPG.js";import{c as g}from"./chunk-RFHMDQXZ.js";import{a as E}from"./chunk-RDNKYRKY.js";import{x as n}from"./chunk-OFW3ZVTP.js";import{a as h}from"./chunk-HCBYKLMW.js";import{a as i,b as c,c as w,i as x}from"./chunk-C44QQJR4.js";import{a as L}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var l=u(L(),1);var r=u(h(),1);function y(e){return new Map(e.map((o,s)=>[`${s}-${o.label}`,o.packPath]))}async function H(e){let o=e.deps?.viewerBase??S(e.env),s=e.deps?.startServer??B,a=e.deps?.openUrl??(m=>g(m).then(()=>{})),t=y(e.rows),d;try{d=await s({packs:t,allowedOrigins:[new URL(o).origin]});let m=d,D=async p=>{let v=[...t.keys()][p];await a(T(m.urlFor(v),o))};if(e.deps?.hold){await e.deps.hold();return}await new Promise(p=>{let v=w(l.default.createElement(P,{rows:e.rows,onOpen:D,onDone:()=>{v.unmount(),p()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}finally{await d?.close()}}function I(e){return e==="passed"?n.green:e==="failed"||e==="broken"||e==="cancelled"?n.red:n.dim}var b=40,R=9,k=20;function f(e,o){return e.length>o?e.slice(0,o-1)+"\u2026":e.padEnd(o)}function O({row:e,selected:o}){let s=e.testId??e.commitId??"";return(0,r.jsxs)(i,{children:[(0,r.jsx)(i,{width:2,flexShrink:0,children:(0,r.jsx)(c,{color:n.orange,children:o?"\u25B8":" "})}),(0,r.jsx)(i,{width:2,flexShrink:0,children:(0,r.jsx)(c,{color:e.kind==="execution"?n.orange:n.muted,children:e.kind==="execution"?"\u25CF":"\u25CB"})}),(0,r.jsx)(i,{width:b,flexShrink:0,children:(0,r.jsx)(c,{color:o?n.orange:void 0,bold:o,wrap:"truncate-end",children:f(e.label,b)})}),(0,r.jsx)(i,{width:R,flexShrink:0,children:(0,r.jsx)(c,{color:I(e.status),bold:o,wrap:"truncate-end",children:f(e.status,R)})}),(0,r.jsx)(i,{width:k,flexShrink:0,children:(0,r.jsx)(c,{color:n.dim,wrap:"truncate-end",children:f(s,k)})})]})}function P(e){let[o,s]=(0,l.useState)(0);return x((a,t)=>{t.upArrow?s(d=>Math.max(0,d-1)):t.downArrow?s(d=>Math.min(e.rows.length-1,d+1)):t.return||a==="o"?e.onOpen(o):(a==="q"||t.escape)&&e.onDone()}),(0,r.jsx)(E,{title:"Evidence",borderColor:n.muted,children:(0,r.jsxs)(i,{flexDirection:"column",children:[e.rows.map((a,t)=>(0,r.jsx)(O,{row:a,selected:t===o},t)),(0,r.jsx)(i,{marginTop:1,children:(0,r.jsx)(c,{color:n.dim,children:"\u2191/\u2193 move \xB7 enter/o open \xB7 q quit"})})]})})}export{y as a,H as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Y,b as Z,c as nn,d as en,e as tn}from"./chunk-
|
|
2
|
+
import{a as Y,b as Z,c as nn,d as en,e as tn}from"./chunk-USI2WMAK.js";import{b as rn,c as sn}from"./chunk-P7YZ3PU3.js";import{m as X,o as P}from"./chunk-56PAQAX5.js";import{a as jn}from"./chunk-6YGTRKDT.js";import{e as Pn}from"./chunk-UR6MHSHU.js";function on(i){return{command:"start",...i}}function an(i,e,o){return{command:"run",run_id:i,kind:e,...o}}function un(i){return{command:"cancel",...i?{run_id:i}:{}}}function dn(i){return{command:"ask_user_response",answer:i}}function ln(){return{command:"shutdown"}}var z=Symbol("run-queue-end"),G=class{items=[];waiting=null;ended=!1;error=null;push(e){if(this.waiting){let{resolve:o}=this.waiting;this.waiting=null,o(e)}else this.items.push(e)}end(){if(this.ended=!0,this.waiting){let{resolve:e}=this.waiting;this.waiting=null,e(z)}}fail(e){if(this.error=e,this.waiting){let{reject:o}=this.waiting;this.waiting=null,o(e)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(z):new Promise((e,o)=>{this.waiting={resolve:e,reject:o}})}},D=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;exited;constructor(e){this.env=e.env,this.runner=e.runner,this.log=e.log,this.sessionId=e.sessionId,this.spawnFn=e.spawn??Z;let o;this.exited=new Promise(c=>{o=c}),this.exitResolve=o}async start(e){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let o=new Promise((c,g)=>{this.pendingReady={resolve:c,reject:g}});this.writeCommand(on(e)),await o}async*run(e,o,c){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${e}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new G,w={runId:e,queue:g};this.activeRun=w,this.writeCommand(an(e,o,c));try{for(;;){let v=await g.next();if(v===z||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===e)))break}}finally{this.activeRun===w&&(this.activeRun=null)}}sendUserResponse(e){this.writeCommand(dn(e))}cancel(e){this.writeCommand(un(e))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(){this.shuttingDown=!0,this.proc&&(this.writeCommand(ln()),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(e){let o=JSON.stringify(e)+`
|
|
3
3
|
`;try{this.proc?.child.stdin?.write(o)}catch{}}async consume(){if(!this.proc)return;try{for await(let c of this.proc.events){if(c.type==="ready"){this.onReady();continue}this.routeEvent(c)}}catch(c){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:c instanceof Error?c.message:String(c)})}let{code:e,signal:o}=await this.proc.exited;this.onExit(e,o)}onReady(){if(this.pendingReady){let{resolve:e}=this.pendingReady;this.pendingReady=null,e()}}routeEvent(e){let o=this.activeRun;if(!o){this.log?.("warn","PERSISTENT_RUNNER_ORPHAN_EVENT","Runner event with no active run",{event_type:e.type});return}o.queue.push(e)}onExit(e,o){if(!this.finalized){if(this.finalized=!0,this.exitInfo={code:e,signal:o},this.shuttingDown||(this.exitedUnexpectedly=!0),this.exitResolve({code:e,signal:o}),this.pendingReady){let{reject:c}=this.pendingReady;this.pendingReady=null,c(new Error(`v16-runner exited before ready (code=${e}, signal=${o??"none"})`))}if(this.activeRun){let{queue:c}=this.activeRun;if(this.activeRun=null,this.shuttingDown)c.end();else{let g=this.proc?.getStderr()?.slice(-500)??"";c.fail(new Error(`v16-runner exited unexpectedly mid-run (code=${e}, signal=${o??"none"})${g?`
|
|
4
4
|
${g}`:""}`))}}}}};var p=Pn(jn(),1);function cn(i){let e={cdp_endpoint:i.cdp_endpoint,ws_endpoint:i.ws_endpoint,width:i.width,height:i.height,headless:i.headless,model:i.model,max_steps:i.max_steps,network_ws:i.network_ws,network_sse:i.network_sse,session_id:i.session_id};return i.device&&(e.device=i.device),i.auth&&(e.auth=i.auth),i.username&&(e.username=i.username),i.access_key&&(e.access_key=i.access_key),e}function j(i,e){let o=null,c=(g,w)=>{for(let v=0;v<g.length;v++){let b=g[v],h=[...w,v];e(b)&&(o===null||h.length>o.length)&&(o=h),b.children&&b.children.length>0&&c(b.children,h)}};return c(i,[]),o}function N(i,e,o){if(e.length===0)return[...i];let c=e[0],g=[...i],w=g[c];if(e.length===1)g[c]=o(w);else{let v=e.slice(1),b=N(w.children??[],v,o);g[c]={...w,children:b}}return g}function pn(){return{steps:[],maxOrdinal:0}}function Nn(i,e){if(e.type==="run_start"&&e.child_id)return e.environment?.resolution?{...i,resolution:e.environment.resolution}:i;if(e.type==="run_start"){let o=sn(i.runnerEnvironment,rn(e.environment));if(o)return{...i,runnerEnvironment:o,...o.resolution?{resolution:o.resolution}:{}}}if(e.type==="step_end"&&typeof e.ordinal=="number"&&e.id){let o={id:e.id,ordinal:e.ordinal,status:e.status,...e.kind?{kind:e.kind}:{},...typeof e.duration=="number"?{duration_ms:Math.round(e.duration*1e3)}:{},...typeof e.action_id=="string"&&e.action_id?{action_id:e.action_id}:{}};return{...i,steps:[...i.steps,o],maxOrdinal:Math.max(i.maxOrdinal,e.ordinal)}}return i}function V(i){let e=i.indexOf(": ");return e>0&&e<15?i.slice(e+2):i}function W(i){return i.map(e=>{let o=e.children?W(e.children):e.children;return e.status==="running"?{...e,status:"stopped",phase:void 0,children:o}:o!==e.children?{...e,children:o}:e})}function Gn(i,e,o,c,g){let[w,v]=(0,p.useState)(!1),[b,h]=(0,p.useState)([]),[hn,T]=(0,p.useState)(null),[fn,B]=(0,p.useState)(null),[mn,I]=(0,p.useState)(null),[vn,J]=(0,p.useState)(null),[gn,H]=(0,p.useState)([]),[Rn,K]=(0,p.useState)(null),[Sn,yn]=(0,p.useState)(void 0),[wn,$]=(0,p.useState)(0),y=(0,p.useRef)(null),E=(0,p.useRef)(null),S=(0,p.useRef)(null),_=(0,p.useRef)(0),F=(0,p.useRef)(!1),U=(0,p.useRef)(pn()),O=(0,p.useRef)(null),xn=(0,p.useCallback)(async(m,x)=>{let Q=O.current;if(Q)try{await Q}catch{}h([]),T(null),B(null),I(null),J(null),H([]),K(null),yn(m.max_steps),v(!0),S.current=null,_.current=0,U.current=pn();let k=y.current;if(k&&E.current!==m.session_id){try{k.kill()}catch{}y.current=null,E.current=null,$(n=>n+1),k=null}if(!k){let n=Y();if(!n){I("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available."),v(!1);return}let d=en({environment:x?.environment,mode:x?.mode,assertionMode:x?.assertionMode,finalValidation:x?.finalValidation,username:m.username,accessKey:m.access_key,sessionId:m.session_id});m.device?.platform&&await nn(d,m.device);let u=new D({env:d,runner:n,log:x?.log,sessionId:m.session_id});y.current=u,E.current=m.session_id,k=u,X("runner",()=>{try{u.kill()}catch{}});let s=cn(m);try{await u.start(s)}catch(a){I(a instanceof Error?a.message:String(a)),v(!1),P("runner","Runner start failed"),y.current=null,E.current=null,$(t=>t+1);return}}let M={...m};delete M.run_id,tn(M,{environment:x?.environment});let kn=`run-${m.run_index}`,Cn=m.mode==="replay"?"replay":"author",L=k,q=(async()=>{F.current=!1;for await(let n of L.run(kn,Cn,M)){if(F.current)break;switch(U.current=Nn(U.current,n),n.type){case"run_start":if(n.child_id)break;if(S.current&&!S.current.isSingleFlow){let d=_.current;_.current++,h(u=>u.map((s,a)=>a===d?{...s,status:"running"}:s.status==="running"&&!s.children?.some(t=>t.status==="running")?{...s,status:s.children?.some(t=>t.status==="failed")?"failed":"passed"}:s))}break;case"bifurcation":{let d=n.flows??[],u=n.count??d.length,s={flows:d,isSingleFlow:n.is_single_flow??u<=1};J(s),S.current=s,_.current=0,h(d.map((a,t)=>({index:t+1,objective:a??`Flow ${t+1}`,status:"pending"})));break}case"step_start":{e?.("STEP_START",`Step ${n.index} started`,{index:n.index,objective:n.objective,child_id:n.child_id});let d=n.index,u=n.objective??`Step ${d}`,s=n.child_id,a=S.current&&!S.current.isSingleFlow;if(s)h(t=>{let r=j(t,l=>l.branchChildId===s)??j(t,l=>l.status==="running");return r?N(t,r,l=>{let f=(l.children??[]).map(R=>R.status==="running"&&R.childId===s?{...R,status:"stopped",phase:void 0}:R);return f.push({index:d,objective:u,status:"running",childId:s}),{...l,children:f}}):t});else if(a){let t=Math.max(0,_.current-1);h(r=>{let l=[...r];if(t>=l.length)return r;let f={...l[t]},C=[...f.children??[]].map(A=>A.status==="running"&&A.childId===void 0?{...A,status:"stopped",phase:void 0}:A);return C.push({index:d,objective:u,status:"running"}),f.children=C,f.status="running",l[t]=f,l})}else h(t=>{let r=W(t);return r.some(f=>f.index===d)?r.map(f=>f.index===d?{...f,status:"running",objective:u}:f):[...r,{index:d,objective:u,status:"running"}]});break}case"step_event":{e?.("STEP_EVENT",`Step ${n.index} ${n.event}`,{index:n.index,phase:n.event,action_type:n.action_type,detail:n.detail,child_id:n.child_id});let d=n.child_id,u=S.current&&!S.current.isSingleFlow;if(n.event==="cm_init"&&n.checkpoint_count!=null){H(s=>[...s,n.checkpoint_count]);break}if(n.event==="replay_started"){K({recordingLength:n.recording_length??0});break}if(n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&o?.(n.detail),d){let s=t=>{if(t.index!==n.index||t.childId!==d)return t;let r={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(r.objective=n.detail),n.action_type&&(r.actionType=n.action_type),{...t,...r}},a=t=>t.map(r=>{let l=s(r);return l!==r?l:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let s=Math.max(0,_.current-1);h(a=>{let t=[...a];if(s>=t.length)return a;let r={...t[s]},l=[...r.children??[]];if(!l.some(R=>R.index===n.index&&R.childId===void 0))l.push({index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type});else for(let R=0;R<l.length;R++){if(l[R].index!==n.index||l[R].childId!==void 0)continue;let C={phase:n.event};n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(C.objective=n.detail),n.action_type&&(C.actionType=n.action_type),l[R]={...l[R],...C}}return r.children=l,t[s]=r,t})}else h(s=>s.some(t=>t.index===n.index)?s.map(t=>{if(t.index!==n.index)return t;let r={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(r.objective=n.detail),n.action_type&&(r.actionType=n.action_type),{...t,...r}}):[...W(s),{index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type}]);break}case"step_end":{e?.("STEP_END",`Step ${n.index} ${n.status}`,{index:n.index,status:n.status,duration:n.duration,summary:n.summary,child_id:n.child_id}),c?.();let d=n.child_id,u=S.current&&!S.current.isSingleFlow;if(d){let s=t=>t.index===n.index&&t.childId===d?{...t,status:n.status,duration:n.duration,phase:void 0,objective:t.objective.startsWith("Step ")?V(n.summary||t.objective):t.objective}:t,a=t=>t.map(r=>{let l=s(r);return l!==r?l:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let s=Math.max(0,_.current-1);h(a=>{let t=[...a];if(s>=t.length)return a;let r={...t[s]},l=(r.children??[]).map(f=>f.index===n.index&&f.childId===void 0?{...f,status:n.status,duration:n.duration,phase:void 0,objective:f.objective.startsWith("Step ")?V(n.summary||f.objective):f.objective}:f);return r.children=l,t[s]=r,t})}else h(s=>s.map(a=>a.index===n.index?{...a,status:n.status,duration:n.duration,phase:void 0,objective:a.objective.startsWith("Step ")?V(n.summary||a.objective):a.objective}:a));{let a=S.current&&!S.current.isSingleFlow?Math.max(0,_.current-1):0,t=typeof n.ordinal=="number"&&n.id?{ordinal:n.ordinal,id:n.id}:void 0;i?.(n.index,a,n.child_id,t)}break}case"child_agent_start":{let d=n.objective??"",u=n.child_id;h(s=>{let a=j(s,t=>t.status==="running");return a?N(s,a,t=>({...t,objective:`${d} (branch)`,phase:`child: ${d.slice(0,50)}`,branchObjective:d,branchChildId:u})):s});break}case"child_agent_end":{let d=n.child_id,u=`child ${n.success?"done":"failed"}`;h(s=>{let a=j(s,t=>t.branchChildId===d);return a?N(s,a,t=>({...t,phase:u})):s.map(t=>t.phase?.startsWith("child:")?{...t,phase:u}:t)});break}case"describe_trigger":g?.(n);break;case"ask_user":T(n.question??"");break;case"run_end":h(d=>d.map(u=>u.status==="running"?{...u,status:n.status,phase:void 0}:u)),v(!1),B(n);break;case"error":v(!1),I(n.message??"Runner error"),h(d=>d.map(u=>u.status==="running"?{...u,status:"failed",phase:void 0}:u));break}}})().catch(n=>{if(y.current!==L)return;let u=[n instanceof Error?n.message:String(n)],s=L.stderr;s&&!u.join(`
|
|
5
5
|
`).includes(s)&&u.push(s),I(u.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as Y,f as q,h as H}from"./chunk-
|
|
2
|
+
import{d as Y,f as q,h as H}from"./chunk-SQC4P2Q7.js";import{a as O,b as j,c as z}from"./chunk-FMUCZWS3.js";import{d as B,f as R}from"./chunk-LN7233E2.js";import{b as _,c as N,j as M}from"./chunk-DN3E6RT6.js";import{a as L}from"./chunk-TZXXJWHA.js";import{m as b}from"./chunk-56PAQAX5.js";import{a as G,b as C,c as K}from"./chunk-XY325HDJ.js";import{h as J}from"./chunk-TAOHYWEO.js";import{a as F,b as $}from"./chunk-Q4V2GK5U.js";import{b as E}from"./chunk-OFW3ZVTP.js";import{createHash as be}from"crypto";import{readdir as Ce,stat as Te}from"fs/promises";import{basename as f,extname as Ie,join as Ae,relative as ke}from"path";import{createHash as de}from"crypto";import{createReadStream as le}from"fs";import{mkdir as ce,readFile as ue,rename as fe,writeFile as ge}from"fs/promises";import{dirname as me,join as he}from"path";var we=60,ve=5;function V(){return{entries:[]}}function X(){return he(E,"mobile","app-cache.json")}async function T(e){let r=de("sha256");for await(let t of le(e))r.update(t);return r.digest("hex")}function ye(){return{readFile:e=>ue(e,"utf8"),writeFile:async(e,r)=>{await ce(me(e),{recursive:!0});let t=`${e}.tmp`;await ge(t,r),await fe(t,e)},hashFile:T,now:()=>new Date}}function I(e){if(!e)return;let r=/\/(\d{4})\/(\d{2})\/(\d{2})\//.exec(e);if(!r)return;let[,t,a,s]=r,n=new Date(`${t}-${a}-${s}T00:00:00Z`);return Number.isNaN(n.getTime())?void 0:n.toISOString()}function Pe(e,r){if(!e.storedAt)return!0;let t=new Date(e.storedAt).getTime();return Number.isNaN(t)?!0:(r.getTime()-t)/864e5>=we-ve}var u=class{deps;constructor(r={}){this.deps={...ye(),...r}}async read(){try{let r=JSON.parse(await this.deps.readFile(X()));if(!r||typeof r!="object")return V();let t=r;return{entries:Array.isArray(t.entries)?t.entries:[]}}catch{return V()}}async write(r){await this.deps.writeFile(X(),JSON.stringify(r,null,2))}async hashOf(r){return this.deps.hashFile(r)}async lookup(r){return(await this.read()).entries.find(a=>a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)}async remember(r){let t=await this.read();t.entries=[...t.entries.filter(a=>!(a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)),r],await this.write(t)}async forget(r){let t=await this.read(),a=t.entries.length;t.entries=t.entries.filter(s=>!(s.sha256===r.sha256&&s.env===r.env&&s.orgId===r.orgId&&s.type===r.type)),t.entries.length!==a&&await this.write(t)}isNearExpiry(r){return Pe(r,this.deps.now())}};var Z={emulator:[".apk"],simulator:[".zip"]};function Q(e){return e.skipped===!0}function De(e,r){let t=Ie(e).toLowerCase();return t===".ipa"?`${f(e)} is a device build \u2014 .ipa is not accepted for ${r} runs.`:Z[r].includes(t)?null:`${f(e)} cannot be uploaded for a ${r} run \u2014 expected one of ${Z[r].join(", ")}.`}async function A(e,r){if(!(await Te(e)).isDirectory())return r.hashOf(e);let a=[],s=async i=>{for(let o of await Ce(i,{withFileTypes:!0})){let p=Ae(i,o.name);o.isDirectory()?await s(p):o.isFile()&&a.push(p)}};await s(e),a.sort();let n=be("sha256");for(let i of a)n.update(ke(e,i)),n.update("\0"),n.update(await T(i)),n.update("\0");return n.digest("hex")}async function W(e){let r=De(e.path,e.type);if(r)return{skipped:!0,reason:r};let t=e.cache??new u,a=e.client??new J(e.baseUrl,{...e.auth,orgId:e.orgId}),s;try{s=await A(e.path,t)}catch(o){return{skipped:!0,reason:`could not read ${f(e.path)}: ${o.message}`}}let n={sha256:s,env:e.env,orgId:e.orgId,type:e.type},i=await t.lookup(n);if(i){if(await a.liveness(i.appId)!=="gone")return{appId:i.appId,...i.appUrl?{appUrl:i.appUrl}:{},fromCache:!0};e.onProgress?.(`${i.appId} is no longer in the cloud \u2014 uploading again`),await t.forget(n)}try{e.onProgress?.(`uploading ${f(e.path)}\u2026`);let o=await a.upload(e.path,e.type);return await t.remember({sha256:s,env:e.env,orgId:e.orgId,type:e.type,appId:o.appId,...o.appUrl?{appUrl:o.appUrl}:{},...I(o.url)?{storedAt:I(o.url)}:{},sourcePath:e.path}),e.onProgress?.(o.cached?`${f(e.path)} already in the cloud (${o.appId})`:`${f(e.path)} uploaded (${o.appId})`),{appId:o.appId,...o.appUrl?{appUrl:o.appUrl}:{},fromCache:!1}}catch(o){return{skipped:!0,reason:o.message}}}function h(e){return`${e.platform}|${F(e)}`}var g=new Map,ee=new Set;function re(e){return ee.has(h(e))}function We(e,r,t){r.state==="stopped"&&(g.has(h(r))||ae(e,r,t))}async function te(e,r,t){let a=g.get(h(r));return a?(t?.(`waiting for ${r.displayName} to finish booting\u2026`),a):ae(e,r,t)}function ae(e,r,t){let a=h(r),s=e.prepare(r,t);g.set(a,s),r.state==="stopped"&&s.then(()=>ee.add(a),()=>{});let n=()=>{g.get(a)===s&&g.delete(a)};return s.then(n,n),s.catch(()=>{}),s}import{basename as xe}from"path";import{spawnSync as Ue}from"child_process";async function Se(e,r,t){if(!e.teardownPlan||!t.appPackage&&!t.shutdown)return;let a;try{a=await e.teardownPlan(r,t)}catch{return}a.length!==0&&b(`device:${r.id}`,()=>{Y({udid:r.id,displayName:r.displayName});for(let s of a)try{Ue(s.file,s.args,{timeout:3e4,stdio:"ignore"})}catch{}})}var oe={emulator:[".apk"],simulator:[".zip"]};async function Ee(e,r,t,a){if(e.kind==="package")return e;if(e.kind==="app_id"){let s=r.cloudUpload;if(!s)throw new Error(`${e.value} is an app id, which needs an account to download it. Log in, or pass a path to a local build instead.`);let n=await K({appId:e.value,baseUrl:s.baseUrl,auth:s.auth,...oe[t]?{accepts:oe[t]}:{},...a?{onProgress:a}:{}}),i=D(n.path);if(!i||i.kind==="app_id")throw new Error(`${n.name} is not a build this CLI can install (from ${e.value}).`);return i}try{let s=new u,n=await A(e.value,s),i=new G;await i.find(n)||a?.(`copying ${xe(e.value)} into the local app store\u2026`);let p=await i.put({key:n,sourcePath:e.value,source:"local"});return{...e,value:p.path}}catch{return e}}function Fe(e){b(`appium:${e}`,()=>{H({deviceClass:e,owner:process.pid})})}var k=class extends Error{constructor(r){super(r),this.name="MobileHostUnsupportedError"}},w=class extends Error{constructor(t,a){super(t);this.doctorText=a;this.name="MobilePreflightError"}};async function $e(e,r,t){let a=t.cloudUpload,s=await W({path:e,type:r,env:a.env,orgId:a.orgId,userId:a.userId,auth:a.auth,baseUrl:a.baseUrl,...t.onProgress?{onProgress:t.onProgress}:{}});if(Q(s)){t.onProgress?.(`app not uploaded \u2014 ${s.reason}`);return}return s.appId}var _e="app must be a build (.apk for an emulator, .zip of the .app bundle for a simulator) or an app id from your cloud uploads \u2014 a package id names something already installed on one device, so it cannot be uploaded, exported as code, or run anywhere else.",se=/\.(apk|zip)$/i;function D(e){let r=e.trim();if(C(r))return{kind:"app_id",value:r};let t=se.exec(r)?.[1]?.toLowerCase();return t?{kind:t,value:r}:null}function Ne(e){return!!e&&(se.test(e)||C(e.trim()))}function Me(e){return e.filter(r=>r.required&&r.status==="fail")}function Be(e,r){return!!r&&e.platform===r.platform&&e.kind===r.kind&&(e.id===r.id||e.virtualName===r.id)}async function mr(e){let r=L();if(!r.supported)throw new k(r.reason);let t=e.appiumUrl??e.defaults?.appium_url,a=!!(e.agent||!e.interactive),s=M();a&&e.platform?.toLowerCase()!=="ios"&&((await s.status("emulator")).installed||await s.ensure("emulator",{automatic:!0,onProgress:e.onProgress}));let n=await O(e.platform,{appiumUrl:t});if(z(n)){let d=n.sections.flatMap(P=>Me(P.checks)).map(P=>P.label).join(", ");throw new w(`Mobile toolchain not ready (${d}). Run \`kane-cli doctor --target ${e.platform?.toLowerCase()==="ios"?"simulator":e.platform?.toLowerCase()==="android"?"emulator":"<emulator|simulator>"}\` for details.`,j(n))}let i=await R({device:e.device,platform:e.platform,defaultTarget:e.defaults?.default_target,interactive:e.interactive}),o;if(i.ok)o=i.target;else if(i.reason==="needs-picker"&&e.pickTarget){let d=await e.pickTarget(i.candidates);if(!d)throw new Error("Target selection cancelled");o=d}else throw new Error(i.message);let p=B(o.platform);if(!p)throw new Error(`No provider for platform "${o.platform}"`);let l=_(o);if(!l)throw new Error(`No managed dependencies serve ${o.platform} ${o.kind} targets yet.`);try{await s.ensure(l,{automatic:a,onProgress:e.onProgress})}catch(d){throw d instanceof N?new w(d.message,d.message):d}let ie=o.state!=="ready"||re(o);o=await te(p,o,e.onProgress);let ne=await q(l,{...t?{appiumUrl:t}:{},device:{udid:o.id,displayName:o.displayName},onProgress:e.onProgress});Fe(l);let x=Be(o,e.defaults?.default_target)?e.defaults?.default_app:void 0,m=e.app??(Ne(x)?x:void 0);if(e.app&&!D(e.app))throw new Error(`${e.app}: ${_e}`);let c=m?D(m):null,U=c?await Ee(c,e,l,e.onProgress):null,v=U?await p.ensureApp(o,U,e.onProgress):void 0,y=c?.kind==="app_id"?c.value:e.cloudUpload&&c&&m?await $e(c.value,l,e):void 0;await Se(p,o,{shutdown:ie,...v?{appPackage:v}:{}});let pe=$(o,v,{noReset:e.noReset??e.defaults?.no_reset,appiumUrl:ne.url,autoGrantPermissions:e.defaults?.auto_grant_permissions,autoAcceptAlerts:e.defaults?.auto_accept_alerts}),S=y??m;return{device:pe,target:o,provider:p,...y?{appId:y}:{},...S?{appRef:S}:{}}}export{We as a,te as b,k as c,w as d,_e as e,D as f,Ne as g,mr as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{h as w}from"./chunk-TAOHYWEO.js";import{a as h}from"./chunk-RZ4F3BHX.js";import{b as f}from"./chunk-
|
|
2
|
+
import{h as w}from"./chunk-TAOHYWEO.js";import{a as h}from"./chunk-RZ4F3BHX.js";import{b as f}from"./chunk-OFW3ZVTP.js";import{mkdtemp as O,rm as $}from"fs/promises";import{createWriteStream as R}from"fs";import{Readable as U}from"stream";import{pipeline as F}from"stream/promises";import{tmpdir as T}from"os";import{basename as z,join as A}from"path";import{access as x,cp as P,mkdir as g,readdir as y,readFile as S,rename as I,rm as k,stat as b,writeFile as v}from"fs/promises";import{basename as D,join as d}from"path";function u(){return d(f,"mobile","apps")}function m(){return d(u(),"index.json")}function C(){return{readIndex:async()=>{try{let e=JSON.parse(await S(m(),"utf8"));return{apps:Array.isArray(e.apps)?e.apps:[]}}catch{return{apps:[]}}},writeIndex:async r=>{await g(u(),{recursive:!0});let e=`${m()}.tmp`;await v(e,JSON.stringify(r,null,2)),await I(e,m())},exists:async r=>{try{return await x(r),!0}catch{return!1}},copy:(r,e)=>P(r,e,{recursive:!0,force:!0}),remove:r=>k(r,{recursive:!0,force:!0}),sizeOf:async r=>{try{return(await b(r)).size}catch{return}},now:()=>new Date}}var c=class{deps;constructor(e={}){this.deps={...C(),...e}}async list(){let{apps:e}=await this.deps.readIndex();return[...e].sort((t,s)=>s.lastUsedAt.localeCompare(t.lastUsedAt))}async find(e){return(await this.deps.readIndex()).apps.find(t=>t.key===e)}async put(e){let t=await this.deps.readIndex(),s=t.apps.find(n=>n.key===e.key),a=this.deps.now().toISOString();if(s&&await this.deps.exists(s.path))return s.lastUsedAt=a,await this.deps.writeIndex(t),s;s&&(t.apps=t.apps.filter(n=>n.key!==e.key));let l=D(e.name??e.sourcePath),o=d(u(),e.key),p=d(o,l);await g(o,{recursive:!0}),await this.deps.copy(e.sourcePath,p);let i={key:e.key,path:p,name:l,source:e.source,...e.source==="local"?{originPath:e.sourcePath}:{},addedAt:a,lastUsedAt:a,...await this.deps.sizeOf(p).then(n=>n?{bytes:n}:{})};return t.apps=[...t.apps.filter(n=>n.key!==e.key),i],await this.deps.writeIndex(t),i}async exists(e){if(await this.deps.sizeOf(e.path)!==void 0)return!0;try{return await y(e.path),!0}catch{return!1}}async forget(e){let t=await this.deps.readIndex(),s=t.apps.find(a=>a.key===e);s&&(await this.deps.remove(s.path),t.apps=t.apps.filter(a=>a.key!==e),await this.deps.writeIndex(t))}async prune(){let e=await this.deps.readIndex(),t=[];for(let s of e.apps)if(await this.deps.sizeOf(s.path)!==void 0)t.push(s);else try{await y(s.path),t.push(s)}catch{}return t.length!==e.apps.length&&await this.deps.writeIndex({apps:t}),t}};var E=30*6e4,j=/^APP\d{6,}$/;function Y(r){return!!r&&j.test(r.trim())}function _(){return{store:new c,client:(r,e)=>new w(r,e),fetchToFile:async(r,e)=>{let t=await h(r,{method:"GET",signal:AbortSignal.timeout(E)});if(!t.ok)throw new Error(`Downloading the app failed: ${t.status} ${t.statusText}`);if(!t.body)throw new Error("Downloading the app failed: empty response body");await F(U.fromWeb(t.body),R(e))}}}async function Z(r,e={}){let t={..._(),...e},s=r.appId.trim(),a=await t.store.find(s);if(a&&await t.store.exists(a))return r.onProgress?.(`using the copy of ${a.name} already on this machine`),await t.store.put({key:s,sourcePath:a.path,source:"cloud",name:a.name}),{path:a.path,name:a.name,fromStore:!0};r.onProgress?.(`looking up ${s}\u2026`);let o=await t.client(r.baseUrl,r.auth).details(s);if(r.accepts&&!r.accepts.some(i=>o.name.toLowerCase().endsWith(i)))throw new Error(`${o.name} cannot run on this device \u2014 expected ${r.accepts.join(" or ")}.`);r.onProgress?.(`downloading ${o.name} \u2014 this can take a while, please wait\u2026`);let p=await O(A(T(),"kane-app-dl-"));try{let i=A(p,z(o.name));await t.fetchToFile(o.url,i);let n=await t.store.put({key:s,sourcePath:i,source:"cloud",name:o.name});return r.onProgress?.(`${o.name} is ready`),{path:n.path,name:n.name,fromStore:!1,details:o}}finally{await $(p,{recursive:!0,force:!0})}}export{c as a,Y as b,Z as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as t}from"./chunk-
|
|
2
|
+
import{b as t}from"./chunk-OFW3ZVTP.js";import{join as i}from"path";function e(n=t){return i(n,"plugins")}function g(n,r=t){return i(e(r),n)}function c(n,r,o=t){return i(g(n,o),r)}function f(n,r=t){return i(g(n,r),"current")}function x(n,r=t){return i(g(n,r),"config.json")}function l(n,r=t){return i(g(n,r),".jobs")}function s(n=t){return i(n,"bin")}function h(n=t){return i(s(n),"hyperexecute")}export{e as a,g as b,c,f as d,x as e,l as f,s as g,h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as m}from"./chunk-
|
|
2
|
+
import{a as m}from"./chunk-AO3PBE2V.js";import{x as t}from"./chunk-OFW3ZVTP.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as Bt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Ft}from"./chunk-I7TIGB7K.js";import{a as te,c as Yt,e as Zt,f as qe,g as Qt,h as nr}from"./chunk-
|
|
2
|
+
import{b as Bt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Ft}from"./chunk-I7TIGB7K.js";import{a as te,c as Yt,e as Zt,f as qe,g as Qt,h as nr}from"./chunk-ATWDQCDA.js";import{a as Xt,b as rr,c as sr,d as ir,e as dt,f as or}from"./chunk-ZGBSGZZM.js";import{a as ke,b as qt,c as Gt,d as Lt,e as Vt}from"./chunk-EXERQHXV.js";import{a as zt}from"./chunk-L2TV4G56.js";import{a as Kt,b as Jt}from"./chunk-JFAFKHDX.js";import{c as Wt}from"./chunk-6KPPGMO2.js";import{e as Ut}from"./chunk-TKYJTXWL.js";import{a as Fe}from"./chunk-AWD56KGX.js";import{b as Nt}from"./chunk-YKTYVJBN.js";import{a as Ht,e as jt}from"./chunk-GFKCTYCA.js";import{a as er}from"./chunk-IMR64OCZ.js";import{g as Mt}from"./chunk-2DCNCH32.js";import{a as $e,b as ct}from"./chunk-DNNZ353O.js";import{a as Se}from"./chunk-NVGBE2DR.js";import{b as nt}from"./chunk-IDX3TOPY.js";import{A as ee,k as be,o as Be}from"./chunk-TH47OOBV.js";import{f as It}from"./chunk-DUAXZYAD.js";import{e as at}from"./chunk-DBIBROYW.js";import{d as me}from"./chunk-WXHQYYD5.js";import{b as Ot}from"./chunk-IAHKTEET.js";import{a as At}from"./chunk-5EOX4MEY.js";import{appendFileSync as wr,mkdirSync as ut,rmdirSync as br,writeFileSync as lt}from"fs";import{dirname as mr,extname as Sr,join as ce}from"path";var X=class extends Error{code;constructor(e,a){super(`${e}: ${a}`),this.name="ProposalAdapterError",this.code=e}};function cr(r){return r.version===2}var ar=8;function vr(r){let e=/^extract@(\d+)$/.exec(r??"");return e?Number.parseInt(e[1],10):null}var yr=r=>typeof r=="object"&&r!==null&&"op"in r;function Ge(r,e,a){return{anchor:r.anchor,quote:r.quote,...a||r.source_id!==e?{source_id:r.source_id}:{}}}function dr(r,e,a={}){let m=vr(a.templateVersion),x=m!==null&&m>=5,_=m!==null&&m<5,y=r.archived!=null&&r.archived.length>0&&m!==null&&m<5;if(y&&a.warn?.(`dropped ${r.archived.length} archive op(s): the bound extract template @${m} never described archiving \u2014 nothing was archived; the use-cases still land`),!x&&r.read_basis.length!==1)throw new X("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${r.read_basis.length}`);if(r.read_basis.length===0)throw new X("READ_BASIS_COUNT","read_basis must not be empty");let v=r.read_basis[0],h=r.read_basis.length>1,$=r.use_cases.map(i=>{if(_&&i.cite.length!==1)throw new X("CITE_COUNT",`${i.temp_ref}: cite must have exactly 1 element, got ${i.cite.length}`);if(i.cite.length<1||i.cite.length>ar)throw new X("CITE_COUNT",`${i.temp_ref}: 1..${ar} cites allowed, got ${i.cite.length}`);let M=(f,re)=>{if(!x&&f!==v.source_id)throw new X("SOURCE_MISMATCH",`${re}: cite source ${f} != read_basis source ${v.source_id} (single-source)`)};M(i.cite[0].source_id,i.temp_ref);let P=i.cite.map(f=>(M(f.source_id,i.temp_ref),Ge(f,v.source_id,x&&(h||f.source_id!==v.source_id)))),l=(i.updated?.criteria??[]).some(yr);if(!x&&l)throw new X("CRITERIA_OPS_UNSUPPORTED",`${i.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${a.templateVersion??"an unversioned template"}`);return{temp_ref:i.temp_ref,title:i.title,...i.description!==void 0?{description:i.description}:{},...i.summary!==void 0?{summary:i.summary}:{},...i.actors!==void 0?{actors:i.actors}:{},...i.value!==void 0?{value:i.value}:{},risk:i.risk,cite:P[0],...P.length>1?{cites:P}:{},...i.criteria!=null&&i.criteria.length>0?{criteria:i.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{},depends_on_hint:i.depends_on_hint,matches_existing:i.matches_existing,...i.conflicts_with!=null?{conflicts_with:i.conflicts_with}:{},...i.changed?{changed:!0}:{},...i.updated!=null?{updated:{...i.updated.title!=null?{title:i.updated.title}:{},...i.updated.description!=null?{description:i.updated.description}:{},...i.updated.summary!=null?{summary:i.updated.summary}:{},...i.updated.actors!=null?{actors:i.updated.actors}:{},...i.updated.value!=null?{value:i.updated.value}:{},...i.updated.risk!=null?{risk:i.updated.risk}:{},...i.updated.criteria!=null?{criteria:l?i.updated.criteria.map(f=>f.op==="set"?{op:"set",text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}:f.op==="keep"?{op:"keep",ref:f.ref,text:f.text}:{op:"remove",ref:f.ref,text:f.text,reason:f.reason}):i.updated.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.updated.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{}}}:{},...i.change_note!=null?{change_note:i.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:v.source_id,source_cid:v.source_cid},use_cases:$,...h?{sources:r.read_basis.map(i=>({source_id:i.source_id,source_cid:i.source_cid}))}:{},...r.extraction_of!=null&&r.extraction_of.length>0?{extraction_claims:r.extraction_of.map(i=>({source_id:i.source_id,completeness:i.completeness}))}:{},...r.archived!=null&&r.archived.length>0&&!y?{archived:r.archived.map(i=>({target:i.target,reason:i.reason,basis:i.basis}))}:{}}}function ur(r){let{contextDir:e,graph:a}=r,m=r.maxDigestBytes??4096,x={},_=[];for(let[h,$]of a.heads){if(x[h]=$,typeof $!="string")continue;let i=a.mediaOf($),M=a.getNode($)?.content?.blob;if(typeof M=="string")if(i.format==="image")_.push({source_id:h,cid:$,format:"image",blobRef:{path:Se(e,M),cid:M}});else{let P=$e(e,a,$)?.toString("utf8")??"";_.push({source_id:h,cid:$,format:i.format,text:P})}}_.sort((h,$)=>h.source_id<$.source_id?-1:1);let y=[];for(let h of a.byLabel(me.STYLENOTE).sort(($,i)=>$.cid<i.cid?-1:1))a.superseded.has(h.cid)||y.push(`\u2022 ${String(h.content.statement)} [${String(h.content.learned_from_kind)}]`);let v="";for(let h of y){if(Buffer.byteLength(v+h+`
|
|
3
3
|
`,"utf8")>m)break;v+=h+`
|
|
4
4
|
`}return{read_basis:x,sources:_,styleNoteDigest:v}}function lr(r,e){let a=ur({contextDir:r,graph:e}).styleNoteDigest;return a.length>0?a:void 0}function mt(r,e,a,m,x){let _=null,y=()=>_??=x&&Object.keys(x).length>0?Promise.resolve(x):Ut().catch(()=>({}));return{contextDir:r,rootSid:e,locks:at(r,e),probe:m??Ft(r,{resolveAlias:async v=>qt(v,{env:process.env,auth:await y()}),embed:async(v,h)=>Gt(v,h,{env:process.env,auth:await y()}),readVector:(v,h)=>Lt(r,v,h),writeVector:(v,h,$)=>Vt(r,v,h,$)}),...a?.length?{reservedEventIds:a}:{}}}function ht(r,e){let a=[],m=[];for(let x of r.use_cases){let _=x.matches_existing;_?.cid&&e.hasNode(_.cid)?a.push({ref:_.cid,expectedTip:e.tipOf(_.cid)}):m.push({tempRef:x.temp_ref,title:String(x.title??""),probeText:String(x.title??"")})}return{verb:"extract",ucTargets:a,newBuCandidates:m,sourcePins:[{source_id:r.source.source_id,source_cid:r.source.source_cid}],readBasis:r.read_basis??null}}function $r(r,e){let a=(r.images??[]).filter(m=>m.delivery==="selected");if(a.length!==0)return a.map(m=>({ref:m.ref,...m.page!==void 0?{page:m.page}:{},...m.loc!==void 0?{loc:m.loc}:{},media_type:m.media_type,blob_ref:{path:Se(e,m.blob),cid:m.blob}}))}function kr(r){return r.length>8&&r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71?"image/png":r.length>3&&r[0]===255&&r[1]===216&&r[2]===255?"image/jpeg":r.length>12&&r.toString("ascii",0,4)==="RIFF"&&r.toString("ascii",8,12)==="WEBP"?"image/webp":null}function Le(r){return r.toISOString().replace(/[-:]/g,"").slice(0,15)}function hr(r){return r.startsWith("su-conv-")?`conv-${Ot(Buffer.from(r,"utf8")).slice(0,8)}`:r}function pr(r){return r.source_id.startsWith("su-conv-")?"the conversation":r.source_id}function Rr(r,e,a){return`reading ${pr(r)}${a>1?` (source ${e} of ${a})`:""}`}function Re(r){return r.toLowerCase().trim().replace(/\s+/g," ")}function gr(r,e){let a=new Map,m=new Map,x=new Map;for(let{cid:y,content:v}of e.byLabel(me.USECASE)){if(e.superseded.has(y))continue;(e.trust.get(y)==="archived"?x:m).set(Re(String(v.title??"")),y)}let _=y=>e.trust.get(y)==="archived"?{cid:y,archived:!0,reason:e.archivedReason.get(y)}:{cid:y};for(let y of r.use_cases){if(y.matches_existing){let $=y.matches_existing.cid;if(e.superseded.has($)){let i=e.tipOf($);$=e.superseded.has(i)?null:i}if($!==null){a.set(y.temp_ref,_($));continue}}let v=m.get(Re(y.title));if(v){a.set(y.temp_ref,{cid:v});continue}let h=x.get(Re(y.title));h&&a.set(y.temp_ref,_(h))}return a}var fr=/^(\S+)\.criteria\[(\d+)\]/;function Cr(r,e,a){if(e.length===0||!e.every(x=>fr.test(x.detail)))return!1;let m=new Map;for(let x of e){let _=fr.exec(x.detail),y=m.get(_[1])??new Set;y.add(Number(_[2])),m.set(_[1],y)}for(let x of r.use_cases){let _=m.get(x.temp_ref);_?.size&&(x.criteria=(x.criteria??[]).filter((y,v)=>!_.has(v)),a(`${x.temp_ref}: dropped ${_.size} criteria with unverifiable cites \u2014 committed without them (criteria are hints, not oracles)`))}return!0}async function gt(r,e,a,m,x=()=>{},_,y){let v=(h,$)=>x(h,$,r.session_id);return Zt(r,e,a,m,x,{async onProposalEvent(h){let $=h,i=null,M=null;if(cr($))try{i=dr($,r.read_basis,{templateVersion:y?.()??null,warn:P=>{e.out(`warning: ${P}`),v("adapter",{warn:P})}}),v("adapter",{ok:!0,use_cases:i.use_cases.length})}catch(P){M=P instanceof X?P.message:String(P),v("adapter",{ok:!1,error:M})}else i=$;return i&&i.use_cases.length===0&&(e.out("warning: the agent proposed ZERO use-cases for this source"),e.emit?.({type:"warning",code:"ZERO_USE_CASES",message:"the agent proposed ZERO use-cases for this source"})),i&&_&&await _(i),{proposal:i,error:M}}})}var Dr=new Set(["agent","ci","override"]);async function Ss(r,e){let a=`ext-${Le(e.now?.()??new Date)}-lk${Math.random().toString(36).slice(2,8)}`,x=at(e.contextDir,a,e.now?{now:e.now}:void 0).tryAcquire([{kind:"extract"}],{hold:"session",verb:"extract"});if("contended"in x){let _=x.contended.holder,y=`another extraction is running on this context${_?` (pid ${_.pid})`:""} \u2014 retry when it finishes`;return e.out(y),e.emit?.({type:"error",message:y,code:"EXTRACT_LOCKED"}),2}try{return await Er(r,e)}finally{x.release()}}async function Er(r,e){let a=r.mode??"interactive";if(r.posture==="reconcile"){if(r.trust==="hold"){let o="error: --trust hold has no meaning here \u2014 a reconcile IS the review; drop the flag";return e.out(`${o} [TRUST_USAGE]`),e.emit?.({type:"error",message:o,code:"TRUST_USAGE"}),2}if(!r.source||!r.changeContext){let o="reconcile posture needs a pinned source and its change context \u2014 internal wiring fault";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}if(a==="ci"){let o="reconcile posture is not available under --mode ci \u2014 a held changeset needs a durable session; use --mode agent";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}}if(r.trust==="hold"&&a==="interactive")return e.out("error: --trust hold only applies to headless runs \u2014 in interactive chat you review items in-session anyway; use --mode agent to hold everything for review"),e.emit?.({type:"error",message:"error: --trust hold only applies to headless runs \u2014 use --mode agent",code:"TRUST_USAGE"}),2;if(a==="interactive"){if(!e.isTTY)return e.out("extract: --mode interactive needs a TTY (use --mode agent|ci|override headless)"),2}else if(!Dr.has(a))return e.out(`extract: unknown mode "${a}" \u2014 interactive | agent | ci | override`),2;if(r.trust!==void 0){if(a==="ci")return e.out("error: --trust is not available under --mode ci (ci is fail-closed \u2014 no trust dials)"),e.emit?.({type:"error",message:"error: --trust is not available under --mode ci",code:"TRUST_UNDER_CI"}),2;if(r.trust!=="auto"&&r.trust!=="hold")return e.out(`error: --trust must be auto | hold, got '${r.trust}'`),e.emit?.({type:"error",message:`error: --trust must be auto | hold, got '${r.trust}'`,code:"TRUST_USAGE"}),2}let m=e.telemetry?.enabled?e.telemetry:void 0,x=Le(e.now?.()??new Date),_=m?At(m.ids.context_instance_id??null,"extract",m.ids.session_id):ce(e.contextDir,"logs",`extract-${x}.log`);ut(mr(_),{recursive:!0});let y=`run-${x}-${Math.random().toString(36).slice(2,8)}`,v=o=>o==="error"||o==="failed_proposal"?"error":o==="repair_respawn"?"warn":"info",h=(o,u,s)=>{try{wr(_,JSON.stringify({ts:new Date().toISOString(),level:v(o),run_id:y,...m?{user_session_id:m.ids.session_id}:{},...s?{session_id:s}:{},kind:o,data:u})+`
|
|
5
5
|
`)}catch{}m?.wireTrace(o,u,s)};{let o=e.out;e.out=u=>{h("transcript",{line:u}),o(u)}}e.chat||e.out(`trace: ${te(_)}`),e.emit?.({type:"run_start",mode:a,trace:_,...m?{session:m.ids.session_id}:{}});let $=Nt();if($&&e.out($),e.preflightTurn){let o=await e.preflightTurn();if(h("preflight",o),!o.ok)return e.out(o.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:o.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),2}let i=ee(e.contextDir),M=lr(e.contextDir,i),P=r.sources?.length?r.sources:r.source?[r.source]:[];if(P.length>0){if(r.resume){let o="error: --source cannot be combined with --resume (the resumed session already has its scope)";return e.out(o),e.emit?.({type:"error",message:o,code:"SOURCE_WITH_RESUME"}),2}for(let o of P){let u=i.heads.get(o);if(typeof u!="string"){let s=u===null?`error: --source ${o} was ingested but is retired \u2014 re-ingest it to extract again`:`error: --source ${o} is not an ingested source (kane-cli context list shows them)`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_UNKNOWN"}),2}}}let l=null,f=null;if(r.resume){try{{let c=await or(e.contextDir,r.resume,i,{verb:"extract",deps:{onWarn:C=>e.out(`note: ${C}`)}});{let C=Object.keys(c.handle.state.read_basis??{});if(C.length>1){let B=`error: session ${r.resume} spans ${C.length} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (re-run kane-cli context extract for anything remaining)`;return e.out(B),e.emit?.({type:"error",message:B,code:"MULTI_SOURCE_RESUME"}),c.handle.release(),2}f=c,h("resume_kind",{kind:c.view.pointer===null?"bare-base":c.view.pointer.at==="final"?"pause":"crash"}),l={handle:c.handle,represent:c.represent,questions:c.questions,staleBasis:c.drift.map(B=>B.subject)}}}}catch(c){let C=c instanceof Error?c.message:String(c);return e.out(`error: ${C}`),e.emit?.({type:"error",message:`error: ${C}`,...c instanceof dt?{code:c.code}:{}}),c instanceof dt?2:1}let o=f?null:Xt(l.handle.state.verb,"extract",r.resume);if(o)return e.out(o.message),e.emit?.({type:"error",message:o.message,code:o.code}),l.handle.release(),2;let u=l.handle.state.change_basis;if(u&&(i.heads.get(u.source_id)??null)!==u.new_head){let c=`error: ${u.source_id} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; re-run kane-cli maintain reconcile against the current file (session ${r.resume} is defunct and can be ignored)`;return e.out(c),e.emit?.({type:"error",message:c,code:"CHANGE_BASIS_MOVED"}),l.handle.release(),2}if(f&&f.view.pointer!==null&&f.drift.length>0){if(!await e.confirmStale(`changed since the pause: ${f.drift.map(C=>C.subject).join(", ")} \u2014 re-ground and continue against the current versions?`)){let C=`resume aborted: the context moved since the pause (${f.drift.map(B=>B.subject).join(", ")}) \u2014 session ${r.resume} is preserved`;return e.out(C),e.emit?.({type:"error",message:C,code:"RESUME_DRIFT"}),l.handle.release(),2}}else l.staleBasis.length>0&&e.out(`note: changed since the pause: ${l.staleBasis.join(", ")} \u2014 re-presented items may be stale`);let s=[...new Set([...l.handle.state.held_receipts??[],...f?.view.kane?.held_receipts??[]])];if(s.length>0)if(e.chat?.holdReceipt)for(let c of s)e.chat.holdReceipt(c);else e={...e,initialMessage:[s.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as l}from"./chunk-
|
|
2
|
+
import{b as l}from"./chunk-D4SRHIJ5.js";import{a as m}from"./chunk-OYJBABRV.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-ZLSWHCWO.js";import{a as c,b as s,h as a,w as u}from"./chunk-OFW3ZVTP.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as g}from"./chunk-
|
|
2
|
+
import{b as g}from"./chunk-OFW3ZVTP.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
|
|
3
3
|
`),f(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let i=this.readConfig();i.active_profile=t,this.writeConfig(i)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let i=this.readConfig();i.default_env=t,this.writeConfig(i)}credentialsPath(t,i){return n(this.profilesDir,t,i,"credentials")}clientPath(t,i){return n(this.profilesDir,t,i,"client.json")}basicAuthPath(t,i){return n(this.profilesDir,t,i,"basic-auth")}profileConfigPath(t,i){return n(this.profilesDir,t,i,"profile-config.json")}saveProfileConfig(t,i,r){let e=this.loadProfileConfig(t,i)??{};this.writeSecure(this.profileConfigPath(t,i),{...e,...r})}loadProfileConfig(t,i){try{return JSON.parse(o(this.profileConfigPath(t,i),"utf-8"))}catch{return null}}writeSecure(t,i){try{u(P(t),{recursive:!0,mode:448}),h(t,JSON.stringify(i,null,2)+`
|
|
4
4
|
`),f(t,384)}catch(r){let e=r instanceof Error?r.message:String(r);process.stderr.write(`[auth] Failed to save credentials: ${e}
|
|
5
5
|
`)}}saveCredentials(t,i,r){this.writeSecure(this.credentialsPath(t,i),r)}loadCredentials(t,i){try{return JSON.parse(o(this.credentialsPath(t,i),"utf-8"))}catch{return null}}saveClient(t,i,r){this.writeSecure(this.clientPath(t,i),r)}loadClient(t,i){try{return JSON.parse(o(this.clientPath(t,i),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let i=this.getDefaultEnv();return{credentials:this.loadCredentials(t,i),profile:t,env:i}}saveBasicAuth(t,i,r){this.writeSecure(this.basicAuthPath(t,i),r)}loadBasicAuth(t,i){try{return JSON.parse(o(this.basicAuthPath(t,i),"utf-8"))}catch{return null}}deleteBasicAuth(t,i){try{s(this.basicAuthPath(t,i))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let i=this.getDefaultEnv(),r=this.loadBasicAuth(t,i);return r?{method:"basic",...r,profile:t,env:i}:this.loadCredentials(t,i)?{method:"oauth",profile:t,env:i}:null}listProfiles(){let t=[];try{for(let i of a(this.profilesDir)){let r=n(this.profilesDir,i);try{for(let e of a(r)){let c=n(r,e),v=l(n(c,"credentials")),p=l(n(c,"client.json")),y=l(n(c,"basic-auth"));(v||p||y)&&t.push({profile:i,env:e})}}catch{}}}catch{}return t}deleteProfile(t,i){try{s(this.credentialsPath(t,i))}catch{}if(this.getActiveProfile()===t){let r=this.readConfig();delete r.active_profile,this.writeConfig(r)}}deleteProfileFull(t,i){if(i){try{s(this.credentialsPath(t,i))}catch{}try{s(this.clientPath(t,i))}catch{}try{s(this.basicAuthPath(t,i))}catch{}try{s(this.profileConfigPath(t,i))}catch{}}else try{let r=n(this.profilesDir,t);for(let e of a(r)){try{s(n(r,e,"credentials"))}catch{}try{s(n(r,e,"client.json"))}catch{}try{s(n(r,e,"basic-auth"))}catch{}try{s(n(r,e,"profile-config.json"))}catch{}}}catch{}}};export{d as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-
|
|
2
|
+
import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-FUNKVREV.js";import{a as C}from"./chunk-ZLSWHCWO.js";import{p as m,q as u,r as f,s as x,t as y}from"./chunk-OFW3ZVTP.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
|
|
3
3
|
Please open this URL manually: ${e}
|
|
4
4
|
`)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
|
|
5
5
|
<html lang="en">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-OYJBABRV.js";import"./chunk-OFW3ZVTP.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-ZLSWHCWO.js";import"./chunk-OFW3ZVTP.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-DN3E6RT6.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-OFW3ZVTP.js";import"./chunk-UR6MHSHU.js";export{a as DEPS_INSTALL_SCHEMA_VERSION,i as DepsBundleResolver,c as DepsInstallRequiredError,h as NoPublishedBundleError,b as classOfTarget,g as downloadPayload,e as formatEta,d as formatRate,j as managedDeps,f as planRangeParts};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import"./chunk-UR6MHSHU.js";var c="Mobile dependencies are resolved through your KaneAI account. Run `kane-cli login` first.";function d(l,o,e=process.env){return e.KANE_MOBILE_DEPS_BASE_URL||o(l)}async function u(){let[{CredentialsManager:l},{refreshOAuthToken:o},{getEnvironment:e},{ControllerClient:n}]=await Promise.all([import("./credentials-
|
|
2
|
+
import"./chunk-UR6MHSHU.js";var c="Mobile dependencies are resolved through your KaneAI account. Run `kane-cli login` first.";function d(l,o,e=process.env){return e.KANE_MOBILE_DEPS_BASE_URL||o(l)}async function u(){let[{CredentialsManager:l},{refreshOAuthToken:o},{getEnvironment:e},{ControllerClient:n}]=await Promise.all([import("./credentials-ZSNM4BTD.js"),import("./token-refresh-G2CSTY4B.js"),import("./config-6TQIMTNB.js"),import("./controller-client-OB4WD2C4.js")]),s=new l;return{creds:s,refresh:r=>o({creds:s,profile:r.profile,env:r.env,credentials:r.credentials}),controllerBaseUrlFor:r=>d(r,t=>e(t).controllerBaseUrl),makeClient:(r,t)=>new n(r,t)}}function p(l){return async o=>{let e=l??await u(),n=e.creds.getActiveProfile();if(!n)throw new Error(c);let s=e.creds.getDefaultEnv(),r=e.controllerBaseUrlFor(s),t=e.creds.loadBasicAuth(n,s);if(t)return e.makeClient(r,{username:t.username,accessKey:t.access_key}).resolveMobileDepsBundle(o);let i=e.creds.loadCredentials(n,s);if(!i)throw new Error(c);try{await e.refresh({creds:e.creds,profile:n,env:s,credentials:i})}catch{}let a=(e.creds.loadCredentials(n,s)??i).access_token;if(typeof a!="string"||!a)throw new Error(c);return e.makeClient(r,a).resolveMobileDepsBundle(o)}}export{p as controllerResolveBundle,d as depsControllerBaseUrl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-BN6AHQL7.js";import"./chunk-2UIHS2FH.js";import"./chunk-YKTYVJBN.js";import"./chunk-2DCNCH32.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-NVGBE2DR.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-OFW3ZVTP.js";import"./chunk-UR6MHSHU.js";export{b as REMOTE_PROVIDERS,d as findProvider,a as landingReceipt,c as looksLikeUrl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c,d}from"./chunk-FMUCZWS3.js";import"./chunk-LN7233E2.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-DN3E6RT6.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-OFW3ZVTP.js";import"./chunk-UR6MHSHU.js";export{d as doctorExitCode,c as doctorPreflightBlocked,b as renderDoctorText,a as runDoctor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{A as L,C as M,D as N,E as O,F as P,G as Q,K as R,L as S,M as T,N as U,O as _,Q as $,R as aa,S as ba,T as ca,U as da,V as ea,W as fa,X as ga,Y as ha,Z as ia,a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as t,j as u,k as v,l as w,m as x,n as y,o as z,p as A,q as B,r as C,s as D,t as E,u as F,v as G,w as H,x as I,y as J,z as K}from"./chunk-
|
|
2
|
+
import{A as L,C as M,D as N,E as O,F as P,G as Q,K as R,L as S,M as T,N as U,O as _,Q as $,R as aa,S as ba,T as ca,U as da,V as ea,W as fa,X as ga,Y as ha,Z as ia,a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as t,j as u,k as v,l as w,m as x,n as y,o as z,p as A,q as B,r as C,s as D,t as E,u as F,v as G,w as H,x as I,y as J,z as K}from"./chunk-QBG7XEGQ.js";import"./chunk-5DBK6QNS.js";import{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-RZLD7TPG.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-5GUD3CIH.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZSXDZI56.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-VZ7KXRXB.js";import{a,f as b}from"./chunk-P7YZ3PU3.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-SQC4P2Q7.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-DN3E6RT6.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-OYJBABRV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-OFW3ZVTP.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,b as buildEnvironment,j as buildEvidenceRunConfig,i as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,a as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,f as shortHash,e as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,h as testIdForInline,g as testIdForTestmd,k as validatePack,c as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,d as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g}from"./chunk-7VZCXW74.js";import"./chunk-OS4VSIHT.js";import"./chunk-TRJUD3XJ.js";import"./chunk-JZ26R6UL.js";import"./chunk-UJZZDPDY.js";import"./chunk-JFAFKHDX.js";import"./chunk-DNNZ353O.js";import"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-A2SQD2AY.js";import{a as F}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-A2SQD2AY.js";import{a as F}from"./chunk-IGJIDN4U.js";import{a as ee}from"./chunk-JZ26R6UL.js";import{f as Z,g as z}from"./chunk-YZ45OEH3.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-ATWDQCDA.js";import"./chunk-IWM5EZC3.js";import"./chunk-ZGBSGZZM.js";import"./chunk-EXERQHXV.js";import"./chunk-BB2W35TW.js";import"./chunk-AXTPNZPX.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-6KPPGMO2.js";import"./chunk-KRKGZ2ZW.js";import{e as Y}from"./chunk-TKYJTXWL.js";import"./chunk-AWD56KGX.js";import"./chunk-BN6AHQL7.js";import"./chunk-2UIHS2FH.js";import{c as L}from"./chunk-YKTYVJBN.js";import"./chunk-GFKCTYCA.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import"./chunk-2DCNCH32.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-R7QAS6LZ.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import{c as O}from"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import{a as A}from"./chunk-CH273NAE.js";import{a as U,b as H}from"./chunk-E5S4BASB.js";import"./chunk-R5T4RLF5.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-OFW3ZVTP.js";import"./chunk-UR6MHSHU.js";async function ue(t){let[{render:n},o,{QuestionBatchPrompt:f}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),g=o.default??o;return new Promise(y=>{let x=n(g.createElement(f,{questions:t,onSubmit:r=>{x.unmount(),y(r)}}))})}async function le(t,n){let[{render:o},f,{ReviewChecklist:g}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),y=f.default??f;return new Promise(x=>{let r=o(y.createElement(g,{items:t.map(v=>{let h=n.get(v.temp_ref);return{uc:v,dedupWith:h&&!h.archived?h.cid:void 0,archivedMatch:h?.archived?{cid:h.cid,reason:h.reason}:void 0}}),onSubmit:v=>{r.unmount(),x(v)}}))})}async function me(t){let{createInterface:n}=await import("readline/promises"),o=n({input:process.stdin,output:process.stdout});try{let f=await o.question(`${t} [y/N] `);return/^y(es)?$/i.test(f.trim())}finally{o.close()}}async function be(t){let n=A(process.cwd()),o=H({verb:"extract",mode:t.plan?"cli":"interactive",contextRoot:n,env:U(),resumeSid:t.resume,write:!0,longSession:!0}),g={...await Y(),...o.spawnEnv()},y=await L(g);if(!y.ok)return process.stderr.write((y.message??"error: turn-endpoint preflight failed")+`
|
|
3
3
|
`),process.stderr.write(o.supportFooter()+`
|
|
4
4
|
`),o.error("preflight_auth"),await o.end({exit_code:2}),2;let x=async()=>y;if(t.plan){let s=await z(t,{contextDir:n,agent:F,preflightTurn:x,ask:ue,review:le,confirmStale:me,out:l=>process.stdout.write(l+`
|
|
5
5
|
`),progress:l=>process.stderr.write(l+`
|
|
6
6
|
`),isTTY:O(),auth:g,telemetry:o});return s===1&&process.stderr.write(o.supportFooter()+`
|
|
7
|
-
`),await o.end({exit_code:s}),s}let[{render:r},v,{ScrollbackProvider:h},{ChatSurface:u},{ScrollbackTap:j},{makeChatController:Q},{setInkExit:_},W]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-
|
|
7
|
+
`),await o.end({exit_code:s}),s}let[{render:r},v,{ScrollbackProvider:h},{ChatSurface:u},{ScrollbackTap:j},{makeChatController:Q},{setInkExit:_},W]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-S2P7WMBI.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-R4THYYPU.js"),import("./exit-manager-3FVBTNYR.js"),Promise.all([import("./chat-committer-ZWWCLJFD.js"),import("./descriptor-OEUZZCOK.js"),import("./explain-UAAQWHYR.js"),import("./readmodel-XOYGGQ3S.js")])]),[{commitChatTurn:M},{topologyDescriptor:e},{explain:a},{openGraph:k}]=W,E=v.default??v,i=Q({commitChatTurn:M,descriptor:e(),contextDir:n,refreshGraph:()=>k(n),graph:k(n),explain:a,by:{kind:"human",id:"owner"},dedupFlags:s=>Z(s,k(n))}),q={current:null},P=null,J=0,G=null,V=!1,te=()=>{if(J+=1,J>=2){try{I.unmount()}catch{}$({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}i.requestPause(),G=setTimeout(()=>{V||(V=!0,(async()=>{i.finalizeForExit(),await q.current?.flush();try{I.unmount()}catch{}$({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},re=await import("./dossier-KTLTGT2X.js"),ne=s=>{try{return re.buildDossier(k(n),s)}catch{return null}},se={listUcs:()=>{let s=k(n),l=new Set(i.state.turns.flatMap(c=>(c.items??[]).map(m=>m.title.toLowerCase()))),d={high:0,med:1,low:2};return s.byLabel("usecase").filter(c=>!s.superseded.has(c.cid)).map((c,m)=>{let b=c.content,C=String(b.title??c.cid.slice(0,12)),N=ee(s,c.cid),S=N?N.designed_at_cid===c.cid?"current":"stale":void 0;return{key:c.cid,title:C,badge:S==="current"?"designed":S==="stale"?"designed \xB7 stale":l.has(C.toLowerCase())?"drafted this session":"existing",designed:S,risk:b.risk,i:m}}).sort((c,m)=>(d[c.risk??"zz"]??3)-(d[m.risk??"zz"]??3)||c.i-m.i).map(({key:c,title:m,badge:b,designed:C})=>({key:c,title:m,badge:b,designed:C}))},runDesignChild:async(s,l=!1,d="design")=>{try{let{designEntryCheck:p,confirmUnreviewedViaAsk:T}=await import("./trust-gate-EX7R2P4Y.js"),w=p(k(n),s);if(!w.ok&&(w.code==="UC_UNREVIEWED"||w.code==="UC_ARCHIVED")&&!await T(D=>i.ask(D),w))return i.note(`design child refused \u2014 approve it first: ${w.reviewCmd}`),2}catch{}let[{runDesign:c}]=await Promise.all([import("./run-26IR3CKX.js")]),m="",b=(()=>{try{let p=k(n),T=p.resolve(s);return(T?p.getNode(T.cid)?.content?.title:void 0)??s}catch{return s}})(),{collectSessionItems:C}=await import("./session-items-2ATN7VXG.js"),N=C(i.state.turns).entries.length,S=i.state.credits?.total,ce=Date.now();i.ledger({kind:"childOpen",verb:d,subject:b});let de=p=>{let T=Math.max(1,Math.round((Date.now()-ce)/1e3)),w=C(i.state.turns).entries.length-N,B=i.state.credits?.total,D=B!==void 0&&S!==void 0?B-S:B;i.ledger(p===0?{kind:"childClose",verb:d,subject:b,ok:!0,durS:T,...w>0?{results:`${w} item${w===1?"":"s"}`}:{},...D!==void 0&&D>0?{credits:D}:{}}:{kind:"childClose",verb:d,subject:b,ok:!1,durS:T,exitCode:p,fixCmd:`kane-cli design tests --use-case ${s}${l||d==="evolve"?" --force":""}`});let X=C(i.state.turns).entries.length;i.ledger({kind:"childBack",parentVerb:"extract",context:`${X} draft${X===1?"":"s"} saved`})},R=1;try{R=await c({useCase:s,force:l,mode:"interactive"},{contextDir:n,agent:F,preflightTurn:x,ask:p=>i.ask(p),chat:i,nested:!0,out:p=>{m=p},progress:()=>{},isTTY:!0,auth:g})}finally{de(R)}return R!==0&&m&&i.note(m),R}},{makeReconcileDeps:ie}=await import("./reconcile-deps-FYXRAMF2.js"),oe=ie({contextDir:n,...t.changeContext?{changeContext:t.changeContext}:{},note:s=>i.note(s)}),ae={verb:"extract",sid:t.resume??o.ids.session_id,env:U(),...t.source?{subject:t.source}:{}},I=r(E.createElement(h,null,E.createElement(j,{into:q}),E.createElement(u,{controller:i,verb:"extract",onCtrlC:te,chain:se,inspect:ne,reconcile:oe,meta:ae})),{exitOnCtrlC:!1});_(()=>I.unmount());let K=null;try{let s=z(t,{contextDir:n,agent:F,preflightTurn:x,onSummary:d=>{P=d},ask:d=>i.ask(d),review:async d=>new Map(d.map(c=>[c.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>i.note(d),progress:()=>{},isTTY:O(),auth:g,chat:i,telemetry:o});s.finally(()=>{V=!0});let l=await s;return K=l,l===1&&process.stderr.write(o.supportFooter()+`
|
|
8
8
|
`),await o.end({exit_code:l}),l}catch(s){throw P||(P={state:"crashed",facts:[`the session ended unexpectedly \u2014 ${s instanceof Error?s.name:"error"}`]}),s}finally{V=!0,G&&clearTimeout(G),i.finalizeForExit(),await q.current?.flush();try{I.unmount()}catch{}P?$(P):K===1&&$({state:"interrupted",facts:["the session ended without saving \u2014 see the error above"]})}}async function Ce(t){let n=H({verb:"extract",mode:t.mode,contextRoot:A(process.cwd()),env:U(),resumeSid:t.resume,write:!0,longSession:!0}),{makeHeadlessIO:o,resolveEncoding:f,guardedChannels:g}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:y,prepareStructuredResume:x}=await import("./structured-answers-5EY2AZN7.js"),r=y(o(f(t.mode),"extract")),{runWithChannel:v}=await import("./run-channel-RGH4WIQX.js"),h=f(t.mode)==="ndjson"?e=>v({event:a=>r.event(a)},e):e=>e();for(let e of t.landed??[]){let a=e;r.event({type:"ingested",source_id:e.source_id,status:e.status,cid:e.source_cid,...a.warnings?.length?{warnings:a.warnings}:{},...a.media?{media:a.media}:{},...a.duplicate_of?{duplicate_of:a.duplicate_of}:{},...a.lineage_candidate?{lineage_candidate:a.lineage_candidate}:{}})}let u;try{u=x({opts:t,contextDir:A(process.cwd()),verb:"extract"})}catch(e){let a=e instanceof Error?e.message:String(e);return r.out(`error: ${a}`),t.mode==="agent"&&r.event({type:"error",message:a}),await n.end({exit_code:1}),t.mode==="agent"?r.done(1,"error"):1}if(u.kind==="refuse")return r.out(u.error),t.mode==="agent"&&r.event({type:"error",message:u.error,code:u.code}),await n.end({exit_code:2}),t.mode==="agent"?r.done(2,"refused"):2;let j=t;if(u.kind==="apply"){for(let e of u.notes)r.out(e);if(u.matchedQids.length>0){r.out(`applying ${u.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let e of u.matchedQids)r.event({type:"panel_resolved",id:e,by:"user",via:"flag"})}u.statement&&(j={...t,message:[t.message,u.statement].filter(Boolean).join(`
|
|
9
9
|
|
|
10
10
|
`)})}let{makeInterruptGuard:Q}=await import("./interrupt-guard-UREUWNRL.js"),_=Q(F,e=>r.out(e)),M=g(r,()=>_.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let e=await h(async()=>{let a={...await Y(),...n.spawnEnv()};return z(j,{contextDir:A(process.cwd()),agent:_.agent,preflightTurn:()=>L(a),ask:async()=>[],review:async k=>new Map(k.map(E=>[E.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:M.out,emit:M.emit,progress:r.progress,isTTY:!1,auth:a,telemetry:n})});return _.interrupted()&&e!==3?(r.out("interrupted \u2014 no session saved"),await n.end({exit_code:130}),r.done(130)):(e===1&&r.out(n.supportFooter()),await n.end({exit_code:e}),r.done(e))}catch(e){return r.event({type:"error",message:`error: extract failed: ${e instanceof Error?e.message:String(e)}`}),r.out(`error: extract failed: ${e instanceof Error?e.message:String(e)}`),r.out('hint: the full trace is in the file named on the "trace:" line at the start of this run'),r.done(1)}finally{_.dispose()}}export{Ce as bindExtractHeadless,be as bindExtractInteractive};
|
|
@@ -2,4 +2,4 @@ import { createRequire } from 'module'; const require = createRequire(import.met
|
|
|
2
2
|
import{a as i}from"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";import{existsSync as u}from"fs";async function g(e){if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-66RG5NN5.js");return r(t("ndjson","extract"),`extract: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}let n=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
|
|
3
3
|
`),2;let{makeHeadlessIO:o,agentRefusal:c}=await import("./headless-io-66RG5NN5.js");return c(o("ndjson","extract"),t,r)};if(e.apply)return n("extract: --apply is not implemented yet \u2014 coming with the plan\u2192apply workflow (run without --apply, or use --plan to preview)");{let{validateResumeMessage:t}=await import("./headless-io-66RG5NN5.js"),r=t(e,"extract");if(r)return n(r)}{let{gateStructuredFlags:t}=await import("./structured-answers-5EY2AZN7.js"),r=t(e,"extract");if(r)return n(r,"STRUCTURED_FLAGS_USAGE")}if(e.withSource&&!e.resume)return n("extract: --with-source pairs with --resume \u2014 it lands the source and sets the resumed session's pending questions aside");if(e.queued)return n("extract: --queued is gone \u2014 extract sweeps every pending source by default (just run kane-cli context extract)");if(!u(i(process.cwd())))return n("error: no context store here (run `kane-cli context ingest <files>` first)","NO_STORE");if(!e.mode&&!process.stdin.isTTY)return process.stderr.write(`extract: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
|
|
4
4
|
`),2;let s=e.mode??"interactive";if(s==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`extract: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
5
|
-
`),2;let{bindExtractInteractive:t}=await import("./extract-bind-
|
|
5
|
+
`),2;let{bindExtractInteractive:t}=await import("./extract-bind-TJ2STXV5.js");return t(e)}let{bindExtractHeadless:a}=await import("./extract-bind-TJ2STXV5.js");return a({...e,mode:s})}export{g as extractCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-
|
|
2
|
+
import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-SS5TOK2J.js";import{b as k}from"./chunk-PT7V5WDQ.js";import{d as J}from"./chunk-D4SRHIJ5.js";import{c as x}from"./chunk-A44G533S.js";import"./chunk-VZ7KXRXB.js";import"./chunk-USI2WMAK.js";import"./chunk-TDPWFYTJ.js";import{a as A}from"./chunk-BRTARADN.js";import"./chunk-SQGBFCFO.js";import{h as H}from"./chunk-4ONGF4NT.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-LN7233E2.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-DN3E6RT6.js";import"./chunk-MSGW4JDG.js";import{m as E,n as q}from"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4JOD47QI.js";import"./chunk-5COGCNED.js";import"./chunk-FUNKVREV.js";import{a as R}from"./chunk-OYJBABRV.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import{a as j}from"./chunk-ZLSWHCWO.js";import"./chunk-OFW3ZVTP.js";import"./chunk-UR6MHSHU.js";import{join as se}from"path";async function V(t){let e=t.projectId,n=t.folderId,r=null;if(!e&&t.autoResolve){let l=await t.resolver.resolve();if(!l)throw new $("unauthorized; run `kane-cli login`");let u=await H({creds:t.autoResolve.creds,config:t.autoResolve.config,profile:t.autoResolve.profile,env:t.autoResolve.envName,tmsCreds:{username:l.username,access_key:l.access_key},isLocal:!1,log:t.log});u.status==="ok"&&(e=u.projectId,n=n??u.folderId,u.autoDefaulted&&(r={projectId:u.autoDefaulted.projectId,projectName:u.autoDefaulted.projectName,folderId:u.autoDefaulted.folderId,folderName:u.autoDefaulted.folderName}))}return{baseUrl:`${t.env.testGeneratorBaseUrl}/test-generator/api/v2`,tmsBaseUrl:t.env.tmsBaseUrl,authResolver:t.resolver,projectId:e,folderId:n,suiteName:t.suiteName,autoDefaulted:r,log:t.log}}function Z(t){return t.reduce((e,n)=>e+(n.test_cases?.length??0),0)}var y=class{constructor(e=n=>process.stdout.write(n)){this.write=e}emit(e){this.write(JSON.stringify(e)+`
|
|
3
3
|
`)}onStart(e){this.emit({type:"generate_start",request_id:e.requestId,objective_chars:e.objectiveChars,scenario_limit:e.scenarioLimit,per_scenario_limit:e.perScenarioLimit,is_refine:e.isRefine})}onUpload(e){this.emit({type:"generate_upload",file:e.file,index:e.index,total:e.total,status:e.status})}onThinking(e){this.emit({type:"generate_thinking",took_ms:e.tookMs})}onProgress(e){this.emit({type:"generate_progress",pct:e})}onSnapshot(e){this.emit({type:"generate_snapshot",scenario_count:e.scenarios.length,case_count:Z(e.scenarios),scenarios:e.scenarios})}onClarification(e){this.emit({type:"generate_clarification",text:e})}onChat(e){this.emit({type:"generate_chat",text:e})}onError(e){this.emit({type:"error",message:e})}onSaveResult(e){this.emit({type:"generate_save_result",suite_dir:e.suiteDir,saved:e.saved,fell_back:e.fellBack,...e.warning?{warning:e.warning}:{}})}onDone(e){this.emit({type:"generate_done",request_id:e.requestId,status:e.status,scenario_count:e.scenarioCount,case_count:e.caseCount,refine_hint:e.refineHint,save_hint:e.saveHint,...e.suiteDir?{suite_dir:e.suiteDir}:{}})}onUpdateAvailable(e){this.emit({type:"update_available",current:e.current,latest:e.latest,severity:e.severity})}},S=class{constructor(e=n=>process.stdout.write(n)){this.write=e}onStart(e){let n=e.isRefine?"Refining":"Generating";this.write(`${n} (request ${e.requestId})\u2026
|
|
4
4
|
`)}onUpload(e){e.status==="uploading"&&this.write(` uploading ${e.file} (${e.index}/${e.total})
|
|
5
5
|
`)}onThinking(e){let n=e.tookMs?` (${Math.round(e.tookMs/1e3)}s)`:"";this.write(` thinking${n}
|
|
@@ -16,6 +16,6 @@ import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p a
|
|
|
16
16
|
`),this.write(` Save: ${e.saveHint}
|
|
17
17
|
`),e.suiteDir&&this.write(` Saved: ${e.suiteDir}
|
|
18
18
|
`)}onUpdateAvailable(e){this.write(`(update available: ${e.current} \u2192 ${e.latest})
|
|
19
|
-
`)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-
|
|
19
|
+
`)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-3KS7KTME.js");n(i(d))}try{let i=await(e.checkUpdate??J)();i&&r.onUpdateAvailable(i)}catch{}let g=t.reqId??null;E(X,()=>{g&&l.cancel(g).catch(()=>{})});let p=process.cwd(),v={validate:e.validate??z,upload:e.upload??O,buildMappings:K,onUpload:i=>r.onUpload(i)};try{if(t.op==="save"){let s;try{s=(await l.attach(t.reqId)).state}catch(D){return r.onError(D.message),2}g=s.requestId,r.onSnapshot(s);let m=t.outDir??ie(),o=await e.materialize(s,m,t.suiteName);r.onSaveResult({suiteDir:o.suiteDir,saved:o.paths.length,fellBack:o.fellBack,warning:o.warning});let h=Q(s.requestId);return r.onDone({requestId:s.requestId,status:"completed",scenarioCount:s.scenarios.length,caseCount:W(s),refineHint:h.refineHint,saveHint:h.saveHint,suiteDir:o.suiteDir}),0}let i=t.op==="refine",f,a;if(i){let s;try{s=await l.attach(t.reqId)}catch(o){return r.onError(o.message),2}if(a=s.state,g=a.requestId,a.error)return r.onError(a.error),2;let m;try{m=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:a.scenarios,isRefine:!0,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of m.warnings)process.stderr.write(`warning: ${o}
|
|
20
20
|
`);r.onStart({requestId:a.requestId,objectiveChars:m.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!0});try{await l.chat(t.reqId,m.promptText,{mappings:m.mappings,attachments:m.attachments})}catch(o){return r.onError(o.message),2}f=s.events}else{let s;try{s=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:[],isRefine:!1,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of s.warnings)process.stderr.write(`warning: ${o}
|
|
21
21
|
`);let m;try{m=await l.start({prompt:s.promptText,attachments:s.attachments,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,memoryEnhancement:t.memory})}catch(o){return r.onError(o.message),2}a=m.state,g=a.requestId,r.onStart({requestId:a.requestId,objectiveChars:s.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!1}),f=m.events}let w="";for await(let s of f){switch(a=P(a,s),s.type){case"thinking_done":r.onThinking({tookMs:s.tookMs});break;case"progress":r.onProgress(s.pct);break;case"clarification":r.onClarification(s.text);break;case"chat":r.onChat(s.text);break;case"error":r.onError(s.message);break;case"done":w=s.status;break;default:break}if(s.type==="done"||s.type!=="thinking"&&a.status&&T(a.status))break}r.onSnapshot(a);let b=w||a.status||"completed",c=Q(a.requestId);return r.onDone({requestId:a.requestId,status:b,scenarioCount:a.scenarios.length,caseCount:W(a),refineHint:c.refineHint,saveHint:c.saveHint,suiteDir:void 0}),oe(b)}finally{q(X)}}var ae=()=>{};async function Me(t){let e=new j,n=new A,r=e.getActiveProfile()??"default",l=t.env??e.getDefaultEnv()??"prod",u=R(l),d=new x;t.name&&d.setSessionName(t.name);let g=n.load().model,p=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}}),f=await V({resolver:i.resolver,env:u,log:ae,projectId:t.projectId,folderId:t.folderId,autoResolve:t.projectId?void 0:{creds:e,config:n,profile:r,envName:l}});return{client:G(f),conn:f,autoDefaulted:f.autoDefaulted??null}},v=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}});return i.basicAuth?{username:i.basicAuth.username,access_key:i.basicAuth.access_key}:i.token?{auth:{type:"bearer",token:i.token}}:{}};return{mode:t.mode,makeClient:p,materialize:(i,f,a)=>Y(i,f,{model:g,sessionId:d.sessionId,resolveAuth:v,spawnOpts:{environment:l},suiteName:a})}}export{Me as buildHeadlessDeps,Pe as decideGenerateMode,ie as defaultOutDir,Ge as parseFilesFlag,$e as resolveGenerateOp,Ne as runGenerateHeadless};
|