sootsim 0.1.82 → 0.1.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +0 -1
  2. package/detox/colors.ts +54 -0
  3. package/detox/config-loader.ts +135 -0
  4. package/detox/expectations.ts +477 -0
  5. package/detox/gestures.ts +442 -0
  6. package/detox/index.ts +1436 -0
  7. package/detox/jest-environment.ts +86 -0
  8. package/detox/jest-preset.cjs +50 -0
  9. package/detox/matchers.ts +29 -0
  10. package/detox/navigation.ts +43 -0
  11. package/detox/run-test.ts +113 -0
  12. package/detox/screenshots/animated-color-test-rest-norngh.png +0 -0
  13. package/detox/screenshots/color-test-after-drag-norngh.png +0 -0
  14. package/detox/screenshots/color-test-rest-norngh.png +0 -0
  15. package/detox/screenshots/theme-blue-toggle.png +0 -0
  16. package/detox/screenshots/theme-blue.png +0 -0
  17. package/detox/screenshots/theme-red-toggle.png +0 -0
  18. package/detox/screenshots/theme-red.png +0 -0
  19. package/dist-cli/bin.js +3 -3
  20. package/dist-cli/chunks/{agent-3C6Z6YXA.js → agent-2CWD6W6P.js} +2 -2
  21. package/dist-cli/chunks/{agent-wrapper-7Z4UFACX.js → agent-wrapper-5W3LOX6S.js} +2 -2
  22. package/dist-cli/chunks/{assert-XYBIZRDK.js → assert-ZOMAMKRT.js} +2 -2
  23. package/dist-cli/chunks/auto-bootstrap-NYYSMTIM.js +2 -0
  24. package/dist-cli/chunks/beta-4K2SQACK.js +2 -0
  25. package/dist-cli/chunks/chunk-3HXQ7MJK.js +79 -0
  26. package/dist-cli/chunks/{chunk-EJGEDUOC.js → chunk-4K7BH2D4.js} +3 -3
  27. package/dist-cli/chunks/{chunk-2EFQQWEC.js → chunk-4OPRODFA.js} +2 -2
  28. package/dist-cli/chunks/{chunk-Z6G5SDG7.js → chunk-4OWVPRZV.js} +2 -2
  29. package/dist-cli/chunks/{chunk-DCFGNIJC.js → chunk-5XCXOLG2.js} +2 -2
  30. package/dist-cli/chunks/chunk-67ZZ2CM5.js +1 -0
  31. package/dist-cli/chunks/{chunk-M3OULYY3.js → chunk-73UZXB4B.js} +2 -2
  32. package/dist-cli/chunks/{chunk-QPDWMYCA.js → chunk-7NWNTUJF.js} +1 -1
  33. package/dist-cli/chunks/chunk-7YHDJLO2.js +119 -0
  34. package/dist-cli/chunks/{chunk-EX6IOT23.js → chunk-AJVTY6KY.js} +2 -2
  35. package/dist-cli/chunks/chunk-AWSQUOAS.js +67 -0
  36. package/dist-cli/chunks/{chunk-JVNGH5S7.js → chunk-BCBNVJVG.js} +1 -1
  37. package/dist-cli/chunks/{chunk-WZLKUS54.js → chunk-BKBL6K2G.js} +1 -1
  38. package/dist-cli/chunks/{chunk-DSYW2NOW.js → chunk-C3DPQZ4J.js} +2 -2
  39. package/dist-cli/chunks/chunk-D3ZSBIIY.js +2 -0
  40. package/dist-cli/chunks/{chunk-PYDAVGCZ.js → chunk-D4HUVLZR.js} +1 -1
  41. package/dist-cli/chunks/{chunk-H6NBDJIO.js → chunk-DUUSJDES.js} +1 -1
  42. package/dist-cli/chunks/{chunk-BVXP2GDN.js → chunk-ELJLF4SG.js} +3 -3
  43. package/dist-cli/chunks/{chunk-TR7NIFSL.js → chunk-EQ7TFQ2F.js} +1 -1
  44. package/dist-cli/chunks/{chunk-UOWBKSSI.js → chunk-EQCKGC4B.js} +1 -1
  45. package/dist-cli/chunks/chunk-FUCGLWNN.js +1 -0
  46. package/dist-cli/chunks/{chunk-BISEHRNE.js → chunk-HYPJW65U.js} +2 -2
  47. package/dist-cli/chunks/chunk-IILJQCZA.js +2 -0
  48. package/dist-cli/chunks/{chunk-2XULSYS6.js → chunk-KU6MSPAH.js} +2 -2
  49. package/dist-cli/chunks/{chunk-QTJJHBCI.js → chunk-OOOR7NT2.js} +1 -1
  50. package/dist-cli/chunks/{chunk-U3XCDQRH.js → chunk-P7WDNKOS.js} +3 -3
  51. package/dist-cli/chunks/{chunk-C7JOLDDQ.js → chunk-PPKKA5VW.js} +2 -2
  52. package/dist-cli/chunks/{chunk-JUCV3VHM.js → chunk-PS2G44GT.js} +2 -2
  53. package/dist-cli/chunks/{chunk-PO64TMRT.js → chunk-QMSJR5R2.js} +2 -2
  54. package/dist-cli/chunks/{chunk-4QUAOBUB.js → chunk-RF4R2U46.js} +2 -2
  55. package/dist-cli/chunks/{chunk-D3SM2JYB.js → chunk-RIXUH3NK.js} +2 -2
  56. package/dist-cli/chunks/{chunk-2JQIKL3B.js → chunk-SFGUPL2X.js} +2 -2
  57. package/dist-cli/chunks/{chunk-GI5MF6LP.js → chunk-SQX5CAYG.js} +1 -1
  58. package/dist-cli/chunks/{chunk-Q4JNA5VO.js → chunk-SQZAC7C4.js} +1 -1
  59. package/dist-cli/chunks/{chunk-M4ERVRM4.js → chunk-SV7FOGJ3.js} +2 -2
  60. package/dist-cli/chunks/{chunk-ZN2C7V5R.js → chunk-TK3OJSEO.js} +2 -2
  61. package/dist-cli/chunks/{chunk-7SCQEPXK.js → chunk-TL7SIZ7S.js} +1 -1
  62. package/dist-cli/chunks/{chunk-IZ2OO47Y.js → chunk-V2GQ4WXJ.js} +2 -2
  63. package/dist-cli/chunks/{chunk-JUDJXJSE.js → chunk-VH7F45CN.js} +1 -1
  64. package/dist-cli/chunks/chunk-WNVNU2OW.js +4 -0
  65. package/dist-cli/chunks/{chunk-O3AOQP3V.js → chunk-XQ2OBHBE.js} +2 -2
  66. package/dist-cli/chunks/{chunk-MQXYJTXM.js → chunk-YCIA4BHJ.js} +2 -2
  67. package/dist-cli/chunks/chunk-ZSMMJMPA.js +1 -0
  68. package/dist-cli/chunks/cli-version-QB4VH24H.js +2 -0
  69. package/dist-cli/chunks/{compat-2DVSCCR7.js → compat-FWSEEGEH.js} +3 -3
  70. package/dist-cli/chunks/{config-YDX4Q4XM.js → config-CYI2WAGP.js} +2 -2
  71. package/dist-cli/chunks/control-UXY7YQVX.js +2 -0
  72. package/dist-cli/chunks/{cpu-profile-GU62WVZZ.js → cpu-profile-IKAE3KTY.js} +2 -2
  73. package/dist-cli/chunks/{daemon-V5NLDTSB.js → daemon-ZUMF53YB.js} +2 -2
  74. package/dist-cli/chunks/{debug-HAOCONNB.js → debug-P6KULKKS.js} +3 -3
  75. package/dist-cli/chunks/{detox-YLC4DLXB.js → detox-SPWAZCYG.js} +2 -2
  76. package/dist-cli/chunks/{device-ZQ4DN4H6.js → device-JWEPK6I2.js} +2 -2
  77. package/dist-cli/chunks/{diagnose-HNUO3Z5F.js → diagnose-IZODTXV2.js} +2 -2
  78. package/dist-cli/chunks/drivers-MK6WJKBC.js +2 -0
  79. package/dist-cli/chunks/{electron-ZAASAHSW.js → electron-R5GP6RVB.js} +3 -3
  80. package/dist-cli/chunks/flow-6O4GEOPJ.js +2 -0
  81. package/dist-cli/chunks/{hints-BA3GE5W5.js → hints-DYDNYX7N.js} +2 -2
  82. package/dist-cli/chunks/{home-paths-MQXRHBTW.js → home-paths-GLMX5OKL.js} +2 -2
  83. package/dist-cli/chunks/{inspect-T4RMS5KX.js → inspect-FJOPCTY2.js} +3 -3
  84. package/dist-cli/chunks/install-A3TUGGHN.js +2 -0
  85. package/dist-cli/chunks/{install-desktop-MH26VONS.js → install-desktop-YPJZMZM5.js} +3 -3
  86. package/dist-cli/chunks/{keys-IELIDRGB.js → keys-GSYPHWNY.js} +2 -2
  87. package/dist-cli/chunks/{launch-VMT3OWOB.js → launch-4G2PKW5X.js} +3 -3
  88. package/dist-cli/chunks/{login-VZBANVLU.js → login-KJQGHA64.js} +4 -4
  89. package/dist-cli/chunks/{logout-GWXBTQ4H.js → logout-XM2SYH5C.js} +2 -2
  90. package/dist-cli/chunks/{maestro-JYHR4HFR.js → maestro-EOWGI7DG.js} +2 -2
  91. package/dist-cli/chunks/{preview-RPZ4UQ2B.js → preview-F73TKK37.js} +2 -2
  92. package/dist-cli/chunks/{profile-7FLDF2AP.js → profile-22FDKBUO.js} +2 -2
  93. package/dist-cli/chunks/{react-3RC4CNDZ.js → react-5L6VPFUP.js} +2 -2
  94. package/dist-cli/chunks/record-JZXCQ4IN.js +70 -0
  95. package/dist-cli/chunks/runtime-EEBX7CFV.js +2 -0
  96. package/dist-cli/chunks/{runtime-delivery-Z7I2KIRB.js → runtime-delivery-LXUM3R4A.js} +2 -2
  97. package/dist-cli/chunks/{screenshot-GRCZ6AM4.js → screenshot-HDRRG33Q.js} +2 -2
  98. package/dist-cli/chunks/{screenshot-mode-E4YHXHH5.js → screenshot-mode-WY63LZIX.js} +2 -2
  99. package/dist-cli/chunks/{screenshots-7SXMX2AY.js → screenshots-MPV2ENL5.js} +2 -2
  100. package/dist-cli/chunks/{server-GDJ2TCRV.js → server-5LBMCJ3G.js} +2 -2
  101. package/dist-cli/chunks/setup-repo-SZSYNKNI.js +2 -0
  102. package/dist-cli/chunks/{skills-62E7NDRC.js → skills-BQ73YOBF.js} +2 -2
  103. package/dist-cli/chunks/{start-Y7KR5ZQ3.js → start-2WU4W6ZU.js} +4 -4
  104. package/dist-cli/chunks/store-RE45SUBF.js +2 -0
  105. package/dist-cli/chunks/telemetry-DG6GJLCP.js +2 -0
  106. package/dist-cli/chunks/{test-IYMSUPVC.js → test-OVO4CQTG.js} +3 -3
  107. package/dist-cli/chunks/{three-mode-QKKXCCC2.js → three-mode-BKM3KFM7.js} +2 -2
  108. package/dist-cli/chunks/{timeline-PF6NQ7RT.js → timeline-MDXGEDQL.js} +2 -2
  109. package/dist-cli/chunks/{upgrade-CE2Y3TAN.js → upgrade-JGQABWVF.js} +2 -2
  110. package/dist-cli/chunks/upload-UJNUA4ZV.js +2 -0
  111. package/dist-cli/chunks/{web-XEO3ZCPF.js → web-WYFAYQ72.js} +2 -2
  112. package/dist-cli/chunks/{what-happened-372J7YF7.js → what-happened-PZW2KW6A.js} +2 -2
  113. package/dist-cli/chunks/{whoami-B4E7KCT5.js → whoami-7ATWJQS6.js} +2 -2
  114. package/dist-lib/agent-daemon-client.cjs +1 -1
  115. package/dist-lib/agent-events.cjs +1 -1
  116. package/dist-lib/agent-sessions.cjs +1 -1
  117. package/dist-lib/attached-projects.cjs +1 -1
  118. package/dist-lib/auth/shared-session.cjs +1 -1
  119. package/dist-lib/backend-origin.cjs +1 -1
  120. package/dist-lib/beta.cjs +44 -0
  121. package/dist-lib/bridge-constants.cjs +1 -1
  122. package/dist-lib/cli-constants.cjs +1 -1
  123. package/dist-lib/config.cjs +1 -1
  124. package/dist-lib/detox/index.cjs +1770 -0
  125. package/dist-lib/detox/jest-preset.cjs +50 -0
  126. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  127. package/dist-lib/home-paths.cjs +1 -1
  128. package/dist-lib/host/bridge-host.cjs +1 -1
  129. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  130. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  131. package/dist-lib/index.cjs +1 -1
  132. package/dist-lib/metro.cjs +1 -1
  133. package/dist-lib/profiles.cjs +1 -1
  134. package/dist-lib/render-mode.cjs +1 -1
  135. package/dist-lib/scripts/demo-app-registry.cjs +809 -0
  136. package/dist-lib/scripts/dev-server-scanner.cjs +1269 -0
  137. package/dist-lib/skills.cjs +8322 -0
  138. package/dist-lib/vite-base.cjs +3 -3
  139. package/dist-lib/vite.cjs +1 -1
  140. package/package.json +39 -10
  141. package/scripts/demo-app-registry.ts +989 -0
  142. package/scripts/dev-server-scanner.ts +674 -0
  143. package/src/agent-daemon-client.ts +390 -0
  144. package/src/agent-events.ts +71 -0
  145. package/src/agent-prompt.ts +71 -0
  146. package/src/agent-sessions.ts +572 -0
  147. package/src/attached-projects.ts +536 -0
  148. package/src/auth/shared-session.ts +199 -0
  149. package/src/backend-origin.ts +49 -0
  150. package/src/beta.ts +21 -0
  151. package/src/bridge-constants.ts +10 -0
  152. package/src/cli-constants.ts +1 -0
  153. package/src/cli-version.ts +30 -0
  154. package/src/codex-client.ts +215 -0
  155. package/src/config.ts +110 -0
  156. package/src/dev-bundle-resolution.ts +180 -0
  157. package/src/home-paths.ts +382 -0
  158. package/src/host/agent-host.ts +576 -0
  159. package/src/host/bridge-host.ts +2293 -0
  160. package/src/host/fetch-proxy-handler.ts +288 -0
  161. package/src/host/fetch-proxy-overrides.ts +39 -0
  162. package/src/host/open-url.ts +234 -0
  163. package/src/index.ts +9 -0
  164. package/src/metro-plugin.ts +207 -0
  165. package/src/native-dev-bundle-url.ts +62 -0
  166. package/src/native-seam-manifest.ts +313 -0
  167. package/src/profiles.ts +179 -0
  168. package/src/render-mode.ts +27 -0
  169. package/src/runtime-delivery.ts +334 -0
  170. package/src/screenshots/compose.ts +422 -0
  171. package/src/screenshots/frame-compose.ts +438 -0
  172. package/src/screenshots/orchestrate.ts +244 -0
  173. package/src/screenshots/registry.ts +58 -0
  174. package/src/screenshots/schema.ts +364 -0
  175. package/src/skills/builtin/a11y-review.ts +126 -0
  176. package/src/skills/builtin/compat-check.ts +104 -0
  177. package/src/skills/builtin/perf-profile.ts +84 -0
  178. package/src/skills/builtin/screenshot-all.ts +46 -0
  179. package/src/skills/builtin/test-flow.ts +118 -0
  180. package/src/skills/builtin/visual-diff.ts +94 -0
  181. package/src/skills/registry.ts +107 -0
  182. package/src/skills/types.ts +41 -0
  183. package/src/vite-plugin-one.ts +187 -0
  184. package/src/vite-plugin.ts +1381 -0
  185. package/src/worklets-babel.ts +132 -0
  186. package/dist-cli/chunks/auto-bootstrap-D2EQVL7R.js +0 -2
  187. package/dist-cli/chunks/beta-VHPXECZY.js +0 -2
  188. package/dist-cli/chunks/chunk-27HBWBE6.js +0 -4
  189. package/dist-cli/chunks/chunk-2W5C5J4O.js +0 -64
  190. package/dist-cli/chunks/chunk-3OH4VCJA.js +0 -1
  191. package/dist-cli/chunks/chunk-45HLFQRI.js +0 -2
  192. package/dist-cli/chunks/chunk-7YLCK5HG.js +0 -5
  193. package/dist-cli/chunks/chunk-BRDUKIZI.js +0 -119
  194. package/dist-cli/chunks/chunk-GADW2Q5S.js +0 -1
  195. package/dist-cli/chunks/chunk-HST43CVE.js +0 -2
  196. package/dist-cli/chunks/chunk-QJBQOGTK.js +0 -73
  197. package/dist-cli/chunks/chunk-V26REV7G.js +0 -1
  198. package/dist-cli/chunks/cli-version-WF7T6IKI.js +0 -2
  199. package/dist-cli/chunks/control-EAK2OPGB.js +0 -2
  200. package/dist-cli/chunks/demo-app-registry-52A2MI72.js +0 -2
  201. package/dist-cli/chunks/drivers-B4QPIZ4B.js +0 -2
  202. package/dist-cli/chunks/flow-PFLHFNVM.js +0 -2
  203. package/dist-cli/chunks/install-ZCPEMK6U.js +0 -2
  204. package/dist-cli/chunks/record-CZ33G5FT.js +0 -70
  205. package/dist-cli/chunks/runtime-AZKHZHJ4.js +0 -2
  206. package/dist-cli/chunks/setup-repo-3Y2QAZRK.js +0 -2
  207. package/dist-cli/chunks/store-TDTFZMGA.js +0 -2
  208. package/dist-cli/chunks/telemetry-G3NIU5NP.js +0 -2
  209. package/dist-cli/chunks/upload-CLWFS7IL.js +0 -2
@@ -0,0 +1,86 @@
1
+ // custom Jest environment for running detox tests against sootsim
2
+ // provides global device, element, by, expect (detox globals)
3
+ // auto-launches sootsim browser in setup, tears down in teardown
4
+
5
+ import * as fs from 'fs'
6
+ import * as path from 'path'
7
+ import { fileURLToPath } from 'url'
8
+ import NodeEnvironment from 'jest-environment-node'
9
+ import type { JestEnvironmentConfig, EnvironmentContext } from '@jest/environment'
10
+
11
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
12
+
13
+ interface DetoxDevice {
14
+ terminateApp?(): Promise<void>
15
+ takeScreenshot?(name: string): Promise<string>
16
+ }
17
+
18
+ export default class SootSimDetoxEnvironment extends NodeEnvironment {
19
+ private screenshotDir: string
20
+
21
+ constructor(config: JestEnvironmentConfig, context: EnvironmentContext) {
22
+ super(config, context)
23
+ this.screenshotDir =
24
+ process.env.SOOTSIM_SCREENSHOT_DIR ||
25
+ path.join(process.cwd(), 'test', 'detox-driver', 'screenshots')
26
+ }
27
+
28
+ async setup() {
29
+ await super.setup()
30
+
31
+ // dynamically import the detox driver — it manages browser lifecycle
32
+ const driverPath = path.resolve(__dirname, 'index.ts')
33
+ const driver = await import(driverPath)
34
+
35
+ // expose detox globals
36
+ this.global.by = driver.by
37
+ this.global.element = driver.element
38
+ this.global.expect = driver.expect
39
+ this.global.waitFor = driver.waitFor
40
+ this.global.device = driver.device
41
+
42
+ // ensure screenshot dir exists
43
+ fs.mkdirSync(this.screenshotDir, { recursive: true })
44
+ }
45
+
46
+ async teardown() {
47
+ // device.terminateApp will close the browser
48
+ try {
49
+ const device = this.global.device as DetoxDevice | undefined
50
+ if (device?.terminateApp) {
51
+ await device.terminateApp()
52
+ }
53
+ } catch {}
54
+
55
+ await super.teardown()
56
+ }
57
+
58
+ async handleTestEvent(event: any, state: any) {
59
+ // capture screenshot on test failure
60
+ if (event.name === 'test_fn_failure' || event.name === 'test_done') {
61
+ const testFailed =
62
+ event.name === 'test_fn_failure' ||
63
+ (event.test && event.test.errors && event.test.errors.length > 0)
64
+
65
+ if (testFailed) {
66
+ try {
67
+ const testName =
68
+ state?.currentlyRunningTest?.name || event.test?.name || 'unknown'
69
+ const safeName = testName.replace(/[^a-zA-Z0-9-_]/g, '_').slice(0, 80)
70
+ const screenshotPath = path.join(this.screenshotDir, `failure-${safeName}.png`)
71
+
72
+ const device = this.global.device as DetoxDevice | undefined
73
+ if (device?.takeScreenshot) {
74
+ const capturedPath = await device.takeScreenshot(`failure-${safeName}`)
75
+ if (capturedPath !== screenshotPath) {
76
+ fs.copyFileSync(capturedPath, screenshotPath)
77
+ }
78
+ console.log(` failure screenshot: ${screenshotPath}`)
79
+ }
80
+ } catch {
81
+ // screenshot capture failed, non-fatal
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,50 @@
1
+ // jest preset for running existing detox suites against sootsim.
2
+ //
3
+ // users drop `preset: 'sootsim/detox/jest-preset'` into their jest config
4
+ // (or `sootsim-detox.config.cjs`) and their `import { by, device, element,
5
+ // expect, waitFor } from 'detox'` calls resolve to the sootsim driver.
6
+
7
+ const path = require('path')
8
+
9
+ // resolve the published driver entry so the mapping works from any cwd.
10
+ // `require.resolve('sootsim/detox')` honours the subpath export in the
11
+ // sootsim package.json.
12
+ const DRIVER_ENTRY = require.resolve('sootsim/detox')
13
+ const PACKAGE_ROOT = path.dirname(require.resolve('sootsim/package.json'))
14
+
15
+ /** @type {import('@jest/types').Config.InitialOptions} */
16
+ module.exports = {
17
+ testTimeout: 180000,
18
+ maxWorkers: 1,
19
+ watchman: false,
20
+ forceExit: true,
21
+ verbose: true,
22
+ testEnvironment: 'node',
23
+ transform: {
24
+ '^.+\\.tsx?$': [
25
+ 'ts-jest',
26
+ {
27
+ isolatedModules: true,
28
+ tsconfig: {
29
+ module: 'commonjs',
30
+ target: 'es2020',
31
+ esModuleInterop: true,
32
+ jsx: 'react-jsx',
33
+ strict: false,
34
+ skipLibCheck: true,
35
+ moduleResolution: 'node',
36
+ allowJs: true,
37
+ resolveJsonModule: true,
38
+ },
39
+ },
40
+ ],
41
+ },
42
+ moduleNameMapper: {
43
+ '^detox$': DRIVER_ENTRY,
44
+ // shared utils some external detox suites import relatively.
45
+ '^\\.\\./utils/navigation$': path.join(PACKAGE_ROOT, 'detox', 'navigation.ts'),
46
+ '^\\.\\./utils/colors$': path.join(PACKAGE_ROOT, 'detox', 'colors.ts'),
47
+ '^\\./(utils/navigation)$': path.join(PACKAGE_ROOT, 'detox', 'navigation.ts'),
48
+ '^\\./(utils/colors)$': path.join(PACKAGE_ROOT, 'detox', 'colors.ts'),
49
+ },
50
+ }
@@ -0,0 +1,29 @@
1
+ // detox-compatible matchers: by.id(), by.text(), by.label(), by.type()
2
+ // these produce matcher descriptors consumed by element() and expect()
3
+
4
+ export interface Matcher {
5
+ type: 'id' | 'text' | 'label' | 'type' | 'role'
6
+ value: string
7
+ }
8
+
9
+ export const by = {
10
+ id(testID: string): Matcher {
11
+ return { type: 'id', value: testID }
12
+ },
13
+
14
+ text(text: string): Matcher {
15
+ return { type: 'text', value: text }
16
+ },
17
+
18
+ label(accessibilityLabel: string): Matcher {
19
+ return { type: 'label', value: accessibilityLabel }
20
+ },
21
+
22
+ type(nativeType: string): Matcher {
23
+ return { type: 'type', value: nativeType }
24
+ },
25
+
26
+ role(accessibilityRole: string): Matcher {
27
+ return { type: 'role', value: accessibilityRole }
28
+ },
29
+ }
@@ -0,0 +1,43 @@
1
+ // sootsim-compatible replacement for kitchen-sink's e2e/utils/navigation.ts
2
+ // instead of navigating through the UI, we load the test case via URL query param
3
+
4
+ import { by, device, element, waitFor } from './index'
5
+
6
+ const BASE_URL = process.env.SOOTSIM_URL || 'http://localhost:5173'
7
+
8
+ /**
9
+ * navigate to a kitchen-sink test case in sootsim
10
+ * loads via URL query param instead of tapping through the UI
11
+ */
12
+ export async function navigateToTestCase(
13
+ testCaseName: string,
14
+ waitForElementId?: string,
15
+ ) {
16
+ const page = device.getPage()
17
+
18
+ // navigate to the test case directly via URL, preserving any params
19
+ // already on BASE_URL (device=, colorScheme=, etc.) — the conformance
20
+ // runner sets these via SOOTSIM_URL and dropping them silently rendered
21
+ // pro max at iphone 16 dimensions.
22
+ const target = new URL(BASE_URL)
23
+ target.searchParams.set('test', testCaseName)
24
+ if (target.pathname === '' || target.pathname === '/') target.pathname = '/'
25
+ const url = target.toString()
26
+ await page.goto(url, { waitUntil: 'load', timeout: 30000 })
27
+
28
+ // wait for sootsim engine to initialize
29
+ await page.waitForFunction(
30
+ 'window.__sootsimTest && window.__sootsimRoot && window.__sootsimRoot.children.length > 0',
31
+ { timeout: 30000 },
32
+ )
33
+
34
+ // let rendering settle
35
+ await page.waitForTimeout(500)
36
+
37
+ // wait for the target element if specified
38
+ if (waitForElementId) {
39
+ await waitFor(element(by.id(waitForElementId)))
40
+ .toExist()
41
+ .withTimeout(10000)
42
+ }
43
+ }
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env npx tsx
2
+ // run an external detox test against sootsim
3
+ // usage: EXTERNAL_TEST_ROOT=/path/to/tests npx tsx test/detox-driver/run-test.ts [test-file-path]
4
+ // example: EXTERNAL_TEST_ROOT=/tmp/demo-app npx tsx test/detox-driver/run-test.ts e2e/MyFlow.test.ts
5
+ //
6
+ // the test file path is resolved relative to EXTERNAL_TEST_ROOT when provided
7
+ // the sootsim dev server must be running on port 5173
8
+
9
+ import { execSync } from 'child_process'
10
+ import * as fs from 'fs'
11
+ import * as path from 'path'
12
+ import { fileURLToPath } from 'url'
13
+
14
+ const __filename = fileURLToPath(import.meta.url)
15
+ const __dirname = path.dirname(__filename)
16
+
17
+ const SOOTSIM_ROOT = path.resolve(__dirname, '../..')
18
+ const EXTERNAL_TEST_ROOT = process.env.EXTERNAL_TEST_ROOT || ''
19
+ const DRIVER_DIR = path.resolve(__dirname)
20
+
21
+ // get test file arg
22
+ const testFile = process.argv[2]
23
+ if (!testFile) {
24
+ console.error('usage: npx tsx test/detox-driver/run-test.ts <test-file>')
25
+ console.error(
26
+ ' e.g. npx tsx test/detox-driver/run-test.ts e2e/PressStyleNative.test.ts',
27
+ )
28
+ process.exit(1)
29
+ }
30
+
31
+ // resolve the test file path
32
+ let testPath = testFile
33
+ if (!path.isAbsolute(testPath)) {
34
+ const fromExternal = EXTERNAL_TEST_ROOT
35
+ ? path.resolve(EXTERNAL_TEST_ROOT, testPath)
36
+ : ''
37
+ if (fromExternal && fs.existsSync(fromExternal)) {
38
+ testPath = fromExternal
39
+ } else {
40
+ testPath = path.resolve(process.cwd(), testPath)
41
+ }
42
+ }
43
+
44
+ if (!fs.existsSync(testPath)) {
45
+ console.error(`test file not found: ${testPath}`)
46
+ process.exit(1)
47
+ }
48
+
49
+ console.log(`running detox test against sootsim:`)
50
+ console.log(` test: ${testPath}`)
51
+ console.log(` sootsim: ${SOOTSIM_ROOT}`)
52
+ console.log(` external root: ${EXTERNAL_TEST_ROOT || '(none)'}`)
53
+ console.log('')
54
+
55
+ // write a temporary jest config with the right module mappings
56
+ const tmpConfig = path.join(SOOTSIM_ROOT, 'test', '.detox-sootsim-jest.config.cjs')
57
+ const configContent = `
58
+ // auto-generated jest config for running detox tests against sootsim
59
+ const path = require('path');
60
+
61
+ module.exports = {
62
+ rootDir: ${JSON.stringify(EXTERNAL_TEST_ROOT || SOOTSIM_ROOT)},
63
+ testMatch: [${JSON.stringify(testPath)}],
64
+ testTimeout: 180000,
65
+ maxWorkers: 1,
66
+ verbose: true,
67
+ transform: {
68
+ '^.+\\.tsx?$': ['ts-jest', {
69
+ isolatedModules: true,
70
+ tsconfig: {
71
+ module: 'commonjs',
72
+ target: 'es2020',
73
+ esModuleInterop: true,
74
+ jsx: 'react-jsx',
75
+ strict: false,
76
+ skipLibCheck: true,
77
+ moduleResolution: 'node',
78
+ allowJs: true,
79
+ resolveJsonModule: true,
80
+ },
81
+ }],
82
+ },
83
+ moduleNameMapper: {
84
+ '^detox$': ${JSON.stringify(path.join(DRIVER_DIR, 'index.ts'))},
85
+ '^\\\\./utils/navigation$': ${JSON.stringify(path.join(DRIVER_DIR, 'navigation.ts'))},
86
+ '^\\\\./utils/colors$': ${JSON.stringify(path.join(DRIVER_DIR, 'colors.ts'))},
87
+ },
88
+ testEnvironment: 'node',
89
+ };
90
+ `
91
+
92
+ fs.writeFileSync(tmpConfig, configContent)
93
+
94
+ try {
95
+ const cmd = `npx jest --config ${tmpConfig} --no-cache --forceExit`
96
+ console.log(`$ ${cmd}\n`)
97
+
98
+ execSync(cmd, {
99
+ stdio: 'inherit',
100
+ cwd: SOOTSIM_ROOT,
101
+ env: {
102
+ ...process.env,
103
+ SOOTSIM_URL: process.env.SOOTSIM_URL || 'http://localhost:5173',
104
+ },
105
+ })
106
+ } catch (e: any) {
107
+ process.exit(e.status || 1)
108
+ } finally {
109
+ // clean up temp config
110
+ try {
111
+ fs.unlinkSync(tmpConfig)
112
+ } catch {}
113
+ }
Binary file
Binary file
package/dist-cli/bin.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- /*! sootsim v0.1.82 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
- import{a as d,b as g,c as b}from"./chunks/chunk-JUCV3VHM.js";import"./chunks/chunk-PO64TMRT.js";import{a as h,b as l,c as f}from"./chunks/chunk-JUDJXJSE.js";import"./chunks/chunk-BRDUKIZI.js";import"./chunks/chunk-HST43CVE.js";import"./chunks/chunk-GI5MF6LP.js";import"./chunks/chunk-7SCQEPXK.js";import"./chunks/chunk-Q4JNA5VO.js";import"./chunks/chunk-45HLFQRI.js";import"./chunks/chunk-PYDAVGCZ.js";import"./chunks/chunk-WZLKUS54.js";function k(a){let t=a instanceof Error?a.message:String(a);(/^command timed out after \d+s$/.test(t)||t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("no sim connected with id ")||t.startsWith("could not connect to ws://")||t.startsWith("sootsim bridge daemon is not running")||t.startsWith("refusing to install the persistent sootsim daemon"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${t}
2
+ /*! sootsim v0.1.84 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
3
+ import{a as d,b as g,c as b}from"./chunks/chunk-PS2G44GT.js";import"./chunks/chunk-QMSJR5R2.js";import{a as h,b as l,c as f}from"./chunks/chunk-VH7F45CN.js";import"./chunks/chunk-7YHDJLO2.js";import"./chunks/chunk-D3ZSBIIY.js";import"./chunks/chunk-SQX5CAYG.js";import"./chunks/chunk-TL7SIZ7S.js";import"./chunks/chunk-SQZAC7C4.js";import"./chunks/chunk-IILJQCZA.js";import"./chunks/chunk-D4HUVLZR.js";import"./chunks/chunk-BKBL6K2G.js";function k(a){let t=a instanceof Error?a.message:String(a);(/^command timed out after \d+s$/.test(t)||t.startsWith("sim disconnected:")||t.startsWith("bridge never reconnected")||t.startsWith("no sim connected with id ")||t.startsWith("could not connect to ws://")||t.startsWith("sootsim bridge daemon is not running")||t.startsWith("refusing to install the persistent sootsim daemon"))&&!process.env.SOOTSIM_VERBOSE&&(process.stderr.write(` ${t}
4
4
  `),process.exit(1)),a instanceof Error&&a.stack?process.stderr.write(`${a.stack}
5
5
  `):process.stderr.write(`${t}
6
6
  `),process.exit(1)}process.on("unhandledRejection",k);process.on("uncaughtException",k);var S=typeof __SOOTSIM_STANDALONE__<"u"&&__SOOTSIM_STANDALONE__,_=new Set(["preview","electron","install-desktop"]);function E(a){!S||!_.has(a)||(process.stderr.write(` sootsim ${a} isn't available in the standalone binary \u2014
7
7
  it needs vite / electron / playwright from a project's node_modules.
8
8
  install the npm package and run via bun or node instead:
9
9
  npm i -g sootsim && sootsim ${a}
10
- `),process.exit(1))}var e=f(process.argv);{let{trackCliEvent:a}=await import("./chunks/telemetry-G3NIU5NP.js");a({event:"cli_command_invoked",properties:{command:e.command||(e.version?"version":e.help?"help":"none"),arg_count:e.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}async function c(a){let{flushCliTelemetry:t}=await import("./chunks/telemetry-G3NIU5NP.js");await t(),process.exit(a)}if(e.version){let{getCliVersion:a}=await import("./chunks/cli-version-WF7T6IKI.js"),{IS_BETA:t,BETA_LABEL:i}=await import("./chunks/beta-VHPXECZY.js"),m=t?` \xB7 ${i}`:"";console.log(`sootsim v${a()}${m}`);let{readActiveRuntime:v}=await import("./chunks/home-paths-MQXRHBTW.js"),u=v();console.log(u?`runtime v${u}`:"runtime not installed"),await c(0)}e.help&&!e.command&&(d(),await c(0));var o=e.globalFlags.port,n=e.verbose,p=e.globalFlags.device,w=e.globalFlags.theme,O=e.globalFlags.driver,T=e.globalFlags.headless===!0,A=e.globalFlags.sim,s=A?["--sim",A,...e.commandArgs]:e.commandArgs;if(p||w){let{settingsStore:a}=await import("./chunks/store-TDTFZMGA.js"),t={};p&&(t.deviceModel=p),w&&(t.colorScheme=w),a.apply(t)}if(!e.command&&e.commandArgs.length===0){let{runStart:a}=await import("./chunks/start-Y7KR5ZQ3.js");await a([],{port:o}),await c(0)}var r=e.command??"";if(!r){if(e.commandArgs.length>0){let a=e.commandArgs.find(t=>!t.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${a}`),console.error(" run `sootsim --help` to see the full surface."),await c(1)}d(),await c(0)}if(r in l){let a=l[r],t=e.commandArgs.length>0?` ${e.commandArgs.join(" ")}`:"";console.error(` \`sootsim ${r}\` was removed. use \`${a}\` instead.`),t&&console.error(` \u2192 ${a}${t}`),console.error(" run `sootsim --help` to see the new verb groups."),await c(1)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){let a=r==="do"||r==="get"||r==="debug"||r==="shell"||r==="wait",t=e.commandArgs.find(i=>!i.startsWith("-"));r==="shell"||(a&&!t?g(r)&&await c(0):(b(a&&t?t:r),await c(0)))}E(r);if(h.has(r)){let{ensureSootsimReady:a,resolveBootstrapPort:t}=await import("./chunks/auto-bootstrap-D2EQVL7R.js"),i=t(s,o);await a(i);let{runInspect:m}=await import("./chunks/inspect-T4RMS5KX.js");await m([r,...s],{port:i,verbose:n})}else switch(r){case"assert":{let{runAssert:a}=await import("./chunks/assert-XYBIZRDK.js");await a(e.commandArgs);break}case"flow":{let{runFlow:a}=await import("./chunks/flow-PFLHFNVM.js"),t=await a(s);process.exit(typeof t=="number"?t:0)}case"test":{let{runTest:a}=await import("./chunks/test-IYMSUPVC.js");await a(e.commandArgs,{port:o,verbose:n});break}case"detox":{let{runDetox:a}=await import("./chunks/detox-YLC4DLXB.js");await a(e.commandArgs,{port:o,verbose:n});break}case"maestro":{let{runMaestro:a}=await import("./chunks/maestro-JYHR4HFR.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"preview":{let{runPreview:a}=await import("./chunks/preview-RPZ4UQ2B.js");await a(e.commandArgs,{port:o,verbose:n});break}case"record":{let{runRecord:a}=await import("./chunks/record-CZ33G5FT.js");await a(s,{port:o,verbose:n});break}case"profile":{let{runProfile:a}=await import("./chunks/profile-7FLDF2AP.js"),t=await a(e.commandArgs,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"cpu-profile":{let{runCpuProfile:a}=await import("./chunks/cpu-profile-GU62WVZZ.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"react":{let{runReact:a}=await import("./chunks/react-3RC4CNDZ.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"screenshot":{let{runScreenshot:a}=await import("./chunks/screenshot-GRCZ6AM4.js");await a(s,{port:o,verbose:n});break}case"screenshots":{let{runScreenshots:a}=await import("./chunks/screenshots-7SXMX2AY.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"screenshot-mode":{let{runScreenshotMode:a}=await import("./chunks/screenshot-mode-E4YHXHH5.js");await a(e.commandArgs,{port:o,verbose:n});break}case"three-mode":case"3d-mode":{let{runThreeMode:a}=await import("./chunks/three-mode-QKKXCCC2.js");await a(e.commandArgs,{port:o,verbose:n});break}case"inspect":{let{runInspect:a}=await import("./chunks/inspect-T4RMS5KX.js");await a(s,{port:o,verbose:n});break}case"debug":{let{runDebug:a}=await import("./chunks/debug-HAOCONNB.js");await a(s,{port:o,verbose:n});break}case"timeline":{let{runTimeline:a}=await import("./chunks/timeline-PF6NQ7RT.js");await a(s,{port:o,verbose:n});break}case"what-happened":{let{runWhatHappened:a}=await import("./chunks/what-happened-372J7YF7.js");await a(s,{port:o,verbose:n});break}case"diagnose":{let{runDiagnose:a}=await import("./chunks/diagnose-HNUO3Z5F.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"open":{let{ensureSootsimReady:a,resolveBootstrapPort:t}=await import("./chunks/auto-bootstrap-D2EQVL7R.js"),i=t(s,o);await a(i);let{runOpenCommand:m}=await import("./chunks/control-EAK2OPGB.js");await m(s,{port:i});break}case"use":case"focus":{let{runUseCommand:a}=await import("./chunks/control-EAK2OPGB.js");await a(s,{port:o});break}case"claim":{let{runClaimCommand:a}=await import("./chunks/control-EAK2OPGB.js");await a(s,{port:o});break}case"close":{let{runCloseCommand:a}=await import("./chunks/control-EAK2OPGB.js");await a(s,{port:o});break}case"config":{let{runConfig:a}=await import("./chunks/config-YDX4Q4XM.js");await a(e.commandArgs);break}case"device":{let{runDeviceCommand:a}=await import("./chunks/device-ZQ4DN4H6.js");await a(s,{port:o});break}case"scan":case"compat":{let{runCompat:a}=await import("./chunks/compat-2DVSCCR7.js");await a(e.commandArgs);break}case"electron":{let{runElectron:a}=await import("./chunks/electron-ZAASAHSW.js");await a(e.commandArgs,{port:o,device:p,driver:O});break}case"login":{let{runLogin:a}=await import("./chunks/login-VZBANVLU.js");await a(e.commandArgs);break}case"logout":{let{runLogout:a}=await import("./chunks/logout-GWXBTQ4H.js");await a();break}case"whoami":{let{runWhoami:a}=await import("./chunks/whoami-B4E7KCT5.js");await a();break}case"keys":{let{runKeys:a}=await import("./chunks/keys-IELIDRGB.js");await a(e.commandArgs);break}case"setup-repo":{let{runSetupRepo:a}=await import("./chunks/setup-repo-3Y2QAZRK.js");await a(e.commandArgs);break}case"install":{let{runInstall:a}=await import("./chunks/install-ZCPEMK6U.js");await a(e.commandArgs);break}case"install-desktop":{let{runInstallDesktop:a}=await import("./chunks/install-desktop-MH26VONS.js");await a(e.commandArgs);break}case"server":{let{runServer:a}=await import("./chunks/server-GDJ2TCRV.js");await a(e.commandArgs,{port:o});break}case"daemon":{let{runDaemon:a}=await import("./chunks/daemon-V5NLDTSB.js");await a(e.commandArgs,{port:o});break}case"runtime":{let{runRuntime:a}=await import("./chunks/runtime-AZKHZHJ4.js");await a(e.commandArgs);break}case"upgrade":{let{runUpgrade:a}=await import("./chunks/upgrade-CE2Y3TAN.js");await a(e.commandArgs);break}case"launch":{let{runLaunch:a}=await import("./chunks/launch-VMT3OWOB.js");await a(e.commandArgs);break}case"start":{let{runStart:a}=await import("./chunks/start-Y7KR5ZQ3.js");await a(e.commandArgs,{port:o});break}case"agent":{let{runAgentCommand:a}=await import("./chunks/agent-3C6Z6YXA.js"),t=await a(e.commandArgs);process.exit(t)}case"agent-wrapper":{let{runAgentWrapper:a}=await import("./chunks/agent-wrapper-7Z4UFACX.js"),t=await a(e.commandArgs);process.exit(t)}case"skills":{let{runSkills:a}=await import("./chunks/skills-62E7NDRC.js");await a(e.commandArgs);break}case"upload":{let{runUpload:a}=await import("./chunks/upload-CLWFS7IL.js");await a(e.commandArgs,{port:o,verbose:n});break}case"hints":{let{runHints:a}=await import("./chunks/hints-BA3GE5W5.js");a(e.commandArgs);break}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),process.exit(1)}
10
+ `),process.exit(1))}var e=f(process.argv);{let{trackCliEvent:a}=await import("./chunks/telemetry-DG6GJLCP.js");a({event:"cli_command_invoked",properties:{command:e.command||(e.version?"version":e.help?"help":"none"),arg_count:e.commandArgs.length,platform:process.platform,arch:process.arch,node_version:process.versions.node}})}async function c(a){let{flushCliTelemetry:t}=await import("./chunks/telemetry-DG6GJLCP.js");await t(),process.exit(a)}if(e.version){let{getCliVersion:a}=await import("./chunks/cli-version-QB4VH24H.js"),{IS_BETA:t,BETA_LABEL:i}=await import("./chunks/beta-4K2SQACK.js"),m=t?` \xB7 ${i}`:"";console.log(`sootsim v${a()}${m}`);let{readActiveRuntime:v}=await import("./chunks/home-paths-GLMX5OKL.js"),u=v();console.log(u?`runtime v${u}`:"runtime not installed"),await c(0)}e.help&&!e.command&&(d(),await c(0));var o=e.globalFlags.port,n=e.verbose,p=e.globalFlags.device,w=e.globalFlags.theme,O=e.globalFlags.driver,T=e.globalFlags.headless===!0,A=e.globalFlags.sim,s=A?["--sim",A,...e.commandArgs]:e.commandArgs;if(p||w){let{settingsStore:a}=await import("./chunks/store-RE45SUBF.js"),t={};p&&(t.deviceModel=p),w&&(t.colorScheme=w),a.apply(t)}if(!e.command&&e.commandArgs.length===0){let{runStart:a}=await import("./chunks/start-2WU4W6ZU.js");await a([],{port:o}),await c(0)}var r=e.command??"";if(!r){if(e.commandArgs.length>0){let a=e.commandArgs.find(t=>!t.startsWith("-"))??e.commandArgs[0];console.error(` unknown command: ${a}`),console.error(" run `sootsim --help` to see the full surface."),await c(1)}d(),await c(0)}if(r in l){let a=l[r],t=e.commandArgs.length>0?` ${e.commandArgs.join(" ")}`:"";console.error(` \`sootsim ${r}\` was removed. use \`${a}\` instead.`),t&&console.error(` \u2192 ${a}${t}`),console.error(" run `sootsim --help` to see the new verb groups."),await c(1)}if(e.help||e.commandArgs.includes("--help")||e.commandArgs.includes("-h")){let a=r==="do"||r==="get"||r==="debug"||r==="shell"||r==="wait",t=e.commandArgs.find(i=>!i.startsWith("-"));r==="shell"||(a&&!t?g(r)&&await c(0):(b(a&&t?t:r),await c(0)))}E(r);if(h.has(r)){let{ensureSootsimReady:a,resolveBootstrapPort:t}=await import("./chunks/auto-bootstrap-NYYSMTIM.js"),i=t(s,o);await a(i);let{runInspect:m}=await import("./chunks/inspect-FJOPCTY2.js");await m([r,...s],{port:i,verbose:n})}else switch(r){case"assert":{let{runAssert:a}=await import("./chunks/assert-ZOMAMKRT.js");await a(e.commandArgs);break}case"flow":{let{runFlow:a}=await import("./chunks/flow-6O4GEOPJ.js"),t=await a(s);process.exit(typeof t=="number"?t:0)}case"test":{let{runTest:a}=await import("./chunks/test-OVO4CQTG.js");await a(e.commandArgs,{port:o,verbose:n});break}case"detox":{let{runDetox:a}=await import("./chunks/detox-SPWAZCYG.js");await a(e.commandArgs,{port:o,verbose:n});break}case"maestro":{let{runMaestro:a}=await import("./chunks/maestro-EOWGI7DG.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"preview":{let{runPreview:a}=await import("./chunks/preview-F73TKK37.js");await a(e.commandArgs,{port:o,verbose:n});break}case"record":{let{runRecord:a}=await import("./chunks/record-JZXCQ4IN.js");await a(s,{port:o,verbose:n});break}case"profile":{let{runProfile:a}=await import("./chunks/profile-22FDKBUO.js"),t=await a(e.commandArgs,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"cpu-profile":{let{runCpuProfile:a}=await import("./chunks/cpu-profile-IKAE3KTY.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"react":{let{runReact:a}=await import("./chunks/react-5L6VPFUP.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"screenshot":{let{runScreenshot:a}=await import("./chunks/screenshot-HDRRG33Q.js");await a(s,{port:o,verbose:n});break}case"screenshots":{let{runScreenshots:a}=await import("./chunks/screenshots-MPV2ENL5.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"screenshot-mode":{let{runScreenshotMode:a}=await import("./chunks/screenshot-mode-WY63LZIX.js");await a(e.commandArgs,{port:o,verbose:n});break}case"three-mode":case"3d-mode":{let{runThreeMode:a}=await import("./chunks/three-mode-BKM3KFM7.js");await a(e.commandArgs,{port:o,verbose:n});break}case"inspect":{let{runInspect:a}=await import("./chunks/inspect-FJOPCTY2.js");await a(s,{port:o,verbose:n});break}case"debug":{let{runDebug:a}=await import("./chunks/debug-P6KULKKS.js");await a(s,{port:o,verbose:n});break}case"timeline":{let{runTimeline:a}=await import("./chunks/timeline-MDXGEDQL.js");await a(s,{port:o,verbose:n});break}case"what-happened":{let{runWhatHappened:a}=await import("./chunks/what-happened-PZW2KW6A.js");await a(s,{port:o,verbose:n});break}case"diagnose":{let{runDiagnose:a}=await import("./chunks/diagnose-IZODTXV2.js"),t=await a(s,{port:o,verbose:n});process.exit(typeof t=="number"?t:0)}case"open":{let{ensureSootsimReady:a,resolveBootstrapPort:t}=await import("./chunks/auto-bootstrap-NYYSMTIM.js"),i=t(s,o);await a(i);let{runOpenCommand:m}=await import("./chunks/control-UXY7YQVX.js");await m(s,{port:i});break}case"use":case"focus":{let{runUseCommand:a}=await import("./chunks/control-UXY7YQVX.js");await a(s,{port:o});break}case"claim":{let{runClaimCommand:a}=await import("./chunks/control-UXY7YQVX.js");await a(s,{port:o});break}case"close":{let{runCloseCommand:a}=await import("./chunks/control-UXY7YQVX.js");await a(s,{port:o});break}case"config":{let{runConfig:a}=await import("./chunks/config-CYI2WAGP.js");await a(e.commandArgs);break}case"device":{let{runDeviceCommand:a}=await import("./chunks/device-JWEPK6I2.js");await a(s,{port:o});break}case"scan":case"compat":{let{runCompat:a}=await import("./chunks/compat-FWSEEGEH.js");await a(e.commandArgs);break}case"electron":{let{runElectron:a}=await import("./chunks/electron-R5GP6RVB.js");await a(e.commandArgs,{port:o,device:p,driver:O});break}case"login":{let{runLogin:a}=await import("./chunks/login-KJQGHA64.js");await a(e.commandArgs);break}case"logout":{let{runLogout:a}=await import("./chunks/logout-XM2SYH5C.js");await a();break}case"whoami":{let{runWhoami:a}=await import("./chunks/whoami-7ATWJQS6.js");await a();break}case"keys":{let{runKeys:a}=await import("./chunks/keys-GSYPHWNY.js");await a(e.commandArgs);break}case"setup-repo":{let{runSetupRepo:a}=await import("./chunks/setup-repo-SZSYNKNI.js");await a(e.commandArgs);break}case"install":{let{runInstall:a}=await import("./chunks/install-A3TUGGHN.js");await a(e.commandArgs);break}case"install-desktop":{let{runInstallDesktop:a}=await import("./chunks/install-desktop-YPJZMZM5.js");await a(e.commandArgs);break}case"server":{let{runServer:a}=await import("./chunks/server-5LBMCJ3G.js");await a(e.commandArgs,{port:o});break}case"daemon":{let{runDaemon:a}=await import("./chunks/daemon-ZUMF53YB.js");await a(e.commandArgs,{port:o});break}case"runtime":{let{runRuntime:a}=await import("./chunks/runtime-EEBX7CFV.js");await a(e.commandArgs);break}case"upgrade":{let{runUpgrade:a}=await import("./chunks/upgrade-JGQABWVF.js");await a(e.commandArgs);break}case"launch":{let{runLaunch:a}=await import("./chunks/launch-4G2PKW5X.js");await a(e.commandArgs);break}case"start":{let{runStart:a}=await import("./chunks/start-2WU4W6ZU.js");await a(e.commandArgs,{port:o});break}case"agent":{let{runAgentCommand:a}=await import("./chunks/agent-2CWD6W6P.js"),t=await a(e.commandArgs);process.exit(t)}case"agent-wrapper":{let{runAgentWrapper:a}=await import("./chunks/agent-wrapper-5W3LOX6S.js"),t=await a(e.commandArgs);process.exit(t)}case"skills":{let{runSkills:a}=await import("./chunks/skills-BQ73YOBF.js");await a(e.commandArgs);break}case"upload":{let{runUpload:a}=await import("./chunks/upload-UJNUA4ZV.js");await a(e.commandArgs,{port:o,verbose:n});break}case"hints":{let{runHints:a}=await import("./chunks/hints-DYDNYX7N.js");a(e.commandArgs);break}default:console.error(` unknown command: ${r}`),console.error(" run `sootsim --help` to see the full surface."),process.exit(1)}
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.82 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as $,b,c as E,d as l,e as A,g as S,h as j,j as T,m as I,n as k,o as x,p as g,q as D,r as O}from"./chunk-27HBWBE6.js";import"./chunk-JVNGH5S7.js";import{c as y}from"./chunk-JUCV3VHM.js";import"./chunk-PO64TMRT.js";import"./chunk-BRDUKIZI.js";import"./chunk-HST43CVE.js";import"./chunk-GI5MF6LP.js";import"./chunk-7SCQEPXK.js";import"./chunk-Q4JNA5VO.js";import"./chunk-45HLFQRI.js";import"./chunk-PYDAVGCZ.js";import"./chunk-WZLKUS54.js";import w from"node:fs";import d from"node:path";import{spawn as U}from"node:child_process";import _ from"node:net";import{WebSocket as C}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new C(`ws://localhost:${this.port}`),this.ready=new Promise((t,n)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),n(new c(`could not connect to sootsim daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==C.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let n=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(n),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(n,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:n,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(n),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let n=this.pending.get(t.id);n&&(this.pending.delete(t.id),clearTimeout(n.timer),t.error?n.reject(new c(t.error,t.code)):n.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function R(r=7668,e=400){return new Promise(t=>{let n=new _.Socket,s=!1,o=i=>{s||(s=!0,n.destroy(),t(i))};n.setTimeout(e),n.once("connect",()=>o(!0)),n.once("timeout",()=>o(!1)),n.once("error",()=>o(!1)),n.connect(r,"127.0.0.1")})}async function F(r={}){let e=r.port??7668;if(await R(e))return{alreadyRunning:!0};let{cmd:t,prefixArgs:n}=O(),s=[...n,"server","--quiet"];e!==7668&&s.push("--port",String(e));let o=U(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(r.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await R(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned sootsim daemon on port ${e} but it did not come up in time. run \`sootsim server\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(r={}){await F({port:r.port,startupTimeoutMs:r.startupTimeoutMs});let e=new f(r);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function me(r){let[e,...t]=r;try{switch(e){case void 0:case"--help":case"-h":case"help":return M(),0;case"attach":return await B(t);case"projects":return await W();case"project":return await J(t);case"sessions":return await V(t);case"start":return await G(t);case"prompt":return await H(t);case"watch":return await q(t);case"transcript":return await X(t);case"end":return await z(t);case"paths":return await Q();default:return process.stderr.write(`unknown agent subcommand: ${e}
1
+ /*! sootsim v0.1.84 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as $,b,c as E,d as l,e as A,g as S,h as j,j as T,m as I,n as k,o as x,p as g,q as D,r as O}from"./chunk-WNVNU2OW.js";import"./chunk-BCBNVJVG.js";import{c as y}from"./chunk-PS2G44GT.js";import"./chunk-QMSJR5R2.js";import"./chunk-7YHDJLO2.js";import"./chunk-D3ZSBIIY.js";import"./chunk-SQX5CAYG.js";import"./chunk-TL7SIZ7S.js";import"./chunk-SQZAC7C4.js";import"./chunk-IILJQCZA.js";import"./chunk-D4HUVLZR.js";import"./chunk-BKBL6K2G.js";import w from"node:fs";import d from"node:path";import{spawn as U}from"node:child_process";import _ from"node:net";import{WebSocket as C}from"ws";var c=class extends Error{code;constructor(e,t){super(e),this.name="AgentDaemonError",this.code=t}},f=class{ws;port;commandTimeoutMs;ready;closed=!1;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;disconnectListeners=new Set;constructor(e={}){this.port=e.port??7668,this.commandTimeoutMs=e.commandTimeoutMs??15e3,this.ws=new C(`ws://localhost:${this.port}`),this.ready=new Promise((t,n)=>{let s=()=>{this.ws.off("error",o),t()},o=i=>{this.ws.off("open",s),n(new c(`could not connect to sootsim daemon on port ${this.port}: ${i.message}`,"NO_DAEMON"))};this.ws.once("open",s),this.ws.once("error",o)}),this.ws.on("message",t=>this.handleMessage(t)),this.ws.on("close",()=>this.handleClose()),this.ws.on("error",()=>{})}async waitReady(){return this.ready}async listProjects(){return this.send("agent:list-projects")}async upsertProject(e){return this.send("agent:upsert-project",{input:e})}async deleteProject(e){return this.send("agent:delete-project",{projectId:e})}async autoAttachForUrl(e){return this.send("agent:auto-attach-for-url",{input:e})}async listSessions(e){return this.send("agent:list-sessions",{projectId:e})}async startSession(e){return this.send("agent:start-session",{input:e})}async sendPrompt(e,t){return this.send("agent:send-prompt",{sessionId:e,prompt:t})}async endSession(e){return this.send("agent:end-session",{sessionId:e})}async getTranscript(e){return this.send("agent:get-transcript",{sessionId:e})}async getPaths(){return this.send("agent:get-paths")}async subscribeEvents(e){return this.send("agent:subscribe-events",{sessionId:e})}async unsubscribeEvents(e){return this.send("agent:unsubscribe-events",{sessionId:e})}onAgentEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}onSessionStatusChange(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}onDisconnect(e){return this.disconnectListeners.add(e),()=>this.disconnectListeners.delete(e)}close(){if(!this.closed){this.closed=!0;try{this.ws.close()}catch{}}}async send(e,t={}){if(await this.ready,this.closed||this.ws.readyState!==C.OPEN)throw new c("daemon connection is closed","NO_DAEMON");let n=this.nextId++;return new Promise((s,o)=>{let i=setTimeout(()=>{this.pending.delete(n),o(new c(`${e} timed out after ${Math.round(this.commandTimeoutMs/1e3)}s`,"TIMEOUT"))},this.commandTimeoutMs);this.pending.set(n,{resolve:s,reject:o,timer:i});try{this.ws.send(JSON.stringify({id:n,type:e,...t}))}catch(a){clearTimeout(i),this.pending.delete(n),o(a instanceof Error?a:new Error(String(a)))}})}handleMessage(e){let t;try{t=JSON.parse(String(e))}catch{return}if(!t||typeof t!="object")return;if(t.type==="agent:event"){for(let s of this.eventListeners)try{s({sessionId:t.sessionId,event:t.event})}catch{}return}if(t.type==="agent:session-status"){for(let s of this.statusListeners)try{s(t.session)}catch{}return}if(typeof t.id!="number")return;let n=this.pending.get(t.id);n&&(this.pending.delete(t.id),clearTimeout(n.timer),t.error?n.reject(new c(t.error,t.code)):n.resolve(t.result))}handleClose(){if(!this.closed){this.closed=!0;for(let[,e]of this.pending)clearTimeout(e.timer),e.reject(new c("daemon disconnected","DISCONNECT"));this.pending.clear();for(let e of this.disconnectListeners)try{e()}catch{}}}};function R(r=7668,e=400){return new Promise(t=>{let n=new _.Socket,s=!1,o=i=>{s||(s=!0,n.destroy(),t(i))};n.setTimeout(e),n.once("connect",()=>o(!0)),n.once("timeout",()=>o(!1)),n.once("error",()=>o(!1)),n.connect(r,"127.0.0.1")})}async function F(r={}){let e=r.port??7668;if(await R(e))return{alreadyRunning:!0};let{cmd:t,prefixArgs:n}=O(),s=[...n,"server","--quiet"];e!==7668&&s.push("--port",String(e));let o=U(t,s,{detached:!0,stdio:"ignore",env:process.env,cwd:process.cwd()});o.unref();let i=Date.now()+(r.startupTimeoutMs??5e3);for(;Date.now()<i;){if(await R(e))return{alreadyRunning:!1,pid:o.pid};await new Promise(a=>setTimeout(a,100))}throw new c(`spawned sootsim daemon on port ${e} but it did not come up in time. run \`sootsim server\` manually to diagnose.`,"SPAWN_TIMEOUT")}async function h(r={}){await F({port:r.port,startupTimeoutMs:r.startupTimeoutMs});let e=new f(r);try{await e.waitReady()}catch(t){throw e.close(),t}return e}async function me(r){let[e,...t]=r;try{switch(e){case void 0:case"--help":case"-h":case"help":return M(),0;case"attach":return await B(t);case"projects":return await W();case"project":return await J(t);case"sessions":return await V(t);case"start":return await G(t);case"prompt":return await H(t);case"watch":return await q(t);case"transcript":return await X(t);case"end":return await z(t);case"paths":return await Q();default:return process.stderr.write(`unknown agent subcommand: ${e}
3
3
  `),M(),2}}catch(n){if(n instanceof c)return process.stderr.write(`${n.message}
4
4
  `),1;throw n}}async function v(r){let e=await h({clientLabel:"sootsim-agent-cli"});try{return await r(e)}finally{e.close()}}function M(){y("agent")}function P(r,e){let t={},n=[];for(let s=0;s<r.length;s++){let o=r[s],i=e[o];i==="value"?(t[o]=r[s+1]??"",s++):i==="bool"?t[o]=!0:n.push(o)}return{flags:t,positional:n}}function N(r,e="codex"){return r==="codex"||r==="claude"?r:e}async function B(r){let{flags:e,positional:t}=P(r,{"--name":"value","--provider":"value"}),n=t[0];if(!n)return process.stderr.write(`usage: sootsim agent attach <dir> [--name X] [--provider codex|claude]
5
5
  `),2;let s=d.resolve(n);if(!w.existsSync(s))return process.stderr.write(`directory does not exist: ${s}
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.82 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{b as M}from"./chunk-JVNGH5S7.js";import"./chunk-WZLKUS54.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as I,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,g=!1,a=new Promise(s=>{t.on("exit",(i,e)=>{g=!0;let p=new Error(`codex app-server exited (code=${i}, signal=${e??""})`);for(let{reject:f}of r.values())f(p);r.clear(),s({code:i,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let i=s.trim();if(!i)return;let e;try{e=JSON.parse(i)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,f=p!=null?r.get(p):void 0;if(!f)return;r.delete(p),e.error?f.reject(new b(e.error.message,e.error.code,e.error.data)):f.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let f of p)try{f(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let i=m.get("__stderr__");if(i)for(let e of i)try{e({text:s})}catch{}});function n(s){if(!g)try{t.stdin.write(JSON.stringify(s)+`
1
+ /*! sootsim v0.1.84 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{b as M}from"./chunk-BCBNVJVG.js";import"./chunk-BKBL6K2G.js";import{execFile as G,spawn as q}from"node:child_process";import{randomUUID as X}from"node:crypto";import{constants as R,createReadStream as Y,createWriteStream as j,existsSync as I,openSync as J}from"node:fs";import V from"node:fs/promises";import z from"node:path";import K from"node:readline";import{promisify as Q}from"node:util";import{spawn as H}from"node:child_process";import L from"node:readline";var b=class extends Error{code;data;constructor(t,r,m){super(t),this.name="CodexRpcError",this.code=r,this.data=m}};function W(d){let t=H(d.bin,["app-server"],{cwd:d.cwd,env:{...process.env,...d.env},stdio:["pipe","pipe","pipe"]}),r=new Map,m=new Map,u=1,g=!1,a=new Promise(s=>{t.on("exit",(i,e)=>{g=!0;let p=new Error(`codex app-server exited (code=${i}, signal=${e??""})`);for(let{reject:f}of r.values())f(p);r.clear(),s({code:i,signal:e})})});L.createInterface({input:t.stdout,crlfDelay:1/0}).on("line",s=>{let i=s.trim();if(!i)return;let e;try{e=JSON.parse(i)}catch{return}if(e.id!=null&&(e.result!==void 0||e.error!==void 0)){let p=typeof e.id=="string"?Number(e.id):e.id,f=p!=null?r.get(p):void 0;if(!f)return;r.delete(p),e.error?f.reject(new b(e.error.message,e.error.code,e.error.data)):f.resolve(e.result);return}if(e.method){let p=m.get(e.method);if(!p)return;for(let f of p)try{f(e.params)}catch(l){console.error(`[codex-client] handler for "${e.method}" threw:`,l instanceof Error?l.stack??l.message:l)}}}),t.stderr.setEncoding("utf8"),t.stderr.on("data",s=>{let i=m.get("__stderr__");if(i)for(let e of i)try{e({text:s})}catch{}});function n(s){if(!g)try{t.stdin.write(JSON.stringify(s)+`
3
3
  `)}catch{}}return{exited:a,on(s,i){let e=m.get(s);return e||(e=new Set,m.set(s,e)),e.add(i),()=>{e?.delete(i)}},request(s,i){if(g)return Promise.reject(new Error(`codex app-server closed; cannot call ${s}`));let e=u++;return new Promise((p,f)=>{r.set(e,{resolve:l=>p(l),reject:f,method:s}),n({jsonrpc:"2.0",id:e,method:s,params:i})})},notify(s,i){n({jsonrpc:"2.0",method:s,params:i})},async shutdown(s=1500){if(g)return;try{t.stdin.end()}catch{}let i=setTimeout(()=>{if(!g)try{t.kill("SIGTERM")}catch{}},s);try{await a}finally{clearTimeout(i)}},kill(s="SIGTERM"){if(!g)try{t.kill(s)}catch{}}}}var O="never",F="danger-full-access",Z={type:"dangerFullAccess"},D="fast",ee="medium",te=Q(G);async function ne(d,t){let r=t||d;if(r.includes("/")||r.includes("\\"))return I(r)?{ok:!0,path:r}:{ok:!1,message:`agent binary not found at path: ${r}`};try{let{stdout:m}=await te("which",[r],{timeout:1500}),u=m.trim();return u?{ok:!0,path:u}:{ok:!1,message:`${r} not found on PATH`}}catch{return{ok:!1,message:`${r} not found on PATH. install the ${d} CLI and retry, or pass --${d}-bin /path/to/${d} to agent start.`}}}function re(d){let t={"--session-id":"sessionId","--project-id":"projectId","--provider":"provider","--cwd":"cwd","--prompt-in":"promptIn","--events-out":"eventsOut","--transcript":"transcript","--codex-bin":"codexBin","--claude-bin":"claudeBin","--claude-session-uuid":"claudeSessionUuid"},r={};for(let m=0;m<d.length;m++){let u=d[m];if(u==="--fresh-thread"){r.freshThread=!0;continue}let g=t[u];g&&(r[g]=d[m+1],m++)}return r}async function Ie(d){let t=re(d);if(!t.sessionId||!t.projectId||!t.provider||!t.cwd||!t.promptIn||!t.eventsOut)return process.stderr.write(`usage: sootsim agent-wrapper --session-id <id> --project-id <id>
4
4
  --provider codex|claude --cwd <path>
5
5
  --prompt-in <fifo> --events-out <fifo>
@@ -1,5 +1,5 @@
1
- /*! sootsim v0.1.82 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import"./chunk-WZLKUS54.js";import{spawn as x}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=x(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
1
+ /*! sootsim v0.1.84 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import"./chunk-BKBL6K2G.js";import{spawn as x}from"child_process";var w=new Set(["describe","find","list","network","logs","count","tree","url","a11y","node","layout","keyboard","errors","warnings","requests","animations","animation","state","sample-color"]),S=new Set(["--exists","--empty","--negate","--quiet","--allow-timeout","!"]),q=new Set(["--count","--count-at-least","--count-at-most","--contains","--not-contains","--matches","--not-matches","--equals","--jq","--has-path","--within"]),P=new Set(["--path-equals"]);function j(s){let r=[],u=[],n=0,e=!1,t=!1,i=!1;for(let o=0;o<s.length;o++){let a=s[o];if(a==="--within"){let c=Number(s[o+1]);if(!Number.isFinite(c)||c<0)return{error:`--within requires a non-negative number, got: ${s[o+1]}`};n=c,o++;continue}if(a==="--negate"||a==="!"){e=!0;continue}if(a==="--quiet"){t=!0;continue}if(a==="--allow-timeout"){i=!0;continue}if(S.has(a)){u.push({kind:a,args:[]});continue}if(q.has(a)){let c=s[o+1];if(c==null)return{error:`${a} requires a value`};u.push({kind:a,args:[c]}),o++;continue}if(P.has(a)){let c=s[o+1],f=s[o+2];if(c==null||f==null)return{error:`${a} requires <path> <value>`};u.push({kind:a,args:[c,f]}),o+=2;continue}r.push(a)}return r.length===0?{error:"assert requires a verb (e.g. find, describe, get errors)"}:{verbArgs:r,predicates:u,withinMs:n,negate:e,quiet:t,allowTimeout:i}}function N(s){return s[0]==="get"||s[0]==="debug"?w.has(s[1])?s[1]:null:s[0]==="do"||s[0]==="wait"?null:w.has(s[0])?s[0]:null}async function R(s){let u=[process.argv[1],...s,"--json"];return new Promise(n=>{let e=x(process.execPath,u,{stdio:["ignore","pipe","pipe"],env:process.env}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",o=>{n({ok:!1,payload:null,reason:`spawn failed: ${o.message}`})}),e.on("close",o=>{if(o!==0){let a=i.trim().split(`
3
3
  `).slice(-2).join(" | ").slice(0,200);n({ok:!1,payload:null,reason:`verb exited ${o}${a?`: ${a}`:""}`});return}if(!t.trim()){n({ok:!1,payload:null,reason:"verb produced no output"});return}try{let a=JSON.parse(t);n({ok:!0,payload:a})}catch{n({ok:!1,payload:null,reason:`verb output was not valid json: ${t.slice(0,120)}`})}})})}function y(s,r){let u=r.split(".").filter(e=>e.length>0),n=s;for(let e of u){if(n==null)return{found:!1};if(Array.isArray(n)){let t=Number(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{found:!1};n=n[t];continue}if(typeof n=="object"){let t=n;if(!(e in t))return{found:!1};n=t[e];continue}return{found:!1}}return{found:!0,value:n}}function d(s){return Array.isArray(s)?s.length:s&&typeof s=="object"?Object.keys(s).length:null}async function A(s,r){let{kind:u,args:n}=s;switch(u){case"--exists":return r==null?{ok:!1,reason:"payload is null"}:d(r)===0?{ok:!1,reason:"payload is empty"}:{ok:!0,reason:"exists"};case"--empty":{if(r==null)return{ok:!0,reason:"payload is null"};let e=d(r);return e===0?{ok:!0,reason:"payload is empty"}:{ok:!1,reason:`payload has ${e} item(s)`}}case"--count":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:`payload not countable (${typeof r})`}:{ok:t===e,reason:`count=${t}, want=${e}`}}case"--count-at-least":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t>=e,reason:`count=${t}, want>=${e}`}}case"--count-at-most":{let e=Number(n[0]),t=d(r);return t==null?{ok:!1,reason:"payload not countable"}:{ok:t<=e,reason:`count=${t}, want<=${e}`}}case"--contains":{let e=n[0],t=JSON.stringify(r);return{ok:t.includes(e),reason:t.includes(e)?`contains "${e}"`:`missing "${e}"`}}case"--not-contains":{let e=n[0],t=JSON.stringify(r);return{ok:!t.includes(e),reason:t.includes(e)?`unexpected "${e}"`:`not contains "${e}"`}}case"--matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=e.test(t);return{ok:i,reason:i?`matches /${n[0]}/`:`no match for /${n[0]}/`}}case"--not-matches":{let e=new RegExp(n[0]),t=JSON.stringify(r),i=!e.test(t);return{ok:i,reason:i?`not matches /${n[0]}/`:`unexpected /${n[0]}/`}}case"--equals":{let e=n[0],t=typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):JSON.stringify(r);return{ok:t===e,reason:`got=${JSON.stringify(t)}, want=${JSON.stringify(e)}`}}case"--has-path":{let e=y(r,n[0]);return{ok:e.found,reason:e.found?`path ${n[0]} present`:`path ${n[0]} missing`}}case"--path-equals":{let[e,t]=n,i=y(r,e);if(!i.found)return{ok:!1,reason:`path ${e} missing`};let o=typeof i.value=="string"||typeof i.value=="number"||typeof i.value=="boolean"?String(i.value):JSON.stringify(i.value);return{ok:o===t,reason:`${e}=${o}, want=${t}`}}case"--jq":{let e=n[0];try{let i=(await O(e,r)).trim();return{ok:i.length>0&&i!=="null"&&i!=="false"&&i!=='""',reason:`jq: ${i.slice(0,120)}`}}catch(t){throw new Error(`jq evaluation failed: ${t.message}`)}}default:return{ok:!1,reason:`unknown predicate ${u}`}}}function O(s,r){return new Promise((u,n)=>{let e=x("jq",[s],{stdio:["pipe","pipe","pipe"]}),t="",i="";e.stdout.on("data",o=>t+=o.toString()),e.stderr.on("data",o=>i+=o.toString()),e.on("error",n),e.on("close",o=>{if(o!==0){n(new Error(i.trim()||`jq exited ${o}`));return}u(t)}),e.stdin.end(JSON.stringify(r))})}async function T(s){(s[0]==="--help"||s[0]==="-h"||s.length===0)&&(J(),process.exit(s.length===0?2:0));let r=j(s);"error"in r&&(process.stderr.write(` assert: ${r.error}
4
4
  `),process.exit(2));let{verbArgs:u,predicates:n,withinMs:e,negate:t,quiet:i,allowTimeout:o}=r;N(u)||(process.stderr.write(` assert: unknown or non-read verb: ${u.join(" ")}
5
5
  supported: ${Array.from(w).sort().join(", ")}
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.84 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b,c,d}from"./chunk-4K7BH2D4.js";import"./chunk-XQ2OBHBE.js";import"./chunk-EQCKGC4B.js";import"./chunk-IILJQCZA.js";import"./chunk-D4HUVLZR.js";import"./chunk-BKBL6K2G.js";export{c as ensureDaemonRunning,a as ensureRuntimeInstalled,d as ensureSootsimReady,b as resolveBootstrapPort};
@@ -0,0 +1,2 @@
1
+ /*! sootsim v0.1.84 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a,b,c,d,e}from"./chunk-SQX5CAYG.js";import"./chunk-BKBL6K2G.js";export{e as BETA_ASK_HEADLINE,c as BETA_LABEL,d as BETA_TAGLINE,b as BETA_VERSION_TARGET,a as IS_BETA};
@@ -0,0 +1,79 @@
1
+ /*! sootsim v0.1.84 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{d as ae,e as le,f as ce}from"./chunk-4OWVPRZV.js";import{d as oe}from"./chunk-7NWNTUJF.js";import{a as re,b as T}from"./chunk-RIXUH3NK.js";import{a as ne}from"./chunk-SFGUPL2X.js";import{c as se,e as ie,g as B}from"./chunk-XQ2OBHBE.js";import{createHash as Ee}from"crypto";import{readFileSync as D}from"fs";import{gzipSync as pe}from"zlib";function de(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}function V(e,t){let r=new AbortController,o=setTimeout(()=>r.abort(new Error(`${t} timed out after ${e/1e3}s`)),e);return{signal:r.signal,cancel:()=>clearTimeout(o)}}async function Se(e){let t=V(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 o=await r.text().catch(()=>"");throw new Error(`PUT ${e.url} failed ${r.status}: ${o.slice(0,200)}`)}}async function _e(e,t=8,r){let o=0,s=0,i=e.length;await Promise.all(Array.from({length:Math.min(t,i)},async()=>{for(;o<i;){let l=e[o++];await Se(l),s++,r?.(s,i)}}))}function $e(e,t,r,o){let s=[];s.push({url:e.bundle.putUrl,contentType:e.bundle.contentType,bytes:t});for(let i of e.files){let l=r.get(i.urlhash);l&&s.push({url:i.putUrl,contentType:i.contentType,bytes:l})}e.events&&o?.eventsBytes&&s.push({url:e.events.putUrl,contentType:e.events.contentType,bytes:o.eventsBytes}),e.flowVideo&&o?.videoBytes&&s.push({url:e.flowVideo.putUrl,contentType:e.flowVideo.contentType,bytes:o.videoBytes}),e.storage&&o?.storageBytes&&s.push({url:e.storage.putUrl,contentType:e.storage.contentType,bytes:o.storageBytes});for(let i of e.snapshots??[]){let l=o?.snapshotBytes?.get(i.id);l&&s.push({url:i.putUrl,contentType:i.contentType,bytes:l})}return s}function ke(e){return e.replace(/\/+$/,"")}var z=class extends Error{constructor(r,o,s,i=""){super(r);this.status=o;this.phase=s;this.responseText=i;this.name="PresignedUploadError"}};async function ue(e){let t=ke(e.originBase),r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader),e.adminBypassToken&&(r["x-soot-admin-upload-bypass"]=e.adminBypassToken);let o=V(3e4,"init"),s;try{s=await fetch(`${t}/api/preview/upload/init`,{method:"POST",headers:r,body:JSON.stringify(e.initBody),signal:o.signal})}finally{o.cancel()}if(!s.ok){let p=await s.text().catch(()=>"");throw new z(`init failed: ${s.status} ${p.slice(0,200)}`,s.status,"init",p)}let i=await s.json(),l=$e(i,e.bundleBytes,e.filesByHash,e.extras);await _e(l,e.concurrency??8,e.onPutProgress);let h=V(3e4,"finalize"),d;try{d=await fetch(`${t}/api/preview/upload/finalize`,{method:"POST",headers:r,body:JSON.stringify({token:i.token}),signal:h.signal})}finally{h.cancel()}if(!d.ok){let p=await d.text().catch(()=>"");throw new z(`finalize failed: ${d.status} ${p.slice(0,200)}`,d.status,"finalize",p)}let S=await d.json();return{init:i,finalize:S}}function Le(e){if(!e)return null;try{let t=JSON.parse(e);return typeof t.message=="string"&&t.message?t.message:null}catch{return null}}var ye=process.env.SOOTSIM_UPLOAD_ORIGIN||"https://sootbean.com",me=process.env.SOOTSIM_PREVIEW_ORIGIN||"https://sootsim.com",j="http://localhost:3000";async function ze(e){if(e)return e;if(process.env.SOOTSIM_UPLOAD_ORIGIN)return process.env.SOOTSIM_UPLOAD_ORIGIN;try{let t=await fetch(`${j}/api/preview/upload/init`,{method:"OPTIONS"});if(t.ok||t.status===204||t.status===405)return j}catch{}return ye}function O(e){return e.replace(/\/$/,"")}function Ae(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 Fe(e){try{let t=new URL(e).hostname.toLowerCase();return t==="sootbean.com"||t.endsWith(".sootbean.com")}catch{return!1}}function Me(e,t){return t?O(t):process.env.SOOTSIM_PREVIEW_ORIGIN?O(process.env.SOOTSIM_PREVIEW_ORIGIN):Ae(e)?O(e):Fe(e)?O(me):O(e)}function He(){console.log(`
3
+ sootsim upload \u2014 publish the current recorded bundle as a /preview/<id> link
4
+
5
+ usage:
6
+ sootsim upload [--origin <url>] [--public-origin <url>] (--events <path> | --video <path>) [--screenshot <path>] [--owner <org> --repo <repo>] [--sim <sim>] [--open] [--assets-only]
7
+
8
+ options:
9
+ --origin <url> upload target (default: auto)
10
+ prefers ${j} when available, otherwise
11
+ falls back to ${ye}
12
+ override with SOOTSIM_UPLOAD_ORIGIN env var
13
+ --public-origin <url>
14
+ public /preview link origin (default: ${me}
15
+ for prod uploads, upload origin for localhost/custom origins).
16
+ override with SOOTSIM_PREVIEW_ORIGIN env var
17
+ --events <path> path to a gzipped events .jsonl.gz file to attach
18
+ required unless --video is present; previews must
19
+ have replay or recording playback data
20
+ --screenshot <path>
21
+ path to a PNG thumbnail to attach to the share
22
+ --video <path> path to a webm/mp4/gif flow recording. embedded inline
23
+ in the pr sticky comment served at
24
+ /api/preview/flow-video?id=<share-id>
25
+ --video-duration-ms <ms>
26
+ duration hint for attached flow video
27
+ --owner <org> associate a session upload with a linked org repo
28
+ --repo <repo> repo name for --owner; the signed-in user must belong
29
+ to the local/org team that owns the link
30
+ --sim <sim> target a specific sim (see: sootsim list)
31
+ --open open the resulting /preview/<id> url in the browser
32
+ --assets-only drop API/JSON/HTML records before upload; keep images,
33
+ fonts, css, js, and binary blobs. live-data demos hit
34
+ the real network at replay time instead of serving
35
+ recorded API snapshots
36
+ -h, --help
37
+
38
+ examples:
39
+ sootsim upload --events ./my-session.jsonl.gz
40
+ sootsim upload --origin http://localhost:3000 --events ./my-session.jsonl.gz --open
41
+ sootsim upload --video /tmp/soot-flow.webm --video-duration-ms 12000
42
+ `)}function w(e,t){let r=e.findIndex(s=>s===t);if(r<0)return;let o=e[r+1];return e.splice(r,2),o}function fe(e,t){let r=e.findIndex(o=>o===t);return r<0?!1:(e.splice(r,1),!0)}function ge(e){let t=(e||"").toLowerCase().split(";")[0].trim();return t?!!(t.startsWith("image/")||t.startsWith("font/")||t.startsWith("video/")||t.startsWith("audio/")||t.startsWith("model/")||t==="text/css"||t==="application/javascript"||t==="text/javascript"||t==="application/wasm"||t==="application/font-woff"||t==="application/font-woff2"||t==="application/octet-stream"):!1}async function he(e){let t=await fetch(e);if(!t.ok)throw new Error(`fetch ${e} -> ${t.status} ${t.statusText}`);return new Uint8Array(await t.arrayBuffer())}function Ne(e){return/\.bundle($|\?)/.test(e)||/\.js($|\?)/.test(e)?"application/javascript":/\.zip($|\?)/.test(e)?"application/zip":"application/javascript"}function Ce(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 We(e,t){let o=[];for(let s=0;s<t;s+=15e5){let i=Math.min(s+15e5,t),l=await B(e,`(window.__sootsimLastTransformedBundle?.text || "").slice(${s}, ${i})`);if(typeof l!="string")return null;o.push(l)}return o.join("")}function G(e){let t=new Map;for(let r of e)t.set(r.urlhash||r.url,r);return Array.from(t.values())}async function nt(e,t){(e.includes("--help")||e.includes("-h"))&&(He(),process.exit(0));let r=[...e],o=await ze(w(r,"--origin")),s=Me(o,w(r,"--public-origin")),i=w(r,"--events"),l=w(r,"--screenshot"),h=w(r,"--video"),d=w(r,"--video-duration-ms"),S=w(r,"--owner"),p=w(r,"--repo"),we=fe(r,"--open");(S&&!p||!S&&p)&&(console.error(" --owner and --repo must be provided together"),process.exit(1)),!i&&!h&&(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 flow --preview` instead of uploading a bundle-only snapshot."),process.exit(1));let J=fe(r,"--assets-only"),be=se(r,{stripBooleanFlags:[],stripValueFlags:[]}),b=ie(be),c,K=[],y=[],A=null;try{if(c=await B(b,'(typeof window.__sootsimCaptureBundle === "function") ? window.__sootsimCaptureBundle() : null'),c?.bundleUrl){let n=new URL(c.bundleUrl).origin,[a,C]=await Promise.all([B(b,`(window.__sootsimPreviewRecorder?.list?.(${JSON.stringify(n)}) || [])`),B(b,`(async () => {
43
+ const list = window.__sootsimListWorkerFetchRecorder
44
+ return typeof list === 'function'
45
+ ? await list(${JSON.stringify(n)})
46
+ : []
47
+ })()`)]);K=G([...a,...C]).filter(u=>{try{return!new URL(u.url).pathname.startsWith("/api/")}catch{return!0}});let $=await B(b,`(async () => {
48
+ const rec = window.__sootsimPreviewRecorder
49
+ const workerList = window.__sootsimListWorkerFetchRecorder
50
+ return {
51
+ main: rec?.list ? rec.list() : [],
52
+ worker: typeof workerList === 'function' ? await workerList() : [],
53
+ }
54
+ })()`),R=($?G([...$.main,...$.worker]):[]).filter(u=>{try{return new URL(u.url).origin!==n}catch{return!1}}),U=R.length>0?{count:R.length,totalBytes:R.reduce((u,x)=>u+(x.size||0),0)}:null;if(U&&U.count>0){console.log(` ${U.count} recorded cross-origin responses (${(U.totalBytes/1024).toFixed(1)} KiB)`);let u=await B(b,`(async () => {
55
+ const rec = window.__sootsimPreviewRecorder
56
+ const workerDump = window.__sootsimDumpWorkerFetchRecorder
57
+ const bundleUrl = ${JSON.stringify(c.bundleUrl)}
58
+ const keep = (r) => {
59
+ try {
60
+ const u = new URL(r.url)
61
+ if (u.origin !== ${JSON.stringify(n)}) return true
62
+ // bundle-origin api responses came from the rewritten
63
+ // /__app-api proxy at record time (re-keyed by the
64
+ // recorder's unwrap step). they need bodies attached the
65
+ // same way as cross-origin records \u2014 direct re-fetch from
66
+ // the dev server lacks the bundle's session cookies.
67
+ if (r.url !== bundleUrl && u.pathname.startsWith('/api/')) return true
68
+ return false
69
+ } catch { return false }
70
+ }
71
+ return {
72
+ main: rec?.dump ? rec.dump().filter(keep) : [],
73
+ worker: typeof workerDump === 'function'
74
+ ? (await workerDump()).filter(keep)
75
+ : [],
76
+ }
77
+ })()`);if(y=G([...u.main,...u.worker]),J){let x=y.length;y=y.filter(q=>ge(q.contentType));let W=U.totalBytes-y.reduce((q,Oe)=>q+(Oe.size||0),0);console.log(` --assets-only: kept ${y.length}/${x} records (dropped ${(W/1024).toFixed(1)} KiB of API responses)`)}}}c?.transformedBundle&&(A=await We(b,c.transformedBundle.byteLength))}finally{b.close()}c||(console.error(" could not read bundle snapshot \u2014 is sootsim running and is the bundle loaded?"),process.exit(2)),c.bundleUrl||(console.error(` no ?bundle= URL on the current sootsim tab.
78
+ open the app you want to share first (e.g. sootsim open 8082), then run upload.`),process.exit(2));let f,F=!1;if(A!==null)f=new TextEncoder().encode(A),F=!0,console.log(` using post-transform bundle: ${(f.byteLength/1024).toFixed(1)} KiB`);else{let n=Ce(c.bundleUrl);n!==c.bundleUrl&&console.log(" forcing lazy=false for self-contained bundle"),console.log(` capturing: ${n}`),f=await he(n),console.log(` main bundle: ${(f.byteLength/1024).toFixed(1)} KiB`)}let k=K.filter(n=>n.url!==c.bundleUrl);J&&(k=k.filter(n=>ge(n.contentType))),console.log(` fetching ${k.length} extra files\u2026`);let E=(await Promise.all(k.map(async n=>{try{let a=await he(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),ve=E.reduce((n,a)=>n+a.bytes.byteLength,0);console.log(` ${E.length} extra files: ${(ve/1024).toFixed(1)} KiB`);let v;i&&(v=D(i));let g;l&&(g=D(l),console.log(` attaching screenshot: ${(g.byteLength/1024).toFixed(1)} KiB`));let m,L,Y;if(h){if(m=D(h),L=h.endsWith(".mp4")?"video/mp4":h.endsWith(".gif")?"image/gif":"video/webm",d){let n=Number(d);(!Number.isFinite(n)||n<=0)&&(console.error(` invalid --video-duration-ms: ${d}`),await T(),process.exit(1)),Y=Math.round(n)}console.log(` attaching flow video: ${(m.byteLength/1024).toFixed(1)} KiB (${L})`)}let P=ae(),I=ce(P),Ue=ne();re({event:"preview_upload_started",identity:{userId:P?.kind==="session"?Ue?.user?.id??null:null,repoId:I?.repoId??null,installationId:I?.installationId??null},properties:{origin:o,hasAuth:!!P,authMode:P?.kind??"none",bundleBytes:f.byteLength,isTransformed:F,extraFiles:E.length,recordedFetches:y.length,hasEvents:!!v,hasScreenshot:!!g,hasVideo:!!m}}),P||(console.error(" preview uploads need auth."),console.error(" set SOOTSIM_API_KEY=sk_sootsim_..., run `sootsim login`, or use the soot github runner."),await T(),process.exit(1));let Te=le(P),Be=(()=>{try{return new URL(c.bundleUrl).origin}catch{return null}})(),Q=(n,a,C,$,te,R,U,u)=>{let x=de(R),W=x?pe(n):n;return{url:a,urlhash:C,method:$,bodyHash:te,requestVaryHash:u,contentType:R,responseHeaders:U,bytes:W,encoding:x?"gzip":void 0}},M=[...E.map(n=>Q(n.bytes,n.url,n.urlhash,"GET","-",n.contentType,n.responseHeaders,n.requestVaryHash)),...y.map(n=>Q(Buffer.from(n.bodyBase64,"base64"),n.url,n.urlhash,n.method||"GET",n.bodyHash||"-",n.contentType,n.responseHeaders,n.requestVaryHash))],H=pe(f),Pe=Ee("sha256").update(f).digest("hex");console.log(` bundle raw=${(f.byteLength/1024).toFixed(1)} KiB gz=${(H.byteLength/1024).toFixed(1)} KiB`);let Ie={contentHash:Pe,bundleSizeBytes:f.byteLength,bundleContentType:Ne(c.bundleUrl),bundleEncoding:"gzip",bundleOrigin:Be,entry:c.entry,isTransformed:F,deviceSpec:c.deviceSpec,installationId:I?.installationId??void 0,repoId:I?.repoId,owner:S??I?.owner,repo:p??I?.repo,files:M.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:v?{sizeBytes:v.byteLength}:void 0,snapshots:g?[{id:"landing",label:"Landing",kind:"landing",t:0,contentType:"image/png",sizeBytes:g.byteLength}]:void 0,flowVideo:m&&L?{sizeBytes:m.byteLength,contentType:L,durationMs:Y}:void 0},X=new Map;for(let n of M)X.set(n.urlhash,n.bytes);let Z=new Map;g&&Z.set("landing",g);let Re=Date.now(),_=H.byteLength;for(let n of M)_+=n.bytes.byteLength;v&&(_+=v.byteLength),g&&(_+=g.byteLength),m&&(_+=m.byteLength);let xe=`${O(o)}/api/preview/upload/init`;console.log(` init: ${xe}`);let N;try{let n=await ue({originBase:o,initBody:Ie,bundleBytes:H,filesByHash:X,extras:{eventsBytes:v,videoBytes:m,snapshotBytes:Z},authHeader:Te,concurrency:16});N=n.finalize;let a=1+n.init.files.length+(n.init.events?1:0)+n.init.snapshots.length+(n.init.flowVideo?1:0);console.log(` PUT ${a} objects in ${Date.now()-Re}ms (${(_/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 T(),process.exit(1)),a.status===402&&(console.error(` ${Le(a.responseText)??"preview uploads require Personal, Team, or an active trial \u2014 upgrade from the billing dialog."}`),await T(),process.exit(1)),console.error(` ${a.message??`${a.phase??"upload"} failed: ${String(n)}`}`),await T(),process.exit(1)}let ee=`${s}${N.url}`;console.log(`
79
+ stored ${N.filesStored??0} extra files`),console.log(` preview: ${ee}`),we&&await oe(ee),await T()}export{ze as a,Me as b,nt as c};
@@ -1,7 +1,7 @@
1
- /*! sootsim v0.1.82 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
- import{a as l}from"./chunk-O3AOQP3V.js";import{E as c,F as m,g as p,i as h,z as w}from"./chunk-PYDAVGCZ.js";import{closeSync as v,existsSync as f,openSync as P,readSync as S,statSync as g}from"fs";import{homedir as k}from"os";import{resolve as T}from"path";import{WebSocket as D}from"ws";var E=6e4;async function L(){let t=w();if(t&&f(h(t)))return;console.log(" first run \u2014 installing sootsim engine runtime (~6 MB)...");let{runRuntime:e}=await import("./runtime-AZKHZHJ4.js");await e(["install"],{})}function I(t,e){return x(t)??e??l()}async function $(t=l(),e=E){if(await u(t,250)||await u(t,1500))return;let n=c();if(n&&m(n)){if(n.bootstrapping===!0&&(await b(e),await u(n.bridgePort,500)))return;throw new Error(`sootsim daemon lockfile is fresh (port ${n.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`)}if(p())throw new Error(`sootsim bridge daemon is not running on port ${t}.
1
+ /*! sootsim v0.1.84 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as l}from"./chunk-XQ2OBHBE.js";import{E as c,F as m,g as p,i as h,z as w}from"./chunk-D4HUVLZR.js";import{closeSync as v,existsSync as f,openSync as P,readSync as S,statSync as g}from"fs";import{homedir as k}from"os";import{resolve as T}from"path";import{WebSocket as D}from"ws";var E=6e4;async function L(){let t=w();if(t&&f(h(t)))return;console.log(" first run \u2014 installing sootsim engine runtime (~6 MB)...");let{runRuntime:e}=await import("./runtime-EEBX7CFV.js");await e(["install"],{})}function I(t,e){return x(t)??e??l()}async function $(t=l(),e=E){if(await u(t,250)||await u(t,1500))return;let n=c();if(n&&m(n)){if(n.bootstrapping===!0&&(await b(e),await u(n.bridgePort,500)))return;throw new Error(`sootsim daemon lockfile is fresh (port ${n.bridgePort}) but the bridge is not reachable. run \`sootsim daemon restart\` or \`sootsim daemon uninstall\`.`)}if(p())throw new Error(`sootsim bridge daemon is not running on port ${t}.
3
3
  dev checkouts skip the auto-install of the persistent launchd / systemd
4
4
  agent. start the daemon manually in another shell with:
5
5
  bun sootsim server
6
- (set SOOTSIM_FORCE_DAEMON_INSTALL=1 to allow auto-install from this repo.)`);console.log(" registering sootsim bridge daemon...");let{daemonInstall:o}=await import("./daemon-V5NLDTSB.js");try{await o({port:t,force:!0})}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`${s}
6
+ (set SOOTSIM_FORCE_DAEMON_INSTALL=1 to allow auto-install from this repo.)`);console.log(" registering sootsim bridge daemon...");let{daemonInstall:o}=await import("./daemon-ZUMF53YB.js");try{await o({port:t,force:!0})}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`${s}
7
7
  if this keeps failing, run \`sootsim daemon uninstall\` and retry, or run \`sootsim server\` in a persistent shell as a workaround.`)}console.log(" waiting for runtime to come online...");let i=process.platform==="darwin"?B():null;try{await b(e);let r=Date.now()+5e3;for(;Date.now()<r;){if(await u(t,500))return;await new Promise(s=>setTimeout(s,200))}throw new Error(`daemon registered but the bridge never bound on port ${t} \u2014 see ${d()} (mac) or \`journalctl --user -u sootsim-server\` (linux).`)}finally{i?.stop()}}async function C(t=l()){await L(),await $(t)}function x(t){for(let e=0;e<t.length;e++){let n=t[e];if((n==="--port"||n==="-p")&&t[e+1]){let o=Number(t[e+1]);return Number.isFinite(o)?o:void 0}if(n.startsWith("--port=")){let o=Number(n.slice(7));return Number.isFinite(o)?o:void 0}}}function u(t,e){return new Promise(n=>{let o=new D(`ws://127.0.0.1:${t}`,{handshakeTimeout:e}),i=!1,r=s=>{if(!i){i=!0;try{o.close()}catch{}n(s)}};o.once("open",()=>r(!0)),o.once("error",()=>r(!1)),setTimeout(()=>r(!1),e)})}async function b(t){let e=Date.now()+t,n;for(;Date.now()<e;){let o=c();if(o&&m(o)){if(o.bootstrapping!==!0)return;o.bootstrapping!==n&&(n=o.bootstrapping)}await new Promise(i=>setTimeout(i,250))}throw new Error(`daemon did not finish bootstrapping within ${Math.round(t/1e3)}s \u2014 check ${d()} (mac) or \`journalctl --user -u sootsim-server\` (linux).`)}function d(){return T(k(),"Library/Logs/sootsim/server.err.log")}function B(){let t=d(),e=0;try{f(t)&&(e=g(t).size)}catch{}let n=!1,o=()=>{if(!n){try{if(f(t)){let i=g(t).size;if(i>e){let r=Buffer.alloc(i-e),s=P(t,"r");try{S(s,r,0,r.length,e)}finally{v(s)}e=i;for(let y of r.toString("utf8").split(/\r?\n/)){let a=y.trim();a&&(a.startsWith("sootsim:")||a.startsWith("sootsim "))&&console.log(` ${a}`)}}else i<e&&(e=i)}}catch{}setTimeout(o,250)}};return o(),{stop:()=>{n=!0}}}export{L as a,I as b,$ as c,C as d};