peachsim 0.1.2238 → 0.1.2242

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 (107) hide show
  1. package/cli/bridge-flow-runner.ts +10 -9
  2. package/cli/commands/inspect/settling.ts +491 -506
  3. package/cli/commands/platform.ts +2 -0
  4. package/cli/drivers/playwright-provisioning.ts +160 -37
  5. package/cli/internal-child.ts +5 -79
  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 +1 -1
  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 +1 -1
  16. package/dist-lib/bridge-contract.cjs +1 -1
  17. package/dist-lib/bridge-contract.mjs +1 -1
  18. package/dist-lib/bundle-channel.cjs +115 -89
  19. package/dist-lib/capture-contract.cjs +1 -1
  20. package/dist-lib/capture-contract.mjs +1 -1
  21. package/dist-lib/cloud-contract.cjs +1 -1
  22. package/dist-lib/cloud-contract.mjs +1 -1
  23. package/dist-lib/cloud-test-args.cjs +1 -1
  24. package/dist-lib/cloud-test-args.mjs +1 -1
  25. package/dist-lib/cloud.cjs +1 -1
  26. package/dist-lib/cloud.mjs +1 -1
  27. package/dist-lib/config.cjs +1 -1
  28. package/dist-lib/config.mjs +1 -1
  29. package/dist-lib/detox/index.cjs +494 -510
  30. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  31. package/dist-lib/expo-swift-bundle.cjs +101 -75
  32. package/dist-lib/expo-swift-metadata.cjs +1 -1
  33. package/dist-lib/expo-swift-metadata.mjs +1 -1
  34. package/dist-lib/home-paths.cjs +1 -1
  35. package/dist-lib/host/bridge-host.cjs +119 -93
  36. package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
  37. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  38. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  39. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  40. package/dist-lib/host/websocket-proxy.cjs +1 -1
  41. package/dist-lib/index.cjs +492 -508
  42. package/dist-lib/jump-to-source-babel.cjs +1 -1
  43. package/dist-lib/jump-to-source-native.cjs +1 -1
  44. package/dist-lib/kotlin-host.cjs +1 -1
  45. package/dist-lib/menu.cjs +1 -1
  46. package/dist-lib/menu.mjs +1 -1
  47. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  49. package/dist-lib/metro-production-bundle.cjs +1 -1
  50. package/dist-lib/metro-production-bundle.mjs +1 -1
  51. package/dist-lib/metro.cjs +4 -4
  52. package/dist-lib/native-app-identity-project.cjs +2 -2
  53. package/dist-lib/native-app-identity-project.mjs +7 -8
  54. package/dist-lib/native-app-identity.cjs +1 -1
  55. package/dist-lib/native-app-identity.mjs +1 -1
  56. package/dist-lib/native-firebase-metadata.cjs +1 -1
  57. package/dist-lib/native-firebase-metadata.mjs +1 -1
  58. package/dist-lib/pdfium-raster.cjs +1 -1
  59. package/dist-lib/pdfium-raster.mjs +1 -1
  60. package/dist-lib/plist.cjs +1 -1
  61. package/dist-lib/plist.mjs +1 -1
  62. package/dist-lib/profiles.cjs +1 -1
  63. package/dist-lib/public-brand.cjs +1 -1
  64. package/dist-lib/public-origins-lib-esm.json +24 -24
  65. package/dist-lib/public-origins-lib.json +53 -53
  66. package/dist-lib/react-native-host-modules.cjs +1 -1
  67. package/dist-lib/react-native-host-modules.mjs +1 -1
  68. package/dist-lib/reap-browser.cjs +1 -1
  69. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  70. package/dist-lib/sdk.cjs +487 -503
  71. package/dist-lib/sdk.mjs +487 -503
  72. package/dist-lib/skills.cjs +1327 -1235
  73. package/dist-lib/swift-compile.cjs +46 -27
  74. package/dist-lib/swift-compile.mjs +42 -23
  75. package/dist-lib/swift-package.cjs +1 -1
  76. package/dist-lib/swift-package.mjs +1 -1
  77. package/dist-lib/swift-submit.cjs +2 -2
  78. package/dist-lib/swift-submit.mjs +2 -2
  79. package/dist-lib/swift-toolchain.cjs +1 -1
  80. package/dist-lib/swift.cjs +1 -1
  81. package/dist-lib/vite-swift.cjs +89 -64
  82. package/dist-lib/vite.cjs +4 -4
  83. package/dist-lib/worklet-executable.cjs +1 -1
  84. package/dist-lib/worklet-executable.mjs +1 -1
  85. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
  86. package/dist-types/packages/peach-engine/src/engine/secureItemHostContract.d.ts +5 -1
  87. package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -0
  88. package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +6 -0
  89. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -1
  90. package/dist-types/packages/peach-engine/src/render-worker/webview-capture-protocol.d.ts +14 -0
  91. package/dist-types/packages/peach-globals/src/nativeSurfaceContract.d.ts +1 -0
  92. package/dist-types/packages/peach-globals/src/secure-item-store.d.ts +2 -0
  93. package/kotlin/sdk.tar.gz +0 -0
  94. package/package.json +1 -1
  95. package/runtime-companion.json +1 -1
  96. package/src/native-static-libraries.ts +20 -20
  97. package/src/native-swift-slices.ts +1 -0
  98. package/src/nitro-adapter.lock.json +253 -253
  99. package/src/nitro-superset.lock.json +4 -4
  100. package/src/swift-compile.ts +10 -3
  101. package/src/swift-distribution.lock.json +11 -11
  102. package/src/swift-host.ts +2 -1
  103. package/src/swift-shared-sdk.ts +10 -1
  104. package/src/swift-standins.ts +5 -2
  105. package/src/swift-submit.ts +3 -1
  106. package/src/swift-wasm-prune.ts +23 -14
  107. package/src/turbo-runtime.lock.json +22 -22
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2238 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2242 | (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;
@@ -1125,7 +1125,7 @@ var init_src = __esm({
1125
1125
  var runtime_companion_default;
1126
1126
  var init_runtime_companion = __esm({
1127
1127
  "runtime-companion.json"() {
1128
- runtime_companion_default = { abi: 1, sha256: "6dd2e5a5b979d46f53a8f7d8fcabf5b355446ecdf5fd09affbffc3e9a5f2599d", file: "node/cli-6dd2e5a5b979d46f53a8f7d8fcabf5b355446ecdf5fd09affbffc3e9a5f2599d.cjs" };
1128
+ runtime_companion_default = { abi: 1, sha256: "e31bca40962475bce9d44f3218ea76c4537e744dfed9849160b028389774d5ba", file: "node/cli-e31bca40962475bce9d44f3218ea76c4537e744dfed9849160b028389774d5ba.cjs" };
1129
1129
  }
1130
1130
  });
1131
1131
 
@@ -11498,7 +11498,7 @@ async function waitForSootsimIdle({
11498
11498
  pollMs = 50,
11499
11499
  stablePolls = 3,
11500
11500
  strict = false,
11501
- paintStill = false,
11501
+ screenStill = false,
11502
11502
  maestro = false,
11503
11503
  motionOnly = false,
11504
11504
  readyPlayback = false,
@@ -11536,7 +11536,7 @@ async function waitForSootsimIdle({
11536
11536
  let deadline = start + budgetMs
11537
11537
  const pollMs = ${Math.max(1, Math.round(pollMs))}
11538
11538
  const strict = ${strict ? "true" : "false"}
11539
- const paintStill = ${paintStill ? "true" : "false"}
11539
+ const screenStill = ${screenStill ? "true" : "false"}
11540
11540
  const maestro = ${maestro ? "true" : "false"}
11541
11541
  const accessibilityBounds = ${accessibilityBounds.toString()}
11542
11542
  const sameNativeAccessibilityShape = ${sameNativeAccessibilityShape.toString()}
@@ -11546,541 +11546,525 @@ async function waitForSootsimIdle({
11546
11546
  // tight budgets (auto-wait) settle on worker stillness plus root
11547
11547
  // membership, generous ones confirm the geometry too.
11548
11548
  const fullGeometry = ${!maestro && maxMs >= 1e3 ? "true" : "false"}
11549
- const requiredStillMs = paintStill ? 0 : ${Math.max(1, Math.round(stablePolls)) * Math.max(1, Math.round(pollMs))}
11550
- const minimumStablePolls = paintStill ? 1 : ${Math.min(2, Math.max(1, Math.round(stablePolls)))}
11551
- const composite = paintStill ? globalThis.SootSim?.bridges?.liveComposite : null
11552
- if (paintStill && !composite) {
11553
- return { settled: false, elapsed: clockNow() - start, blockedBy: 'screen pixels unavailable' }
11554
- }
11555
- // subscribe to presented frames; authoritative screenshots force a
11556
- // worker render, which changes the very counter we used to inspect.
11557
- const unsubscribe = composite?.subscribe(() => {})
11549
+ const requiredStillMs = screenStill ? 0 : ${Math.max(1, Math.round(stablePolls)) * Math.max(1, Math.round(pollMs))}
11550
+ const minimumStablePolls = screenStill ? 1 : ${Math.min(2, Math.max(1, Math.round(stablePolls)))}
11558
11551
  let transitionEndedAt = null
11559
- let pixelFrameToken = -1
11560
- let screenPixels = null
11561
11552
  // the hierarchy read last taken and the geometry revision it answered.
11562
11553
  // it outlives this wait: a revision still current when a later wait
11563
11554
  // polls names the same geometry, so a step that follows a settled one
11564
11555
  // proves an unchanged screen without walking the tree again.
11565
11556
  const geometry = (globalThis.__peachSettleGeometry ??= { revision: null, hierarchy: null })
11566
- try {
11567
-
11568
- // discover transitions while observing layout. when motion starts,
11569
- // observations from before its completion cannot prove the new screen;
11570
- // those that began after it drained still can. a loaded host runs a
11571
- // push past a tap's budget, so the transition gets its own timeout and
11572
- // the budget restarts once it drains.
11573
- let transitionWait = (async () => {
11574
- try {
11575
- const wfst = globalThis.__sootsimTest?.waitForScreenTransitions
11576
- if (typeof wfst === 'function' && budgetMs > 120) {
11577
- const transition = await wfst({
11578
- timeoutMs: ${Math.max(0, Math.round(transitionTimeoutMs))},
11579
- settleMs: 64,
11580
- startWindowMs: ${Math.max(0, Math.round(transitionStartWindowMs))},
11581
- })
11582
- if (transition?.started !== true) return false
11583
- // a loaded worker replies long after the motion stopped; it
11584
- // reports how long ago, so polls begun since still count. a
11585
- // runtime without the field ends the transition at the reply.
11586
- const rested = typeof transition.restedMs === 'number' ? Math.max(0, transition.restedMs) : 0
11587
- transitionEndedAt = clockNow() - rested
11588
- deadline = Math.max(deadline, transitionEndedAt + budgetMs)
11589
- return true
11590
- }
11591
- } catch {}
11592
- return false
11593
- })()
11594
-
11595
- // a worker that cannot answer within the remaining budget is busy, not
11596
- // idle: its poll reads as unsettled. bounding each read by the budget
11597
- // keeps a busy worker from holding a poll past the deadline.
11598
- const BUSY = { busy: true }
11599
- const answer = (read) =>
11600
- Promise.race([
11601
- Promise.resolve().then(read),
11602
- new Promise((resolve) =>
11603
- setTimeout(() => resolve(BUSY), Math.max(deadline - clockNow(), 100)),
11604
- ),
11605
- ])
11557
+ // discover transitions while observing layout. when motion starts,
11558
+ // observations from before its completion cannot prove the new screen;
11559
+ // those that began after it drained still can. a loaded host runs a
11560
+ // push past a tap's budget, so the transition gets its own timeout and
11561
+ // the budget restarts once it drains.
11562
+ let transitionWait = (async () => {
11563
+ try {
11564
+ const wfst = globalThis.__sootsimTest?.waitForScreenTransitions
11565
+ if (typeof wfst === 'function' && budgetMs > 120) {
11566
+ const transition = await wfst({
11567
+ timeoutMs: ${Math.max(0, Math.round(transitionTimeoutMs))},
11568
+ settleMs: 64,
11569
+ startWindowMs: ${Math.max(0, Math.round(transitionStartWindowMs))},
11570
+ })
11571
+ if (transition?.started !== true) return false
11572
+ // a loaded worker replies long after the motion stopped; it
11573
+ // reports how long ago, so polls begun since still count. a
11574
+ // runtime without the field ends the transition at the reply.
11575
+ const rested = typeof transition.restedMs === 'number' ? Math.max(0, transition.restedMs) : 0
11576
+ transitionEndedAt = clockNow() - rested
11577
+ deadline = Math.max(deadline, transitionEndedAt + budgetMs)
11578
+ return true
11579
+ }
11580
+ } catch {}
11581
+ return false
11582
+ })()
11583
+
11584
+ // a worker that cannot answer within the remaining budget is busy, not
11585
+ // idle: its poll reads as unsettled. bounding each read by the budget
11586
+ // keeps a busy worker from holding a poll past the deadline.
11587
+ const BUSY = { busy: true }
11588
+ const answer = (read) =>
11589
+ Promise.race([
11590
+ Promise.resolve().then(read),
11591
+ new Promise((resolve) =>
11592
+ setTimeout(() => resolve(BUSY), Math.max(deadline - clockNow(), 100)),
11593
+ ),
11594
+ ])
11606
11595
 
11607
- const readSnapshot = async () => {
11608
- let animating = false
11609
- let animatingBy = ''
11610
- let layoutDirty = false
11611
- let pendingFetches = 0
11612
- let workerBusy = false
11613
- let requestTotal = 0
11614
- let requestInFlight = 0
11615
- let appCommits = null
11616
- let nodeCount = null
11617
- let renderStatsAvailable = false
11618
- let shellAnimating = false
11619
- let shellBlockers = ''
11620
- let webViewStarting = false
11621
- let webViewBlocker = ''
11622
- // the reads are independent, so they run concurrently: a loaded sim
11623
- // answers each one late, and a poll that waits for them in turn
11624
- // costs their sum, which fits too few polls in the budget to settle.
11625
- // the window node count is the exception: it launches after the
11626
- // motion read, so a poll motion already fails skips that walk.
11627
- // strict reads also wait out shell motion. pixel reads inspect finite
11628
- // animations in both realms: a worklet can move the app while the
11629
- // tenant's basic animation flag and last presented pixels read still.
11630
- const accessibilityRead = maestro
11631
- ? answer(() => globalThis.__sootsimTest.captureAccessibilityTree()).catch(() => null)
11632
- : null
11633
- const motionRead = strict || paintStill
11634
- ? answer(() => globalThis.__sootsimTest?.listAnimations?.()).catch(() => null)
11596
+ const readSnapshot = async () => {
11597
+ let animating = false
11598
+ let animatingBy = ''
11599
+ let layoutDirty = false
11600
+ let pendingFetches = 0
11601
+ let workerBusy = false
11602
+ let requestTotal = 0
11603
+ let requestInFlight = 0
11604
+ let appCommits = null
11605
+ let nodeCount = null
11606
+ let renderStatsAvailable = false
11607
+ let shellAnimating = false
11608
+ let shellBlockers = ''
11609
+ let webViewStarting = false
11610
+ let webViewBlocker = ''
11611
+ let visibleMotion = false
11612
+ let visibleMotionBy = ''
11613
+ // the reads are independent, so they run concurrently: a loaded sim
11614
+ // answers each one late, and a poll that waits for them in turn
11615
+ // costs their sum, which fits too few polls in the budget to settle.
11616
+ // the window node count is the exception: it launches after the
11617
+ // motion read, so a poll motion already fails skips that walk.
11618
+ // strict reads also wait out shell motion. pixel reads inspect finite
11619
+ // animations in both realms: a worklet can move the app while the
11620
+ // tenant's basic animation flag and last presented pixels read still.
11621
+ const accessibilityRead = maestro
11622
+ ? answer(() => globalThis.__sootsimTest.captureAccessibilityTree()).catch(() => null)
11623
+ : null
11624
+ const motionRead = strict || screenStill
11625
+ ? answer(() => globalThis.__sootsimTest?.listAnimations?.()).catch(() => null)
11626
+ : null
11627
+ const statsRead = answer(() => globalThis.__sootsimRenderHost?.queryStats?.()).catch(() => null)
11628
+ // image preparation ends in the tenant before the compositor decodes
11629
+ // and realizes its pixels. both owners must finish before settling.
11630
+ // the compositor rejects a stats request it is too busy to answer.
11631
+ const compositorRead = answer(() => globalThis.__sootsimCompositor.getStats({ detail: 'readiness' })).catch(() => BUSY)
11632
+ const countsRead = answer(() => globalThis.__sootsimTest?.getRequestCounts?.()).catch(() => null)
11633
+ // the mounted hierarchy in render-worker mode comes from the test
11634
+ // bridge: globalThis.__sootsimRoot is an empty placeholder there, so a
11635
+ // walk over it hashes every screen to the same empty string while
11636
+ // it moves. listInspectable is the worker-backed read describe
11637
+ // uses; a worker too busy to answer it reads as unsettled. tight
11638
+ // budgets skip this read and settle on the cheaper signals above.
11639
+ // it walks every node, so a poll whose geometry revision matches the
11640
+ // last read, in this wait or an earlier one, reuses that read.
11641
+ const hierarchyRead =
11642
+ fullGeometry && typeof globalThis.__sootsimTest?.listInspectable === 'function'
11643
+ ? answer(() => globalThis.__sootsimTest.getGeometryRevision?.())
11644
+ .catch(() => null)
11645
+ .then((revision) => {
11646
+ if (revision === BUSY) return BUSY
11647
+ if (typeof revision === 'string' && geometry.revision === revision) return geometry.hierarchy
11648
+ return answer(() => globalThis.__sootsimTest.listInspectable({}))
11649
+ .catch(() => null)
11650
+ .then((hierarchy) => {
11651
+ const kept = typeof revision === 'string' && Array.isArray(hierarchy)
11652
+ geometry.revision = kept ? revision : null
11653
+ geometry.hierarchy = kept ? hierarchy : null
11654
+ return hierarchy
11655
+ })
11656
+ })
11635
11657
  : null
11636
- const statsRead = answer(() => globalThis.__sootsimRenderHost?.queryStats?.()).catch(() => null)
11637
- // image preparation ends in the tenant before the compositor decodes
11638
- // and realizes its pixels. both owners must finish before settling.
11639
- // the compositor rejects a stats request it is too busy to answer.
11640
- const compositorRead = answer(() => globalThis.__sootsimCompositor.getStats({ detail: 'readiness' })).catch(() => BUSY)
11641
- const countsRead = answer(() => globalThis.__sootsimTest?.getRequestCounts?.()).catch(() => null)
11642
- // the mounted hierarchy in render-worker mode comes from the test
11643
- // bridge: globalThis.__sootsimRoot is an empty placeholder there, so a
11644
- // walk over it hashes every screen to the same empty string while
11645
- // it moves. listInspectable is the worker-backed read describe
11646
- // uses; a worker too busy to answer it reads as unsettled. tight
11647
- // budgets skip this read and settle on the cheaper signals above.
11648
- // it walks every node, so a poll whose geometry revision matches the
11649
- // last read, in this wait or an earlier one, reuses that read.
11650
- const hierarchyRead =
11651
- fullGeometry && typeof globalThis.__sootsimTest?.listInspectable === 'function'
11652
- ? answer(() => globalThis.__sootsimTest.getGeometryRevision?.())
11653
- .catch(() => null)
11654
- .then((revision) => {
11655
- if (revision === BUSY) return BUSY
11656
- if (typeof revision === 'string' && geometry.revision === revision) return geometry.hierarchy
11657
- return answer(() => globalThis.__sootsimTest.listInspectable({}))
11658
- .catch(() => null)
11659
- .then((hierarchy) => {
11660
- const kept = typeof revision === 'string' && Array.isArray(hierarchy)
11661
- geometry.revision = kept ? revision : null
11662
- geometry.hierarchy = kept ? hierarchy : null
11663
- return hierarchy
11664
- })
11665
- })
11666
- : null
11667
- if (motionRead) {
11668
- const motion = await motionRead
11669
- if (motion === BUSY) workerBusy = true
11670
- else if (Array.isArray(motion)) {
11671
- const blocking = motion.filter((anim) =>
11672
- (anim.realm === 'shell' || paintStill) &&
11673
- anim.priority !== 'low' && anim.visible !== false &&
11674
- (!paintStill || anim.loop !== true))
11675
- shellAnimating = blocking.length > 0
11676
- // name what holds the settle so a timeout points at its owner.
11677
- shellBlockers = blocking
11678
- .slice(0, 4)
11679
- .map((anim) => anim.source + '/' + anim.kind + '#' + anim.id + ' at ' + anim.current + (anim.loop ? ' loop' : ''))
11680
- .join(', ')
11681
- }
11658
+ if (motionRead) {
11659
+ const motion = await motionRead
11660
+ if (motion === BUSY) workerBusy = true
11661
+ else if (Array.isArray(motion)) {
11662
+ const blocking = motion.filter((anim) =>
11663
+ (anim.realm === 'shell' || screenStill) &&
11664
+ anim.priority !== 'low' && anim.visible !== false &&
11665
+ (!screenStill || anim.loop !== true))
11666
+ shellAnimating = blocking.length > 0
11667
+ // what blocking leaves out still moves the screen while visible;
11668
+ // it ends a screen-still wait only at maestro's hierarchy check
11669
+ // or the deadline, as a screen that never holds still does on ios.
11670
+ const moving = screenStill
11671
+ ? motion.filter((anim) => anim.visible !== false && !blocking.includes(anim))
11672
+ : []
11673
+ visibleMotion = moving.length > 0
11674
+ visibleMotionBy = moving
11675
+ .slice(0, 4)
11676
+ .map((anim) => anim.source + '/' + anim.kind + '#' + anim.id + (anim.loop ? ' loop' : '') + (anim.priority === 'low' ? ' low' : ''))
11677
+ .join(', ')
11678
+ // name what holds the settle so a timeout points at its owner.
11679
+ shellBlockers = blocking
11680
+ .slice(0, 4)
11681
+ .map((anim) => anim.source + '/' + anim.kind + '#' + anim.id + ' at ' + anim.current + (anim.loop ? ' loop' : ''))
11682
+ .join(', ')
11682
11683
  }
11683
- const stats = await statsRead
11684
- if (stats === BUSY) {
11685
- workerBusy = true
11686
- } else if (!stats && readyPlayback) {
11687
- workerBusy = true
11688
- } else if (stats) {
11689
- renderStatsAvailable = true
11690
- const missingFields = ['hasActiveBlockingNativeAnimations', 'hasPendingBlockingAnimationFrames']
11691
- .filter((field) => typeof stats[field] !== 'boolean')
11692
- if (readyPlayback && typeof stats.hasPendingReadinessAnimationFrames !== 'boolean') missingFields.push('hasPendingReadinessAnimationFrames')
11693
- if ((strict || readyPlayback) && missingFields.length > 0) {
11694
- return {
11695
- runtimeUnsupported: {
11696
- error: 'runtime_readiness_unsupported',
11697
- runtimeVersion: globalThis.__sootsimRuntimeVersion || 'unknown',
11698
- missingFields,
11699
- },
11700
- }
11684
+ }
11685
+ const stats = await statsRead
11686
+ if (stats === BUSY) {
11687
+ workerBusy = true
11688
+ } else if (!stats && readyPlayback) {
11689
+ workerBusy = true
11690
+ } else if (stats) {
11691
+ renderStatsAvailable = true
11692
+ const missingFields = ['hasActiveBlockingNativeAnimations', 'hasPendingBlockingAnimationFrames']
11693
+ .filter((field) => typeof stats[field] !== 'boolean')
11694
+ if (readyPlayback && typeof stats.hasPendingReadinessAnimationFrames !== 'boolean') missingFields.push('hasPendingReadinessAnimationFrames')
11695
+ if ((strict || readyPlayback) && missingFields.length > 0) {
11696
+ return {
11697
+ runtimeUnsupported: {
11698
+ error: 'runtime_readiness_unsupported',
11699
+ runtimeVersion: globalThis.__sootsimRuntimeVersion || 'unknown',
11700
+ missingFields,
11701
+ },
11701
11702
  }
11702
- // positive checks only: an older runtime without the blocking
11703
- // fields reads as still, and strict rejects that runtime above
11704
- // instead of ever settling on unknown motion.
11705
- animating =
11706
- stats.hasActiveAnims === true ||
11707
- stats.hasActiveBlockingNativeAnimations === true ||
11708
- (!paintStill && (readyPlayback ? stats.hasPendingReadinessAnimationFrames : stats.hasPendingBlockingAnimationFrames) === true)
11709
- if (animating)
11710
- animatingBy = [
11711
- stats.hasActiveAnims === true && 'activeAnims',
11712
- stats.hasActiveBlockingNativeAnimations === true && 'blockingNative',
11713
- !paintStill && stats.hasPendingBlockingAnimationFrames === true && 'pendingFrames',
11714
- !paintStill && stats.hasPendingReadinessAnimationFrames === true && 'pendingReadinessFrames',
11715
- ].filter(Boolean).join('+')
11716
- // the runtime reports only layout work that can reach the window:
11717
- // a covered screen or inactive tab committing does not hold it.
11718
- layoutDirty =
11719
- stats.layoutDirty === true && stats.renderRequested === true
11720
- // a freshly-pushed screen showing a skeleton is layout-stable
11721
- // but not actually settled \u2014 its data/images are still in
11722
- // flight. treat bounded image-loader fetches as not-idle so
11723
- // settle waits for real content, capped by the budget.
11724
- const pf = stats.memory && stats.memory.imageLoader
11725
- ? stats.memory.imageLoader.pendingFetches
11726
- : 0
11727
- pendingFetches = typeof pf === 'number' ? pf : 0
11728
- // tenant layout commits: a screen that keeps committing is still
11729
- // mounting or remounting, even with no animation flag raised.
11730
- appCommits = typeof stats.appCommitCount === 'number' ? stats.appCommitCount : null
11731
11703
  }
11732
- // mounted-root membership: the count of nodes that can reach the
11733
- // window moves while the screen mounts, unmounts or recycles, in
11734
- // either render mode. a screen a pushed one covers or an inactive
11735
- // tab stays mounted out of the window, so what it mounts is not
11736
- // screen motion. the worker rebuilds the membership set while the
11737
- // wire moves on every animated frame, so a poll the motion read
11738
- // already fails skips it: the motion flags alone prove this poll
11739
- // unsettled, and the carried count hands the first still poll the
11740
- // pre-motion baseline to compare against.
11741
- const motionStill = !workerBusy && !animating && !layoutDirty && !shellAnimating
11742
- const nodeCountRead = motionStill
11743
- ? answer(() => globalThis.__sootsimTest?.getWindowNodeCount?.()).catch(() => null)
11744
- : null
11745
- const compositor = await compositorRead
11746
- if (compositor === BUSY) {
11747
- workerBusy = true
11748
- } else {
11749
- pendingFetches += compositor.images.pendingFetches
11750
- pendingFetches += compositor.imageRealization.pending
11751
- if (compositor.webViewCaptureSettled === false) {
11752
- webViewStarting = true
11753
- webViewBlocker = 'compositor webView capture not settled'
11754
- }
11704
+ // positive checks only: an older runtime without the blocking
11705
+ // fields reads as still, and strict rejects that runtime above
11706
+ // instead of ever settling on unknown motion.
11707
+ animating =
11708
+ stats.hasActiveAnims === true ||
11709
+ stats.hasActiveBlockingNativeAnimations === true ||
11710
+ (!screenStill && (readyPlayback ? stats.hasPendingReadinessAnimationFrames : stats.hasPendingBlockingAnimationFrames) === true)
11711
+ if (animating)
11712
+ animatingBy = [
11713
+ stats.hasActiveAnims === true && 'activeAnims',
11714
+ stats.hasActiveBlockingNativeAnimations === true && 'blockingNative',
11715
+ !screenStill && stats.hasPendingBlockingAnimationFrames === true && 'pendingFrames',
11716
+ !screenStill && stats.hasPendingReadinessAnimationFrames === true && 'pendingReadinessFrames',
11717
+ ].filter(Boolean).join('+')
11718
+ // the runtime reports only layout work that can reach the window:
11719
+ // a covered screen or inactive tab committing does not hold it.
11720
+ layoutDirty =
11721
+ stats.layoutDirty === true && stats.renderRequested === true
11722
+ // a freshly-pushed screen showing a skeleton is layout-stable
11723
+ // but not actually settled \u2014 its data/images are still in
11724
+ // flight. treat bounded image-loader fetches as not-idle so
11725
+ // settle waits for real content, capped by the budget.
11726
+ const pf = stats.memory && stats.memory.imageLoader
11727
+ ? stats.memory.imageLoader.pendingFetches
11728
+ : 0
11729
+ pendingFetches = typeof pf === 'number' ? pf : 0
11730
+ // tenant layout commits: a screen that keeps committing is still
11731
+ // mounting or remounting, even with no animation flag raised.
11732
+ appCommits = typeof stats.appCommitCount === 'number' ? stats.appCommitCount : null
11733
+ }
11734
+ // mounted-root membership: the count of nodes that can reach the
11735
+ // window moves while the screen mounts, unmounts or recycles, in
11736
+ // either render mode. a screen a pushed one covers or an inactive
11737
+ // tab stays mounted out of the window, so what it mounts is not
11738
+ // screen motion. the worker rebuilds the membership set while the
11739
+ // wire moves on every animated frame, so a poll the motion read
11740
+ // already fails skips it: the motion flags alone prove this poll
11741
+ // unsettled, and the carried count hands the first still poll the
11742
+ // pre-motion baseline to compare against.
11743
+ const motionStill = !workerBusy && !animating && !layoutDirty && !shellAnimating
11744
+ const nodeCountRead = motionStill
11745
+ ? answer(() => globalThis.__sootsimTest?.getWindowNodeCount?.()).catch(() => null)
11746
+ : null
11747
+ const compositor = await compositorRead
11748
+ if (compositor === BUSY) {
11749
+ workerBusy = true
11750
+ } else {
11751
+ pendingFetches += compositor.images.pendingFetches
11752
+ pendingFetches += compositor.imageRealization.pending
11753
+ if (compositor.webViewCaptureSettled === false) {
11754
+ webViewStarting = true
11755
+ webViewBlocker = 'compositor webView capture not settled'
11755
11756
  }
11756
- const counts = await countsRead
11757
- if (counts === BUSY) workerBusy = true
11758
- // <Image> loads are left to the image loader, which counts only those
11759
- // that can reach the window. a runtime older than the CLI reports none.
11760
- const imageLoads = counts?.imageLoads ?? { total: 0, inFlight: 0 }
11761
- requestTotal = typeof counts?.total === 'number' ? counts.total - imageLoads.total : 0
11762
- requestInFlight = typeof counts?.inFlight === 'number' ? counts.inFlight - imageLoads.inFlight : 0
11763
- // a skipped read carries the last count: mounts during motion still
11764
- // break the first still poll after it, instead of a blank baseline
11765
- // reading them as stable.
11766
- const total = nodeCountRead ? await nodeCountRead : lastNodeCount
11767
- if (total === BUSY) workerBusy = true
11768
- nodeCount = typeof total === 'number' ? total : null
11769
- const accessibility = accessibilityRead ? await accessibilityRead : null
11770
- const nativeHierarchy = Array.isArray(accessibility) && accessibility.length > 0
11771
- ? accessibility
11772
- : null
11773
- if (accessibility === BUSY) workerBusy = true
11774
- let hierarchy = hierarchyRead ? await hierarchyRead : null
11775
- if (hierarchy === BUSY) {
11776
- workerBusy = true
11777
- hierarchy = null
11778
- } else if (!Array.isArray(hierarchy)) {
11779
- hierarchy = null
11757
+ }
11758
+ const counts = await countsRead
11759
+ if (counts === BUSY) workerBusy = true
11760
+ // <Image> loads are left to the image loader, which counts only those
11761
+ // that can reach the window. a runtime older than the CLI reports none.
11762
+ const imageLoads = counts?.imageLoads ?? { total: 0, inFlight: 0 }
11763
+ requestTotal = typeof counts?.total === 'number' ? counts.total - imageLoads.total : 0
11764
+ requestInFlight = typeof counts?.inFlight === 'number' ? counts.inFlight - imageLoads.inFlight : 0
11765
+ // a skipped read carries the last count: mounts during motion still
11766
+ // break the first still poll after it, instead of a blank baseline
11767
+ // reading them as stable.
11768
+ const total = nodeCountRead ? await nodeCountRead : lastNodeCount
11769
+ if (total === BUSY) workerBusy = true
11770
+ nodeCount = typeof total === 'number' ? total : null
11771
+ const accessibility = accessibilityRead ? await accessibilityRead : null
11772
+ const nativeHierarchy = Array.isArray(accessibility) && accessibility.length > 0
11773
+ ? accessibility
11774
+ : null
11775
+ if (accessibility === BUSY) workerBusy = true
11776
+ let hierarchy = hierarchyRead ? await hierarchyRead : null
11777
+ if (hierarchy === BUSY) {
11778
+ workerBusy = true
11779
+ hierarchy = null
11780
+ } else if (!Array.isArray(hierarchy)) {
11781
+ hierarchy = null
11782
+ }
11783
+ const nodes = []
11784
+ // identity beside each geometry entry, from the rows already read,
11785
+ // so a changed layout can name the nodes that moved.
11786
+ const nodeRows = []
11787
+ const LOADING_TEXT_REGEX = /^(creating webview|loading html|fetching bundle|waiting for first render|starting preview|loading simulator|fetching app code|waiting for native preview|starting design|loading canvas|fetching screens|painting the canvas|waiting for webview|waiting for preview|waiting for canvas|preview stalled)/i
11788
+ const noteLoading = (state, text) => {
11789
+ if (state?.busy === true) {
11790
+ webViewStarting = true
11791
+ if (!webViewBlocker) webViewBlocker = 'accessibility busy state active'
11780
11792
  }
11781
- const nodes = []
11782
- // identity beside each geometry entry, from the rows already read,
11783
- // so a changed layout can name the nodes that moved.
11784
- const nodeRows = []
11785
- const LOADING_TEXT_REGEX = /^(creating webview|loading html|fetching bundle|waiting for first render|starting preview|loading simulator|fetching app code|waiting for native preview|starting design|loading canvas|fetching screens|painting the canvas|waiting for webview|waiting for preview|waiting for canvas|preview stalled)/i
11786
- const noteLoading = (state, text) => {
11787
- if (state?.busy === true) {
11788
- webViewStarting = true
11789
- if (!webViewBlocker) webViewBlocker = 'accessibility busy state active'
11790
- }
11791
- if (typeof text === 'string' && LOADING_TEXT_REGEX.test(text.trim())) {
11792
- webViewStarting = true
11793
- if (!webViewBlocker) webViewBlocker = 'webView startup in progress ("' + text.trim() + '")'
11793
+ if (typeof text === 'string' && LOADING_TEXT_REGEX.test(text.trim())) {
11794
+ webViewStarting = true
11795
+ if (!webViewBlocker) webViewBlocker = 'webView startup in progress ("' + text.trim() + '")'
11796
+ }
11797
+ }
11798
+ if (hierarchy) {
11799
+ for (const n of hierarchy) {
11800
+ const layout = n && n.layout
11801
+ if (layout && layout.width > 0) {
11802
+ // painted bounds catch a scroll fling. background playback
11803
+ // keeps a view's painted bounds moving forever, so it and its
11804
+ // subtree count by their own layout; the rest of the screen
11805
+ // still catches the fling.
11806
+ const abs = n.backgroundPlayback ? layout : n.absolute || n.absolutePosition || layout
11807
+ const geometry = Math.round(abs.x) + ',' + Math.round(abs.y) + ',' + Math.round(layout.width)
11808
+ nodes.push(geometry)
11809
+ nodeRows.push([String(n.nodeId ?? nodes.length - 1), (n.type || '?') + (n.testId ? '#' + n.testId : ''), geometry])
11794
11810
  }
11811
+ noteLoading(
11812
+ n.accessibilityState,
11813
+ typeof n.text === 'string' ? n.text : '',
11814
+ )
11795
11815
  }
11796
- if (hierarchy) {
11797
- for (const n of hierarchy) {
11798
- const layout = n && n.layout
11799
- if (layout && layout.width > 0) {
11800
- // painted bounds catch a scroll fling. background playback
11801
- // keeps a view's painted bounds moving forever, so it and its
11802
- // subtree count by their own layout; the rest of the screen
11803
- // still catches the fling.
11804
- const abs = n.backgroundPlayback ? layout : n.absolute || n.absolutePosition || layout
11805
- const geometry = Math.round(abs.x) + ',' + Math.round(abs.y) + ',' + Math.round(layout.width)
11816
+ } else {
11817
+ const root = globalThis.__sootsimRoot
11818
+ if (root) {
11819
+ const walk = (n) => {
11820
+ if (n.layout && n.layout.width > 0) {
11821
+ const geometry = Math.round(n.layout.x) + ',' + Math.round(n.layout.y) + ',' + Math.round(n.layout.width)
11806
11822
  nodes.push(geometry)
11807
- nodeRows.push([String(n.nodeId ?? nodes.length - 1), (n.type || '?') + (n.testId ? '#' + n.testId : ''), geometry])
11823
+ nodeRows.push([String(n.id ?? nodes.length - 1), (n.type || '?') + (n.props?.testID ? '#' + n.props.testID : ''), geometry])
11808
11824
  }
11809
11825
  noteLoading(
11810
- n.accessibilityState,
11811
- typeof n.text === 'string' ? n.text : '',
11826
+ n.props?.accessibilityState,
11827
+ n.textContent || (typeof n.props?.children === 'string' ? n.props.children : ''),
11812
11828
  )
11829
+ for (const c of n.children || []) walk(c)
11813
11830
  }
11814
- } else {
11815
- const root = globalThis.__sootsimRoot
11816
- if (root) {
11817
- const walk = (n) => {
11818
- if (n.layout && n.layout.width > 0) {
11819
- const geometry = Math.round(n.layout.x) + ',' + Math.round(n.layout.y) + ',' + Math.round(n.layout.width)
11820
- nodes.push(geometry)
11821
- nodeRows.push([String(n.id ?? nodes.length - 1), (n.type || '?') + (n.props?.testID ? '#' + n.props.testID : ''), geometry])
11822
- }
11823
- noteLoading(
11824
- n.props?.accessibilityState,
11825
- n.textContent || (typeof n.props?.children === 'string' ? n.props.children : ''),
11826
- )
11827
- for (const c of n.children || []) walk(c)
11828
- }
11829
- walk(root)
11830
- }
11831
+ walk(root)
11831
11832
  }
11832
- if (!webViewStarting && typeof document !== 'undefined') {
11833
- const busyEl = [...document.querySelectorAll('[aria-busy="true"]')].find((element) => {
11834
- const bounds = element.getBoundingClientRect()
11835
- return element.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true }) &&
11836
- bounds.width > 0 && bounds.height > 0 && bounds.right > 0 && bounds.bottom > 0 &&
11837
- bounds.left < globalThis.innerWidth && bounds.top < globalThis.innerHeight
11833
+ }
11834
+ if (!webViewStarting && typeof document !== 'undefined') {
11835
+ const busyEl = [...document.querySelectorAll('[aria-busy="true"]')].find((element) => {
11836
+ const bounds = element.getBoundingClientRect()
11837
+ return element.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true }) &&
11838
+ bounds.width > 0 && bounds.height > 0 && bounds.right > 0 && bounds.bottom > 0 &&
11839
+ bounds.left < globalThis.innerWidth && bounds.top < globalThis.innerHeight
11840
+ })
11841
+ if (busyEl) {
11842
+ webViewStarting = true
11843
+ webViewBlocker = 'accessibility busy element displayed'
11844
+ } else {
11845
+ // a loading document with no area (an app's hidden worker or
11846
+ // executor frame) paints nothing, and a screenshot on device
11847
+ // does not wait for it.
11848
+ const unreadyWebView = [...document.querySelectorAll(
11849
+ '[data-sootsim-webview-loading="true"], [data-sootsim-webview-mode="placeholder"]'
11850
+ )].find((view) => {
11851
+ const frame = view.querySelector('iframe')
11852
+ return !frame || frame.clientWidth > 0 || frame.clientHeight > 0
11838
11853
  })
11839
- if (busyEl) {
11854
+ if (unreadyWebView) {
11840
11855
  webViewStarting = true
11841
- webViewBlocker = 'accessibility busy element displayed'
11842
- } else {
11843
- // a loading document with no area (an app's hidden worker or
11844
- // executor frame) paints nothing, and a screenshot on device
11845
- // does not wait for it.
11846
- const unreadyWebView = [...document.querySelectorAll(
11847
- '[data-sootsim-webview-loading="true"], [data-sootsim-webview-mode="placeholder"]'
11848
- )].find((view) => {
11849
- const frame = view.querySelector('iframe')
11850
- return !frame || frame.clientWidth > 0 || frame.clientHeight > 0
11851
- })
11852
- if (unreadyWebView) {
11853
- webViewStarting = true
11854
- webViewBlocker = 'webView document still loading'
11855
- }
11856
- }
11857
- }
11858
- if (paintStill) {
11859
- const canvas = composite.getCanvas()
11860
- const token = composite.getFrameToken()
11861
- if (!canvas || canvas.width <= 1 || canvas.height <= 1) {
11862
- screenPixels = null
11863
- } else if (token !== pixelFrameToken || canvas.width !== screenPixels?.width || canvas.height !== screenPixels?.height) {
11864
- const context = canvas.getContext('2d')
11865
- const image = context?.getImageData(0, 0, canvas.width, canvas.height)
11866
- screenPixels = image ? { width: image.width, height: image.height, data: new Uint32Array(image.data.buffer) } : null
11867
- pixelFrameToken = token
11856
+ webViewBlocker = 'webView document still loading'
11868
11857
  }
11869
11858
  }
11870
- return { layout: nodes.join(';'), nodeRows, nativeHierarchy, screenPixels, animating, animatingBy, shellAnimating, shellBlockers, layoutDirty, pendingFetches, workerBusy, webViewStarting, webViewBlocker, renderStatsAvailable, requestTotal, requestInFlight, appCommits, nodeCount }
11871
11859
  }
11872
-
11873
- // how long generic background network is allowed to keep us waiting AFTER
11874
- // the screen is otherwise visually settled. apps with continuous traffic
11875
- // (polling, realtime sockets, a tap that fires 20-50 fetches) never reach
11876
- // requestInFlight===0 / a stable requestTotal, so requiring full network
11877
- // quiet burns the ENTIRE budget on every command \u2014 the leading idle that
11878
- // failed PR-preview recordings for network-heavy apps (3pc fight-pulse).
11879
- // layout-stability + the image-loader already prove visible content
11880
- // loaded (a data load changes layout; an image load shows in the loader),
11881
- // so the generic request counters are a courtesy, not a gate: honor them
11882
- // only within this grace once the screen is visually still.
11883
- const networkQuietGraceMs = 1200
11884
- let lastNativeHierarchy = null
11885
- let lastLayout = ''
11886
- let lastNodeRows = []
11887
- // what moved between the last two differing polls, bounded; names the
11888
- // nodes behind "layout changed" without keeping any poll history.
11889
- let lastLayoutChange = null
11890
- const describeLayoutChange = (before, after) => {
11891
- const previous = new Map(before.map(([key, label, geometry]) => [key, [label, geometry]]))
11892
- const moved = []
11893
- const added = []
11894
- const short = (label, key) => String(label).slice(0, 48) + ' [' + String(key).slice(0, 24) + ']'
11895
- for (const [key, label, geometry] of after) {
11896
- const was = previous.get(key)
11897
- previous.delete(key)
11898
- if (!was) added.push(short(label, key) + ' ' + geometry)
11899
- else if (was[1] !== geometry) moved.push(short(label, key) + ' ' + was[1] + '->' + geometry)
11900
- }
11901
- const removed = [...previous].map(([key, [label, geometry]]) => short(label, key) + ' ' + geometry)
11902
- return {
11903
- moved: moved.length, added: added.length, removed: removed.length,
11904
- movedSample: moved.slice(0, 3), addedSample: added.slice(0, 3), removedSample: removed.slice(0, 3),
11905
- }
11860
+ return { layout: nodes.join(';'), nodeRows, nativeHierarchy, visibleMotion, visibleMotionBy, animating, animatingBy, shellAnimating, shellBlockers, layoutDirty, pendingFetches, workerBusy, webViewStarting, webViewBlocker, renderStatsAvailable, requestTotal, requestInFlight, appCommits, nodeCount }
11861
+ }
11862
+
11863
+ // how long generic background network is allowed to keep us waiting AFTER
11864
+ // the screen is otherwise visually settled. apps with continuous traffic
11865
+ // (polling, realtime sockets, a tap that fires 20-50 fetches) never reach
11866
+ // requestInFlight===0 / a stable requestTotal, so requiring full network
11867
+ // quiet burns the ENTIRE budget on every command \u2014 the leading idle that
11868
+ // failed PR-preview recordings for network-heavy apps (3pc fight-pulse).
11869
+ // layout-stability + the image-loader already prove visible content
11870
+ // loaded (a data load changes layout; an image load shows in the loader),
11871
+ // so the generic request counters are a courtesy, not a gate: honor them
11872
+ // only within this grace once the screen is visually still.
11873
+ const networkQuietGraceMs = 1200
11874
+ let lastNativeHierarchy = null
11875
+ let lastLayout = ''
11876
+ let lastNodeRows = []
11877
+ // what moved between the last two differing polls, bounded; names the
11878
+ // nodes behind "layout changed" without keeping any poll history.
11879
+ let lastLayoutChange = null
11880
+ const describeLayoutChange = (before, after) => {
11881
+ const previous = new Map(before.map(([key, label, geometry]) => [key, [label, geometry]]))
11882
+ const moved = []
11883
+ const added = []
11884
+ const short = (label, key) => String(label).slice(0, 48) + ' [' + String(key).slice(0, 24) + ']'
11885
+ for (const [key, label, geometry] of after) {
11886
+ const was = previous.get(key)
11887
+ previous.delete(key)
11888
+ if (!was) added.push(short(label, key) + ' ' + geometry)
11889
+ else if (was[1] !== geometry) moved.push(short(label, key) + ' ' + was[1] + '->' + geometry)
11906
11890
  }
11907
- let lastScreenPixels = null
11908
- let screenChangedPolls = 0
11909
- let lastRequestTotal = -1
11910
- let lastAppCommits = null
11911
- let lastNodeCount = null
11912
- // the last completed poll and the values it was compared against.
11913
- let report = null
11914
- // the still polls of the current run, when each began and answered
11915
- let stillPolls = []
11916
- let lastIdlePoll = null
11917
- let visuallyStillSince = 0
11918
- // counts across the whole budget: a flag that is true on every poll is a
11919
- // different bug from one that is true intermittently, and the two need
11920
- // opposite fixes (engine vs budget).
11921
- let polls = 0
11922
- let dirtyPolls = 0
11923
- let animatingPolls = 0
11924
- let layoutChangedPolls = 0
11925
- let webViewStartingPolls = 0
11926
- const screenUnchanged = (pixels, previous) => {
11927
- if (!pixels || !previous || pixels.width !== previous.width || pixels.height !== previous.height) return false
11928
- if (pixels === previous) return true
11929
- for (let i = 0; i < pixels.data.length; i++) {
11930
- if (pixels.data[i] !== previous.data[i]) return false
11931
- }
11932
- return true
11891
+ const removed = [...previous].map(([key, [label, geometry]]) => short(label, key) + ' ' + geometry)
11892
+ return {
11893
+ moved: moved.length, added: added.length, removed: removed.length,
11894
+ movedSample: moved.slice(0, 3), addedSample: added.slice(0, 3), removedSample: removed.slice(0, 3),
11933
11895
  }
11934
- const hierarchyUnchanged = (current, previous) =>
11935
- current !== null && previous !== null && current.length === previous.length &&
11936
- current.every((node, index) => sameNativeAccessibilityShape(node, previous[index], accessibilityBounds))
11937
- while (true) {
11938
- if (clockNow() >= deadline) {
11939
- if (!transitionWait) break
11940
- await transitionWait
11941
- transitionWait = null
11942
- // nothing polled while parked on the transition, and a loaded
11943
- // worker's late reply would spend the restarted budget unobserved.
11944
- if (transitionEndedAt !== null) deadline = Math.max(deadline, clockNow() + budgetMs)
11945
- if (clockNow() >= deadline) break
11946
- }
11947
- const pollStarted = clockNow()
11948
- const snapshot = await readSnapshot()
11949
- if (snapshot.runtimeUnsupported) return snapshot.runtimeUnsupported
11950
- // a read the deadline cut short observed nothing: the last full poll
11951
- // names what held the settle, not a worker that ran out of budget.
11952
- // the loop head drains a transition still in flight before it ends.
11953
- if (snapshot.workerBusy && clockNow() >= deadline && report) continue
11954
- polls++
11955
- report = { snapshot, nativeHierarchy: lastNativeHierarchy, layout: lastLayout, screenPixels: lastScreenPixels, requestTotal: lastRequestTotal, appCommits: lastAppCommits, nodeCount: lastNodeCount }
11956
- if (snapshot.layoutDirty) dirtyPolls++
11957
- if (snapshot.animating || snapshot.shellAnimating) animatingPolls++
11958
- if (snapshot.webViewStarting) webViewStartingPolls++
11959
- if (polls > 1 && snapshot.layout !== lastLayout) {
11960
- layoutChangedPolls++
11961
- lastLayoutChange = describeLayoutChange(lastNodeRows, snapshot.nodeRows)
11962
- }
11963
- const screenChanged = paintStill && !screenUnchanged(snapshot.screenPixels, lastScreenPixels)
11964
- if (polls > 1 && screenChanged) screenChangedPolls++
11965
- const strictOk =
11966
- !strict ||
11967
- (snapshot.renderStatsAvailable &&
11968
- !snapshot.animating &&
11969
- !snapshot.shellAnimating &&
11970
- !snapshot.layoutDirty)
11971
- // visually settled: no worker motion or layout work, no new layout
11972
- // commits, a stable mounted node count, no image content loading
11973
- // (unless motion alone is asked), no webview startup in progress,
11974
- // layout unchanged since the last poll. both modes wait out finite
11975
- // worker motion now; strict additionally implies the flags through
11976
- // strictOk and adds shell motion plus the blocking-stats floor. a
11977
- // null count or commit reading means the runtime does not report
11978
- // it, which reads as stable the way a missing stats block does.
11979
- // equal presented pixels can precede pending worker motion or layout.
11980
- // after that work drains, iOS's 3 s pixel phase may accept two equal
11981
- // native TreeNodes while paint-only playback continues. overlap
11982
- // hierarchy reads so neither the gesture nor screenshot deadline grows.
11983
- const maestroStill = snapshot.screenPixels !== null && !snapshot.workerBusy && snapshot.pendingFetches === 0 && snapshot.requestInFlight === 0 && !snapshot.webViewStarting &&
11984
- !snapshot.animating && !snapshot.shellAnimating && !snapshot.layoutDirty && (
11985
- !screenChanged || (clockNow() - start >= 3000 &&
11986
- hierarchyUnchanged(snapshot.nativeHierarchy, lastNativeHierarchy))
11987
- )
11988
- const idleSnapshot =
11989
- strictOk &&
11896
+ }
11897
+ let screenChangedPolls = 0
11898
+ let lastRequestTotal = -1
11899
+ let lastAppCommits = null
11900
+ let lastNodeCount = null
11901
+ // the last completed poll and the values it was compared against.
11902
+ let report = null
11903
+ // the still polls of the current run, when each began and answered
11904
+ let stillPolls = []
11905
+ let lastIdlePoll = null
11906
+ let visuallyStillSince = 0
11907
+ // counts across the whole budget: a flag that is true on every poll is a
11908
+ // different bug from one that is true intermittently, and the two need
11909
+ // opposite fixes (engine vs budget).
11910
+ let polls = 0
11911
+ let dirtyPolls = 0
11912
+ let animatingPolls = 0
11913
+ let layoutChangedPolls = 0
11914
+ let webViewStartingPolls = 0
11915
+ const hierarchyUnchanged = (current, previous) =>
11916
+ current !== null && previous !== null && current.length === previous.length &&
11917
+ current.every((node, index) => sameNativeAccessibilityShape(node, previous[index], accessibilityBounds))
11918
+ while (true) {
11919
+ if (clockNow() >= deadline) {
11920
+ if (!transitionWait) break
11921
+ await transitionWait
11922
+ transitionWait = null
11923
+ // nothing polled while parked on the transition, and a loaded
11924
+ // worker's late reply would spend the restarted budget unobserved.
11925
+ if (transitionEndedAt !== null) deadline = Math.max(deadline, clockNow() + budgetMs)
11926
+ if (clockNow() >= deadline) break
11927
+ }
11928
+ const pollStarted = clockNow()
11929
+ const snapshot = await readSnapshot()
11930
+ if (snapshot.runtimeUnsupported) return snapshot.runtimeUnsupported
11931
+ // a read the deadline cut short observed nothing: the last full poll
11932
+ // names what held the settle, not a worker that ran out of budget.
11933
+ // the loop head drains a transition still in flight before it ends.
11934
+ if (snapshot.workerBusy && clockNow() >= deadline && report) continue
11935
+ polls++
11936
+ report = { snapshot, nativeHierarchy: lastNativeHierarchy, layout: lastLayout, requestTotal: lastRequestTotal, appCommits: lastAppCommits, nodeCount: lastNodeCount }
11937
+ if (snapshot.layoutDirty) dirtyPolls++
11938
+ if (snapshot.animating || snapshot.shellAnimating) animatingPolls++
11939
+ if (snapshot.webViewStarting) webViewStartingPolls++
11940
+ if (polls > 1 && snapshot.layout !== lastLayout) {
11941
+ layoutChangedPolls++
11942
+ lastLayoutChange = describeLayoutChange(lastNodeRows, snapshot.nodeRows)
11943
+ }
11944
+ // the first poll has nothing to compare, so it cannot prove a still screen
11945
+ const screenChanged = screenStill && (
11946
+ polls === 1 ||
11947
+ snapshot.visibleMotion ||
11948
+ (snapshot.appCommits !== null && lastAppCommits !== null && snapshot.appCommits !== lastAppCommits) ||
11949
+ (snapshot.nodeCount !== null && lastNodeCount !== null && snapshot.nodeCount !== lastNodeCount) ||
11950
+ snapshot.layout !== lastLayout ||
11951
+ (maestro && !hierarchyUnchanged(snapshot.nativeHierarchy, lastNativeHierarchy))
11952
+ )
11953
+ if (polls > 1 && screenChanged) screenChangedPolls++
11954
+ const strictOk =
11955
+ !strict ||
11956
+ (snapshot.renderStatsAvailable &&
11990
11957
  !snapshot.animating &&
11991
11958
  !snapshot.shellAnimating &&
11992
- !snapshot.layoutDirty &&
11993
- snapshot.pendingFetches === 0 &&
11994
- !snapshot.workerBusy &&
11995
- !snapshot.webViewStarting
11996
- const visuallyStill = maestro ? maestroStill :
11997
- idleSnapshot &&
11998
- (snapshot.appCommits === null || lastAppCommits === null || snapshot.appCommits === lastAppCommits) &&
11999
- (snapshot.nodeCount === null || lastNodeCount === null || snapshot.nodeCount === lastNodeCount) &&
12000
- !screenChanged &&
12001
- snapshot.layout === lastLayout
12002
- // generic network quiet: nothing in flight and no new requests issued.
12003
- const networkQuiet =
12004
- snapshot.requestInFlight === 0 && snapshot.requestTotal === lastRequestTotal
12005
- if (visuallyStill) {
12006
- if (visuallyStillSince === 0) visuallyStillSince = clockNow()
12007
- // two equal idle observations prove the interval between them.
12008
- // discarding the first requires a third worker round trip, which
12009
- // can exhaust the budget after a late image on a loaded host.
12010
- if (!maestro && !paintStill && stillPolls.length === 0 && lastIdlePoll) {
12011
- stillPolls.push(lastIdlePoll)
12012
- }
12013
- stillPolls.push({ started: pollStarted, answered: clockNow() })
12014
- // still long enough, counting only polls that began after a started
12015
- // transition drained.
12016
- const stillProven = () => {
12017
- const proving = stillPolls.filter((poll) => transitionEndedAt === null || poll.started >= transitionEndedAt)
12018
- return proving.length >= minimumStablePolls && clockNow() - proving[0].answered >= requiredStillMs
12019
- }
12020
- // settle once the screen has held still long enough AND either the
12021
- // network is genuinely quiet OR it has refused to quiet within the
12022
- // grace (continuous background traffic must not block forever).
12023
- if (
12024
- stillProven() &&
12025
- (maestro || networkQuiet || clockNow() - visuallyStillSince >= networkQuietGraceMs)
12026
- ) {
12027
- if (transitionWait) {
12028
- await transitionWait
12029
- transitionWait = null
12030
- }
12031
- if (stillProven()) return { settled: true, elapsed: clockNow() - start, blockedBy: '' }
11959
+ !snapshot.layoutDirty)
11960
+ // visually settled: no worker motion or layout work, no new layout
11961
+ // commits, a stable mounted node count, no image content loading
11962
+ // (unless motion alone is asked), no webview startup in progress,
11963
+ // layout unchanged since the last poll. both modes wait out finite
11964
+ // worker motion now; strict additionally implies the flags through
11965
+ // strictOk and adds shell motion plus the blocking-stats floor. a
11966
+ // null count or commit reading means the runtime does not report
11967
+ // it, which reads as stable the way a missing stats block does.
11968
+ // equal presented pixels can precede pending worker motion or layout.
11969
+ // after that work drains, iOS's 3 s pixel phase may accept two equal
11970
+ // native TreeNodes while paint-only playback continues. overlap
11971
+ // hierarchy reads so neither the gesture nor screenshot deadline grows.
11972
+ const maestroStill = !snapshot.workerBusy && snapshot.pendingFetches === 0 && snapshot.requestInFlight === 0 && !snapshot.webViewStarting &&
11973
+ !snapshot.animating && !snapshot.shellAnimating && !snapshot.layoutDirty && (
11974
+ !screenChanged || (clockNow() - start >= 3000 &&
11975
+ hierarchyUnchanged(snapshot.nativeHierarchy, lastNativeHierarchy))
11976
+ )
11977
+ const idleSnapshot =
11978
+ strictOk &&
11979
+ !snapshot.animating &&
11980
+ !snapshot.shellAnimating &&
11981
+ !snapshot.layoutDirty &&
11982
+ snapshot.pendingFetches === 0 &&
11983
+ !snapshot.workerBusy &&
11984
+ !snapshot.webViewStarting
11985
+ const visuallyStill = maestro ? maestroStill :
11986
+ idleSnapshot &&
11987
+ (snapshot.appCommits === null || lastAppCommits === null || snapshot.appCommits === lastAppCommits) &&
11988
+ (snapshot.nodeCount === null || lastNodeCount === null || snapshot.nodeCount === lastNodeCount) &&
11989
+ !screenChanged &&
11990
+ snapshot.layout === lastLayout
11991
+ // generic network quiet: nothing in flight and no new requests issued.
11992
+ const networkQuiet =
11993
+ snapshot.requestInFlight === 0 && snapshot.requestTotal === lastRequestTotal
11994
+ if (visuallyStill) {
11995
+ if (visuallyStillSince === 0) visuallyStillSince = clockNow()
11996
+ // two equal idle observations prove the interval between them.
11997
+ // discarding the first requires a third worker round trip, which
11998
+ // can exhaust the budget after a late image on a loaded host.
11999
+ if (!maestro && !screenStill && stillPolls.length === 0 && lastIdlePoll) {
12000
+ stillPolls.push(lastIdlePoll)
12001
+ }
12002
+ stillPolls.push({ started: pollStarted, answered: clockNow() })
12003
+ // still long enough, counting only polls that began after a started
12004
+ // transition drained.
12005
+ const stillProven = () => {
12006
+ const proving = stillPolls.filter((poll) => transitionEndedAt === null || poll.started >= transitionEndedAt)
12007
+ return proving.length >= minimumStablePolls && clockNow() - proving[0].answered >= requiredStillMs
12008
+ }
12009
+ // settle once the screen has held still long enough AND either the
12010
+ // network is genuinely quiet OR it has refused to quiet within the
12011
+ // grace (continuous background traffic must not block forever).
12012
+ if (
12013
+ stillProven() &&
12014
+ (maestro || networkQuiet || clockNow() - visuallyStillSince >= networkQuietGraceMs)
12015
+ ) {
12016
+ if (transitionWait) {
12017
+ await transitionWait
12018
+ transitionWait = null
12032
12019
  }
12033
- } else {
12034
- stillPolls = []
12035
- visuallyStillSince = 0
12020
+ if (stillProven()) return { settled: true, elapsed: clockNow() - start, blockedBy: '' }
12036
12021
  }
12037
- lastIdlePoll = idleSnapshot ? { started: pollStarted, answered: clockNow() } : null
12038
- lastNativeHierarchy = snapshot.nativeHierarchy
12039
- lastLayout = snapshot.layout
12040
- lastNodeRows = snapshot.nodeRows
12041
- lastScreenPixels = snapshot.screenPixels
12042
- lastRequestTotal = snapshot.requestTotal
12043
- lastAppCommits = snapshot.appCommits
12044
- lastNodeCount = snapshot.nodeCount
12045
- // reply latency belongs inside the poll interval; the stillness window
12046
- // above remains measured from completed observations.
12047
- const remainingPollMs = pollMs - (clockNow() - pollStarted)
12048
- if (remainingPollMs > 0) await clockSleep(remainingPollMs)
12049
- }
12050
- if (!report) {
12051
- return { settled: false, elapsed: clockNow() - start, blockedBy: 'no poll fit the budget' }
12052
- }
12053
- const last = report.snapshot
12054
- const blockers = []
12055
- if (!maestro && strict && !last.renderStatsAvailable) blockers.push('render stats unavailable')
12056
- if (!maestro && last.animating) blockers.push('animations still running' + (last.animatingBy ? ' (' + last.animatingBy + ')' : ''))
12057
- if (last.shellAnimating) blockers.push('animations still running (' + last.shellBlockers + ')')
12058
- if (!maestro && last.layoutDirty) blockers.push('layout still dirty')
12059
- if (!maestro && last.appCommits !== null && report.appCommits !== null && last.appCommits !== report.appCommits) blockers.push('layout commits still landing')
12060
- if (!maestro && last.nodeCount !== null && report.nodeCount !== null && last.nodeCount !== report.nodeCount) blockers.push('node count still changing')
12061
- if (last.pendingFetches > 0) blockers.push(last.pendingFetches + ' image fetches pending')
12062
- if (last.workerBusy) blockers.push('a render worker too busy to report')
12063
- if (last.webViewStarting) blockers.push(last.webViewBlocker || 'webView still starting')
12064
- if (!maestro && last.layout !== report.layout) blockers.push('layout still changing')
12065
- if (maestro && !hierarchyUnchanged(last.nativeHierarchy, report.nativeHierarchy)) blockers.push(last.nativeHierarchy === null ? 'native accessibility hierarchy unavailable' : 'native accessibility hierarchy still changing')
12066
- if (paintStill && !last.screenPixels) blockers.push('screen pixels unavailable')
12067
- else if (paintStill && !screenUnchanged(last.screenPixels, report.screenPixels)) blockers.push('screen pixels still changing')
12068
- if (last.requestInFlight > 0) blockers.push(last.requestInFlight + ' requests in flight')
12069
- else if (!maestro && last.requestTotal !== report.requestTotal) blockers.push('new requests issued')
12070
- if (polls < 2) blockers.push('sim too busy to poll twice')
12071
- // the last read is still: motion ended too near the deadline for the
12072
- // stillness window to hold before it.
12073
- if (!blockers.length) blockers.push('motion ended before stillness was proven')
12074
- return {
12075
- settled: false,
12076
- elapsed: clockNow() - start,
12077
- blockedBy:
12078
- blockers.join(', ') + ' over ' + polls + ' polls (layout changed ' + layoutChangedPolls +
12079
- 'x, layoutDirty ' + dirtyPolls + 'x, animating ' + animatingPolls + 'x, webViewStarting ' + webViewStartingPolls + 'x, screen changed ' + screenChangedPolls + 'x)' +
12080
- (lastLayoutChange ? '; last layout change ' + JSON.stringify(lastLayoutChange) : ''),
12022
+ } else {
12023
+ stillPolls = []
12024
+ visuallyStillSince = 0
12081
12025
  }
12082
- } finally {
12083
- unsubscribe?.()
12026
+ lastIdlePoll = idleSnapshot ? { started: pollStarted, answered: clockNow() } : null
12027
+ lastNativeHierarchy = snapshot.nativeHierarchy
12028
+ lastLayout = snapshot.layout
12029
+ lastNodeRows = snapshot.nodeRows
12030
+ lastRequestTotal = snapshot.requestTotal
12031
+ lastAppCommits = snapshot.appCommits
12032
+ lastNodeCount = snapshot.nodeCount
12033
+ // reply latency belongs inside the poll interval; the stillness window
12034
+ // above remains measured from completed observations.
12035
+ const remainingPollMs = pollMs - (clockNow() - pollStarted)
12036
+ if (remainingPollMs > 0) await clockSleep(remainingPollMs)
12037
+ }
12038
+ if (!report) {
12039
+ return { settled: false, elapsed: clockNow() - start, blockedBy: 'no poll fit the budget' }
12040
+ }
12041
+ const last = report.snapshot
12042
+ const blockers = []
12043
+ if (!maestro && strict && !last.renderStatsAvailable) blockers.push('render stats unavailable')
12044
+ if (!maestro && last.animating) blockers.push('animations still running' + (last.animatingBy ? ' (' + last.animatingBy + ')' : ''))
12045
+ if (last.shellAnimating) blockers.push('animations still running (' + last.shellBlockers + ')')
12046
+ if (!maestro && last.layoutDirty) blockers.push('layout still dirty')
12047
+ if (!maestro && last.appCommits !== null && report.appCommits !== null && last.appCommits !== report.appCommits) blockers.push('layout commits still landing')
12048
+ if (!maestro && last.nodeCount !== null && report.nodeCount !== null && last.nodeCount !== report.nodeCount) blockers.push('node count still changing')
12049
+ if (last.pendingFetches > 0) blockers.push(last.pendingFetches + ' image fetches pending')
12050
+ if (last.workerBusy) blockers.push('a render worker too busy to report')
12051
+ if (last.webViewStarting) blockers.push(last.webViewBlocker || 'webView still starting')
12052
+ if (!maestro && last.layout !== report.layout) blockers.push('layout still changing')
12053
+ if (maestro && !hierarchyUnchanged(last.nativeHierarchy, report.nativeHierarchy)) blockers.push(last.nativeHierarchy === null ? 'native accessibility hierarchy unavailable' : 'native accessibility hierarchy still changing')
12054
+ if (screenStill && last.visibleMotion) blockers.push('visible motion continues (' + last.visibleMotionBy + ')')
12055
+ if (last.requestInFlight > 0) blockers.push(last.requestInFlight + ' requests in flight')
12056
+ else if (!maestro && last.requestTotal !== report.requestTotal) blockers.push('new requests issued')
12057
+ if (polls < 2) blockers.push('sim too busy to poll twice')
12058
+ // the last read is still: motion ended too near the deadline for the
12059
+ // stillness window to hold before it.
12060
+ if (!blockers.length) blockers.push('motion ended before stillness was proven')
12061
+ return {
12062
+ settled: false,
12063
+ elapsed: clockNow() - start,
12064
+ blockedBy:
12065
+ blockers.join(', ') + ' over ' + polls + ' polls (layout changed ' + layoutChangedPolls +
12066
+ 'x, layoutDirty ' + dirtyPolls + 'x, animating ' + animatingPolls + 'x, webViewStarting ' + webViewStartingPolls + 'x, screen changed ' + screenChangedPolls + 'x)' +
12067
+ (lastLayoutChange ? '; last layout change ' + JSON.stringify(lastLayoutChange) : ''),
12084
12068
  }
12085
12069
  })()`
12086
12070
  },
@@ -13519,7 +13503,7 @@ function readIosSdkTree(root) {
13519
13503
 
13520
13504
  // src/swift-standin-digest.ts
13521
13505
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
13522
- var STANDIN_SOURCE_DIGEST = true ? "ae88f21106ce704b52a260a8c3d5bc2c1576fc0beef490d84ca792d99bcedc3f" : standinSourceDigest();
13506
+ var STANDIN_SOURCE_DIGEST = true ? "ae85ffec56f52b5fc73fd9519b221f33abfd4b67aec6d9c5695044b4b6b6ab32" : standinSourceDigest();
13523
13507
 
13524
13508
  // src/expo-native-workspace.ts
13525
13509
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -16058,7 +16042,7 @@ var FOUNDATION_IMPLICIT_MODULES = [
16058
16042
  var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
16059
16043
  (module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
16060
16044
  ).join("");
16061
- var compilerSourceDigest = true ? "7c1188b9ba2b81e03391ec670b3e984dbb3a70fccecf681beaa2b8c7a7c36a5c" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
16045
+ var compilerSourceDigest = true ? "6ff3c88ff95ee93cffc6e832c96753820df284d9d2d9a99d405e2cb6be86ed65" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
16062
16046
  var CORE_FOUNDATION_HANDLE_IMPORTS = [
16063
16047
  "CFAllocator",
16064
16048
  "CFArray",