peachsim 0.1.2490 → 0.1.2492

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 (140) hide show
  1. package/cli/bridge-flow-runner.ts +190 -167
  2. package/cli/cloud-box-artifact.ts +49 -0
  3. package/cli/cloud-client.ts +7 -2
  4. package/cli/commands/inspect/settling.ts +7 -2
  5. package/cli/commands/platform.ts +7 -1
  6. package/cli/native-input.ts +18 -8
  7. package/dist-lib/agent-daemon-client.cjs +1 -1
  8. package/dist-lib/agent-events.cjs +1 -1
  9. package/dist-lib/attached-projects.cjs +1 -1
  10. package/dist-lib/auth/shared-session.cjs +1 -1
  11. package/dist-lib/backend-origin.cjs +1 -1
  12. package/dist-lib/beta.cjs +1 -1
  13. package/dist-lib/beta.mjs +2 -2
  14. package/dist-lib/bridge-constants.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.mjs +5 -5
  17. package/dist-lib/bridge-contract.cjs +1 -1
  18. package/dist-lib/bridge-contract.mjs +3 -3
  19. package/dist-lib/bundle-channel.cjs +2 -2
  20. package/dist-lib/capture-contract.cjs +1 -1
  21. package/dist-lib/capture-contract.mjs +3 -3
  22. package/dist-lib/cloud-contract.cjs +1 -1
  23. package/dist-lib/cloud-contract.mjs +3 -3
  24. package/dist-lib/cloud-test-args.cjs +1 -1
  25. package/dist-lib/cloud-test-args.mjs +2 -2
  26. package/dist-lib/cloud.cjs +1 -1
  27. package/dist-lib/cloud.mjs +7 -7
  28. package/dist-lib/config.cjs +1 -1
  29. package/dist-lib/config.mjs +5 -5
  30. package/dist-lib/detox/index.cjs +8 -3
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/esm-chunks/{acorn-V3XDEDP6.mjs → acorn-FU2FRHH2.mjs} +3 -3
  33. package/dist-lib/esm-chunks/{chunk-ZMCFZNUO.mjs → chunk-2PXTYLHZ.mjs} +5 -5
  34. package/dist-lib/esm-chunks/{chunk-HEOMLBGO.mjs → chunk-5CBH6U4Z.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-P6RAV46E.mjs → chunk-5D567O3G.mjs} +5 -5
  36. package/dist-lib/esm-chunks/{chunk-3JP3KRAD.mjs → chunk-66G5BBLZ.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-633546VE.mjs → chunk-AYLLC3WV.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-KGUUTG42.mjs → chunk-DDEXJ7N5.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-ZR3V6DY4.mjs → chunk-DIKB4ZTF.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-FLENJWNX.mjs → chunk-HHC6G7P2.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-ISB7UYPO.mjs → chunk-HMFMZEYN.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-MSVSZ66J.mjs → chunk-IOMFLWBI.mjs} +2 -2
  43. package/dist-lib/esm-chunks/{chunk-6J6FWZLQ.mjs → chunk-MA2ZJ77J.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-DCO5CMNF.mjs → chunk-N27ZLCKM.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-N7VZ7VEK.mjs → chunk-PZMRNAME.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-KUFZD2CT.mjs → chunk-QI3ZYNIW.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-E6Q66I6T.mjs → chunk-SUBUXVVR.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-PBEN5WRU.mjs → chunk-WBME7FVJ.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-LATLGHGM.mjs → chunk-WHCH5I3R.mjs} +12 -12
  50. package/dist-lib/esm-chunks/{chunk-HGXXVBJG.mjs → chunk-WXSE2Q5H.mjs} +3 -3
  51. package/dist-lib/esm-chunks/{chunk-6V2ECPE7.mjs → chunk-WZC67JCE.mjs} +1 -1
  52. package/dist-lib/esm-chunks/{chunk-O7GFR7YK.mjs → chunk-XMN5ZUL5.mjs} +4 -4
  53. package/dist-lib/esm-chunks/{chunk-AQ3PGPWE.mjs → chunk-YLQTCLSU.mjs} +1 -1
  54. package/dist-lib/esm-chunks/{metro-layout-parser-JHKSRYFH.mjs → metro-layout-parser-MCDRWEZS.mjs} +3 -3
  55. package/dist-lib/esm-chunks/{swift-package-prebuilt-JX5THTBC.mjs → swift-package-prebuilt-UFSFZOBX.mjs} +10 -10
  56. package/dist-lib/esm-chunks/{swift-sdk-app-module-W6JPOC7Q.mjs → swift-sdk-app-module-G4ILN2V5.mjs} +13 -13
  57. package/dist-lib/esm-chunks/{swift-sdk-image-7IQKWX4J.mjs → swift-sdk-image-VIXRBEVE.mjs} +13 -13
  58. package/dist-lib/esm-chunks/{swift-sdk-image-producer-IFBEHFC5.mjs → swift-sdk-image-producer-CDWJNY67.mjs} +4 -4
  59. package/dist-lib/expo-swift-bundle.cjs +2 -2
  60. package/dist-lib/expo-swift-metadata.cjs +1 -1
  61. package/dist-lib/expo-swift-metadata.mjs +7 -7
  62. package/dist-lib/home-paths.cjs +1 -1
  63. package/dist-lib/host/bridge-host.cjs +5 -4
  64. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  65. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  66. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  67. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  68. package/dist-lib/host/websocket-proxy.cjs +1 -1
  69. package/dist-lib/index.cjs +11 -5
  70. package/dist-lib/kotlin-host.cjs +1 -1
  71. package/dist-lib/menu.cjs +1 -1
  72. package/dist-lib/menu.mjs +3 -3
  73. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  74. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  75. package/dist-lib/metro-production-bundle.cjs +1 -1
  76. package/dist-lib/metro-production-bundle.mjs +4 -4
  77. package/dist-lib/native-app-identity-project.cjs +1 -1
  78. package/dist-lib/native-app-identity-project.mjs +15 -15
  79. package/dist-lib/native-app-identity.cjs +1 -1
  80. package/dist-lib/native-app-identity.mjs +6 -6
  81. package/dist-lib/native-firebase-metadata.cjs +1 -1
  82. package/dist-lib/native-firebase-metadata.mjs +3 -3
  83. package/dist-lib/pdfium-raster.cjs +1 -1
  84. package/dist-lib/pdfium-raster.mjs +2 -2
  85. package/dist-lib/plist.cjs +1 -1
  86. package/dist-lib/plist.mjs +3 -3
  87. package/dist-lib/profiles.cjs +1 -1
  88. package/dist-lib/public-brand.cjs +1 -1
  89. package/dist-lib/public-origins-lib-esm.json +79 -79
  90. package/dist-lib/public-origins-lib.json +69 -69
  91. package/dist-lib/react-native-host-modules.cjs +1 -1
  92. package/dist-lib/react-native-host-modules.mjs +2 -2
  93. package/dist-lib/reap-browser.cjs +1 -1
  94. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  95. package/dist-lib/sdk.cjs +8 -3
  96. package/dist-lib/sdk.mjs +14 -9
  97. package/dist-lib/skills.cjs +168 -186
  98. package/dist-lib/swift-compile.cjs +1 -1
  99. package/dist-lib/swift-compile.mjs +10 -10
  100. package/dist-lib/swift-package.cjs +1 -1
  101. package/dist-lib/swift-package.mjs +3 -3
  102. package/dist-lib/swift-submit.cjs +1 -1
  103. package/dist-lib/swift-submit.mjs +5 -5
  104. package/dist-lib/swift-svg-raster.cjs +1 -1
  105. package/dist-lib/swift-svg-raster.mjs +2 -2
  106. package/dist-lib/swift-toolchain.cjs +1 -1
  107. package/dist-lib/swift.cjs +1 -1
  108. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  109. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  110. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  111. package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
  112. package/dist-lib/vendor/acorn.cjs +1 -1
  113. package/dist-lib/vendor/bplist-parser.cjs +1 -1
  114. package/dist-lib/vendor/ignore.cjs +1 -1
  115. package/dist-lib/vendor/magic-string.cjs +1 -1
  116. package/dist-lib/vendor/plist.cjs +1 -1
  117. package/dist-lib/vendor/smol-toml.cjs +1 -1
  118. package/dist-lib/vendor/stream-json.cjs +1 -1
  119. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  120. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  121. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  122. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  123. package/dist-lib/vendor/sucrase.cjs +1 -1
  124. package/dist-lib/vendor/terser.cjs +1 -1
  125. package/dist-lib/vendor/valibot.cjs +1 -1
  126. package/dist-lib/vendor/ws.cjs +1 -1
  127. package/dist-lib/vendor/zod.cjs +1 -1
  128. package/dist-lib/worklet-executable.cjs +1 -1
  129. package/dist-lib/worklet-executable.mjs +3 -3
  130. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -1
  131. package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -1
  132. package/dist-types/packages/peach-engine/src/render-worker/host.d.ts +2 -1
  133. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +8 -9
  134. package/dist-types/packages/peach-globals/src/index.d.ts +2 -2
  135. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
  136. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +13 -1
  137. package/package.json +1 -1
  138. package/src/bridge-contract.ts +2 -17
  139. package/src/connect.ts +1 -1
  140. package/src/guest-bundle.ts +3 -2
@@ -37,7 +37,13 @@ import {
37
37
  import { MaestroJsContext, scriptConditionIsTruthy } from './maestro-js'
38
38
  import { redactForSharing } from './output-redaction'
39
39
  import { ensureCliRecordingEntitlement } from './recording-access'
40
- import type { PerformResult, PerformStep, ResetResult } from '../src/bridge-contract'
40
+ import type {
41
+ PerformResult,
42
+ PerformStep,
43
+ ResetResult,
44
+ SimNodeRecord,
45
+ SimSemanticQueryResult,
46
+ } from '../src/bridge-contract'
41
47
  import type { WsBridge } from './ws-bridge'
42
48
  import type {
43
49
  PeachAccessibilityNode,
@@ -1645,178 +1651,193 @@ export class SootSimBridgeFlowRunner {
1645
1651
  // (match scoped to a container). a nested selector resolves the same way,
1646
1652
  // and a relative filter holds when ANY match of its anchor satisfies it.
1647
1653
  private async findElementScoped(opts: FlowTargetSelector, preferHittable = false) {
1648
- const screen = await this.screenBounds()
1649
- const candidates = await this.evaluate<any[]>(`(async () => {
1650
- const test = globalThis.__sootsimTest
1651
- if (!test || !test.queryAll) return null
1652
- const selector = ${JSON.stringify(opts)}
1653
- const compile = ${maestroSelectorMatcher.toString()}
1654
- // relative filters need their anchors too; other id selectors only
1655
- // project matching nodes, retaining every duplicate for ordering below.
1656
- // patterns accepting an absent id also need unidentified nodes.
1657
- const idMatcher = selector.id == null ? null : compile(selector.id, 'id')
1658
- const needsAnchors = ['childOf', 'below', 'above', 'leftOf', 'rightOf']
1659
- .some((key) => selector[key] != null)
1660
- const query = idMatcher && !idMatcher(null) && !needsAnchors
1661
- ? { idPattern: { source: idMatcher.source, flags: idMatcher.flags, matchLastSegment: true } }
1662
- : {}
1663
- const all = ((await test.queryAll(query)) || []).filter(
1664
- (n) => n && n.absolutePosition && n.layout,
1654
+ const relativeKeys = ['below', 'above', 'leftOf', 'rightOf'] as const
1655
+ const needsAnchors =
1656
+ opts.childOf != null || relativeKeys.some((key) => opts[key] != null)
1657
+ const recordQuery: Promise<SimSemanticQueryResult> = this.bridge.send({
1658
+ type: 'query',
1659
+ simId: this.opts.simId,
1660
+ query: { kind: 'nodes', id: needsAnchors ? undefined : opts.id },
1661
+ })
1662
+ const [screen, result] = await Promise.all([this.screenBounds(), recordQuery])
1663
+ const all = result.records
1664
+ if (!Array.isArray(all)) throw new Error('engine returned no selector node records')
1665
+ // maestro reads ios frames as integer edges (AXElement.boundsString)
1666
+ const bounds = (n: SimNodeRecord) => {
1667
+ const left = Math.trunc(n.absolutePosition.x)
1668
+ const top = Math.trunc(n.absolutePosition.y)
1669
+ return {
1670
+ x: left,
1671
+ y: top,
1672
+ width: Math.trunc(n.absolutePosition.x + n.layout.width) - left,
1673
+ height: Math.trunc(n.absolutePosition.y + n.layout.height) - top,
1674
+ }
1675
+ }
1676
+ const painted = (n: SimNodeRecord) => (n.visibleFrame?.area ?? 0) > 0
1677
+ // one viewport contract, shared with isOffscreen in
1678
+ // commands/inspect/resolve-target.ts: a center on the edge still takes
1679
+ // a tap, so the edge counts as on screen here too.
1680
+ const centerOnScreen = (n: SimNodeRecord) => {
1681
+ const cx = n.absolutePosition.x + n.layout.width / 2
1682
+ const cy = n.absolutePosition.y + n.layout.height / 2
1683
+ return cx >= 0 && cx <= screen.width && cy >= 0 && cy <= screen.height
1684
+ }
1685
+ const byPosition = (a: SimNodeRecord, b: SimNodeRecord) =>
1686
+ a.absolutePosition.y - b.absolutePosition.y ||
1687
+ a.absolutePosition.x - b.absolutePosition.x
1688
+ const relative = {
1689
+ below: (n: SimNodeRecord, other: SimNodeRecord) => bounds(n).y > bounds(other).y,
1690
+ above: (n: SimNodeRecord, other: SimNodeRecord) => bounds(n).y < bounds(other).y,
1691
+ leftOf: (n: SimNodeRecord, other: SimNodeRecord) => bounds(n).x < bounds(other).x,
1692
+ rightOf: (n: SimNodeRecord, other: SimNodeRecord) => bounds(n).x > bounds(other).x,
1693
+ }
1694
+ const traitFilters = new Map<string, (node: SimNodeRecord) => boolean>([
1695
+ ['TEXT', (node) => node.text != null],
1696
+ [
1697
+ 'SQUARE',
1698
+ (node) => {
1699
+ const frame = bounds(node)
1700
+ return Math.abs(1 - frame.width / frame.height) < 0.03
1701
+ },
1702
+ ],
1703
+ ['LONG_TEXT', (node) => (node.text?.length ?? 0) > 200],
1704
+ ])
1705
+ const matchAll = (raw: FlowTargetSelector | string): SimNodeRecord[] => {
1706
+ const sel = typeof raw === 'string' ? { text: raw } : raw
1707
+ const matchesId = sel.id == null ? null : maestroSelectorMatcher(sel.id, 'id')
1708
+ const matchesText =
1709
+ sel.text == null ? null : maestroSelectorMatcher(sel.text, 'text')
1710
+ let candidates = all.filter(
1711
+ (n) =>
1712
+ (!matchesId || matchesId(n.testID)) &&
1713
+ (!matchesText ||
1714
+ matchesText(n.text) ||
1715
+ matchesText(n.accessibilityLabel) ||
1716
+ matchesText(n.placeholder)),
1665
1717
  )
1666
- // maestro reads ios frames as integer edges (AXElement.boundsString)
1667
- const bounds = (n) => {
1668
- const left = Math.trunc(n.absolutePosition.x)
1669
- const top = Math.trunc(n.absolutePosition.y)
1670
- return {
1671
- x: left,
1672
- y: top,
1673
- width: Math.trunc(n.absolutePosition.x + n.layout.width) - left,
1674
- height: Math.trunc(n.absolutePosition.y + n.layout.height) - top,
1675
- }
1718
+ if (sel.width != null || sel.height != null) {
1719
+ const tolerance = sel.tolerance ?? 0
1720
+ candidates = candidates.filter((n) => {
1721
+ const b = bounds(n)
1722
+ return (
1723
+ (sel.width == null || Math.abs(b.width - sel.width) <= tolerance) &&
1724
+ (sel.height == null || Math.abs(b.height - sel.height) <= tolerance)
1725
+ )
1726
+ })
1676
1727
  }
1677
- const painted = (n) => (n.visibleFrame?.area ?? 0) > 0
1678
- // one viewport contract, shared with isOffscreen in
1679
- // commands/inspect/resolve-target.ts: a center on the edge still takes
1680
- // a tap, so the edge counts as on screen here too.
1681
- const centerOnScreen = (n) => {
1682
- const cx = n.absolutePosition.x + n.layout.width / 2
1683
- const cy = n.absolutePosition.y + n.layout.height / 2
1684
- return cx >= 0 && cx <= ${screen.width} && cy >= 0 && cy <= ${screen.height}
1728
+ for (const trait of sel.traits ? String(sel.traits).split(' ') : []) {
1729
+ const filter = traitFilters.get(trait.replaceAll('-', '_').toUpperCase())
1730
+ if (!filter) throw new Error('unknown selector trait: ' + trait)
1731
+ candidates = candidates.filter(filter)
1685
1732
  }
1686
- const byPosition = (a, b) =>
1687
- a.absolutePosition.y - b.absolutePosition.y ||
1688
- a.absolutePosition.x - b.absolutePosition.x
1689
- const relative = {
1690
- below: (n, other) => bounds(n).y > bounds(other).y,
1691
- above: (n, other) => bounds(n).y < bounds(other).y,
1692
- leftOf: (n, other) => bounds(n).x < bounds(other).x,
1693
- rightOf: (n, other) => bounds(n).x > bounds(other).x,
1733
+ // ios reports isEnabled / isSelected from the accessibility traits
1734
+ // react native derives from accessibilityState
1735
+ if (sel.enabled != null) {
1736
+ candidates = candidates.filter(
1737
+ (n) => !n.accessibilityState?.disabled === sel.enabled,
1738
+ )
1694
1739
  }
1695
- const traitFilters = {
1696
- TEXT: (n) => n.text != null,
1697
- SQUARE: (n) => {
1698
- const b = bounds(n)
1699
- return Math.abs(1 - b.width / b.height) < 0.03
1700
- },
1701
- LONG_TEXT: (n) => (n.text?.length ?? 0) > 200,
1740
+ if (sel.selected != null) {
1741
+ candidates = candidates.filter(
1742
+ (n) => !!n.accessibilityState?.selected === sel.selected,
1743
+ )
1702
1744
  }
1703
- const matchAll = (raw) => {
1704
- const sel = typeof raw === 'string' ? { text: raw } : raw
1705
- const matchesId = sel.id == null ? null : compile(sel.id, 'id')
1706
- const matchesText = sel.text == null ? null : compile(sel.text, 'text')
1707
- let candidates = all.filter((n) =>
1708
- (!matchesId || matchesId(n.testID)) &&
1709
- (!matchesText || matchesText(n.text) || matchesText(n.accessibilityLabel) || matchesText(n.placeholder)),
1745
+ // maestro's ios checked: a switch whose value is "1". react native
1746
+ // gives the switch role that trait and reports "1" from
1747
+ // accessibilityState.checked; a checkbox role gets no trait, so ios
1748
+ // never reads it as checked.
1749
+ if (sel.checked != null) {
1750
+ candidates = candidates.filter(
1751
+ (n) =>
1752
+ (n.accessibilityRole === 'switch' &&
1753
+ n.accessibilityState?.checked === true) === sel.checked,
1754
+ )
1755
+ }
1756
+ for (const key of relativeKeys) {
1757
+ const anchor = sel[key]
1758
+ if (anchor == null) continue
1759
+ const anchors = pick(
1760
+ matchAll(anchor),
1761
+ typeof anchor === 'string' ? undefined : anchor.index,
1762
+ )
1763
+ candidates = candidates.filter((n) =>
1764
+ anchors.some((other) => relative[key](n, other)),
1710
1765
  )
1711
- if (sel.width != null || sel.height != null) {
1712
- const tolerance = sel.tolerance ?? 0
1713
- candidates = candidates.filter((n) => {
1714
- const b = bounds(n)
1715
- return (sel.width == null || Math.abs(b.width - sel.width) <= tolerance) &&
1716
- (sel.height == null || Math.abs(b.height - sel.height) <= tolerance)
1717
- })
1718
- }
1719
- for (const trait of sel.traits ? String(sel.traits).split(' ') : []) {
1720
- const filter = traitFilters[trait.replaceAll('-', '_').toUpperCase()]
1721
- if (!filter) throw new Error('unknown selector trait: ' + trait)
1722
- candidates = candidates.filter(filter)
1723
- }
1724
- // ios reports isEnabled / isSelected from the accessibility traits
1725
- // react native derives from accessibilityState
1726
- if (sel.enabled != null) {
1727
- candidates = candidates.filter((n) => !n.accessibilityState?.disabled === sel.enabled)
1728
- }
1729
- if (sel.selected != null) {
1730
- candidates = candidates.filter((n) => !!n.accessibilityState?.selected === sel.selected)
1731
- }
1732
- // maestro's ios checked: a switch whose value is "1". react native
1733
- // gives the switch role that trait and reports "1" from
1734
- // accessibilityState.checked; a checkbox role gets no trait, so ios
1735
- // never reads it as checked.
1736
- if (sel.checked != null) {
1737
- candidates = candidates.filter(
1738
- (n) =>
1739
- (n.accessibilityRole === 'switch' && n.accessibilityState?.checked === true) ===
1740
- sel.checked,
1741
- )
1742
- }
1743
- for (const key of Object.keys(relative)) {
1744
- if (sel[key] == null) continue
1745
- const anchors = pick(matchAll(sel[key]), sel[key].index)
1746
- candidates = candidates.filter((n) => anchors.some((other) => relative[key](n, other)))
1747
- }
1748
- // scope before visibility: childOf narrows the match set first, so a
1749
- // clipped sliver inside the container survives to resolve (and refuse
1750
- // honestly) instead of being discarded for a hittable duplicate the
1751
- // scope then removes.
1752
- if (sel.childOf) {
1753
- const containers = matchAll(sel.childOf)
1754
- const container = containers.find(painted) ?? containers[0]
1755
- if (!container) return []
1756
- const x0 = container.absolutePosition.x
1757
- const y0 = container.absolutePosition.y
1758
- const x1 = x0 + container.layout.width
1759
- const y1 = y0 + container.layout.height
1760
- candidates = candidates.filter((n) => {
1761
- const cx = n.absolutePosition.x + n.layout.width / 2
1762
- const cy = n.absolutePosition.y + n.layout.height / 2
1763
- return cx >= x0 && cx <= x1 && cy >= y0 && cy <= y1
1764
- })
1765
- }
1766
- // prefer painted matches, then on-screen ones (findByTestId's
1767
- // visible-first behavior); only fall back to off-screen ones when
1768
- // nothing is on-screen, so index: still resolves a target that needs
1769
- // scrolling into view. a screen still mounted under the one on top
1770
- // paints nothing, and maestro's hierarchy never holds it.
1771
- const onScreen = candidates.filter(centerOnScreen)
1772
- // without an explicit index, prefer a painted match whose center is
1773
- // on screen: a painted sliver with its center off screen cannot take
1774
- // a tap at its center, so a duplicate id resolves to the hittable
1775
- // match. an explicit index keeps the full painted order, and a
1776
- // clipped-only match still resolves so the tap reports honestly.
1777
- const paintedCandidates = candidates.filter(painted)
1778
- if (paintedCandidates.length > 0) {
1779
- if (sel.index == null) {
1780
- const hittable = paintedCandidates.filter(centerOnScreen)
1781
- candidates = hittable.length > 0 ? hittable : paintedCandidates
1782
- } else {
1783
- candidates = paintedCandidates
1784
- }
1785
- } else if (onScreen.length > 0) candidates = onScreen
1786
- // maestro's index: sorts matches by frame y, then x, and without an
1787
- // index takes the first in the ios hierarchy, which lays siblings out
1788
- // by position rather than subview order (RAN on ios 27: two views with
1789
- // one identifier, the first subview moved below by a transform, maestro
1790
- // takes the upper one). a list that renders rows in key order and
1791
- // places them by transform still resolves its top row.
1792
- candidates.sort(byPosition)
1793
- if (sel.index == null && sel.text && !sel.id) {
1794
- candidates.sort((a, b) => (a.text || '').length - (b.text || '').length)
1795
- }
1796
- return candidates
1797
1766
  }
1798
- // maestro Filters.index: a negative index counts from the end
1799
- const pick = (candidates, rawIndex) => {
1800
- if (rawIndex == null) return candidates
1801
- const index = Math.trunc(Number(rawIndex))
1802
- const resolved = index >= 0 ? index : candidates.length + index
1803
- return candidates[resolved] ? [candidates[resolved]] : []
1767
+ // scope before visibility: childOf narrows the match set first, so a
1768
+ // clipped sliver inside the container survives to resolve (and refuse
1769
+ // honestly) instead of being discarded for a hittable duplicate the
1770
+ // scope then removes.
1771
+ if (sel.childOf) {
1772
+ const containers = matchAll(sel.childOf)
1773
+ const container = containers.find(painted) ?? containers[0]
1774
+ if (!container) return []
1775
+ const x0 = container.absolutePosition.x
1776
+ const y0 = container.absolutePosition.y
1777
+ const x1 = x0 + container.layout.width
1778
+ const y1 = y0 + container.layout.height
1779
+ candidates = candidates.filter((n) => {
1780
+ const cx = n.absolutePosition.x + n.layout.width / 2
1781
+ const cy = n.absolutePosition.y + n.layout.height / 2
1782
+ return cx >= x0 && cx <= x1 && cy >= y0 && cy <= y1
1783
+ })
1804
1784
  }
1805
- const matches = pick(matchAll(selector), selector.index)
1806
- const nodes = ${JSON.stringify(preferHittable && opts.index == null)} ? matches : matches.slice(0, 1)
1807
- return nodes.map((node) => ({
1808
- nodeId: typeof node.nodeId === 'number' ? node.nodeId : null,
1809
- id: node.id || null,
1810
- testID: node.testID || null,
1811
- text: node.text || null,
1812
- absolutePosition: node.absolutePosition,
1813
- layout: node.layout,
1814
- // authoritative visibility, as in findElement above.
1815
- visibleFrame: node.visibleFrame || null,
1816
- isTextInput: !!node.isTextInput,
1817
- }))
1818
- })()`)
1819
- if (!candidates?.length) return null
1785
+ // prefer painted matches, then on-screen ones (findByTestId's
1786
+ // visible-first behavior); only fall back to off-screen ones when
1787
+ // nothing is on-screen, so index: still resolves a target that needs
1788
+ // scrolling into view. a screen still mounted under the one on top
1789
+ // paints nothing, and maestro's hierarchy never holds it.
1790
+ const onScreen = candidates.filter(centerOnScreen)
1791
+ // without an explicit index, prefer a painted match whose center is
1792
+ // on screen: a painted sliver with its center off screen cannot take
1793
+ // a tap at its center, so a duplicate id resolves to the hittable
1794
+ // match. an explicit index keeps the full painted order, and a
1795
+ // clipped-only match still resolves so the tap reports honestly.
1796
+ const paintedCandidates = candidates.filter(painted)
1797
+ if (paintedCandidates.length > 0) {
1798
+ if (sel.index == null) {
1799
+ const hittable = paintedCandidates.filter(centerOnScreen)
1800
+ candidates = hittable.length > 0 ? hittable : paintedCandidates
1801
+ } else {
1802
+ candidates = paintedCandidates
1803
+ }
1804
+ } else if (onScreen.length > 0) candidates = onScreen
1805
+ // maestro's index: sorts matches by frame y, then x, and without an
1806
+ // index takes the first in the ios hierarchy, which lays siblings out
1807
+ // by position rather than subview order (RAN on ios 27: two views with
1808
+ // one identifier, the first subview moved below by a transform, maestro
1809
+ // takes the upper one). a list that renders rows in key order and
1810
+ // places them by transform still resolves its top row.
1811
+ candidates.sort(byPosition)
1812
+ if (sel.index == null && sel.text && !sel.id) {
1813
+ candidates.sort((a, b) => (a.text || '').length - (b.text || '').length)
1814
+ }
1815
+ return candidates
1816
+ }
1817
+ // maestro Filters.index: a negative index counts from the end
1818
+ const pick = (
1819
+ candidates: SimNodeRecord[],
1820
+ rawIndex?: FlowTargetSelector['index'],
1821
+ ) => {
1822
+ if (rawIndex == null) return candidates
1823
+ const index = Math.trunc(Number(rawIndex))
1824
+ const resolved = index >= 0 ? index : candidates.length + index
1825
+ return candidates[resolved] ? [candidates[resolved]] : []
1826
+ }
1827
+ const matches = pick(matchAll(opts), opts.index)
1828
+ const nodes = preferHittable && opts.index == null ? matches : matches.slice(0, 1)
1829
+ const candidates = nodes.map((node) => ({
1830
+ nodeId: typeof node.nodeId === 'number' ? node.nodeId : null,
1831
+ id: node.id || null,
1832
+ testID: node.testID || null,
1833
+ text: node.text || null,
1834
+ absolutePosition: node.absolutePosition,
1835
+ layout: node.layout,
1836
+ // authoritative visibility, as in findElement above.
1837
+ visibleFrame: node.visibleFrame || null,
1838
+ isTextInput: !!node.isTextInput,
1839
+ }))
1840
+ if (!candidates.length) return null
1820
1841
  return preferHittable && opts.index == null
1821
1842
  ? this.preferHittableCandidate(candidates)
1822
1843
  : candidates[0]
@@ -2214,11 +2235,13 @@ export class SootSimBridgeFlowRunner {
2214
2235
  const element = await this.findElement(opts)
2215
2236
  if (!element) return false
2216
2237
  const frame = element.visibleFrame
2238
+ const area = frame?.area
2217
2239
  const usable =
2218
2240
  !!frame &&
2219
2241
  Number.isFinite(frame.width) &&
2220
2242
  Number.isFinite(frame.height) &&
2221
- Number.isFinite(frame.area)
2243
+ typeof area === 'number' &&
2244
+ Number.isFinite(area)
2222
2245
  if (!usable) {
2223
2246
  // absent or non-numeric geometry is unknown visibility, never "hidden".
2224
2247
  // returning false here would quietly hand assertNotVisible a pass it did
@@ -2228,7 +2251,7 @@ export class SootSimBridgeFlowRunner {
2228
2251
  `returned visibleFrame ${JSON.stringify(frame ?? null)}`,
2229
2252
  )
2230
2253
  }
2231
- return frame.width > 0 && frame.height > 0 && frame.area > 0
2254
+ return frame.width > 0 && frame.height > 0 && area > 0
2232
2255
  }
2233
2256
 
2234
2257
  async inputText(text: string) {
@@ -21,6 +21,7 @@ import {
21
21
  nativeBundleAssets,
22
22
  } from '../src/native-bundles'
23
23
  import { embedBundleAssets } from './cloud-client.ts'
24
+ import { prepareNativeInput, resolveNativeInput } from './native-input'
24
25
  import { buildRemoteProjectBundle } from './remote-project-bundle'
25
26
  import type { RemotePlatform } from './cloud-session.ts'
26
27
 
@@ -32,6 +33,8 @@ export interface CloudBoxArtifactProduction {
32
33
  assetsDirectory: string | null
33
34
  /** the app project whose compiled native modules the bundle carries. */
34
35
  nativeProject: string | null
36
+ /** the app identity encoded by a standalone native project. */
37
+ nativeAppName?: string
35
38
  /** the compiled native module files the bundle's footers name, by guest url. */
36
39
  nativeAssets: CloudBoxNativeAsset[]
37
40
  warnings: string[]
@@ -55,6 +58,52 @@ export async function produceCloudBoxArtifact(
55
58
  onNativeReady?: () => void
56
59
  } = {},
57
60
  ): Promise<CloudBoxArtifactProduction> {
61
+ const nativeInput = resolveNativeInput(
62
+ typeof input === 'string' ? input : input.projectDir,
63
+ )
64
+ if (nativeInput && nativeInput.kind !== 'kotlin') {
65
+ if (platform !== 'ios')
66
+ throw new Error('standalone Swift projects need an iOS simulator')
67
+ if (options.assetsDirectory || options.nativeProjectDir || options.assetServer)
68
+ throw new Error('standalone Swift projects already supply their native assets')
69
+ const packageOrigin = 'https://peach-package.invalid'
70
+ const prepared = await prepareNativeInput(nativeInput, { origin: packageOrigin })
71
+ try {
72
+ if (!('guestSourceForMetadataUrl' in prepared))
73
+ throw new Error('expected a prepared Swift package')
74
+ const descriptor = JSON.stringify(prepared.metadata)
75
+ const packageHash = createHash('sha256').update(descriptor).digest('hex')
76
+ const assetUrl = (path: string) =>
77
+ prebuiltNativeAssetUrl(packageHash, path.slice(1))
78
+ const metadataUrl = assetUrl(prepared.metadataPath)
79
+ const prefix = assetUrl('/')
80
+ const metadata = descriptor.replaceAll(`${packageOrigin}/`, prefix)
81
+ const nativeAssets = [...prepared.assets].map(([path, asset]) => ({
82
+ ...asset,
83
+ url: assetUrl(path),
84
+ }))
85
+ nativeAssets.push({
86
+ url: metadataUrl,
87
+ contentType: 'application/json',
88
+ bytes: Buffer.from(metadata),
89
+ })
90
+ const bytes = Buffer.from(
91
+ await prepared.guestSourceForMetadataUrl(metadataUrl),
92
+ 'utf8',
93
+ )
94
+ options.onNativeReady?.()
95
+ return {
96
+ bytes,
97
+ assetsDirectory: null,
98
+ nativeProject: null,
99
+ nativeAppName: prepared.name,
100
+ nativeAssets,
101
+ warnings: [],
102
+ }
103
+ } finally {
104
+ prepared.dispose()
105
+ }
106
+ }
58
107
  const preparation = (async () => {
59
108
  const bundlePath =
60
109
  typeof input === 'string'
@@ -1535,8 +1535,11 @@ export async function deleteRemoteSim(options: {
1535
1535
  }
1536
1536
 
1537
1537
  export function resolveCloudSessionForParsed(
1538
- parsed: Pick<ParsedBridgeCliArgs, 'simId' | 'simIdSource'>,
1538
+ parsed: Pick<ParsedBridgeCliArgs, 'simId' | 'simIdSource'> &
1539
+ Partial<Pick<ParsedBridgeCliArgs, 'explicitPort'>>,
1539
1540
  ): CloudSession | null {
1541
+ // an explicit --port names a local bridge, which a saved remote session never serves
1542
+ if (parsed.explicitPort) return null
1540
1543
  const session = readCloudSession()
1541
1544
  if (!session) return null
1542
1545
  // a box holds one simulator and names it by the box, so --sim names a box
@@ -1756,7 +1759,9 @@ export class CloudBoxBridge implements WsBridge {
1756
1759
 
1757
1760
  export function createCloudBridgeForParsed(
1758
1761
  parsed: Pick<ParsedBridgeCliArgs, 'simId' | 'simIdSource'> &
1759
- Partial<Pick<ParsedBridgeCliArgs, 'explicitTimeout' | 'commandTimeoutMs'>>,
1762
+ Partial<
1763
+ Pick<ParsedBridgeCliArgs, 'explicitTimeout' | 'commandTimeoutMs' | 'explicitPort'>
1764
+ >,
1760
1765
  ): WsBridge | null {
1761
1766
  const session = resolveCloudSessionForParsed(parsed)
1762
1767
  if (!session) return null
@@ -187,7 +187,9 @@ function renderActivityIdleScript({
187
187
  }
188
188
  const blockers = []
189
189
  const stats = await Promise.race([
190
- Promise.resolve().then(() => host?.queryStats(false)).catch(() => null),
190
+ Promise.resolve()
191
+ .then(() => host?.queryReadinessStats ? host.queryReadinessStats() : host?.queryStats(false))
192
+ .catch(() => null),
191
193
  new Promise((resolve) => setTimeout(() => resolve(null), 500)),
192
194
  ])
193
195
  if (stats) {
@@ -349,7 +351,10 @@ export async function waitForSootsimIdle({
349
351
  const motionRead = strict || screenStill
350
352
  ? answer(() => globalThis.__sootsimTest?.listAnimations?.()).catch(() => null)
351
353
  : null
352
- const statsRead = answer(() => globalThis.__sootsimRenderHost?.queryStats?.(false)).catch(() => null)
354
+ const host = globalThis.__sootsimRenderHost
355
+ const statsRead = answer(() =>
356
+ host?.queryReadinessStats ? host.queryReadinessStats() : host?.queryStats?.(false)
357
+ ).catch(() => null)
353
358
  // image preparation ends in the tenant before the compositor decodes
354
359
  // and realizes its pixels. both owners must finish before settling.
355
360
  // the compositor rejects a stats request it is too busy to answer.
@@ -512,7 +512,11 @@ async function runRemoteBox(
512
512
  }
513
513
  }
514
514
  // an app folder is built here, and its native modules and fonts come from it
515
+ const { resolveNativeInput } = await import('../native-input')
516
+ const nativeInput = resolveNativeInput(input.bundlePath)
517
+ const standaloneSwift = nativeInput && nativeInput.kind !== 'kotlin'
515
518
  const projectDir =
519
+ !standaloneSwift &&
516
520
  !/^https?:/.test(input.bundlePath) &&
517
521
  statSync(input.bundlePath, { throwIfNoEntry: false })?.isDirectory()
518
522
  ? resolve(input.bundlePath)
@@ -528,6 +532,7 @@ async function runRemoteBox(
528
532
  // a fresh prebuilt bundle can go straight to authorized allocation. check
529
533
  // coverage first when the cli builds native code or may replace a session.
530
534
  if (
535
+ standaloneSwift ||
531
536
  nativeProjectDir ||
532
537
  existingSession ||
533
538
  input.name ||
@@ -651,7 +656,8 @@ async function runRemoteBox(
651
656
  device: selectedDevice,
652
657
  initialUrl: input.initialUrl,
653
658
  name: input.name ?? boxNameForBundle(projectDir ?? input.bundlePath),
654
- appName: appNameFromPath(projectDir ?? input.bundlePath),
659
+ appName:
660
+ preparedArtifact?.nativeAppName ?? appNameFromPath(projectDir ?? input.bundlePath),
655
661
  fresh: input.watch || input.name === null,
656
662
  endpoint,
657
663
  apiOrigin,
@@ -111,6 +111,19 @@ export async function prepareSwiftInput(
111
111
  host.disposeSwiftProject(packagePath)
112
112
  throw error
113
113
  }
114
+ const createGuestSource = async (
115
+ config: Awaited<ReturnType<typeof loadRNXAppConfig>>,
116
+ metadataUrl?: string,
117
+ ) => {
118
+ const source = await produceConfiguredBundle(
119
+ swiftGuestBundle(name, metadataUrl),
120
+ config,
121
+ new Set(),
122
+ )
123
+ return appInfo.identity
124
+ ? insertNativeAppIdentityFooter(source, appInfo.identity)
125
+ : source
126
+ }
114
127
  return {
115
128
  host,
116
129
  module,
@@ -118,17 +131,13 @@ export async function prepareSwiftInput(
118
131
  name,
119
132
  appProject,
120
133
  appInfo,
134
+ async guestSourceForMetadataUrl(metadataUrl: string) {
135
+ return createGuestSource(await loadRNXAppConfig(appProject), metadataUrl)
136
+ },
121
137
  async build(origin: string) {
122
138
  const config = await loadRNXAppConfig(appProject)
123
139
  host.configureSwiftProject(packagePath, config)
124
- const source = await produceConfiguredBundle(
125
- swiftGuestBundle(name),
126
- config,
127
- new Set(),
128
- )
129
- const guestSource = appInfo.identity
130
- ? insertNativeAppIdentityFooter(source, appInfo.identity)
131
- : source
140
+ const guestSource = await createGuestSource(config)
132
141
  const metadata = await host.swiftPackageMetadata(
133
142
  packagePath,
134
143
  name,
@@ -206,6 +215,7 @@ export async function prepareNativeInput(
206
215
  metadataPath: SWIFT_PACKAGE_PATH + encodeURIComponent(prepared.name),
207
216
  icon: prepared.appInfo.icon,
208
217
  assets,
218
+ guestSourceForMetadataUrl: prepared.guestSourceForMetadataUrl,
209
219
  dispose: prepared.dispose,
210
220
  }
211
221
  } catch (error) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2490 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2492 | (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.2490 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2492 | (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.2490 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2492 | (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.2490 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2492 | (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.2490 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2492 | (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.2490 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2492 | (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;