sootsim 0.1.233 → 0.1.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cli/bin.js +4 -4
- package/dist-cli/chunks/{agent-FSAU46RP.js → agent-RKA6QTYE.js} +2 -2
- package/dist-cli/chunks/{agent-wrapper-C7OIZCDK.js → agent-wrapper-OB6OUCSF.js} +2 -2
- package/dist-cli/chunks/{app-fonts-DXMHWUJT.js → app-fonts-6PFARL6B.js} +2 -2
- package/dist-cli/chunks/{assert-WNFJZX3A.js → assert-Q6BV2NEM.js} +2 -2
- package/dist-cli/chunks/{auth-3VWWSVDJ.js → auth-HJ3NXFJP.js} +2 -2
- package/dist-cli/chunks/beta-7LVCC4DC.js +2 -0
- package/dist-cli/chunks/{camera-2AXW72BD.js → camera-LWGYRGBB.js} +2 -2
- package/dist-cli/chunks/{chunk-Q3KYEB42.js → chunk-2QOLVYFF.js} +1 -1
- package/dist-cli/chunks/chunk-2RP6TUZ3.js +1 -0
- package/dist-cli/chunks/{chunk-HBD6YSQT.js → chunk-2YOWFGX3.js} +1 -1
- package/dist-cli/chunks/{chunk-3654N4EX.js → chunk-36HLSYS2.js} +2 -2
- package/dist-cli/chunks/{chunk-ZXTPXUAL.js → chunk-37CANPD2.js} +3 -3
- package/dist-cli/chunks/{chunk-BOYWUXVQ.js → chunk-4NTBHQZU.js} +3 -3
- package/dist-cli/chunks/{chunk-AHNX3XFL.js → chunk-4YPQAOC6.js} +1 -1
- package/dist-cli/chunks/{chunk-TB775GFN.js → chunk-54U7A36G.js} +1 -1
- package/dist-cli/chunks/{chunk-FMZCSQXP.js → chunk-57FLKZOS.js} +3 -3
- package/dist-cli/chunks/{chunk-ZQBKE54L.js → chunk-5AVOWKYR.js} +1 -1
- package/dist-cli/chunks/{chunk-MGECBBZI.js → chunk-5FDIH76R.js} +2 -2
- package/dist-cli/chunks/{chunk-GQQZNMLJ.js → chunk-5JX4BCGL.js} +1 -1
- package/dist-cli/chunks/{chunk-WBWRABBM.js → chunk-6KZBSG52.js} +2 -2
- package/dist-cli/chunks/{chunk-3RIGVY4O.js → chunk-6NUCPZGB.js} +1 -1
- package/dist-cli/chunks/{chunk-5SAISMRK.js → chunk-7G4VSJQ4.js} +1 -1
- package/dist-cli/chunks/{chunk-TQF5LD6Y.js → chunk-7ST3HVVO.js} +1 -1
- package/dist-cli/chunks/{chunk-G7DEABX5.js → chunk-A3R3A55R.js} +2 -2
- package/dist-cli/chunks/{chunk-WAVNZQ5B.js → chunk-AASXS3LK.js} +2 -2
- package/dist-cli/chunks/{chunk-K2MMUVAS.js → chunk-B77AQNOH.js} +1 -1
- package/dist-cli/chunks/{chunk-46QQ23PF.js → chunk-DAWIWEWR.js} +2 -2
- package/dist-cli/chunks/{chunk-RTLMLUPQ.js → chunk-DFAMEHIJ.js} +2 -2
- package/dist-cli/chunks/chunk-DVPVSP7S.js +99 -0
- package/dist-cli/chunks/{chunk-ULBICLEG.js → chunk-FSSTNYFL.js} +2 -2
- package/dist-cli/chunks/{chunk-ZRRTM6WY.js → chunk-HTTSF6YF.js} +2 -2
- package/dist-cli/chunks/{chunk-KR5WHNHB.js → chunk-IB6NUH34.js} +2 -2
- package/dist-cli/chunks/{chunk-OMQVA6X5.js → chunk-IHRBDBGS.js} +2 -2
- package/dist-cli/chunks/{chunk-LU5U5HEI.js → chunk-JXPGKN3F.js} +2 -2
- package/dist-cli/chunks/{chunk-5W3SERZ3.js → chunk-KIALD4JX.js} +2 -2
- package/dist-cli/chunks/{chunk-QE7FDUJN.js → chunk-KIYCMEMO.js} +3 -3
- package/dist-cli/chunks/{chunk-DU2XIAOZ.js → chunk-KIYNMK6P.js} +2 -2
- package/dist-cli/chunks/{chunk-KNGJ7VHE.js → chunk-KQCFBS3K.js} +2 -2
- package/dist-cli/chunks/{chunk-IDGS2QTY.js → chunk-LJLYNHJF.js} +1 -1
- package/dist-cli/chunks/{chunk-63LYNRZC.js → chunk-LW25UTSS.js} +2 -2
- package/dist-cli/chunks/{chunk-S7S2TXMP.js → chunk-MS33P5CV.js} +1 -1
- package/dist-cli/chunks/{chunk-KUHSSHBI.js → chunk-PSDDQWFO.js} +1 -1
- package/dist-cli/chunks/chunk-TAPKEEG2.js +1 -0
- package/dist-cli/chunks/{chunk-7LEIOQSX.js → chunk-TD3PSMQU.js} +1 -1
- package/dist-cli/chunks/chunk-TGPXK5U2.js +2 -0
- package/dist-cli/chunks/{chunk-Q5SCJQUL.js → chunk-UQEDU53Q.js} +2 -2
- package/dist-cli/chunks/{chunk-ZRQEHAES.js → chunk-VVVCJPSQ.js} +1 -1
- package/dist-cli/chunks/{chunk-36ROSEUV.js → chunk-VWAOND2T.js} +1 -1
- package/dist-cli/chunks/{chunk-3DRMNDJ7.js → chunk-WPS3EFNK.js} +1 -1
- package/dist-cli/chunks/{chunk-FQ5ISCZF.js → chunk-XK5YL6SF.js} +2 -2
- package/dist-cli/chunks/{chunk-6GADJWCT.js → chunk-YV35LVCO.js} +2 -2
- package/dist-cli/chunks/cli-version-7DTLL57G.js +2 -0
- package/dist-cli/chunks/{compat-QFJSNZ7F.js → compat-NN643MYB.js} +3 -3
- package/dist-cli/chunks/{config-FYNAEPT6.js → config-GVVXK4LX.js} +2 -2
- package/dist-cli/chunks/{control-AYMN3IBC.js → control-TL666XUK.js} +2 -2
- package/dist-cli/chunks/daemon-MTBKLQAM.js +2 -0
- package/dist-cli/chunks/{debug-IGWPYQVC.js → debug-4D7UPKL6.js} +3 -3
- package/dist-cli/chunks/{desktop-EKR2GZ6P.js → desktop-UK3TXNWM.js} +3 -3
- package/dist-cli/chunks/{detox-JSFPSPI4.js → detox-GGCJIYAO.js} +2 -2
- package/dist-cli/chunks/{device-TOVWFBQJ.js → device-27GVWZRM.js} +2 -2
- package/dist-cli/chunks/{diagnose-SKCJE2OJ.js → diagnose-MRGZ2QTM.js} +2 -2
- package/dist-cli/chunks/drivers-BHAS62HS.js +2 -0
- package/dist-cli/chunks/{film-7ZRUTIPW.js → film-SFZGOMH5.js} +3 -3
- package/dist-cli/chunks/flow-X3NSSQNP.js +2 -0
- package/dist-cli/chunks/help-7WJO45XU.js +2 -0
- package/dist-cli/chunks/{hidden-runtime-alias-CNJPGHH3.js → hidden-runtime-alias-EJ5NRH2V.js} +2 -2
- package/dist-cli/chunks/{home-paths-MUFDNXAD.js → home-paths-ICQCVYFE.js} +2 -2
- package/dist-cli/chunks/inspect-FRSSCWP2.js +2 -0
- package/dist-cli/chunks/install-desktop-67O3RXXA.js +2 -0
- package/dist-cli/chunks/{login-575DYIFV.js → login-YJFCUM4C.js} +4 -4
- package/dist-cli/chunks/{logout-FWSC6I62.js → logout-T4MKUGMT.js} +2 -2
- package/dist-cli/chunks/{maestro-XVRDDQPC.js → maestro-MJH5BSJG.js} +3 -3
- package/dist-cli/chunks/{maestro-generate-D2BWU3QI.js → maestro-generate-5ORUBHVA.js} +3 -3
- package/dist-cli/chunks/{mode-5NB4ZSW7.js → mode-D7MC6TTG.js} +2 -2
- package/dist-cli/chunks/optional-demo-registry-KV3FG6HR.js +2 -0
- package/dist-cli/chunks/{perf-FHR37YVM.js → perf-IRUFRNO5.js} +2 -2
- package/dist-cli/chunks/record-GTZOEPUV.js +70 -0
- package/dist-cli/chunks/runtime-RXHJI4Y4.js +2 -0
- package/dist-cli/chunks/{screenshot-command-ZZGUTSXV.js → screenshot-command-72DH5GXF.js} +3 -3
- package/dist-cli/chunks/{screenshots-capture-BOUIB3JS.js → screenshots-capture-6QQ4NPZ6.js} +2 -2
- package/dist-cli/chunks/{serve-YC7L66XG.js → serve-C2GAQBTN.js} +2 -2
- package/dist-cli/chunks/{setup-LUDPDJK4.js → setup-TOAATCCA.js} +3 -3
- package/dist-cli/chunks/{skills-FQ55TVJQ.js → skills-PPGCRJYB.js} +2 -2
- package/dist-cli/chunks/{storage-3KQFUZXP.js → storage-LI55AAJB.js} +2 -2
- package/dist-cli/chunks/store-L4ASCJJM.js +2 -0
- package/dist-cli/chunks/telemetry-BVONU4AY.js +2 -0
- package/dist-cli/chunks/{timeline-SUHWK7B7.js → timeline-VTU7U2F7.js} +2 -2
- package/dist-cli/chunks/{upgrade-U5BIIO7Z.js → upgrade-VQSDSFTG.js} +2 -2
- package/dist-cli/chunks/upload-REVW5JI2.js +2 -0
- package/dist-cli/chunks/{version-JKCTZB5N.js → version-V37CLU3B.js} +2 -2
- package/dist-cli/chunks/web-PPVH2K63.js +2 -0
- package/dist-cli/chunks/{what-happened-ZQV5XPQM.js → what-happened-3ZN3FV34.js} +2 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +1 -1
- 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/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- 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.cjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +15 -6
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/dist-cli/chunks/beta-FYKGC4H6.js +0 -2
- package/dist-cli/chunks/chunk-3ZNQP22M.js +0 -99
- package/dist-cli/chunks/chunk-CBDZY232.js +0 -2
- package/dist-cli/chunks/chunk-PSEFQYVM.js +0 -1
- package/dist-cli/chunks/chunk-UJZ337EP.js +0 -1
- package/dist-cli/chunks/chunk-WHSY2B3U.js +0 -2
- package/dist-cli/chunks/cli-version-CS57HE3I.js +0 -2
- package/dist-cli/chunks/daemon-UOJGRIKE.js +0 -2
- package/dist-cli/chunks/drivers-VJLWPIKJ.js +0 -2
- package/dist-cli/chunks/flow-4J2JB726.js +0 -2
- package/dist-cli/chunks/help-IZWZPAUI.js +0 -2
- package/dist-cli/chunks/inspect-AELXHN3R.js +0 -2
- package/dist-cli/chunks/install-desktop-L4ZD5MNA.js +0 -2
- package/dist-cli/chunks/optional-demo-registry-4EYB4RJG.js +0 -2
- package/dist-cli/chunks/record-ZKVEEOM3.js +0 -70
- package/dist-cli/chunks/runtime-PFL2DHOG.js +0 -2
- package/dist-cli/chunks/store-KVEMIG7O.js +0 -2
- package/dist-cli/chunks/telemetry-LZQKUZ6S.js +0 -2
- package/dist-cli/chunks/upload-KRWZEVFY.js +0 -2
- package/dist-cli/chunks/web-O6GVKSMI.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
function o(e,n,r,a){return{width:3,ringToggle:{top:e[0],height:e[1]},volumeUp:{top:n[0],height:n[1]},volumeDown:{top:r[0],height:r[1]},lock:{top:a[0],height:a[1]}}}var b={width:2.5,lock:{top:188.7,height:68.1},ringToggle:{top:113.2,height:36},volumeUp:{top:188.2,height:68.1},volumeDown:{top:269,height:68.1}},d={width:3,lock:{top:238,height:78},ringToggle:{top:-1e3,height:0},volumeUp:{top:336,height:62},volumeDown:{top:408,height:62}},g={width:3,lock:{top:248,height:72},ringToggle:{top:-1e3,height:0},volumeUp:{top:144,height:62},volumeDown:{top:216,height:62}},i=48;function t(e){return{...e,platform:"ios",navigationBarHeight:0,navigationBarMode:e.homeIndicatorHeight>0?"gesture":"none",displayCutout:{top:e.dynamicIsland?e.statusBarHeight:0,bottom:0,left:0,right:0},cameraCutout:null,osVersion:e.iosVersion,androidApiLevel:null,systemName:"iOS",manufacturer:"Apple",brand:"Apple",modelName:e.name}}var u={"canvas-workspace":t({name:"Canvas Workspace",width:1440,height:900,scale:1,statusBarHeight:0,homeIndicatorHeight:0,cornerRadius:0,continuousCornerRadius:0,bezelWidth:16,dynamicIsland:null,safeAreaInsets:{top:0,bottom:0,left:0,right:0},iosVersion:"26.4",physicalPPI:110,hardwareButtons:o([185.8,41.7],[258.2,67.6],[344,67.6],[281.5,106.9]),experimental:!0}),"iphone-se":t({name:"iPhone SE",width:375,height:667,scale:2,statusBarHeight:20,homeIndicatorHeight:0,cornerRadius:0,continuousCornerRadius:0,bezelWidth:28.7,dynamicIsland:null,safeAreaInsets:{top:20,bottom:0,left:0,right:0},iosVersion:"15.8",physicalPPI:326,hardwareButtons:b}),"iphone-14":t({name:"iPhone 14",width:390,height:844,scale:3,statusBarHeight:47,homeIndicatorHeight:34,cornerRadius:46.2,continuousCornerRadius:67.462,bezelWidth:19.5,dynamicIsland:null,safeAreaInsets:{top:47,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o([141.7,29.7],[205.9,69.6],[289.5,69.6],[228.9,114.5])}),"iphone-15":t({name:"iPhone 15",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:73.402,bezelWidth:18.2,dynamicIsland:{width:126,height:37.3,top:14.1},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o([171.7,32],[235.8,65.3],[320.5,65.3],[280.6,105.2])}),"iphone-15-plus":t({name:"iPhone 15 Plus",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:74.654,bezelWidth:17.3,dynamicIsland:{width:126,height:37.3,top:11.4},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o([172.1,33],[236.1,66.6],[321.2,66.6],[281,106.8])}),"iphone-15-pro":t({name:"iPhone 15 Pro",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:73.402,bezelWidth:15.3,dynamicIsland:{width:126,height:38,top:13.4},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"18.2",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-15-pro-max":t({name:"iPhone 15 Pro Max",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:74.654,bezelWidth:15.3,dynamicIsland:{width:126,height:38,top:13.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"18.2",physicalPPI:460,hardwareButtons:o([173.3,32.2],[253.4,61.7],[343.3,61.7],[268.5,98.5])}),"iphone-16":t({name:"iPhone 16",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:73.402,bezelWidth:15.3,dynamicIsland:{width:126,height:37.3,top:11},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-16-plus":t({name:"iPhone 16 Plus",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:74.654,bezelWidth:15.3,dynamicIsland:{width:126,height:37.3,top:11.4},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([173.3,32.2],[253.4,61.7],[343.3,61.7],[268.5,98.5])}),"iphone-16-pro":t({name:"iPhone 16 Pro",width:402,height:874,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:61,continuousCornerRadius:84.661,bezelWidth:15.3,dynamicIsland:{width:126,height:38,top:13.5},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-16-pro-max":t({name:"iPhone 16 Pro Max",width:440,height:956,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:61.3,continuousCornerRadius:85.163,bezelWidth:15.4,dynamicIsland:{width:126,height:38,top:14},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([178.8,32.2],[266.8,61.8],[352.7,61.8],[292.2,98.3])}),"iphone-17":t({name:"iPhone 17",width:402,height:874,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:61,continuousCornerRadius:84.661,bezelWidth:15.3,dynamicIsland:{width:126,height:37.3,top:14},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-17-air":t({name:"iPhone Air",width:420,height:912,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:64.6,continuousCornerRadius:88.313,bezelWidth:15.4,dynamicIsland:{width:126,height:38,top:20},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([178.8,32.2],[266.8,61.8],[352.7,61.8],[292.2,98.3])}),"iphone-17-pro":t({name:"iPhone 17 Pro",width:402,height:874,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:61,continuousCornerRadius:84.661,bezelWidth:15.3,dynamicIsland:{width:126,height:38,top:14},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-17-pro-max":t({name:"iPhone 17 Pro Max",width:440,height:956,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:61.3,continuousCornerRadius:85.163,bezelWidth:15.4,dynamicIsland:{width:126,height:38,top:14},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([178.8,32.2],[266.8,61.8],[352.7,61.8],[292.2,98.3])}),"pixel-8":{platform:"android",name:"Pixel 8",width:412,height:915,scale:2.625,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:i,navigationBarMode:"gesture",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:39,continuousCornerRadius:39,bezelWidth:13,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:i,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 8",physicalPPI:428,hardwareButtons:d},"pixel-8-three-button":{platform:"android",name:"Pixel 8 (3-button)",width:412,height:915,scale:2.625,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:48,navigationBarMode:"three-button",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:39,continuousCornerRadius:39,bezelWidth:13,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:48,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 8",physicalPPI:428,hardwareButtons:d},"pixel-9-pro-xl":{platform:"android",name:"Pixel 9 Pro XL",width:448,height:997,scale:3,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:i,navigationBarMode:"gesture",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:41,continuousCornerRadius:41,bezelWidth:12,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:i,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 9 Pro XL",physicalPPI:486,hardwareButtons:d},"galaxy-s24":{platform:"android",name:"Galaxy S24",width:360,height:780,scale:3,statusBarHeight:36,homeIndicatorHeight:0,navigationBarHeight:i,navigationBarMode:"gesture",displayCutout:{top:36,bottom:0,left:0,right:0},cornerRadius:36,continuousCornerRadius:36,bezelWidth:8,dynamicIsland:null,cameraCutout:{diameter:18},safeAreaInsets:{top:36,bottom:i,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Samsung",brand:"samsung",modelName:"SM-S921B",physicalPPI:416,hardwareButtons:g},"galaxy-s24-ultra":{platform:"android",name:"Galaxy S24 Ultra",width:384,height:824,scale:3.75,statusBarHeight:36,homeIndicatorHeight:0,navigationBarHeight:i,navigationBarMode:"gesture",displayCutout:{top:36,bottom:0,left:0,right:0},cornerRadius:24,continuousCornerRadius:24,bezelWidth:9,dynamicIsland:null,cameraCutout:{diameter:18},safeAreaInsets:{top:36,bottom:i,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Samsung",brand:"samsung",modelName:"SM-S928B",physicalPPI:505,hardwareButtons:g}},m="iphone-17-pro";function P(e){return u[e]}function p(){return Object.keys(u)}function v(){return p().filter(e=>!u[e].experimental)}var l={"iphone-6-9":{name:"iphone-6-9",label:'iPhone 6.7"',width:1284,height:2778,store:"apple"},"iphone-6-1":{name:"iphone-6-1",label:'iPhone 6.5"',width:1242,height:2688,store:"apple"},"android-phone":{name:"android-phone",label:"Google Play phone",width:1080,height:1920,store:"google"},"android-tablet-7":{name:"android-tablet-7",label:'Google Play 7" tablet',width:1200,height:1920,store:"google"},"android-tablet-10":{name:"android-tablet-10",label:'Google Play 10" tablet',width:1600,height:2560,store:"google"}},c={dark:{type:"gradient",direction:180,glow:"#4caeff",stops:[{offset:0,color:"#111827"},{offset:40,color:"#101725"},{offset:100,color:"#06080d"}]},cyan:{type:"gradient",direction:180,glow:"#25c3ec",stops:[{offset:0,color:"#1b465c"},{offset:32,color:"#122336"},{offset:100,color:"#05070b"}]},gold:{type:"gradient",direction:180,glow:"#ffc25a",stops:[{offset:0,color:"#3b2f1a"},{offset:34,color:"#18140d"},{offset:100,color:"#050505"}]},red:{type:"gradient",direction:180,glow:"#ff6178",stops:[{offset:0,color:"#3e1018"},{offset:35,color:"#17080c"},{offset:100,color:"#050405"}]}},B={color:"#25c3ec",blur:120,spread:52,opacity:.34},R="iphone-17-pro";var y=[{name:"white",value:"#ffffff"},{name:"gray-light",value:"#d1d5db"},{name:"gray",value:"#6b7280"},{name:"gray-dark",value:"#3b4350"},{name:"slate",value:"#2a3644"},{name:"black",value:"#000000"},{name:"cyan",value:"#25c3ec"},{name:"blue",value:"#3f7cff"},{name:"teal",value:"#1fc7b4"},{name:"green",value:"#42c95d"},{name:"lime",value:"#92d21b"},{name:"gold",value:"#f5c518"},{name:"orange",value:"#ff912e"},{name:"coral",value:"#ff6f5b"},{name:"red",value:"#ff4f6f"},{name:"berry",value:"#d054ff"},{name:"magenta",value:"#ff4eb8"}],f=Object.fromEntries(y.map(e=>[e.name,e.value]));function C(e){return f[e]??f.gray}function I(e){return Object.prototype.hasOwnProperty.call(l,e)?l[e]:null}function S(e){return{type:e.type,color:e.color,direction:e.direction,glow:e.glow,stops:e.stops?.map(n=>({...n}))}}function T(e){return Object.prototype.hasOwnProperty.call(c,e)?S(c[e]):null}var h={deviceModel:{type:"enum",default:m,description:"device model to simulate",cliFlag:"device",cliFlagShort:"d",options:p(),group:"device"},orientation:{type:"enum",default:"portrait",description:"screen orientation",cliFlag:"orientation",options:["portrait","landscape"],group:"device"},colorScheme:{type:"enum",default:"auto",description:"color scheme (auto follows system preference)",cliFlag:"theme",cliFlagShort:"t",options:["light","dark","auto"],group:"appearance"},reduceMotion:{type:"boolean",default:!1,description:"reduce motion",group:"appearance"},boldText:{type:"boolean",default:!1,description:"bold text",group:"appearance"},fontSize:{type:"number",default:1,description:"font size multiplier (1.0 = default)",group:"appearance",validate:e=>e>=.5&&e<=2},networkCondition:{type:"enum",default:"wifi",description:"simulated network condition",cliFlag:"network",options:["wifi","lte","fast-3g","slow-3g","offline"],group:"network"},language:{type:"string",default:"en",description:"language code (ISO 639-1)",cliFlag:"language",group:"locale"},region:{type:"string",default:"US",description:"region code (ISO 3166-1)",cliFlag:"region",group:"locale"},showTouches:{type:"boolean",default:!1,description:"show touch indicators",group:"simulator"},showFrame:{type:"boolean",default:!0,description:"show device frame",cliFlag:"frame",group:"simulator"},showTopBar:{type:"boolean",default:!0,description:"show simulator top bar",group:"simulator"},screenshotMode:{type:"boolean",default:!1,description:"show screenshot composition mode in the browser shell",group:"simulator"},threeMode:{type:"boolean",default:!1,description:"show the experimental 3d device stage in the browser shell",group:"simulator"},threeRecordingEditor:{type:"boolean",default:!1,description:"dock the 3d recording editor in the 3d stage (toggled from its rail)",group:"simulator"},screenshotCanvas:{type:"enum",default:"iphone-6-9",description:"target app-store canvas preset for screenshot mode",options:Object.keys(l),group:"simulator"},screenshotBackground:{type:"enum",default:"dark",description:"background preset rendered inside the screenshot canvas",options:Object.keys(c),group:"simulator"},screenshotText:{type:"enum",default:"bold-top",description:"text layout preset for the screenshot canvas",options:["bold-top","editorial-left","minimal-bottom","none"],group:"simulator"},screenshotPose:{type:"enum",default:"straight",description:"device pose preset inside the screenshot canvas",options:["straight","tilted-left","tilted-right","cut-bottom","cut-top"],group:"simulator"},screenshotDynamicSize:{type:"boolean",default:!1,description:"let the screenshot canvas rect fit available space (off = pin to exact preset pixels)",group:"simulator"},showStatusBar:{type:"boolean",default:!0,description:"show status bar",group:"simulator"},showHomeIndicator:{type:"boolean",default:!0,description:"show home indicator",group:"simulator"},alwaysShowLiveWebViews:{type:"boolean",default:!1,description:"always render WebViews as live browser views",group:"simulator"},a11yMode:{type:"enum",default:"delayed",description:"accessibility tree sync mode (off, delayed=100ms, active=30ms)",options:["off","delayed","active"],group:"simulator"},a11yDepth:{type:"enum",default:"deep",description:"accessibility tree structure depth (shallow or deep)",options:["shallow","deep"],group:"simulator"},inspectMode:{type:"boolean",default:!1,description:"inspect mode",group:"simulator"},errorReporting:{type:"boolean",default:!1,description:"send anonymous crash reports",group:"privacy"},agentProvider:{type:"enum",default:"codex",description:"ai agent used by the sootsim agent prompt bar",options:["codex","claude"],group:"agent"},onboardingComplete:{type:"boolean",default:!1,description:"first-run onboarding completed",group:"beta"},betaConsentVersion:{type:"number",default:0,description:"last accepted beta telemetry policy version",group:"beta"},detailedTelemetry:{type:"boolean",default:!0,description:"send detailed usage telemetry (sessions, perf samples)",group:"beta"}};function w(){if(typeof window>"u")return{};let e={};try{let n=new URLSearchParams(window.location.search),r=n.get("device");r&&h.deviceModel.options?.includes(r)&&(e.deviceModel=r),n.get("ssMode")==="1"&&(e.screenshotMode=!0);let a=n.get("colorScheme")??n.get("theme");a&&h.colorScheme.options?.includes(a)&&(e.colorScheme=a);let s=n.get("alwaysShowLiveWebViews");s==="1"||s==="true"?e.alwaysShowLiveWebViews=!0:(s==="0"||s==="false")&&(e.alwaysShowLiveWebViews=!1)}catch{}return e}function H(){let e={};for(let[n,r]of Object.entries(h))e[n]=r.default;return Object.assign(e,w()),e}export{B as a,R as b,C as c,I as d,S as e,T as f,u as g,P as h,v as i,h as j,w as k,H as l};
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
function o(e,n,r,a){return{width:3,ringToggle:{top:e[0],height:e[1]},volumeUp:{top:n[0],height:n[1]},volumeDown:{top:r[0],height:r[1]},lock:{top:a[0],height:a[1]}}}var y={width:2.5,lock:{top:188.7,height:68.1},ringToggle:{top:113.2,height:36},volumeUp:{top:188.2,height:68.1},volumeDown:{top:269,height:68.1}},u={width:3,lock:{top:238,height:78},ringToggle:{top:-1e3,height:0},volumeUp:{top:336,height:62},volumeDown:{top:408,height:62}},m={width:3,lock:{top:248,height:72},ringToggle:{top:-1e3,height:0},volumeUp:{top:144,height:62},volumeDown:{top:216,height:62}},i=48;function t(e){return{...e,platform:"ios",navigationBarHeight:0,navigationBarMode:e.homeIndicatorHeight>0?"gesture":"none",displayCutout:{top:e.dynamicIsland?e.statusBarHeight:0,bottom:0,left:0,right:0},cameraCutout:null,osVersion:e.iosVersion,androidApiLevel:null,systemName:"iOS",manufacturer:"Apple",brand:"Apple",modelName:e.name}}var p={"canvas-workspace":t({name:"Canvas Workspace",width:1440,height:900,scale:1,statusBarHeight:0,homeIndicatorHeight:0,cornerRadius:0,continuousCornerRadius:0,bezelWidth:16,dynamicIsland:null,safeAreaInsets:{top:0,bottom:0,left:0,right:0},iosVersion:"26.4",physicalPPI:110,hardwareButtons:o([185.8,41.7],[258.2,67.6],[344,67.6],[281.5,106.9]),experimental:!0}),"iphone-se":t({name:"iPhone SE",width:375,height:667,scale:2,statusBarHeight:20,homeIndicatorHeight:0,cornerRadius:0,continuousCornerRadius:0,bezelWidth:28.7,dynamicIsland:null,safeAreaInsets:{top:20,bottom:0,left:0,right:0},iosVersion:"15.8",physicalPPI:326,hardwareButtons:y}),"iphone-14":t({name:"iPhone 14",width:390,height:844,scale:3,statusBarHeight:47,homeIndicatorHeight:34,cornerRadius:46.2,continuousCornerRadius:67.462,bezelWidth:19.5,dynamicIsland:null,safeAreaInsets:{top:47,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o([141.7,29.7],[205.9,69.6],[289.5,69.6],[228.9,114.5])}),"iphone-15":t({name:"iPhone 15",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:73.402,bezelWidth:18.2,dynamicIsland:{width:126,height:37.3,top:14.1},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o([171.7,32],[235.8,65.3],[320.5,65.3],[280.6,105.2])}),"iphone-15-plus":t({name:"iPhone 15 Plus",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:74.654,bezelWidth:17.3,dynamicIsland:{width:126,height:37.3,top:11.4},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"17.6",physicalPPI:460,hardwareButtons:o([172.1,33],[236.1,66.6],[321.2,66.6],[281,106.8])}),"iphone-15-pro":t({name:"iPhone 15 Pro",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:73.402,bezelWidth:15.3,dynamicIsland:{width:126,height:38,top:13.4},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"18.2",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-15-pro-max":t({name:"iPhone 15 Pro Max",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:74.654,bezelWidth:15.3,dynamicIsland:{width:126,height:38,top:13.3},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"18.2",physicalPPI:460,hardwareButtons:o([173.3,32.2],[253.4,61.7],[343.3,61.7],[268.5,98.5])}),"iphone-16":t({name:"iPhone 16",width:393,height:852,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:73.402,bezelWidth:15.3,dynamicIsland:{width:126,height:37.3,top:11},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-16-plus":t({name:"iPhone 16 Plus",width:430,height:932,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:53.9,continuousCornerRadius:74.654,bezelWidth:15.3,dynamicIsland:{width:126,height:37.3,top:11.4},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([173.3,32.2],[253.4,61.7],[343.3,61.7],[268.5,98.5])}),"iphone-16-pro":t({name:"iPhone 16 Pro",width:402,height:874,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:61,continuousCornerRadius:84.661,bezelWidth:15.3,dynamicIsland:{width:126,height:38,top:13.5},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-16-pro-max":t({name:"iPhone 16 Pro Max",width:440,height:956,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:61.3,continuousCornerRadius:85.163,bezelWidth:15.4,dynamicIsland:{width:126,height:38,top:14},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([178.8,32.2],[266.8,61.8],[352.7,61.8],[292.2,98.3])}),"iphone-17":t({name:"iPhone 17",width:402,height:874,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:61,continuousCornerRadius:84.661,bezelWidth:15.3,dynamicIsland:{width:126,height:37.3,top:14},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-17-air":t({name:"iPhone Air",width:420,height:912,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:64.6,continuousCornerRadius:88.313,bezelWidth:15.4,dynamicIsland:{width:126,height:38,top:20},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([178.8,32.2],[266.8,61.8],[352.7,61.8],[292.2,98.3])}),"iphone-17-pro":t({name:"iPhone 17 Pro",width:402,height:874,scale:3,statusBarHeight:59,homeIndicatorHeight:34,cornerRadius:61,continuousCornerRadius:84.661,bezelWidth:15.3,dynamicIsland:{width:126,height:38,top:14},safeAreaInsets:{top:59,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([159.1,31.5],[220.1,61.9],[299,61.9],[260.8,98.9])}),"iphone-17-pro-max":t({name:"iPhone 17 Pro Max",width:440,height:956,scale:3,statusBarHeight:62,homeIndicatorHeight:34,cornerRadius:61.3,continuousCornerRadius:85.163,bezelWidth:15.4,dynamicIsland:{width:126,height:38,top:14},safeAreaInsets:{top:62,bottom:34,left:0,right:0},iosVersion:"26.4",physicalPPI:460,hardwareButtons:o([178.8,32.2],[266.8,61.8],[352.7,61.8],[292.2,98.3])}),"pixel-8":{platform:"android",name:"Pixel 8",width:412,height:915,scale:2.625,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:i,navigationBarMode:"gesture",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:39,continuousCornerRadius:39,bezelWidth:13,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:i,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 8",physicalPPI:428,hardwareButtons:u},"pixel-8-three-button":{platform:"android",name:"Pixel 8 (3-button)",width:412,height:915,scale:2.625,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:48,navigationBarMode:"three-button",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:39,continuousCornerRadius:39,bezelWidth:13,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:48,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 8",physicalPPI:428,hardwareButtons:u},"pixel-9-pro-xl":{platform:"android",name:"Pixel 9 Pro XL",width:448,height:997,scale:3,statusBarHeight:40,homeIndicatorHeight:0,navigationBarHeight:i,navigationBarMode:"gesture",displayCutout:{top:40,bottom:0,left:0,right:0},cornerRadius:41,continuousCornerRadius:41,bezelWidth:12,dynamicIsland:null,cameraCutout:{diameter:24},safeAreaInsets:{top:40,bottom:i,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Google",brand:"google",modelName:"Pixel 9 Pro XL",physicalPPI:486,hardwareButtons:u},"galaxy-s24":{platform:"android",name:"Galaxy S24",width:360,height:780,scale:3,statusBarHeight:36,homeIndicatorHeight:0,navigationBarHeight:i,navigationBarMode:"gesture",displayCutout:{top:36,bottom:0,left:0,right:0},cornerRadius:36,continuousCornerRadius:36,bezelWidth:8,dynamicIsland:null,cameraCutout:{diameter:18},safeAreaInsets:{top:36,bottom:i,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Samsung",brand:"samsung",modelName:"SM-S921B",physicalPPI:416,hardwareButtons:m},"galaxy-s24-ultra":{platform:"android",name:"Galaxy S24 Ultra",width:384,height:824,scale:3.75,statusBarHeight:36,homeIndicatorHeight:0,navigationBarHeight:i,navigationBarMode:"gesture",displayCutout:{top:36,bottom:0,left:0,right:0},cornerRadius:24,continuousCornerRadius:24,bezelWidth:9,dynamicIsland:null,cameraCutout:{diameter:18},safeAreaInsets:{top:36,bottom:i,left:0,right:0},osVersion:"15",iosVersion:"",androidApiLevel:35,systemName:"Android",manufacturer:"Samsung",brand:"samsung",modelName:"SM-S928B",physicalPPI:505,hardwareButtons:m}},f="iphone-17-pro";function v(e){return p[e]}function h(){return Object.keys(p)}function x(){return h().filter(e=>!p[e].experimental)}var c={"iphone-6-9":{name:"iphone-6-9",label:'iPhone 6.7"',width:1284,height:2778,store:"apple"},"iphone-6-1":{name:"iphone-6-1",label:'iPhone 6.5"',width:1242,height:2688,store:"apple"},"android-phone":{name:"android-phone",label:"Google Play phone",width:1080,height:1920,store:"google"},"android-tablet-7":{name:"android-tablet-7",label:'Google Play 7" tablet',width:1200,height:1920,store:"google"},"android-tablet-10":{name:"android-tablet-10",label:'Google Play 10" tablet',width:1600,height:2560,store:"google"}},d={dark:{type:"gradient",direction:180,glow:"#4caeff",stops:[{offset:0,color:"#111827"},{offset:40,color:"#101725"},{offset:100,color:"#06080d"}]},cyan:{type:"gradient",direction:180,glow:"#25c3ec",stops:[{offset:0,color:"#1b465c"},{offset:32,color:"#122336"},{offset:100,color:"#05070b"}]},gold:{type:"gradient",direction:180,glow:"#ffc25a",stops:[{offset:0,color:"#3b2f1a"},{offset:34,color:"#18140d"},{offset:100,color:"#050505"}]},red:{type:"gradient",direction:180,glow:"#ff6178",stops:[{offset:0,color:"#3e1018"},{offset:35,color:"#17080c"},{offset:100,color:"#050405"}]}},R={color:"#25c3ec",blur:120,spread:52,opacity:.34},C="iphone-17-pro";var S=[{name:"white",value:"#ffffff"},{name:"gray-light",value:"#d1d5db"},{name:"gray",value:"#6b7280"},{name:"gray-dark",value:"#3b4350"},{name:"slate",value:"#2a3644"},{name:"black",value:"#000000"},{name:"cyan",value:"#25c3ec"},{name:"blue",value:"#3f7cff"},{name:"teal",value:"#1fc7b4"},{name:"green",value:"#42c95d"},{name:"lime",value:"#92d21b"},{name:"gold",value:"#f5c518"},{name:"orange",value:"#ff912e"},{name:"coral",value:"#ff6f5b"},{name:"red",value:"#ff4f6f"},{name:"berry",value:"#d054ff"},{name:"magenta",value:"#ff4eb8"}],b=Object.fromEntries(S.map(e=>[e.name,e.value]));function I(e){return b[e]??b.gray}function T(e){return Object.prototype.hasOwnProperty.call(c,e)?c[e]:null}function w(e){return{type:e.type,color:e.color,direction:e.direction,glow:e.glow,stops:e.stops?.map(n=>({...n}))}}function A(e){return Object.prototype.hasOwnProperty.call(d,e)?w(d[e]):null}var g={deviceModel:{type:"enum",default:f,description:"device model to simulate",cliFlag:"device",cliFlagShort:"d",options:h(),group:"device"},orientation:{type:"enum",default:"portrait",description:"screen orientation",cliFlag:"orientation",options:["portrait","landscape"],group:"device"},colorScheme:{type:"enum",default:"auto",description:"color scheme (auto follows system preference)",cliFlag:"theme",cliFlagShort:"t",options:["light","dark","auto"],group:"appearance"},reduceMotion:{type:"boolean",default:!1,description:"reduce motion",group:"appearance"},boldText:{type:"boolean",default:!1,description:"bold text",group:"appearance"},fontSize:{type:"number",default:1,description:"font size multiplier (1.0 = default)",group:"appearance",validate:e=>e>=.5&&e<=2},networkCondition:{type:"enum",default:"wifi",description:"simulated network condition",cliFlag:"network",options:["wifi","lte","fast-3g","slow-3g","offline"],group:"network"},language:{type:"string",default:"en",description:"language code (ISO 639-1)",cliFlag:"language",group:"locale"},region:{type:"string",default:"US",description:"region code (ISO 3166-1)",cliFlag:"region",group:"locale"},showTouches:{type:"boolean",default:!1,description:"show touch indicators",group:"simulator"},showFrame:{type:"boolean",default:!0,description:"show device frame",cliFlag:"frame",group:"simulator"},showTopBar:{type:"boolean",default:!0,description:"show simulator top bar",group:"simulator"},screenshotMode:{type:"boolean",default:!1,description:"show screenshot composition mode in the browser shell",group:"simulator"},threeMode:{type:"boolean",default:!1,description:"show the experimental 3d device stage in the browser shell",group:"simulator"},threeRecordingEditor:{type:"boolean",default:!1,description:"dock the 3d recording editor in the 3d stage (toggled from its rail)",group:"simulator"},screenshotCanvas:{type:"enum",default:"iphone-6-9",description:"target app-store canvas preset for screenshot mode",options:Object.keys(c),group:"simulator"},screenshotBackground:{type:"enum",default:"dark",description:"background preset rendered inside the screenshot canvas",options:Object.keys(d),group:"simulator"},screenshotText:{type:"enum",default:"bold-top",description:"text layout preset for the screenshot canvas",options:["bold-top","editorial-left","minimal-bottom","none"],group:"simulator"},screenshotPose:{type:"enum",default:"straight",description:"device pose preset inside the screenshot canvas",options:["straight","tilted-left","tilted-right","cut-bottom","cut-top"],group:"simulator"},screenshotDynamicSize:{type:"boolean",default:!1,description:"let the screenshot canvas rect fit available space (off = pin to exact preset pixels)",group:"simulator"},showStatusBar:{type:"boolean",default:!0,description:"show status bar",group:"simulator"},showHomeIndicator:{type:"boolean",default:!0,description:"show home indicator",group:"simulator"},alwaysShowLiveWebViews:{type:"boolean",default:!1,description:"always render WebViews as live browser views",group:"simulator"},a11yMode:{type:"enum",default:"delayed",description:"accessibility tree sync mode (off, delayed=100ms, active=30ms)",options:["off","delayed","active"],group:"simulator"},a11yDepth:{type:"enum",default:"deep",description:"accessibility tree structure depth (shallow or deep)",options:["shallow","deep"],group:"simulator"},inspectMode:{type:"boolean",default:!1,description:"inspect mode",group:"simulator"},errorReporting:{type:"boolean",default:!1,description:"send anonymous crash reports",group:"privacy"},agentProvider:{type:"enum",default:"codex",description:"ai agent used by the sootsim agent prompt bar",options:["codex","claude"],group:"agent"},onboardingComplete:{type:"boolean",default:!1,description:"first-run onboarding completed",group:"beta"},betaConsentVersion:{type:"number",default:0,description:"last accepted beta telemetry policy version",group:"beta"},detailedTelemetry:{type:"boolean",default:!0,description:"send detailed usage telemetry (sessions, perf samples)",group:"beta"}};function P(){if(typeof window>"u")return{};let e={};try{let n=new URLSearchParams(window.location.search),r=n.get("device");r&&g.deviceModel.options?.includes(r)&&(e.deviceModel=r),n.get("ssMode")==="1"&&(e.screenshotMode=!0);let a=n.get("colorScheme")??n.get("theme");a&&g.colorScheme.options?.includes(a)&&(e.colorScheme=a);let s=n.get("reduceMotion");s==="1"||s==="true"?e.reduceMotion=!0:(s==="0"||s==="false")&&(e.reduceMotion=!1);let l=n.get("alwaysShowLiveWebViews");l==="1"||l==="true"?e.alwaysShowLiveWebViews=!0:(l==="0"||l==="false")&&(e.alwaysShowLiveWebViews=!1)}catch{}return e}function k(){let e={};for(let[n,r]of Object.entries(g))e[n]=r.default;return Object.assign(e,P()),e}export{R as a,C as b,I as c,T as d,w as e,A as f,p as g,v as h,x as i,g as j,P as k,k as l};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{b as ms}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{b as ms}from"./chunk-2QOLVYFF.js";var hs={};ms(hs,{Alias:()=>ee,CST:()=>cs,Composer:()=>be,Document:()=>se,Lexer:()=>Be,LineCounter:()=>De,Pair:()=>v,Parser:()=>we,Scalar:()=>y,Schema:()=>ve,YAMLError:()=>_e,YAMLMap:()=>$,YAMLParseError:()=>R,YAMLSeq:()=>B,YAMLWarning:()=>Pe,isAlias:()=>F,isCollection:()=>L,isDocument:()=>x,isMap:()=>U,isNode:()=>I,isPair:()=>T,isScalar:()=>E,isSeq:()=>V,parse:()=>un,parseAllDocuments:()=>fn,parseDocument:()=>us,stringify:()=>hn,visit:()=>Q,visitAsync:()=>je});var tt=Symbol.for("yaml.alias"),st=Symbol.for("yaml.document"),Y=Symbol.for("yaml.map"),qt=Symbol.for("yaml.pair"),q=Symbol.for("yaml.scalar"),re=Symbol.for("yaml.seq"),K=Symbol.for("yaml.node.type"),F=s=>!!s&&typeof s=="object"&&s[K]===tt,x=s=>!!s&&typeof s=="object"&&s[K]===st,U=s=>!!s&&typeof s=="object"&&s[K]===Y,T=s=>!!s&&typeof s=="object"&&s[K]===qt,E=s=>!!s&&typeof s=="object"&&s[K]===q,V=s=>!!s&&typeof s=="object"&&s[K]===re;function L(s){if(s&&typeof s=="object")switch(s[K]){case Y:case re:return!0}return!1}function I(s){if(s&&typeof s=="object")switch(s[K]){case tt:case Y:case q:case re:return!0}return!1}var nt=s=>(E(s)||L(s))&&!!s.anchor;var j=Symbol("break visit"),ds=Symbol("skip children"),z=Symbol("remove node");function Q(s,e){let t=gs(e);x(s)?ke(null,s.contents,t,Object.freeze([s]))===z&&(s.contents=null):ke(null,s,t,Object.freeze([]))}Q.BREAK=j;Q.SKIP=ds;Q.REMOVE=z;function ke(s,e,t,n){let i=ys(s,e,t,n);if(I(i)||T(i))return bs(s,n,i),ke(s,i,t,n);if(typeof i!="symbol"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=ke(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===j)return j;o===z&&(e.items.splice(r,1),r-=1)}}}else if(T(e)){n=Object.freeze(n.concat(e));let r=ke("key",e.key,t,n);if(r===j)return j;r===z&&(e.key=null);let o=ke("value",e.value,t,n);if(o===j)return j;o===z&&(e.value=null)}}return i}async function je(s,e){let t=gs(e);x(s)?await Ne(null,s.contents,t,Object.freeze([s]))===z&&(s.contents=null):await Ne(null,s,t,Object.freeze([]))}je.BREAK=j;je.SKIP=ds;je.REMOVE=z;async function Ne(s,e,t,n){let i=await ys(s,e,t,n);if(I(i)||T(i))return bs(s,n,i),Ne(s,i,t,n);if(typeof i!="symbol"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ne(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===j)return j;o===z&&(e.items.splice(r,1),r-=1)}}}else if(T(e)){n=Object.freeze(n.concat(e));let r=await Ne("key",e.key,t,n);if(r===j)return j;r===z&&(e.key=null);let o=await Ne("value",e.value,t,n);if(o===j)return j;o===z&&(e.value=null)}}return i}function gs(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function ys(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(U(e))return t.Map?.(s,e,n);if(V(e))return t.Seq?.(s,e,n);if(T(e))return t.Pair?.(s,e,n);if(E(e))return t.Scalar?.(s,e,n);if(F(e))return t.Alias?.(s,e,n)}function bs(s,e,t){let n=e[e.length-1];if(L(n))n.items[s]=t;else if(T(n))s==="key"?n.key=t:n.value=t;else if(x(n))n.contents=t;else{let i=F(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var pn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},mn=s=>s.replace(/[!,[\]{}]/g,e=>pn[e]),Z=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+mn(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&I(e.contents)){let r={};Q(e.contents,(o,l)=>{I(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
3
3
|
`)}};Z.defaultYaml={explicit:!1,version:"1.2"};Z.defaultTags={"!!":"tag:yaml.org,2002:"};function it(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Rt(s){let e=new Set;return Q(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Ft(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function ws(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=Rt(s));let o=Ft(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(E(o.node)||L(o.node)))o.node.anchor=o.anchor;else{let l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:n}}function fe(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],l=fe(s,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=fe(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=fe(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=fe(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function M(s,e,t){if(Array.isArray(s))return s.map((n,i)=>M(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!nt(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}var ue=class{constructor(e){Object.defineProperty(this,K,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!x(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=M(this,"",o);if(typeof i=="function")for(let{count:a,res:c}of o.anchors.values())i(c,a);return typeof r=="function"?fe(r,{"":l},"",l):l}};var ee=class extends ue{constructor(e){super(tt),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Q(e,{Node:(r,o)=>{(F(o)||nt(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(let r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(a)}let l=n.get(o);if(l||(M(o,null,t),l=n.get(o)),l?.res===void 0){let a="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(a)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=rt(i,o,n)),l.count*l.aliasCount>r)){let a="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(a)}return l.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(it(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function rt(s,e,t){if(F(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(L(e)){let n=0;for(let i of e.items){let r=rt(s,i,t);r>n&&(n=r)}return n}else if(T(e)){let n=rt(s,e.key,t),i=rt(s,e.value,t);return Math.max(n,i)}return 1}var ot=s=>!s||typeof s!="function"&&typeof s!="object",y=class extends ue{constructor(e){super(q),this.value=e}toJSON(e,t){return t?.keep?this.value:M(this.value,e,t)}toString(){return String(this.value)}};y.BLOCK_FOLDED="BLOCK_FOLDED";y.BLOCK_LITERAL="BLOCK_LITERAL";y.PLAIN="PLAIN";y.QUOTE_DOUBLE="QUOTE_DOUBLE";y.QUOTE_SINGLE="QUOTE_SINGLE";var dn="tag:yaml.org,2002:";function gn(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function oe(s,e,t){if(x(s)&&(s=s.contents),I(s))return s;if(T(s)){let f=t.schema[Y].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t,a;if(n&&s&&typeof s=="object"){if(a=l.get(s),a)return a.anchor??(a.anchor=i(s)),new ee(a.anchor);a={anchor:null,node:null},l.set(s,a)}e?.startsWith("!!")&&(e=dn+e.slice(2));let c=gn(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let f=new y(s);return a&&(a.node=f),f}c=s instanceof Map?o[Y]:Symbol.iterator in Object(s)?o[re]:o[Y]}r&&(r(c),delete t.onTagObj);let p=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new y(s);return e?p.tag=e:c.default||(p.tag=c.tag),a&&(a.node=p),p}function qe(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return oe(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var Ae=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Oe=class extends ue{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>I(n)||T(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ae(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(L(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,qe(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(L(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&E(r)?r.value:r:L(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!T(t))return!1;let n=t.value;return n==null||e&&E(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return L(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(L(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,qe(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};var Ss=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function J(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var te=(s,e,t)=>s.endsWith(`
|
|
4
4
|
`)?J(t,e):t.includes(`
|
|
5
5
|
`)?`
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as K,b as V,c as Ne}from"./chunk-5FDIH76R.js";import{c as Pe}from"./chunk-4YPQAOC6.js";import{d as _e}from"./chunk-VVVCJPSQ.js";import{d as Oe}from"./chunk-WPS3EFNK.js";import{g as $e,i as Fe,k as B}from"./chunk-JXPGKN3F.js";import{a as Ue,b as E}from"./chunk-KIYNMK6P.js";import{a as Ae}from"./chunk-KQCFBS3K.js";import{createHash as St}from"crypto";import{readFileSync as M}from"fs";import je from"path";import{gzipSync as ge,gunzipSync as vt}from"zlib";function Ce(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 ut,constants as ct}from"node:zlib";var dt=9;function Le(e){return ut(e,{params:{[ct.BROTLI_PARAM_QUALITY]:dt}})}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 pt(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 pt(l),o++,r?.(o,i)}}))}function ft(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 gt(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 ze(e){let t=gt(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=ft(i,e.bundleBytes,e.filesByHash,e.extras);await mt(l,e.concurrency??8,e.onPutProgress);let m=ce(3e4,"finalize"),c;try{c=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:i.token}),signal:m.signal})}finally{m.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 ht(e){return e!==null&&typeof e=="object"?e:null}function De(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function de(e){let t=ht(e);return t?t.schemaVersion===1&&De(t.t)!==void 0&&De(t.seq)!==void 0&&typeof t.context=="string"&&typeof t.kind=="string"&&"data"in t:!1}function yt(e,t){let r=[];for(let s of e.split(`
|
|
3
|
+
`)){let o=s.trim();if(o)try{let i=JSON.parse(o);t(i)&&r.push(i)}catch{}}return r}function He(e){return yt(e,de)}import{execSync as bt}from"child_process";function me(e){try{return bt(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 wt(){let e=me("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 fe(){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 m=t??me("git rev-parse --abbrev-ref HEAD"),c=i?null:wt();return{owner:i??c?.owner??null,repo:l??c?.repo??null,branch:m==="HEAD"?null:m,commitSha:r??me("git rev-parse HEAD"),githubUsername:null,pullRequestNumber:pe(process.env.CONTRAST_PR_NUMBER),pullRequestTitle:s,githubRunId:null,source:"cli"}}function Yt(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 Qt(e){return e.auth?e.uploadedShare?!0:e.auth.kind==="github"||process.env.GITHUB_ACTIONS==="true":!1}async function Xt(e){let t=e.auth??K();if(!t)return null;let r=fe(),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 m=await i.text().catch(()=>"");return console.warn(` warn: run registration failed: /api/sootsim/test-runs ${i.status}${m?`: ${m.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 xt(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"),m=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 m!="string"||!m)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(m);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 Ve=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://contrast.dev",We=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",ye="http://localhost:3000",kt=2e3;async function Et(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(kt)});if(t.ok||t.status===204||t.status===405)return ye}catch{}return Ve}function N(e){return e.replace(/\/$/,"")}function Bt(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 It(e){try{let t=new URL(e).hostname.toLowerCase();return t==="contrast.dev"||t.endsWith(".contrast.dev")}catch{return!1}}function At(e,t){return t?N(t):process.env.SOOTSIM_PREVIEW_ORIGIN?N(process.env.SOOTSIM_PREVIEW_ORIGIN):Bt(e)?N(e):It(e)?N(We):N(e)}function Ut(){console.log(`
|
|
4
|
+
sootsim record upload \u2014 publish the current recorded bundle as a /preview/<id> link
|
|
5
|
+
|
|
6
|
+
usage:
|
|
7
|
+
sootsim record upload [--origin <url>] [--public-origin <url>] (--events <path> | --video <path>) [--screenshot <path>] [--owner <org> --repo <repo>] [--sim <sim>] [--open] [--assets-only]
|
|
8
|
+
|
|
9
|
+
options:
|
|
10
|
+
--origin <url> upload target (default: auto)
|
|
11
|
+
prefers ${ye} when available, otherwise
|
|
12
|
+
falls back to ${Ve}
|
|
13
|
+
override with SOOTSIM_UPLOAD_ORIGIN env var
|
|
14
|
+
--public-origin <url>
|
|
15
|
+
public /preview link origin (default: ${We}
|
|
16
|
+
for prod uploads, upload origin for localhost/custom origins).
|
|
17
|
+
override with SOOTSIM_PREVIEW_ORIGIN env var
|
|
18
|
+
--events <path> path to a gzipped events .jsonl.gz file to attach
|
|
19
|
+
required unless --video is present; previews must
|
|
20
|
+
have replay or recording playback data
|
|
21
|
+
--screenshot <path>
|
|
22
|
+
path to a PNG thumbnail to attach to the share
|
|
23
|
+
--snapshot-manifest <path>
|
|
24
|
+
JSON manifest of existing interaction PNGs to attach
|
|
25
|
+
--video <path> path to a mp4/gif flow recording. embedded inline
|
|
26
|
+
in the pr sticky comment served at
|
|
27
|
+
/api/preview/flow-video?id=<share-id>
|
|
28
|
+
--video-duration-ms <ms>
|
|
29
|
+
duration hint for attached flow video
|
|
30
|
+
--timeline-events <path>
|
|
31
|
+
extra trace timeline rows, JSONL or JSONL gz
|
|
32
|
+
--trace-frame-stats <path>
|
|
33
|
+
frame stats JSON returned by the recorder bridge
|
|
34
|
+
--failure-bundle <dir>
|
|
35
|
+
per-failure debug bundle dir written by the flow runner
|
|
36
|
+
(error.json, describe.json, a11y.txt, tree.txt,
|
|
37
|
+
console.json, screenshot.png). uploaded with the share
|
|
38
|
+
so failed CI runs are debuggable from the dashboard
|
|
39
|
+
--owner <org> associate a session upload with a linked org repo
|
|
40
|
+
--repo <repo> repo name for --owner; the signed-in user must belong
|
|
41
|
+
to the local/org team that owns the link
|
|
42
|
+
--billing-kind test_run
|
|
43
|
+
meter this upload as a natural-language test run
|
|
44
|
+
--sim <sim> target a specific sim (see: sootsim list)
|
|
45
|
+
--open open the resulting /preview/<id> url in the browser
|
|
46
|
+
--assets-only drop API/JSON/HTML records before upload; keep images,
|
|
47
|
+
fonts, css, js, and binary blobs. live-data demos hit
|
|
48
|
+
the real network at replay time instead of serving
|
|
49
|
+
recorded API snapshots
|
|
50
|
+
-h, --help
|
|
51
|
+
|
|
52
|
+
examples:
|
|
53
|
+
sootsim record upload --events ./my-session.jsonl.gz
|
|
54
|
+
sootsim record upload --origin http://localhost:3000 --events ./my-session.jsonl.gz --open
|
|
55
|
+
sootsim record upload --video /tmp/sootsim-flow.mp4 --video-duration-ms 12000
|
|
56
|
+
`)}function p(e,t){let r=e.findIndex(o=>o===t);if(r<0)return;let s=e[r+1];return e.splice(r,2),s}function qe(e,t){let r=e.findIndex(s=>s===t);return r<0?!1:(e.splice(r,1),!0)}function Ge(e,t){if(!e)return;let r=Number(e);return(!Number.isFinite(r)||r<=0)&&(console.error(` invalid ${t}: ${e}`),process.exit(1)),Math.round(r)}function Je(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!!(t.startsWith("image/")||t.startsWith("font/")||t.startsWith("video/")||t.startsWith("audio/")||t.startsWith("model/")||t==="text/css"||t==="application/javascript"||t==="text/javascript"||t==="application/wasm"||t==="application/font-woff"||t==="application/font-woff2"||t==="application/octet-stream"):!1}async function Ke(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 _t(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function Pt(e){try{return new URL(e).searchParams.get("appFonts")||""}catch{return""}}function $t(e){try{return new URL(e).searchParams.get("appSplash")||""}catch{return""}}function Ft(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 Ot(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 Nt(e){return e.recordedDurationMs&&e.recordingStartedAtMs?{since:e.recordingStartedAtMs-1e4,until:e.recordingStartedAtMs+e.recordedDurationMs+5e3,limit:2e3}:{limit:2e3}}function Ct(e){let t=M(e),s=(t[0]===31&&t[1]===139?vt(t):t).toString("utf8");return He(s)}function Lt(e){return JSON.parse(M(e,"utf8"))}function zt(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 Dt(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 yn(e,t){(e.includes("--help")||e.includes("-h"))&&(Ut(),process.exit(0));let r=[...e],s=await Et(p(r,"--origin")),o=At(s,p(r,"--public-origin")),i=p(r,"--events"),l=p(r,"--screenshot"),m=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=Ge(p(r,"--recorded-duration-ms"),"--recorded-duration-ms"),we=Ge(p(r,"--recording-started-at-ms"),"--recording-started-at-ms"),X=p(r,"--owner"),Z=p(r,"--repo"),D=p(r,"--billing-kind"),Ye=p(r,"--run-scope"),Qe=qe(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 `sootsim record --mode combined --open`\n or `sootsim maestro test --preview` instead of uploading a bundle-only snapshot."),process.exit(1));let Me=qe(r,"--assets-only"),Xe=$e(r,{stripBooleanFlags:[],stripValueFlags:[]}),S=Fe(Xe),d,Te=[],v=[],R=h?Ct(h):[],Se=T?Lt(T):null;R.push(...zt(Se));let ve=R.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,[f,P]=await Promise.all([B(S,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(u)}) || [])`),B(S,`(async () => {
|
|
57
|
+
const list = window.__sootsimListWorkerFetchRecorder
|
|
58
|
+
return typeof list === 'function'
|
|
59
|
+
? await list(${JSON.stringify(u)})
|
|
60
|
+
: []
|
|
61
|
+
})()`)]);Te=he([...f,...P]).filter(g=>{try{return!new URL(g.url).pathname.startsWith("/api/")}catch{return!0}});let O=await B(S,`(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
|
+
})()`),z=(O?he([...O.main,...O.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 () => {
|
|
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(v=he([...g.main,...g.worker]),Me){let le=v.length;v=v.filter(ue=>Je(ue.contentType));let at=k.totalBytes-v.reduce((ue,lt)=>ue+(lt.size||0),0);console.log(` --assets-only: kept ${v.length}/${le} records (dropped ${(at/1024).toFixed(1)} KiB of API responses)`)}}}d?.transformedBundle&&(ee=await Ot(S,d.transformedBundle.byteLength));let n=await B(S,`(() => {
|
|
92
|
+
const bridge = window.SootSim?.bridges?.timeline ?? window.__sootsimTimeline
|
|
93
|
+
if (!bridge || typeof bridge.recent !== 'function') return null
|
|
94
|
+
return bridge.recent(${JSON.stringify(Nt({recordedDurationMs:be,recordingStartedAtMs:we}))})
|
|
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:[];R=[...R,...a.filter(de)].sort((u,f)=>u.t-f.t||u.seq-f.seq)}finally{S.close()}d||(console.error(" could not read bundle snapshot \u2014 is sootsim running and is the bundle loaded?"),process.exit(2)),d.bundleUrl||(console.error(` no ?bundle= URL on the current sootsim tab.
|
|
96
|
+
open the app you want to share first (e.g. sootsim open 8082), then run upload.`),process.exit(2));let 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=Ft(d.bundleUrl);n!==d.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),y=await Ke(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=>Je(n.contentType))),console.log(` fetching ${H.length} extra files\u2026`);let j=(await Promise.all(H.map(async n=>{try{let a=await Ke(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),Ze=j.reduce((n,a)=>n+a.bytes.byteLength,0);console.log(` ${j.length} extra files: ${(Ze/1024).toFixed(1)} KiB`);let I;i&&(I=M(i)),R.sort((n,a)=>n.t-a.t||n.seq-a.seq);let Re=R.map(n=>JSON.stringify(n)).join(`
|
|
97
|
+
`),ne=ge(Re?`${Re}
|
|
98
|
+
`:"");console.log(` trace timeline: ${R.length} events${ve?` (${ve} from runner sidecars)`:""}`);let b;l&&(b=M(l),console.log(` attaching screenshot: ${(b.byteLength/1024).toFixed(1)} KiB`));let C=m?xt(m):[];C.length>0&&console.log(` attaching ${C.length} interaction snapshots`);let A,U;if(Y){let n=f=>{try{return M(je.join(Y,f),"utf8")}catch{return null}},a=f=>{let P=n(f);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(f=>f!==null)&&(A=ge(JSON.stringify(u)),console.log(` attaching failure bundle: ${(A.byteLength/1024).toFixed(1)} KiB gz`));try{U=M(je.join(Y,"screenshot.png"))}catch{}}let x,L,xe;if(c){if(x=M(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"),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)),xe=Math.round(n)}console.log(` attaching flow video: ${(x.byteLength/1024).toFixed(1)} KiB (${L})`)}let $=K(),F=Ne($),_=fe(),et=Ae();Ue({event:"preview_upload_started",identity:{userId:$?.kind==="session"?et?.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:R.length,hasScreenshot:!!b,hasVideo:!!x}}),$||(console.error(" preview uploads need auth."),console.error(" set SOOTSIM_API_KEY=sk_sootsim_..., run `sootsim login`, or use the Contrast github runner."),await E(),process.exit(1));let tt=V($),nt=(()=>{try{return new URL(d.bundleUrl).origin}catch{return null}})(),q=(n,a,u,f,P,O,Ie,z)=>{let k=Ce(O),g=k?ge(n):n;return{url:a,urlhash:u,method:f,bodyHash:P,requestVaryHash:z,contentType:O,responseHeaders:Ie,bytes:g,encoding:k?"gzip":void 0}},ke=[],re=Pt(d.pageHref)||"";if(re){let n=await _e(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=$t(d.pageHref)||"";if(se){let n=await Pe(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=Le(y),rt=St("sha256").update(y).digest("hex");console.log(` bundle raw=${(y.byteLength/1024).toFixed(1)} KiB br=${(ie.byteLength/1024).toFixed(1)} KiB`);let st={contentHash:rt,bundleSizeBytes:y.byteLength,bundleContentType:_t(d.bundleUrl),bundleEncoding:"br",bundleOrigin:nt,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:Ye||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:Dt(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 C)n.push(a.meta);return n.length>0?n:void 0})(),flowVideo:x&&L?{sizeBytes:x.byteLength,contentType:L,durationMs:xe}: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 C)G.set(n.meta.id,n.bytes);let ot=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 C)w+=n.bytes.byteLength;A&&(w+=A.byteLength),x&&(w+=x.byteLength);let it=`${N(s)}/api/preview/upload/init`;console.log(` init: ${it}`);let J;try{let n=await ze({originBase:s,initBody:st,bundleBytes:ie,filesByHash:Be,extras:{eventsBytes:I,timelineBytes:ne,videoBytes:x,failureBundleBytes:A,snapshotBytes:G},authHeader:tt,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()-ot}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 `sootsim 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(`
|
|
99
|
+
stored ${J.filesStored??0} extra files`),console.log(` preview: ${ae}`),Qe&&await Oe(ae),await E(),{previewUrl:ae,shareId:J.id}}export{fe as a,Yt as b,Qt as c,Xt as d,Et as e,At as f,yn as g};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{e as p}from"./chunk-DVPVSP7S.js";import{a as c,b as l}from"./chunk-5FDIH76R.js";import{a}from"./chunk-KQCFBS3K.js";async function g(e,t){if(t)return t.replace(/\/$/,"");if(e.kind==="session"&&e.origin)return e.origin.replace(/\/$/,"");let i=a();return i?.origin?i.origin.replace(/\/$/,""):(await p()).replace(/\/$/,"")}async function m(e,t={}){let i=c();if(i||(process.stderr.write(`
|
|
3
3
|
sootsim ${e} needs auth before it can check recording access.
|
|
4
4
|
|
|
5
5
|
pick one:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as c}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as c}from"./chunk-A3R3A55R.js";import{a}from"./chunk-LW25UTSS.js";import{a as e}from"./chunk-XK5YL6SF.js";import{c as n}from"./chunk-7ST3HVVO.js";import{c as i,d as m,e as p}from"./chunk-TD3PSMQU.js";import{a as u}from"./chunk-7G4VSJQ4.js";import{a as f,c as s}from"./chunk-5AVOWKYR.js";function g(){return`sootsim CLI v${u()} \xB7 ${c().primary}`}function C(){let r=m({bridgePort:7668,defaultShellUrl:n},e()),o=`
|
|
3
3
|
${s}
|
|
4
4
|
`;console.log(`${g()}
|
|
5
5
|
${o}${r}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as j,b as ne,c as re,d as xe,e as ke,g as Pe}from"./chunk-WAVNZQ5B.js";import{b as Ie,l as ce}from"./chunk-WBWRABBM.js";import{a as U,b as ae}from"./chunk-S7S2TXMP.js";import{a as Te,b as _e}from"./chunk-AHNX3XFL.js";import{a as Ce,b as se,c as Ee}from"./chunk-ZRQEHAES.js";import{d as le}from"./chunk-3DRMNDJ7.js";import{m as R}from"./chunk-6GADJWCT.js";import{m as Me,o as Re}from"./chunk-3RIGVY4O.js";import{a as Ue,b as Oe,c as ie,e as Be,f as De,g as C,h as v,i as E}from"./chunk-LU5U5HEI.js";import{e as _,f as b,g as M}from"./chunk-TB775GFN.js";import{H as Se,M as te,O as W,l as ve}from"./chunk-GQQZNMLJ.js";import{g as oe,i as $e}from"./chunk-46QQ23PF.js";import{spawn as je,spawnSync as Ke}from"node:child_process";import D from"node:fs";import pt from"node:os";import T from"node:path";import{WebSocket as ft}from"ws";function st(e){return e.replace(/^\[|\]$/g,"").toLowerCase()}function K(e){let t=st(e);return t==="localhost"||t.endsWith(".localhost")||t==="0.0.0.0"||t==="::1"||/^127(?:\.\d{1,3}){3}$/.test(t)}function Le(e){return new Error(`could not resolve a native bundle for ${e}. pass an explicit bundle URL or open Connect and choose the app there.`)}function it(e,t){return e?.includes("/one/metro-entry.bundle")?"one":typeof t=="string"&&t?"expo":"unknown"}function Ne(e,t,o){return`${e}//${t}:${o}`}function at(e){if(typeof window>"u")return!1;try{let t=new URL(e);return K(t.hostname)&&K(window.location.hostname)&&t.origin!==window.location.origin}catch{return!1}}async function Ae(e,t){let o={...t,cache:t?.cache??"no-store"};return at(e)?fetch(`/__fetch-proxy?url=${encodeURIComponent(e)}`,o):fetch(e,o)}function lt(e){return e==="https:"?443:80}function ct(e){let t=e.pathname||"/";return(t==="/"||t==="")&&!e.search&&!e.hash}async function dt(e){try{let t=await fetch("/__server-scan",{cache:"no-store"});if(!t.ok||!(t.headers.get("content-type")||"").toLowerCase().includes("json"))return null;let o=await t.json();if(!Array.isArray(o))return null;let n=o.find(r=>!!r&&typeof r=="object"&&r.port===e&&typeof r.bundleUrl=="string");return n?{bundleUrl:re(n.bundleUrl),port:e,framework:typeof n.framework=="string"?n.framework:"unknown",projectName:typeof n.projectName=="string"?n.projectName:void 0}:null}catch{return null}}async function Fe(e,t){let o=e.replace(/\/+$/,"");try{if(K(new URL(o).hostname)){let n=await dt(t);if(n)return n}}catch{}try{let n=await Ae(`${o}/`,{headers:{"expo-platform":"ios"}});if(n.ok){let r=await n.json(),s=r?.extra?.expoClient||r?.extra||{},i=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:void 0;if(i||s.name)return{bundleUrl:re(i||`${o}${ne}`),port:t,framework:it(i,s.sdkVersion),projectName:s.name}}}catch{}try{let n=await Ae(`${o}/status`);if(n.ok&&(await n.text()).includes("packager-status:running"))return{bundleUrl:`${o}${ne}`,port:t,framework:"metro"}}catch{}return null}async function mt(e){return Fe(Ne("http:","localhost",e),e)}async function He(e){let t=e.trim();if(/^\d+$/.test(t)){let a=parseInt(t,10),l=await mt(a);if(l)return l;throw Le(`localhost:${a}`)}let o=t.startsWith("http")?t:`http://${t}`,n;try{n=new URL(o)}catch{throw new Error(`could not parse "${e}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let r=n.protocol||"http:",s=n.port?parseInt(n.port,10):lt(r),i=Ne(r,n.hostname,s);if(ct(n)){let a=await Fe(i,s);if(a)return a;throw Le(i)}return{bundleUrl:n.toString(),port:s,framework:"unknown"}}function lo(){console.error(" no sootsim desktop companion found."),console.error(""),console.error(" install the desktop app:"),console.error(" sootsim desktop install"),console.error(""),console.error(" or run setup to install the background daemon:"),console.error(" sootsim setup"),console.error("")}function We(e){let t=U();if(console.log(` note: no sootsim bridge detected on port ${e}`),t){console.log(" launch the installed companion with:"),console.log(" sootsim desktop");return}console.log(""),console.log(" run `sootsim setup` to install the background daemon,"),console.log(" or run `sootsim serve` in another shell for a foreground bridge.")}function ut(e){console.error(""),console.error(` no sim is connected to the sootsim bridge on port ${e}.`),console.error(""),console.error(" start your app dev server, then open it in sootsim:"),console.error(" npx expo start --localhost --port 8081"),console.error(" sootsim open 8081"),console.error(""),console.error(" then inspect the live app:"),console.error(" sootsim describe")}async function co(e,t,o){let n=[];try{n=await e.listSims()}catch{}if(console.error(""),n.length===0){ut(t);return}console.error(` no sim with id "${o}" is connected to the bridge on port ${t}.`),console.error(""),console.error(" connected sims:");for(let r of n){let s=[r.isPrimary?"primary":null,r.readyState,r.userVisible===!1?"hidden":r.userVisible===!0?"visible":null,r.userFocused?"focused":null].filter(Boolean).join(", ");console.error(` ${r.id} (${s})`)}console.error(""),console.error(" pass a valid --sim id, or run `sootsim list` to see all sessions.")}var ht=12e4,ze=100,gt=5e3,qe=1e4,wt={rn:"/rn",connectrn:"/rn","connect-rn":"/rn",clock:"/app/clock","native-ui":"/app/native-ui",tamagui:"/app/tamagui",settings:"/app/settings",photos:"/app/photos",camera:"/app/camera"};function $(e){return new Promise(t=>setTimeout(t,e))}function Ge(e){let t=process.env[e]?.trim();if(!t)return null;let o=Number(t);return Number.isInteger(o)&&o>0?o:null}function bt(){let e=Ge("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS")??Ge("SOOTSIM_PW_CONNECT_TIMEOUT_MS")??ht;return{timeoutMs:e,hostTimeoutMs:e+gt,intervalMs:ze,attempts:Math.max(1,Math.ceil(e/ze))}}function yt(e){return e==="chromium"||e==="electron"||e==="playwright"||e==="system"}function vt(e,t){return e.includes("--headless")?!0:e.includes("--headed")?!1:t==="playwright"&&process.platform==="linux"&&!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY?(console.error(" no display detected \u2192 running playwright headless (override with --headed)"),!0):!1}function G(e){return e.trim()}var Ye=/^[A-Za-z][A-Za-z0-9+.-]*:/;function St(e){let t=e.trim();if(!t)throw new Error("expected <url-or-route>");return Ye.test(t)||t.startsWith("/")?t:`/${t}`}function $t(e){return e!==null&&typeof e=="object"}function xt(e){let t=e.trim();return t?t.startsWith("/")?!0:Ye.test(t)?!/^https?:\/\//i.test(t):!1:!1}async function kt(e){if(await z(e,250))return e;let t=te();if(t&&W(t)&&await z(t.bridgePort,500))return t.bridgePort;if(t&&W(t))throw new Error(`sootsim bridge lockfile is fresh (port ${t.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`);await It();let o=Pt(["serve","--quiet","--port",String(e)]),n=null;o.once("exit",(s,i)=>{n=String(s??i??"unknown")}),o.unref();let r=Date.now()+qe;for(;Date.now()<r;){let s=te();if(s&&W(s)&&await z(s.bridgePort,250))return console.error(` started local bridge on port ${s.bridgePort}; run \`sootsim setup\` to install the background daemon`),s.bridgePort;if(await z(e,250))return console.error(` started local bridge on port ${e}; run \`sootsim setup\` to install the background daemon`),e;if(n)throw new Error(`sootsim bridge exited before becoming ready (exit ${n})`);await $(150)}throw new Error(`sootsim bridge did not start within ${Math.round(qe/1e3)}s`)}async function It(){let e=Se();if(e&&D.existsSync(ve(e)))return;console.error(" installing sootsim engine runtime...");let{runRuntime:t}=await import("./runtime-PFL2DHOG.js");await t(["install"],{})}function Pt(e){let t=process.argv[1];return t&&D.existsSync(t)?je(process.execPath,[t,...e],{detached:!0,stdio:"ignore",env:process.env}):je("sootsim",e,{detached:!0,stdio:"ignore",env:process.env})}function z(e,t){return new Promise(o=>{let n=new ft(`ws://127.0.0.1:${e}`,{handshakeTimeout:t}),r=!1,s=i=>{if(!r){r=!0;try{n.close()}catch{}o(i)}};n.once("open",()=>s(!0)),n.once("error",()=>s(!1)),setTimeout(()=>s(!1),t)})}function ue(e){try{let t=new URL(e),o=t.pathname.replace(/\/+$/,"")||"/";return t.searchParams.has("open")||t.searchParams.has("port")||t.searchParams.has("bundle")||t.searchParams.has("demo")||t.pathname.includes("/sootsim/index.html")||o==="/sootsim"||t.pathname==="/__soot"||t.pathname==="/__soot/"||o==="/rn"||/^\/rn\/[^/]+$/i.test(o)||/^\/app\/[^/]+$/i.test(o)||o==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(o)||/^\/__soot\/app\/[^/]+$/i.test(o)}catch{return!1}}function Ct(e){try{let t=new URL(e,"http://sootsim.local");if(t.origin!=="http://sootsim.local")return!1;let o=t.pathname.replace(/\/+$/,"")||"/";return o==="/rn"||/^\/rn\/[^/]+$/i.test(o)||/^\/app\/[^/]+$/i.test(o)||o==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(o)||/^\/__soot\/app\/[^/]+$/i.test(o)}catch{return!1}}function Et(e,t){let o=new URL(e,"http://sootsim.local"),n=new URL(t),r=V(n.pathname),s=o.pathname.startsWith("/__soot/")?o.pathname.slice(7):o.pathname;return n.pathname=`${r}${s}`,n.search=o.search,n.hash=o.hash,n.toString()}function Tt(e){try{let t=new URL(e).pathname.replace(/\/+$/,"")||"/";return/^\/preview\/[^/]+$/.test(t)||/^\/build\/.+/.test(t)}catch{return!1}}async function Bo(e){let t=G(e);return(await Ze(t)).bundleUrl}function _t(e){try{let t=new URL(e.startsWith("http")?e:`http://${e}`),o=t.pathname||"/";if(o!=="/"&&o!==""||t.search||t.hash||!/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(t.hostname))return null;let n=t.port?Number(t.port):t.protocol==="https:"?443:80;return Number.isFinite(n)&&n>0?n:null}catch{return null}}async function Ze(e){let t=G(e),o=/^\d+$/.test(t)?Number(t):_t(t);if(o&&o>0){let n=await ke(o);if(n)return{bundleUrl:n.bundleUrl,port:n.port,framework:n.framework,projectName:n.projectName}}return He(t)}function V(e){let t=e.replace(/\/+$/,"")||"/";return t==="/__soot"||t.startsWith("/__soot/")?"/__soot":""}function Mt(e,t){let o=G(e),n=new URL(t),r=V(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),/^\d+$/.test(o)?n.pathname=`${r}/rn/${o}`:(n.pathname=`${r}/rn`,n.searchParams.set("open",o)),n.toString()}function Rt(e){let t=G(e);return/^\d+$/.test(t)||/^https?:\/\//i.test(t)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(t)}async function Ut(e,t,o={}){let n=await Ze(e),r=new URL(t),s=V(r.pathname);r.pathname=`${s}/rn`,r.searchParams.delete("open"),r.searchParams.delete("port"),r.searchParams.delete("demo"),r.searchParams.delete("app");let i=o.hot===void 0?n.bundleUrl:xe(n.bundleUrl,o.hot);return r.searchParams.set("bundle",i),r.toString()}function Ot(e){return e.startsWith("~/")?T.join(pt.homedir(),e.slice(2)):T.isAbsolute(e)?e:T.resolve(process.cwd(),e)}function Bt(e){let t={},o={};for(let r=0;r<e.length;r++){if(e[r]==="--replace"){let s=e[r+1];s||(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let i=s.indexOf("=");(i<=0||i===s.length-1)&&(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let a=s.slice(0,i).trim(),l=Ot(s.slice(i+1).trim());D.existsSync(l)||(console.error(` sootsim open: replacement file not found: ${l}`),process.exit(1)),t[a]={file:l},r++;continue}if(e[r]==="--remap"){let s=e[r+1],i=s?s.indexOf("="):-1;(!s||i<=0||i===s.length-1)&&(console.error(" sootsim open: --remap expects <host:port>=<host:port>"),process.exit(1)),o[s.slice(0,i).trim()]=s.slice(i+1).trim(),r++;continue}}let n={};return Object.keys(t).length>0&&(n.modules=t),Object.keys(o).length>0&&(n.network={remap:o}),n.modules||n.network?n:void 0}function Xe(){return Ue().shellBaseUrl}async function Dt(e){try{let t=new URL(e),o=t.searchParams.get("bundle")||"";if(!o)return e;let n=process.env.CONTRAST_REPO_DIR||await se(o)||void 0,r=Ce({bundleUrl:o,repoDir:n});if(r.length===0)return e;let s=await Lt(r);return s.length===0?e:(t.searchParams.set("appFonts",Ee(s)),t.toString())}catch{return e}}async function Lt(e){let t=await Promise.all(e.map(async n=>{let r=new AbortController,s=setTimeout(()=>r.abort(),1500);try{let i=await fetch(n.url,{method:"HEAD",signal:r.signal});return i.status>=200&&i.status<400?n:null}catch{return null}finally{clearTimeout(s)}})),o=[];for(let n of t)n!==null&&o.push(n);return o}async function At(e,t,o={}){if(!e)return new URL(t).toString();if(ue(e))return new URL(e).toString();if(Ct(e))return Et(e,t);let n=wt[e.toLowerCase()];if(n){let r=new URL(t),s=V(r.pathname);return r.pathname=`${s}${n}`,r.toString()}return Rt(e)?Ut(e,t,o):Mt(e,t)}async function Nt(e){try{let t=new URL(e),o=t.searchParams.get("bundle")||"";if(!o)return e;let n=process.env.CONTRAST_REPO_DIR||await se(o)||void 0,r=Te({bundleUrl:o,repoDir:n});return!r||r.imageUrl&&!await Ft(r.imageUrl)?e:(t.searchParams.set("appSplash",_e(r)),t.toString())}catch{return e}}async function Ft(e){let t=new AbortController,o=setTimeout(()=>t.abort(),1500);try{let n=await fetch(e,{method:"HEAD",signal:t.signal});return n.status>=200&&n.status<400}catch{return!1}finally{clearTimeout(o)}}async function q(e,t=Xe(),o={}){let n=await At(e,t,o),r=await Nt(await Dt(n));if(!o.device)return r;let s=new URL(r);return s.searchParams.set("device",o.device),s.toString()}function Ve(e,t){let o=e?.url||e?.origin||t;try{let n=new URL(o);return n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("inspectOpen"),n.searchParams.delete("appFonts"),n.searchParams.delete("appSplash"),n.toString()}catch{return t}}async function Ht(e,t,o,n={}){let r=new URL(await q(e,t,n));return r.searchParams.set("inspectOpen",o),r.toString()}async function Wt(e,t,o,n={}){let r=n.attempts??30,s=n.intervalMs??500,i=n.minNodeCount??10;for(let a=0;a<r;a++){let l=v(e,{commandTimeoutMs:t,simId:o,simIdSource:"flag"});try{let d=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof d=="number"&&d>i)return{bridge:l,count:d}}catch{}l.close(),await $(s)}return null}function jt(e){if(!e)return null;try{let t=new URL(e);if(t.searchParams.has("bundle")){let o=t.searchParams.get("bundle")||"";try{let n=new URL(o),r=n.pathname.length>36?`...${n.pathname.slice(-36)}`:n.pathname;return`bundle ${n.host}${r}`}catch{return"bundle"}}return t.searchParams.has("port")?`connect :${t.searchParams.get("port")||""}`:t.searchParams.has("open")?`connect ${t.searchParams.get("open")||""}`:t.searchParams.has("demo")?`demo ${t.searchParams.get("demo")||"default"}`:t.pathname.includes("/sootsim/index.html")||t.pathname==="/sootsim/"||t.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function Kt(e){let t=e.indexOf(":");if(t<=0)return e.length>24?`${e.slice(0,21)}\u2026`:e;let o=e.slice(0,t),n=e.slice(t+1),r=n.length>12?`${n.slice(0,8)}\u2026`:n;return o==="AGENTBUS_SESSION"||o==="CLAUDE_CODE_SESSION_ID"||o==="CODEX_THREAD_ID"?`agent ${r}`:`${o} ${r}`}function Do(e,t){if(e.length===0){console.log(" no sims connected");return}console.log(` connected sims (${e.length}):
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as j,b as ne,c as re,d as xe,e as ke,g as Pe}from"./chunk-AASXS3LK.js";import{b as Ie,l as ce}from"./chunk-6KZBSG52.js";import{a as U,b as ae}from"./chunk-MS33P5CV.js";import{a as Te,b as _e}from"./chunk-4YPQAOC6.js";import{a as Ce,b as se,c as Ee}from"./chunk-VVVCJPSQ.js";import{d as le}from"./chunk-WPS3EFNK.js";import{m as R}from"./chunk-YV35LVCO.js";import{m as Me,o as Re}from"./chunk-6NUCPZGB.js";import{a as Ue,b as Oe,c as ie,e as Be,f as De,g as C,h as v,i as E}from"./chunk-JXPGKN3F.js";import{e as _,f as b,g as M}from"./chunk-54U7A36G.js";import{H as Se,M as te,O as W,l as ve}from"./chunk-5JX4BCGL.js";import{g as oe,i as $e}from"./chunk-DAWIWEWR.js";import{spawn as je,spawnSync as Ke}from"node:child_process";import D from"node:fs";import pt from"node:os";import T from"node:path";import{WebSocket as ft}from"ws";function st(e){return e.replace(/^\[|\]$/g,"").toLowerCase()}function K(e){let t=st(e);return t==="localhost"||t.endsWith(".localhost")||t==="0.0.0.0"||t==="::1"||/^127(?:\.\d{1,3}){3}$/.test(t)}function Le(e){return new Error(`could not resolve a native bundle for ${e}. pass an explicit bundle URL or open Connect and choose the app there.`)}function it(e,t){return e?.includes("/one/metro-entry.bundle")?"one":typeof t=="string"&&t?"expo":"unknown"}function Ne(e,t,o){return`${e}//${t}:${o}`}function at(e){if(typeof window>"u")return!1;try{let t=new URL(e);return K(t.hostname)&&K(window.location.hostname)&&t.origin!==window.location.origin}catch{return!1}}async function Ae(e,t){let o={...t,cache:t?.cache??"no-store"};return at(e)?fetch(`/__fetch-proxy?url=${encodeURIComponent(e)}`,o):fetch(e,o)}function lt(e){return e==="https:"?443:80}function ct(e){let t=e.pathname||"/";return(t==="/"||t==="")&&!e.search&&!e.hash}async function dt(e){try{let t=await fetch("/__server-scan",{cache:"no-store"});if(!t.ok||!(t.headers.get("content-type")||"").toLowerCase().includes("json"))return null;let o=await t.json();if(!Array.isArray(o))return null;let n=o.find(r=>!!r&&typeof r=="object"&&r.port===e&&typeof r.bundleUrl=="string");return n?{bundleUrl:re(n.bundleUrl),port:e,framework:typeof n.framework=="string"?n.framework:"unknown",projectName:typeof n.projectName=="string"?n.projectName:void 0}:null}catch{return null}}async function Fe(e,t){let o=e.replace(/\/+$/,"");try{if(K(new URL(o).hostname)){let n=await dt(t);if(n)return n}}catch{}try{let n=await Ae(`${o}/`,{headers:{"expo-platform":"ios"}});if(n.ok){let r=await n.json(),s=r?.extra?.expoClient||r?.extra||{},i=typeof r?.launchAsset?.url=="string"?r.launchAsset.url:void 0;if(i||s.name)return{bundleUrl:re(i||`${o}${ne}`),port:t,framework:it(i,s.sdkVersion),projectName:s.name}}}catch{}try{let n=await Ae(`${o}/status`);if(n.ok&&(await n.text()).includes("packager-status:running"))return{bundleUrl:`${o}${ne}`,port:t,framework:"metro"}}catch{}return null}async function mt(e){return Fe(Ne("http:","localhost",e),e)}async function He(e){let t=e.trim();if(/^\d+$/.test(t)){let a=parseInt(t,10),l=await mt(a);if(l)return l;throw Le(`localhost:${a}`)}let o=t.startsWith("http")?t:`http://${t}`,n;try{n=new URL(o)}catch{throw new Error(`could not parse "${e}". pass a dev-server port, a dev-server base URL, or a full bundle URL.`)}let r=n.protocol||"http:",s=n.port?parseInt(n.port,10):lt(r),i=Ne(r,n.hostname,s);if(ct(n)){let a=await Fe(i,s);if(a)return a;throw Le(i)}return{bundleUrl:n.toString(),port:s,framework:"unknown"}}function lo(){console.error(" no sootsim desktop companion found."),console.error(""),console.error(" install the desktop app:"),console.error(" sootsim desktop install"),console.error(""),console.error(" or run setup to install the background daemon:"),console.error(" sootsim setup"),console.error("")}function We(e){let t=U();if(console.log(` note: no sootsim bridge detected on port ${e}`),t){console.log(" launch the installed companion with:"),console.log(" sootsim desktop");return}console.log(""),console.log(" run `sootsim setup` to install the background daemon,"),console.log(" or run `sootsim serve` in another shell for a foreground bridge.")}function ut(e){console.error(""),console.error(` no sim is connected to the sootsim bridge on port ${e}.`),console.error(""),console.error(" start your app dev server, then open it in sootsim:"),console.error(" npx expo start --localhost --port 8081"),console.error(" sootsim open 8081"),console.error(""),console.error(" then inspect the live app:"),console.error(" sootsim describe")}async function co(e,t,o){let n=[];try{n=await e.listSims()}catch{}if(console.error(""),n.length===0){ut(t);return}console.error(` no sim with id "${o}" is connected to the bridge on port ${t}.`),console.error(""),console.error(" connected sims:");for(let r of n){let s=[r.isPrimary?"primary":null,r.readyState,r.userVisible===!1?"hidden":r.userVisible===!0?"visible":null,r.userFocused?"focused":null].filter(Boolean).join(", ");console.error(` ${r.id} (${s})`)}console.error(""),console.error(" pass a valid --sim id, or run `sootsim list` to see all sessions.")}var ht=12e4,ze=100,gt=5e3,qe=1e4,wt={rn:"/rn",connectrn:"/rn","connect-rn":"/rn",clock:"/app/clock","native-ui":"/app/native-ui",tamagui:"/app/tamagui",settings:"/app/settings",photos:"/app/photos",camera:"/app/camera"};function $(e){return new Promise(t=>setTimeout(t,e))}function Ge(e){let t=process.env[e]?.trim();if(!t)return null;let o=Number(t);return Number.isInteger(o)&&o>0?o:null}function bt(){let e=Ge("SOOTSIM_DRIVER_CONNECT_TIMEOUT_MS")??Ge("SOOTSIM_PW_CONNECT_TIMEOUT_MS")??ht;return{timeoutMs:e,hostTimeoutMs:e+gt,intervalMs:ze,attempts:Math.max(1,Math.ceil(e/ze))}}function yt(e){return e==="chromium"||e==="electron"||e==="playwright"||e==="system"}function vt(e,t){return e.includes("--headless")?!0:e.includes("--headed")?!1:t==="playwright"&&process.platform==="linux"&&!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY?(console.error(" no display detected \u2192 running playwright headless (override with --headed)"),!0):!1}function G(e){return e.trim()}var Ye=/^[A-Za-z][A-Za-z0-9+.-]*:/;function St(e){let t=e.trim();if(!t)throw new Error("expected <url-or-route>");return Ye.test(t)||t.startsWith("/")?t:`/${t}`}function $t(e){return e!==null&&typeof e=="object"}function xt(e){let t=e.trim();return t?t.startsWith("/")?!0:Ye.test(t)?!/^https?:\/\//i.test(t):!1:!1}async function kt(e){if(await z(e,250))return e;let t=te();if(t&&W(t)&&await z(t.bridgePort,500))return t.bridgePort;if(t&&W(t))throw new Error(`sootsim bridge lockfile is fresh (port ${t.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`);await It();let o=Pt(["serve","--quiet","--port",String(e)]),n=null;o.once("exit",(s,i)=>{n=String(s??i??"unknown")}),o.unref();let r=Date.now()+qe;for(;Date.now()<r;){let s=te();if(s&&W(s)&&await z(s.bridgePort,250))return console.error(` started local bridge on port ${s.bridgePort}; run \`sootsim setup\` to install the background daemon`),s.bridgePort;if(await z(e,250))return console.error(` started local bridge on port ${e}; run \`sootsim setup\` to install the background daemon`),e;if(n)throw new Error(`sootsim bridge exited before becoming ready (exit ${n})`);await $(150)}throw new Error(`sootsim bridge did not start within ${Math.round(qe/1e3)}s`)}async function It(){let e=Se();if(e&&D.existsSync(ve(e)))return;console.error(" installing sootsim engine runtime...");let{runRuntime:t}=await import("./runtime-RXHJI4Y4.js");await t(["install"],{})}function Pt(e){let t=process.argv[1];return t&&D.existsSync(t)?je(process.execPath,[t,...e],{detached:!0,stdio:"ignore",env:process.env}):je("sootsim",e,{detached:!0,stdio:"ignore",env:process.env})}function z(e,t){return new Promise(o=>{let n=new ft(`ws://127.0.0.1:${e}`,{handshakeTimeout:t}),r=!1,s=i=>{if(!r){r=!0;try{n.close()}catch{}o(i)}};n.once("open",()=>s(!0)),n.once("error",()=>s(!1)),setTimeout(()=>s(!1),t)})}function ue(e){try{let t=new URL(e),o=t.pathname.replace(/\/+$/,"")||"/";return t.searchParams.has("open")||t.searchParams.has("port")||t.searchParams.has("bundle")||t.searchParams.has("demo")||t.pathname.includes("/sootsim/index.html")||o==="/sootsim"||t.pathname==="/__soot"||t.pathname==="/__soot/"||o==="/rn"||/^\/rn\/[^/]+$/i.test(o)||/^\/app\/[^/]+$/i.test(o)||o==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(o)||/^\/__soot\/app\/[^/]+$/i.test(o)}catch{return!1}}function Ct(e){try{let t=new URL(e,"http://sootsim.local");if(t.origin!=="http://sootsim.local")return!1;let o=t.pathname.replace(/\/+$/,"")||"/";return o==="/rn"||/^\/rn\/[^/]+$/i.test(o)||/^\/app\/[^/]+$/i.test(o)||o==="/__soot/rn"||/^\/__soot\/rn\/[^/]+$/i.test(o)||/^\/__soot\/app\/[^/]+$/i.test(o)}catch{return!1}}function Et(e,t){let o=new URL(e,"http://sootsim.local"),n=new URL(t),r=V(n.pathname),s=o.pathname.startsWith("/__soot/")?o.pathname.slice(7):o.pathname;return n.pathname=`${r}${s}`,n.search=o.search,n.hash=o.hash,n.toString()}function Tt(e){try{let t=new URL(e).pathname.replace(/\/+$/,"")||"/";return/^\/preview\/[^/]+$/.test(t)||/^\/build\/.+/.test(t)}catch{return!1}}async function Bo(e){let t=G(e);return(await Ze(t)).bundleUrl}function _t(e){try{let t=new URL(e.startsWith("http")?e:`http://${e}`),o=t.pathname||"/";if(o!=="/"&&o!==""||t.search||t.hash||!/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(t.hostname))return null;let n=t.port?Number(t.port):t.protocol==="https:"?443:80;return Number.isFinite(n)&&n>0?n:null}catch{return null}}async function Ze(e){let t=G(e),o=/^\d+$/.test(t)?Number(t):_t(t);if(o&&o>0){let n=await ke(o);if(n)return{bundleUrl:n.bundleUrl,port:n.port,framework:n.framework,projectName:n.projectName}}return He(t)}function V(e){let t=e.replace(/\/+$/,"")||"/";return t==="/__soot"||t.startsWith("/__soot/")?"/__soot":""}function Mt(e,t){let o=G(e),n=new URL(t),r=V(n.pathname);return n.pathname=`${r}/rn`,n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),/^\d+$/.test(o)?n.pathname=`${r}/rn/${o}`:(n.pathname=`${r}/rn`,n.searchParams.set("open",o)),n.toString()}function Rt(e){let t=G(e);return/^\d+$/.test(t)||/^https?:\/\//i.test(t)?!0:/^(localhost|127\.0\.0\.1|\[::1\]|[^/]+\.localhost):\d+(?:\/.*)?$/i.test(t)}async function Ut(e,t,o={}){let n=await Ze(e),r=new URL(t),s=V(r.pathname);r.pathname=`${s}/rn`,r.searchParams.delete("open"),r.searchParams.delete("port"),r.searchParams.delete("demo"),r.searchParams.delete("app");let i=o.hot===void 0?n.bundleUrl:xe(n.bundleUrl,o.hot);return r.searchParams.set("bundle",i),r.toString()}function Ot(e){return e.startsWith("~/")?T.join(pt.homedir(),e.slice(2)):T.isAbsolute(e)?e:T.resolve(process.cwd(),e)}function Bt(e){let t={},o={};for(let r=0;r<e.length;r++){if(e[r]==="--replace"){let s=e[r+1];s||(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let i=s.indexOf("=");(i<=0||i===s.length-1)&&(console.error(" sootsim open: --replace expects <module>=<file>"),process.exit(1));let a=s.slice(0,i).trim(),l=Ot(s.slice(i+1).trim());D.existsSync(l)||(console.error(` sootsim open: replacement file not found: ${l}`),process.exit(1)),t[a]={file:l},r++;continue}if(e[r]==="--remap"){let s=e[r+1],i=s?s.indexOf("="):-1;(!s||i<=0||i===s.length-1)&&(console.error(" sootsim open: --remap expects <host:port>=<host:port>"),process.exit(1)),o[s.slice(0,i).trim()]=s.slice(i+1).trim(),r++;continue}}let n={};return Object.keys(t).length>0&&(n.modules=t),Object.keys(o).length>0&&(n.network={remap:o}),n.modules||n.network?n:void 0}function Xe(){return Ue().shellBaseUrl}async function Dt(e){try{let t=new URL(e),o=t.searchParams.get("bundle")||"";if(!o)return e;let n=process.env.CONTRAST_REPO_DIR||await se(o)||void 0,r=Ce({bundleUrl:o,repoDir:n});if(r.length===0)return e;let s=await Lt(r);return s.length===0?e:(t.searchParams.set("appFonts",Ee(s)),t.toString())}catch{return e}}async function Lt(e){let t=await Promise.all(e.map(async n=>{let r=new AbortController,s=setTimeout(()=>r.abort(),1500);try{let i=await fetch(n.url,{method:"HEAD",signal:r.signal});return i.status>=200&&i.status<400?n:null}catch{return null}finally{clearTimeout(s)}})),o=[];for(let n of t)n!==null&&o.push(n);return o}async function At(e,t,o={}){if(!e)return new URL(t).toString();if(ue(e))return new URL(e).toString();if(Ct(e))return Et(e,t);let n=wt[e.toLowerCase()];if(n){let r=new URL(t),s=V(r.pathname);return r.pathname=`${s}${n}`,r.toString()}return Rt(e)?Ut(e,t,o):Mt(e,t)}async function Nt(e){try{let t=new URL(e),o=t.searchParams.get("bundle")||"";if(!o)return e;let n=process.env.CONTRAST_REPO_DIR||await se(o)||void 0,r=Te({bundleUrl:o,repoDir:n});return!r||r.imageUrl&&!await Ft(r.imageUrl)?e:(t.searchParams.set("appSplash",_e(r)),t.toString())}catch{return e}}async function Ft(e){let t=new AbortController,o=setTimeout(()=>t.abort(),1500);try{let n=await fetch(e,{method:"HEAD",signal:t.signal});return n.status>=200&&n.status<400}catch{return!1}finally{clearTimeout(o)}}async function q(e,t=Xe(),o={}){let n=await At(e,t,o),r=await Nt(await Dt(n));if(!o.device)return r;let s=new URL(r);return s.searchParams.set("device",o.device),s.toString()}function Ve(e,t){let o=e?.url||e?.origin||t;try{let n=new URL(o);return n.searchParams.delete("bundle"),n.searchParams.delete("demo"),n.searchParams.delete("app"),n.searchParams.delete("open"),n.searchParams.delete("port"),n.searchParams.delete("inspectOpen"),n.searchParams.delete("appFonts"),n.searchParams.delete("appSplash"),n.toString()}catch{return t}}async function Ht(e,t,o,n={}){let r=new URL(await q(e,t,n));return r.searchParams.set("inspectOpen",o),r.toString()}async function Wt(e,t,o,n={}){let r=n.attempts??30,s=n.intervalMs??500,i=n.minNodeCount??10;for(let a=0;a<r;a++){let l=v(e,{commandTimeoutMs:t,simId:o,simIdSource:"flag"});try{let d=await l.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount()) || 0)()"});if(typeof d=="number"&&d>i)return{bridge:l,count:d}}catch{}l.close(),await $(s)}return null}function jt(e){if(!e)return null;try{let t=new URL(e);if(t.searchParams.has("bundle")){let o=t.searchParams.get("bundle")||"";try{let n=new URL(o),r=n.pathname.length>36?`...${n.pathname.slice(-36)}`:n.pathname;return`bundle ${n.host}${r}`}catch{return"bundle"}}return t.searchParams.has("port")?`connect :${t.searchParams.get("port")||""}`:t.searchParams.has("open")?`connect ${t.searchParams.get("open")||""}`:t.searchParams.has("demo")?`demo ${t.searchParams.get("demo")||"default"}`:t.pathname.includes("/sootsim/index.html")||t.pathname==="/sootsim/"||t.pathname==="/sootsim"?"embedded sootsim":null}catch{return null}}function Kt(e){let t=e.indexOf(":");if(t<=0)return e.length>24?`${e.slice(0,21)}\u2026`:e;let o=e.slice(0,t),n=e.slice(t+1),r=n.length>12?`${n.slice(0,8)}\u2026`:n;return o==="AGENTBUS_SESSION"||o==="CLAUDE_CODE_SESSION_ID"||o==="CODEX_THREAD_ID"?`agent ${r}`:`${o} ${r}`}function Do(e,t){if(e.length===0){console.log(" no sims connected");return}console.log(` connected sims (${e.length}):
|
|
3
3
|
`);for(let o of e){let n=o.lockedBy&&o.lockExpiresAt?`locked by ${Kt(o.lockedBy)} (${Math.max(0,Math.round((o.lockExpiresAt-Date.now())/1e3))}s)`:"",r=[o.isPrimary?"primary":"",o.id===t?"selected":"",o.readyState,o.userVisible===!1?"hidden":o.userVisible===!0?"visible":"",o.attachedCliCount&&o.attachedCliCount>0?"in use":"",o.userFocused?"focused":"",n].filter(Boolean);console.log(` ${o.id}${r.length?` [${r.join(", ")}]`:""}`);let s=jt(o.url);if(s)console.log(` loaded: ${s}`);else if(o.url){let a=o.url.length>96?`${o.url.slice(0,93)}\u2026`:o.url;console.log(` url: ${a}`)}else o.origin&&console.log(` origin: ${o.origin}`);let i=zt(o);i&&console.log(` engine: ${i}`),o.title&&console.log(` title: ${o.title}`),o.visibilityState&&o.visibilityState!=="visible"&&console.log(` visibility: ${o.visibilityState}`),console.log(` connected: ${Je(Date.now()-o.connectedAt)}`),o.lastActiveAt&&o.lastActiveAt>0&&console.log(` last active: ${Je(Date.now()-o.lastActiveAt)}`)}}function zt(e){let t=e.url||e.origin||"";if(!t)return null;try{let o=new URL(t).port;return o==="5173"?"dev \u2014 local source (:5173)":o==="3000"?"Contrast app embedded (:3000)":Pe()?`dev \u2014 local build (:${o||"?"})`:`runtime \u2014 published engine (:${o||"?"})`}catch{return null}}function Je(e){let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s ago`:t<3600?`${Math.round(t/60)}m ago`:t<86400?`${Math.round(t/3600)}h ago`:`${Math.round(t/86400)}d ago`}async function de(e,t,o,n={}){let r=n.attempts??30,s=n.intervalMs??500;for(let i=0;i<r;i++){let a=v(e,{commandTimeoutMs:t});try{let d=(await a.listSims()).find(o);if(d)return d}catch{}finally{a.close()}await $(s)}return null}async function qt(e,t,o,n,r={}){let s=r.attempts??30,i=r.intervalMs??500,a=!!n&&Number.isInteger(n)&&n>1,l=()=>a&&n!==void 0&&!pe(n);for(let d=0;d<s;d++){if(l())return{kind:"host-exit"};let m=v(e,{commandTimeoutMs:t});try{let g=(await m.listSims()).find(o);if(g)return l()?{kind:"host-exit"}:{kind:"match",sim:g}}catch{}finally{m.close()}if(l())return{kind:"host-exit"};await $(i)}return{kind:"timeout"}}async function Gt(e,t,o,n={}){let r=n.attempts??20,s=n.intervalMs??250;for(let i=0;i<r;i++){let a=v(e,{commandTimeoutMs:t});try{let d=(await a.listSims()).find(m=>m.id===o);if(!d||d.readyState!=="open")return!0}catch{return!0}finally{a.close()}await $(s)}return!1}function Vt(e){let t=e.meta;if(!t||t.sootsimHostDriver!=="playwright")return null;let o=Number(t.sootsimHostPid);return!Number.isInteger(o)||o<=1||o===process.pid?null:o}function Jt(e){if(!e.connectAckFile)return!1;try{return D.writeFileSync(e.connectAckFile,`${JSON.stringify({connectedAt:Date.now(),pid:e.pid??null})}
|
|
4
4
|
`,{flag:"w"}),!0}catch{return!1}}function Qe(e){if(e.diagnosticLogPath)try{let t=D.readFileSync(e.diagnosticLogPath,"utf8").trim();if(!t){console.error(` ${T.basename(e.diagnosticLogPath)} was empty`);return}let o=t.length>4e3?`\u2026
|
|
5
5
|
${t.slice(-4e3)}`:t;console.error(` ${T.basename(e.diagnosticLogPath)}:`),console.error(o)}catch(t){let o=t instanceof Error?t.message:String(t);console.error(` failed to read ${T.basename(e.diagnosticLogPath)}: ${o}`)}}function pe(e){try{return process.kill(e,0),!0}catch(t){return t?.code==="EPERM"}}async function Qt(e,t=2500){let o=Date.now()+t;for(;Date.now()<o;){if(!pe(e))return!0;await $(100)}return!pe(e)}function Yt(e){let t=Ke("ps",["-o","command=","-p",String(e)],{encoding:"utf8",stdio:["ignore","pipe","pipe"]}),o=Ke("ps",["eww","-o","command=","-p",String(e)],{encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(t.status!==0||o.status!==0)return!1;let n=(t.stdout||"").trimEnd(),r=(o.stdout||"").trimEnd();return(r.startsWith(n)?r.slice(n.length):r).includes("SOOTSIM_PW_URL=")}async function me(e,t){let o=new Set(t),n=new Set;for(let r of e){if(!o.has(r.id))continue;let s=Vt(r);s&&n.add(s)}for(let r of n){if(!Yt(r)){console.log(` skipped pid ${r}: not a sootsim playwright host (stale sim record)`);continue}try{process.kill(r,"SIGTERM")}catch{}if(await Qt(r)){console.log(` closed playwright host process ${r}`);continue}try{process.kill(r,"SIGKILL"),console.log(` force-closed playwright host process ${r}`)}catch{}}}function J(e,t){if(t){let r=t.trim(),s=e.find(i=>i.id===r);if(!s)throw new Error(`no sim connected with id ${r}`);return s}let o=e.find(r=>r.isPrimary&&r.readyState==="open");if(o)return o;let n=e.find(r=>r.readyState==="open");if(n)return n;throw new Error("no sim connected")}function O(e,t,o){console.log(` ${o==="current sim"?"loaded":"opened"}: ${e} [${o}]`),console.log(` current sim: ${t.id}`),console.log(JSON.stringify({simId:t.id,url:t.url},null,2))}async function B(e,t,o){if(o.includes("--no-describe"))return;let n=process.env.SOOTSIM_QUIET_TARGET_NOTICE;process.env.SOOTSIM_QUIET_TARGET_NOTICE="1";try{await Zt(e,t,{stableMs:150,maxMs:400});let r=v(e,{commandTimeoutMs:3e3,simId:t,cliLabel:"open --describe",simIdSource:"flag"});try{let s=null;try{s=await r.send({type:"evaluate",code:Me})}catch{}if(s&&!(s.flag===!0&&!s.loadingText&&Re(s))){let m=s.loadingText?`still showing "${s.loadingText}"`:s.flag!==!0?"guest ready event has not fired":s.targets<=0?"no visible app content is inspectable yet":"app tree is still stabilizing";console.log(` app still loading: ${m} (nodes: ${s.nodes}, targets: ${s.targets})`),console.log(" before interacting, run: sootsim wait ready --max-ms 120000")}let a=`(async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as R}from"./chunk-K2MMUVAS.js";import{o as D}from"./chunk-GQQZNMLJ.js";import{a as T}from"./chunk-Q3KYEB42.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import h from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function y(){return _()}function U(){return h.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=h.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function he(){return S().attachedProjects}var Q=336*60*60*1e3;function ye(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-4EYB4RJG.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=h.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(y(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(y(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),x=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&x.push("--codex-bin",e.codexBin),e.claudeBin&&x.push("--claude-bin",e.claudeBin),e.freshThread&&x.push("--fresh-thread"),o&&x.push("--claude-session-uuid",o);let P=V(A,x,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});P.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(P.pid)try{process.kill(P.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:P.pid,status:"idle"}),{session:k(s.id),wrapperPid:P.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as R}from"./chunk-B77AQNOH.js";import{o as D}from"./chunk-5JX4BCGL.js";import{a as T}from"./chunk-2QOLVYFF.js";function Y(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.type=="string"&&typeof t.ts=="number"}function I(e){let t=e.trim();if(!t)return null;try{let r=JSON.parse(t);return Y(r)?r:null}catch{return null}}import{randomBytes as G,createHash as q}from"node:crypto";import m from"node:fs";import h from"node:path";var N=null;function _(){if(N)return N;let e=process.env.SOOTSIM_USER_DATA_DIR;return e||D()}function y(){return _()}function U(){return h.join(_(),"attached-projects.json")}function $(){return{version:1,attachedProjects:[],previewAttachments:[],agentSessions:[]}}function S(){let e=U(),t;try{t=m.readFileSync(e,"utf8")}catch(r){if(r.code==="ENOENT")return $();throw r}try{let r=JSON.parse(t);if(!r||typeof r!="object")throw new Error("not an object");return{version:1,attachedProjects:Array.isArray(r.attachedProjects)?r.attachedProjects:[],previewAttachments:Array.isArray(r.previewAttachments)?r.previewAttachments:[],agentSessions:Array.isArray(r.agentSessions)?r.agentSessions:[]}}catch(r){let n=`${e}.corrupt-${Date.now()}`;try{m.renameSync(e,n),console.warn(`[sootsim] attached-projects.json was unparseable; quarantined to ${n}. original error: ${r.message}`)}catch{}return $()}}function X(e){let t=U();m.mkdirSync(h.dirname(t),{recursive:!0});let r=`${t}.tmp-${process.pid}-${Date.now()}`,n=m.openSync(r,"w",384);try{m.writeFileSync(n,JSON.stringify(e,null,2)),m.fsyncSync(n)}finally{m.closeSync(n)}m.renameSync(r,t)}function w(e){let t=S();return e(t),X(t),t}function B(e){return q("sha256").update(h.resolve(e)).digest("hex").slice(0,16)}function K(){return`s_${G(10).toString("hex")}`}function ge(e){let t=h.resolve(e.cwd),r=B(t),n;return w(o=>{let s=o.attachedProjects.find(c=>c.id===r);if(s){let c={...s,...e,id:r,cwd:t,sourceRoots:e.sourceRoots??s.sourceRoots,knownBundleUrls:e.knownBundleUrls??s.knownBundleUrls,pinnedSourceResolutions:e.pinnedSourceResolutions??s.pinnedSourceResolutions,telemetry:e.telemetry??s.telemetry,updatedAt:Date.now(),createdAt:s.createdAt},g=o.attachedProjects.indexOf(s);o.attachedProjects[g]=c,n=c;return}let a=Date.now(),d={id:r,name:e.name??h.basename(t),cwd:t,repoRoot:e.repoRoot,sourceRoots:e.sourceRoots??[t],framework:e.framework??"unknown",bundleId:e.bundleId,knownBundleUrls:e.knownBundleUrls??[],preferredProvider:e.preferredProvider??"codex",preferredTransport:e.preferredTransport??"tmux",editorOpenCommand:e.editorOpenCommand,moshiWebhookToken:e.moshiWebhookToken,pinnedSourceResolutions:e.pinnedSourceResolutions??{},isolateDiscovery:e.isolateDiscovery,git:e.git,telemetry:e.telemetry??{lastOpened:0,runsCompleted:0},createdAt:a,updatedAt:a};o.attachedProjects.push(d),n=d}),n}function F(e){return S().attachedProjects.find(t=>t.id===e)??null}function he(){return S().attachedProjects}var Q=336*60*60*1e3;function ye(e,t={}){w(r=>{let n=r.attachedProjects.find(s=>s.id===e);if(!n)return;let o=t.ts??Date.now();if(n.telemetry.runsCompleted=(n.telemetry.runsCompleted??0)+1,typeof t.usd=="number"&&Number.isFinite(t.usd)&&t.usd>=0){let s=n.telemetry.costHistory??[],a=o-Q,d=s.filter(c=>c.ts>=a);d.push({ts:o,usd:t.usd}),n.telemetry.costHistory=d}n.updatedAt=o})}function Se(e,t=Date.now()){let r=t-6048e5,n=e.telemetry.costHistory??[],o=0;for(let s of n)s.ts>=r&&(o+=s.usd);return o}function we(e){w(t=>{t.attachedProjects=t.attachedProjects.filter(r=>r.id!==e),t.agentSessions=t.agentSessions.filter(r=>r.projectId!==e),t.previewAttachments=t.previewAttachments.filter(r=>r.projectId!==e)})}function M(e){let t;return w(r=>{if(e.id){let a=r.agentSessions.find(d=>d.id===e.id);if(a){let d={...a,...e,lastSeenAt:Date.now()},c=r.agentSessions.indexOf(a);r.agentSessions[c]=d,t=d;return}}let n=r.attachedProjects.find(a=>a.id===e.projectId);if(!n)throw new Error(`upsertSession: no AttachedProject with id=${e.projectId}`);let o=Date.now(),s={id:e.id??K(),projectId:e.projectId,provider:e.provider,transport:e.transport??n.preferredTransport,cwd:e.cwd??n.cwd,claudeSessionUuid:e.claudeSessionUuid,tmuxSessionName:e.tmuxSessionName,wrapperPid:e.wrapperPid,status:e.status??"idle",needsAttention:e.needsAttention??!1,lastPrompt:e.lastPrompt,lastSummary:e.lastSummary,lastTurnFiles:e.lastTurnFiles,currentlyEditing:e.currentlyEditing,lastSeenAt:o,createdAt:o};r.agentSessions.push(s),t=s}),t}function k(e){return S().agentSessions.find(t=>t.id===e)??null}function C(e){let t=S().agentSessions;return e?t.filter(r=>r.projectId===e):t}function v(e,t){w(r=>{let n=r.agentSessions.find(s=>s.id===e);if(!n)return;let o=r.agentSessions.indexOf(n);r.agentSessions[o]={...n,...t,id:n.id,projectId:n.projectId,createdAt:n.createdAt,lastSeenAt:Date.now()}})}async function ve(){if(S().attachedProjects.length>0)return;let{loadOptionalDemoApps:t}=await import("./optional-demo-registry-KV3FG6HR.js"),r=await t();r.length!==0&&w(n=>{for(let o of r){if(!m.existsSync(o.dir))continue;let s=h.resolve(o.dir),a=B(s);if(n.attachedProjects.some(c=>c.id===a))continue;let d=Date.now();n.attachedProjects.push({id:a,name:o.label,cwd:s,sourceRoots:[s],framework:o.framework,knownBundleUrls:[`http://localhost:${o.preferredPort}/index.bundle`],preferredProvider:"codex",preferredTransport:"tmux",pinnedSourceResolutions:{},telemetry:{lastOpened:0,runsCompleted:0},createdAt:d,updatedAt:d})}})}import{spawn as V,spawnSync as z}from"node:child_process";import{randomUUID as Z}from"node:crypto";import i,{constants as f}from"node:fs";import u from"node:path";import ee from"node:readline";function j(e){return u.join(y(),"sessions",e)}function W(e){return u.join(j(e),"prompt.in")}function J(e){return u.join(j(e),"events.out")}function te(e){return u.join(y(),"transcripts",`${e}.log`)}function O(e,t){if(!e)return!1;try{process.kill(e,0)}catch{return!1}return!(t&&!i.existsSync(j(t)))}function re(){if(process.env.SOOTSIM_BIN)return{cmd:process.env.SOOTSIM_BIN,prefixArgs:[]};if(process.versions.electron){let n=process.resourcesPath;if(n){let o=[u.join(n,"bin","sootsim"),u.join(n,"bin",`sootsim-${process.platform}-${process.arch}`)];for(let s of o)if(i.existsSync(s))return{cmd:s,prefixArgs:[]}}}let e=ne();if(e)return e;let t=process.argv[0],r=process.argv[1];if(r&&/\.(ts|tsx|mjs|cjs|js)$/.test(r))return{cmd:t,prefixArgs:[r]};if(!r||r.includes("/.bin/"))throw new Error("sootsim CLI not found. set SOOTSIM_BIN to the path of the sootsim binary, or build the workspace CLI via `bun run --cwd packages/sootsim build:cli`.");return{cmd:t,prefixArgs:[]}}function ne(){try{let e=se();if(!e)return null;let t=`sootsim-${process.platform}-${process.arch}`,r=u.join(e,"dist-bin",t);if(i.existsSync(r))return{cmd:r,prefixArgs:[]};let n=u.join(e,"dist-cli","bin.js");if(i.existsSync(n)){try{let o=u.join(e,"cli","commands","agent-wrapper.ts");if(i.existsSync(o)){let s=i.statSync(o).mtimeMs;i.statSync(n).mtimeMs<s&&console.warn("[sootsim] dist-cli/bin.js is older than agent-wrapper.ts \u2014 rebuild with `bun run --cwd packages/sootsim build:cli` (watch:cli:binary builds dist-bin/ instead).")}}catch{}return{cmd:process.execPath,prefixArgs:[n]}}return null}catch{return null}}function se(){try{let r=T.resolve("sootsim/package.json");return u.dirname(r)}catch{}let e=oe();if(!e)return null;let t=u.dirname(e);for(let r=0;r<8;r++){let n=u.join(t,"package.json");try{if(i.existsSync(n)&&JSON.parse(i.readFileSync(n,"utf8")).name==="sootsim")return t}catch{}let o=u.dirname(t);if(o===t)break;t=o}return null}function oe(){try{let e=import.meta.url;return!e||!e.startsWith("file://")?null:decodeURIComponent(e.slice(7))}catch{return null}}async function ie(e,t,r){let n=u.join(y(),"locks");i.mkdirSync(n,{recursive:!0});try{i.chmodSync(n,448)}catch{}let o=u.join(n,`start-${e}-${t}.lock`),s=Date.now()+4e3,a=null;for(;a===null;)try{a=i.openSync(o,f.O_WRONLY|f.O_CREAT|f.O_EXCL,384)}catch(d){if(d.code!=="EEXIST")throw d;try{let c=Number(i.readFileSync(o,"utf8").trim());if(c&&!ce(c)){i.unlinkSync(o);continue}}catch{}if(Date.now()>s)throw new Error(`another start is in progress for project=${e} provider=${t} (lock: ${o})`);await new Promise(c=>setTimeout(c,50))}try{return i.writeFileSync(a,String(process.pid)),await r()}finally{try{i.closeSync(a)}catch{}try{i.unlinkSync(o)}catch{}}}function ce(e){try{return process.kill(e,0),!0}catch{return!1}}function L(e){let t=u.dirname(e);i.mkdirSync(t,{recursive:!0});try{i.chmodSync(t,448)}catch{}if(i.existsSync(e))try{if(i.statSync(e).isFIFO()){try{i.chmodSync(e,384)}catch{}return}i.unlinkSync(e)}catch{i.unlinkSync(e)}let r=z("mkfifo",["-m","600",e]);if(r.status!==0)throw new Error(`mkfifo(${e}) failed: ${r.stderr?.toString().trim()||"unknown error"}`)}var l=class extends Error{code;constructor(t,r){super(r),this.code=t}};async function Te(e){let t=F(e.projectId);if(!t)throw new l("NO_PROJECT",`no project with id=${e.projectId}`);let r=e.provider||t.preferredProvider||"codex";return ie(t.id,r,async()=>{let n=C(t.id).find(p=>p.provider===r&&p.status!=="ended"&&O(p.wrapperPid,p.id));if(n)throw new l("ALREADY_RUNNING",`session already running for project=${t.id} provider=${r} (session ${n.id}, pid ${n.wrapperPid}). end it first with \`sootsim agent end <sessionId>\`.`);let o=r==="claude"?Z():void 0,s=M({projectId:t.id,provider:r,transport:"pty",cwd:t.cwd,status:"idle",claudeSessionUuid:o}),a=W(s.id),d=J(s.id),c=te(s.id);L(a),L(d);let g=u.dirname(c);i.mkdirSync(g,{recursive:!0});try{i.chmodSync(g,448)}catch{}let{cmd:A,prefixArgs:H}=re(),x=[...H,"agent-wrapper","--session-id",s.id,"--project-id",t.id,"--provider",r,"--cwd",t.cwd,"--prompt-in",a,"--events-out",d,"--transcript",c];e.codexBin&&x.push("--codex-bin",e.codexBin),e.claudeBin&&x.push("--claude-bin",e.claudeBin),e.freshThread&&x.push("--fresh-thread"),o&&x.push("--claude-session-uuid",o);let P=V(A,x,{detached:!0,stdio:"ignore",env:{...process.env,SOOTSIM_USER_DATA_DIR:y()}});P.unref();let E=e.readyTimeoutMs??6e3,b=await ae(d,p=>p.type==="ready"||p.type==="error",E);if(!b||b.type==="error"){if(P.pid)try{process.kill(P.pid,"SIGTERM")}catch{}try{i.rmSync(j(s.id),{recursive:!0,force:!0})}catch{}v(s.id,{status:"ended"});let p=b&&b.type==="error"?b.message:`no ready event within ${E}ms`;throw new l("WRAPPER_FAILED",p)}return v(s.id,{wrapperPid:P.pid,status:"idle"}),{session:k(s.id),wrapperPid:P.pid}})}async function De(e,t){let r=k(e);if(!r)throw new l("NO_SESSION",`no session with id=${e}`);if(!O(r.wrapperPid,e))throw v(e,{status:"ended"}),new l("NOT_ALIVE",`session wrapper is not alive (pid=${r.wrapperPid}). start a new session.`);let n=W(e);if(!i.existsSync(n))throw new l("NO_FIFO",`prompt FIFO missing: ${n}`);let o=i.openSync(n,f.O_WRONLY);try{let s=R(t);if(!s)throw new l("EMPTY_PROMPT","prompt text is empty");i.writeSync(o,s+`
|
|
3
3
|
`)}finally{i.closeSync(o)}v(e,{lastPrompt:t.displayText??t.text,status:"working"})}async function Re(e){let t=k(e);if(!t)throw new l("NO_SESSION",`no session with id=${e}`);if(O(t.wrapperPid,e))try{process.kill(t.wrapperPid,"SIGTERM")}catch{}let r=j(e),n=y();if(r.startsWith(n))try{i.rmSync(r,{recursive:!0,force:!0})}catch{}v(e,{status:"ended",wrapperPid:void 0})}function Ne(e,t){let r=J(e);if(!i.existsSync(r))throw new l("NO_FIFO",`events FIFO missing: ${r}`);let n=i.openSync(r,f.O_RDWR),o=i.createReadStream("",{fd:n,autoClose:!0}),s=ee.createInterface({input:o,crlfDelay:1/0});s.on("line",d=>{let c=I(d);c&&t(c)});let a=!1;return()=>{if(!a){a=!0;try{s.close()}catch{}try{o.destroy()}catch{}}}}async function ae(e,t,r){let n=i.openSync(e,f.O_RDWR|f.O_NONBLOCK),o=Buffer.alloc(8192),s="",a=Date.now()+r;try{for(;Date.now()<a;){let d=0;try{d=i.readSync(n,o,0,o.length,null)}catch(c){if(c.code!=="EAGAIN")throw c;d=0}if(d>0){s+=o.subarray(0,d).toString("utf8");let c;for(;(c=s.indexOf(`
|
|
4
4
|
`))>=0;){let g=s.slice(0,c);s=s.slice(c+1);let A=I(g);if(A&&t(A))return A}}else await new Promise(c=>setTimeout(c,30))}return null}finally{i.closeSync(n)}}export{I as a,y as b,ge as c,F as d,he as e,ye as f,Se as g,we as h,k as i,C as j,v as k,ve as l,j as m,W as n,J as o,te as p,O as q,re as r,l as s,Te as t,De as u,Re as v,Ne as w};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{c as b}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{c as b}from"./chunk-7ST3HVVO.js";import{b as F,e as T,g as A}from"./chunk-54U7A36G.js";import{M as w,N as S,O as I,P as B}from"./chunk-5JX4BCGL.js";import{WebSocket as W}from"ws";var P=null;function O(){return P||(P=M(),P)}function M(){let i=S();if(i&&B(i))return{source:"dev-bridge",bridgePort:i.bridgePort,shellBaseUrl:i.shellPort?`http://localhost:${i.shellPort}/`:b};let r=w();return r&&I(r)?{source:"daemon",bridgePort:r.bridgePort,shellBaseUrl:r.runtimePort>0?`http://localhost:${r.runtimePort}/`:b}:{source:"default",bridgePort:7668,shellBaseUrl:b}}function U(i){let r=S();if(r&&B(r)&&r.bridgePort===i)return{source:"dev-bridge",shellBaseUrl:r.shellPort?`http://localhost:${r.shellPort}/`:b};let e=w();return e&&I(e)&&e.bridgePort===i?{source:"daemon",shellBaseUrl:e.runtimePort>0?`http://localhost:${e.runtimePort}/`:b}:null}function G(i){let r;try{let l=new URL(i);r=l.port?Number(l.port):l.protocol==="https:"?443:80}catch{return null}if(!Number.isFinite(r)||r<=0)return null;let e=S();if(e&&B(e)&&(e.shellPort===r||e.runtimePort===r||e.bridgePort===r))return e.bridgePort;let d=w();return d&&I(d)&&(d.runtimePort===r||d.bridgePort===r)?d.bridgePort:null}function _(){return O().bridgePort}function K(i,r){let e=U(i),d=e?.source==="dev-bridge"?"dev bridge":e?.source==="daemon"?"daemon bridge":"bridge",l=e?`${e.source}.json`:"no lockfile",t=r??e?.shellBaseUrl;process.stderr.write(` \u2192 ${d} :${i} (${t?`shell ${t}, `:""}${l})
|
|
3
3
|
`)}var $=class extends Error{lock;constructor(r,e){super(r),this.name="BridgeSimLockedError",this.lock=e}};function N(i){return i==="flag"?"via --sim":i==="saved"?"saved via `sootsim use`":"primary fallback \u2014 no sim pinned"}function Q(i,r={}){let e=new Set,d=r.port??_(),l=r.commandTimeoutMs??15e3,t,u="none",v=new Set(r.stripBooleanFlags??[]),p=new Set(r.stripValueFlags??[]);for(let n=0;n<i.length;n++){let a=i[n];if(a==="--port"||a==="-p"){e.add(n),n+1<i.length&&(e.add(n+1),d=Number(i[n+1])),n++;continue}if(a.startsWith("--port=")){e.add(n),d=Number(a.slice(7));continue}if(a==="--timeout"){e.add(n),n+1<i.length&&(e.add(n+1),l=Number(i[n+1])),n++;continue}if(a==="--sim"||a==="--session"||a==="--tab"){e.add(n),n+1<i.length&&(e.add(n+1),t=i[n+1]?.trim()||void 0,u="flag"),n++;continue}let s=a.startsWith("--sim=")?a.slice(6):a.startsWith("--session=")?a.slice(10):a.startsWith("--tab=")?a.slice(6):void 0;if(s!==void 0){e.add(n),t=s.trim()||void 0,u="flag";continue}if(v.has(a)){e.add(n);continue}p.has(a)&&(e.add(n),n+1<i.length&&e.add(n+1),n++)}if(!t){let n=T();n&&(t=n.trim()||void 0,u="saved")}return{positional:i.filter((n,a)=>!e.has(a)),wsPort:d,simId:t,simIdSource:u,commandTimeoutMs:l}}function R(i,r={}){let e=1,d=r.commandTimeoutMs??15e3,l=new Map,t=new W(`ws://localhost:${i}`),u=F(),v=new Promise((s,o)=>{t.on("open",()=>{try{t.send(JSON.stringify({type:"bridge:hello",id:0,cliIdentityKey:u.key,cliIdentitySource:u.source,cliLabel:r.cliLabel}))}catch{}s()}),t.on("error",c=>{let m=c.message?`: ${c.message}`:"";o(new Error(`could not connect to ws://localhost:${i}${m}`))})}),p=!1,n=!1;function a(s,o){if(n||process.env.SOOTSIM_QUIET_TARGET_NOTICE==="1"||s.startsWith("bridge:")||s==="focus"||s==="close")return;n=!0;let c=o??"primary",m=N(o?r.simIdSource:"none");process.stderr.write(` \u2192 ${c} (${m})
|
|
4
4
|
`)}return t.on("message",s=>{let o;try{o=JSON.parse(s.toString())}catch{return}if(o.id===0)return;let c=l.get(o.id);c&&(l.delete(o.id),o._otherCliCount>0&&!p&&(p=!0,process.stderr.write(`
|
|
5
5
|
\u26A0 ${o._otherCliCount} other CLI identity/identities are driving this sim
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{G as R,H as d,I as x,K as w,l as g,u as $,x as b}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{G as R,H as d,I as x,K as w,l as g,u as $,x as b}from"./chunk-5JX4BCGL.js";import{spawn as E}from"child_process";import k from"crypto";import o from"fs";import u from"path";import{Readable as C}from"stream";import{pipeline as T}from"stream/promises";var _="https://contrast.dev",U="SOOTSIM_CDN_ORIGIN",D="SOOTSIM_RUNTIME_CHANNEL",P="SOOTSIM_RUNTIME_VERSION",X="https://sootsim.com/changelog";function y(){try{let t=JSON.parse(o.readFileSync(b(),"utf8"));return t&&typeof t=="object"?t:{}}catch{return{}}}function f(t){let n=y();return(t||process.env[U]||n.cdnOrigin||_).replace(/\/+$/,"")}function S(t){let n=y();return t||process.env[D]||n.runtimeChannel||"stable"}function O(){let t=process.env[P];if(t&&t.trim())return t.trim();let n=y();return typeof n.runtimeVersion=="string"&&n.runtimeVersion.trim()?n.runtimeVersion.trim():null}function A(t){let n=new URL(`${f(t)}/runtimes/manifest.json`);return n.searchParams.set("t",String(Date.now())),n.toString()}function j(t,n){return`${f(n)}/runtimes/sootsim-runtime-${t}.tar.gz`}async function I(t){let n=A(t),r=await fetch(n,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`manifest fetch failed: ${r.status} ${r.statusText} (${n})`);return await r.json()}function L(t,n={}){let r=S(n.channel),e=n.version||O()||t.channels[r]?.latest;if(!e)throw new Error(`no version specified and channel '${r}' has no latest entry in the manifest`);let s=t.versions[e];if(!s)throw new Error(`version ${e} not found in manifest; available: ${Object.keys(t.versions).slice(-10).join(", ")||"(none)"}`);return{version:e,channel:r,entry:s}}async function N(t={}){R();let n=f(t.cdnOrigin),r=await I(n),{version:e,channel:s,entry:i}=L(r,t),c=g(e),a=t.setActive!==!1;if(!t.force&&o.existsSync(u.join(c,"index.html")))return a&&x(e),{version:e,channel:s,cdnOrigin:n,runtimeDir:c,installed:!1,activated:a,manifest:r};let h=i.tarball||j(e,n),m=u.join($(),`sootsim-runtime-${e}.tar.gz`);process.stderr.write(`sootsim: downloading runtime ${e}\u2026
|
|
3
3
|
`),await F(h,m),process.stderr.write(`sootsim: extracting runtime ${e}\u2026
|
|
4
4
|
`);let v=await G(m);if(v!==i.sha256)throw o.rmSync(m,{force:!0}),new Error(`sha256 mismatch for runtime ${e}: expected ${i.sha256}, actual ${v}`);let l=u.join(u.dirname(c),`.installing-${e}-${process.pid}`);o.rmSync(l,{recursive:!0,force:!0}),o.mkdirSync(l,{recursive:!0});try{if(await H(m,l),!o.existsSync(u.join(l,"index.html")))throw new Error(`extracted tarball for runtime ${e} is missing index.html`);o.rmSync(c,{recursive:!0,force:!0}),o.renameSync(l,c)}catch(p){throw o.rmSync(l,{recursive:!0,force:!0}),p}return a&&x(e),{version:e,channel:s,cdnOrigin:n,runtimeDir:c,installed:!0,activated:a,manifest:r}}async function Y(t={}){R();let n=f(t.cdnOrigin),r=S(t.channel),e=O();if(e){let p=d(),V=o.existsSync(u.join(g(e),"index.html"));if(p===e&&V)return{checked:!0,updated:!1,reason:`runtime is pinned to ${e}`,activeVersion:p,latestVersion:e};let M=await N({version:e,channel:r,cdnOrigin:n,setActive:!1});return{checked:!0,updated:!0,reason:`runtime is pinned to ${e}`,activeVersion:e,latestVersion:e,install:M}}let s=await I(n),i=s.channels[r]?.latest;if(!i)return{checked:!0,updated:!1,reason:`channel '${r}' has no latest runtime`,activeVersion:d()};if(!s.versions[i])return{checked:!0,updated:!1,reason:`manifest is missing version ${i}`,activeVersion:d(),latestVersion:i};let a=d(),h=a?g(a):null,m=h?o.existsSync(u.join(h,"index.html")):!1;if(!(!a||!m||w(i,a)>0))return{checked:!0,updated:!1,reason:"active runtime is current",activeVersion:a,latestVersion:i};let l=await N({version:i,channel:r,cdnOrigin:n,setActive:!1});return{checked:!0,updated:!0,activeVersion:i,latestVersion:i,install:l}}async function Z(t={}){let n=d(),r=O();if(r)return{active:n,latest:r,pinned:r,outdated:n!==r};try{let e=await I(f(t.cdnOrigin)),s=S(t.channel),i=e.channels[s]?.latest??null,c=!!(i&&(!n||w(i,n)>0));return{active:n,latest:i,pinned:null,outdated:c}}catch{return{active:n,latest:null,pinned:null,outdated:!1}}}async function F(t,n){let r=await fetch(t);if(!r.ok||!r.body)throw new Error(`download failed: ${r.status} ${r.statusText} (${t})`);o.mkdirSync(u.dirname(n),{recursive:!0});let e=`${n}.partial`;try{await T(C.fromWeb(r.body),o.createWriteStream(e)),o.renameSync(e,n)}catch(s){try{o.unlinkSync(e)}catch{}throw s}}function G(t){return new Promise((n,r)=>{let e=k.createHash("sha256"),s=o.createReadStream(t);s.on("data",i=>e.update(i)),s.on("error",r),s.on("end",()=>n(e.digest("hex")))})}function H(t,n){return new Promise((r,e)=>{let s=E("tar",["-xzf",t,"-C",n],{stdio:["ignore","inherit","inherit"]});s.on("error",e),s.on("exit",i=>{i===0?r():e(new Error(`tar exited with code ${i}`))})})}export{_ as a,X as b,f as c,S as d,O as e,I as f,N as g,Y as h,Z as i};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! sootsim v0.1.
|
|
2
|
-
import{a as ot}from"./chunk-
|
|
1
|
+
/*! sootsim v0.1.234 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
|
+
import{a as ot}from"./chunk-FSSTNYFL.js";import{a as nt}from"./chunk-PSDDQWFO.js";import{a as ge,c as we,d as be,e as et,f as ye,g as Se,h as tt,i as ve,j as it}from"./chunk-57FLKZOS.js";import{a as Qe}from"./chunk-DFAMEHIJ.js";import{e as rt}from"./chunk-DVPVSP7S.js";import{h as qe,p as Ye,r as Ze,v as Xe}from"./chunk-IB6NUH34.js";import{f as We}from"./chunk-AASXS3LK.js";import{a as Ke}from"./chunk-MS33P5CV.js";import{a as He}from"./chunk-VWAOND2T.js";import{h as me,m as ze}from"./chunk-YV35LVCO.js";import{I as J,m as Ue,n as je,o as Ve,p as Je}from"./chunk-6NUCPZGB.js";import{g as he,h as fe,i as Ge}from"./chunk-JXPGKN3F.js";import{a as Be,b as ue}from"./chunk-KIYNMK6P.js";import{e as pe,f as Ne}from"./chunk-54U7A36G.js";import{g as Le,h as Ce}from"./chunk-DAWIWEWR.js";import*as $ from"fs";import{createHash as Gt,randomUUID as zt}from"node:crypto";import{tmpdir as q}from"os";import*as w from"path";import*as v from"fs";import*as S from"path";var $t="inset 0 0 0 0.5px #000, inset 0 0 0 2px #757575, inset 0 0 0 5px #212121",at=1;function Pt(r){let e=Ce(r),t=e.scale,i=e.statusBarHeight>0&&!e.dynamicIsland&&e.homeIndicatorHeight===0&&e.cornerRadius===0,n=e.width,o=e.height,a=i?e.width+58:e.width+e.bezelWidth*2,s=i?e.height+111+111:e.height+e.bezelWidth*2,l=9.5,p=at,u=a+l*2,m=s+at*2,b=l+(i?29:e.bezelWidth),g=i?111:e.bezelWidth,P=i?52:e.cornerRadius+e.bezelWidth,k=[{side:"right",top:e.hardwareButtons.lock.top,height:e.hardwareButtons.lock.height,width:e.hardwareButtons.width},{side:"left",top:e.hardwareButtons.ringToggle.top,height:e.hardwareButtons.ringToggle.height,width:e.hardwareButtons.width},{side:"left",top:e.hardwareButtons.volumeUp.top,height:e.hardwareButtons.volumeUp.height,width:e.hardwareButtons.width},{side:"left",top:e.hardwareButtons.volumeDown.top,height:e.hardwareButtons.volumeDown.height,width:e.hardwareButtons.width}];return{model:r,renderScale:t,outerWidth:Math.round(u*t),outerHeight:Math.round(m*t),logicalOuterWidth:u,logicalOuterHeight:m,logicalFrameWidth:a,logicalFrameHeight:s,logicalFrameLeft:l,logicalFrameTop:p,logicalScreenWidth:n,logicalScreenHeight:o,logicalScreenLeft:b,logicalScreenTop:g,logicalScreenRadius:i?0:e.cornerRadius,logicalFrameRadius:P,frameBackground:i?"linear-gradient(180deg, #1b1c20 0%, #0f1012 42%, #050608 100%)":"#000000",frameOutline:i?"0 0 0 1px #1f2125":"0 0 0 1px #333",metallicRingShadow:i?null:$t,buttons:k,legacyHomeButton:i?{top:111+e.height+47/2,left:e.width/2-64/2+29,size:64,ring:1.5}:null,showHomeIndicator:e.homeIndicatorHeight>0,logicalHomeIndicatorStripHeight:e.homeIndicatorHeight}}function kt(r){let e=r.side==="right",t=e?"inset(-3px -3px -3px 0)":"inset(-3px 0 -3px -3px)";return`
|
|
3
3
|
<div
|
|
4
4
|
aria-hidden="true"
|
|
5
5
|
style="
|
|
@@ -559,7 +559,7 @@ flow extension:
|
|
|
559
559
|
})()`}),console.log(` captured ${_.length} partial replay events`)}catch(c){console.warn(` event recorder stop failed: ${c?.message||String(c)}`)}console.error(`
|
|
560
560
|
x failed: ${h.message}
|
|
561
561
|
`),O&&(console.log(" partial profile:"),pt(O)),I&&console.log(` partial video: ${I}`);try{let c=d.lastFailedStep,y=c?`step-${String(c.index+1).padStart(2,"0")}-${c.kind}`:"unstaged",F=w.join(s,y);await d.captureFailureBundle(F,{error:h,stepIndex:c?.index,stepKind:c?.kind,stepTarget:c?.target}),de=F,console.log(` failure bundle: ${F}`),console.log(" (contents: screenshot.png, describe.json, a11y.txt, tree.txt, console.json, error.json)")}catch(c){try{let y=w.join(s,"error.png");await d.captureScreenshot(y),console.log(` error screenshot: ${y}`)}catch{}console.log(` (failure bundle capture failed: ${c instanceof Error?c.message:String(c)})`)}await ze(E,{errorsCommand:`sootsim get errors 5${d.simId?` --sim ${d.simId}`:""}`,warningsCommand:`sootsim get warnings 5${d.simId?` --sim ${d.simId}`:""}`,requestsCommand:`sootsim get requests 5${d.simId?` --sim ${d.simId}`:""}`}),j=1}if(await d.liveStatus?.end(j===0?"passed":"failed"),g&&(j===0||I||_))try{let h=await Zt(_??[]),c=["--origin",P,"--events",h];k&&c.push("--public-origin",k),I&&c.push("--video",I),U&&c.push("--screenshot",U),I&&L&&Number.isFinite(L)&&(c.push("--video-duration-ms",String(Math.round(L))),c.push("--recorded-duration-ms",String(Math.round(L))));let y=d.getLastRecordingStartedAtMs();y&&Number.isFinite(y)&&c.push("--recording-started-at-ms",String(Math.round(y))),x.wsPort&&c.push("--port",String(x.wsPort)),d.simId&&c.push("--sim",d.simId),oe&&c.push("--open"),Pe&&c.push("--owner",Pe),ke&&c.push("--repo",ke),c.push("--run-scope",ft),H&&c.push("--billing-kind",H),console.log(`
|
|
562
|
-
preparing preview upload\u2026`);let F=d.getFlowTraceSteps();F.length>0&&c.push("--timeline-events",await Xt(F));let V=await Qt(F,y);V&&c.push("--snapshot-manifest",V),de&&c.push("--failure-bundle",de);let D=d.getLastRecordingFrameStats();D&&c.push("--trace-frame-stats",await ei(D));let{runUpload:Tt}=await import("./upload-
|
|
562
|
+
preparing preview upload\u2026`);let F=d.getFlowTraceSteps();F.length>0&&c.push("--timeline-events",await Xt(F));let V=await Qt(F,y);V&&c.push("--snapshot-manifest",V),de&&c.push("--failure-bundle",de);let D=d.getLastRecordingFrameStats();D&&c.push("--trace-frame-stats",await ei(D));let{runUpload:Tt}=await import("./upload-REVW5JI2.js");Fe=await Tt(c,{})}catch(h){console.error(` preview upload failed: ${h?.message||h}`),j=1}return $e=d.getFlowTraceSteps(),E.close(),le?(d.simId&&ce.add(d.simId),await Yt(x.wsPort,x.commandTimeoutMs,[...ce])):d.simId&&d.simId!==Z&&Ne(d.simId),await ue(),j}async function Yt(r,e,t){let i=[...new Set(t.filter(Boolean))];if(i.length===0)return;let n=fe(r,{commandTimeoutMs:e});try{let o=await n.listSims(),a=i.filter(l=>o.some(p=>p.id===l&&p.readyState==="open"));if(a.length===0)return;let s=await Xe(n,r,e,a);await Ye(o,a),s.closed.length>0&&console.log(` closed flow sim(s): ${s.closed.join(", ")}`),s.remaining.length>0&&console.warn(` warn: flow sim(s) still connected after close: ${s.remaining.join(", ")}`)}catch(o){console.warn(` warn: failed to close flow sim(s): ${o instanceof Error?o.message:String(o)}`)}finally{n.close()}}async function Zt(r){let{gzipSync:e}=await import("zlib"),t=r.map(o=>JSON.stringify(o)).join(`
|
|
563
563
|
`)+(r.length?`
|
|
564
564
|
`:""),i=e(Buffer.from(t,"utf8")),n=w.join(q(),`sootsim-events-${Date.now()}.jsonl.gz`);return $.writeFileSync(n,i),console.log(` events: ${r.length} written to ${n} (${i.length} bytes gz)`),n}async function Xt(r){let{gzipSync:e}=await import("zlib"),t=r.map((a,s)=>({schemaVersion:1,t:a.endedAtMs,seq:1e6+s,context:"host",kind:"flow-step",id:`flow-step-${a.stepIndex}`,data:{stepIndex:a.stepIndex,stepNumber:a.stepIndex+1,stepName:a.stepName,...a.targetLabel?{targetLabel:a.targetLabel}:{},status:a.status,durationMs:a.durationMs,startedAtMs:a.startedAtMs,endedAtMs:a.endedAtMs,...a.error?{error:a.error}:{}}})),i=t.map(a=>JSON.stringify(a)).join(`
|
|
565
565
|
`)+`
|