rnxsim 0.1.376 → 0.1.378
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/README.md +28 -25
- package/cli/app-config.ts +9 -12
- package/cli/app-fonts.ts +3 -3
- package/cli/app-project.ts +8 -8
- package/cli/auth.ts +7 -9
- package/cli/bin.ts +16 -31
- package/cli/bridge-flow-runner.ts +3 -3
- package/cli/browser-backend.ts +44 -0
- package/cli/command-contract.ts +221 -0
- package/cli/command-registry.ts +291 -0
- package/cli/commands/agent-wrapper.ts +2 -2
- package/cli/commands/app-fonts.ts +2 -2
- package/cli/commands/assert.ts +3 -3
- package/cli/commands/auth.ts +1 -1
- package/cli/commands/box/cloud-box.ts +1 -1
- package/cli/commands/box/plane-share.ts +2 -2
- package/cli/commands/box.ts +4 -6
- package/cli/commands/compat.ts +1 -1
- package/cli/commands/config.ts +2 -2
- package/cli/commands/control.ts +29 -29
- package/cli/commands/cpu-profile.ts +7 -7
- package/cli/commands/daemon-mac-app.ts +7 -7
- package/cli/commands/daemon.ts +10 -10
- package/cli/commands/debug.ts +11 -11
- package/cli/commands/detox.ts +13 -13
- package/cli/commands/diagnose.ts +6 -6
- package/cli/commands/do-chain.ts +1 -2
- package/cli/commands/electron.ts +1 -3
- package/cli/commands/film.ts +3 -3
- package/cli/commands/flow.ts +43 -43
- package/cli/commands/inspect/count.ts +1 -1
- package/cli/commands/inspect/describe.ts +1 -1
- package/cli/commands/inspect/env.ts +2 -2
- package/cli/commands/inspect/get-layout.ts +1 -1
- package/cli/commands/inspect/keyboard.ts +1 -1
- package/cli/commands/inspect/list.ts +1 -1
- package/cli/commands/inspect/memory.ts +1 -1
- package/cli/commands/inspect/resolve-target.ts +1 -1
- package/cli/commands/inspect/screens.ts +1 -1
- package/cli/commands/inspect/tree.ts +1 -1
- package/cli/commands/inspect/url.ts +1 -1
- package/cli/commands/inspect/wait-event.ts +5 -5
- package/cli/commands/inspect.ts +34 -34
- package/cli/commands/install-desktop.ts +3 -3
- package/cli/commands/login.ts +6 -6
- package/cli/commands/maestro-generate.ts +5 -5
- package/cli/commands/maestro.ts +5 -5
- package/cli/commands/profile.ts +1 -1
- package/cli/commands/record.ts +9 -9
- package/cli/commands/runtime.ts +18 -18
- package/cli/commands/screenshot-command.ts +1 -1
- package/cli/commands/screenshot-layers.ts +5 -5
- package/cli/commands/screenshot-mode.ts +1 -1
- package/cli/commands/screenshot.ts +8 -8
- package/cli/commands/screenshots-capture.ts +5 -5
- package/cli/commands/serve.ts +3 -3
- package/cli/commands/setup.ts +20 -12
- package/cli/commands/skills.ts +5 -5
- package/cli/commands/slides.ts +1 -1
- package/cli/commands/telemetry.ts +1 -1
- package/cli/commands/three-mode.ts +1 -1
- package/cli/commands/timeline.ts +8 -8
- package/cli/commands/upgrade.ts +116 -131
- package/cli/commands/upload.ts +12 -12
- package/cli/commands/version.ts +7 -7
- package/cli/commands/what-happened.ts +9 -9
- package/cli/current-sim.ts +3 -3
- package/cli/desktop-companion.ts +1 -1
- package/cli/drivers/playwright.ts +9 -9
- package/cli/drivers/registry.ts +1 -1
- package/cli/drivers/types.ts +1 -1
- package/cli/flow-file.ts +2 -2
- package/cli/flow-session.ts +1 -1
- package/cli/help-core.ts +136 -0
- package/cli/help.ts +17 -53
- package/cli/hints.ts +5 -5
- package/cli/inspect-notice-state.ts +1 -1
- package/cli/maestro-js.ts +1 -1
- package/cli/outbound-endpoints.ts +23 -5
- package/cli/parse-args.ts +19 -66
- package/cli/recording-access.ts +1 -1
- package/cli/registry.ts +1 -0
- package/cli/run-registry.ts +1 -1
- package/cli/run-rnx-core.ts +148 -0
- package/cli/run-rnx.ts +6 -9
- package/cli/runtime-notes.ts +3 -3
- package/cli/standalone.ts +4 -0
- package/cli/ws-bridge.ts +8 -8
- package/detox/config-loader.ts +2 -2
- package/detox/index.ts +8 -8
- package/detox/jest-preset.cjs +1 -1
- package/detox/navigation.ts +2 -2
- package/dist-lib/agent-daemon-client.cjs +5 -5
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +2 -2
- package/dist-lib/agent-sessions.cjs +10 -10
- package/dist-lib/attached-projects.cjs +6 -6
- package/dist-lib/auth/shared-session.cjs +6 -6
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +25 -25
- package/dist-lib/detox/index.cjs +73 -31
- package/dist-lib/detox/jest-preset.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +29 -29
- package/dist-lib/host/bridge-host.cjs +128 -49
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +14 -14
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +8 -8
- package/dist-lib/profiles.cjs +12 -12
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +8 -8
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +329 -160
- package/dist-lib/vite.cjs +9 -9
- package/package.json +4 -11
- package/scripts/dev-server-scanner.ts +2 -2
- package/scripts/optional-demo-registry.ts +1 -1
- package/skills/contrast/SKILL.md +3 -3
- package/skills/rnx-debug/SKILL.md +1 -1
- package/skills/rnx-test/SKILL.md +2 -2
- package/src/agent-identity.ts +1 -1
- package/src/agent-sessions.ts +7 -5
- package/src/cli-version.ts +12 -4
- package/src/config.ts +26 -28
- package/src/disk-cleanup.ts +11 -11
- package/src/home-paths.ts +28 -28
- package/src/host/bridge-host.ts +16 -16
- package/src/metro-plugin.ts +2 -2
- package/src/profiles.ts +2 -2
- package/src/runtime-assets.ts +7 -7
- package/src/runtime-delivery.ts +13 -13
- package/src/screenshots/orchestrate.ts +1 -1
- package/src/screenshots/schema.ts +2 -2
- package/src/skills/builtin/a11y-review.ts +2 -2
- package/src/skills/builtin/compat-check.ts +2 -2
- package/src/skills/builtin/maestro-test.ts +2 -2
- package/src/skills/builtin/perf-profile.ts +2 -2
- package/src/skills/builtin/screenshot-all.ts +2 -2
- package/src/skills/builtin/visual-diff.ts +2 -2
- package/src/skills/registry.ts +8 -8
- package/src/skills/types.ts +1 -1
- package/src/vite-plugin-one.ts +3 -3
- package/src/vite-plugin.ts +15 -2
- package/dist-cli/bin.js +0 -15
- package/dist-cli/chunks/agent-H42FCKFF.js +0 -48
- package/dist-cli/chunks/agent-wrapper-BBZKTZS6.js +0 -17
- package/dist-cli/chunks/app-fonts-43VXIKF4.js +0 -4
- package/dist-cli/chunks/assert-IXOLVO5Z.js +0 -49
- package/dist-cli/chunks/auth-KFMFB6FU.js +0 -12
- package/dist-cli/chunks/beta-5AO3SJB7.js +0 -4
- package/dist-cli/chunks/box-ZHM66L6K.js +0 -1730
- package/dist-cli/chunks/camera-FNJVFCDQ.js +0 -33
- package/dist-cli/chunks/chunk-37MCSPTE.js +0 -71
- package/dist-cli/chunks/chunk-3PEMSUAQ.js +0 -30
- package/dist-cli/chunks/chunk-4TQ5HOK3.js +0 -7
- package/dist-cli/chunks/chunk-5YZYDEMI.js +0 -4
- package/dist-cli/chunks/chunk-6CV3R3XD.js +0 -15
- package/dist-cli/chunks/chunk-7LGK5XU6.js +0 -4
- package/dist-cli/chunks/chunk-7R2TK2NY.js +0 -4
- package/dist-cli/chunks/chunk-7VZZQQEE.js +0 -497
- package/dist-cli/chunks/chunk-AFOVILIL.js +0 -130
- package/dist-cli/chunks/chunk-BEU7CD7E.js +0 -9
- package/dist-cli/chunks/chunk-CE4JQJ6Y.js +0 -6
- package/dist-cli/chunks/chunk-CIE6CZXL.js +0 -142
- package/dist-cli/chunks/chunk-CSJ7L7ZL.js +0 -312
- package/dist-cli/chunks/chunk-CWCQP53A.js +0 -27
- package/dist-cli/chunks/chunk-DCS5FK5N.js +0 -7
- package/dist-cli/chunks/chunk-DEV3E3MV.js +0 -4
- package/dist-cli/chunks/chunk-DGJMIVZM.js +0 -5
- package/dist-cli/chunks/chunk-DGX3MN65.js +0 -5
- package/dist-cli/chunks/chunk-DNPQMTW5.js +0 -4
- package/dist-cli/chunks/chunk-DOVBJBVD.js +0 -5
- package/dist-cli/chunks/chunk-DPBJ3S3J.js +0 -3
- package/dist-cli/chunks/chunk-FVZBGPCU.js +0 -4
- package/dist-cli/chunks/chunk-GDKMOIUT.js +0 -4
- package/dist-cli/chunks/chunk-GIF2NJCS.js +0 -32
- package/dist-cli/chunks/chunk-GZE57ORL.js +0 -4
- package/dist-cli/chunks/chunk-H3U56DKI.js +0 -24
- package/dist-cli/chunks/chunk-HZLOYAPH.js +0 -4
- package/dist-cli/chunks/chunk-J2IKAEU2.js +0 -4
- package/dist-cli/chunks/chunk-JXAXYK7W.js +0 -11
- package/dist-cli/chunks/chunk-KJE2O2GK.js +0 -4
- package/dist-cli/chunks/chunk-KMNVDZZI.js +0 -423
- package/dist-cli/chunks/chunk-LC3QRIRB.js +0 -10
- package/dist-cli/chunks/chunk-LGFTAQYC.js +0 -4
- package/dist-cli/chunks/chunk-LQMUA5IY.js +0 -4
- package/dist-cli/chunks/chunk-MFIQTWC5.js +0 -4
- package/dist-cli/chunks/chunk-MGALNF2F.js +0 -7
- package/dist-cli/chunks/chunk-MLBZZHOY.js +0 -4
- package/dist-cli/chunks/chunk-NNRF7GIB.js +0 -107
- package/dist-cli/chunks/chunk-NORLYTTO.js +0 -7
- package/dist-cli/chunks/chunk-P6KVGV3H.js +0 -14
- package/dist-cli/chunks/chunk-PAJTUK33.js +0 -4
- package/dist-cli/chunks/chunk-QELIC5XP.js +0 -4
- package/dist-cli/chunks/chunk-QRDF33WD.js +0 -11
- package/dist-cli/chunks/chunk-R76BA7C7.js +0 -535
- package/dist-cli/chunks/chunk-RVEB4CZ2.js +0 -4
- package/dist-cli/chunks/chunk-SK4M7NXT.js +0 -5
- package/dist-cli/chunks/chunk-SKMG5DD7.js +0 -5
- package/dist-cli/chunks/chunk-TEESPOYR.js +0 -4
- package/dist-cli/chunks/chunk-TH2UFGVP.js +0 -4
- package/dist-cli/chunks/chunk-TLP3T3VO.js +0 -4
- package/dist-cli/chunks/chunk-TZUABDIJ.js +0 -38
- package/dist-cli/chunks/chunk-UB2W6OQM.js +0 -99
- package/dist-cli/chunks/chunk-UYVXALPB.js +0 -506
- package/dist-cli/chunks/chunk-VQDYFFIG.js +0 -5
- package/dist-cli/chunks/chunk-VWCNJPCJ.js +0 -5
- package/dist-cli/chunks/chunk-VZIK4WIS.js +0 -74
- package/dist-cli/chunks/chunk-W3FNXAQP.js +0 -4
- package/dist-cli/chunks/chunk-XCDNVNP3.js +0 -4
- package/dist-cli/chunks/chunk-XSVILA4Z.js +0 -4
- package/dist-cli/chunks/chunk-XUTJ7ZWD.js +0 -4
- package/dist-cli/chunks/chunk-YTXY3MHW.js +0 -4
- package/dist-cli/chunks/chunk-ZF7PVX44.js +0 -28
- package/dist-cli/chunks/chunk-ZSSG7OR7.js +0 -4
- package/dist-cli/chunks/cleanup-MLOK2OZA.js +0 -25
- package/dist-cli/chunks/cli-version-OBNR366V.js +0 -4
- package/dist-cli/chunks/compat-SHMFSKU7.js +0 -23
- package/dist-cli/chunks/config-TPEAEUJ2.js +0 -13
- package/dist-cli/chunks/connect-3LEXWTE5.js +0 -4
- package/dist-cli/chunks/control-Z3FWA6BO.js +0 -4
- package/dist-cli/chunks/daemon-RSVYSC65.js +0 -4
- package/dist-cli/chunks/debug-GUVAK2KR.js +0 -200
- package/dist-cli/chunks/desktop-OOP2PTKP.js +0 -31
- package/dist-cli/chunks/detox-C2ILVBEC.js +0 -52
- package/dist-cli/chunks/device-NXIQQJWR.js +0 -18
- package/dist-cli/chunks/diagnose-2JBGYE5L.js +0 -43
- package/dist-cli/chunks/disk-cleanup-VURWJYQV.js +0 -4
- package/dist-cli/chunks/do-chain-DJ4UQC7A.js +0 -5
- package/dist-cli/chunks/drivers-JMA2OIKU.js +0 -4
- package/dist-cli/chunks/env-KTNPKEZR.js +0 -4
- package/dist-cli/chunks/film-DCPS7EID.js +0 -74
- package/dist-cli/chunks/flow-4DZ7B2OA.js +0 -4
- package/dist-cli/chunks/help-34CJMQY2.js +0 -4
- package/dist-cli/chunks/hidden-runtime-alias-HHT2C7WE.js +0 -4
- package/dist-cli/chunks/home-paths-KTPGCPMS.js +0 -4
- package/dist-cli/chunks/inspect-JF5WYJRD.js +0 -4
- package/dist-cli/chunks/install-desktop-ZIC4CDXI.js +0 -4
- package/dist-cli/chunks/login-TTJAOI2Q.js +0 -26
- package/dist-cli/chunks/logout-ERAQ6SKW.js +0 -4
- package/dist-cli/chunks/maestro-W46QCF77.js +0 -108
- package/dist-cli/chunks/maestro-generate-VBLM3MTU.js +0 -36
- package/dist-cli/chunks/mode-ZEDZK7R7.js +0 -26
- package/dist-cli/chunks/optional-demo-registry-ZUTPSVYQ.js +0 -4
- package/dist-cli/chunks/perf-YVT2WXT4.js +0 -48
- package/dist-cli/chunks/permissions-L7VVDHFP.js +0 -13
- package/dist-cli/chunks/platform-7TJOU2FB.js +0 -6
- package/dist-cli/chunks/privacy-57UOTB5J.js +0 -4
- package/dist-cli/chunks/record-VXG37P7U.js +0 -72
- package/dist-cli/chunks/report-issue-WNNOBZHC.js +0 -29
- package/dist-cli/chunks/reset-H5NBFE5U.js +0 -4
- package/dist-cli/chunks/resolve-target-57TK5WLE.js +0 -4
- package/dist-cli/chunks/runtime-QU2NIF2K.js +0 -4
- package/dist-cli/chunks/screenshot-command-AN56TTG7.js +0 -159
- package/dist-cli/chunks/screenshot-layers-3W5R7DB2.js +0 -20
- package/dist-cli/chunks/screenshots-capture-6AWJY7XZ.js +0 -42
- package/dist-cli/chunks/serve-GLYO5Q7J.js +0 -56
- package/dist-cli/chunks/setup-UA2HLD7S.js +0 -4
- package/dist-cli/chunks/sim-client-5C2RDQQO.js +0 -4
- package/dist-cli/chunks/skills-EYXWBRNQ.js +0 -50
- package/dist-cli/chunks/state-REJ7W6K3.js +0 -14
- package/dist-cli/chunks/storage-CFMDHI3V.js +0 -37
- package/dist-cli/chunks/store-XMCUA45G.js +0 -4
- package/dist-cli/chunks/telemetry-FBL3NAKB.js +0 -4
- package/dist-cli/chunks/timeline-HMCHN5FO.js +0 -24
- package/dist-cli/chunks/upgrade-2QSPAA3P.js +0 -7
- package/dist-cli/chunks/upload-DUQBKZYV.js +0 -4
- package/dist-cli/chunks/version-IOA6QFGB.js +0 -6
- package/dist-cli/chunks/web-NCGUYVCJ.js +0 -4
- package/dist-cli/chunks/welcome-QYGSQCWQ.js +0 -5
- package/dist-cli/chunks/what-happened-YTOUK4LO.js +0 -25
- package/dist-cli/chunks/ws-bridge-OF4OZARG.js +0 -4
- package/scripts/postinstall.cjs +0 -3
- package/scripts/preuninstall.cjs +0 -118
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.376 | (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 i}from"./chunk-5YZYDEMI.js";import{spawn as m}from"node:child_process";import c from"node:fs";import t from"node:path";function b(n){let e=t.resolve(n),r=null;for(;;){if(!r&&c.existsSync(t.join(e,"package.json"))&&(r=e),c.existsSync(t.join(e,".git")))return r;let s=t.dirname(e);if(s===e)return null;e=s}}function g(n){let e=t.resolve(n);for(;;){if(c.existsSync(t.join(e,"bun.lock"))||c.existsSync(t.join(e,"bun.lockb")))return"bun";if(c.existsSync(t.join(e,"pnpm-lock.yaml")))return"pnpm";if(c.existsSync(t.join(e,"package-lock.json")))return"npm";let r=t.dirname(e);if(r===e)return"npm";e=r}}function j(n){let e=t.resolve(n.appDir),r=u(t.join(e,"package.json")),s=`${i.commandName} open`,o=r.scripts?.[i.commandName];if(o&&o!==s)throw new Error(`package.json already defines scripts.${i.commandName} as ${JSON.stringify(o)}; resolve that conflict before setup`);let a=g(e),p=[];return r.devDependencies?.[i.packageName]!==n.cliVersion&&p.push(f(a,n.cliVersion)),o!==s&&p.push(S(a)),{appDir:e,packageManager:a,operations:p}}async function w(n,e){for(let r of n.operations)e.dryRun||await y(r,n.appDir,e.json)}function O(n){return n.operations.map(e=>`${e.command} ${e.args.map(l).join(" ")}`)}function u(n){let e;try{e=JSON.parse(c.readFileSync(n,"utf8"))}catch(o){let a=o instanceof Error?o.message:String(o);throw new Error(`could not read ${n}: ${a}`)}if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${n} must contain a JSON object`);let r=d(Reflect.get(e,"scripts")),s=d(Reflect.get(e,"devDependencies"));return{...r?{scripts:r}:{},...s?{devDependencies:s}:{}}}function d(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let e=Object.entries(n).filter(r=>typeof r[1]=="string");return Object.fromEntries(e)}function f(n,e){let r=`${i.packageName}@${e}`;switch(n){case"bun":return{command:"bun",args:["add","--dev","--exact",r],description:`install ${r} as an exact dev dependency`};case"pnpm":return{command:"pnpm",args:["add","--save-dev","--save-exact",r],description:`install ${r} as an exact dev dependency`};case"npm":return{command:"npm",args:["install","--save-dev","--save-exact",r],description:`install ${r} as an exact dev dependency`}}}function l(n){return/^[a-zA-Z0-9_./@=-]+$/.test(n)?n:JSON.stringify(n)}function y(n,e,r){return new Promise((s,o)=>{let a=m(n.command,n.args,{cwd:e,stdio:r?["ignore",2,"inherit"]:"inherit"});a.once("error",o),a.once("exit",p=>{p===0?s():o(new Error(`${n.command} exited with code ${p??"unknown"}`))})})}function S(n){return{command:n,args:n==="bun"?["pm","pkg","set",`scripts.${i.commandName}=${i.commandName} open`]:["pkg","set",`scripts.${i.commandName}=${i.commandName} open`],description:`add the \`${i.commandName}\` package script`}}export{b as a,j as b,w as c,O as d};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.376 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{execFileSync as S,execSync as x}from"node:child_process";var g=new WeakMap,l=new Set,b=!1;function f(){return{platform:process.platform,env:process.env}}function A(e){return S("/bin/ps",["-p",String(e),"-o","command="],{encoding:"utf8"}).trim()}function w(e=f()){return e.platform==="linux"&&e.env.GITHUB_ACTIONS==="true"&&e.env.RUNNER_OS==="Linux"}function L(e){let r=String(e);return/^--disable-gpu(?:=.*)?$/i.test(r)||/^--enable-unsafe-swiftshader(?:=.*)?$/i.test(r)||/^--use-angle=(?:swiftshader|swiftshader-webgl)$/i.test(r)||/^--use-gl=swiftshader$/i.test(r)}function I(e){return e.match(/(?:^|\s)(--disable-gpu(?:=[^\s]+)?|--enable-unsafe-swiftshader(?:=[^\s]+)?|--use-angle=(?:swiftshader|swiftshader-webgl)|--use-gl=swiftshader)(?=\s|$)/i)?.[1]??null}function k(e){return e==="darwin"?"metal":e==="linux"?"vulkan":"default"}function y(e,r=f()){if(w(r))return;let n=I(e);if(n)throw new Error(`[reap-browser] refused software-rendering Chrome process argument ${n}`);let o=k(r.platform),t=e.split(/\s+/);if(!t.includes(`--use-angle=${o}`)||!t.includes("--enable-gpu"))throw new Error(`[reap-browser] Chrome process did not retain the required ${o} GPU arguments`);if(r.platform==="darwin"&&e.includes("/Applications/Google Chrome.app/"))throw new Error("[reap-browser] refused the user's installed Google Chrome; use Playwright channel chromium")}function E(e){if(!e||typeof e!="object")return[];let n=e.gpu;if(!n||typeof n!="object")return[];let o=n,t=[],a=o.auxAttributes;if(a&&typeof a=="object")for(let s of Object.values(a))typeof s=="string"&&t.push(s);let i=o.devices;if(Array.isArray(i)){for(let s of i)if(!(!s||typeof s!="object"))for(let u of Object.values(s))typeof u=="string"&&t.push(u)}return t}function B(e){if(!e||typeof e!="object")return null;let r=e;if(!Array.isArray(r.processInfo))return null;for(let n of r.processInfo){if(!n||typeof n!="object")continue;let o=n;if(o.type==="browser"&&typeof o.id=="number"&&Number.isInteger(o.id)&&o.id>0)return o.id}return null}function G(e,r=f()){if(w(r))return;let o=E(e).join(" | ");if(!o||/swiftshader|llvmpipe|software rasterizer/i.test(o))throw new Error(`[reap-browser] Chrome reported a software renderer${o?`: ${o}`:""}`);if(r.platform==="darwin"&&!/metal/i.test(o))throw new Error(`[reap-browser] Chrome did not report an ANGLE Metal renderer: ${o}`)}function p(e){if(e&&typeof e=="object"){let n=g.get(e);if(n!==void 0)return n}let r=e;if(r&&typeof r.process=="function")try{let n=r.process();if(n&&typeof n.pid=="number"&&n.pid>0)return n.pid}catch{}if(r&&typeof r.browser=="function")try{let n=r.browser();if(n)return p(n)}catch{}return null}function h(e){let r=[];try{r=x(`pgrep -P ${e} || true`).toString().split(`
|
|
5
|
-
`).filter(Boolean)}catch{}for(let n of r)h(Number(n));try{process.kill(e,"SIGKILL")}catch{}}function d(e){let r=e;if(!r||typeof r!="object")return null;if(typeof r.newBrowserCDPSession=="function"||typeof r.process=="function")return r;if(typeof r.browser!="function")return null;try{let n=r.browser();return n?d(n):null}catch{return null}}function m(e,r,n){e&&typeof e=="object"&&g.set(e,n),g.set(r,n),l.add(n),C()}async function $(e){let r=p(e);if(r!==null)return r;let n=d(e);if(!n||typeof n.newBrowserCDPSession!="function")return null;let o=await n.newBrowserCDPSession();try{let t=B(await o.send("SystemInfo.getProcessInfo"));return t===null?null:(m(e,n,t),t)}finally{await o.detach?.()}}async function N(e){let r=p(e);if(r!==null){l.delete(r),h(r);return}let n=e;if(n&&typeof n.close=="function")try{await n.close()}catch{}}async function j(e,r,n,o=A){if(w(r))return;let t=p(e),a=d(e);t!==null&&a&&m(e,a,t),t!==null&&(r.platform==="darwin"||r.platform==="linux")&&y(o(t),r);let i=n?await n(e):e,s=d(i);if(s&&typeof s.newBrowserCDPSession=="function"){let u=await s.newBrowserCDPSession();try{let c=B(await u.send("SystemInfo.getProcessInfo"));if(c===null)throw new Error("[reap-browser] Chrome did not report its browser process id");m(e,s,c),i&&typeof i=="object"&&g.set(i,c),(r.platform==="darwin"||r.platform==="linux")&&y(o(c),r),G(await u.send("SystemInfo.getInfo"),r);return}finally{await u.detach?.()}}throw new Error("[reap-browser] could not validate the launched Chrome GPU renderer")}var D=!1;function C(){if(b)return;b=!0;let e=()=>{for(let r of l)h(r)};D||(process.on("SIGTERM",()=>{e(),process.exit(0)}),process.on("SIGINT",()=>{e(),process.exit(0)})),process.on("exit",e)}async function R(e){let r=await e(),n=p(r);if(n===null)try{n=await $(r)}catch{n=null}let o=new Set;n!=null&&(o.add(n),l.add(n),C());let t=d(r)??r;if(typeof t.on=="function"){let i=typeof t.newBrowserCDPSession=="function"?"disconnected":"close";t.on(i,()=>{for(let s of o)l.delete(s);o.clear()})}return{browser:r,reapNow:()=>{for(let i of o)h(i),l.delete(i);o.clear()}}}async function T(e){let{browser:r}=await R(e);return r}function W(e=process.platform){return["--enable-unsafe-webgpu",`--use-angle=${k(e)}`,"--enable-gpu","--enable-gpu-rasterization","--enable-zero-copy","--ignore-gpu-blocklist"]}function O(e={},r=f()){let n=Array.isArray(e.args)?e.args:[],o=n.find(L);if(o!==void 0)throw new Error(`[reap-browser] refused software-rendering Chrome launch argument ${String(o)}`);if(e.executablePath!==void 0)throw new Error("[reap-browser] executablePath bypasses Playwright Chrome for Testing and is not allowed");if(e.ignoreDefaultArgs===!0)throw new Error("[reap-browser] ignoreDefaultArgs=true bypasses required Chrome launch defaults");let t=new Set(["--enable-unsafe-webgpu","--enable-gpu","--enable-gpu-rasterization","--enable-zero-copy","--ignore-gpu-blocklist"]),a=n.filter(u=>{let c=String(u);return!t.has(c)&&!c.startsWith("--use-angle=")}),i=Array.isArray(e.ignoreDefaultArgs)?e.ignoreDefaultArgs:[],s=[...new Set([...i,"--disable-gpu","--enable-unsafe-swiftshader"])];return{...e,channel:"chromium",args:[...a,...W(r.platform)],ignoreDefaultArgs:s}}function v(e,r,n,o={}){return async()=>{let t=o.runtime??f();if(w(t))return e(P(r,t));let a=P(r,t),i;try{i=await e(a)}catch(s){let u=s instanceof Error?s.message:String(s);throw/not found at|not installed|Chromium distribution|Executable doesn't exist|No such file/i.test(u)?new Error("[reap-browser] Playwright Chrome for Testing is required for local GPU browser work. Run `bun scripts/ops/install-playwright-browsers.ts chromium`.",{cause:s}):s}try{await j(i,t,n,o.processCommand)}catch(s){throw await N(i),s}return i}}function z(e){if(e.ignoreDefaultArgs===!0)throw new Error("[reap-browser] ignoreDefaultArgs=true bypasses required Chrome launch defaults");let n=(Array.isArray(e.args)?e.args.map(String):[]).filter(t=>!t.startsWith("--use-angle=")&&t!=="--enable-gpu"&&t!=="--enable-gpu-rasterization"&&t!=="--enable-zero-copy"&&t!=="--ignore-gpu-blocklist"&&!/^--enable-unsafe-webgpu(?:=.*)?$/i.test(t)&&!/^--enable-features=(?:Vulkan|WebGPU)(?:,(?:Vulkan|WebGPU))*$/i.test(t)&&!/^--enable-unsafe-swiftshader(?:=.*)?$/i.test(t)),o={...e,args:[...n,"--use-angle=swiftshader","--enable-unsafe-swiftshader","--enable-unsafe-webgpu","--enable-features=Vulkan"]};return delete o.channel,delete o.executablePath,o}function P(e={},r=f()){return w(r)?z(e):O(e,r)}async function q(e,r={},n,o={}){return T(v(e,r,n,o))}async function J(e,r={},n,o={}){return R(v(e,r,n,o))}export{q as a,J as b};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.376 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{o as d}from"./chunk-QRDF33WD.js";import{chmodSync as S,existsSync as f,mkdirSync as A,readFileSync as k,rmSync as o,writeFileSync as y}from"node:fs";import{dirname as c,join as D,resolve as m}from"node:path";var s=1,p="SOOTSIM_SHARED_AUTH_FILE",u="https://contrast.dev";function w(){let t=process.env[p];return t?.trim()?c(m(t)):d()}function a(){let t=process.env[p];return t?.trim()?m(t):D(w(),"desktop-auth.json")}function g(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.id!="string"||!e.id.trim()?null:{id:e.id.trim(),name:typeof e.name=="string"?e.name:void 0,email:typeof e.email=="string"?e.email:void 0,image:typeof e.image=="string"?e.image:void 0,githubUsername:typeof e.githubUsername=="string"?e.githubUsername:void 0,isAdmin:e.isAdmin===!0,teams:Array.isArray(e.teams)?e.teams.map(r=>{if(!r||typeof r!="object")return null;let n=r;return typeof n.id!="string"||typeof n.name!="string"?null:{id:n.id,name:n.name,role:n.role==="owner"?"owner":"member",githubOrg:typeof n.githubOrg=="string"?n.githubOrg:null}}).filter(r=>!!r):void 0}}function v(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==s||typeof e.token!="string"||!e.token.trim())return null;let r=typeof e.origin=="string"&&e.origin.trim()?e.origin.trim():u,n=e.source==="cli"||e.source==="electron"||e.source==="browser"||e.source==="unknown"?e.source:"unknown",i=typeof e.updatedAt=="string"&&e.updatedAt?e.updatedAt:new Date().toISOString(),h=typeof e.validatedAt=="string"&&e.validatedAt?e.validatedAt:void 0;return{version:s,token:e.token.trim(),user:g(e.user),origin:r,source:n,updatedAt:i,validatedAt:h}}function b(){let t=a();if(!f(t))return null;try{let e=JSON.parse(k(t,"utf8")),r=v(e);return r||(o(t,{force:!0}),null)}catch{return o(t,{force:!0}),null}}function O(t){let e=a();A(c(e),{recursive:!0});let r={version:s,token:t.token.trim(),user:t.user?g(t.user):null,origin:t.origin?.trim()||u,source:t.source,updatedAt:t.updatedAt||new Date().toISOString(),validatedAt:t.validatedAt};y(e,JSON.stringify(r,null,2)+`
|
|
5
|
-
`);try{S(e,384)}catch{}return r}function l(){o(a(),{force:!0})}async function E(t){let e=b();if(!e?.token)return null;let r=t||e.origin||u;try{let n=await fetch(`${r.replace(/\/$/,"")}/api/auth/me`,{headers:{authorization:`Bearer ${e.token}`}});if(n.status===401)return l(),null;if(!n.ok)return e;let i=await n.json();return i.user?.id?O({token:e.token,user:i.user,origin:r,source:e.source,validatedAt:new Date().toISOString()}):(l(),null)}catch{return e}}export{b as a,O as b,l as c,E as d};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.376 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
var o=!0,e="public beta",t=e,n="we send anonymous error and dependency data while you use it";export{o as a,e as b,t as c,n as d};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.376 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{AsyncLocalStorage as n}from"node:async_hooks";var t=class extends Error{code;constructor(e){super(`rnx exited with code ${e}`),this.name="RnxExit",this.code=e}},s=new n;function i(r){if(r instanceof t)throw r}function c(r){throw new t(r)}export{t as a,i as b,c};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.376 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{existsSync as s}from"node:fs";import{basename as a,dirname as p,join as l}from"node:path";import{fileURLToPath as m,pathToFileURL as c}from"node:url";var u="packages/sootsim/scripts/demo-app-registry.ts",f=8;function A(o){let r=o;for(let e=0;e<f;e++){if(a(r)==="node_modules")return null;let n=l(r,u);if(s(n))return n;let i=p(r);if(i===r)return null;r=i}return null}var t=null;async function S(){if(t)return t;let o=A(p(m(import.meta.url)));if(!o)return t=[],t;try{let r=await import(c(o).href);t=Array.isArray(r.APPS)?r.APPS:[]}catch{t=[]}return t}function D(){return t??[]}function O(o){let r=t;return t=o,{restore:()=>{t=r}}}export{A as a,S as b,D as c,O as d};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.376 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
-
import { createRequire as __sootsimCreateRequire } from 'node:module'
|
|
3
|
-
var require = __sootsimCreateRequire(import.meta.url)
|
|
4
|
-
import{F as b,p as h,r as y,t as S}from"./chunk-CSJ7L7ZL.js";import{u as m,y as w,z as p}from"./chunk-CWCQP53A.js";var C={timeoutMs:1800,settleMs:48,startWindowMs:64};function g(e){return new Promise(n=>setTimeout(n,e))}function P(e){return e.includes("--json")}function I(e){process.stdout.write(`${JSON.stringify(e??null,null,2)}
|
|
5
|
-
`)}function q(e){process.stderr.write(`${e}
|
|
6
|
-
`)}function f(e,n=Date.now()){let r=new Date(e),t=`${d(r.getHours())}:${d(r.getMinutes())}:${d(r.getSeconds())}`,s=n-e;if(s<0)return t;let o=Math.round(s/1e3);return o<60?`${t} +${o}s`:o<3600?`${t} +${Math.round(o/60)}m`:o<86400?`${t} +${Math.round(o/3600)}h`:`${t} +${Math.round(o/86400)}d`}function d(e){return e<10?`0${e}`:String(e)}async function T(e,n,...r){return w(e,`__sootsimTest.${n}`,...r)}async function x(e,n,...r){return p(e,`SootSim.bridges.mainShell.${n}`,...r)}async function N(e,n={}){try{let r=await T(e,"waitForScreenTransitions",C);if(!n.verbose||!r?.started)return;if(r.timedOut){console.log(` screen transition still active after ${r.waitedMs}ms; continuing`);return}r.waitedMs>0&&console.log(` waited ${r.waitedMs}ms for screen transition settle`)}catch{}}async function _(e,n,r,...t){let s=Date.now()+Math.max(0,r);for(;;)try{return await x(e,n,...t)}catch(o){if(!b(o)||Date.now()>=s)throw o;await g(50)}}async function k(e,n,r,t={}){let s=t.attempts??30,o=t.intervalMs??500,a=t.minNodeCount??10;for(let i=0;i<s;i++){let l=m(e,{commandTimeoutMs:n,simId:r,simIdSource:t.simIdSource});try{let u=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof u=="number"&&u>a)return{bridge:l,count:u}}catch{}l.close(),await g(o)}return null}async function E(e,n,r,t={}){let s=t.timeoutMs??8e3,o=t.intervalMs??250,a=Date.now()+s;for(;Date.now()<a;){let i=m(e,{commandTimeoutMs:n,simId:r,simIdSource:t.simIdSource});try{return await i.send({type:"evaluate",code:"1"}),i}catch{i.close()}await g(o)}return null}async function O(e,n={}){let r=n.timeoutMs??1e4,t=await h(e,r),s=t.ready?t.flag===!0?"flag":"nodes-fallback":t.errors>0&&t.flag!==!0?"error-bail":"timeout";return{ready:t.ready,source:s,elapsedMs:t.elapsedMs,nodes:t.nodes,targets:t.targets,liveFrameActive:t.liveFrameActive,liveFrameChannels:t.liveFrameChannels,liveFramePublishes:t.liveFramePublishes,flag:t.flag,loadingText:t.loadingText,externalReady:t.externalReady,externalStatus:t.externalStatus,externalError:t.externalError,errors:t.errors}}function M(e){let n=e.displayUrl||e.url;return e.status!=null?`${e.method} ${n} -> ${e.status}${e.statusText?` ${e.statusText}`:""}`:e.error?`${e.method} ${n} -> ${e.error}`:`${e.method} ${n}`}async function $(e,n,...r){return e.send({type:"call",path:`__sootsimTest.${n}`,args:r})}async function v(e,n={}){let r=await e.send({type:"evaluate",code:S});if(!r||typeof r!="object")return;let t=Math.max(0,Number(r.errors)||0),s=Math.max(0,Number(r.warnings)||0);if(t===0&&s===0)return;let o=[];if(t>0&&o.push(`${t} console error${t===1?"":"s"}`),s>0&&o.push(`${s} console warning${s===1?"":"s"}`),console.log(`
|
|
7
|
-
console: ${o.join(", ")}`),n.errorsCommand&&console.log(` inspect: ${n.errorsCommand}`),s>0&&n.warningsCommand&&console.log(` inspect: ${n.warningsCommand}`),!n.includeTail||t===0)return;let a=await y(e,5);if(!(!Array.isArray(a)||a.length===0)){console.log(`
|
|
8
|
-
recent console errors:
|
|
9
|
-
`);for(let i of a){let l=f(i.timestamp),u=Array.isArray(i.args)?i.args.map(c=>typeof c=="object"?JSON.stringify(c):String(c)).join(" "):String(i);console.log(` [${l}] ${u}`)}}}async function B(e,n={}){let r=await $(e,"getRequestCounts");if(!r||typeof r!="object")return;let t=Math.max(0,Number(r.failed)||0);if(t===0||(console.log(`
|
|
10
|
-
network: ${t} failed request${t===1?"":"s"}`),n.requestsCommand&&console.log(` inspect: ${n.requestsCommand}`),!n.includeTail))return;let s=await $(e,"getFailedRequests",5);if(!(!Array.isArray(s)||s.length===0)){console.log(`
|
|
11
|
-
recent failed requests:
|
|
12
|
-
`);for(let o of s){let a=f(o.timestamp);console.log(` [${a}] ${M(o)}`),o.responseBody?console.log(` ${o.responseBody}`):o.error&&console.log(` ${o.error}`)}}}async function R(e){let n=await e.send({type:"evaluate",code:`(async () => {
|
|
13
|
-
const test = window.__sootsimTest
|
|
14
|
-
const mainShell = window.SootSim?.bridges?.mainShell
|
|
15
|
-
let shell = null
|
|
16
|
-
try {
|
|
17
|
-
shell = typeof mainShell?.getState === 'function' ? await mainShell.getState() : null
|
|
18
|
-
} catch {}
|
|
19
|
-
let nodeCount = 0
|
|
20
|
-
try {
|
|
21
|
-
nodeCount = typeof test?.getNodeCount === 'function' ? await test.getNodeCount() : 0
|
|
22
|
-
} catch {}
|
|
23
|
-
return {
|
|
24
|
-
url: window.location.href,
|
|
25
|
-
simId: window.__sootsimSimId || null,
|
|
26
|
-
nodeCount,
|
|
27
|
-
mode: window.__sootsimRenderHost ? 'render-worker' : 'main-thread',
|
|
28
|
-
shell: shell
|
|
29
|
-
? {
|
|
30
|
-
state: shell.state || null,
|
|
31
|
-
activeApp: shell.activeApp || null,
|
|
32
|
-
showSwitcher: !!shell.showSwitcher,
|
|
33
|
-
switcherPhase: shell.switcherPhase || null,
|
|
34
|
-
}
|
|
35
|
-
: null,
|
|
36
|
-
}
|
|
37
|
-
})()`});if(!n||typeof n!="object")return;console.log(`
|
|
38
|
-
state:`),n.simId&&console.log(` sim: ${n.simId}`),n.url&&console.log(` url: ${n.url}`),n.mode&&console.log(` mode: ${n.mode}`);let r=Number(n.nodeCount)||0;console.log(` nodes: ${r}${r>10?" (ready)":" (not ready)"}`);let t=n.shell;if(t&&typeof t=="object"){let s=[t.state?`state=${t.state}`:null,t.activeApp?`app=${t.activeApp}`:null,t.showSwitcher?"switcher=open":null,t.switcherPhase?`phase=${t.switcherPhase}`:null].filter(Boolean);s.length>0&&console.log(` shell: ${s.join(" ")}`)}}async function L(e,n={}){try{await R(e)}catch{}try{await v(e,{includeTail:!0,errorsCommand:n.errorsCommand,warningsCommand:n.warningsCommand})}catch{}try{await B(e,{includeTail:!0,requestsCommand:n.requestsCommand})}catch{}}export{g as a,P as b,I as c,q as d,f as e,T as f,N as g,_ as h,k as i,E as j,O as k,R as l,L as m};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/*! rnx v0.1.376 | (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 G,b as J,c as Fe}from"./chunk-JXAXYK7W.js";import{c as $e,d as Ne}from"./chunk-XUTJ7ZWD.js";import{q as _e}from"./chunk-P6KVGV3H.js";import{t as Ue,v as Pe,x}from"./chunk-CWCQP53A.js";import{c as m}from"./chunk-TH2UFGVP.js";import{a as Ae}from"./chunk-5YZYDEMI.js";import{createHash as Mt}from"crypto";import{readFileSync as w}from"fs";import He from"path";import{gzipSync as ge,gunzipSync as Tt}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 at,constants as lt}from"node:zlib";var ut=9;function Ce(e){return at(e,{params:{[lt.BROTLI_PARAM_QUALITY]:ut}})}var ue={initMs:3e4,putMs:12e4,finalizeMs:18e4};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 ct(e){let t=ce(ue.putMs,`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 dt(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 ct(l),o++,r?.(o,i)}}))}function pt(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 ft(e){return e.replace(/\/+$/,"")}var K=class extends Error{constructor(r,s,o,i=""){super(r);this.status=s;this.phase=o;this.responseText=i;this.name="PresignedUploadError"}};async function Oe(e){let t=ft(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(ue.initMs,"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 M=await o.text().catch(()=>"");throw new K(`init failed: ${o.status} ${M.slice(0,200)}`,o.status,"init",M)}let i=await o.json(),l=pt(i,e.bundleBytes,e.filesByHash,e.extras);await dt(l,e.concurrency??8,e.onPutProgress);let f=ce(ue.finalizeMs,"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 M=await c.text().catch(()=>"");throw new K(`finalize failed: ${c.status} ${M.slice(0,200)}`,c.status,"finalize",M)}let y=await c.json();return{init:i,finalize:y}}function mt(e){return e!==null&&typeof e=="object"?e:null}function ze(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function de(e){let t=mt(e);return t?t.schemaVersion===1&&ze(t.t)!==void 0&&ze(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function gt(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 De(e){return gt(e,de)}import{execSync as ht}from"child_process";function fe(e){try{return ht(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 yt(){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 y=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(y),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:yt();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 Kt(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 Vt(e){return e.auth?e.uploadedShare?!0:e.auth.kind==="github"||process.env.GITHUB_ACTIONS==="true":!1}async function Wt(e){let t=e.auth??G();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:J(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 St(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 vt(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,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 y=w(f);return{meta:{id:i,label:typeof l=="string"&&l?l:i,kind:"interaction",t:Math.round(c),contentType:"image/png",sizeBytes:y.byteLength},bytes:y}})}var Ke=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://contrast.dev",Ve=process.env.SOOTSIM_PREVIEW_ORIGIN||Ae.origin;async function Rt(e){return e||(process.env.SOOTSIM_UPLOAD_ORIGIN?process.env.SOOTSIM_UPLOAD_ORIGIN:Ke)}function N(e){return e.replace(/\/$/,"")}function xt(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 kt(e){try{let t=new URL(e).hostname.toLowerCase();return t==="contrast.dev"||t.endsWith(".contrast.dev")}catch{return!1}}function Bt(e,t){return t?N(t):process.env.SOOTSIM_PREVIEW_ORIGIN?N(process.env.SOOTSIM_PREVIEW_ORIGIN):xt(e)?N(e):kt(e)?N(Ve):N(e)}function Et(){console.log(`
|
|
6
|
-
rnx record upload \u2014 publish the current recorded bundle as a /preview/<id> link
|
|
7
|
-
|
|
8
|
-
usage:
|
|
9
|
-
rnx 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: ${Ke})
|
|
13
|
-
override with SOOTSIM_UPLOAD_ORIGIN env var
|
|
14
|
-
--public-origin <url>
|
|
15
|
-
public /preview link origin (default: ${Ve}
|
|
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: rnx 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
|
-
rnx record upload --events ./my-session.jsonl.gz
|
|
54
|
-
rnx record upload --origin https://contrast.localhost:3000 --events ./my-session.jsonl.gz --open
|
|
55
|
-
rnx record upload --video /tmp/sootsim-flow.mp4 --video-duration-ms 12000
|
|
56
|
-
`)}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 je(e,t){let r=e.findIndex(s=>s===t);return r<0?!1:(e.splice(r,1),!0)}function qe(e,t){if(!e)return;let r=Number(e);return(!Number.isFinite(r)||r<=0)&&(console.error(` invalid ${t}: ${e}`),m(1)),Math.round(r)}function Ge(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 Je(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 It(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function At(e){try{return new URL(e).searchParams.get("appFonts")||""}catch{return""}}function Ut(e){try{return new URL(e).searchParams.get("appSplash")||""}catch{return""}}function Pt(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 _t(e,t){let s=[];for(let o=0;o<t;o+=15e5){let i=Math.min(o+15e5,t),l=await x(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${o}, ${i})`);if(typeof l!="string")return null;s.push(l)}return s.join("")}function $t(e){return e.recordedDurationMs&&e.recordingStartedAtMs?{since:e.recordingStartedAtMs-1e4,until:e.recordingStartedAtMs+e.recordedDurationMs+5e3,limit:2e3}:{limit:2e3}}function Nt(e){let t=w(e),s=(t[0]===31&&t[1]===139?Tt(t):t).toString("utf8");return De(s)}function Ft(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 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 Ct(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 mn(e,t){(e.includes("--help")||e.includes("-h"))&&(Et(),m(0));let r=[...e],s=await Rt(p(r,"--origin")),o=Bt(s,p(r,"--public-origin")),i=p(r,"--events"),l=p(r,"--screenshot"),f=p(r,"--snapshot-manifest"),c=p(r,"--video"),y=p(r,"--timeline-events"),M=p(r,"--trace-frame-stats"),V=p(r,"--failure-bundle"),W=p(r,"--video-duration-ms"),ye=qe(p(r,"--recorded-duration-ms"),"--recorded-duration-ms"),be=qe(p(r,"--recording-started-at-ms"),"--recording-started-at-ms"),Y=p(r,"--owner"),Q=p(r,"--repo"),O=p(r,"--billing-kind"),We=p(r,"--run-scope"),Ye=je(r,"--open");(Y&&!Q||!Y&&Q)&&(console.error(" --owner and --repo must be provided together"),m(1)),O&&O!=="test_run"&&(console.error(` invalid --billing-kind: ${O}`),m(1)),!i&&!c&&(console.error(" preview uploads require playback data: pass --events or --video.\n for a normal local preview, use `rnx record --mode combined --open`\n or `rnx maestro test --preview` instead of uploading a bundle-only snapshot."),m(1));let we=je(r,"--assets-only"),Qe=Ue(r,{stripBooleanFlags:[],stripValueFlags:[]}),T=Pe(Qe),d,Me=[],k=[],B=y?Nt(y):[],Te=M?Ft(M):null;B.push(...Lt(Te));let Se=B.length,X=null;try{if(d=await x(T,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),d?.bundleUrl){let u=new URL(d.bundleUrl).origin,[g,P]=await Promise.all([x(T,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(u)}) || [])`),x(T,`(async () => {
|
|
57
|
-
const list = window.__sootsimListWorkerFetchRecorder
|
|
58
|
-
return typeof list === 'function'
|
|
59
|
-
? await list(${JSON.stringify(u)})
|
|
60
|
-
: []
|
|
61
|
-
})()`)]);Me=he([...g,...P]).filter(h=>{try{return!new URL(h.url).pathname.startsWith("/api/")}catch{return!0}});let $=await x(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
|
-
})()`),C=($?he([...$.main,...$.worker]):[]).filter(h=>{try{return new URL(h.url).origin!==u}catch{return!1}}),R=C.length>0?{count:C.length,totalBytes:C.reduce((h,ae)=>h+(ae.size||0),0)}:null;if(R&&R.count>0){console.log(` ${R.count} recorded cross-origin responses (${(R.totalBytes/1024).toFixed(1)} KiB)`);let h=await x(T,`(async () => {
|
|
69
|
-
const rec = window.__sootsimPreviewRecorder
|
|
70
|
-
const workerDump = window.__sootsimDumpWorkerFetchRecorder
|
|
71
|
-
const bundleUrl = ${JSON.stringify(d.bundleUrl)}
|
|
72
|
-
const keep = (r) => {
|
|
73
|
-
try {
|
|
74
|
-
const u = new URL(r.url)
|
|
75
|
-
if (u.origin !== ${JSON.stringify(u)}) 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(k=he([...h.main,...h.worker]),we){let ae=k.length;k=k.filter(le=>Ge(le.contentType));let ot=R.totalBytes-k.reduce((le,it)=>le+(it.size||0),0);console.log(` --assets-only: kept ${k.length}/${ae} records (dropped ${(ot/1024).toFixed(1)} KiB of API responses)`)}}}d?.transformedBundle&&(X=await _t(T,d.transformedBundle.byteLength));let n=await x(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($t({recordedDurationMs:ye,recordingStartedAtMs:be}))})
|
|
95
|
-
})()`).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:[];B=[...B,...a.filter(de)].sort((u,g)=>u.t-g.t||u.seq-g.seq)}finally{T.close()}d||(console.error(" could not read bundle snapshot \u2014 is rnx running and is the bundle loaded?"),m(2)),d.bundleUrl||(console.error(` no ?bundle= URL on the current rnx tab.
|
|
96
|
-
open the app you want to share first (e.g. rnx open 8082), then run upload.`),m(2));let S,ve=!1;if(X!==null)S=new TextEncoder().encode(X),ve=!0,console.log(` using post-transform bundle: ${(S.byteLength/1024).toFixed(1)} KiB`);else{let n=Pt(d.bundleUrl);n!==d.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),S=await Je(n),console.log(` main bundle: ${(S.byteLength/1024).toFixed(1)} KiB`)}let z=Me.filter(n=>n.url!==d.bundleUrl);we&&(z=z.filter(n=>Ge(n.contentType))),console.log(` fetching ${z.length} extra files\u2026`);let Z=(await Promise.all(z.map(async n=>{try{let a=await Je(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),Xe=Z.reduce((n,a)=>n+a.bytes.byteLength,0);console.log(` ${Z.length} extra files: ${(Xe/1024).toFixed(1)} KiB`);let _;i&&(_=w(i)),B.sort((n,a)=>n.t-a.t||n.seq-a.seq);let Re=B.map(n=>JSON.stringify(n)).join(`
|
|
97
|
-
`),ee=ge(Re?`${Re}
|
|
98
|
-
`:"");console.log(` trace timeline: ${B.length} events${Se?` (${Se} from runner sidecars)`:""}`);let v;l&&(v=w(l),console.log(` attaching screenshot: ${(v.byteLength/1024).toFixed(1)} KiB`));let F=f?vt(f):[];F.length>0&&console.log(` attaching ${F.length} interaction snapshots`);let E,I;if(V){let n=g=>{try{return w(He.join(V,g),"utf8")}catch{return null}},a=g=>{let P=n(g);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(g=>g!==null)&&(E=ge(JSON.stringify(u)),console.log(` attaching failure bundle: ${(E.byteLength/1024).toFixed(1)} KiB gz`));try{I=w(He.join(V,"screenshot.png"))}catch{}}let A,L,xe;if(c){if(A=w(c),L=c.endsWith(".mp4")?"video/mp4":c.endsWith(".gif")?"image/gif":void 0,L||(console.error(" preview flow videos must be mp4 or gif"),m(1)),W){let n=Number(W);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${W}`),m(1)),xe=Math.round(n)}console.log(` attaching flow video: ${(A.byteLength/1024).toFixed(1)} KiB (${L})`)}let te=G(),D=Fe(te),U=me();te||(console.error(" preview uploads need auth."),console.error(" set RNX_API_KEY=sk_rnx_..., run `rnx login`, or use the Contrast github runner."),m(1));let Ze=J(te),et=(()=>{try{return new URL(d.bundleUrl).origin}catch{return null}})(),H=(n,a,u,g,P,$,Ie,C)=>{let R=Le($),h=R?ge(n):n;return{url:a,urlhash:u,method:g,bodyHash:P,requestVaryHash:C,contentType:$,responseHeaders:Ie,bytes:h,encoding:R?"gzip":void 0}},ke=[],ne=At(d.pageHref)||"";if(ne){let n=await _e(ne,{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(H(Buffer.from(a.bytes),a.url,a.urlhash,"GET","-",a.contentType))}let Be=[],re=Ut(d.pageHref)||"";if(re){let n=await $e(re,{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)Be.push(H(Buffer.from(a.bytes),a.url,a.urlhash,"GET","-",a.contentType))}let se=[...Z.map(n=>H(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...k.map(n=>H(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash)),...ke,...Be],oe=Ce(S),tt=Mt("sha256").update(S).digest("hex");console.log(` bundle raw=${(S.byteLength/1024).toFixed(1)} KiB br=${(oe.byteLength/1024).toFixed(1)} KiB`);let nt={contentHash:tt,bundleSizeBytes:S.byteLength,bundleContentType:It(d.bundleUrl),bundleEncoding:"br",bundleMinified:!1,bundleOrigin:et,runtimeVersion:d.runtimeVersion??void 0,appFonts:ne||void 0,appSplash:re||void 0,entry:d.entry,isTransformed:ve,deviceSpec:d.deviceSpec,installationId:D?.installationId??void 0,repoId:D?.repoId,owner:Y??D?.owner??U.owner??void 0,repo:Q??D?.repo??U.repo??void 0,branch:U.branch??void 0,commitSha:U.commitSha??void 0,githubUsername:U.githubUsername??void 0,pullRequestNumber:U.pullRequestNumber??void 0,pullRequestTitle:U.pullRequestTitle??void 0,billingKind:O==="test_run"?"test_run":void 0,runScope:We||void 0,files:se.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:_?{sizeBytes:_.byteLength}:void 0,timeline:{sizeBytes:ee.byteLength,encoding:"gzip"},traceFrameStats:Ct(Te),recordedDurationMs:ye,recordingStartedAtMs:be,failureBundle:E?{sizeBytes:E.byteLength,encoding:"gzip"}:void 0,snapshots:(()=>{let n=[];v&&n.push({id:"landing",label:"Landing",kind:"landing",t:0,contentType:"image/png",sizeBytes:v.byteLength}),I&&n.push({id:"failure",label:"Failure",kind:"failure",contentType:"image/png",sizeBytes:I.byteLength});for(let a of F)n.push(a.meta);return n.length>0?n:void 0})(),flowVideo:A&&L?{sizeBytes:A.byteLength,contentType:L,durationMs:xe}:void 0},Ee=new Map;for(let n of se)Ee.set(n.urlhash,n.bytes);let j=new Map;v&&j.set("landing",v),I&&j.set("failure",I);for(let n of F)j.set(n.meta.id,n.bytes);let rt=Date.now(),b=oe.byteLength;for(let n of se)b+=n.bytes.byteLength;_&&(b+=_.byteLength),b+=ee.byteLength,v&&(b+=v.byteLength),I&&(b+=I.byteLength);for(let n of F)b+=n.bytes.byteLength;E&&(b+=E.byteLength),A&&(b+=A.byteLength);let st=`${N(s)}/api/preview/upload/init`;console.log(` init: ${st}`);let q;try{let n=await Oe({originBase:s,initBody:nt,bundleBytes:oe,filesByHash:Ee,extras:{eventsBytes:_,timelineBytes:ee,videoBytes:A,failureBundleBytes:E,snapshotBytes:j},authHeader:Ze,concurrency:16});q=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()-rt}ms (${(b/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 `rnx login` and retry."),m(1)),a.status===402&&(console.error(` ${St(a.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),m(1)),console.error(` ${a.message??`${a.phase??"upload"} failed: ${String(n)}`}`),m(1)}let ie=`${o}${q.url}`;return console.log(`
|
|
99
|
-
stored ${q.filesStored??0} extra files`),console.log(` preview: ${ie}`),Ye&&await Ne(ie),{previewUrl:ie,shareId:q.id}}export{me as a,Kt as b,Vt as c,Wt as d,Rt as e,Bt as f,mn as g};
|