sootsim 0.1.233 → 0.1.235

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.
Files changed (149) hide show
  1. package/dist-cli/bin.js +4 -4
  2. package/dist-cli/chunks/{agent-FSAU46RP.js → agent-VY6XJQDL.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-C7OIZCDK.js → agent-wrapper-NSBHSS3Y.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-DXMHWUJT.js → app-fonts-BRTQV44M.js} +2 -2
  5. package/dist-cli/chunks/{assert-WNFJZX3A.js → assert-WOOZQZ67.js} +2 -2
  6. package/dist-cli/chunks/{auth-3VWWSVDJ.js → auth-7J7WDEFG.js} +2 -2
  7. package/dist-cli/chunks/beta-E3A3FN5N.js +2 -0
  8. package/dist-cli/chunks/{camera-2AXW72BD.js → camera-KWI4FUYT.js} +2 -2
  9. package/dist-cli/chunks/chunk-2NTPCZNI.js +99 -0
  10. package/dist-cli/chunks/{chunk-K2MMUVAS.js → chunk-4IGHCZBZ.js} +1 -1
  11. package/dist-cli/chunks/{chunk-ZXTPXUAL.js → chunk-4WKY22WY.js} +3 -3
  12. package/dist-cli/chunks/{chunk-HBD6YSQT.js → chunk-6EZX7YXZ.js} +1 -1
  13. package/dist-cli/chunks/{chunk-ULBICLEG.js → chunk-6XLP5EB5.js} +2 -2
  14. package/dist-cli/chunks/{chunk-Q5SCJQUL.js → chunk-7DV3AEBI.js} +2 -2
  15. package/dist-cli/chunks/chunk-ANOU6P4R.js +1 -0
  16. package/dist-cli/chunks/{chunk-46QQ23PF.js → chunk-APBFMXMM.js} +2 -2
  17. package/dist-cli/chunks/{chunk-ZRRTM6WY.js → chunk-AQ6HSRGZ.js} +2 -2
  18. package/dist-cli/chunks/{chunk-WAVNZQ5B.js → chunk-BZPJSFSP.js} +2 -2
  19. package/dist-cli/chunks/{chunk-GQQZNMLJ.js → chunk-CFIAG2RO.js} +1 -1
  20. package/dist-cli/chunks/{chunk-OMQVA6X5.js → chunk-EB52ZQ3B.js} +2 -2
  21. package/dist-cli/chunks/{chunk-63LYNRZC.js → chunk-EOUBCSIZ.js} +2 -2
  22. package/dist-cli/chunks/{chunk-WBWRABBM.js → chunk-G4VPOKCZ.js} +2 -2
  23. package/dist-cli/chunks/{chunk-KR5WHNHB.js → chunk-GD6LJ2CR.js} +2 -2
  24. package/dist-cli/chunks/{chunk-QE7FDUJN.js → chunk-HVKLAOZM.js} +3 -3
  25. package/dist-cli/chunks/{chunk-5W3SERZ3.js → chunk-ITU3SFQX.js} +2 -2
  26. package/dist-cli/chunks/{chunk-5SAISMRK.js → chunk-IZGWQAPR.js} +1 -1
  27. package/dist-cli/chunks/chunk-JPXFE6M4.js +2 -0
  28. package/dist-cli/chunks/{chunk-Q3KYEB42.js → chunk-K3Q4FEMG.js} +1 -1
  29. package/dist-cli/chunks/{chunk-FMZCSQXP.js → chunk-KEZZHUOP.js} +3 -3
  30. package/dist-cli/chunks/{chunk-BOYWUXVQ.js → chunk-MSXVV6JQ.js} +3 -3
  31. package/dist-cli/chunks/{chunk-IDGS2QTY.js → chunk-OUZCXC3F.js} +1 -1
  32. package/dist-cli/chunks/{chunk-KNGJ7VHE.js → chunk-P3IXWUXV.js} +2 -2
  33. package/dist-cli/chunks/{chunk-G7DEABX5.js → chunk-PULCBYY6.js} +2 -2
  34. package/dist-cli/chunks/chunk-R7RUIOMK.js +2 -0
  35. package/dist-cli/chunks/{chunk-ZQBKE54L.js → chunk-RJ5ZTFTF.js} +1 -1
  36. package/dist-cli/chunks/{chunk-7LEIOQSX.js → chunk-TA6OIGXV.js} +1 -1
  37. package/dist-cli/chunks/{chunk-RTLMLUPQ.js → chunk-TEEK6DLL.js} +2 -2
  38. package/dist-cli/chunks/{chunk-3DRMNDJ7.js → chunk-TR25YKVI.js} +1 -1
  39. package/dist-cli/chunks/{chunk-DU2XIAOZ.js → chunk-TZJ6V6E3.js} +2 -2
  40. package/dist-cli/chunks/{chunk-36ROSEUV.js → chunk-UMRMWSAM.js} +1 -1
  41. package/dist-cli/chunks/{chunk-3654N4EX.js → chunk-VZQLOXV4.js} +2 -2
  42. package/dist-cli/chunks/{chunk-6GADJWCT.js → chunk-WQ5DQ5X7.js} +2 -2
  43. package/dist-cli/chunks/{chunk-LU5U5HEI.js → chunk-XUJDCVTH.js} +6 -6
  44. package/dist-cli/chunks/{chunk-3RIGVY4O.js → chunk-XWRHHNOK.js} +1 -1
  45. package/dist-cli/chunks/{chunk-AHNX3XFL.js → chunk-YAX25DGN.js} +1 -1
  46. package/dist-cli/chunks/{chunk-TB775GFN.js → chunk-YLSEQMQK.js} +1 -1
  47. package/dist-cli/chunks/{chunk-ZRQEHAES.js → chunk-YQDB5ODC.js} +1 -1
  48. package/dist-cli/chunks/{chunk-FQ5ISCZF.js → chunk-YXP22OFA.js} +2 -2
  49. package/dist-cli/chunks/{chunk-KUHSSHBI.js → chunk-YYW4JGGL.js} +1 -1
  50. package/dist-cli/chunks/chunk-Z3BORSD4.js +1 -0
  51. package/dist-cli/chunks/{chunk-S7S2TXMP.js → chunk-Z7TEEXRM.js} +1 -1
  52. package/dist-cli/chunks/{chunk-MGECBBZI.js → chunk-ZVVEXBEJ.js} +2 -2
  53. package/dist-cli/chunks/cli-version-YYFAD5AQ.js +2 -0
  54. package/dist-cli/chunks/{compat-QFJSNZ7F.js → compat-7NLJUPG6.js} +3 -3
  55. package/dist-cli/chunks/{config-FYNAEPT6.js → config-LODVAH4H.js} +2 -2
  56. package/dist-cli/chunks/{control-AYMN3IBC.js → control-H4RVHEDW.js} +2 -2
  57. package/dist-cli/chunks/daemon-NQ5RDWC4.js +2 -0
  58. package/dist-cli/chunks/{debug-IGWPYQVC.js → debug-PM3WQ2Z5.js} +3 -3
  59. package/dist-cli/chunks/{desktop-EKR2GZ6P.js → desktop-MF4ZQA2W.js} +3 -3
  60. package/dist-cli/chunks/{detox-JSFPSPI4.js → detox-IFKFVHIT.js} +2 -2
  61. package/dist-cli/chunks/{device-TOVWFBQJ.js → device-6EQ2R5CO.js} +2 -2
  62. package/dist-cli/chunks/{diagnose-SKCJE2OJ.js → diagnose-AKWL66RQ.js} +2 -2
  63. package/dist-cli/chunks/drivers-5NKXLGOH.js +2 -0
  64. package/dist-cli/chunks/{film-7ZRUTIPW.js → film-NIR3F3EQ.js} +3 -3
  65. package/dist-cli/chunks/flow-DYOXMN3T.js +2 -0
  66. package/dist-cli/chunks/help-ZEEVDVCV.js +2 -0
  67. package/dist-cli/chunks/{hidden-runtime-alias-CNJPGHH3.js → hidden-runtime-alias-QT52GUMS.js} +2 -2
  68. package/dist-cli/chunks/{home-paths-MUFDNXAD.js → home-paths-TZFWKT7O.js} +2 -2
  69. package/dist-cli/chunks/inspect-KSPWBUAB.js +2 -0
  70. package/dist-cli/chunks/install-desktop-4GT67C5I.js +2 -0
  71. package/dist-cli/chunks/{login-575DYIFV.js → login-553MMERY.js} +4 -4
  72. package/dist-cli/chunks/{logout-FWSC6I62.js → logout-UX4PNMDO.js} +2 -2
  73. package/dist-cli/chunks/{maestro-XVRDDQPC.js → maestro-XVWZ37YC.js} +3 -3
  74. package/dist-cli/chunks/{maestro-generate-D2BWU3QI.js → maestro-generate-O3J2XRQD.js} +3 -3
  75. package/dist-cli/chunks/{mode-5NB4ZSW7.js → mode-S7PO7F4H.js} +2 -2
  76. package/dist-cli/chunks/optional-demo-registry-BVQUDY4V.js +2 -0
  77. package/dist-cli/chunks/{perf-FHR37YVM.js → perf-SQD72526.js} +2 -2
  78. package/dist-cli/chunks/record-TFIQZHAO.js +70 -0
  79. package/dist-cli/chunks/runtime-XCEDZMMB.js +2 -0
  80. package/dist-cli/chunks/{screenshot-command-ZZGUTSXV.js → screenshot-command-TCUSGETC.js} +3 -3
  81. package/dist-cli/chunks/{screenshots-capture-BOUIB3JS.js → screenshots-capture-TUGNPCWG.js} +2 -2
  82. package/dist-cli/chunks/{serve-YC7L66XG.js → serve-JAKYFLDC.js} +6 -6
  83. package/dist-cli/chunks/{setup-LUDPDJK4.js → setup-WBQ5PYMM.js} +3 -3
  84. package/dist-cli/chunks/{skills-FQ55TVJQ.js → skills-U5NQ6Y2O.js} +2 -2
  85. package/dist-cli/chunks/{storage-3KQFUZXP.js → storage-X6CEYBPL.js} +2 -2
  86. package/dist-cli/chunks/store-Z2X4OFEM.js +2 -0
  87. package/dist-cli/chunks/telemetry-NWD6GLRC.js +2 -0
  88. package/dist-cli/chunks/{timeline-SUHWK7B7.js → timeline-RUVDOAYG.js} +2 -2
  89. package/dist-cli/chunks/{upgrade-U5BIIO7Z.js → upgrade-X52FGN22.js} +2 -2
  90. package/dist-cli/chunks/upload-ZUHYO36E.js +2 -0
  91. package/dist-cli/chunks/{version-JKCTZB5N.js → version-SMQW5VNI.js} +2 -2
  92. package/dist-cli/chunks/web-2NTSSKPW.js +2 -0
  93. package/dist-cli/chunks/{what-happened-ZQV5XPQM.js → what-happened-3AXYUGTU.js} +2 -2
  94. package/dist-lib/agent-daemon-client.cjs +1 -1
  95. package/dist-lib/agent-events.cjs +1 -1
  96. package/dist-lib/agent-identity.cjs +1 -1
  97. package/dist-lib/agent-sessions.cjs +1 -1
  98. package/dist-lib/attached-projects.cjs +1 -1
  99. package/dist-lib/auth/shared-session.cjs +1 -1
  100. package/dist-lib/backend-origin.cjs +1 -1
  101. package/dist-lib/beta.cjs +1 -1
  102. package/dist-lib/beta.mjs +1 -1
  103. package/dist-lib/bridge-constants.cjs +15 -3
  104. package/dist-lib/cli-constants.cjs +1 -1
  105. package/dist-lib/config.cjs +1 -1
  106. package/dist-lib/detox/index.cjs +1 -1
  107. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  108. package/dist-lib/home-paths.cjs +1 -1
  109. package/dist-lib/host/bridge-host.cjs +12 -5
  110. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  111. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  112. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  113. package/dist-lib/host/websocket-proxy.cjs +12 -5
  114. package/dist-lib/index.cjs +1 -1
  115. package/dist-lib/jump-to-source-babel.cjs +1 -1
  116. package/dist-lib/menu.cjs +1 -1
  117. package/dist-lib/menu.mjs +1 -1
  118. package/dist-lib/metro.cjs +1 -1
  119. package/dist-lib/profiles.cjs +1 -1
  120. package/dist-lib/render-mode.cjs +1 -1
  121. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  122. package/dist-lib/sdk.cjs +1 -1
  123. package/dist-lib/sdk.mjs +1 -1
  124. package/dist-lib/skills.cjs +44 -15
  125. package/dist-lib/vite.cjs +1 -1
  126. package/package.json +1 -1
  127. package/src/bridge-constants.ts +14 -0
  128. package/src/host/websocket-proxy.ts +11 -2
  129. package/dist-cli/chunks/beta-FYKGC4H6.js +0 -2
  130. package/dist-cli/chunks/chunk-3ZNQP22M.js +0 -99
  131. package/dist-cli/chunks/chunk-CBDZY232.js +0 -2
  132. package/dist-cli/chunks/chunk-PSEFQYVM.js +0 -1
  133. package/dist-cli/chunks/chunk-TQF5LD6Y.js +0 -2
  134. package/dist-cli/chunks/chunk-UJZ337EP.js +0 -1
  135. package/dist-cli/chunks/chunk-WHSY2B3U.js +0 -2
  136. package/dist-cli/chunks/cli-version-CS57HE3I.js +0 -2
  137. package/dist-cli/chunks/daemon-UOJGRIKE.js +0 -2
  138. package/dist-cli/chunks/drivers-VJLWPIKJ.js +0 -2
  139. package/dist-cli/chunks/flow-4J2JB726.js +0 -2
  140. package/dist-cli/chunks/help-IZWZPAUI.js +0 -2
  141. package/dist-cli/chunks/inspect-AELXHN3R.js +0 -2
  142. package/dist-cli/chunks/install-desktop-L4ZD5MNA.js +0 -2
  143. package/dist-cli/chunks/optional-demo-registry-4EYB4RJG.js +0 -2
  144. package/dist-cli/chunks/record-ZKVEEOM3.js +0 -70
  145. package/dist-cli/chunks/runtime-PFL2DHOG.js +0 -2
  146. package/dist-cli/chunks/store-KVEMIG7O.js +0 -2
  147. package/dist-cli/chunks/telemetry-LZQKUZ6S.js +0 -2
  148. package/dist-cli/chunks/upload-KRWZEVFY.js +0 -2
  149. package/dist-cli/chunks/web-O6GVKSMI.js +0 -2
@@ -1,99 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as Ue,b as _e,c as Pe}from"./chunk-MGECBBZI.js";import{c as Be}from"./chunk-AHNX3XFL.js";import{d as Ee}from"./chunk-ZRQEHAES.js";import{d as Ae}from"./chunk-3DRMNDJ7.js";import{g as Re,i as Ie,k as B}from"./chunk-LU5U5HEI.js";import{a as ke,b as E}from"./chunk-DU2XIAOZ.js";import{a as xe}from"./chunk-KNGJ7VHE.js";import{createHash as ht}from"crypto";import{readFileSync as w}from"fs";import Ne from"path";import{gzipSync as ue,gunzipSync as yt}from"zlib";function Le(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!(t.startsWith("image/")||t.startsWith("video/")||t.startsWith("audio/")||t==="font/woff2"||t==="application/font-woff2"||t==="application/zip"||t==="application/gzip"):!0}import{brotliCompressSync as ot,constants as it}from"node:zlib";var at=9;function $e(e){return ot(e,{params:{[it.BROTLI_PARAM_QUALITY]:at}})}function ae(e,t){let r=new AbortController,s=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(s)}}async function lt(e){let t=ae(12e4,`PUT ${e.url}`),r;try{r=await fetch(e.url,{method:"PUT",headers:{"content-type":e.contentType},body:e.bytes,signal:t.signal})}finally{t.cancel()}if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`PUT ${e.url} failed ${r.status}: ${s.slice(0,200)}`)}}async function ut(e,t=8,r){let s=0,i=0,a=e.length;await Promise.all(Array.from({length:Math.min(t,a)},async()=>{for(;s<a;){let u=e[s++];await lt(u),i++,r?.(i,a)}}))}function ct(e,t,r,s){let i=[];i.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let a of e.files){let u=r.get(a.urlhash);u&&i.push({url:a.putUrl,contentType:a.contentType,bytes:u})}e.events&&s?.eventsBytes&&i.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:s.eventsBytes}),e.timeline&&s?.timelineBytes&&i.push({url:e.timeline.putUrl,contentType:e.timeline.contentType,bytes:s.timelineBytes}),e.flowVideo&&s?.videoBytes&&i.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:s.videoBytes}),e.storage&&s?.storageBytes&&i.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:s.storageBytes}),e.failureBundle&&s?.failureBundleBytes&&i.push({url:e.failureBundle.putUrl,contentType:e.failureBundle.contentType,bytes:s.failureBundleBytes});for(let a of e.snapshots??[]){let u=s?.snapshotBytes?.get(a.id);u&&i.push({url:a.putUrl,contentType:a.contentType,bytes:u})}return i}function dt(e){return e.replace(/\/+$/,"")}var K=class extends Error{constructor(r,s,i,a=""){super(r);this.status=s;this.phase=i;this.responseText=a;this.name="PresignedUploadError"}};async function Fe(e){let t=dt(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-contrast-admin-upload-bypass"]=e.adminBypassToken);let s=ae(3e4,"init"),i;try{i=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:s.signal})}finally{s.cancel()}if(!i.ok){let M=await i.text().catch(()=>"");throw new K(`init failed: ${i.status} ${M.slice(0,200)}`,i.status,"init",M)}let a=await i.json(),u=ct(a,e.bundleBytes,e.filesByHash,e.extras);await ut(u,e.concurrency??8,e.onPutProgress);let g=ae(3e4,"finalize"),d;try{d=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:a.token}),signal:g.signal})}finally{g.cancel()}if(!d.ok){let M=await d.text().catch(()=>"");throw new K(`finalize failed: ${d.status} ${M.slice(0,200)}`,d.status,"finalize",M)}let R=await d.json();return{init:a,finalize:R}}function pt(e){return e!==null&&typeof e=="object"?e:null}function Oe(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function le(e){let t=pt(e);return t?t.schemaVersion===1&&Oe(t.t)!==void 0&&Oe(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function ft(e,t){let r=[];for(let s of e.split(`
3
- `)){let i=s.trim();if(i)try{let a=JSON.parse(i);t(a)&&r.push(a)}catch{}}return r}function Ce(e){return ft(e,le)}function bt(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t.message=="string"&&t.message?t.message:null}catch{return null}}function wt(e){let t=JSON.parse(w(e,"utf8"));if(!Array.isArray(t))throw new Error("snapshot manifest must be an array");let r=new Set;return t.map((s,i)=>{if(s===null||typeof s!="object")throw new Error(`snapshot manifest entry ${i} must be an object`);let a=Reflect.get(s,"id"),u=Reflect.get(s,"label"),g=Reflect.get(s,"path"),d=Reflect.get(s,"t");if(typeof a!="string"||!a||r.has(a))throw new Error(`snapshot manifest entry ${i} has an invalid or duplicate id`);if(typeof g!="string"||!g)throw new Error(`snapshot manifest entry ${i} has no PNG path`);if(typeof d!="number"||!Number.isFinite(d)||d<0)throw new Error(`snapshot manifest entry ${i} has an invalid capture time`);r.add(a);let R=w(g);return{meta:{id:a,label:typeof u=="string"&&u?u:a,kind:"interaction",t:Math.round(d),contentType:"image/png",sizeBytes:R.byteLength},bytes:R}})}var Je=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://contrast.dev",qe=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",de="http://localhost:3000",Mt=2e3;async function Tt(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${de}/api/preview/upload/init`,{method:"OPTIONS",signal:AbortSignal.timeout(Mt)});if(t.ok||t.status===204||t.status===405)return de}catch{}return Je}function F(e){return e.replace(/\/$/,"")}function St(e){try{let r=new URL(e).hostname.replace(/^\[|\]$/g,"").toLowerCase();return r==="localhost"||r.endsWith(".localhost")||r==="0.0.0.0"||r==="::1"||/^127(?:\.\d{1,3}){3}$/.test(r)}catch{return!1}}function vt(e){try{let t=new URL(e).hostname.toLowerCase();return t==="contrast.dev"||t.endsWith(".contrast.dev")}catch{return!1}}function xt(e,t){return t?F(t):process.env.SOOTSIM_PREVIEW_ORIGIN?F(process.env.SOOTSIM_PREVIEW_ORIGIN):St(e)?F(e):vt(e)?F(qe):F(e)}function kt(){console.log(`
4
- sootsim record upload \u2014 publish the current recorded bundle as a /preview/<id> link
5
-
6
- usage:
7
- sootsim record upload [--origin <url>] [--public-origin <url>] (--events <path> | --video <path>) [--screenshot <path>] [--owner <org> --repo <repo>] [--sim <sim>] [--open] [--assets-only]
8
-
9
- options:
10
- --origin <url> upload target (default: auto)
11
- prefers ${de} when available, otherwise
12
- falls back to ${Je}
13
- override with SOOTSIM_UPLOAD_ORIGIN env var
14
- --public-origin <url>
15
- public /preview link origin (default: ${qe}
16
- for prod uploads, upload origin for localhost/custom origins).
17
- override with SOOTSIM_PREVIEW_ORIGIN env var
18
- --events <path> path to a gzipped events .jsonl.gz file to attach
19
- required unless --video is present; previews must
20
- have replay or recording playback data
21
- --screenshot <path>
22
- path to a PNG thumbnail to attach to the share
23
- --snapshot-manifest <path>
24
- JSON manifest of existing interaction PNGs to attach
25
- --video <path> path to a mp4/gif flow recording. embedded inline
26
- in the pr sticky comment served at
27
- /api/preview/flow-video?id=<share-id>
28
- --video-duration-ms <ms>
29
- duration hint for attached flow video
30
- --timeline-events <path>
31
- extra trace timeline rows, JSONL or JSONL gz
32
- --trace-frame-stats <path>
33
- frame stats JSON returned by the recorder bridge
34
- --failure-bundle <dir>
35
- per-failure debug bundle dir written by the flow runner
36
- (error.json, describe.json, a11y.txt, tree.txt,
37
- console.json, screenshot.png). uploaded with the share
38
- so failed CI runs are debuggable from the dashboard
39
- --owner <org> associate a session upload with a linked org repo
40
- --repo <repo> repo name for --owner; the signed-in user must belong
41
- to the local/org team that owns the link
42
- --billing-kind test_run
43
- meter this upload as a natural-language test run
44
- --sim <sim> target a specific sim (see: sootsim list)
45
- --open open the resulting /preview/<id> url in the browser
46
- --assets-only drop API/JSON/HTML records before upload; keep images,
47
- fonts, css, js, and binary blobs. live-data demos hit
48
- the real network at replay time instead of serving
49
- recorded API snapshots
50
- -h, --help
51
-
52
- examples:
53
- sootsim record upload --events ./my-session.jsonl.gz
54
- sootsim record upload --origin http://localhost:3000 --events ./my-session.jsonl.gz --open
55
- sootsim record upload --video /tmp/sootsim-flow.mp4 --video-duration-ms 12000
56
- `)}function p(e,t){let r=e.findIndex(i=>i===t);if(r<0)return;let s=e[r+1];return e.splice(r,2),s}function ze(e,t){let r=e.findIndex(s=>s===t);return r<0?!1:(e.splice(r,1),!0)}function De(e,t){if(!e)return;let r=Number(e);return(!Number.isFinite(r)||r<=0)&&(console.error(` invalid ${t}: ${e}`),process.exit(1)),Math.round(r)}function je(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!!(t.startsWith("image/")||t.startsWith("font/")||t.startsWith("video/")||t.startsWith("audio/")||t.startsWith("model/")||t==="text/css"||t==="application/javascript"||t==="text/javascript"||t==="application/wasm"||t==="application/font-woff"||t==="application/font-woff2"||t==="application/octet-stream"):!1}async function He(e){let t=await fetch(e);if(!t.ok)throw new Error(`fetch ${e} -> ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())}function Et(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function Bt(e){try{return new URL(e).searchParams.get("appFonts")||""}catch{return""}}function Rt(e){try{return new URL(e).searchParams.get("appSplash")||""}catch{return""}}function It(e){try{let t=new URL(e);return t.searchParams.get("lazy")==="true"?(t.searchParams.set("lazy","false"),t.toString()):e}catch{return e}}async function At(e,t){let s=[];for(let i=0;i<t;i+=15e5){let a=Math.min(i+15e5,t),u=await B(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${i}, ${a})`);if(typeof u!="string")return null;s.push(u)}return s.join("")}function Ut(e){return e.recordedDurationMs&&e.recordingStartedAtMs?{since:e.recordingStartedAtMs-1e4,until:e.recordingStartedAtMs+e.recordedDurationMs+5e3,limit:2e3}:{limit:2e3}}function _t(e){let t=w(e),s=(t[0]===31&&t[1]===139?yt(t):t).toString("utf8");return Ce(s)}function Pt(e){return JSON.parse(w(e,"utf8"))}function Lt(e){if(e===null||typeof e!="object")return[];let t=e,r=typeof t.startedAtEpochMs=="number"&&t.startedAtEpochMs>0?t.startedAtEpochMs:null;if(r===null||!Array.isArray(t.samples))return[];let s=[];for(let i of t.samples){if(!Array.isArray(i)||typeof i[0]!="number")continue;let a=u=>typeof u=="number"&&Number.isFinite(u)?Math.round(u*100)/100:0;s.push({schemaVersion:1,t:r+Math.round(i[0]),seq:s.length+1,context:"tenant",kind:"frame",data:{totalMs:a(i[1]),layoutMs:a(i[2]),renderMs:a(i[3]),copyMs:a(i[4])}})}return s}function $t(e){if(e===null||typeof e!="object")return e;let{samples:t,...r}=e;return r}function ce(e){let t=new Map;for(let r of e)t.set(r.urlhash||r.url,r);return Array.from(t.values())}async function rn(e,t){(e.includes("--help")||e.includes("-h"))&&(kt(),process.exit(0));let r=[...e],s=await Tt(p(r,"--origin")),i=xt(s,p(r,"--public-origin")),a=p(r,"--events"),u=p(r,"--screenshot"),g=p(r,"--snapshot-manifest"),d=p(r,"--video"),R=p(r,"--timeline-events"),M=p(r,"--trace-frame-stats"),V=p(r,"--failure-bundle"),G=p(r,"--video-duration-ms"),pe=De(p(r,"--recorded-duration-ms"),"--recorded-duration-ms"),fe=De(p(r,"--recording-started-at-ms"),"--recording-started-at-ms"),W=p(r,"--owner"),Y=p(r,"--repo"),z=p(r,"--billing-kind"),Ke=p(r,"--run-scope"),Ve=ze(r,"--open");(W&&!Y||!W&&Y)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),z&&z!=="test_run"&&(console.error(` invalid --billing-kind: ${z}`),process.exit(1)),!a&&!d&&(console.error(" preview uploads require playback data: pass --events or --video.\n for a normal local preview, use `sootsim record --mode combined --open`\n or `sootsim maestro test --preview` instead of uploading a bundle-only snapshot."),process.exit(1));let me=ze(r,"--assets-only"),Ge=Re(r,{stripBooleanFlags:[],stripValueFlags:[]}),T=Ie(Ge),c,ge=[],S=[],v=R?_t(R):[],he=M?Pt(M):null;v.push(...Lt(he));let ye=v.length,Q=null;try{if(c=await B(T,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),c?.bundleUrl){let l=new URL(c.bundleUrl).origin,[f,_]=await Promise.all([B(T,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(l)}) || [])`),B(T,`(async () => {
57
- const list = window.__sootsimListWorkerFetchRecorder
58
- return typeof list === 'function'
59
- ? await list(${JSON.stringify(l)})
60
- : []
61
- })()`)]);ge=ce([...f,..._]).filter(m=>{try{return!new URL(m.url).pathname.startsWith("/api/")}catch{return!0}});let $=await B(T,`(async () => {
62
- const rec = window.__sootsimPreviewRecorder
63
- const workerList = window.__sootsimListWorkerFetchRecorder
64
- return {
65
- main: rec?.list ? rec.list() : [],
66
- worker: typeof workerList === 'function' ? await workerList() : [],
67
- }
68
- })()`),N=($?ce([...$.main,...$.worker]):[]).filter(m=>{try{return new URL(m.url).origin!==l}catch{return!1}}),k=N.length>0?{count:N.length,totalBytes:N.reduce((m,oe)=>m+(oe.size||0),0)}:null;if(k&&k.count>0){console.log(` ${k.count} recorded cross-origin responses (${(k.totalBytes/1024).toFixed(1)} KiB)`);let m=await B(T,`(async () => {
69
- const rec = window.__sootsimPreviewRecorder
70
- const workerDump = window.__sootsimDumpWorkerFetchRecorder
71
- const bundleUrl = ${JSON.stringify(c.bundleUrl)}
72
- const keep = (r) => {
73
- try {
74
- const u = new URL(r.url)
75
- if (u.origin !== ${JSON.stringify(l)}) return true
76
- // bundle-origin api responses came from the rewritten
77
- // /__app-api proxy at record time (re-keyed by the
78
- // recorder's unwrap step). they need bodies attached the
79
- // same way as cross-origin records \u2014 direct re-fetch from
80
- // the dev server lacks the bundle's session cookies.
81
- if (r.url !== bundleUrl && u.pathname.startsWith('/api/')) return true
82
- return false
83
- } catch { return false }
84
- }
85
- return {
86
- main: rec?.dump ? rec.dump().filter(keep) : [],
87
- worker: typeof workerDump === 'function'
88
- ? (await workerDump()).filter(keep)
89
- : [],
90
- }
91
- })()`);if(S=ce([...m.main,...m.worker]),me){let oe=S.length;S=S.filter(ie=>je(ie.contentType));let rt=k.totalBytes-S.reduce((ie,st)=>ie+(st.size||0),0);console.log(` --assets-only: kept ${S.length}/${oe} records (dropped ${(rt/1024).toFixed(1)} KiB of API responses)`)}}}c?.transformedBundle&&(Q=await At(T,c.transformedBundle.byteLength));let n=await B(T,`(() => {
92
- const bridge = window.SootSim?.bridges?.timeline ?? window.__sootsimTimeline
93
- if (!bridge || typeof bridge.recent !== 'function') return null
94
- return bridge.recent(${JSON.stringify(Ut({recordedDurationMs:pe,recordingStartedAtMs:fe}))})
95
- })()`).catch(l=>(console.warn(` warning: failed to capture trace timeline: ${l instanceof Error?l.message:String(l)}`),null)),o=Array.isArray(n?.events)?n.events:[];v=[...v,...o.filter(le)].sort((l,f)=>l.t-f.t||l.seq-f.seq)}finally{T.close()}c||(console.error(" could not read bundle snapshot \u2014 is sootsim running and is the bundle loaded?"),process.exit(2)),c.bundleUrl||(console.error(` no ?bundle= URL on the current sootsim tab.
96
- open the app you want to share first (e.g. sootsim open 8082), then run upload.`),process.exit(2));let h,X=!1;if(Q!==null)h=new TextEncoder().encode(Q),X=!0,console.log(` using post-transform bundle: ${(h.byteLength/1024).toFixed(1)} KiB`);else{let n=It(c.bundleUrl);n!==c.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),h=await He(n),console.log(` main bundle: ${(h.byteLength/1024).toFixed(1)} KiB`)}let D=ge.filter(n=>n.url!==c.bundleUrl);me&&(D=D.filter(n=>je(n.contentType))),console.log(` fetching ${D.length} extra files\u2026`);let j=(await Promise.all(D.map(async n=>{try{let o=await He(n.url);return{...n,bytes:o}}catch(o){return console.error(` warning: failed to re-fetch ${n.url}: ${o instanceof Error?o.message:o}`),null}}))).filter(n=>!!n),We=j.reduce((n,o)=>n+o.bytes.byteLength,0);console.log(` ${j.length} extra files: ${(We/1024).toFixed(1)} KiB`);let I;a&&(I=w(a)),v.sort((n,o)=>n.t-o.t||n.seq-o.seq);let be=v.map(n=>JSON.stringify(n)).join(`
97
- `),Z=ue(be?`${be}
98
- `:"");console.log(` trace timeline: ${v.length} events${ye?` (${ye} from runner sidecars)`:""}`);let y;u&&(y=w(u),console.log(` attaching screenshot: ${(y.byteLength/1024).toFixed(1)} KiB`));let O=g?wt(g):[];O.length>0&&console.log(` attaching ${O.length} interaction snapshots`);let A,U;if(V){let n=f=>{try{return w(Ne.join(V,f),"utf8")}catch{return null}},o=f=>{let _=n(f);if(_===null)return null;try{return JSON.parse(_)}catch{return _}},l={error:o("error.json"),describe:o("describe.json"),console:o("console.json"),a11y:n("a11y.txt"),tree:n("tree.txt")};Object.values(l).some(f=>f!==null)&&(A=ue(JSON.stringify(l)),console.log(` attaching failure bundle: ${(A.byteLength/1024).toFixed(1)} KiB gz`));try{U=w(Ne.join(V,"screenshot.png"))}catch{}}let x,C,we;if(d){if(x=w(d),C=d.endsWith(".mp4")?"video/mp4":d.endsWith(".gif")?"image/gif":void 0,C||(console.error(" preview flow videos must be mp4 or gif"),await E(),process.exit(1)),G){let n=Number(G);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${G}`),await E(),process.exit(1)),we=Math.round(n)}console.log(` attaching flow video: ${(x.byteLength/1024).toFixed(1)} KiB (${C})`)}let P=Ue(),L=Pe(P),Ye=xe();ke({event:"preview_upload_started",identity:{userId:P?.kind==="session"?Ye?.user?.id??null:null,repoId:L?.repoId??null,installationId:L?.installationId??null},properties:{origin:s,hasAuth:!!P,authMode:P?.kind??"none",bundleBytes:h.byteLength,isTransformed:X,extraFiles:j.length,recordedFetches:S.length,hasEvents:!!I,traceTimelineEvents:v.length,hasScreenshot:!!y,hasVideo:!!x}}),P||(console.error(" preview uploads need auth."),console.error(" set SOOTSIM_API_KEY=sk_sootsim_..., run `sootsim login`, or use the Contrast github runner."),await E(),process.exit(1));let Qe=_e(P),Xe=(()=>{try{return new URL(c.bundleUrl).origin}catch{return null}})(),H=(n,o,l,f,_,$,ve,N)=>{let k=Le($),m=k?ue(n):n;return{url:o,urlhash:l,method:f,bodyHash:_,requestVaryHash:N,contentType:$,responseHeaders:ve,bytes:m,encoding:k?"gzip":void 0}},Me=[],ee=Bt(c.pageHref)||"";if(ee){let n=await Ee(ee,{onStaged:({url:o,byteLength:l})=>console.log(` staged app font: ${o} (${(l/1024).toFixed(1)} KiB)`),onError:(o,l)=>console.error(` warning: failed to fetch app font ${o}: ${l instanceof Error?l.message:l}`)});for(let o of n)Me.push(H(Buffer.from(o.bytes),o.url,o.urlhash,"GET","-",o.contentType))}let Te=[],te=Rt(c.pageHref)||"";if(te){let n=await Be(te,{onStaged:({url:o,byteLength:l})=>console.log(` staged splash image: ${o} (${(l/1024).toFixed(1)} KiB)`),onError:(o,l)=>console.error(` warning: failed to fetch splash image ${o}: ${l instanceof Error?l.message:l}`)});for(let o of n)Te.push(H(Buffer.from(o.bytes),o.url,o.urlhash,"GET","-",o.contentType))}let ne=[...j.map(n=>H(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...S.map(n=>H(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash)),...Me,...Te],re=$e(h),Ze=ht("sha256").update(h).digest("hex");console.log(` bundle raw=${(h.byteLength/1024).toFixed(1)} KiB br=${(re.byteLength/1024).toFixed(1)} KiB`);let et={contentHash:Ze,bundleSizeBytes:h.byteLength,bundleContentType:Et(c.bundleUrl),bundleEncoding:"br",bundleOrigin:Xe,runtimeVersion:c.runtimeVersion??void 0,appFonts:ee||void 0,appSplash:te||void 0,entry:c.entry,isTransformed:X,deviceSpec:c.deviceSpec,installationId:L?.installationId??void 0,repoId:L?.repoId,owner:W??L?.owner,repo:Y??L?.repo,billingKind:z==="test_run"?"test_run":void 0,runScope:Ke||void 0,files:ne.map(n=>({url:n.url,urlhash:n.urlhash,method:n.method,bodyHash:n.bodyHash,contentType:n.contentType,responseHeaders:n.responseHeaders,requestVaryHash:n.requestVaryHash,encoding:n.encoding,sizeBytes:n.bytes.byteLength})),events:I?{sizeBytes:I.byteLength}:void 0,timeline:{sizeBytes:Z.byteLength,encoding:"gzip"},traceFrameStats:$t(he),recordedDurationMs:pe,recordingStartedAtMs:fe,failureBundle:A?{sizeBytes:A.byteLength,encoding:"gzip"}:void 0,snapshots:(()=>{let n=[];y&&n.push({id:"landing",label:"Landing",kind:"landing",t:0,contentType:"image/png",sizeBytes:y.byteLength}),U&&n.push({id:"failure",label:"Failure",kind:"failure",contentType:"image/png",sizeBytes:U.byteLength});for(let o of O)n.push(o.meta);return n.length>0?n:void 0})(),flowVideo:x&&C?{sizeBytes:x.byteLength,contentType:C,durationMs:we}:void 0},Se=new Map;for(let n of ne)Se.set(n.urlhash,n.bytes);let J=new Map;y&&J.set("landing",y),U&&J.set("failure",U);for(let n of O)J.set(n.meta.id,n.bytes);let tt=Date.now(),b=re.byteLength;for(let n of ne)b+=n.bytes.byteLength;I&&(b+=I.byteLength),b+=Z.byteLength,y&&(b+=y.byteLength),U&&(b+=U.byteLength);for(let n of O)b+=n.bytes.byteLength;A&&(b+=A.byteLength),x&&(b+=x.byteLength);let nt=`${F(s)}/api/preview/upload/init`;console.log(` init: ${nt}`);let q;try{let n=await Fe({originBase:s,initBody:et,bundleBytes:re,filesByHash:Se,extras:{eventsBytes:I,timelineBytes:Z,videoBytes:x,failureBundleBytes:A,snapshotBytes:J},authHeader:Qe,concurrency:16});q=n.finalize;let o=1+n.init.files.length+(n.init.events?1:0)+(n.init.timeline?1:0)+n.init.snapshots.length+(n.init.flowVideo?1:0)+(n.init.failureBundle?1:0);console.log(` PUT ${o} objects in ${Date.now()-tt}ms (${(b/1024).toFixed(1)} KiB)`)}catch(n){let o=n;o.phase==="init"&&o.status===401&&(console.error(" preview upload requires a valid login."),console.error(" run `sootsim login` and retry."),await E(),process.exit(1)),o.status===402&&(console.error(` ${bt(o.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),await E(),process.exit(1)),console.error(` ${o.message??`${o.phase??"upload"} failed: ${String(n)}`}`),await E(),process.exit(1)}let se=`${i}${q.url}`;return console.log(`
99
- stored ${q.filesStored??0} extra files`),console.log(` preview: ${se}`),Ve&&await Ae(se),await E(),{previewUrl:se,shareId:q.id}}export{Tt as a,xt as b,rn as c};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{h as w,j as u,k as m,l}from"./chunk-46QQ23PF.js";var p="sootsim:settings",v=["errorReporting","colorScheme","a11yMode","a11yDepth","screenshotCanvas","screenshotBackground","screenshotText","screenshotPose","screenshotDynamicSize","alwaysShowLiveWebViews","agentProvider","onboardingComplete","betaConsentVersion","detailedTelemetry"];function S(){if(typeof window>"u")return null;let e=window.sootsimElectron;return e&&typeof e=="object"?e:null}function g(e){let t={};for(let n of v){if(!(n in e))continue;let r=e[n],o=u[n];o.validate&&!o.validate(r)||o.options&&!o.options.includes(r)||(t[n]=r)}return t}function h(e){let t={};for(let n of v)t[n]=e[n];return t}function _(){if(typeof localStorage>"u")return{};try{let e=localStorage.getItem(p);return e?g(JSON.parse(e)):{}}catch{return{}}}function V(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(p,JSON.stringify(h(e)))}catch{}}function E(){let t=S()?.sharedConfig?.settings;return!t||typeof t!="object"?{}:g(t)}function K(e){let t=S();if(t?.writeSharedConfig)try{t.writeSharedConfig({settings:h(e)})}catch{}}function b(){if(typeof window>"u")return null;let e=window.__sootsimSharedConfig;return e&&typeof e=="object"?e:null}function j(){let e=b()?.settings;return!e||typeof e!="object"?{}:g(e)}function D(e){if(!b())return;let t={settings:h(e)};try{if(globalThis.__sootsimBridgeRequest?.writeSharedConfig?.(t))return}catch{}if(!(typeof fetch>"u"))try{fetch("/__sootsim/shared-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function k(){let e=_(),t=j(),n=E();return{...e,...t,...n}}function R(e){V(e),K(e),D(e)}function C(e){if(typeof window>"u")return()=>{};let t=i=>{if(!(i.key!==p||i.newValue==null))try{e(g(JSON.parse(i.newValue)))}catch{}};window.addEventListener("storage",t);let n=S(),r;n?.onSharedConfigChanged&&(r=n.onSharedConfigChanged(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))}));let c=globalThis.__sootsimBridgeRequest?.subscribeSharedConfig?.(i=>{let d=i?.settings;!d||typeof d!="object"||e(g(d))});return()=>{window.removeEventListener("storage",t),r?.(),c?.()}}var M=l(),P=k();for(let e of Object.keys(m()))delete P[e];var s={...M,...P},f=[],a=null;function y(){for(let e of f)e();R(s)}C(e=>{let t={...s},n=!1;for(let[r,o]of Object.entries(e)){let c=r;t[c]!==o&&(t[c]=o,n=!0)}if(n){s=t,a=null;for(let r of f)r()}});var L={get(e){return s[e]},set(e,t){let n=u[e];n.validate&&!n.validate(t)||n.options&&!n.options.includes(t)||s[e]!==t&&(s={...s,[e]:t},e==="deviceModel"&&(a=null),y())},getAll(){return s},apply(e){let t=!1,n={...s};for(let[r,o]of Object.entries(e)){if(o===void 0)continue;let c=r,i=u[c];i&&(i.validate&&!i.validate(o)||i.options&&!i.options.includes(o)||n[c]!==o&&(n[c]=o,t=!0))}t&&(s=n,a=null,y())},reset(){s=l(),a=null,y()},subscribe(e){return f.push(e),()=>{f=f.filter(t=>t!==e)}},getDeviceSpec(){return a||(a=w(s.deviceModel)),a},getA11yMode(){return s.a11yMode},setA11yMode(e){this.set("a11yMode",e)},getInspectMode(){return s.inspectMode},setInspectMode(e){this.set("inspectMode",e)}};export{L as a};
@@ -1 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- var t=4001,r="sootsim close";var o="http://localhost:5173/";export{t as a,r as b,o as c};
@@ -1 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as d,b as p}from"./chunk-MGECBBZI.js";import{execSync as c}from"child_process";function s(e){try{return c(e,{stdio:["ignore","pipe","ignore"],timeout:3e3,encoding:"utf8"}).trim()||null}catch{return null}}function o(e){let n=e?.trim();return!n||!/^\d+$/.test(n)?null:Number(n)}function m(){let e=s("git remote get-url origin");if(!e)return null;let n=e.match(/github\.com[/:]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i);return n?{owner:n[1],repo:n[2]}:null}function f(){let e=process.env.GITHUB_ACTIONS==="true",n=(process.env.CONTRAST_REPO||process.env.GITHUB_REPOSITORY||"").trim(),[r,i]=n.includes("/")?n.split("/",2):[null,null];if(e){let u=process.env.GITHUB_REF?.match(/^refs\/pull\/(\d+)\//)?.[1];return{owner:r,repo:i,branch:process.env.GITHUB_HEAD_REF?.trim()||process.env.GITHUB_REF_NAME?.trim()||null,commitSha:process.env.GITHUB_SHA?.trim()||null,githubUsername:process.env.GITHUB_ACTOR?.trim()||null,pullRequestNumber:o(process.env.CONTRAST_PR_NUMBER)??o(u),githubRunId:process.env.GITHUB_RUN_ID?.trim()||null,source:"ci"}}let l=s("git rev-parse --abbrev-ref HEAD"),t=r?null:m();return{owner:r??t?.owner??null,repo:i??t?.repo??null,branch:l==="HEAD"?null:l,commitSha:s("git rev-parse HEAD"),githubUsername:null,pullRequestNumber:o(process.env.CONTRAST_PR_NUMBER),githubRunId:null,source:"cli"}}function R(e){if(e.length===0)return{stepCount:null,failedStepIndex:null};let n=e.find(r=>r.status==="failure");return{stepCount:e.length,failedStepIndex:n?n.stepIndex:null}}function b(e){return e.auth?e.uploadedShare?!0:e.auth.kind==="github"||process.env.GITHUB_ACTIONS==="true":!1}async function S(e){let n=e.auth??d();if(!n)return null;let r=f(),i=e.owner??(n.kind==="github"?n.owner:null)??r.owner,l=e.repo??(n.kind==="github"?n.repo:null)??r.repo;try{let t=await fetch(`${e.origin.replace(/\/$/,"")}/api/sootsim/test-runs`,{method:"POST",headers:{"content-type":"application/json",authorization:p(n)},body:JSON.stringify({kind:e.kind,source:r.source,name:e.name??void 0,prompt:e.prompt??void 0,summary:e.summary??void 0,status:e.status,failureMessage:e.failureMessage??void 0,previewShareId:e.previewShareId??void 0,owner:i??void 0,repo:l??void 0,branch:r.branch??void 0,commitSha:r.commitSha??void 0,githubUsername:r.githubUsername??void 0,pullRequestNumber:r.pullRequestNumber??void 0,githubRunId:r.githubRunId??void 0,stepCount:e.stepCount??void 0,failedStepIndex:e.failedStepIndex??void 0,durationMs:e.durationMs??void 0,flowYamlSizeBytes:e.flowYamlSizeBytes??void 0})});if(!t.ok){let a=await t.text().catch(()=>"");return console.warn(` warn: run registration failed: /api/sootsim/test-runs ${t.status}${a?`: ${a.slice(0,200)}`:""}`),null}let u=await t.json();return u.run?.id?{id:u.run.id,previewUrl:u.run.previewUrl??null,traceUrl:u.run.traceUrl??null}:(console.warn(" warn: run registration returned no id"),null)}catch(t){return console.warn(` warn: run registration failed: ${t instanceof Error?t.message:String(t)}`),null}}export{R as a,b,S as c};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-5SAISMRK.js";import"./chunk-Q3KYEB42.js";export{a as getCliVersion};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b,c,d,e}from"./chunk-3654N4EX.js";import"./chunk-DU2XIAOZ.js";import"./chunk-KNGJ7VHE.js";import"./chunk-ZRRTM6WY.js";import"./chunk-G7DEABX5.js";import"./chunk-63LYNRZC.js";import"./chunk-FQ5ISCZF.js";import"./chunk-TQF5LD6Y.js";import"./chunk-TB775GFN.js";import"./chunk-7LEIOQSX.js";import"./chunk-GQQZNMLJ.js";import"./chunk-5SAISMRK.js";import"./chunk-ZQBKE54L.js";import"./chunk-46QQ23PF.js";import"./chunk-Q3KYEB42.js";export{c as daemonInstall,b as getDaemonServiceStatus,a as runDaemon,d as teardownDaemonService,e as teardownSootsimHome};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-UJZ337EP.js";import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i}from"./chunk-WBWRABBM.js";import"./chunk-S7S2TXMP.js";import"./chunk-3DRMNDJ7.js";import"./chunk-TB775GFN.js";import"./chunk-GQQZNMLJ.js";import"./chunk-Q3KYEB42.js";export{e as ALL_DRIVERS,i as buildDriverListRows,a as chromiumDriver,b as electronDriver,f as getAllDrivers,g as getDriver,c as playwrightDriver,h as resolveDriver,d as systemDriver};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{c,d,e,f,g,h}from"./chunk-QE7FDUJN.js";import"./chunk-ULBICLEG.js";import"./chunk-KUHSSHBI.js";import{c as a,d as b}from"./chunk-FMZCSQXP.js";import"./chunk-RTLMLUPQ.js";import"./chunk-3ZNQP22M.js";import"./chunk-MGECBBZI.js";import"./chunk-KR5WHNHB.js";import"./chunk-WAVNZQ5B.js";import"./chunk-PSEFQYVM.js";import"./chunk-WBWRABBM.js";import"./chunk-S7S2TXMP.js";import"./chunk-AHNX3XFL.js";import"./chunk-ZRQEHAES.js";import"./chunk-3DRMNDJ7.js";import"./chunk-36ROSEUV.js";import"./chunk-6GADJWCT.js";import"./chunk-3RIGVY4O.js";import"./chunk-LU5U5HEI.js";import"./chunk-IDGS2QTY.js";import"./chunk-DU2XIAOZ.js";import"./chunk-KNGJ7VHE.js";import"./chunk-63LYNRZC.js";import"./chunk-FQ5ISCZF.js";import"./chunk-TQF5LD6Y.js";import"./chunk-TB775GFN.js";import"./chunk-7LEIOQSX.js";import"./chunk-GQQZNMLJ.js";import"./chunk-CBDZY232.js";import"./chunk-46QQ23PF.js";import"./chunk-Q3KYEB42.js";export{e as discoverSootsimUrl,c as getLastFlowPreviewUploadResult,d as getLastFlowTraceSteps,g as hoistLeadingSimFlag,a as parseFlowFile,f as runFlowPlayback,h as runMaestroAuthoring,b as validateFlowFile};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b,c}from"./chunk-ZRRTM6WY.js";import"./chunk-G7DEABX5.js";import"./chunk-63LYNRZC.js";import"./chunk-FQ5ISCZF.js";import"./chunk-TQF5LD6Y.js";import"./chunk-TB775GFN.js";import"./chunk-7LEIOQSX.js";import"./chunk-GQQZNMLJ.js";import"./chunk-5SAISMRK.js";import"./chunk-ZQBKE54L.js";import"./chunk-46QQ23PF.js";import"./chunk-Q3KYEB42.js";export{c as printCommandHelp,b as printGroupHelp,a as printHelp};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{j as a,k as b}from"./chunk-FMZCSQXP.js";import"./chunk-RTLMLUPQ.js";import"./chunk-KR5WHNHB.js";import"./chunk-WAVNZQ5B.js";import"./chunk-PSEFQYVM.js";import"./chunk-WBWRABBM.js";import"./chunk-S7S2TXMP.js";import"./chunk-AHNX3XFL.js";import"./chunk-ZRQEHAES.js";import"./chunk-3DRMNDJ7.js";import"./chunk-36ROSEUV.js";import"./chunk-6GADJWCT.js";import"./chunk-3RIGVY4O.js";import"./chunk-LU5U5HEI.js";import"./chunk-IDGS2QTY.js";import"./chunk-63LYNRZC.js";import"./chunk-FQ5ISCZF.js";import"./chunk-TQF5LD6Y.js";import"./chunk-TB775GFN.js";import"./chunk-7LEIOQSX.js";import"./chunk-GQQZNMLJ.js";import"./chunk-CBDZY232.js";import"./chunk-46QQ23PF.js";import"./chunk-Q3KYEB42.js";export{a as printShellPerfReport,b as runInspect};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-BOYWUXVQ.js";import"./chunk-S7S2TXMP.js";import"./chunk-HBD6YSQT.js";import"./chunk-Q3KYEB42.js";export{a as runInstallDesktop};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b}from"./chunk-36ROSEUV.js";import"./chunk-Q3KYEB42.js";export{a as loadOptionalDemoApps,b as optionalDemoAppsSync};
@@ -1,70 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as P}from"./chunk-ULBICLEG.js";import"./chunk-3ZNQP22M.js";import{a as Z,c as ee}from"./chunk-MGECBBZI.js";import"./chunk-AHNX3XFL.js";import"./chunk-ZRQEHAES.js";import{d as Y}from"./chunk-3DRMNDJ7.js";import{g as b,i as v,j as Q}from"./chunk-LU5U5HEI.js";import"./chunk-DU2XIAOZ.js";import"./chunk-KNGJ7VHE.js";import"./chunk-TQF5LD6Y.js";import{c as X}from"./chunk-TB775GFN.js";import"./chunk-GQQZNMLJ.js";import"./chunk-Q3KYEB42.js";import{existsSync as we,mkdirSync as E,readdirSync as he,readFileSync as be,rmSync as J,writeFileSync as N}from"fs";import{homedir as ve,tmpdir as ye}from"os";import{dirname as W,extname as oe,join as C,resolve as Se}from"path";var z=24e4,Re=9e4,$e=3e4;async function D(e,r,o,i){let t=Math.max(2e4,i+$e);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|lock already held/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 _e=new Set(["--sim","--port","-p","--mode","--duration","--fps","--format","--output","-o","--frames","--max-width","--origin","--owner","--repo"]),xe=new Set(["start","stop","cancel","status","prelude-start","upload"]);function ke(e){for(let r=0;r<e.length;r++){let o=e[r];if(o.startsWith("-")){_e.has(o)&&r++;continue}return xe.has(o)?{name:o,index:r}:null}return null}function Oe(){let e=process.env,r=(e.CONTRAST_BRANCH||e.GITHUB_HEAD_REF||e.GITHUB_REF_NAME||"").trim(),o=(e.CONTRAST_SHA||e.GITHUB_SHA||"").trim(),i=(e.CONTRAST_PR_NUMBER||"").trim(),t=i?Number.parseInt(i,10):Number.NaN,n=(e.CONTRAST_PR_TITLE||"").trim();return{branch:r||void 0,commitSha:o||void 0,pullRequestNumber:Number.isFinite(t)&&t>0?t:void 0,pullRequestTitle:n||void 0}}function re(e){let r=l(e,"--owner")?.trim(),o=l(e,"--repo")?.trim();return(r&&!o||!r&&o)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),r&&o?{owner:r,repo:o}:null}async function qe(e,r){let o=ke(e);if(o){let d=[...e.slice(0,o.index),...e.slice(o.index+1)];if(o.name==="start"){await Ne(d,r);return}if(o.name==="prelude-start"){await Ce(d,r);return}if(o.name==="upload"){let{runUpload:y}=await import("./upload-KRWZEVFY.js");await y(d,r);return}if(o.name==="stop"){await Pe(d,r);return}if(o.name==="cancel"){await Fe(d,r);return}await Ae(d,r);return}let i=b(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only","--open"],stripValueFlags:["--mode","--duration","--fps","--format","--output","--frames","--max-width","--origin","--owner","--repo"]}),t=ie(l(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=l(e,"--format");s&&!["webm","mp4","gif","png"].includes(s)&&(console.error(` invalid --format "${s}" \u2014 expected webm | mp4 | gif | png`),process.exit(1));let c=l(e,"--output"),a=Number(l(e,"--duration")??"10");(!Number.isFinite(a)||a<=0)&&(console.error(` invalid --duration "${l(e,"--duration")}" \u2014 expected a positive number of seconds`),process.exit(1));let m=600;a>m&&(console.error(` invalid --duration "${l(e,"--duration")}" \u2014 exceeds the ${m}s (10m) maximum`),process.exit(1));let u=Number(l(e,"--fps")??"30"),p=l(e,"--frames");if(p!==void 0){let d=Number(p);(!Number.isInteger(d)||d<=0)&&(console.error(` invalid --frames "${p}" \u2014 expected a positive integer count`),process.exit(1))}let x=e.includes("--open"),j=l(e,"--max-width")?Number(l(e,"--max-width")):void 0,g=Math.max(100,Math.round(a*1e3)),K=l(e,"--origin"),pe=re(e);if(t==="live"||t==="combined"){c&&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 P("record",{originOverride:K,allowGitHubAuth:!0});let d=v({...i,commandTimeoutMs:6e4});try{await q(d),await ae(d,t),t==="combined"&&await T(d),await de(d,K,pe);let y=await ce(d,t,t==="combined"?n:void 0);y.ok||(console.error(` start failed: recording store refused to start (${t})`+(y.error?`: ${y.error}`:"")),process.exit(1)),console.log(` recording ${t} for ${a}s`),await new Promise(_=>setTimeout(_,g)),await le(d);let k=await ue(d);me(k,x,t)}finally{d.close()}return}let I=p?Number(p):null,R=Be(s,c,I);x&&console.log(" note: --open is ignored for local-file capture \u2014 it applies to --mode live/combined");let h=v({...i,commandTimeoutMs:6e4});try{if(await te(h),await T(h),R==="png"){let $=I??10,w=U(c,`sootsim-frames-${M()}`);c&&oe(c)&&console.log(` note: --frames writes multiple pngs, so --output "${c}" is a directory \u2014 frame-NNN.png files land inside it`),E(w,{recursive:!0});for(let f of he(w))/^frame-\d+\.png$/.test(f)&&J(C(w,f),{force:!0});console.log(` sampling ${$} frames over ${a}s \u2192 ${w}`);let S=await h.send({type:"evaluate",code:`window.__sootsimRecorder.startFrameCapture({ count: ${$}, durationMs: ${g}${n?`, layers: ${JSON.stringify(n)}`:""} })`});(!S.ok||!S.requestId)&&(console.error(` frame capture start failed: ${S.error??"unknown error"}`),process.exit(1)),await new Promise(f=>setTimeout(f,g));let fe=Date.now()+Math.max(5e3,g),A=null;for(;;){let f=await h.send({type:"evaluate",code:`window.__sootsimRecorder.getFrameCaptureResult(${S.requestId})`});if(f||(console.error(" frame capture result missing"),process.exit(1)),f.done){f.ok||(console.error(` frame capture failed: ${f.error??"unknown error"}`),process.exit(1)),A=f.frames??[];break}Date.now()>=fe&&(console.error(" frame capture timed out"),process.exit(1)),await new Promise(F=>setTimeout(F,100))}A.forEach((f,F)=>{let ge=`${w}/frame-${String(F+1).padStart(3,"0")}.png`;N(ge,Buffer.from(f.data,"base64"))}),console.log(` saved ${A.length} frames`);return}if(R==="gif"){let $=I??Math.max(10,Math.round(a*u/3)),w=U(c,`sootsim-${M()}.gif`);E(W(w),{recursive:!0}),console.log(` encoding gif: ${$} frames over ${a}s \u2192 ${w}`);let S=await D(h,`window.__sootsimRecorder.captureGif({ frames: ${$}, durationMs: ${g}${j?`, maxWidth: ${j}`:""}${n?`, layers: ${JSON.stringify(n)}`:""} })`,"gif encode",g);S||(console.error(" gif capture returned no frames"),process.exit(1)),N(w,Buffer.from(S.data,"base64")),console.log(` saved: ${w} (${G(S.size)})`);return}let d=U(c,`sootsim-${M()}.${R}`);E(W(d),{recursive:!0});let y={format:R,fps:u,durationMs:g};n&&(y.layers=n);let k=await D(h,`window.__sootsimRecorder.start(${JSON.stringify(y)})`,`${R} start`,g);k.ok||(console.error(` start failed: ${k.error??"unknown error"}`),/render host not available|already streaming|already recording|lock already held/i.test(k.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 ${R} for ${a}s \u2192 ${d}`),await new Promise($=>setTimeout($,g));let _=await D(h,"window.__sootsimRecorder.stop()",`${R} encode/flush`,g);_.ok||(console.error(` stop failed: ${_.error??"unknown error"}`),process.exit(1)),_.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),process.exit(1)),await ne(h,d),console.log(` saved: ${d} (${G(_.size)})`)}finally{h.close()}}var Ee=6e3;async function L(e,r){try{return await e.send({type:"evaluate",code:r},{timeoutMs:Ee})}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 te(e){await L(e,'typeof window.__sootsimRecorder !== "undefined"')||(console.error(" window.__sootsimRecorder missing \u2014 is sootsim engine running in this sim?"),process.exit(1))}async function T(e){let{hidden:r}=await Q(e);r&&(console.error(` refusing to record: the sootsim tab is hidden, so frame capture
8
- would be throttled to ~1fps and produce a frozen-looking file.
9
- bring the chrome window to the foreground (un-minimize / switch to
10
- its tab) or run the recording in headless playwright, then retry.`),process.exit(1))}async function ne(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}N(r,Buffer.concat(o))}function l(e,r){let o=e.indexOf(r);if(!(o<0||o===e.length-1))return e[o+1]}function Te(e){if(!e)return;let r=oe(e).toLowerCase().replace(/^\./,"");if(r==="webm"||r==="mp4"||r==="gif")return r;if(r==="png")return"png"}function Be(e,r,o){return e||(o!=null?"png":Te(r)??"webm")}function M(){return new Date().toISOString().replace(/[:T]/g,"-").replace(/\..+/,"")}function Me(){let e=C(ve(),".sootsim","recordings");return E(e,{recursive:!0}),e}function U(e,r){return e?Se(process.cwd(),e):C(Me(),r)}function G(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(2)}MB`}function ie(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 H(){return C(ye(),`sootsim-recording-${X()}.json`)}function B(){let e=H();if(!we(e))return null;try{return{mode:"video",...JSON.parse(be(e,"utf8"))}}catch{return J(e,{force:!0}),null}}function Ue(e){N(H(),JSON.stringify(e,null,2))}function O(){J(H(),{force:!0})}function V(e,r){e&&r.simId&&e!==r.simId&&console.log(` note: the tracked recording session is on sim ${r.simId}, not the
11
- requested sim ${e}. record state is global (not per-sim);
12
- this command acts on that session regardless of --sim.`)}async function Ne(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=b(e,{port:r.port,stripBooleanFlags:["--no-shell","--shell-only"],stripValueFlags:["--mode","--fps","--format","--max-width","--origin","--owner","--repo"]}),t=ie(l(e,"--mode")),n=e.includes("--shell-only")?"shell":e.includes("--no-shell")?"tenant":void 0,s=l(e,"--format"),c=s==="mp4"?"mp4":"webm";s&&c!==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 a=Number(l(e,"--fps")??"30"),m=re(e),u=v({...i,commandTimeoutMs:t==="live"||t==="combined"?Re: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 P("record",{originOverride:l(e,"--origin"),allowGitHubAuth:!0}),await q(u),await ae(u,t),t==="combined"&&await T(u),await de(u,l(e,"--origin"),m);let p=await ce(u,t,t==="combined"?n:void 0);p.ok||(console.error(` start failed: recording store refused to start (${t})`+(p.error?`: ${p.error}`:"")),process.exit(1))}else{await te(u),await T(u);let p={format:c,fps:a};n&&(p.layers=n);let x=await u.send({type:"evaluate",code:`window.__sootsimRecorder.start(${JSON.stringify(p)})`});x.ok||(console.error(` start failed: ${x.error??"unknown error"}`),process.exit(1))}Ue({simId:i.simId??null,mode:t,format:c,fps:a,layers:n,startedAt:new Date().toISOString()}),console.log(t==="video"?` recording ${c} @ ${a}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{u.close()}}async function Ce(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=b(e,{port:r.port,stripBooleanFlags:[],stripValueFlags:["--origin"]}),t=v({...i,commandTimeoutMs:15e3});try{if(await q(t),await T(t),!await t.send({type:"evaluate",code:`(() => {
13
- const start = window.SootSim?.bridges?.startRecordingPrelude
14
- if (typeof start !== 'function') return false
15
- return Promise.resolve(start()).then((value) => value === true)
16
- })()`})){let s=await t.send({type:"evaluate",code:`(() => {
17
- const getError = window.SootSim?.bridges?.getRecordingStartError
18
- return typeof getError === 'function' ? getError() : null
19
- })()`}).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 se(e){try{let r=await e.send({type:"evaluate",code:`(() => {
20
- const store = window.SootSim?.bridges?.getRecordingState?.();
21
- const headless = window.__sootsimRecorder?.state?.();
22
- const eventRecorder = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder;
23
- const eventRecording =
24
- typeof eventRecorder?.isRecording === 'function'
25
- ? eventRecorder.isRecording() === true
26
- : false;
27
- return { store: store ? store.state : undefined, headless, eventRecording };
28
- })()`});return r?r.store==="recording"||r.headless==="recording"?"recording":r.store==="processing"?"processing":r.eventRecording?"prelude":r.store==="idle"||r.headless==="idle"?"idle":null:null}catch{return null}}async function Ie(e){let r=await e.send({type:"evaluate",code:`(() => {
29
- const store = window.SootSim?.bridges?.getRecordingState?.();
30
- const eventRecorder = window.SootSim?.bridges?.eventRecorder ?? window.__sootsimEventRecorder;
31
- const hadStoreRecording = store && store.state !== 'idle';
32
- const hadEventRecording =
33
- typeof eventRecorder?.isRecording === 'function'
34
- ? eventRecorder.isRecording() === true
35
- : false;
36
- const cancel = window.SootSim?.bridges?.cancelRecording;
37
- if (typeof cancel === 'function') cancel();
38
- return Boolean(hadStoreRecording || hadEventRecording);
39
- })()`}).catch(()=>!1),o=await e.send({type:"evaluate",code:`(async () => {
40
- const r = window.__sootsimRecorder;
41
- if (r && typeof r.forceRelease === 'function') return await r.forceRelease();
42
- return false;
43
- })()`}).catch(()=>!1);return{store:r,headless:o}}async function Ae(e,r){let o=B();if(o){V(b(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=b(e,{port:r.port}),t=v({...i,commandTimeoutMs:8e3});try{let n=await se(t);if(n==="recording"||n==="processing"||n==="prelude"){if(n==="prelude"){console.log(" a recording preview prelude is active. hidden setup is being\n captured for the next live/combined preview recording. finish\n it with `sootsim record start --mode combined`, or discard it\n with `sootsim record cancel`.");return}console.log(` a recording is in progress (engine state: ${n}), but not via
44
- \`record start\` \u2014 it was started by an atomic \`record --duration\`
45
- run or the in-browser record button, which own their own lifecycle.
46
- if that controlling run is still alive it will finish on its own
47
- (atomic \`--mode video/gif/png\` writes a local file from that
48
- process; live/combined upload to /preview/<id>). if the run was
49
- killed, the recording is abandoned and will NOT finish \u2014 reclaim
50
- it now with \`sootsim record cancel\`, or it auto-reclaims when the
51
- abandoned capture's deadline lapses.`)}else console.log(" no recording in progress")}finally{t.close()}}async function Fe(e,r){let o=B();if(!o){let s=b(e,{port:r.port}),c=v({...s,commandTimeoutMs:8e3});try{let a=await se(c);if(a==="recording"||a==="processing"||a==="prelude"){let m=await Ie(c);m.store&&a==="prelude"?console.log(" recording preview prelude cancelled"):m.store||m.headless?console.log(" 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."):console.log(" 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{c.close()}return}let i=b(e,{port:r.port});V(i.simId,o);let t=o.simId??i.simId??void 0,n=v({...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{O(),n.close()}console.log(" recording cancelled")}async function Pe(e,r){let o=B();o||(console.error(" no recording in progress. start one with `sootsim record start`."),process.exit(1));let i=b(e,{port:r.port,stripBooleanFlags:["--open"],stripValueFlags:["--output"]});V(i.simId,o);let t=o.simId??i.simId??void 0,n=e.includes("--open"),s=v({...i,simId:t,commandTimeoutMs:o.mode==="live"||o.mode==="combined"?z:6e4});try{if(o.mode==="live"||o.mode==="combined"){await le(s);let u=await ue(s);O(),me(u,n,o.mode);return}let c=l(e,"--output"),a=U(c,`sootsim-${M()}.${o.format}`);E(W(a),{recursive:!0});let m=await s.send({type:"evaluate",code:"window.__sootsimRecorder.stop()"});m.ok||(console.error(` stop failed: ${m.error??"unknown error"}`),O(),process.exit(1)),m.size||(console.error(" recorder returned an empty blob \u2014 nothing written"),O(),process.exit(1)),await ne(s,a),O(),console.log(` saved: ${a} (${G(m.size)})`)}finally{s.close()}}async function q(e){await L(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 ae(e,r){await L(e,`(() => {
52
- const fn = window.__sootsimCaptureBundle
53
- if (typeof fn !== 'function') return false
54
- const snap = fn()
55
- return !!(snap && snap.bundleUrl)
56
- })()`)||(console.error(` --mode ${r} needs a guest app bundle to upload to /preview/<id>,
57
- but this sim has no bundle loaded (a built-in shell screen like
58
- photos/settings/home has none). open a metro/guest app first, or
59
- use \`--mode video\` for a local screen recording with no upload.`),process.exit(1))}async function de(e,r,o){let i=Z();if(!i)return;let t=i.kind==="api-key"?i.secret:i.token,n=Oe(),s=i.kind==="github"?{...ee(i),owner:o?.owner,repo:o?.repo,...n}:o?{owner:o.owner,repo:o.repo,...n}:null,c=r?r.replace(/\/$/,""):null;await e.send({type:"evaluate",code:`(() => {
60
- const set = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.setSession
61
- if (typeof set !== 'function') return false
62
- set({ token: ${JSON.stringify(t)}, user: null })
63
- window.__sootsimPreviewUploadIdentity = ${JSON.stringify(s)}
64
- window.__sootsimPreviewUseInjectedBearer = true
65
- ${c?`window.__sootsimUploadOrigin = ${JSON.stringify(c)}`:"delete window.__sootsimUploadOrigin"}
66
- return true
67
- })()`})||(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 ce(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 le(e){await e.send({type:"evaluate",code:"void window.SootSim.bridges.stopRecording()"})}async function ue(e){let r=Date.now()+z;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 ${z/1e3}s`}}function me(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
68
- 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
69
- nothing to replay. Video will play the captured screen recording.`:` note: this live recording captured no events \u2014 the preview has nothing
70
- to replay and will boot a fresh interactive session instead.`),r&&Y(e.previewUrl)}export{Te as extToFormat,Be as resolveFormat,qe as runRecord,l as valueOf};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-ZXTPXUAL.js";import"./chunk-5W3SERZ3.js";import"./chunk-LU5U5HEI.js";import"./chunk-TQF5LD6Y.js";import"./chunk-TB775GFN.js";import"./chunk-GQQZNMLJ.js";import"./chunk-Q3KYEB42.js";export{a as runRuntime};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a}from"./chunk-CBDZY232.js";import"./chunk-46QQ23PF.js";import"./chunk-Q3KYEB42.js";export{a as settingsStore};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b}from"./chunk-DU2XIAOZ.js";import"./chunk-KNGJ7VHE.js";import"./chunk-GQQZNMLJ.js";import"./chunk-Q3KYEB42.js";export{b as flushCliTelemetry,a as trackCliEvent};
@@ -1,2 +0,0 @@
1
- /*! sootsim v0.1.233 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a,b,c}from"./chunk-3ZNQP22M.js";import"./chunk-MGECBBZI.js";import"./chunk-AHNX3XFL.js";import"./chunk-ZRQEHAES.js";import"./chunk-3DRMNDJ7.js";import"./chunk-LU5U5HEI.js";import"./chunk-DU2XIAOZ.js";import"./chunk-KNGJ7VHE.js";import"./chunk-TQF5LD6Y.js";import"./chunk-TB775GFN.js";import"./chunk-GQQZNMLJ.js";import"./chunk-Q3KYEB42.js";export{a as resolveDefaultUploadOrigin,b as resolvePublicPreviewOrigin,c as runUpload};