peachsim 0.1.2529 → 0.1.2531

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 (137) hide show
  1. package/cli/bridge-flow-runner.ts +62 -115
  2. package/cli/commands/flow.ts +72 -29
  3. package/cli/commands/inspect/settling.ts +17 -0
  4. package/cli/commands/test.ts +19 -14
  5. package/cli/outbound-endpoints.ts +1 -1
  6. package/dist-lib/agent-daemon-client.cjs +1 -1
  7. package/dist-lib/agent-events.cjs +1 -1
  8. package/dist-lib/attached-projects.cjs +1 -1
  9. package/dist-lib/auth/shared-session.cjs +1 -1
  10. package/dist-lib/backend-origin.cjs +1 -1
  11. package/dist-lib/beta.cjs +1 -1
  12. package/dist-lib/beta.mjs +2 -2
  13. package/dist-lib/bridge-constants.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.mjs +5 -5
  16. package/dist-lib/bridge-contract.cjs +1 -1
  17. package/dist-lib/bridge-contract.mjs +3 -3
  18. package/dist-lib/bundle-channel.cjs +25 -11
  19. package/dist-lib/capture-contract.cjs +1 -1
  20. package/dist-lib/capture-contract.mjs +3 -3
  21. package/dist-lib/cloud-contract.cjs +1 -1
  22. package/dist-lib/cloud-contract.mjs +3 -3
  23. package/dist-lib/cloud-test-args.cjs +1 -1
  24. package/dist-lib/cloud-test-args.mjs +2 -2
  25. package/dist-lib/cloud.cjs +1 -1
  26. package/dist-lib/cloud.mjs +7 -7
  27. package/dist-lib/config.cjs +1 -1
  28. package/dist-lib/config.mjs +5 -5
  29. package/dist-lib/detox/index.cjs +17 -2
  30. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  31. package/dist-lib/esm-chunks/{acorn-DP76I5LX.mjs → acorn-NHWX2J24.mjs} +3 -3
  32. package/dist-lib/esm-chunks/{chunk-6Z7IRZOI.mjs → chunk-35N2TDU4.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-KVE5PEF7.mjs → chunk-4EBD4OKW.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-B2AUMFHR.mjs → chunk-4KTLY5JC.mjs} +5 -5
  35. package/dist-lib/esm-chunks/{chunk-YMJXYR5V.mjs → chunk-4OMQ2R5V.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-6RFG5TBM.mjs → chunk-6IEHVC3Z.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-LIHP4WC5.mjs → chunk-7CZNR5FB.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-XB5NMNMP.mjs → chunk-AN4HGYLM.mjs} +7 -6
  39. package/dist-lib/esm-chunks/{chunk-ZH3DACJC.mjs → chunk-CGW4JC44.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-TTSPRDG5.mjs → chunk-D4NCFDNF.mjs} +4 -4
  41. package/dist-lib/esm-chunks/{chunk-4ESBMS7N.mjs → chunk-EQRWIYYK.mjs} +2 -2
  42. package/dist-lib/esm-chunks/{chunk-FJQ7PIGT.mjs → chunk-F52OCOPH.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-GHQDA4Q6.mjs → chunk-GKJ2T3TK.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-NCT2R5UW.mjs → chunk-H4CMYNNG.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-G7LSGLNN.mjs → chunk-INLBW6NG.mjs} +3 -3
  46. package/dist-lib/esm-chunks/{chunk-COT5BNBM.mjs → chunk-LLPNDBX5.mjs} +30 -14
  47. package/dist-lib/esm-chunks/{chunk-DQKUZ34S.mjs → chunk-PBWV4H5F.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-RXUKY2DH.mjs → chunk-ROJ76CJT.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-UY744LUK.mjs → chunk-SBKP3U5X.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-N6JP6ZEK.mjs → chunk-SUHGSVF2.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{chunk-N5IOZ4Y2.mjs → chunk-UUWNV4RM.mjs} +1 -1
  52. package/dist-lib/esm-chunks/{chunk-7JPE27MR.mjs → chunk-WLZGRQB5.mjs} +1 -1
  53. package/dist-lib/esm-chunks/{metro-layout-parser-YENXVDM2.mjs → metro-layout-parser-K5R2NP2H.mjs} +3 -3
  54. package/dist-lib/esm-chunks/{swift-package-prebuilt-VJCKF5Z5.mjs → swift-package-prebuilt-FET7FKFD.mjs} +10 -10
  55. package/dist-lib/esm-chunks/{swift-sdk-app-module-ISPCBQYV.mjs → swift-sdk-app-module-JQOFDB45.mjs} +15 -15
  56. package/dist-lib/esm-chunks/{swift-sdk-image-4BCVFTGO.mjs → swift-sdk-image-M3EDI6PV.mjs} +13 -13
  57. package/dist-lib/esm-chunks/{swift-sdk-image-producer-JWFPWPYM.mjs → swift-sdk-image-producer-ETQMD57W.mjs} +4 -4
  58. package/dist-lib/expo-swift-bundle.cjs +23 -9
  59. package/dist-lib/expo-swift-metadata.cjs +1 -1
  60. package/dist-lib/expo-swift-metadata.mjs +7 -7
  61. package/dist-lib/home-paths.cjs +1 -1
  62. package/dist-lib/host/bridge-host.cjs +25 -11
  63. package/dist-lib/host/fetch-proxy-handler.cjs +5 -5
  64. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  65. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  66. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  67. package/dist-lib/host/websocket-proxy.cjs +1 -1
  68. package/dist-lib/index.cjs +16 -1
  69. package/dist-lib/kotlin-host.cjs +1 -1
  70. package/dist-lib/menu.cjs +1 -1
  71. package/dist-lib/menu.mjs +3 -3
  72. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  73. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  74. package/dist-lib/metro-production-bundle.cjs +1 -1
  75. package/dist-lib/metro-production-bundle.mjs +4 -4
  76. package/dist-lib/native-app-identity-project.cjs +2 -2
  77. package/dist-lib/native-app-identity-project.mjs +15 -15
  78. package/dist-lib/native-app-identity.cjs +1 -1
  79. package/dist-lib/native-app-identity.mjs +6 -6
  80. package/dist-lib/native-firebase-metadata.cjs +1 -1
  81. package/dist-lib/native-firebase-metadata.mjs +3 -3
  82. package/dist-lib/pdfium-raster.cjs +1 -1
  83. package/dist-lib/pdfium-raster.mjs +2 -2
  84. package/dist-lib/plist.cjs +1 -1
  85. package/dist-lib/plist.mjs +3 -3
  86. package/dist-lib/profiles.cjs +1 -1
  87. package/dist-lib/public-brand.cjs +1 -1
  88. package/dist-lib/public-origins-lib-esm.json +79 -79
  89. package/dist-lib/public-origins-lib.json +71 -69
  90. package/dist-lib/react-native-host-modules.cjs +1 -1
  91. package/dist-lib/react-native-host-modules.mjs +2 -2
  92. package/dist-lib/reap-browser.cjs +1 -1
  93. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  94. package/dist-lib/sdk.cjs +16 -1
  95. package/dist-lib/sdk.mjs +22 -7
  96. package/dist-lib/skills.cjs +117 -107
  97. package/dist-lib/swift-compile.cjs +21 -7
  98. package/dist-lib/swift-compile.mjs +10 -10
  99. package/dist-lib/swift-package.cjs +1 -1
  100. package/dist-lib/swift-package.mjs +3 -3
  101. package/dist-lib/swift-submit.cjs +1 -1
  102. package/dist-lib/swift-submit.mjs +5 -5
  103. package/dist-lib/swift-svg-raster.cjs +1 -1
  104. package/dist-lib/swift-svg-raster.mjs +2 -2
  105. package/dist-lib/swift-toolchain.cjs +1 -1
  106. package/dist-lib/swift.cjs +1 -1
  107. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  108. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  109. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  110. package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
  111. package/dist-lib/vendor/acorn.cjs +1 -1
  112. package/dist-lib/vendor/bplist-parser.cjs +1 -1
  113. package/dist-lib/vendor/ignore.cjs +1 -1
  114. package/dist-lib/vendor/magic-string.cjs +1 -1
  115. package/dist-lib/vendor/plist.cjs +1 -1
  116. package/dist-lib/vendor/smol-toml.cjs +1 -1
  117. package/dist-lib/vendor/stream-json.cjs +1 -1
  118. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  119. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  120. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  121. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  122. package/dist-lib/vendor/sucrase.cjs +1 -1
  123. package/dist-lib/vendor/terser.cjs +1 -1
  124. package/dist-lib/vendor/valibot.cjs +1 -1
  125. package/dist-lib/vendor/ws.cjs +1 -1
  126. package/dist-lib/vendor/zod.cjs +1 -1
  127. package/dist-lib/worklet-executable.cjs +1 -1
  128. package/dist-lib/worklet-executable.mjs +3 -3
  129. package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +62 -0
  130. package/dist-types/packages/peach-engine/src/render-worker/shellScrollContract.d.ts +1 -1
  131. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
  132. package/kotlin/sdk.tar.gz +0 -0
  133. package/package.json +1 -1
  134. package/runtime-companion.json +1 -1
  135. package/src/swift-sdk-app-module.ts +2 -5
  136. package/src/swift-sdk-image.ts +2 -4
  137. package/src/swift-wasm-prune.ts +17 -1
@@ -2,15 +2,14 @@ import * as fs from 'fs'
2
2
  import * as path from 'path'
3
3
  import {
4
4
  isTextInputEditCommand,
5
- PEACH_RELOAD_APP_BRIDGE_PATH,
5
+ maestroSelectorMatcher,
6
6
  type TextInputEditCommand,
7
7
  } from '@peach/globals'
8
- import { maestroSelectorMatcher } from '@peach/globals'
9
8
  import {
10
9
  REQUIRED_IDENTICAL_FLOW_FRAMES,
11
10
  framesIdentical,
12
11
  } from '../detox/frame-identity.cjs'
13
- import { devices, type DeviceModel } from '../src/device-catalog.ts'
12
+ import { devices, listDeviceModels, type DeviceModel } from '../src/device-catalog.ts'
14
13
  import { flowTimeoutScale } from '../src/flow-timeout-scale'
15
14
  import { composeFramedScreenshot } from '../src/screenshots/frame-compose'
16
15
  import { sleep } from '../src/sleep'
@@ -19,6 +18,7 @@ import {
19
18
  prepareStorageSnapshotForShare,
20
19
  ShareableStorageSnapshot,
21
20
  } from '../src/storageSnapshotContract.ts'
21
+ import { isTapSuccess } from './commands/inspect/actions'
22
22
  import {
23
23
  inspectWaitReady,
24
24
  isPeachAccessibilityTree,
@@ -42,14 +42,13 @@ import type {
42
42
  PerformStep,
43
43
  ResetResult,
44
44
  SimNodeRecord,
45
+ SimSemanticQuery,
45
46
  SimSemanticQueryResult,
47
+ SimStateResult,
48
+ SimTapResult,
46
49
  } from '../src/bridge-contract'
47
50
  import type { WsBridge } from './ws-bridge'
48
- import type {
49
- PeachAccessibilityNode,
50
- SootSimReplayTarget,
51
- SootSimTapResult,
52
- } from '@peach/globals'
51
+ import type { PeachAccessibilityNode, SootSimReplayTarget } from '@peach/globals'
53
52
  import type {
54
53
  SootSimExternalAppLifecycleOptions,
55
54
  SootSimLaunchArguments,
@@ -1220,26 +1219,14 @@ export class SootSimBridgeFlowRunner {
1220
1219
  }) as Promise<T>
1221
1220
  }
1222
1221
 
1222
+ private async query(query: SimSemanticQuery): Promise<SimSemanticQueryResult> {
1223
+ return this.bridge.send({ type: 'query', simId: this.opts.simId, query })
1224
+ }
1225
+
1223
1226
  private async screenBounds() {
1224
- const snapshot = await this.callTest<Record<string, unknown> | null>(
1225
- 'getSurfaceMetricsSnapshot',
1226
- )
1227
- const window = snapshot?.window
1228
- if (
1229
- !window ||
1230
- typeof window !== 'object' ||
1231
- !('width' in window) ||
1232
- !('height' in window) ||
1233
- typeof window.width !== 'number' ||
1234
- typeof window.height !== 'number' ||
1235
- !Number.isFinite(window.width) ||
1236
- !Number.isFinite(window.height) ||
1237
- window.width <= 0 ||
1238
- window.height <= 0
1239
- ) {
1240
- throw new Error('live screen dimensions are unavailable')
1241
- }
1242
- return { x: 0, y: 0, width: window.width, height: window.height }
1227
+ const { screen } = await this.query({ kind: 'screen' })
1228
+ if (!screen) throw new Error('live screen dimensions are unavailable')
1229
+ return { x: 0, y: 0, width: screen.width, height: screen.height }
1243
1230
  }
1244
1231
 
1245
1232
  // ordered input batch executed inside the page in one round-trip; the
@@ -1576,11 +1563,7 @@ export class SootSimBridgeFlowRunner {
1576
1563
  }
1577
1564
 
1578
1565
  private async captureAccessibilityTree(): Promise<PeachAccessibilityNode[]> {
1579
- const tree = await this.evaluate(`(async () => {
1580
- const test = globalThis.__sootsimTest
1581
- if (!test || typeof test.captureAccessibilityTree !== 'function') throw new Error('engine accessibility snapshot is unavailable')
1582
- return await test.captureAccessibilityTree()
1583
- })()`)
1566
+ const tree = (await this.query({ kind: 'accessibility' })).accessibility
1584
1567
  if (!isPeachAccessibilityTree(tree))
1585
1568
  throw new Error('engine returned an invalid accessibility snapshot')
1586
1569
  return tree
@@ -1847,29 +1830,23 @@ export class SootSimBridgeFlowRunner {
1847
1830
  candidates: T[],
1848
1831
  ): Promise<T | null> {
1849
1832
  if (candidates.length < 2) return candidates[0] ?? null
1850
- const nodeIds = candidates.map((node) => node.nodeId)
1851
- const index = await this.evaluate<number>(`(async () => {
1852
- const test = globalThis.__sootsimTest
1853
- for (const [index, nodeId] of ${JSON.stringify(nodeIds)}.entries()) {
1854
- if (typeof nodeId !== 'number') continue
1855
- const resolved = await test.resolveTapTarget(nodeId)
1856
- if (!resolved) continue
1857
- const verification = await test.verifyTapTargetAt(resolved.cx, resolved.cy, {
1858
- nodeId: resolved.target.nodeId,
1859
- })
1860
- if (verification.requestedTargetMatched === true) return index
1861
- }
1862
- return -1
1863
- })()`)
1864
- return candidates[index] ?? candidates[0] ?? null
1833
+ for (const candidate of candidates) {
1834
+ if (typeof candidate.nodeId !== 'number') continue
1835
+ const resolved = await this.resolveTapTarget(candidate.nodeId)
1836
+ if (!resolved) continue
1837
+ const { hit } = await this.query({
1838
+ kind: 'hitTest',
1839
+ x: resolved.cx,
1840
+ y: resolved.cy,
1841
+ nodeId: resolved.target.nodeId,
1842
+ })
1843
+ if (hit?.requestedTargetMatched === true) return candidate
1844
+ }
1845
+ return candidates[0] ?? null
1865
1846
  }
1866
1847
 
1867
1848
  private async resolveTapTarget(nodeId: number) {
1868
- return this.evaluate<any>(`(async () => {
1869
- const test = globalThis.__sootsimTest
1870
- if (!test?.resolveTapTarget) return null
1871
- return await test.resolveTapTarget(${nodeId})
1872
- })()`)
1849
+ return (await this.query({ kind: 'tapTarget', nodeId })).tapTarget ?? null
1873
1850
  }
1874
1851
 
1875
1852
  private async activatePressTarget(
@@ -1878,43 +1855,33 @@ export class SootSimBridgeFlowRunner {
1878
1855
  x: number,
1879
1856
  y: number,
1880
1857
  ) {
1881
- const replayTarget: ReplayTapTarget = opts.id
1858
+ const target: ReplayTapTarget = opts.id
1882
1859
  ? { id: opts.id, testID: opts.id, text: null }
1883
1860
  : { id: null, testID: null, text: opts.text ?? null }
1884
- return this.evaluate<any>(`(async () => {
1885
- const test = globalThis.__sootsimTest
1886
- if (!test) return null
1887
- let point = { x: ${x}, y: ${y} }
1888
- const resolved = await test.resolveTapTarget(${nodeId})
1889
- if (resolved && Number.isFinite(resolved.cx) && Number.isFinite(resolved.cy)) {
1890
- point = { x: resolved.cx, y: resolved.cy }
1891
- }
1892
- const direct = await test.activatePressAt(point.x, point.y, ${nodeId})
1893
- if (direct?.ok) {
1894
- globalThis.dispatchEvent(
1895
- new CustomEvent('sootsim:agentAction', {
1896
- detail: { type: 'tap', x: point.x, y: point.y, target: ${JSON.stringify(
1897
- replayTarget,
1898
- )} },
1899
- }),
1900
- )
1901
- }
1902
- return direct || null
1903
- })()`)
1861
+ const resolved = await this.resolveTapTarget(nodeId)
1862
+ const point =
1863
+ resolved && Number.isFinite(resolved.cx) && Number.isFinite(resolved.cy)
1864
+ ? { x: resolved.cx, y: resolved.cy }
1865
+ : { x, y }
1866
+ return (
1867
+ await this.perform([
1868
+ { type: 'activatePress', x: point.x, y: point.y, nodeId, target },
1869
+ ])
1870
+ ).steps[0]
1904
1871
  }
1905
1872
 
1906
1873
  private async tap(
1907
1874
  x: number,
1908
1875
  y: number,
1909
1876
  target?: ReplayTapTarget,
1910
- ): Promise<SootSimTapResult | null> {
1877
+ ): Promise<SimTapResult | null> {
1911
1878
  return (await this.bridge.send({
1912
1879
  type: 'tap',
1913
1880
  simId: this.opts.simId,
1914
1881
  x,
1915
1882
  y,
1916
1883
  target,
1917
- })) as SootSimTapResult | null
1884
+ })) as SimTapResult | null
1918
1885
  }
1919
1886
 
1920
1887
  private async longPress(
@@ -1936,10 +1903,7 @@ export class SootSimBridgeFlowRunner {
1936
1903
  // the engine's inspect geometry revision: equal readings bracket a span in
1937
1904
  // which no tree, layout, scroll or prop write could move any element.
1938
1905
  private async geometryRevision(): Promise<string | null> {
1939
- const revision = await this.evaluate(
1940
- `(async () => globalThis.__sootsimTest?.getGeometryRevision?.())()`,
1941
- )
1942
- return typeof revision === 'string' ? revision : null
1906
+ return (await this.query({ kind: 'geometryRevision' })).revision ?? null
1943
1907
  }
1944
1908
 
1945
1909
  private async waitForElement(
@@ -2119,7 +2083,7 @@ export class SootSimBridgeFlowRunner {
2119
2083
  }
2120
2084
  if (hit?.requestedTargetMatched === false)
2121
2085
  throw new Error(`tapOn refused: ${JSON.stringify(hit)}`)
2122
- if (hit?.hit === true) {
2086
+ if (isTapSuccess(hit)) {
2123
2087
  await repeatTaps(tappedAtMs, () => this.tap(cx, cy, replayTarget))
2124
2088
  await this.waitForAppToSettle()
2125
2089
  if (!current.isTextInput) return
@@ -2270,12 +2234,9 @@ export class SootSimBridgeFlowRunner {
2270
2234
  'inputText: no focused TextInput; tap the input and wait for focus before typing',
2271
2235
  )
2272
2236
  }
2273
- await this.bridge.send({
2274
- type: 'keyboard',
2275
- simId: this.opts.simId,
2276
- action: 'type',
2277
- text,
2278
- })
2237
+ const typed = await this.perform([{ type: 'type', text }])
2238
+ if (!typed.ok)
2239
+ throw new Error(`inputText failed: ${typed.steps[0]?.error ?? 'not typed'}`)
2279
2240
  await sleep(200)
2280
2241
  }
2281
2242
 
@@ -2327,7 +2288,7 @@ export class SootSimBridgeFlowRunner {
2327
2288
  const deadline = Date.now() + timeoutMs
2328
2289
  do {
2329
2290
  try {
2330
- const focused = await this.callTest<FocusedTextInputInfo | null>('getFocusedNode')
2291
+ const { focused } = await this.query({ kind: 'focus' })
2331
2292
  if (focused && this.focusedTextInputMatches(focused, expected)) return true
2332
2293
  } catch {
2333
2294
  // bridge hiccup — keep polling within the budget
@@ -2338,12 +2299,7 @@ export class SootSimBridgeFlowRunner {
2338
2299
  }
2339
2300
 
2340
2301
  async pressKey(name: string) {
2341
- await this.bridge.send({
2342
- type: 'keyboard',
2343
- simId: this.opts.simId,
2344
- action: 'press',
2345
- text: name,
2346
- })
2302
+ await this.perform([{ type: 'key', key: name }])
2347
2303
  await sleep(120)
2348
2304
  }
2349
2305
 
@@ -2403,12 +2359,12 @@ export class SootSimBridgeFlowRunner {
2403
2359
  }
2404
2360
 
2405
2361
  private async isKeyboardVisible(): Promise<boolean> {
2406
- const visible = await this.evaluate<boolean>(`(() => {
2407
- const keyboard =
2408
- globalThis.__sootsimKeyboard ?? globalThis.SootSim?.bridges?.keyboard ?? null
2409
- return !!keyboard?.isVisible?.()
2410
- })()`)
2411
- return visible === true
2362
+ const state: SimStateResult = await this.bridge.send({
2363
+ type: 'state',
2364
+ simId: this.opts.simId,
2365
+ stateOptions: { screenshot: false, tree: false, errors: false },
2366
+ })
2367
+ return state.keyboard?.visible === true
2412
2368
  }
2413
2369
 
2414
2370
  async eraseText(count: number) {
@@ -2520,16 +2476,12 @@ export class SootSimBridgeFlowRunner {
2520
2476
  }
2521
2477
 
2522
2478
  private async readCurrentDeviceModel(): Promise<DeviceModel | null> {
2523
- const settings = (await this.bridge.send({
2524
- type: 'call',
2525
- simId: this.opts.simId,
2526
- path: 'SootSim.bridges.settings.get',
2527
- args: [],
2528
- })) as Record<string, unknown> | null
2529
- const model =
2530
- settings && typeof settings.deviceModel === 'string' ? settings.deviceModel : null
2531
- if (!model || !(model in devices)) return null
2532
- return model as DeviceModel
2479
+ const info = (await this.perform([{ type: 'deviceInfo' }])).steps[0]?.value
2480
+ if (typeof info !== 'object' || info === null || !('model' in info)) return null
2481
+ for (const model of listDeviceModels()) {
2482
+ if (devices[model].name === info.model) return model
2483
+ }
2484
+ return null
2533
2485
  }
2534
2486
 
2535
2487
  // the app's console errors and warnings plus failed requests, captured by
@@ -3053,12 +3005,7 @@ export class SootSimBridgeFlowRunner {
3053
3005
 
3054
3006
  private async reloadGuestAppRuntime(options: SootSimExternalAppLifecycleOptions) {
3055
3007
  await this.bridge.send(
3056
- {
3057
- type: 'call',
3058
- simId: this.opts.simId,
3059
- path: PEACH_RELOAD_APP_BRIDGE_PATH,
3060
- args: [options],
3061
- },
3008
+ { type: 'relaunch', simId: this.opts.simId, relaunchOptions: options },
3062
3009
  { timeoutMs: 120000 },
3063
3010
  )
3064
3011
  }
@@ -21,6 +21,7 @@ import {
21
21
  type SootSimFlowProfileResult,
22
22
  type SootSimFlowTraceStep,
23
23
  } from '../bridge-flow-runner'
24
+ import { createCloudBridgeForParsed } from '../cloud-client'
24
25
  import { clearCurrentSimId, readCurrentSimId, saveCurrentSimId } from '../current-sim'
25
26
  import { findDesktopCompanion, notifyDesktopMigration } from '../desktop-companion'
26
27
  import { exportFlowSession } from '../flow-export'
@@ -513,6 +514,27 @@ flow extension:
513
514
  parsedBridgeArgs.wsPort = pinned.port
514
515
  }
515
516
  }
517
+ const cloudBridge = createCloudBridgeForParsed(parsedBridgeArgs)
518
+ const dryRun = args.includes('--dry-run') || args.includes('--no-run')
519
+ if (cloudBridge) {
520
+ const localOnly = [
521
+ (url || targetApp) && 'an app override',
522
+ (openInNewSim || wantElectron) && 'a new simulator window',
523
+ targetDevice && 'a device override',
524
+ targetPosture && 'a posture override',
525
+ dryRun && 'interactive playback',
526
+ preview && '--preview',
527
+ record && !preview && '--record',
528
+ profile && '--profile',
529
+ frontmatter.env?.PEACH_STATUS_BAR_TIME && 'PEACH_STATUS_BAR_TIME',
530
+ ].filter(Boolean)
531
+ if (localOnly.length > 0) {
532
+ console.error(
533
+ ` error: ${localOnly.join(', ')} requires a local simulator. End the remote session with \`peach remote close\` to run locally.`,
534
+ )
535
+ peachExit(1)
536
+ }
537
+ }
516
538
  if (wantElectron) notifyDesktopMigration()
517
539
  if (wantElectron && !findDesktopCompanion({ native: false })) {
518
540
  console.error(
@@ -529,7 +551,7 @@ flow extension:
529
551
  // a saved pin whose bridge has no lockfile names no live world: refuse
530
552
  // promptly instead of adopting whatever listens on the default port. a
531
553
  // --sim flag resolves across lockfile-claimed worlds only, so it stays.
532
- if (requestedSimId && !effectiveOpenInNewSim) {
554
+ if (requestedSimId && !effectiveOpenInNewSim && !cloudBridge) {
533
555
  if (
534
556
  parsedBridgeArgs.simIdSource === 'saved' &&
535
557
  !parsedBridgeArgs.explicitPort &&
@@ -586,7 +608,12 @@ flow extension:
586
608
  // no world to reuse from: skip the probe so an unrelated listener there
587
609
  // stays untouched, and fall through to discovery.
588
610
  let reuseActivePrimary = false
589
- if (!openTarget && !effectiveOpenInNewSim && parsedBridgeArgs.simIdSource === 'none') {
611
+ if (
612
+ !cloudBridge &&
613
+ !openTarget &&
614
+ !effectiveOpenInNewSim &&
615
+ parsedBridgeArgs.simIdSource === 'none'
616
+ ) {
590
617
  const reuseWorldClaimed =
591
618
  parsedBridgeArgs.explicitPort ||
592
619
  worldForBridgePort(parsedBridgeArgs.wsPort) !== null
@@ -612,6 +639,7 @@ flow extension:
612
639
  }
613
640
 
614
641
  if (
642
+ !cloudBridge &&
615
643
  !openTarget &&
616
644
  !reuseActivePrimary &&
617
645
  (effectiveOpenInNewSim || parsedBridgeArgs.simIdSource === 'none')
@@ -719,26 +747,31 @@ flow extension:
719
747
  : 'none'
720
748
  // retain the world open settled on above (or the --base-url pin when no
721
749
  // open ran), or the steps talk to another shell.
722
- const bridge = createBridge(parsedBridgeArgs.wsPort, {
723
- commandTimeoutMs: resolvedBridgeArgs.commandTimeoutMs,
724
- simId: pinnedSimId,
725
- simIdSource: pinnedSimIdSource,
726
- // the shell prints `lockedBy` over the device while the flow drives it.
727
- // without a label that falls back to the cli identity key, which is an
728
- // internal `ENV_VAR:value` string rather than something a viewer reads.
729
- cliLabel: 'maestro test',
730
- leaseScope: 'connection',
731
- })
750
+ const bridge =
751
+ cloudBridge ??
752
+ createBridge(parsedBridgeArgs.wsPort, {
753
+ commandTimeoutMs: resolvedBridgeArgs.commandTimeoutMs,
754
+ simId: pinnedSimId,
755
+ simIdSource: pinnedSimIdSource,
756
+ // the shell prints `lockedBy` over the device while the flow drives it.
757
+ // without a label that falls back to the cli identity key, which is an
758
+ // internal `ENV_VAR:value` string rather than something a viewer reads.
759
+ cliLabel: 'maestro test',
760
+ leaseScope: 'connection',
761
+ })
732
762
  try {
733
763
  let driver: SootSimBridgeFlowRunner
734
764
  const applySimSettings = async () => {
735
- // iOS shows a WKWebView's page itself, so a run presents it live
736
- await bridge.send({
737
- type: 'call',
738
- simId: driver.simId,
739
- path: 'SootSim.bridges.settings.applyRuntime',
740
- args: [{ alwaysShowLiveWebViews: true }],
741
- })
765
+ // iOS shows a WKWebView's page itself, so a run presents it live; a
766
+ // remote simulator has no shell holding that setting.
767
+ if (!cloudBridge) {
768
+ await bridge.send({
769
+ type: 'call',
770
+ simId: driver.simId,
771
+ path: 'SootSim.bridges.settings.applyRuntime',
772
+ args: [{ alwaysShowLiveWebViews: true }],
773
+ })
774
+ }
742
775
  const statusBarTime = frontmatter.env?.PEACH_STATUS_BAR_TIME
743
776
  if (statusBarTime) {
744
777
  if (!/^(?:[1-9]|1[0-2]):[0-5][0-9]$/.test(statusBarTime)) {
@@ -750,7 +783,16 @@ flow extension:
750
783
  code: `globalThis.dispatchEvent(new CustomEvent('sootsim:statusBarOverride', { detail: { time: ${JSON.stringify(statusBarTime)} } }))`,
751
784
  })
752
785
  }
753
- if (targetTheme) {
786
+ if (targetTheme === 'light' || targetTheme === 'dark') {
787
+ await bridge.send({
788
+ type: 'setAppearance',
789
+ simId: driver.simId,
790
+ appearance: targetTheme,
791
+ })
792
+ } else if (targetTheme) {
793
+ // automatic appearance follows the local shell's browser theme
794
+ if (cloudBridge)
795
+ throw new Error('Choose a light or dark theme for a remote simulator.')
754
796
  await bridge.send({
755
797
  type: 'call',
756
798
  simId: driver.simId,
@@ -840,7 +882,7 @@ flow extension:
840
882
  // re-arm the event recorder after every launchApp-with-reload. the
841
883
  // recorder lives in-page state and gets wiped by window.location.reload.
842
884
  onAfterLaunch: async (simId) => {
843
- if (simId) saveCurrentSimId(simId, parsedBridgeArgs.wsPort)
885
+ if (simId && !cloudBridge) saveCurrentSimId(simId, parsedBridgeArgs.wsPort)
844
886
  const deviceChanged = await applySimSettings()
845
887
  if (deviceChanged) await driver.waitForTree(120000)
846
888
  if (await applyPosture()) await driver.waitForTree(120000)
@@ -858,12 +900,14 @@ flow extension:
858
900
  if (slow) driver.stepDelay = slow
859
901
  // live step rail + pause gate in the sim devtools "test" tab, named by the
860
902
  // flow file so the rail identifies what is running.
861
- driver.liveStatus = new FlowLiveStatusReporter(
862
- bridge,
863
- path.basename(flowPath),
864
- flowContent,
865
- () => driver.simId,
866
- )
903
+ if (!cloudBridge) {
904
+ driver.liveStatus = new FlowLiveStatusReporter(
905
+ bridge,
906
+ path.basename(flowPath),
907
+ flowContent,
908
+ () => driver.simId,
909
+ )
910
+ }
867
911
  // maestro default vars + flow-level `env:` frontmatter, defined into the
868
912
  // flow's JS context before the first step (upstream withDefaultEnvVars +
869
913
  // DefineVariablesCommand).
@@ -884,7 +928,6 @@ flow extension:
884
928
  let recordedPreviewSnapshots: FlowSnapshotManifestEntry[] = []
885
929
  let failureBundleDir: string | null = null
886
930
  let exitCode = 0
887
- const dryRun = args.includes('--dry-run') || args.includes('--no-run')
888
931
  const firstStep =
889
932
  typeof steps[0] === 'string' ? normalizeBareStringStep(steps[0]) : steps[0]
890
933
  const startsWithLaunchApp = !!firstStep?.launchApp
@@ -1271,7 +1314,7 @@ flow extension:
1271
1314
  parsedBridgeArgs.commandTimeoutMs,
1272
1315
  [...ownedSimIds],
1273
1316
  )
1274
- } else if (driver.simId && driver.simId !== pinnedSimId) {
1317
+ } else if (!cloudBridge && driver.simId && driver.simId !== pinnedSimId) {
1275
1318
  // `launchApp clearState` rotates the sim id mid-flow (the shell reconnects
1276
1319
  // under a fresh id). the runner tracks that in-memory, but a directory run
1277
1320
  // (`peach test <dir>`) spawns the next flow fresh — it re-reads
@@ -225,6 +225,23 @@ export async function waitForSootsimIdle({
225
225
  transitionTimeoutMs = 4000,
226
226
  stillSince = null,
227
227
  }: WaitForSootsimIdleOptions): Promise<WaitForSootsimIdleResult> {
228
+ // a remote simulator is a headless runtime with no browser compositor for the
229
+ // page script to read; it runs its own readiness passes to quiescence.
230
+ if (bridge.plane === 'cloud') {
231
+ const started = Date.now()
232
+ try {
233
+ await bridge.send({
234
+ type: 'settle',
235
+ simId,
236
+ maxFrames: Math.min(600, Math.max(4, Math.ceil(maxMs / 16))),
237
+ })
238
+ return { elapsed: Date.now() - started, settled: true, blockedBy: '' }
239
+ } catch (error) {
240
+ if (!(error instanceof Error) || !error.message.includes('did not settle'))
241
+ throw error
242
+ return { elapsed: Date.now() - started, settled: false, blockedBy: error.message }
243
+ }
244
+ }
228
245
  let result: any
229
246
  // guest elapsed covers a completed read. this clock is read only when the
230
247
  // bridge throws, so a successful settle does not report host time.
@@ -11,8 +11,7 @@ import { isCloudTestValueFlag, parseCloudTestArgs } from '../../src/cloud-test-a
11
11
  import { rnxPublicBrand } from '../../src/public-brand'
12
12
  import { requireAccount } from '../account-gate'
13
13
  import { authHeaderValue, resolveCliAuth } from '../auth'
14
- import { failureSentence } from '../cloud-client'
15
- import { readCloudSession } from '../cloud-session'
14
+ import { createCloudBridgeForParsed, failureSentence } from '../cloud-client'
16
15
  import {
17
16
  parseCloudTestSidecarPorts,
18
17
  parseLiveDevStackApp,
@@ -1231,20 +1230,20 @@ export async function runTest(
1231
1230
  }
1232
1231
  const maestroVerb =
1233
1232
  verb && MAESTRO_VERBS.has(verb) && !existsSync(resolve(verb)) ? verb : null
1233
+ const bridgeArgs = parseBridgeCliArgs(args, { port: opts.port })
1234
1234
  if (!maestroVerb || !AUTHORING_VERBS.has(maestroVerb) || args.includes('--validate'))
1235
1235
  await requireAccount('test')
1236
- const drivesSimulator =
1237
- maestroVerb !== 'validate' &&
1238
- !args.includes('--validate') &&
1239
- !args.includes('--cloud') &&
1240
- !args.includes('--hosted')
1241
- if (drivesSimulator && readCloudSession()) {
1242
- console.error(
1243
- ' error: peach test cannot run on the remote simulator this folder is using; run `peach close` to end it, and peach test then runs on a local simulator',
1244
- )
1245
- return 1
1246
- }
1247
1236
  if (maestroVerb) {
1237
+ if (
1238
+ maestroVerb !== 'validate' &&
1239
+ maestroVerb !== 'load' &&
1240
+ createCloudBridgeForParsed(bridgeArgs)
1241
+ ) {
1242
+ console.error(
1243
+ ` error: peach test ${maestroVerb} requires a local simulator. End the remote session with \`peach remote close\` to run locally.`,
1244
+ )
1245
+ return 1
1246
+ }
1248
1247
  // the verb leads: the interpreter reads its subcommand from the first slot
1249
1248
  const index = targetIndexFromArgs(args)
1250
1249
  return runMaestro(
@@ -1274,7 +1273,13 @@ export async function runTest(
1274
1273
  return runMaestro(selected.args, opts)
1275
1274
  }
1276
1275
 
1277
- const bridgePort = parseBridgeCliArgs(args, { port: opts.port }).wsPort
1276
+ if (createCloudBridgeForParsed(bridgeArgs)) {
1277
+ console.error(
1278
+ ' error: Detox requires a local simulator here. Run `peach test --cloud` to submit a hosted Detox job, or `peach remote close` to run locally.',
1279
+ )
1280
+ return 1
1281
+ }
1282
+ const bridgePort = bridgeArgs.wsPort
1278
1283
  const appTarget = app ? await resolveTestAppTarget(app, bridgePort) : ''
1279
1284
  const { runDetox } = await import('./detox')
1280
1285
  const detoxArgs = withoutApp(selected.args)
@@ -740,7 +740,7 @@ export const DECLARED_OUTBOUND_CALLS: Record<string, OutboundCallDeclaration> =
740
740
  { category: 'local_development', count: 1 },
741
741
  'packages/peach-engine/src/capture/browser-execution-observer.ts :: websocket :: options.webSocketUrl':
742
742
  { category: 'local_development', count: 1 },
743
- 'packages/peach-engine/src/remote-stream/browser-tenant-proxy.ts :: fetch :: this.config.url':
743
+ 'packages/peach-engine/src/remote-stream/scene-recording.ts :: fetch :: this.host.url':
744
744
  { category: 'remote_display_server', count: 1 },
745
745
  'packages/peach-engine/src/remote-stream/display-socket.ts :: websocket :: url': {
746
746
  category: 'remote_display_server',
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/beta.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/beta.mjs CHANGED
@@ -1,5 +1,5 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
- import "./esm-chunks/chunk-RXUKY2DH.mjs";
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import "./esm-chunks/chunk-ROJ76CJT.mjs";
3
3
 
4
4
  // src/beta.ts
5
5
  var IS_BETA = true;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2529 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2531 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;