rnxsim 0.0.0 → 0.1.312
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/LICENSE +21 -0
- package/README.md +512 -0
- package/detox/colors.ts +54 -0
- package/detox/config-loader.ts +135 -0
- package/detox/element-types.ts +39 -0
- package/detox/expectations.ts +537 -0
- package/detox/gestures.ts +480 -0
- package/detox/index.ts +2118 -0
- package/detox/jest-preset.cjs +51 -0
- package/detox/jest-setup-after-env.cjs +18 -0
- package/detox/matchers.ts +30 -0
- package/detox/motion-change.cjs +109 -0
- package/detox/motion-change.d.cts +35 -0
- package/detox/navigation.ts +43 -0
- package/detox/screenshots/animated-color-test-rest-norngh.png +0 -0
- package/detox/screenshots/color-test-after-drag-norngh.png +0 -0
- package/detox/screenshots/color-test-rest-norngh.png +0 -0
- package/detox/screenshots/theme-blue-toggle.png +0 -0
- package/detox/screenshots/theme-blue.png +0 -0
- package/detox/screenshots/theme-red-toggle.png +0 -0
- package/detox/screenshots/theme-red.png +0 -0
- package/dist-cli/bin.js +15 -0
- package/dist-cli/chunks/agent-NXVDDCFG.js +48 -0
- package/dist-cli/chunks/agent-wrapper-DXJCFKL3.js +17 -0
- package/dist-cli/chunks/app-fonts-W5AJZQJF.js +4 -0
- package/dist-cli/chunks/assert-3LOJEUDT.js +49 -0
- package/dist-cli/chunks/auth-MFTYYPNX.js +12 -0
- package/dist-cli/chunks/beta-GT3NN67B.js +4 -0
- package/dist-cli/chunks/camera-6EAK7CUL.js +22 -0
- package/dist-cli/chunks/chunk-274UD5FD.js +4 -0
- package/dist-cli/chunks/chunk-2SA2VTGP.js +5 -0
- package/dist-cli/chunks/chunk-33FKQH54.js +5 -0
- package/dist-cli/chunks/chunk-37I5AIS7.js +3 -0
- package/dist-cli/chunks/chunk-3D57IBPC.js +4 -0
- package/dist-cli/chunks/chunk-4BXCZHAU.js +4 -0
- package/dist-cli/chunks/chunk-5OX7ANRA.js +5 -0
- package/dist-cli/chunks/chunk-66NF2KNG.js +9 -0
- package/dist-cli/chunks/chunk-6UKJB2VC.js +125 -0
- package/dist-cli/chunks/chunk-7INBNA3U.js +26 -0
- package/dist-cli/chunks/chunk-7VWOSTD5.js +5 -0
- package/dist-cli/chunks/chunk-AY47WKS5.js +23 -0
- package/dist-cli/chunks/chunk-B7KMNHX7.js +4 -0
- package/dist-cli/chunks/chunk-BKNOLP3J.js +4 -0
- package/dist-cli/chunks/chunk-BRIZOR4K.js +28 -0
- package/dist-cli/chunks/chunk-DM6KUAOZ.js +4 -0
- package/dist-cli/chunks/chunk-EUAVBTKU.js +4 -0
- package/dist-cli/chunks/chunk-FTC4M26Q.js +4 -0
- package/dist-cli/chunks/chunk-FWYYCUAZ.js +4 -0
- package/dist-cli/chunks/chunk-G74YIEVS.js +7 -0
- package/dist-cli/chunks/chunk-GZDHEONW.js +507 -0
- package/dist-cli/chunks/chunk-HG7ORJMT.js +5 -0
- package/dist-cli/chunks/chunk-HMDOLCKG.js +15 -0
- package/dist-cli/chunks/chunk-JG6S4RSH.js +4 -0
- package/dist-cli/chunks/chunk-KR5BGMBZ.js +4 -0
- package/dist-cli/chunks/chunk-KZW5WBGU.js +983 -0
- package/dist-cli/chunks/chunk-L24Z3CRS.js +30 -0
- package/dist-cli/chunks/chunk-LDQ7HVCW.js +4 -0
- package/dist-cli/chunks/chunk-MENV7VLD.js +4 -0
- package/dist-cli/chunks/chunk-MNGQ42QE.js +568 -0
- package/dist-cli/chunks/chunk-N6A3SXMR.js +4 -0
- package/dist-cli/chunks/chunk-NLEMQ4PY.js +6 -0
- package/dist-cli/chunks/chunk-NPVGMH2N.js +101 -0
- package/dist-cli/chunks/chunk-OR3XTXEB.js +107 -0
- package/dist-cli/chunks/chunk-PEPUGJVI.js +4 -0
- package/dist-cli/chunks/chunk-Q3RGLERJ.js +142 -0
- package/dist-cli/chunks/chunk-SI3BUTQR.js +4 -0
- package/dist-cli/chunks/chunk-T4FT6CM7.js +4 -0
- package/dist-cli/chunks/chunk-TBMVBI26.js +7 -0
- package/dist-cli/chunks/chunk-TCWQJILS.js +5 -0
- package/dist-cli/chunks/chunk-TGQNQ6XT.js +766 -0
- package/dist-cli/chunks/chunk-TYE3WBSR.js +5 -0
- package/dist-cli/chunks/chunk-U4PN6JOT.js +6 -0
- package/dist-cli/chunks/chunk-VUFRB347.js +4 -0
- package/dist-cli/chunks/chunk-VZBLFMYC.js +10 -0
- package/dist-cli/chunks/chunk-WBT32R6N.js +25 -0
- package/dist-cli/chunks/chunk-XRGEEPJ5.js +38 -0
- package/dist-cli/chunks/chunk-Y2FSZSO7.js +71 -0
- package/dist-cli/chunks/chunk-YRV7HR3P.js +74 -0
- package/dist-cli/chunks/chunk-YZRFF4YA.js +14 -0
- package/dist-cli/chunks/chunk-ZMZTHU7V.js +4 -0
- package/dist-cli/chunks/cleanup-H3GWQB63.js +25 -0
- package/dist-cli/chunks/cli-version-3QPAJ3LC.js +4 -0
- package/dist-cli/chunks/compat-5WG2XJV7.js +20 -0
- package/dist-cli/chunks/config-ANMBVVLL.js +13 -0
- package/dist-cli/chunks/control-NSGNQFJG.js +4 -0
- package/dist-cli/chunks/daemon-JHF4BJ3U.js +4 -0
- package/dist-cli/chunks/debug-CHV2O2KF.js +200 -0
- package/dist-cli/chunks/desktop-FIPIK4CH.js +31 -0
- package/dist-cli/chunks/detox-CVUJP7K6.js +52 -0
- package/dist-cli/chunks/device-6WCUM4W6.js +18 -0
- package/dist-cli/chunks/diagnose-I6EMWEII.js +43 -0
- package/dist-cli/chunks/disk-cleanup-P27CYFTN.js +4 -0
- package/dist-cli/chunks/drivers-HQ6AKZT6.js +4 -0
- package/dist-cli/chunks/film-UOQFFYNF.js +74 -0
- package/dist-cli/chunks/flow-N27MRRNL.js +4 -0
- package/dist-cli/chunks/help-SF6FEGEE.js +4 -0
- package/dist-cli/chunks/hidden-runtime-alias-NJYFSJKZ.js +4 -0
- package/dist-cli/chunks/home-paths-XOV44JEF.js +4 -0
- package/dist-cli/chunks/inspect-CWFRFQTY.js +4 -0
- package/dist-cli/chunks/install-desktop-KLQDNXZQ.js +4 -0
- package/dist-cli/chunks/login-BPFQENCX.js +28 -0
- package/dist-cli/chunks/logout-5A45ZGY7.js +4 -0
- package/dist-cli/chunks/maestro-E4CSDMLM.js +104 -0
- package/dist-cli/chunks/maestro-generate-CKMOJQX2.js +36 -0
- package/dist-cli/chunks/mode-SZYNMIQF.js +26 -0
- package/dist-cli/chunks/optional-demo-registry-FRH4SFVG.js +4 -0
- package/dist-cli/chunks/perf-VXU2XJAX.js +48 -0
- package/dist-cli/chunks/permissions-IRIAOVND.js +13 -0
- package/dist-cli/chunks/record-RY7FPLLH.js +72 -0
- package/dist-cli/chunks/report-issue-KNWXOE53.js +29 -0
- package/dist-cli/chunks/runtime-AR3GJTGK.js +4 -0
- package/dist-cli/chunks/screenshot-command-QLALR6GY.js +159 -0
- package/dist-cli/chunks/screenshot-layers-OQFMFVRL.js +20 -0
- package/dist-cli/chunks/screenshots-capture-6TSRJFGB.js +42 -0
- package/dist-cli/chunks/serve-F54J2NQO.js +44 -0
- package/dist-cli/chunks/setup-7V6UKX4U.js +32 -0
- package/dist-cli/chunks/skills-QQBOSETH.js +50 -0
- package/dist-cli/chunks/storage-TAPMKK5O.js +37 -0
- package/dist-cli/chunks/store-7NX3S43H.js +4 -0
- package/dist-cli/chunks/telemetry-E7BUK6RA.js +4 -0
- package/dist-cli/chunks/timeline-IAM564NA.js +24 -0
- package/dist-cli/chunks/upgrade-CD55QXIX.js +7 -0
- package/dist-cli/chunks/upload-GZ6LIMYM.js +4 -0
- package/dist-cli/chunks/version-3DYJ5AS3.js +6 -0
- package/dist-cli/chunks/web-6NW6YLPI.js +4 -0
- package/dist-cli/chunks/what-happened-CZZDOOVG.js +25 -0
- package/dist-lib/agent-daemon-client.cjs +468 -0
- package/dist-lib/agent-events.cjs +48 -0
- package/dist-lib/agent-identity.cjs +53 -0
- package/dist-lib/agent-sessions.cjs +725 -0
- package/dist-lib/attached-projects.cjs +526 -0
- package/dist-lib/auth/shared-session.cjs +195 -0
- package/dist-lib/backend-origin.cjs +70 -0
- package/dist-lib/beta.cjs +41 -0
- package/dist-lib/beta.mjs +13 -0
- package/dist-lib/bridge-constants.cjs +161 -0
- package/dist-lib/cli-constants.cjs +32 -0
- package/dist-lib/config.cjs +96 -0
- package/dist-lib/detox/index.cjs +2863 -0
- package/dist-lib/detox/jest-preset.cjs +51 -0
- package/dist-lib/dev-bundle-resolution.cjs +223 -0
- package/dist-lib/home-paths.cjs +421 -0
- package/dist-lib/host/bridge-host.cjs +5600 -0
- package/dist-lib/host/fetch-proxy-handler.cjs +373 -0
- package/dist-lib/host/fetch-proxy-overrides.cjs +63 -0
- package/dist-lib/host/fetch-proxy-overrides.mjs +37 -0
- package/dist-lib/host/websocket-proxy.cjs +214 -0
- package/dist-lib/index.cjs +513 -0
- package/dist-lib/jump-to-source-babel.cjs +93 -0
- package/dist-lib/menu.cjs +620 -0
- package/dist-lib/menu.mjs +581 -0
- package/dist-lib/metro.cjs +297 -0
- package/dist-lib/profiles.cjs +246 -0
- package/dist-lib/public-brand.cjs +39 -0
- package/dist-lib/render-mode.cjs +54 -0
- package/dist-lib/scripts/dev-server-scanner.cjs +1034 -0
- package/dist-lib/sdk.cjs +2333 -0
- package/dist-lib/sdk.mjs +2240 -0
- package/dist-lib/skills.cjs +23911 -0
- package/dist-lib/vite.cjs +358 -0
- package/package.json +189 -18
- package/scripts/dev-server-scanner.ts +941 -0
- package/scripts/optional-demo-registry.ts +113 -0
- package/scripts/postinstall.cjs +3 -0
- package/scripts/preuninstall.cjs +118 -0
- package/skills/contrast/SKILL.md +171 -0
- package/skills/rnx-debug/SKILL.md +425 -0
- package/skills/rnx-perf/SKILL.md +295 -0
- package/skills/rnx-setup/SKILL.md +160 -0
- package/skills/rnx-test/SKILL.md +292 -0
- package/skills/rnx-visual/SKILL.md +122 -0
- package/src/agent-daemon-client.ts +410 -0
- package/src/agent-events.ts +71 -0
- package/src/agent-identity.ts +23 -0
- package/src/agent-prompt.ts +71 -0
- package/src/agent-sessions.ts +573 -0
- package/src/attached-projects.ts +539 -0
- package/src/auth/shared-session.ts +204 -0
- package/src/backend-origin.ts +49 -0
- package/src/beta.ts +19 -0
- package/src/bridge-constants.ts +171 -0
- package/src/browser-cache.ts +16 -0
- package/src/cli-constants.ts +1 -0
- package/src/cli-version.ts +32 -0
- package/src/codex-client.ts +215 -0
- package/src/config.ts +134 -0
- package/src/dev-bundle-resolution.ts +236 -0
- package/src/disk-cleanup.ts +466 -0
- package/src/home-paths.ts +552 -0
- package/src/host/agent-host.ts +666 -0
- package/src/host/bridge-host.ts +2626 -0
- package/src/host/fetch-proxy-handler.ts +397 -0
- package/src/host/fetch-proxy-overrides.ts +51 -0
- package/src/host/open-url.ts +89 -0
- package/src/host/websocket-proxy.ts +210 -0
- package/src/index.ts +12 -705
- package/src/jump-to-source-babel.ts +135 -0
- package/src/menu.ts +734 -0
- package/src/metro-plugin.ts +139 -0
- package/src/native-dev-bundle-url.ts +96 -0
- package/src/native-seam-manifest.ts +341 -0
- package/src/plist.ts +27 -0
- package/src/poll-until.ts +92 -0
- package/src/profiles.ts +179 -0
- package/src/public-brand.ts +9 -0
- package/src/render-mode.ts +27 -0
- package/src/runtime-assets.ts +228 -0
- package/src/runtime-delivery.ts +54 -0
- package/src/screenshots/compose.ts +422 -0
- package/src/screenshots/frame-compose.ts +454 -0
- package/src/screenshots/orchestrate.ts +256 -0
- package/src/screenshots/org-deck.ts +91 -0
- package/src/screenshots/registry.ts +58 -0
- package/src/screenshots/schema.ts +364 -0
- package/src/sdk.ts +7 -0
- package/src/settings-bundle.ts +418 -0
- package/src/skills/builtin/a11y-review.ts +132 -0
- package/src/skills/builtin/compat-check.ts +71 -0
- package/src/skills/builtin/maestro-test.ts +121 -0
- package/src/skills/builtin/perf-profile.ts +90 -0
- package/src/skills/builtin/screenshot-all.ts +52 -0
- package/src/skills/builtin/visual-diff.ts +100 -0
- package/src/skills/registry.ts +107 -0
- package/src/skills/types.ts +41 -0
- package/src/team-machine-prompt.ts +73 -0
- package/src/vite-plugin-one.ts +190 -0
- package/src/vite-plugin.ts +1750 -0
- package/src/worklets-babel.ts +134 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a}from"./chunk-TCWQJILS.js";import{A as l,C as u}from"./chunk-66NF2KNG.js";var c=/^[A-Za-z0-9._:-]{1,160}$/;function T(e){if(!e?.startsWith("TM_SESSION:"))return null;let n=e.slice(11).trim();return c.test(n)?n:null}function p(e){return c.test(e)}function f(){let e=process.env.DO_NOT_TRACK;return e==="1"||e==="true"||!l().productAnalytics}function m(){if(f())return null;let e=process.env.VITE_POSTHOG_API_KEY||"";if(!e)return null;let n=process.env.CONTRAST_POSTHOG_HOST||process.env.VITE_POSTHOG_HOST||"https://us.i.posthog.com";return{apiKey:e,host:n.replace(/\/+$/,"")}}function d(){try{return u()}catch{return"anonymous-cli"}}function S(e){return e?e.userId?e.userId:e.installationId!=null?`install:${e.installationId}`:e.repoId?`repo:${e.repoId}`:e.shareId?`share:${e.shareId}`:d():d()}function h(e){let n=e.identity??{},o=process.env.TM_SESSION,s=o&&p(o)?"team-machine":process.env.CI==="1"||process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true"?"ci":null,t={$lib:"sootsim-cli",source:n.source??"cli",...e.properties,traffic_type:s?"automated":"human",is_automated:s!==null,...s?{automation_source:s}:{}};return n.userId&&(t.userId=n.userId),n.repoId&&(t.repoId=n.repoId),n.installationId!=null&&(t.installationId=String(n.installationId)),n.shareId&&(t.shareId=n.shareId),n.plan&&(t.plan=n.plan),{event:e.event,distinct_id:S(n),properties:t,timestamp:new Date().toISOString()}}var r=[],I=!1;async function i(){if(r.length===0)return;let e=m();if(!e){r.length=0;return}let n=r.splice(0,r.length).map(h);try{await fetch(`${e.host}/batch/`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({api_key:e.apiKey,batch:n}),signal:AbortSignal.timeout(2e3)})}catch{}}function g(){I||(I=!0,process.on("beforeExit",()=>void i()),process.on("exit",()=>void i()))}function C(e){if(f())return;g();let n=null;try{n=a()?.user?.id??null}catch{n=null}r.push({...e,identity:{source:"cli",userId:n,...e.identity}})}async function E(){await i()}export{T as a,p as b,C as c,E as d};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{b as C}from"./chunk-B7KMNHX7.js";import{f as h}from"./chunk-U4PN6JOT.js";import{G as B,O as b,g as S}from"./chunk-66NF2KNG.js";import a from"node:fs";import c from"node:path";var g=1,k=`automatic-cleanup-v${g}.json`,A=`automatic-cleanup-v${g}.lock`,P=360*60*1e3;function w(){let i=c.join(S(),k);try{return JSON.parse(a.readFileSync(i,"utf8")).generation===g}catch{return!1}}function N(i){if(i<1024)return`${i} B`;let e=["KiB","MiB","GiB","TiB"],n=i/1024,s=e[0];for(let r=1;r<e.length&&n>=1024;r++)n/=1024,s=e[r];return`${n.toFixed(n>=10?1:2)} ${s}`}function p(i){let e;try{e=a.lstatSync(i)}catch{return 0}let n=e.blocks>0?e.blocks*512:e.size;if(!e.isDirectory()||e.isSymbolicLink())return n;let s=n;try{for(let r of a.readdirSync(i))s+=p(c.join(i,r))}catch{}return s}function E(i){for(let e of["SingletonLock","SingletonSocket","lockfile"])try{if(a.lstatSync(c.join(i,e)))return!0}catch{}return!1}function v(i,e){let n;try{n=a.readdirSync(i,{withFileTypes:!0})}catch{return[]}let s=E(e),r=[];for(let t of n){if(!t.isDirectory()||t.isSymbolicLink())continue;let o=c.join(i,t.name);if(C(t.name)){r.push({path:o,bytes:p(o),kind:"browser-cache",state:s?"in-use":"safe",selected:!s,detail:s?"browser profile is open; close it before cleanup":"disposable browser HTTP, bytecode, or GPU cache"});continue}r.push(...v(o,e))}return r}function x(i){let e=c.join(i,"profiles","playwright"),n;try{n=a.readdirSync(e,{withFileTypes:!0})}catch{return[]}return n.flatMap(s=>{if(!s.isDirectory()||s.isSymbolicLink())return[];let r=c.join(e,s.name);return v(r,r)})}function L(i){let e=c.join(i,"electron","userData");return v(e,e)}function R(i,e){let n=c.join(i,"recordings"),s;try{s=a.readdirSync(n,{withFileTypes:!0})}catch{return[]}return s.map(r=>{let t=c.join(n,r.name);return{path:t,bytes:p(t),kind:"recording",state:"aggressive",selected:e,detail:"user-created recording or captured-frame output"}})}function U(i){let e=new Set(b()),n=[...e],s=h.planLocalRetention({retainVersions:2,protectVersions:n}),r=h.planLocalRetention({retainVersions:1,protectVersions:n}),t=new Set(s.removeVersions),o=new Set(r.removeVersions),l=new Set([...s.keepVersions,...s.removeVersions,...r.keepVersions,...r.removeVersions]),m=[];for(let u of[...l].sort()){let d=h.product.runtimeDir(u),y="retained",f="retained runtime";e.has(u)&&u!==s.activeVersion?(y="in-use",f="runtime is serving a connected simulator"):t.has(u)?(y="safe",f="inactive runtime outside the two-version rollback window"):o.has(u)?(y="aggressive",f="most recent rollback runtime"):u===s.activeVersion&&(f="active runtime; always protected"),m.push({path:d,bytes:p(d),kind:"runtime-version",state:y,selected:y==="safe"||y==="aggressive"&&i,detail:f})}for(let u of s.removeCacheFiles)m.push({path:u,bytes:p(u),kind:"runtime-archive",state:"safe",selected:!0,detail:"downloaded archive is unnecessary after successful extraction"});return{activeRuntime:s.activeVersion,entries:m}}function T(i={}){let e=i.aggressive===!0,n=S(),s=U(e),r=[...s.entries,...x(n),...L(n),...R(n,e)].sort((t,o)=>o.bytes-t.bytes||t.path.localeCompare(o.path));return{home:n,activeRuntime:s.activeRuntime,entries:r,reclaimableBytes:r.reduce((t,o)=>t+(o.selected?o.bytes:0),0),protectedBytes:r.reduce((t,o)=>t+(o.selected?0:o.bytes),0),totalBytes:p(n)}}function D(i,e){let n=c.relative(i,e);if(!n||n.startsWith("..")||c.isAbsolute(n))throw new Error(`refusing cleanup target outside the rnx data home: ${e}`)}function I(i={}){let e=T(i),n=i.aggressive===!0?1:2;h.pruneLocalRetention({retainVersions:n,protectVersions:b()});for(let t of e.entries)if(t.selected&&!(t.kind==="runtime-archive"||t.kind==="runtime-version")){if(t.kind==="browser-cache"){let l=c.relative(e.home,t.path).split(c.sep),m=l[0]==="profiles"&&l[1]==="playwright"&&l[2]?c.join(e.home,"profiles","playwright",l[2]):l[0]==="electron"&&l[1]==="userData"?c.join(e.home,"electron","userData"):null;if(m&&E(m)){t.state="in-use",t.selected=!1,t.detail="browser profile opened while cleanup was starting";continue}}D(e.home,t.path),a.rmSync(t.path,{recursive:!0,force:!0})}let s=e.entries.filter(t=>t.selected&&!a.existsSync(t.path)).map(t=>t.path),r=p(e.home);return{...e,removedPaths:s,reclaimedBytes:Math.max(0,e.totalBytes-r),remainingBytes:r}}function $(){B();let i=S(),e=c.join(i,k),n=c.join(i,A);if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let s=null;for(let r=0;r<2&&s===null;r++)try{let t=a.openSync(n,"wx");try{a.writeFileSync(t,`${JSON.stringify({pid:process.pid,startedAt:Date.now()})}
|
|
5
|
+
`,"utf8"),s=t}catch(o){a.closeSync(t);try{a.unlinkSync(n)}catch{}throw o}}catch(t){if((t instanceof Error&&"code"in t?t.code:null)!=="EEXIST")throw t;let l=0,m=0,u=null;try{u=a.lstatSync(n);let d=JSON.parse(a.readFileSync(n,"utf8"));l=typeof d.pid=="number"?d.pid:0,m=typeof d.startedAt=="number"?d.startedAt:0}catch{}if(l>0&&m>0&&Date.now()-m<P)try{return process.kill(l,0),{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0}}catch{}if(!u)continue;try{let d=a.lstatSync(n);if(d.dev!==u.dev||d.ino!==u.ino)return{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};a.unlinkSync(n)}catch{}}if(s===null)return{status:"busy",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};try{if(w())return{status:"already-complete",reclaimedBytes:0,remainingBytes:0,deferredInUseBytes:0};let r=I(),t=r.entries.reduce((l,m)=>l+(m.state==="in-use"?m.bytes:0),0);if(t>0)return{status:"deferred",reclaimedBytes:r.reclaimedBytes,remainingBytes:r.remainingBytes,deferredInUseBytes:t};let o=`${e}.${process.pid}.tmp`;return a.writeFileSync(o,`${JSON.stringify({generation:g,completedAt:Date.now(),reclaimedBytes:r.reclaimedBytes})}
|
|
6
|
+
`,"utf8"),a.renameSync(o,e),{status:"complete",reclaimedBytes:r.reclaimedBytes,remainingBytes:r.remainingBytes,deferredInUseBytes:0}}finally{a.closeSync(s);try{a.unlinkSync(n)}catch{}}}export{w as a,N as b,T as c,I as d,$ as e};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{a as K,b as V,c as Le}from"./chunk-BKNOLP3J.js";import{c as Ne,d as Ce}from"./chunk-T4FT6CM7.js";import{k as Fe}from"./chunk-YZRFF4YA.js";import{h as Pe,j as $e,l as B}from"./chunk-7INBNA3U.js";import{c as _e,d as E}from"./chunk-N6A3SXMR.js";import{a as Ue}from"./chunk-TCWQJILS.js";import{a as Ae}from"./chunk-ZMZTHU7V.js";import{createHash as vt}from"crypto";import{readFileSync as M}from"fs";import qe from"path";import{gzipSync as ge,gunzipSync as xt}from"zlib";function Oe(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 ct,constants as dt}from"node:zlib";var pt=9;function ze(e){return ct(e,{params:{[dt.BROTLI_PARAM_QUALITY]:pt}})}function ce(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 ft(e){let t=ce(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 mt(e,t=8,r){let s=0,o=0,i=e.length;await Promise.all(Array.from({length:Math.min(t,i)},async()=>{for(;s<i;){let l=e[s++];await ft(l),o++,r?.(o,i)}}))}function gt(e,t,r,s){let o=[];o.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let i of e.files){let l=r.get(i.urlhash);l&&o.push({url:i.putUrl,contentType:i.contentType,bytes:l})}e.events&&s?.eventsBytes&&o.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:s.eventsBytes}),e.timeline&&s?.timelineBytes&&o.push({url:e.timeline.putUrl,contentType:e.timeline.contentType,bytes:s.timelineBytes}),e.flowVideo&&s?.videoBytes&&o.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:s.videoBytes}),e.storage&&s?.storageBytes&&o.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:s.storageBytes}),e.failureBundle&&s?.failureBundleBytes&&o.push({url:e.failureBundle.putUrl,contentType:e.failureBundle.contentType,bytes:s.failureBundleBytes});for(let i of e.snapshots??[]){let l=s?.snapshotBytes?.get(i.id);l&&o.push({url:i.putUrl,contentType:i.contentType,bytes:l})}return o}function ht(e){return e.replace(/\/+$/,"")}var W=class extends Error{constructor(r,s,o,i=""){super(r);this.status=s;this.phase=o;this.responseText=i;this.name="PresignedUploadError"}};async function De(e){let t=ht(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=ce(3e4,"init"),o;try{o=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:s.signal})}finally{s.cancel()}if(!o.ok){let T=await o.text().catch(()=>"");throw new W(`init failed: ${o.status} ${T.slice(0,200)}`,o.status,"init",T)}let i=await o.json(),l=gt(i,e.bundleBytes,e.filesByHash,e.extras);await mt(l,e.concurrency??8,e.onPutProgress);let f=ce(3e4,"finalize"),c;try{c=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:i.token}),signal:f.signal})}finally{f.cancel()}if(!c.ok){let T=await c.text().catch(()=>"");throw new W(`finalize failed: ${c.status} ${T.slice(0,200)}`,c.status,"finalize",T)}let h=await c.json();return{init:i,finalize:h}}function yt(e){return e!==null&&typeof e=="object"?e:null}function He(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function de(e){let t=yt(e);return t?t.schemaVersion===1&&He(t.t)!==void 0&&He(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function bt(e,t){let r=[];for(let s of e.split(`
|
|
5
|
+
`)){let o=s.trim();if(o)try{let i=JSON.parse(o);t(i)&&r.push(i)}catch{}}return r}function je(e){return bt(e,de)}import{execSync as wt}from"child_process";function fe(e){try{return wt(e,{stdio:["ignore","pipe","ignore"],timeout:3e3,encoding:"utf8"}).trim()||null}catch{return null}}function pe(e){let t=e?.trim();return!t||!/^\d+$/.test(t)?null:Number(t)}function Mt(){let e=fe("git remote get-url origin");if(!e)return null;let t=e.match(/github\.com[/:]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i);return t?{owner:t[1],repo:t[2]}:null}function me(){let e=process.env.GITHUB_ACTIONS==="true",t=process.env.CONTRAST_BRANCH?.trim()||null,r=process.env.CONTRAST_SHA?.trim()||null,s=process.env.CONTRAST_PR_TITLE?.trim()||null,o=(process.env.CONTRAST_REPO||process.env.GITHUB_REPOSITORY||"").trim(),[i,l]=o.includes("/")?o.split("/",2):[null,null];if(e){let h=process.env.GITHUB_REF?.match(/^refs\/pull\/(\d+)\//)?.[1];return{owner:i,repo:l,branch:t||process.env.GITHUB_HEAD_REF?.trim()||process.env.GITHUB_REF_NAME?.trim()||null,commitSha:r||process.env.GITHUB_SHA?.trim()||null,githubUsername:process.env.GITHUB_ACTOR?.trim()||null,pullRequestNumber:pe(process.env.CONTRAST_PR_NUMBER)??pe(h),pullRequestTitle:s,githubRunId:process.env.GITHUB_RUN_ID?.trim()||null,source:"ci"}}let f=t??fe("git rev-parse --abbrev-ref HEAD"),c=i?null:Mt();return{owner:i??c?.owner??null,repo:l??c?.repo??null,branch:f==="HEAD"?null:f,commitSha:r??fe("git rev-parse HEAD"),githubUsername:null,pullRequestNumber:pe(process.env.CONTRAST_PR_NUMBER),pullRequestTitle:s,githubRunId:null,source:"cli"}}function Qt(e){if(e.length===0)return{stepCount:null,failedStepIndex:null};let t=e.find(r=>r.status==="failure");return{stepCount:e.length,failedStepIndex:t?t.stepIndex:null}}function Xt(e){return e.auth?e.uploadedShare?!0:e.auth.kind==="github"||process.env.GITHUB_ACTIONS==="true":!1}async function Zt(e){let t=e.auth??K();if(!t)return null;let r=me(),s=e.owner??(t.kind==="github"?t.owner:null)??r.owner,o=e.repo??(t.kind==="github"?t.repo:null)??r.repo;try{let i=await fetch(`${e.origin.replace(/\/$/,"")}/api/sootsim/test-runs`,{method:"POST",headers:{"content-type":"application/json",authorization:V(t)},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:s??void 0,repo:o??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(!i.ok){let f=await i.text().catch(()=>"");return console.warn(` warn: run registration failed: /api/sootsim/test-runs ${i.status}${f?`: ${f.slice(0,200)}`:""}`),null}let l=await i.json();return l.run?.id?{id:l.run.id,previewUrl:l.run.previewUrl??null,traceUrl:l.run.traceUrl??null}:(console.warn(" warn: run registration returned no id"),null)}catch(i){return console.warn(` warn: run registration failed: ${i instanceof Error?i.message:String(i)}`),null}}function Rt(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 kt(e){let t=JSON.parse(M(e,"utf8"));if(!Array.isArray(t))throw new Error("snapshot manifest must be an array");let r=new Set;return t.map((s,o)=>{if(s===null||typeof s!="object")throw new Error(`snapshot manifest entry ${o} must be an object`);let i=Reflect.get(s,"id"),l=Reflect.get(s,"label"),f=Reflect.get(s,"path"),c=Reflect.get(s,"t");if(typeof i!="string"||!i||r.has(i))throw new Error(`snapshot manifest entry ${o} has an invalid or duplicate id`);if(typeof f!="string"||!f)throw new Error(`snapshot manifest entry ${o} has no PNG path`);if(typeof c!="number"||!Number.isFinite(c)||c<0)throw new Error(`snapshot manifest entry ${o} has an invalid capture time`);r.add(i);let h=M(f);return{meta:{id:i,label:typeof l=="string"&&l?l:i,kind:"interaction",t:Math.round(c),contentType:"image/png",sizeBytes:h.byteLength},bytes:h}})}var We=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://contrast.dev",Ye=process.env.SOOTSIM_PREVIEW_ORIGIN||Ae.origin,ye="https://contrast.localhost:3000",Et=2e3;async function Bt(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${ye}/api/preview/upload/init`,{method:"OPTIONS",signal:AbortSignal.timeout(Et)});if(t.ok||t.status===204||t.status===405)return ye}catch{}return We}function C(e){return e.replace(/\/$/,"")}function It(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 At(e){try{let t=new URL(e).hostname.toLowerCase();return t==="contrast.dev"||t.endsWith(".contrast.dev")}catch{return!1}}function Ut(e,t){return t?C(t):process.env.SOOTSIM_PREVIEW_ORIGIN?C(process.env.SOOTSIM_PREVIEW_ORIGIN):It(e)?C(e):At(e)?C(Ye):C(e)}function _t(){console.log(`
|
|
6
|
+
rnxsim record upload \u2014 publish the current recorded bundle as a /preview/<id> link
|
|
7
|
+
|
|
8
|
+
usage:
|
|
9
|
+
rnxsim record upload [--origin <url>] [--public-origin <url>] (--events <path> | --video <path>) [--screenshot <path>] [--owner <org> --repo <repo>] [--sim <sim>] [--open] [--assets-only]
|
|
10
|
+
|
|
11
|
+
options:
|
|
12
|
+
--origin <url> upload target (default: auto)
|
|
13
|
+
prefers ${ye} when available, otherwise
|
|
14
|
+
falls back to ${We}
|
|
15
|
+
override with SOOTSIM_UPLOAD_ORIGIN env var
|
|
16
|
+
--public-origin <url>
|
|
17
|
+
public /preview link origin (default: ${Ye}
|
|
18
|
+
for prod uploads, upload origin for localhost/custom origins).
|
|
19
|
+
override with SOOTSIM_PREVIEW_ORIGIN env var
|
|
20
|
+
--events <path> path to a gzipped events .jsonl.gz file to attach
|
|
21
|
+
required unless --video is present; previews must
|
|
22
|
+
have replay or recording playback data
|
|
23
|
+
--screenshot <path>
|
|
24
|
+
path to a PNG thumbnail to attach to the share
|
|
25
|
+
--snapshot-manifest <path>
|
|
26
|
+
JSON manifest of existing interaction PNGs to attach
|
|
27
|
+
--video <path> path to a mp4/gif flow recording. embedded inline
|
|
28
|
+
in the pr sticky comment served at
|
|
29
|
+
/api/preview/flow-video?id=<share-id>
|
|
30
|
+
--video-duration-ms <ms>
|
|
31
|
+
duration hint for attached flow video
|
|
32
|
+
--timeline-events <path>
|
|
33
|
+
extra trace timeline rows, JSONL or JSONL gz
|
|
34
|
+
--trace-frame-stats <path>
|
|
35
|
+
frame stats JSON returned by the recorder bridge
|
|
36
|
+
--failure-bundle <dir>
|
|
37
|
+
per-failure debug bundle dir written by the flow runner
|
|
38
|
+
(error.json, describe.json, a11y.txt, tree.txt,
|
|
39
|
+
console.json, screenshot.png). uploaded with the share
|
|
40
|
+
so failed CI runs are debuggable from the dashboard
|
|
41
|
+
--owner <org> associate a session upload with a linked org repo
|
|
42
|
+
--repo <repo> repo name for --owner; the signed-in user must belong
|
|
43
|
+
to the local/org team that owns the link
|
|
44
|
+
--billing-kind test_run
|
|
45
|
+
meter this upload as a natural-language test run
|
|
46
|
+
--sim <sim> target a specific sim (see: rnxsim list)
|
|
47
|
+
--open open the resulting /preview/<id> url in the browser
|
|
48
|
+
--assets-only drop API/JSON/HTML records before upload; keep images,
|
|
49
|
+
fonts, css, js, and binary blobs. live-data demos hit
|
|
50
|
+
the real network at replay time instead of serving
|
|
51
|
+
recorded API snapshots
|
|
52
|
+
-h, --help
|
|
53
|
+
|
|
54
|
+
examples:
|
|
55
|
+
rnxsim record upload --events ./my-session.jsonl.gz
|
|
56
|
+
rnxsim record upload --origin https://contrast.localhost:3000 --events ./my-session.jsonl.gz --open
|
|
57
|
+
rnxsim record upload --video /tmp/sootsim-flow.mp4 --video-duration-ms 12000
|
|
58
|
+
`)}function p(e,t){let r=e.findIndex(o=>o===t);if(r<0)return;let s=e[r+1];return e.splice(r,2),s}function Ge(e,t){let r=e.findIndex(s=>s===t);return r<0?!1:(e.splice(r,1),!0)}function Je(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 Ke(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 Ve(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 Pt(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function $t(e){try{return new URL(e).searchParams.get("appFonts")||""}catch{return""}}function Ft(e){try{return new URL(e).searchParams.get("appSplash")||""}catch{return""}}function Nt(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 Ct(e,t){let s=[];for(let o=0;o<t;o+=15e5){let i=Math.min(o+15e5,t),l=await B(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${o}, ${i})`);if(typeof l!="string")return null;s.push(l)}return s.join("")}function Lt(e){return e.recordedDurationMs&&e.recordingStartedAtMs?{since:e.recordingStartedAtMs-1e4,until:e.recordingStartedAtMs+e.recordedDurationMs+5e3,limit:2e3}:{limit:2e3}}function Ot(e){let t=M(e),s=(t[0]===31&&t[1]===139?xt(t):t).toString("utf8");return je(s)}function zt(e){return JSON.parse(M(e,"utf8"))}function Dt(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 o of t.samples){if(!Array.isArray(o)||typeof o[0]!="number")continue;let i=l=>typeof l=="number"&&Number.isFinite(l)?Math.round(l*100)/100:0;s.push({schemaVersion:1,t:r+Math.round(o[0]),seq:s.length+1,context:"tenant",kind:"frame",data:{totalMs:i(o[1]),layoutMs:i(o[2]),renderMs:i(o[3]),copyMs:i(o[4])}})}return s}function Ht(e){if(e===null||typeof e!="object")return e;let{samples:t,...r}=e;return r}function he(e){let t=new Map;for(let r of e)t.set(r.urlhash||r.url,r);return Array.from(t.values())}async function wn(e,t){(e.includes("--help")||e.includes("-h"))&&(_t(),process.exit(0));let r=[...e],s=await Bt(p(r,"--origin")),o=Ut(s,p(r,"--public-origin")),i=p(r,"--events"),l=p(r,"--screenshot"),f=p(r,"--snapshot-manifest"),c=p(r,"--video"),h=p(r,"--timeline-events"),T=p(r,"--trace-frame-stats"),Y=p(r,"--failure-bundle"),Q=p(r,"--video-duration-ms"),be=Je(p(r,"--recorded-duration-ms"),"--recorded-duration-ms"),we=Je(p(r,"--recording-started-at-ms"),"--recording-started-at-ms"),X=p(r,"--owner"),Z=p(r,"--repo"),D=p(r,"--billing-kind"),Qe=p(r,"--run-scope"),Xe=Ge(r,"--open");(X&&!Z||!X&&Z)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),D&&D!=="test_run"&&(console.error(` invalid --billing-kind: ${D}`),process.exit(1)),!i&&!c&&(console.error(" preview uploads require playback data: pass --events or --video.\n for a normal local preview, use `rnxsim record --mode combined --open`\n or `rnxsim maestro test --preview` instead of uploading a bundle-only snapshot."),process.exit(1));let Me=Ge(r,"--assets-only"),Ze=Pe(r,{stripBooleanFlags:[],stripValueFlags:[]}),S=$e(Ze),d,Te=[],v=[],x=h?Ot(h):[],Se=T?zt(T):null;x.push(...Dt(Se));let ve=x.length,ee=null;try{if(d=await B(S,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),d?.bundleUrl){let u=new URL(d.bundleUrl).origin,[m,P]=await Promise.all([B(S,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(u)}) || [])`),B(S,`(async () => {
|
|
59
|
+
const list = window.__sootsimListWorkerFetchRecorder
|
|
60
|
+
return typeof list === 'function'
|
|
61
|
+
? await list(${JSON.stringify(u)})
|
|
62
|
+
: []
|
|
63
|
+
})()`)]);Te=he([...m,...P]).filter(g=>{try{return!new URL(g.url).pathname.startsWith("/api/")}catch{return!0}});let N=await B(S,`(async () => {
|
|
64
|
+
const rec = window.__sootsimPreviewRecorder
|
|
65
|
+
const workerList = window.__sootsimListWorkerFetchRecorder
|
|
66
|
+
return {
|
|
67
|
+
main: rec?.list ? rec.list() : [],
|
|
68
|
+
worker: typeof workerList === 'function' ? await workerList() : [],
|
|
69
|
+
}
|
|
70
|
+
})()`),z=(N?he([...N.main,...N.worker]):[]).filter(g=>{try{return new URL(g.url).origin!==u}catch{return!1}}),k=z.length>0?{count:z.length,totalBytes:z.reduce((g,le)=>g+(le.size||0),0)}:null;if(k&&k.count>0){console.log(` ${k.count} recorded cross-origin responses (${(k.totalBytes/1024).toFixed(1)} KiB)`);let g=await B(S,`(async () => {
|
|
71
|
+
const rec = window.__sootsimPreviewRecorder
|
|
72
|
+
const workerDump = window.__sootsimDumpWorkerFetchRecorder
|
|
73
|
+
const bundleUrl = ${JSON.stringify(d.bundleUrl)}
|
|
74
|
+
const keep = (r) => {
|
|
75
|
+
try {
|
|
76
|
+
const u = new URL(r.url)
|
|
77
|
+
if (u.origin !== ${JSON.stringify(u)}) return true
|
|
78
|
+
// bundle-origin api responses came from the rewritten
|
|
79
|
+
// /__app-api proxy at record time (re-keyed by the
|
|
80
|
+
// recorder's unwrap step). they need bodies attached the
|
|
81
|
+
// same way as cross-origin records \u2014 direct re-fetch from
|
|
82
|
+
// the dev server lacks the bundle's session cookies.
|
|
83
|
+
if (r.url !== bundleUrl && u.pathname.startsWith('/api/')) return true
|
|
84
|
+
return false
|
|
85
|
+
} catch { return false }
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
main: rec?.dump ? rec.dump().filter(keep) : [],
|
|
89
|
+
worker: typeof workerDump === 'function'
|
|
90
|
+
? (await workerDump()).filter(keep)
|
|
91
|
+
: [],
|
|
92
|
+
}
|
|
93
|
+
})()`);if(v=he([...g.main,...g.worker]),Me){let le=v.length;v=v.filter(ue=>Ke(ue.contentType));let lt=k.totalBytes-v.reduce((ue,ut)=>ue+(ut.size||0),0);console.log(` --assets-only: kept ${v.length}/${le} records (dropped ${(lt/1024).toFixed(1)} KiB of API responses)`)}}}d?.transformedBundle&&(ee=await Ct(S,d.transformedBundle.byteLength));let n=await B(S,`(() => {
|
|
94
|
+
const bridge = window.SootSim?.bridges?.timeline ?? window.__sootsimTimeline
|
|
95
|
+
if (!bridge || typeof bridge.recent !== 'function') return null
|
|
96
|
+
return bridge.recent(${JSON.stringify(Lt({recordedDurationMs:be,recordingStartedAtMs:we}))})
|
|
97
|
+
})()`).catch(u=>(console.warn(` warning: failed to capture trace timeline: ${u instanceof Error?u.message:String(u)}`),null)),a=Array.isArray(n?.events)?n.events:[];x=[...x,...a.filter(de)].sort((u,m)=>u.t-m.t||u.seq-m.seq)}finally{S.close()}d||(console.error(" could not read bundle snapshot \u2014 is rnx running and is the bundle loaded?"),process.exit(2)),d.bundleUrl||(console.error(` no ?bundle= URL on the current rnx tab.
|
|
98
|
+
open the app you want to share first (e.g. rnxsim open 8082), then run upload.`),process.exit(2));let y,te=!1;if(ee!==null)y=new TextEncoder().encode(ee),te=!0,console.log(` using post-transform bundle: ${(y.byteLength/1024).toFixed(1)} KiB`);else{let n=Nt(d.bundleUrl);n!==d.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),y=await Ve(n),console.log(` main bundle: ${(y.byteLength/1024).toFixed(1)} KiB`)}let H=Te.filter(n=>n.url!==d.bundleUrl);Me&&(H=H.filter(n=>Ke(n.contentType))),console.log(` fetching ${H.length} extra files\u2026`);let j=(await Promise.all(H.map(async n=>{try{let a=await Ve(n.url);return{...n,bytes:a}}catch(a){return console.error(` warning: failed to re-fetch ${n.url}: ${a instanceof Error?a.message:a}`),null}}))).filter(n=>!!n),et=j.reduce((n,a)=>n+a.bytes.byteLength,0);console.log(` ${j.length} extra files: ${(et/1024).toFixed(1)} KiB`);let I;i&&(I=M(i)),x.sort((n,a)=>n.t-a.t||n.seq-a.seq);let xe=x.map(n=>JSON.stringify(n)).join(`
|
|
99
|
+
`),ne=ge(xe?`${xe}
|
|
100
|
+
`:"");console.log(` trace timeline: ${x.length} events${ve?` (${ve} from runner sidecars)`:""}`);let b;l&&(b=M(l),console.log(` attaching screenshot: ${(b.byteLength/1024).toFixed(1)} KiB`));let L=f?kt(f):[];L.length>0&&console.log(` attaching ${L.length} interaction snapshots`);let A,U;if(Y){let n=m=>{try{return M(qe.join(Y,m),"utf8")}catch{return null}},a=m=>{let P=n(m);if(P===null)return null;try{return JSON.parse(P)}catch{return P}},u={error:a("error.json"),describe:a("describe.json"),console:a("console.json"),a11y:n("a11y.txt"),tree:n("tree.txt")};Object.values(u).some(m=>m!==null)&&(A=ge(JSON.stringify(u)),console.log(` attaching failure bundle: ${(A.byteLength/1024).toFixed(1)} KiB gz`));try{U=M(qe.join(Y,"screenshot.png"))}catch{}}let R,O,Re;if(c){if(R=M(c),O=c.endsWith(".mp4")?"video/mp4":c.endsWith(".gif")?"image/gif":void 0,O||(console.error(" preview flow videos must be mp4 or gif"),await E(),process.exit(1)),Q){let n=Number(Q);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${Q}`),await E(),process.exit(1)),Re=Math.round(n)}console.log(` attaching flow video: ${(R.byteLength/1024).toFixed(1)} KiB (${O})`)}let $=K(),F=Le($),_=me(),tt=Ue();_e({event:"preview_upload_started",identity:{userId:$?.kind==="session"?tt?.user?.id??null:null,repoId:F?.repoId??null,installationId:F?.installationId??null},properties:{origin:s,hasAuth:!!$,authMode:$?.kind??"none",bundleBytes:y.byteLength,isTransformed:te,extraFiles:j.length,recordedFetches:v.length,hasEvents:!!I,traceTimelineEvents:x.length,hasScreenshot:!!b,hasVideo:!!R}}),$||(console.error(" preview uploads need auth."),console.error(" set RNX_API_KEY=sk_rnx_..., run `rnxsim login`, or use the Contrast github runner."),await E(),process.exit(1));let nt=V($),rt=(()=>{try{return new URL(d.bundleUrl).origin}catch{return null}})(),q=(n,a,u,m,P,N,Ie,z)=>{let k=Oe(N),g=k?ge(n):n;return{url:a,urlhash:u,method:m,bodyHash:P,requestVaryHash:z,contentType:N,responseHeaders:Ie,bytes:g,encoding:k?"gzip":void 0}},ke=[],re=$t(d.pageHref)||"";if(re){let n=await Fe(re,{onStaged:({url:a,byteLength:u})=>console.log(` staged app font: ${a} (${(u/1024).toFixed(1)} KiB)`),onError:(a,u)=>console.error(` warning: failed to fetch app font ${a}: ${u instanceof Error?u.message:u}`)});for(let a of n)ke.push(q(Buffer.from(a.bytes),a.url,a.urlhash,"GET","-",a.contentType))}let Ee=[],se=Ft(d.pageHref)||"";if(se){let n=await Ne(se,{onStaged:({url:a,byteLength:u})=>console.log(` staged splash image: ${a} (${(u/1024).toFixed(1)} KiB)`),onError:(a,u)=>console.error(` warning: failed to fetch splash image ${a}: ${u instanceof Error?u.message:u}`)});for(let a of n)Ee.push(q(Buffer.from(a.bytes),a.url,a.urlhash,"GET","-",a.contentType))}let oe=[...j.map(n=>q(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...v.map(n=>q(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash)),...ke,...Ee],ie=ze(y),st=vt("sha256").update(y).digest("hex");console.log(` bundle raw=${(y.byteLength/1024).toFixed(1)} KiB br=${(ie.byteLength/1024).toFixed(1)} KiB`);let ot={contentHash:st,bundleSizeBytes:y.byteLength,bundleContentType:Pt(d.bundleUrl),bundleEncoding:"br",bundleMinified:!1,bundleOrigin:rt,runtimeVersion:d.runtimeVersion??void 0,appFonts:re||void 0,appSplash:se||void 0,entry:d.entry,isTransformed:te,deviceSpec:d.deviceSpec,installationId:F?.installationId??void 0,repoId:F?.repoId,owner:X??F?.owner??_.owner??void 0,repo:Z??F?.repo??_.repo??void 0,branch:_.branch??void 0,commitSha:_.commitSha??void 0,githubUsername:_.githubUsername??void 0,pullRequestNumber:_.pullRequestNumber??void 0,pullRequestTitle:_.pullRequestTitle??void 0,billingKind:D==="test_run"?"test_run":void 0,runScope:Qe||void 0,files:oe.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:ne.byteLength,encoding:"gzip"},traceFrameStats:Ht(Se),recordedDurationMs:be,recordingStartedAtMs:we,failureBundle:A?{sizeBytes:A.byteLength,encoding:"gzip"}:void 0,snapshots:(()=>{let n=[];b&&n.push({id:"landing",label:"Landing",kind:"landing",t:0,contentType:"image/png",sizeBytes:b.byteLength}),U&&n.push({id:"failure",label:"Failure",kind:"failure",contentType:"image/png",sizeBytes:U.byteLength});for(let a of L)n.push(a.meta);return n.length>0?n:void 0})(),flowVideo:R&&O?{sizeBytes:R.byteLength,contentType:O,durationMs:Re}:void 0},Be=new Map;for(let n of oe)Be.set(n.urlhash,n.bytes);let G=new Map;b&&G.set("landing",b),U&&G.set("failure",U);for(let n of L)G.set(n.meta.id,n.bytes);let it=Date.now(),w=ie.byteLength;for(let n of oe)w+=n.bytes.byteLength;I&&(w+=I.byteLength),w+=ne.byteLength,b&&(w+=b.byteLength),U&&(w+=U.byteLength);for(let n of L)w+=n.bytes.byteLength;A&&(w+=A.byteLength),R&&(w+=R.byteLength);let at=`${C(s)}/api/preview/upload/init`;console.log(` init: ${at}`);let J;try{let n=await De({originBase:s,initBody:ot,bundleBytes:ie,filesByHash:Be,extras:{eventsBytes:I,timelineBytes:ne,videoBytes:R,failureBundleBytes:A,snapshotBytes:G},authHeader:nt,concurrency:16});J=n.finalize;let a=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 ${a} objects in ${Date.now()-it}ms (${(w/1024).toFixed(1)} KiB)`)}catch(n){let a=n;a.phase==="init"&&a.status===401&&(console.error(" preview upload requires a valid login."),console.error(" run `rnxsim login` and retry."),await E(),process.exit(1)),a.status===402&&(console.error(` ${Rt(a.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),await E(),process.exit(1)),console.error(` ${a.message??`${a.phase??"upload"} failed: ${String(n)}`}`),await E(),process.exit(1)}let ae=`${o}${J.url}`;return console.log(`
|
|
101
|
+
stored ${J.filesStored??0} extra files`),console.log(` preview: ${ae}`),Xe&&await Ce(ae),await E(),{previewUrl:ae,shareId:J.id}}export{me as a,Qt as b,Xt as c,Zt as d,Bt as e,Ut as f,wn as g};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
import{h as j,j as A,m as K,n as v}from"./chunk-7INBNA3U.js";import{createHash as Y}from"node:crypto";import{mkdirSync as L,readFileSync as W,readdirSync as Q,unlinkSync as X,writeFileSync as D}from"node:fs";import{dirname as q,extname as Z,resolve as B}from"node:path";function H(t){let e=t[0]?.toLowerCase()??"toggle";return e!=="on"&&e!=="off"&&e!=="toggle"&&(console.error(` unknown argument: "${e}" (expected on | off | toggle)`),process.exit(1)),e}async function U(t,e,n){let o=j(t,{port:e.port}),i=H(o.positional),m=A({...o,commandTimeoutMs:5e3});try{let a=!!(await K(m,"SootSim.bridges.settings.get"))?.[n.modeKey],u=i==="on"?!0:i==="off"?!1:!a;if(a===u)return console.log(` ${n.displayName}: already ${u?"on":"off"}`),{current:a,target:u,changed:!1};if(!await m.send({type:"evaluate",acquireLock:!0,code:`(async () => {
|
|
5
|
+
const modeKey = ${JSON.stringify(n.modeKey)}
|
|
6
|
+
const target = ${JSON.stringify(u)}
|
|
7
|
+
window.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
8
|
+
detail: { type: 'fire-action', id: ${JSON.stringify(n.actionId)} },
|
|
9
|
+
}))
|
|
10
|
+
const deadline = Date.now() + 1200
|
|
11
|
+
while (Date.now() < deadline) {
|
|
12
|
+
if (Boolean(window.SootSim?.bridges?.settings?.get?.()?.[modeKey]) === target) {
|
|
13
|
+
return true
|
|
14
|
+
}
|
|
15
|
+
await new Promise((resolve) => setTimeout(resolve, 40))
|
|
16
|
+
}
|
|
17
|
+
return false
|
|
18
|
+
})()`}))throw new Error(`${n.displayName} did not change to ${u?"on":"off"}; the live shell may not support this mode`);return console.log(` ${n.displayName}: ${a?"on":"off"} -> ${u?"on":"off"}`),{current:a,target:u,changed:!0}}finally{m.close()}}var z=12e3,ee=6e5,te=new Set(["load","seek","play","pause","render","measure"]);async function ye(t,e){(t.includes("--help")||t.includes("-h"))&&(console.log(`
|
|
19
|
+
rnxsim mode three \u2014 toggle the 3d device stage
|
|
20
|
+
|
|
21
|
+
usage:
|
|
22
|
+
rnxsim mode three [on|off|toggle]
|
|
23
|
+
rnxsim mode three configure [options]
|
|
24
|
+
rnxsim mode three load <timeline.json>
|
|
25
|
+
rnxsim mode three seek <time-ms>
|
|
26
|
+
rnxsim mode three play|pause
|
|
27
|
+
rnxsim mode three render <timeline.json> --output <dir> [options]
|
|
28
|
+
rnxsim mode three measure <timeline.json> [options]
|
|
29
|
+
|
|
30
|
+
arguments:
|
|
31
|
+
on enable 3d mode
|
|
32
|
+
off disable 3d mode
|
|
33
|
+
toggle flip the current state (default)
|
|
34
|
+
|
|
35
|
+
configure options:
|
|
36
|
+
--device <id> set the phone body: iphone-17-air | iphone-17-pro |
|
|
37
|
+
pixel-10 (a film authors its own via initial.device)
|
|
38
|
+
--background <id> set the 3d background
|
|
39
|
+
--gradient <stops> custom gradient bg: comma-separated css hex stops,
|
|
40
|
+
e.g. "#0a0e1a,#16243f,#05080f" (overrides --background;
|
|
41
|
+
evenly spaced, or use "color@offset" for explicit %)
|
|
42
|
+
--gradient-angle <deg> custom gradient angle (default 180 = top\u2192bottom)
|
|
43
|
+
--colorway <id> set the phone colorway
|
|
44
|
+
--script <id> apply a camera preset pose
|
|
45
|
+
--progress <0..1> script progress to sample (default: 1)
|
|
46
|
+
--animate run the script instead of sampling one frame
|
|
47
|
+
--slow run the script slowly when --animate is set
|
|
48
|
+
--environment on|off enable or disable environment objects
|
|
49
|
+
--env-shape <id> orb | pill | diamond | pane
|
|
50
|
+
--env-spread <id> tight | medium | wide
|
|
51
|
+
--env-size <id> small | medium | large
|
|
52
|
+
--env-color <id> peach | gold | mint | sky | violet
|
|
53
|
+
--env-glow on|off enable or disable environment glow
|
|
54
|
+
--env-plastic on|off enable or disable environment plastic material
|
|
55
|
+
--setting <id> none | room | white-backdrop
|
|
56
|
+
--focus on|off enable or disable Focus depth of field
|
|
57
|
+
--focus-amount <id> subtle | medium | strong | intense | extreme
|
|
58
|
+
--focus-range <id> tight | balanced | wide
|
|
59
|
+
--reset-pose return to the default hero pose before other changes
|
|
60
|
+
|
|
61
|
+
render options:
|
|
62
|
+
--output <dir> write frame-%05d.png + timeline-render.json
|
|
63
|
+
--fps <number> frames per second (default: 30)
|
|
64
|
+
--width <px> exact output width (default: 1920)
|
|
65
|
+
--height <px> exact output height (default: 1080)
|
|
66
|
+
--from <ms> first timeline time (default: 0)
|
|
67
|
+
--to <ms> exclusive end time (default: timeline duration)
|
|
68
|
+
--overwrite replace this command's existing frames in the dir
|
|
69
|
+
|
|
70
|
+
measure options (projected bounds only \u2014 no pixels rendered):
|
|
71
|
+
--fps <number> sample rate (default: 30)
|
|
72
|
+
--width <px> output width the bounds project into (default: 1920)
|
|
73
|
+
--height <px> output height the bounds project into (default: 1080)
|
|
74
|
+
--from <ms> first timeline time (default: 0)
|
|
75
|
+
--to <ms> exclusive end time (default: timeline duration)
|
|
76
|
+
--count <n> sample n frames from --from at the --fps spacing
|
|
77
|
+
--at <ms[,ms...]> sample exact timeline times (overrides from/to/count)
|
|
78
|
+
--output <file.json> write the measurement JSON here instead of stdout
|
|
79
|
+
|
|
80
|
+
examples:
|
|
81
|
+
rnxsim mode three
|
|
82
|
+
rnxsim mode three on
|
|
83
|
+
rnxsim mode three configure --script hero-arc --background gradient-tide
|
|
84
|
+
rnxsim mode three configure --environment on --env-shape pane --setting room
|
|
85
|
+
rnxsim mode three render ./cinematic.json --output ./frames --fps 30
|
|
86
|
+
rnxsim mode three measure ./cinematic.json --width 450 --height 900 --at 0,1200
|
|
87
|
+
rnxsim mode three off
|
|
88
|
+
`),process.exit(0));let n=ie(t);if(n){await le(n,t,e);return}if(ne(t)){await oe(t,e);return}(await U(t,e,{modeKey:"threeMode",displayName:"three-mode",actionId:"toggle-three-mode"})).target&&await re(t,e)}function ne(t){return t[0]==="configure"||t.some(e=>["--device","--background","--gradient","--gradient-angle","--colorway","--script","--progress","--animate","--slow","--environment","--env-shape","--env-spread","--env-size","--env-color","--env-glow","--env-plastic","--setting","--focus","--focus-amount","--focus-range","--reset-pose"].includes(e))}async function oe(t,e){let n=j(t,{port:e.port,stripBooleanFlags:["--animate","--slow","--reset-pose"],stripValueFlags:["--device","--background","--gradient","--gradient-angle","--colorway","--script","--progress","--environment","--env-shape","--env-spread","--env-size","--env-color","--env-glow","--env-plastic","--setting","--focus","--focus-amount","--focus-range"]}),o=me(t),i=A({...n,commandTimeoutMs:z+1e3});try{await J(i);let m=await v(i,"SootSim.bridges.threeMode.configure",o);console.log(` three-mode: configured (${ue(m)})`)}finally{i.close()}}async function re(t,e){let n=j(t,{port:e.port}),o=A({...n,commandTimeoutMs:z+1e3});try{await J(o)}finally{o.close()}}async function J(t){let e=await t.send({type:"evaluate",code:`(async () => {
|
|
89
|
+
const deadline = Date.now() + ${z}
|
|
90
|
+
while (Date.now() < deadline) {
|
|
91
|
+
const settings = window.SootSim?.bridges?.settings?.get?.()
|
|
92
|
+
if (settings && settings.threeMode !== true) {
|
|
93
|
+
return { ready: false, disabled: true }
|
|
94
|
+
}
|
|
95
|
+
const bridge = window.SootSim?.bridges?.threeMode
|
|
96
|
+
const state = typeof bridge?.getState === 'function' ? bridge.getState() : null
|
|
97
|
+
if (state?.ready === true) return state
|
|
98
|
+
await new Promise((resolve) => setTimeout(resolve, 50))
|
|
99
|
+
}
|
|
100
|
+
const bridge = window.SootSim?.bridges?.threeMode
|
|
101
|
+
const state = typeof bridge?.getState === 'function' ? bridge.getState() : null
|
|
102
|
+
return state || { ready: false }
|
|
103
|
+
})()`});if(e?.ready===!0)return e;throw e?.disabled?new Error("3d mode is off; run `rnxsim mode three on` before configure"):new Error("3d mode runtime did not become ready")}function ie(t){for(let e=0;e<t.length;e+=1){let n=t[e];if(n==="--sim"||n==="--port"||n==="-p"){e+=1;continue}if(!n.startsWith("-"))return te.has(n)?n:null}return null}function _(t,e){let n=t.indexOf(e);return n>=0?t[n+1]:void 0}function y(t,e,n,o=0){let i=_(t,e);if(i===void 0)return n;let m=Number.parseFloat(i);if(!Number.isFinite(m)||m<o)throw new Error(`${e} expects a number greater than or equal to ${o}`);return m}function G(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function se(t,e){let n=Z(t).toLowerCase();return e==="recording"?n===".mp4"||n===".m4v"?"video/mp4":"video/webm":n===".jpg"||n===".jpeg"?"image/jpeg":n===".webp"?"image/webp":"image/png"}function V(t,e){if(Array.isArray(t))return t.map(o=>V(o,e));if(!G(t))return t;let n={};for(let[o,i]of Object.entries(t))n[o]=V(i,e);if((n.type==="recording"||n.type==="screenshot"||n.kind==="screen")&&typeof n.src=="string"&&!/^(?:blob:|data:|https?:)/i.test(n.src)){let o=B(e,n.src),i=W(o);n.src=`data:${se(o,n.type==="recording"?"recording":"screenshot")};base64,${i.toString("base64")}`}return n}function ae(t){let e=B(t),n=JSON.parse(W(e,"utf8"));return{absolutePath:e,timeline:V(n,q(e))}}async function de(t){await v(t,"SootSim.bridges.settings.set","threeMode",!0),await J(t)}async function le(t,e,n){let o=j(e,{port:n.port,commandTimeoutMs:ee,stripBooleanFlags:["--overwrite"],stripValueFlags:["--output","--fps","--width","--height","--from","--to","--count","--at"]}),i=A(o);try{if(await de(i),t==="seek"){let r=o.positional[1],l=r===void 0?Number.NaN:Number.parseFloat(r);if(!Number.isFinite(l))throw new Error("three-mode seek expects time in ms");let f=await v(i,"SootSim.bridges.threeMode.seek",l);console.log(` three-mode: ${Math.round(f.timeMs)}ms / ${Math.round(f.durationMs)}ms (${f.shotId??"no shot"})`);return}if(t==="play"||t==="pause"){let r=await v(i,`SootSim.bridges.threeMode.${t}`),l=G(r.timeline)?r.timeline:{};console.log(` three-mode: ${t} (${Math.round(Number(l.timeMs??0))}ms)`);return}let m=o.positional[1];if(!m)throw new Error(`three-mode ${t} expects a timeline JSON path`);let T=ae(m),a=await v(i,"SootSim.bridges.threeMode.loadTimeline",T.timeline);if(t==="load"){console.log(` three-mode: loaded ${T.absolutePath} (${Math.round(a.durationMs)}ms)`);return}if(t==="measure"){let r=y(e,"--fps",30,.001),l=Math.round(y(e,"--width",1920,1)),f=Math.round(y(e,"--height",1080,1)),h=_(e,"--at"),$;if(h!==void 0){let c=h.split(",").map(w=>{let S=Number.parseFloat(w);if(!Number.isFinite(S)||S<0)throw new Error(`--at expects comma-separated times in ms, got "${w}"`);return Math.min(S,a.durationMs)}),M=[];for(let w of c){let S=await v(i,"SootSim.bridges.threeMode.measure",{fps:r,width:l,height:f,from:w,count:1});M.push({...S.frames[0],index:M.length})}$={fps:r,from:c[0],to:c[c.length-1],width:l,height:f,frames:M}}else{let c=y(e,"--from",0,0),M=_(e,"--count"),w={fps:r,width:l,height:f,from:c};if(M===void 0){let S=y(e,"--to",a.durationMs,0);if(S<=c||S>a.durationMs)throw new Error(`--to must be greater than --from and at most ${a.durationMs}`);w.to=S}else w.count=Math.round(y(e,"--count",1,1));$=await v(i,"SootSim.bridges.threeMode.measure",w)}let b=`${JSON.stringify($,null,2)}
|
|
104
|
+
`,I=_(e,"--output");if(I){let c=B(I);L(q(c),{recursive:!0}),D(c,b),process.stderr.write(` three-mode: measured ${$.frames.length} frames \u2192 ${c}
|
|
105
|
+
`)}else process.stdout.write(b);return}let u=_(e,"--output");if(!u)throw new Error("three-mode render requires --output <dir>");let g=B(u),R=y(e,"--fps",30,.001),E=Math.round(y(e,"--width",1920,1)),k=Math.round(y(e,"--height",1080,1)),F=y(e,"--from",0,0),x=y(e,"--to",a.durationMs,0);if(x<=F||x>a.durationMs)throw new Error(`--to must be greater than --from and at most ${a.durationMs}`);let N=1e3/R,s=Math.ceil((x-F)/N);L(g,{recursive:!0});let p=Q(g).filter(r=>/^frame-\d{5}\.png$/.test(r)||r==="timeline-render.json");if(p.length>0&&!e.includes("--overwrite"))throw new Error(`${g} already has timeline frames; pass --overwrite to replace them`);for(let r of p)X(B(g,r));let d=[],O=4;for(let r=0;r<s;r+=O){let l=Math.min(O,s-r),f=F+r*N,h=Math.min(x,f+l*N),$=await v(i,"SootSim.bridges.threeMode.renderFrames",{fps:R,from:f,to:h,width:E,height:k,count:l});if($.frames.length!==l)throw new Error(`3d renderer returned ${$.frames.length} frames for a ${l}-frame batch`);for(let b of $.frames){let I=r+b.index,c=`frame-${String(I).padStart(5,"0")}.png`,M=b.dataUrl.indexOf(",");if(M<0||!b.dataUrl.slice(0,M).includes("image/png;base64"))throw new Error(`3d renderer returned a non-PNG frame at ${b.timeMs}ms`);let w=Buffer.from(b.dataUrl.slice(M+1),"base64");D(B(g,c),w),d.push({file:c,timeMs:b.timeMs,sha256:Y("sha256").update(w).digest("hex"),alpha:b.alpha,phoneCollision:b.phoneCollision})}process.stderr.write(`\r three-mode: rendered ${Math.min(r+l,s)}/${s}`)}process.stderr.write(`
|
|
106
|
+
`);let C={version:2,timeline:T.absolutePath,fps:R,from:F,to:x,width:E,height:k,frameCount:s,transparent:d.every(r=>r.alpha.transparentPixels>0),frames:d};D(B(g,"timeline-render.json"),`${JSON.stringify(C,null,2)}
|
|
107
|
+
`),console.log(` three-mode: wrote ${s} deterministic RGBA frames to ${g}`)}finally{i.close()}}function me(t){let e=s=>t.find((p,d)=>t[d-1]===s),n={},o=e("--device");if(o){if(o!=="iphone-17-air"&&o!=="iphone-17-pro"&&o!=="pixel-10")throw new Error(`--device expects iphone-17-air, iphone-17-pro, or pixel-10, got "${o}"`);n.device=o}let i=e("--colorway");i&&(n.colorway=i);let m=e("--background");m&&(n.background=m);let T=e("--gradient");if(T){let s=T.split(",").map(C=>C.trim()).filter(Boolean),p=s.map((C,r)=>{let[l,f]=C.split("@"),h=f!==void 0?Number.parseFloat(f):s.length>1?r/(s.length-1):0;return h>1&&(h=h/100),Number.isFinite(h)||(h=s.length>1?r/(s.length-1):0),{color:l.trim(),offset:h}}),d=e("--gradient-angle"),O=d===void 0?void 0:Number.parseFloat(d);if(d!==void 0&&!Number.isFinite(O))throw new Error(`--gradient-angle expects a number, got "${d}"`);n.customGradient={stops:p,...O!==void 0?{angleDeg:O}:{}}}let a=e("--setting");if(a){if(a!=="none"&&a!=="room"&&a!=="white-backdrop")throw new Error(`--setting expects none, room, or white-backdrop, got "${a}"`);n.setting=a}let u={},g=P(e("--focus"),"--focus");g!==void 0&&(u.enabled=g);for(let[s,p]of[["--focus-amount","amount"],["--focus-range","range"]]){let d=e(s);d&&(u[p]=d)}Object.keys(u).length>0&&(n.focus=u),t.includes("--reset-pose")&&(n.resetPose=!0);let R=P(e("--environment"),"--environment"),E={},k={};for(let[s,p]of[["--env-shape","shape"],["--env-spread","spread"],["--env-size","size"],["--env-color","color"]]){let d=e(s);d&&(E[p]=d)}let F=P(e("--env-glow"),"--env-glow");F!==void 0&&(k.glow=F);let x=P(e("--env-plastic"),"--env-plastic");x!==void 0&&(k.plastic=x),(R!==void 0||Object.keys(E).length>0||Object.keys(k).length>0)&&(n.environment=R===!1?!1:{pins:E,effects:k});let N=e("--script");if(N){let s=e("--progress"),p=s===void 0?1:Number.parseFloat(s);if(!Number.isFinite(p))throw new Error(`--progress expects a number from 0 to 1, got "${s}"`);n.script={id:N,progress:p,animate:t.includes("--animate"),slow:t.includes("--slow")}}return n}function P(t,e){if(t===void 0)return;let n=t.toLowerCase();if(["on","true","yes","1"].includes(n))return!0;if(["off","false","no","0"].includes(n))return!1;throw new Error(`${e} expects on or off, got "${t}"`)}function ue(t){return[`ready=${!!t.ready}`,`background=${String(t.background??"unknown")}`,`colorway=${String(t.colorway??"unknown")}`,`environment=${t.environmentActive?"on":"off"}`,`setting=${String(t.setting??"none")}`,`focus=${t.focus&&typeof t.focus=="object"&&t.focus.enabled?"on":"off"}`].join(", ")}export{U as a,ye as b,J as c,me as d};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! rnx v0.1.312 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
+
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
+
var p={"--help":{type:"boolean",short:"-h"},"--version":{type:"boolean",short:"-V"},"--verbose":{type:"boolean",short:"-v"},"--port":{type:"number",short:"-p"},"--device":{type:"string",short:"-d"},"--theme":{type:"string",short:"-t"},"--headless":{type:"boolean"},"--driver":{type:"string"},"--sim":{type:"string"},"--session":{type:"string"},"--tab":{type:"string"}},m=new Set(["list","describe","find","get","do","wait","network","logs","shell"]),d=new Set(["do","get","wait","shell","debug"]),b=new Set(["detox","maestro","record","film","storage","permissions","perf","screenshot","mode","inspect","debug","timeline","what-happened","shell","assert","device","open","list","use","claim","close","compat","report-issue","desktop","login","logout","auth","setup","serve","daemon","runtime","upgrade","update","version","skill","config","cleanup","app-fonts","agent-wrapper","agent",...m]);function u(c){let r=c.slice(2),e={command:null,commandArgs:[],globalFlags:{},help:!1,version:!1,verbose:!1},s=0;for(;s<r.length;){let o=r[s];if(o==="--"){e.commandArgs.push(...r.slice(s+1));break}let i=Object.entries(p).find(([a,t])=>a===o||t.short===o);if(i){let[a,t]=i,l=a.replace(/^--/,"");if(t.type==="boolean")e.globalFlags[l]=!0,s++;else{let n=r[s+1];if(n===void 0||n.startsWith("-")){console.error(` warning: ${o} requires a value`),s++;continue}if(t.type==="number"){let g=Number(n);if(Number.isNaN(g)){console.error(` warning: ${o} requires a number, got "${n}"`),s+=2;continue}e.globalFlags[l]=g}else e.globalFlags[l]=n;s+=2}continue}if(!e.command&&!o.startsWith("-")){let a=o.indexOf("-");if(a>0){let t=o.slice(0,a),l=o.slice(a+1);if(d.has(t)&&l.length>0){e.command=t;let n=r.slice(s+1);e.commandArgs=[l,...n[0]==="--"?n.slice(1):n];break}}if(b.has(o)){e.command=o;let t=r.slice(s+1);e.commandArgs=t[0]==="--"?t.slice(1):t;break}e.commandArgs=r.slice(s);break}e.commandArgs.push(o),s++}return e.help=!!e.globalFlags.help,e.version=!!e.globalFlags.version,e.verbose=!!e.globalFlags.verbose,e}export{m as a,u as b};
|