sootsim 0.1.65 → 0.1.67
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-cli/bin.js +3 -3
- package/dist-cli/chunks/{agent-44BHCTZA.js → agent-Z45KTLTP.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-BEP5WHZR.js → agent-wrapper-EEKVEJOC.js} +2 -2
- package/dist-cli/chunks/{assert-SKDEGGRD.js → assert-MDYZKXZ6.js} +2 -2
- package/dist-cli/chunks/auto-bootstrap-YZ6C6VYO.js +2 -0
- package/dist-cli/chunks/beta-WXH75XUE.js +2 -0
- package/dist-cli/chunks/chunk-2HKCZLY7.js +372 -0
- package/dist-cli/chunks/{chunk-46OKLW3Z.js → chunk-2I535GZU.js} +1 -1
- package/dist-cli/chunks/{chunk-L2SDB6G5.js → chunk-3KVVIZ6M.js} +2 -2
- package/dist-cli/chunks/chunk-42NMKOVE.js +3 -0
- package/dist-cli/chunks/{chunk-S46M5JZP.js → chunk-4H6LBA4A.js} +1 -1
- package/dist-cli/chunks/{chunk-M4HI2THN.js → chunk-4QSGVTBE.js} +2 -2
- package/dist-cli/chunks/{chunk-MLPLYQGK.js → chunk-52RZ6TSZ.js} +3 -3
- package/dist-cli/chunks/{chunk-ELZHT3LB.js → chunk-5WRBVYML.js} +2 -2
- package/dist-cli/chunks/{chunk-NJ2ACA36.js → chunk-67566AJS.js} +2 -2
- package/dist-cli/chunks/chunk-6O64VUC6.js +2 -0
- package/dist-cli/chunks/chunk-7PQHQOCI.js +186 -0
- package/dist-cli/chunks/{chunk-5ZB5ZN5Z.js → chunk-AQ7YR4MO.js} +14 -14
- package/dist-cli/chunks/{chunk-FRANP4PR.js → chunk-ATRGAFJD.js} +1 -1
- package/dist-cli/chunks/{chunk-OTWUZRFZ.js → chunk-BCVVANS5.js} +2 -2
- package/dist-cli/chunks/chunk-CUNQTNH4.js +35 -0
- package/dist-cli/chunks/{chunk-JC5L5ZJX.js → chunk-DOWYG3HG.js} +2 -2
- package/dist-cli/chunks/{chunk-MSBMGQJE.js → chunk-EJTXYZEF.js} +128 -36
- package/dist-cli/chunks/{chunk-P2C3JX3D.js → chunk-F23Y4HMT.js} +1 -1
- package/dist-cli/chunks/{chunk-GHFA4O5B.js → chunk-F4RC4AOY.js} +1 -1
- package/dist-cli/chunks/chunk-GFVC6EEB.js +1 -0
- package/dist-cli/chunks/{chunk-TWKWXGN5.js → chunk-HW5YHSIE.js} +1 -1
- package/dist-cli/chunks/{chunk-VGQXIMEX.js → chunk-IB4BRND4.js} +1 -1
- package/dist-cli/chunks/{chunk-X75XFMI4.js → chunk-IBWN764Q.js} +2 -2
- package/dist-cli/chunks/chunk-JE4JBSNJ.js +119 -0
- package/dist-cli/chunks/{chunk-O56DABNK.js → chunk-K4PKR2EO.js} +2 -2
- package/dist-cli/chunks/chunk-KBJ2WHII.js +73 -0
- package/dist-cli/chunks/chunk-KR36VJSN.js +1 -0
- package/dist-cli/chunks/{chunk-UHYZO26V.js → chunk-LQ5BA5JU.js} +2 -2
- package/dist-cli/chunks/chunk-MIAAZSSE.js +12 -0
- package/dist-cli/chunks/{chunk-PTUCXL7Y.js → chunk-N4JRDJMN.js} +3 -3
- package/dist-cli/chunks/{chunk-U5EQ5RWL.js → chunk-NYR3Z44O.js} +2 -2
- package/dist-cli/chunks/{chunk-2EBGZC4A.js → chunk-O624O5MO.js} +2 -2
- package/dist-cli/chunks/{chunk-HNXQ2JP6.js → chunk-SH6HMUCY.js} +2 -2
- package/dist-cli/chunks/chunk-SVFSMAZN.js +2 -0
- package/dist-cli/chunks/chunk-TEMZK6Q2.js +1 -0
- package/dist-cli/chunks/{chunk-KKOOZPQP.js → chunk-TLTS533S.js} +1 -1
- package/dist-cli/chunks/chunk-U47AHSGE.js +23 -0
- package/dist-cli/chunks/{chunk-6GZS5TCL.js → chunk-XCRUPKWB.js} +2 -2
- package/dist-cli/chunks/{chunk-5MMRIGC3.js → chunk-YGQV3CUV.js} +2 -2
- package/dist-cli/chunks/{chunk-GZCZ4GCS.js → chunk-ZJJKYJMH.js} +2 -2
- package/dist-cli/chunks/{chunk-FU33BTPL.js → chunk-ZO7SGE65.js} +1 -1
- package/dist-cli/chunks/{chunk-UH4H5HXN.js → chunk-ZP2HMCKS.js} +1 -1
- package/dist-cli/chunks/cli-version-5LGQQE5P.js +2 -0
- package/dist-cli/chunks/{compat-MDZTV64M.js → compat-5MMZ4R3Q.js} +3 -3
- package/dist-cli/chunks/{config-DRGNQOYL.js → config-YWN44WJQ.js} +2 -2
- package/dist-cli/chunks/control-LUCFDAZI.js +2 -0
- package/dist-cli/chunks/{cpu-profile-JQAGHLDS.js → cpu-profile-VFGUVXU5.js} +2 -2
- package/dist-cli/chunks/{daemon-3RT7EABW.js → daemon-ONX5ZBXF.js} +2 -2
- package/dist-cli/chunks/{debug-CYINYNWV.js → debug-CPOG32OT.js} +5 -5
- package/dist-cli/chunks/demo-app-registry-LWT6JLU6.js +2 -0
- package/dist-cli/chunks/{detox-DUABQYC6.js → detox-J6NGSZR5.js} +2 -2
- package/dist-cli/chunks/{device-KSSSQOQC.js → device-QYOQXI2P.js} +2 -2
- package/dist-cli/chunks/{diagnose-NUDACXIR.js → diagnose-MMW4LJLA.js} +2 -2
- package/dist-cli/chunks/drivers-NRWUJJCD.js +2 -0
- package/dist-cli/chunks/{electron-LC3Y74FA.js → electron-IK3HIZY4.js} +3 -3
- package/dist-cli/chunks/flow-2MB7HINM.js +2 -0
- package/dist-cli/chunks/{hints-EOARRVNB.js → hints-KZOD56U5.js} +2 -2
- package/dist-cli/chunks/{home-paths-HOBR3K3B.js → home-paths-R2YZZTUM.js} +2 -2
- package/dist-cli/chunks/inspect-ZARO3HQ4.js +970 -0
- package/dist-cli/chunks/install-O67RTYCX.js +2 -0
- package/dist-cli/chunks/{install-desktop-W2OOILJG.js → install-desktop-4GH5I7SC.js} +3 -3
- package/dist-cli/chunks/{keys-RR43E2O3.js → keys-AXEFZUUI.js} +2 -2
- package/dist-cli/chunks/{launch-GAPSA5HQ.js → launch-QLE56ON7.js} +3 -3
- package/dist-cli/chunks/{login-IADXSJEW.js → login-J45NQQM6.js} +4 -4
- package/dist-cli/chunks/{logout-AT33MGA7.js → logout-ZE5OUBB7.js} +2 -2
- package/dist-cli/chunks/{maestro-G36ATKHQ.js → maestro-FS6CAKDD.js} +2 -2
- package/dist-cli/chunks/{preview-BJUMMDBL.js → preview-TSU5IXVR.js} +2 -2
- package/dist-cli/chunks/{profile-CEQNS53P.js → profile-ZBJ4TYWA.js} +2 -2
- package/dist-cli/chunks/{react-BPEDK3TN.js → react-TGZLTTYN.js} +2 -2
- package/dist-cli/chunks/record-JSBFUNOD.js +54 -0
- package/dist-cli/chunks/runtime-DGDQ7NVY.js +2 -0
- package/dist-cli/chunks/{runtime-delivery-IYK2HNPG.js → runtime-delivery-36UMAXOV.js} +2 -2
- package/dist-cli/chunks/screenshot-3CHMALUJ.js +33 -0
- package/dist-cli/chunks/{screenshot-mode-VUBCO7T2.js → screenshot-mode-C547UT5H.js} +2 -2
- package/dist-cli/chunks/{screenshots-JENURQSV.js → screenshots-XCNGSNYG.js} +2 -2
- package/dist-cli/chunks/{server-PVAO3OA2.js → server-W37X3IW7.js} +6 -6
- package/dist-cli/chunks/setup-repo-DETS5ZJT.js +2 -0
- package/dist-cli/chunks/{skills-4JI327YS.js → skills-OXZLDNDW.js} +2 -2
- package/dist-cli/chunks/{start-7YB4I5V5.js → start-N6ZQYUBP.js} +4 -4
- package/dist-cli/chunks/store-QOXJKJUZ.js +2 -0
- package/dist-cli/chunks/telemetry-74LX7WG4.js +2 -0
- package/dist-cli/chunks/{test-5C6NYF62.js → test-DWZ7PRSW.js} +3 -3
- package/dist-cli/chunks/{three-mode-C6TE63VR.js → three-mode-P2R7KA62.js} +2 -2
- package/dist-cli/chunks/{timeline-NFYS6IPO.js → timeline-VPES3YCN.js} +3 -3
- package/dist-cli/chunks/{upgrade-KROEHYG2.js → upgrade-NYQLA4UJ.js} +2 -2
- package/dist-cli/chunks/upload-YOMMYESV.js +2 -0
- package/dist-cli/chunks/{web-UTOZ7MRF.js → web-OTALJKK5.js} +2 -2
- package/dist-cli/chunks/what-happened-GZ73H6KF.js +22 -0
- package/dist-cli/chunks/{whoami-O6XVOJBF.js → whoami-UDLQK7IY.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +9 -2
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +23 -7
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/vite-base.cjs +23 -7
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/auto-bootstrap-SMQMN7WS.js +0 -2
- package/dist-cli/chunks/beta-DEQZ2J7G.js +0 -2
- package/dist-cli/chunks/chunk-3HC3F7CO.js +0 -3
- package/dist-cli/chunks/chunk-5MRRLWSD.js +0 -1
- package/dist-cli/chunks/chunk-B32KMMQV.js +0 -2
- package/dist-cli/chunks/chunk-CBRKFAOD.js +0 -1
- package/dist-cli/chunks/chunk-DLSOZVYM.js +0 -1
- package/dist-cli/chunks/chunk-E6CRWOWO.js +0 -2
- package/dist-cli/chunks/chunk-FPOQPEGK.js +0 -11
- package/dist-cli/chunks/chunk-GHTXP5R7.js +0 -348
- package/dist-cli/chunks/chunk-NTEZEQSB.js +0 -100
- package/dist-cli/chunks/chunk-R2QEABGZ.js +0 -119
- package/dist-cli/chunks/chunk-TRHZBTPF.js +0 -34
- package/dist-cli/chunks/chunk-UXFF7AEE.js +0 -73
- package/dist-cli/chunks/chunk-X2IIAIAP.js +0 -3
- package/dist-cli/chunks/chunk-ZW3HKMLQ.js +0 -17
- package/dist-cli/chunks/cli-version-HH7DAYBK.js +0 -2
- package/dist-cli/chunks/control-NCUWAXPH.js +0 -2
- package/dist-cli/chunks/demo-app-registry-JGIZ7NN7.js +0 -2
- package/dist-cli/chunks/drivers-CKGMOVM4.js +0 -2
- package/dist-cli/chunks/flow-3AHNNHF7.js +0 -2
- package/dist-cli/chunks/inspect-QCZVODE6.js +0 -1025
- package/dist-cli/chunks/install-747G2O4S.js +0 -2
- package/dist-cli/chunks/record-73CGQ3EP.js +0 -50
- package/dist-cli/chunks/runtime-QR5IHGKJ.js +0 -2
- package/dist-cli/chunks/screenshot-GUM2U2PN.js +0 -28
- package/dist-cli/chunks/setup-repo-ECVECJZQ.js +0 -2
- package/dist-cli/chunks/store-2MXXL4QE.js +0 -2
- package/dist-cli/chunks/telemetry-GIA7FIKW.js +0 -2
- package/dist-cli/chunks/upload-OS3J5ZOS.js +0 -2
- package/dist-cli/chunks/what-happened-FCP2U43H.js +0 -15
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as o}from"./chunk-L2SDB6G5.js";import"./chunk-FRANP4PR.js";import"./chunk-PTUCXL7Y.js";import"./chunk-JC5L5ZJX.js";import"./chunk-2EBGZC4A.js";import"./chunk-ZW3HKMLQ.js";import"./chunk-VGQXIMEX.js";import"./chunk-E6CRWOWO.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";async function t(n){console.error(" note: `sootsim install` is now `sootsim setup-repo`. forwarding\u2026\n"),await o(n)}export{t as runInstall};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as C}from"./chunk-HNXQ2JP6.js";import"./chunk-UXFF7AEE.js";import{d as X}from"./chunk-UHYZO26V.js";import"./chunk-CBRKFAOD.js";import{d as H}from"./chunk-UH4H5HXN.js";import"./chunk-JC5L5ZJX.js";import"./chunk-2EBGZC4A.js";import{c as w,e as h}from"./chunk-ZW3HKMLQ.js";import{b as K}from"./chunk-VGQXIMEX.js";import"./chunk-E6CRWOWO.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";import{existsSync as ue,mkdirSync as O,readdirSync as me,readFileSync as fe,rmSync as W,writeFileSync as U}from"fs";import{homedir as pe,tmpdir as ge}from"os";import{dirname as P,extname as Y,join as E,resolve as we}from"path";var Q=6e4,he=3e4;async function N(e,r,o,i){let t=Math.max(2e4,i+he);try{return await e.send({type:"evaluate",code:r},{timeoutMs:t})}catch(n){let s=n instanceof Error?n.message:String(n);/^command timed out after \d+s$/.test(s)&&(console.error(` ${o} stalled \u2014 the render host did not finish within ${Math.round(t/1e3)}s; it is likely contended or wedged.
|
|
3
|
-
the capture lock auto-releases, so simply retry the recording.
|
|
4
|
-
if it persists, recover the sim with \`sootsim close --sim <id>\`.`),process.exit(1)),/render host not available|already streaming|already recording/i.test(s)&&(console.error(` ${o} failed: ${s}
|
|
5
|
-
a prior recording was abandoned and its capture is still
|
|
6
|
-
releasing. the lock self-heals in ~${Math.round((i+2e4)/1e3)}s \u2014 retry then, or recover now with
|
|
7
|
-
\`sootsim close --sim <id>\` and reopen the sim.`),process.exit(1)),console.error(` ${o} failed: ${s}`),process.exit(1)}}var be=new Set(["--sim","--port","-p","--mode","--duration","--fps","--format","--output","-o","--frames","--max-width","--origin"]),ve=new Set(["start","stop","cancel","status","prelude-start"]);function ye(e){for(let r=0;r<e.length;r++){let o=e[r];if(o.startsWith("-")){be.has(o)&&r++;continue}return ve.has(o)?{name:o,index:r}:null}return null}async function De(e,r){let o=ye(e);if(o){let a=[...e.slice(0,o.index),...e.slice(o.index+1)];if(o.name==="start"){await ke(a,r);return}if(o.name==="prelude-start"){await Oe(a,r);return}if(o.name==="stop"){await Ie(a,r);return}if(o.name==="cancel"){await Me(a,r);return}await Be(a,r);return}let i=w(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width","--origin"]}),t=oe(u(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=u(e,"--format");s&&!["webm","mp4","gif","png"].includes(s)&&(console.error(` invalid --format "${s}" \u2014 expected webm | mp4 | gif | png`),process.exit(1));let l=u(e,"--output"),d=Number(u(e,"--duration")??"10");(!Number.isFinite(d)||d<=0)&&(console.error(` invalid --duration "${u(e,"--duration")}" \u2014 expected a positive number of seconds`),process.exit(1));let c=1800;d>c&&(console.error(` invalid --duration "${u(e,"--duration")}" \u2014 exceeds the ${c}s (30m) maximum`),process.exit(1));let f=Number(u(e,"--fps")??"30"),b=u(e,"--frames");if(b!==void 0){let a=Number(b);(!Number.isInteger(a)||a<=0)&&(console.error(` invalid --frames "${b}" \u2014 expected a positive integer count`),process.exit(1))}let V=e.includes("--open"),j=u(e,"--max-width")?Number(u(e,"--max-width")):void 0,p=Math.max(100,Math.round(d*1e3)),q=u(e,"--origin");if(t==="live"||t==="combined"){l&&console.log(` note: --output is ignored for --mode ${t} \u2014 the recording uploads to /preview/<id>`),n&&t==="live"&&console.log(` note: --${n==="shell"?"shell-only":"no-shell"} is ignored for --mode live \u2014 live recordings capture events only, no video`),await C("record",{originOverride:q,allowGitHubAuth:!0});let a=h({...i,commandTimeoutMs:6e4});try{await G(a),await te(a,t),await ne(a,q);let R=await ie(a,t,t==="combined"?n:void 0);R.ok||(console.error(` start failed: recording store refused to start (${t})`+(R.error?`: ${R.error}`:"")),process.exit(1)),console.log(` recording ${t} for ${d}s`),await new Promise(x=>setTimeout(x,p)),await se(a);let _=await ae(a);de(_,V,t)}finally{a.close()}return}let A=b?Number(b):null,$=Re(s,l,A);V&&console.log(" note: --open is ignored for local-file capture \u2014 it applies to --mode live/combined");let v=h({...i,commandTimeoutMs:6e4});try{if(await Z(v),$==="png"){let S=A??10,g=I(l,`sootsim-frames-${M()}`);l&&Y(l)&&console.log(` note: --frames writes multiple pngs, so --output "${l}" is a directory \u2014 frame-NNN.png files land inside it`),O(g,{recursive:!0});for(let m of me(g))/^frame-\d+\.png$/.test(m)&&W(E(g,m),{force:!0});console.log(` sampling ${S} frames over ${d}s \u2192 ${g}`);let y=await v.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${S}, durationMs: ${p}${n?`, layers: ${JSON.stringify(n)}`:""} })`});(!y.ok||!y.requestId)&&(console.error(` frame capture start failed: ${y.error??"unknown error"}`),process.exit(1)),await new Promise(m=>setTimeout(m,p));let le=Date.now()+Math.max(5e3,p),F=null;for(;;){let m=await v.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${y.requestId})`});if(m||(console.error(" frame capture result missing"),process.exit(1)),m.done){m.ok||(console.error(` frame capture failed: ${m.error??"unknown error"}`),process.exit(1)),F=m.frames??[];break}Date.now()>=le&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(T=>setTimeout(T,100))}F.forEach((m,T)=>{let ce=`${g}/frame-${String(T+1).padStart(3,"0")}.png`;U(ce,Buffer.from(m.data,"base64"))}),console.log(` saved ${F.length} frames`);return}if($==="gif"){let S=A??Math.max(10,Math.round(d*f/3)),g=I(l,`sootsim-${M()}.gif`);O(P(g),{recursive:!0}),console.log(` encoding gif: ${S} frames over ${d}s \u2192 ${g}`);let y=await N(v,`window.__sootsimRecorder.captureGif({ frames: ${S}, durationMs: ${p}${j?`, maxWidth: ${j}`:""}${n?`, layers: ${JSON.stringify(n)}`:""} })`,"gif encode",p);y||(console.error(" gif capture returned no frames"),process.exit(1)),U(g,Buffer.from(y.data,"base64")),console.log(` saved: ${g} (${D(y.size)})`);return}let a=I(l,`sootsim-${M()}.${$}`);O(P(a),{recursive:!0});let R={format:$,fps:f,durationMs:p};n&&(R.layers=n);let _=await N(v,`window.__sootsimRecorder.start(${JSON.stringify(R)})`,`${$} start`,p);_.ok||(console.error(` start failed: ${_.error??"unknown error"}`),/render host not available|already streaming|already recording/i.test(_.error??"")&&console.error(" a prior recording was abandoned and its capture is still\n releasing. retry in ~20s, or recover now with\n `sootsim close --sim <id>` then reopen the sim."),process.exit(1)),console.log(` recording ${$} for ${d}s \u2192 ${a}`),await new Promise(S=>setTimeout(S,p));let x=await N(v,"window.__sootsimRecorder.stop()",`${$} encode/flush`,p);x.ok||(console.error(` stop failed: ${x.error??"unknown error"}`),process.exit(1)),x.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await ee(v,a),console.log(` saved: ${a} (${D(x.size)})`)}finally{v.close()}}var $e=6e3;async function z(e,r){try{return await e.send({type:"evaluate",code:r},{timeoutMs:$e})}catch(o){let i=o instanceof Error?o.message:String(o);throw/^command timed out after \d+s$/.test(i)&&(console.error(" sim did not respond \u2014 it is connected to the bridge but has not\n loaded an app (or its page is unresponsive). run `sootsim list`\n and target a sim with a loaded app via --sim <id>."),process.exit(1)),o}}async function Z(e){await z(e,'typeof window.__sootsimRecorder !== "undefined"')||(console.error(" window.__sootsimRecorder missing \u2014 is sootsim engine running in this sim?"),process.exit(1))}async function ee(e,r){let o=[],i=0;for(;;){let t=await e.send({type:"evaluate",code:`window.__sootsimRecorder.getBlobBase64({ offset: ${i}, chunk: 2097152 })`});if(!t)throw new Error("no blob available on recorder");if(o.push(Buffer.from(t.data,"base64")),i=t.offset,t.done)break}U(r,Buffer.concat(o))}function u(e,r){let o=e.indexOf(r);if(!(o<0||o===e.length-1))return e[o+1]}function Se(e){if(!e)return;let r=Y(e).toLowerCase().replace(/^\./,"");if(r==="webm"||r==="mp4"||r==="gif")return r;if(r==="png")return"png"}function Re(e,r,o){return e||(o!=null?"png":Se(r)??"webm")}function M(){return new Date().toISOString().replace(/[:T]/g,"-").replace(/\..+/,"")}function xe(){let e=E(pe(),".sootsim","recordings");return O(e,{recursive:!0}),e}function I(e,r){return e?we(process.cwd(),e):E(xe(),r)}function D(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(2)}MB`}function oe(e){if(!e)return"video";if(e==="video"||e==="live"||e==="combined")return e;console.error(` invalid --mode "${e}" \u2014 expected video | live | combined`),process.exit(1)}function J(){return E(ge(),`sootsim-recording-${K()}.json`)}function B(){let e=J();if(!ue(e))return null;try{return{mode:"video",...JSON.parse(fe(e,"utf8"))}}catch{return W(e,{force:!0}),null}}function _e(e){U(J(),JSON.stringify(e,null,2))}function k(){W(J(),{force:!0})}function L(e,r){e&&r.simId&&e!==r.simId&&console.log(` note: the tracked recording session is on sim ${r.simId}, not the
|
|
8
|
-
requested sim ${e}. record state is global (not per-sim);
|
|
9
|
-
this command acts on that session regardless of --sim.`)}async function ke(e,r){let o=B();o&&(console.error(` recording already in progress (started ${o.startedAt}, sim ${o.simId??"?"}). run \`sootsim record stop\` first, or \`sootsim record cancel\` to discard.`),process.exit(1));let i=w(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only"],stripValueFlags:["--mode","--fps","--format","--max-width","--origin"]}),t=oe(u(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=u(e,"--format"),l=s==="mp4"?"mp4":"webm";s&&l!==s&&(console.error(` record start only supports webm or mp4 (got: ${s}). for gif/png use atomic mode: sootsim record --format ${s} --duration <s>`),process.exit(1));let d=Number(u(e,"--fps")??"30"),c=h({...i,commandTimeoutMs:15e3});try{if(t==="live"||t==="combined"){n&&t==="live"&&console.log(` note: --${n==="shell"?"shell-only":"no-shell"} is ignored for --mode live \u2014 live recordings capture events only, no video`),await C("record",{originOverride:u(e,"--origin"),allowGitHubAuth:!0}),await G(c),await te(c,t),await ne(c,u(e,"--origin"));let f=await ie(c,t,t==="combined"?n:void 0);f.ok||(console.error(` start failed: recording store refused to start (${t})`+(f.error?`: ${f.error}`:"")),process.exit(1))}else{await Z(c);let f={format:l,fps:d};n&&(f.layers=n);let b=await c.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(f)})`});b.ok||(console.error(` start failed: ${b.error??"unknown error"}`),process.exit(1))}_e({simId:i.simId??null,mode:t,format:l,fps:d,layers:n,startedAt:new Date().toISOString()}),console.log(t==="video"?` recording ${l} @ ${d}fps${n?` (${n})`:""} \u2014 run \`sootsim record stop --output <path>\` when done`:` recording ${t} \u2014 run \`sootsim record stop\` when done (add --open to launch the preview URL)`)}finally{c.close()}}async function Oe(e,r){let o=B();o&&(console.error(` recording already in progress (started ${o.startedAt}, sim ${o.simId??"?"}). run \`sootsim record stop\` first, or \`sootsim record cancel\` to discard.`),process.exit(1));let i=w(e,{port:r.port,stripBooleanFlags:[],stripValueFlags:["--origin"]}),t=h({...i,commandTimeoutMs:15e3});try{if(await G(t),!await t.send({type:"evaluate",code:`(() => {
|
|
10
|
-
const start = window.SootSim?.bridges?.startRecordingPrelude
|
|
11
|
-
if (typeof start !== 'function') return false
|
|
12
|
-
return Promise.resolve(start()).then((value) => value === true)
|
|
13
|
-
})()`})){let s=await t.send({type:"evaluate",code:`(() => {
|
|
14
|
-
const getError = window.SootSim?.bridges?.getRecordingStartError
|
|
15
|
-
return typeof getError === 'function' ? getError() : null
|
|
16
|
-
})()`}).catch(()=>null);console.error(` prelude start failed: recording store refused to start${typeof s=="string"&&s?` (${s})`:""}`),process.exit(1)}console.log(" recording preview prelude \u2014 run `sootsim record start --mode combined` when the visible proof segment is ready")}finally{t.close()}}async function re(e){try{let r=await e.send({type:"evaluate",code:`(() => {
|
|
17
|
-
const store = window.SootSim?.bridges?.getRecordingState?.();
|
|
18
|
-
const headless = window.__sootsimRecorder?.state?.();
|
|
19
|
-
return { store: store ? store.state : undefined, headless };
|
|
20
|
-
})()`});return r?r.store==="recording"||r.headless==="recording"?"recording":r.store==="processing"?"processing":r.store==="idle"||r.headless==="idle"?"idle":null:null}catch{return null}}async function Be(e,r){let o=B();if(o){L(w(e,{port:r.port}).simId,o),o.mode==="video"?console.log(` recording ${o.mode} (${o.format} @ ${o.fps}fps) on sim ${o.simId??"?"} since ${o.startedAt}`):console.log(` recording ${o.mode} on sim ${o.simId??"?"} since ${o.startedAt}`);return}let i=w(e,{port:r.port}),t=h({...i,commandTimeoutMs:8e3});try{let n=await re(t);console.log(n==="recording"||n==="processing"?` a recording is in progress (engine state: ${n}), but not via
|
|
21
|
-
\`record start\` \u2014 it was started by an atomic \`record --duration\`
|
|
22
|
-
run or the in-browser record button, which own their own lifecycle.
|
|
23
|
-
if that controlling run is still alive it will finish on its own
|
|
24
|
-
(atomic \`--mode video/gif/png\` writes a local file from that
|
|
25
|
-
process; live/combined upload to /preview/<id>). if the run was
|
|
26
|
-
killed, the recording is abandoned and will NOT finish \u2014 reclaim
|
|
27
|
-
it now with \`sootsim record cancel\`, or it auto-reclaims when the
|
|
28
|
-
abandoned capture's deadline lapses.`:" no recording in progress")}finally{t.close()}}async function Me(e,r){let o=B();if(!o){let s=w(e,{port:r.port}),l=h({...s,commandTimeoutMs:8e3});try{let d=await re(l);if(d==="recording"||d==="processing"){let c=await l.send({type:"evaluate",code:`(async () => {
|
|
29
|
-
const r = window.__sootsimRecorder;
|
|
30
|
-
if (r && typeof r.forceRelease === 'function') return await r.forceRelease();
|
|
31
|
-
return false;
|
|
32
|
-
})()`}).catch(()=>!1);console.log(c?" reclaimed an abandoned recording (started by an atomic\n `record --duration` run or the record button whose owner is\n gone). the recorder is idle again \u2014 live/combined can start.":" a recording is in progress and still owned by a live atomic\n `record --duration` run or the in-browser record button \u2014 it\n will finish on its own and nothing was reclaimed.")}else console.log(" no recording in progress")}finally{l.close()}return}let i=w(e,{port:r.port});L(i.simId,o);let t=o.simId??i.simId??void 0,n=h({...i,simId:t,commandTimeoutMs:15e3});try{o.mode==="live"||o.mode==="combined"?await n.send({type:"evaluate",code:"void window.SootSim?.bridges?.cancelRecording?.()"}):await n.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"})}catch{}finally{k(),n.close()}console.log(" recording cancelled")}async function Ie(e,r){let o=B();o||(console.error(" no recording in progress. start one with `sootsim record start`."),process.exit(1));let i=w(e,{port:r.port,stripBooleanFlags:["--open"],stripValueFlags:["--output"]});L(i.simId,o);let t=o.simId??i.simId??void 0,n=e.includes("--open"),s=h({...i,simId:t,commandTimeoutMs:6e4});try{if(o.mode==="live"||o.mode==="combined"){await se(s);let f=await ae(s);k(),de(f,n,o.mode);return}let l=u(e,"--output"),d=I(l,`sootsim-${M()}.${o.format}`);O(P(d),{recursive:!0});let c=await s.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});c.ok||(console.error(` stop failed: ${c.error??"unknown error"}`),k(),process.exit(1)),c.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),k(),process.exit(1)),await ee(s,d),k(),console.log(` saved: ${d} (${D(c.size)})`)}finally{s.close()}}async function G(e){await z(e,'typeof window.SootSim?.bridges?.startRecording === "function" && typeof window.SootSim?.bridges?.stopRecording === "function"')||(console.error(" SootSim.bridges.startRecording missing \u2014 is sootsim engine running in this sim?"),process.exit(1))}async function te(e,r){await z(e,`(() => {
|
|
33
|
-
const fn = window.__sootsimCaptureBundle
|
|
34
|
-
if (typeof fn !== 'function') return false
|
|
35
|
-
const snap = fn()
|
|
36
|
-
return !!(snap && snap.bundleUrl)
|
|
37
|
-
})()`)||(console.error(` --mode ${r} needs a guest app bundle to upload to /preview/<id>,
|
|
38
|
-
but this sim has no bundle loaded (a built-in shell screen like
|
|
39
|
-
photos/settings/home has none). open a metro/guest app first, or
|
|
40
|
-
use \`--mode video\` for a local screen recording with no upload.`),process.exit(1))}async function ne(e,r){let o=X();if(!o)return;let i=o.kind==="api-key"?o.secret:o.token,t=o.kind==="github"?{repoId:o.repoId,installationId:o.installationId}:null,n=r?r.replace(/\/$/,""):null;await e.send({type:"evaluate",code:`(() => {
|
|
41
|
-
const set = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.setSession
|
|
42
|
-
if (typeof set !== 'function') return false
|
|
43
|
-
set({ token: ${JSON.stringify(i)}, user: null })
|
|
44
|
-
window.__sootsimPreviewUploadIdentity = ${JSON.stringify(t)}
|
|
45
|
-
${n?`window.__sootsimUploadOrigin = ${JSON.stringify(n)}`:"delete window.__sootsimUploadOrigin"}
|
|
46
|
-
return true
|
|
47
|
-
})()`})||(console.error(" SootSim.bridges.setSession missing \u2014 this sim is running an engine\n build without CLI-injected preview auth. reload the sim or open a\n fresh one (`sootsim open --new`); if it persists, update sootsim."),process.exit(1))}async function ie(e,r,o){let i=o?JSON.stringify(o):"undefined";return await e.send({type:"evaluate",code:`window.SootSim.bridges.startRecording(${JSON.stringify(r)}, ${i}, { skipEntitlement: true })`})===!0?{ok:!0,error:null}:{ok:!1,error:await e.send({type:"evaluate",code:"(window.SootSim?.bridges?.getRecordingStartError?.() ?? null)"}).catch(()=>null)??null}}async function se(e){await e.send({type:"evaluate",code:"void window.SootSim.bridges.stopRecording()"})}async function ae(e){let r=Date.now()+Q;for(;Date.now()<r;){let o=await e.send({type:"evaluate",code:"(() => { const s = window.SootSim?.bridges?.getRecordingState?.(); return s ? { state: s.state, lastUpload: s.lastUpload, uploadError: s.uploadError } : null })()"});if(o&&o.state==="idle"){if(o.uploadError)return{uploadError:o.uploadError};if(o.lastUpload?.previewUrl)return{previewUrl:o.lastUpload.previewUrl,eventCount:o.lastUpload.eventCount}}await new Promise(i=>setTimeout(i,300))}return{uploadError:`upload did not settle within ${Q/1e3}s`}}function de(e,r,o){e.uploadError&&(console.error(` upload failed: ${e.uploadError}`),process.exit(1)),e.previewUrl||(console.error(" upload returned no preview URL"),process.exit(1)),console.log(` preview: ${e.previewUrl}`),console.log(` note: this URL is content-addressed \u2014 re-recording the same bundle
|
|
48
|
-
replaces this capture at the same /preview/<id>.`),(o==="live"||o==="combined")&&typeof e.eventCount=="number"&&console.log(` captured ${e.eventCount} event${e.eventCount===1?"":"s"}`),(o==="live"||o==="combined")&&e.eventCount===0&&console.log(o==="combined"?` note: this combined recording captured no events \u2014 the Live tab has
|
|
49
|
-
nothing to replay, and the Video tab may stall with no events to drive it.`:` note: this live recording captured no events \u2014 the preview has nothing
|
|
50
|
-
to replay and will boot a fresh interactive session instead.`),r&&H(e.previewUrl)}export{Se as extToFormat,Re as resolveFormat,De as runRecord,u as valueOf};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a}from"./chunk-MLPLYQGK.js";import"./chunk-ZW3HKMLQ.js";import"./chunk-VGQXIMEX.js";import"./chunk-E6CRWOWO.js";import"./chunk-5MMRIGC3.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";export{a as runRuntime};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a as S}from"./chunk-M4HI2THN.js";import"./chunk-DLSOZVYM.js";import{a as x}from"./chunk-S46M5JZP.js";import"./chunk-GZCZ4GCS.js";import"./chunk-OTWUZRFZ.js";import{f as m}from"./chunk-U5EQ5RWL.js";import{c as h,d as g,e as w,h as y}from"./chunk-ZW3HKMLQ.js";import"./chunk-VGQXIMEX.js";import"./chunk-E6CRWOWO.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";import{mkdirSync as R,writeFileSync as v}from"fs";import{dirname as _,resolve as $}from"path";async function W(e,o){(e.includes("--help")||e.includes("-h"))&&(console.log(`
|
|
3
|
-
sootsim screenshot \u2014 capture the canvas as a PNG
|
|
4
|
-
|
|
5
|
-
usage:
|
|
6
|
-
sootsim screenshot [output] [options]
|
|
7
|
-
sootsim screenshot [options] --output <path>
|
|
8
|
-
|
|
9
|
-
options:
|
|
10
|
-
--output <path> output file path (default: /tmp/sootsim-inspect.png)
|
|
11
|
-
first positional arg works too: \`screenshot /tmp/x.png\`
|
|
12
|
-
--with-frame wrap the captured screen in a tight device frame
|
|
13
|
-
--no-frame capture the raw screen bitmap (default)
|
|
14
|
-
--no-shell exclude the simulated iOS chrome (status bar, keyboard,
|
|
15
|
-
toasts) \u2014 captures the tenant surfaces only
|
|
16
|
-
--shell-only capture only the shell chrome, no tenant content
|
|
17
|
-
--area x,y,w,h crop to a logical sootsim rect
|
|
18
|
-
--id <testID> crop to a node's bounding box
|
|
19
|
-
--text <text> crop to a node found by text content
|
|
20
|
-
--gallery crawl and capture multiple screens as HTML gallery
|
|
21
|
-
--themes capture light and dark variants
|
|
22
|
-
|
|
23
|
-
examples:
|
|
24
|
-
sootsim screenshot
|
|
25
|
-
sootsim screenshot --with-frame --output framed.png
|
|
26
|
-
sootsim screenshot --area 0,200,393,400 --output hero.png
|
|
27
|
-
sootsim screenshot --id loginButton --output button.png
|
|
28
|
-
`),process.exit(0));let t=D(e);if(t.length>0){for(let{flag:l,suggestion:p}of t)console.error(p?` unknown flag: ${l} (did you mean ${p}?)`:` unknown flag: ${l}`);console.error(" run `sootsim screenshot --help` for the list of supported flags"),process.exit(1)}let r=e.includes("--gallery"),a=e.includes("--themes"),n=M(e),c=L(e);if(r||a)return n&&(console.error(" --with-frame is not supported with --gallery / --themes"),process.exit(1)),b(e,o);n&&e.some(l=>l==="--area"||l==="--id"||l==="--text")&&(console.error(" --with-frame only supports full-screen capture for now"),console.error(" remove --area / --id / --text, or capture raw and compose later"),process.exit(1));let s=h(e,{port:o.port,stripBooleanFlags:["--with-frame","--no-frame","--no-shell","--shell-only"],stripValueFlags:["--output","--area","--id","--text"]}),i=E(e),u=await P(e);if(await O(s.wsPort)){try{await T(s,i,u,n,c)}catch(l){console.error(` screenshot failed: ${l instanceof Error?l.message:String(l)}`),process.exit(1)}return}n&&(console.error(" --with-frame requires a running sootsim bridge"),console.error(" open the app in a live sim first, then rerun the command"),process.exit(1)),u&&(console.error(" --area / --id / --text require a running sootsim bridge"),console.error(" start one with `sootsim server`, `sootsim electron`, or your project dev server"),process.exit(1)),await b(e,o)}async function O(e){let o=g(e,{commandTimeoutMs:1e3});try{return await o.listSims(),!0}catch{return!1}finally{o.close()}}async function P(e){let o=e.find((a,n)=>e[n-1]==="--area");if(o){let a=o.split(",").map(u=>Number(u.trim()));if(a.length!==4||a.some(u=>!Number.isFinite(u)))throw new Error(`--area expects x,y,w,h (got "${o}")`);let[n,c,s,i]=a;return{x:n,y:c,w:s,h:i}}let t=e.find((a,n)=>e[n-1]==="--id"),r=e.find((a,n)=>e[n-1]==="--text");return t||r?{__matcher:{id:t,text:r}}:null}async function T(e,o,t,r,a){let n=w({...e,commandTimeoutMs:1e4});try{let c=t,s=t?.__matcher;if(s){let d=await n.send({type:"evaluate",code:x(s)});if(!d)throw new Error(s.id?`no node with id "${s.id}"`:`no node matching text "${s.text}"`);c=d}let i=c?{x:c.x,y:c.y,w:c.w,h:c.h}:void 0,u={type:"screenshot"};a&&(u.layers=a),i&&(u.crop=i);let l=(await n.send(u)).replace(/^data:image\/png;base64,/,"");i&&console.log(` area: x=${i.x} y=${i.y} w=${i.w} h=${i.h}`),a&&console.log(` layers: ${a}`);let p=$(process.cwd(),o||"/tmp/sootsim-inspect.png");R(_(p),{recursive:!0});let f=Buffer.from(l,"base64");if(r){let d=await k(n);if(!d)throw new Error("could not read current device model from the target sim");let A=await S(f,d);v(p,A),console.log(` frame: ${d}`)}else v(p,f);console.log(` saved: ${p}`)}finally{n.close()}}async function k(e){let o=await y(e,"SootSim.bridges.settings.get")??{deviceModel:null},t=typeof o.deviceModel=="string"?o.deviceModel:null;return!t||!(t in m)?null:t}function M(e){let o=!1;for(let t of e)t==="--with-frame"&&(o=!0),t==="--no-frame"&&(o=!1);return o}function L(e){if(e.includes("--shell-only"))return"shell";if(e.includes("--no-shell"))return"tenant"}var N=new Set(["--help","-h","--verbose","-v","--with-frame","--no-frame","--no-shell","--shell-only","--gallery","--themes"]),B=new Set(["--output","--area","--id","--text","--url","--port","--timeout","--sim"]),C={"--rect":"--area","--crop":"--area","--region":"--area","--bounds":"--area","--box":"--area","--xywh":"--area","--out":"--output","-o":"--output","--file":"--output","--path":"--output","--testid":"--id","--test-id":"--id","--test_id":"--id"};function D(e){let o=[];for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){if(B.has(r)){t++;continue}N.has(r)||o.push({flag:r,suggestion:C[r]})}}return o}function E(e){let o=e.find((t,r)=>e[r-1]==="--output");if(o)return o;for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("-")){B.has(r)&&t++;continue}return r}}async function b(e,o){let t=E(e)||"sootsim-screenshot.png",r=e.includes("--gallery"),a=e.find((s,i)=>e[i-1]==="--url")||`http://localhost:${o.port||5173}`,{chromium:n}=await import("playwright"),c=await n.launch({channel:"chrome",headless:!0});try{if(r)console.log(" capturing gallery..."),console.log(" (gallery mode not yet implemented)");else{let s=await c.newPage({viewport:{width:500,height:900}});await s.goto(a,{waitUntil:"networkidle"}),await s.waitForTimeout(2e3);let i=$(process.cwd(),t);R(_(i),{recursive:!0}),await s.screenshot({path:i}),console.log(` saved: ${i}`),await s.close()}}catch(s){console.error(` screenshot failed: ${s.message}`),process.exitCode=1}finally{await c.close()}}export{W as runScreenshot};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a}from"./chunk-L2SDB6G5.js";import"./chunk-FRANP4PR.js";import"./chunk-PTUCXL7Y.js";import"./chunk-JC5L5ZJX.js";import"./chunk-2EBGZC4A.js";import"./chunk-ZW3HKMLQ.js";import"./chunk-VGQXIMEX.js";import"./chunk-E6CRWOWO.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";export{a as runSetupRepo};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{a,b,c}from"./chunk-UXFF7AEE.js";import"./chunk-UHYZO26V.js";import"./chunk-CBRKFAOD.js";import"./chunk-UH4H5HXN.js";import"./chunk-JC5L5ZJX.js";import"./chunk-2EBGZC4A.js";import"./chunk-ZW3HKMLQ.js";import"./chunk-VGQXIMEX.js";import"./chunk-E6CRWOWO.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*! sootsim v0.1.65 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import{K as F,x as S,y as k,z as g}from"./chunk-5ZB5ZN5Z.js";import{c as b,e as y}from"./chunk-ZW3HKMLQ.js";import{b as w}from"./chunk-VGQXIMEX.js";import"./chunk-E6CRWOWO.js";import"./chunk-TWKWXGN5.js";import"./chunk-KKOOZPQP.js";function M(t){let e=[];for(let n=0;n<t.length;n++)if(t[n]==="--since"&&n+1<t.length){e.push(n,n+1);let s=t[n+1].trim(),a=/^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(s);if(a){let l=Number(a[1]),u=a[2]??"ms",r=u==="s"?l*1e3:u==="m"?l*6e4:l;return{since:Date.now()-r,consumed:e}}let o=Number(s);if(Number.isFinite(o)&&o>1e12)return{since:o,consumed:e}}return{consumed:e}}function E(t){let e=[];for(let n=0;n<t.length;n++)if(t[n]==="--kinds"&&n+1<t.length)return e.push(n,n+1),{kinds:t[n+1].split(",").map(s=>s.trim()).filter(Boolean),consumed:e};return{consumed:e}}function C(t){let e=[];for(let n=0;n<t.length;n++)if(t[n]==="--limit"&&n+1<t.length){e.push(n,n+1);let s=Number(t[n+1]);if(Number.isFinite(s)&&s>0)return{limit:s,consumed:e}}return{consumed:e}}function _(t,e){if(e===null)return new Date(t).toLocaleTimeString();let n=(t-e)/1e3;return`${n>=0?"+":""}${n.toFixed(2)}s`}function j(t,e){switch(t){case"app-launch":return e.phase==="launch"?`launch ${e.appName??e.toAppId??""}`:`dismiss ${e.appName??e.fromAppId??""} \u2192 ${e.toAppId??""}`;case"toast":return`"${e.text??""}"${e.durationMs?` (${e.durationMs}ms)`:""}`;case"keyboard":return`${e.phase??"?"}${e.heightPx?` h=${e.heightPx}`:""}${e.mode?` ${e.mode}`:""}`;case"screen":return`${e.phase??"?"} ${e.name??e.activeName??""}`;case"route":return`${e.phase??"?"} ${e.path??e.pathname??""}`;case"alert":case"actionsheet":case"picker":return`${e.phase??"?"} ${e.title??e.message??""}`;case"notification":return`${e.title??""}${e.body?` \u2014 ${e.body}`:""}`;case"fetch":return`${e.method??"GET"} ${e.url??""}${e.status?` -> ${e.status}`:""}`;case"console":return`${e.level??"log"}: ${(e.message??"").toString().slice(0,120)}`;case"shell":return`${e.event??e.type??e.phase??""}`;case"scroll":return`${e.phase??"?"} ${e.target??""}`;case"gesture":return`${e.phase??"?"} ${e.type??""}`;case"text-input":return`${e.phase??"?"}${e.value!==void 0?` "${String(e.value).slice(0,40)}"`:""}`;case"react-commit":{let n=e.slowest;return`${e.fiberCount??"?"} fibers ${e.durationMs??"?"}ms${n?.displayName?` \xB7 ${n.displayName} ${n.durationMs??"?"}ms`:""}`}case"reanimated":case"animation":return`${e.kind??""} ${e.target??""}${e.durationMs?` ${e.durationMs}ms`:""}`}}function N(t,e){let n=_(t.t,e).padStart(8),s=t.context.padEnd(6),a=`[${t.kind}]`.padEnd(15),o="",l=t.data;return l&&typeof l=="object"&&(o=j(t.kind,l)),` ${n} ${s} ${a} ${o}`}function T(t){let e=[],n={label:"initial state",events:[],startedAt:t[0]?.t??null};e.push(n);for(let s of t)if(n.events.push(s),s.kind==="screen"||s.kind==="route"){let a=s.data,o=a?.phase;if(!o||o==="enter"||o==="appear"||o==="active"){let l=a?.name||a?.activeName||a?.path||a?.pathname||s.kind;e.length===1&&n.events.length===1?n.label=`${s.kind}: ${l}`:(n={label:`${s.kind}: ${l}`,events:[],startedAt:s.t},e.push(n))}}return e}async function O(t,e){let n=b(t,{port:e.port,stripBooleanFlags:["--summary","--all","--json","--no-advance","--help","-h","--flow"],stripValueFlags:["--since","--kinds","--limit"]});(t.includes("--help")||t.includes("-h"))&&(console.log(`
|
|
3
|
-
sootsim what-happened \u2014 show recent events from the semantic timeline
|
|
4
|
-
|
|
5
|
-
usage:
|
|
6
|
-
sootsim what-happened # since last CLI call
|
|
7
|
-
sootsim what-happened --summary # one-line counts
|
|
8
|
-
sootsim what-happened --all # full ring (ignore cursor)
|
|
9
|
-
sootsim what-happened --since 5s # absolute window
|
|
10
|
-
sootsim what-happened --kinds toast,fetch
|
|
11
|
-
sootsim what-happened --limit 50
|
|
12
|
-
sootsim what-happened --json
|
|
13
|
-
sootsim what-happened --no-advance # don't advance cursor after read
|
|
14
|
-
`),process.exit(0));let s=t.includes("--summary"),a=t.includes("--flow"),o=t.includes("--all"),l=t.includes("--json"),u=t.includes("--no-advance"),{since:r}=M(t),{kinds:d}=E(t),{limit:x}=C(t),f=w(),v={limit:x??200,...d&&d.length?{kinds:d}:{},...r!==void 0?{since:r}:o?{}:{sinceCursor:f}},m=y(n);try{if(s){let c=await S(m,v);if(l)console.log(JSON.stringify(c));else{let p=o?"all time":r!==void 0?`last ${((Date.now()-r)/1e3).toFixed(1)}s`:"since last call";console.log(` ${p}: ${F(c)}`)}!u&&!o&&c.lastAt&&await g(m,f,c.lastAt);return}let i=await k(m,v);if(l)console.log(JSON.stringify(a?T(i.events):i,null,2));else if(i.events.length===0)console.log(o?" no events recorded":r!==void 0?" no events in window":" no new events since last call");else if(a){let c=i.events[0]?.t??null,p=T(i.events),$=o?`\u2500\u2500\u2500 ${i.events.length} event(s) total \u2014 flow view \u2500\u2500\u2500`:r!==void 0?`\u2500\u2500\u2500 ${i.events.length} event(s) in last ${((Date.now()-r)/1e3).toFixed(1)}s \u2014 flow view \u2500\u2500\u2500`:`\u2500\u2500\u2500 ${i.events.length} event(s) since last call \u2014 flow view \u2500\u2500\u2500`;console.log(` ${$}`);for(let h of p){console.log(`
|
|
15
|
-
\u2500\u2500 ${h.label} (${h.events.length} event${h.events.length===1?"":"s"}) \u2500\u2500`);for(let A of h.events)console.log(N(A,c))}}else{let c=i.events[0]?.t??null,p=o?`\u2500\u2500\u2500 ${i.events.length} event(s) total \u2500\u2500\u2500`:r!==void 0?`\u2500\u2500\u2500 ${i.events.length} event(s) in last ${((Date.now()-r)/1e3).toFixed(1)}s \u2500\u2500\u2500`:`\u2500\u2500\u2500 ${i.events.length} event(s) since last call \u2500\u2500\u2500`;console.log(` ${p}`);for(let $ of i.events)console.log(N($,c))}!u&&!o&&i.watermark>0&&await g(m,f,i.watermark)}finally{m.close()}}export{O as runWhatHappened};
|