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