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.
- package/cli/bridge-flow-runner.ts +10 -9
- package/cli/commands/inspect/settling.ts +491 -506
- package/cli/commands/platform.ts +2 -0
- package/cli/drivers/playwright-provisioning.ts +160 -37
- package/cli/internal-child.ts +5 -79
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +115 -89
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +494 -510
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +101 -75
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +119 -93
- package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +492 -508
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +7 -8
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +53 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +487 -503
- package/dist-lib/sdk.mjs +487 -503
- package/dist-lib/skills.cjs +1327 -1235
- package/dist-lib/swift-compile.cjs +46 -27
- package/dist-lib/swift-compile.mjs +42 -23
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +89 -64
- package/dist-lib/vite.cjs +4 -4
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/secureItemHostContract.d.ts +5 -1
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -1
- package/dist-types/packages/peach-engine/src/render-worker/webview-capture-protocol.d.ts +14 -0
- package/dist-types/packages/peach-globals/src/nativeSurfaceContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/secure-item-store.d.ts +2 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/native-static-libraries.ts +20 -20
- package/src/native-swift-slices.ts +1 -0
- package/src/nitro-adapter.lock.json +253 -253
- package/src/nitro-superset.lock.json +4 -4
- package/src/swift-compile.ts +10 -3
- package/src/swift-distribution.lock.json +11 -11
- package/src/swift-host.ts +2 -1
- package/src/swift-shared-sdk.ts +10 -1
- package/src/swift-standins.ts +5 -2
- package/src/swift-submit.ts +3 -1
- package/src/swift-wasm-prune.ts +23 -14
- package/src/turbo-runtime.lock.json +22 -22
package/dist-lib/detox/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
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;
|
|
@@ -1732,7 +1732,7 @@ async function waitForSootsimIdle({
|
|
|
1732
1732
|
pollMs = 50,
|
|
1733
1733
|
stablePolls = 3,
|
|
1734
1734
|
strict = false,
|
|
1735
|
-
|
|
1735
|
+
screenStill = false,
|
|
1736
1736
|
maestro = false,
|
|
1737
1737
|
motionOnly = false,
|
|
1738
1738
|
readyPlayback = false,
|
|
@@ -1770,7 +1770,7 @@ async function waitForSootsimIdle({
|
|
|
1770
1770
|
let deadline = start + budgetMs
|
|
1771
1771
|
const pollMs = ${Math.max(1, Math.round(pollMs))}
|
|
1772
1772
|
const strict = ${strict ? "true" : "false"}
|
|
1773
|
-
const
|
|
1773
|
+
const screenStill = ${screenStill ? "true" : "false"}
|
|
1774
1774
|
const maestro = ${maestro ? "true" : "false"}
|
|
1775
1775
|
const accessibilityBounds = ${accessibilityBounds.toString()}
|
|
1776
1776
|
const sameNativeAccessibilityShape = ${sameNativeAccessibilityShape.toString()}
|
|
@@ -1780,541 +1780,525 @@ async function waitForSootsimIdle({
|
|
|
1780
1780
|
// tight budgets (auto-wait) settle on worker stillness plus root
|
|
1781
1781
|
// membership, generous ones confirm the geometry too.
|
|
1782
1782
|
const fullGeometry = ${!maestro && maxMs >= 1e3 ? "true" : "false"}
|
|
1783
|
-
const requiredStillMs =
|
|
1784
|
-
const minimumStablePolls =
|
|
1785
|
-
const composite = paintStill ? globalThis.SootSim?.bridges?.liveComposite : null
|
|
1786
|
-
if (paintStill && !composite) {
|
|
1787
|
-
return { settled: false, elapsed: clockNow() - start, blockedBy: 'screen pixels unavailable' }
|
|
1788
|
-
}
|
|
1789
|
-
// subscribe to presented frames; authoritative screenshots force a
|
|
1790
|
-
// worker render, which changes the very counter we used to inspect.
|
|
1791
|
-
const unsubscribe = composite?.subscribe(() => {})
|
|
1783
|
+
const requiredStillMs = screenStill ? 0 : ${Math.max(1, Math.round(stablePolls)) * Math.max(1, Math.round(pollMs))}
|
|
1784
|
+
const minimumStablePolls = screenStill ? 1 : ${Math.min(2, Math.max(1, Math.round(stablePolls)))}
|
|
1792
1785
|
let transitionEndedAt = null
|
|
1793
|
-
let pixelFrameToken = -1
|
|
1794
|
-
let screenPixels = null
|
|
1795
1786
|
// the hierarchy read last taken and the geometry revision it answered.
|
|
1796
1787
|
// it outlives this wait: a revision still current when a later wait
|
|
1797
1788
|
// polls names the same geometry, so a step that follows a settled one
|
|
1798
1789
|
// proves an unchanged screen without walking the tree again.
|
|
1799
1790
|
const geometry = (globalThis.__peachSettleGeometry ??= { revision: null, hierarchy: null })
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
const
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
Promise
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1791
|
+
// discover transitions while observing layout. when motion starts,
|
|
1792
|
+
// observations from before its completion cannot prove the new screen;
|
|
1793
|
+
// those that began after it drained still can. a loaded host runs a
|
|
1794
|
+
// push past a tap's budget, so the transition gets its own timeout and
|
|
1795
|
+
// the budget restarts once it drains.
|
|
1796
|
+
let transitionWait = (async () => {
|
|
1797
|
+
try {
|
|
1798
|
+
const wfst = globalThis.__sootsimTest?.waitForScreenTransitions
|
|
1799
|
+
if (typeof wfst === 'function' && budgetMs > 120) {
|
|
1800
|
+
const transition = await wfst({
|
|
1801
|
+
timeoutMs: ${Math.max(0, Math.round(transitionTimeoutMs))},
|
|
1802
|
+
settleMs: 64,
|
|
1803
|
+
startWindowMs: ${Math.max(0, Math.round(transitionStartWindowMs))},
|
|
1804
|
+
})
|
|
1805
|
+
if (transition?.started !== true) return false
|
|
1806
|
+
// a loaded worker replies long after the motion stopped; it
|
|
1807
|
+
// reports how long ago, so polls begun since still count. a
|
|
1808
|
+
// runtime without the field ends the transition at the reply.
|
|
1809
|
+
const rested = typeof transition.restedMs === 'number' ? Math.max(0, transition.restedMs) : 0
|
|
1810
|
+
transitionEndedAt = clockNow() - rested
|
|
1811
|
+
deadline = Math.max(deadline, transitionEndedAt + budgetMs)
|
|
1812
|
+
return true
|
|
1813
|
+
}
|
|
1814
|
+
} catch {}
|
|
1815
|
+
return false
|
|
1816
|
+
})()
|
|
1817
|
+
|
|
1818
|
+
// a worker that cannot answer within the remaining budget is busy, not
|
|
1819
|
+
// idle: its poll reads as unsettled. bounding each read by the budget
|
|
1820
|
+
// keeps a busy worker from holding a poll past the deadline.
|
|
1821
|
+
const BUSY = { busy: true }
|
|
1822
|
+
const answer = (read) =>
|
|
1823
|
+
Promise.race([
|
|
1824
|
+
Promise.resolve().then(read),
|
|
1825
|
+
new Promise((resolve) =>
|
|
1826
|
+
setTimeout(() => resolve(BUSY), Math.max(deadline - clockNow(), 100)),
|
|
1827
|
+
),
|
|
1828
|
+
])
|
|
1829
|
+
|
|
1830
|
+
const readSnapshot = async () => {
|
|
1831
|
+
let animating = false
|
|
1832
|
+
let animatingBy = ''
|
|
1833
|
+
let layoutDirty = false
|
|
1834
|
+
let pendingFetches = 0
|
|
1835
|
+
let workerBusy = false
|
|
1836
|
+
let requestTotal = 0
|
|
1837
|
+
let requestInFlight = 0
|
|
1838
|
+
let appCommits = null
|
|
1839
|
+
let nodeCount = null
|
|
1840
|
+
let renderStatsAvailable = false
|
|
1841
|
+
let shellAnimating = false
|
|
1842
|
+
let shellBlockers = ''
|
|
1843
|
+
let webViewStarting = false
|
|
1844
|
+
let webViewBlocker = ''
|
|
1845
|
+
let visibleMotion = false
|
|
1846
|
+
let visibleMotionBy = ''
|
|
1847
|
+
// the reads are independent, so they run concurrently: a loaded sim
|
|
1848
|
+
// answers each one late, and a poll that waits for them in turn
|
|
1849
|
+
// costs their sum, which fits too few polls in the budget to settle.
|
|
1850
|
+
// the window node count is the exception: it launches after the
|
|
1851
|
+
// motion read, so a poll motion already fails skips that walk.
|
|
1852
|
+
// strict reads also wait out shell motion. pixel reads inspect finite
|
|
1853
|
+
// animations in both realms: a worklet can move the app while the
|
|
1854
|
+
// tenant's basic animation flag and last presented pixels read still.
|
|
1855
|
+
const accessibilityRead = maestro
|
|
1856
|
+
? answer(() => globalThis.__sootsimTest.captureAccessibilityTree()).catch(() => null)
|
|
1857
|
+
: null
|
|
1858
|
+
const motionRead = strict || screenStill
|
|
1859
|
+
? answer(() => globalThis.__sootsimTest?.listAnimations?.()).catch(() => null)
|
|
1860
|
+
: null
|
|
1861
|
+
const statsRead = answer(() => globalThis.__sootsimRenderHost?.queryStats?.()).catch(() => null)
|
|
1862
|
+
// image preparation ends in the tenant before the compositor decodes
|
|
1863
|
+
// and realizes its pixels. both owners must finish before settling.
|
|
1864
|
+
// the compositor rejects a stats request it is too busy to answer.
|
|
1865
|
+
const compositorRead = answer(() => globalThis.__sootsimCompositor.getStats({ detail: 'readiness' })).catch(() => BUSY)
|
|
1866
|
+
const countsRead = answer(() => globalThis.__sootsimTest?.getRequestCounts?.()).catch(() => null)
|
|
1867
|
+
// the mounted hierarchy in render-worker mode comes from the test
|
|
1868
|
+
// bridge: globalThis.__sootsimRoot is an empty placeholder there, so a
|
|
1869
|
+
// walk over it hashes every screen to the same empty string while
|
|
1870
|
+
// it moves. listInspectable is the worker-backed read describe
|
|
1871
|
+
// uses; a worker too busy to answer it reads as unsettled. tight
|
|
1872
|
+
// budgets skip this read and settle on the cheaper signals above.
|
|
1873
|
+
// it walks every node, so a poll whose geometry revision matches the
|
|
1874
|
+
// last read, in this wait or an earlier one, reuses that read.
|
|
1875
|
+
const hierarchyRead =
|
|
1876
|
+
fullGeometry && typeof globalThis.__sootsimTest?.listInspectable === 'function'
|
|
1877
|
+
? answer(() => globalThis.__sootsimTest.getGeometryRevision?.())
|
|
1878
|
+
.catch(() => null)
|
|
1879
|
+
.then((revision) => {
|
|
1880
|
+
if (revision === BUSY) return BUSY
|
|
1881
|
+
if (typeof revision === 'string' && geometry.revision === revision) return geometry.hierarchy
|
|
1882
|
+
return answer(() => globalThis.__sootsimTest.listInspectable({}))
|
|
1883
|
+
.catch(() => null)
|
|
1884
|
+
.then((hierarchy) => {
|
|
1885
|
+
const kept = typeof revision === 'string' && Array.isArray(hierarchy)
|
|
1886
|
+
geometry.revision = kept ? revision : null
|
|
1887
|
+
geometry.hierarchy = kept ? hierarchy : null
|
|
1888
|
+
return hierarchy
|
|
1889
|
+
})
|
|
1890
|
+
})
|
|
1869
1891
|
: null
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
geometry.revision = kept ? revision : null
|
|
1896
|
-
geometry.hierarchy = kept ? hierarchy : null
|
|
1897
|
-
return hierarchy
|
|
1898
|
-
})
|
|
1899
|
-
})
|
|
1900
|
-
: null
|
|
1901
|
-
if (motionRead) {
|
|
1902
|
-
const motion = await motionRead
|
|
1903
|
-
if (motion === BUSY) workerBusy = true
|
|
1904
|
-
else if (Array.isArray(motion)) {
|
|
1905
|
-
const blocking = motion.filter((anim) =>
|
|
1906
|
-
(anim.realm === 'shell' || paintStill) &&
|
|
1907
|
-
anim.priority !== 'low' && anim.visible !== false &&
|
|
1908
|
-
(!paintStill || anim.loop !== true))
|
|
1909
|
-
shellAnimating = blocking.length > 0
|
|
1910
|
-
// name what holds the settle so a timeout points at its owner.
|
|
1911
|
-
shellBlockers = blocking
|
|
1912
|
-
.slice(0, 4)
|
|
1913
|
-
.map((anim) => anim.source + '/' + anim.kind + '#' + anim.id + ' at ' + anim.current + (anim.loop ? ' loop' : ''))
|
|
1914
|
-
.join(', ')
|
|
1915
|
-
}
|
|
1892
|
+
if (motionRead) {
|
|
1893
|
+
const motion = await motionRead
|
|
1894
|
+
if (motion === BUSY) workerBusy = true
|
|
1895
|
+
else if (Array.isArray(motion)) {
|
|
1896
|
+
const blocking = motion.filter((anim) =>
|
|
1897
|
+
(anim.realm === 'shell' || screenStill) &&
|
|
1898
|
+
anim.priority !== 'low' && anim.visible !== false &&
|
|
1899
|
+
(!screenStill || anim.loop !== true))
|
|
1900
|
+
shellAnimating = blocking.length > 0
|
|
1901
|
+
// what blocking leaves out still moves the screen while visible;
|
|
1902
|
+
// it ends a screen-still wait only at maestro's hierarchy check
|
|
1903
|
+
// or the deadline, as a screen that never holds still does on ios.
|
|
1904
|
+
const moving = screenStill
|
|
1905
|
+
? motion.filter((anim) => anim.visible !== false && !blocking.includes(anim))
|
|
1906
|
+
: []
|
|
1907
|
+
visibleMotion = moving.length > 0
|
|
1908
|
+
visibleMotionBy = moving
|
|
1909
|
+
.slice(0, 4)
|
|
1910
|
+
.map((anim) => anim.source + '/' + anim.kind + '#' + anim.id + (anim.loop ? ' loop' : '') + (anim.priority === 'low' ? ' low' : ''))
|
|
1911
|
+
.join(', ')
|
|
1912
|
+
// name what holds the settle so a timeout points at its owner.
|
|
1913
|
+
shellBlockers = blocking
|
|
1914
|
+
.slice(0, 4)
|
|
1915
|
+
.map((anim) => anim.source + '/' + anim.kind + '#' + anim.id + ' at ' + anim.current + (anim.loop ? ' loop' : ''))
|
|
1916
|
+
.join(', ')
|
|
1916
1917
|
}
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
}
|
|
1918
|
+
}
|
|
1919
|
+
const stats = await statsRead
|
|
1920
|
+
if (stats === BUSY) {
|
|
1921
|
+
workerBusy = true
|
|
1922
|
+
} else if (!stats && readyPlayback) {
|
|
1923
|
+
workerBusy = true
|
|
1924
|
+
} else if (stats) {
|
|
1925
|
+
renderStatsAvailable = true
|
|
1926
|
+
const missingFields = ['hasActiveBlockingNativeAnimations', 'hasPendingBlockingAnimationFrames']
|
|
1927
|
+
.filter((field) => typeof stats[field] !== 'boolean')
|
|
1928
|
+
if (readyPlayback && typeof stats.hasPendingReadinessAnimationFrames !== 'boolean') missingFields.push('hasPendingReadinessAnimationFrames')
|
|
1929
|
+
if ((strict || readyPlayback) && missingFields.length > 0) {
|
|
1930
|
+
return {
|
|
1931
|
+
runtimeUnsupported: {
|
|
1932
|
+
error: 'runtime_readiness_unsupported',
|
|
1933
|
+
runtimeVersion: globalThis.__sootsimRuntimeVersion || 'unknown',
|
|
1934
|
+
missingFields,
|
|
1935
|
+
},
|
|
1935
1936
|
}
|
|
1936
|
-
// positive checks only: an older runtime without the blocking
|
|
1937
|
-
// fields reads as still, and strict rejects that runtime above
|
|
1938
|
-
// instead of ever settling on unknown motion.
|
|
1939
|
-
animating =
|
|
1940
|
-
stats.hasActiveAnims === true ||
|
|
1941
|
-
stats.hasActiveBlockingNativeAnimations === true ||
|
|
1942
|
-
(!paintStill && (readyPlayback ? stats.hasPendingReadinessAnimationFrames : stats.hasPendingBlockingAnimationFrames) === true)
|
|
1943
|
-
if (animating)
|
|
1944
|
-
animatingBy = [
|
|
1945
|
-
stats.hasActiveAnims === true && 'activeAnims',
|
|
1946
|
-
stats.hasActiveBlockingNativeAnimations === true && 'blockingNative',
|
|
1947
|
-
!paintStill && stats.hasPendingBlockingAnimationFrames === true && 'pendingFrames',
|
|
1948
|
-
!paintStill && stats.hasPendingReadinessAnimationFrames === true && 'pendingReadinessFrames',
|
|
1949
|
-
].filter(Boolean).join('+')
|
|
1950
|
-
// the runtime reports only layout work that can reach the window:
|
|
1951
|
-
// a covered screen or inactive tab committing does not hold it.
|
|
1952
|
-
layoutDirty =
|
|
1953
|
-
stats.layoutDirty === true && stats.renderRequested === true
|
|
1954
|
-
// a freshly-pushed screen showing a skeleton is layout-stable
|
|
1955
|
-
// but not actually settled \u2014 its data/images are still in
|
|
1956
|
-
// flight. treat bounded image-loader fetches as not-idle so
|
|
1957
|
-
// settle waits for real content, capped by the budget.
|
|
1958
|
-
const pf = stats.memory && stats.memory.imageLoader
|
|
1959
|
-
? stats.memory.imageLoader.pendingFetches
|
|
1960
|
-
: 0
|
|
1961
|
-
pendingFetches = typeof pf === 'number' ? pf : 0
|
|
1962
|
-
// tenant layout commits: a screen that keeps committing is still
|
|
1963
|
-
// mounting or remounting, even with no animation flag raised.
|
|
1964
|
-
appCommits = typeof stats.appCommitCount === 'number' ? stats.appCommitCount : null
|
|
1965
1937
|
}
|
|
1966
|
-
//
|
|
1967
|
-
//
|
|
1968
|
-
//
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1938
|
+
// positive checks only: an older runtime without the blocking
|
|
1939
|
+
// fields reads as still, and strict rejects that runtime above
|
|
1940
|
+
// instead of ever settling on unknown motion.
|
|
1941
|
+
animating =
|
|
1942
|
+
stats.hasActiveAnims === true ||
|
|
1943
|
+
stats.hasActiveBlockingNativeAnimations === true ||
|
|
1944
|
+
(!screenStill && (readyPlayback ? stats.hasPendingReadinessAnimationFrames : stats.hasPendingBlockingAnimationFrames) === true)
|
|
1945
|
+
if (animating)
|
|
1946
|
+
animatingBy = [
|
|
1947
|
+
stats.hasActiveAnims === true && 'activeAnims',
|
|
1948
|
+
stats.hasActiveBlockingNativeAnimations === true && 'blockingNative',
|
|
1949
|
+
!screenStill && stats.hasPendingBlockingAnimationFrames === true && 'pendingFrames',
|
|
1950
|
+
!screenStill && stats.hasPendingReadinessAnimationFrames === true && 'pendingReadinessFrames',
|
|
1951
|
+
].filter(Boolean).join('+')
|
|
1952
|
+
// the runtime reports only layout work that can reach the window:
|
|
1953
|
+
// a covered screen or inactive tab committing does not hold it.
|
|
1954
|
+
layoutDirty =
|
|
1955
|
+
stats.layoutDirty === true && stats.renderRequested === true
|
|
1956
|
+
// a freshly-pushed screen showing a skeleton is layout-stable
|
|
1957
|
+
// but not actually settled \u2014 its data/images are still in
|
|
1958
|
+
// flight. treat bounded image-loader fetches as not-idle so
|
|
1959
|
+
// settle waits for real content, capped by the budget.
|
|
1960
|
+
const pf = stats.memory && stats.memory.imageLoader
|
|
1961
|
+
? stats.memory.imageLoader.pendingFetches
|
|
1962
|
+
: 0
|
|
1963
|
+
pendingFetches = typeof pf === 'number' ? pf : 0
|
|
1964
|
+
// tenant layout commits: a screen that keeps committing is still
|
|
1965
|
+
// mounting or remounting, even with no animation flag raised.
|
|
1966
|
+
appCommits = typeof stats.appCommitCount === 'number' ? stats.appCommitCount : null
|
|
1967
|
+
}
|
|
1968
|
+
// mounted-root membership: the count of nodes that can reach the
|
|
1969
|
+
// window moves while the screen mounts, unmounts or recycles, in
|
|
1970
|
+
// either render mode. a screen a pushed one covers or an inactive
|
|
1971
|
+
// tab stays mounted out of the window, so what it mounts is not
|
|
1972
|
+
// screen motion. the worker rebuilds the membership set while the
|
|
1973
|
+
// wire moves on every animated frame, so a poll the motion read
|
|
1974
|
+
// already fails skips it: the motion flags alone prove this poll
|
|
1975
|
+
// unsettled, and the carried count hands the first still poll the
|
|
1976
|
+
// pre-motion baseline to compare against.
|
|
1977
|
+
const motionStill = !workerBusy && !animating && !layoutDirty && !shellAnimating
|
|
1978
|
+
const nodeCountRead = motionStill
|
|
1979
|
+
? answer(() => globalThis.__sootsimTest?.getWindowNodeCount?.()).catch(() => null)
|
|
1980
|
+
: null
|
|
1981
|
+
const compositor = await compositorRead
|
|
1982
|
+
if (compositor === BUSY) {
|
|
1983
|
+
workerBusy = true
|
|
1984
|
+
} else {
|
|
1985
|
+
pendingFetches += compositor.images.pendingFetches
|
|
1986
|
+
pendingFetches += compositor.imageRealization.pending
|
|
1987
|
+
if (compositor.webViewCaptureSettled === false) {
|
|
1988
|
+
webViewStarting = true
|
|
1989
|
+
webViewBlocker = 'compositor webView capture not settled'
|
|
1989
1990
|
}
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
1991
|
+
}
|
|
1992
|
+
const counts = await countsRead
|
|
1993
|
+
if (counts === BUSY) workerBusy = true
|
|
1994
|
+
// <Image> loads are left to the image loader, which counts only those
|
|
1995
|
+
// that can reach the window. a runtime older than the CLI reports none.
|
|
1996
|
+
const imageLoads = counts?.imageLoads ?? { total: 0, inFlight: 0 }
|
|
1997
|
+
requestTotal = typeof counts?.total === 'number' ? counts.total - imageLoads.total : 0
|
|
1998
|
+
requestInFlight = typeof counts?.inFlight === 'number' ? counts.inFlight - imageLoads.inFlight : 0
|
|
1999
|
+
// a skipped read carries the last count: mounts during motion still
|
|
2000
|
+
// break the first still poll after it, instead of a blank baseline
|
|
2001
|
+
// reading them as stable.
|
|
2002
|
+
const total = nodeCountRead ? await nodeCountRead : lastNodeCount
|
|
2003
|
+
if (total === BUSY) workerBusy = true
|
|
2004
|
+
nodeCount = typeof total === 'number' ? total : null
|
|
2005
|
+
const accessibility = accessibilityRead ? await accessibilityRead : null
|
|
2006
|
+
const nativeHierarchy = Array.isArray(accessibility) && accessibility.length > 0
|
|
2007
|
+
? accessibility
|
|
2008
|
+
: null
|
|
2009
|
+
if (accessibility === BUSY) workerBusy = true
|
|
2010
|
+
let hierarchy = hierarchyRead ? await hierarchyRead : null
|
|
2011
|
+
if (hierarchy === BUSY) {
|
|
2012
|
+
workerBusy = true
|
|
2013
|
+
hierarchy = null
|
|
2014
|
+
} else if (!Array.isArray(hierarchy)) {
|
|
2015
|
+
hierarchy = null
|
|
2016
|
+
}
|
|
2017
|
+
const nodes = []
|
|
2018
|
+
// identity beside each geometry entry, from the rows already read,
|
|
2019
|
+
// so a changed layout can name the nodes that moved.
|
|
2020
|
+
const nodeRows = []
|
|
2021
|
+
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
|
|
2022
|
+
const noteLoading = (state, text) => {
|
|
2023
|
+
if (state?.busy === true) {
|
|
2024
|
+
webViewStarting = true
|
|
2025
|
+
if (!webViewBlocker) webViewBlocker = 'accessibility busy state active'
|
|
2014
2026
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2027
|
+
if (typeof text === 'string' && LOADING_TEXT_REGEX.test(text.trim())) {
|
|
2028
|
+
webViewStarting = true
|
|
2029
|
+
if (!webViewBlocker) webViewBlocker = 'webView startup in progress ("' + text.trim() + '")'
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
if (hierarchy) {
|
|
2033
|
+
for (const n of hierarchy) {
|
|
2034
|
+
const layout = n && n.layout
|
|
2035
|
+
if (layout && layout.width > 0) {
|
|
2036
|
+
// painted bounds catch a scroll fling. background playback
|
|
2037
|
+
// keeps a view's painted bounds moving forever, so it and its
|
|
2038
|
+
// subtree count by their own layout; the rest of the screen
|
|
2039
|
+
// still catches the fling.
|
|
2040
|
+
const abs = n.backgroundPlayback ? layout : n.absolute || n.absolutePosition || layout
|
|
2041
|
+
const geometry = Math.round(abs.x) + ',' + Math.round(abs.y) + ',' + Math.round(layout.width)
|
|
2042
|
+
nodes.push(geometry)
|
|
2043
|
+
nodeRows.push([String(n.nodeId ?? nodes.length - 1), (n.type || '?') + (n.testId ? '#' + n.testId : ''), geometry])
|
|
2028
2044
|
}
|
|
2045
|
+
noteLoading(
|
|
2046
|
+
n.accessibilityState,
|
|
2047
|
+
typeof n.text === 'string' ? n.text : '',
|
|
2048
|
+
)
|
|
2029
2049
|
}
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
// subtree count by their own layout; the rest of the screen
|
|
2037
|
-
// still catches the fling.
|
|
2038
|
-
const abs = n.backgroundPlayback ? layout : n.absolute || n.absolutePosition || layout
|
|
2039
|
-
const geometry = Math.round(abs.x) + ',' + Math.round(abs.y) + ',' + Math.round(layout.width)
|
|
2050
|
+
} else {
|
|
2051
|
+
const root = globalThis.__sootsimRoot
|
|
2052
|
+
if (root) {
|
|
2053
|
+
const walk = (n) => {
|
|
2054
|
+
if (n.layout && n.layout.width > 0) {
|
|
2055
|
+
const geometry = Math.round(n.layout.x) + ',' + Math.round(n.layout.y) + ',' + Math.round(n.layout.width)
|
|
2040
2056
|
nodes.push(geometry)
|
|
2041
|
-
nodeRows.push([String(n.
|
|
2057
|
+
nodeRows.push([String(n.id ?? nodes.length - 1), (n.type || '?') + (n.props?.testID ? '#' + n.props.testID : ''), geometry])
|
|
2042
2058
|
}
|
|
2043
2059
|
noteLoading(
|
|
2044
|
-
n.accessibilityState,
|
|
2045
|
-
typeof n.
|
|
2060
|
+
n.props?.accessibilityState,
|
|
2061
|
+
n.textContent || (typeof n.props?.children === 'string' ? n.props.children : ''),
|
|
2046
2062
|
)
|
|
2063
|
+
for (const c of n.children || []) walk(c)
|
|
2047
2064
|
}
|
|
2048
|
-
|
|
2049
|
-
const root = globalThis.__sootsimRoot
|
|
2050
|
-
if (root) {
|
|
2051
|
-
const walk = (n) => {
|
|
2052
|
-
if (n.layout && n.layout.width > 0) {
|
|
2053
|
-
const geometry = Math.round(n.layout.x) + ',' + Math.round(n.layout.y) + ',' + Math.round(n.layout.width)
|
|
2054
|
-
nodes.push(geometry)
|
|
2055
|
-
nodeRows.push([String(n.id ?? nodes.length - 1), (n.type || '?') + (n.props?.testID ? '#' + n.props.testID : ''), geometry])
|
|
2056
|
-
}
|
|
2057
|
-
noteLoading(
|
|
2058
|
-
n.props?.accessibilityState,
|
|
2059
|
-
n.textContent || (typeof n.props?.children === 'string' ? n.props.children : ''),
|
|
2060
|
-
)
|
|
2061
|
-
for (const c of n.children || []) walk(c)
|
|
2062
|
-
}
|
|
2063
|
-
walk(root)
|
|
2064
|
-
}
|
|
2065
|
+
walk(root)
|
|
2065
2066
|
}
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2067
|
+
}
|
|
2068
|
+
if (!webViewStarting && typeof document !== 'undefined') {
|
|
2069
|
+
const busyEl = [...document.querySelectorAll('[aria-busy="true"]')].find((element) => {
|
|
2070
|
+
const bounds = element.getBoundingClientRect()
|
|
2071
|
+
return element.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true }) &&
|
|
2072
|
+
bounds.width > 0 && bounds.height > 0 && bounds.right > 0 && bounds.bottom > 0 &&
|
|
2073
|
+
bounds.left < globalThis.innerWidth && bounds.top < globalThis.innerHeight
|
|
2074
|
+
})
|
|
2075
|
+
if (busyEl) {
|
|
2076
|
+
webViewStarting = true
|
|
2077
|
+
webViewBlocker = 'accessibility busy element displayed'
|
|
2078
|
+
} else {
|
|
2079
|
+
// a loading document with no area (an app's hidden worker or
|
|
2080
|
+
// executor frame) paints nothing, and a screenshot on device
|
|
2081
|
+
// does not wait for it.
|
|
2082
|
+
const unreadyWebView = [...document.querySelectorAll(
|
|
2083
|
+
'[data-sootsim-webview-loading="true"], [data-sootsim-webview-mode="placeholder"]'
|
|
2084
|
+
)].find((view) => {
|
|
2085
|
+
const frame = view.querySelector('iframe')
|
|
2086
|
+
return !frame || frame.clientWidth > 0 || frame.clientHeight > 0
|
|
2072
2087
|
})
|
|
2073
|
-
if (
|
|
2088
|
+
if (unreadyWebView) {
|
|
2074
2089
|
webViewStarting = true
|
|
2075
|
-
webViewBlocker = '
|
|
2076
|
-
} else {
|
|
2077
|
-
// a loading document with no area (an app's hidden worker or
|
|
2078
|
-
// executor frame) paints nothing, and a screenshot on device
|
|
2079
|
-
// does not wait for it.
|
|
2080
|
-
const unreadyWebView = [...document.querySelectorAll(
|
|
2081
|
-
'[data-sootsim-webview-loading="true"], [data-sootsim-webview-mode="placeholder"]'
|
|
2082
|
-
)].find((view) => {
|
|
2083
|
-
const frame = view.querySelector('iframe')
|
|
2084
|
-
return !frame || frame.clientWidth > 0 || frame.clientHeight > 0
|
|
2085
|
-
})
|
|
2086
|
-
if (unreadyWebView) {
|
|
2087
|
-
webViewStarting = true
|
|
2088
|
-
webViewBlocker = 'webView document still loading'
|
|
2089
|
-
}
|
|
2090
|
+
webViewBlocker = 'webView document still loading'
|
|
2090
2091
|
}
|
|
2091
2092
|
}
|
|
2092
|
-
if (paintStill) {
|
|
2093
|
-
const canvas = composite.getCanvas()
|
|
2094
|
-
const token = composite.getFrameToken()
|
|
2095
|
-
if (!canvas || canvas.width <= 1 || canvas.height <= 1) {
|
|
2096
|
-
screenPixels = null
|
|
2097
|
-
} else if (token !== pixelFrameToken || canvas.width !== screenPixels?.width || canvas.height !== screenPixels?.height) {
|
|
2098
|
-
const context = canvas.getContext('2d')
|
|
2099
|
-
const image = context?.getImageData(0, 0, canvas.width, canvas.height)
|
|
2100
|
-
screenPixels = image ? { width: image.width, height: image.height, data: new Uint32Array(image.data.buffer) } : null
|
|
2101
|
-
pixelFrameToken = token
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
return { layout: nodes.join(';'), nodeRows, nativeHierarchy, screenPixels, animating, animatingBy, shellAnimating, shellBlockers, layoutDirty, pendingFetches, workerBusy, webViewStarting, webViewBlocker, renderStatsAvailable, requestTotal, requestInFlight, appCommits, nodeCount }
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
|
-
// how long generic background network is allowed to keep us waiting AFTER
|
|
2108
|
-
// the screen is otherwise visually settled. apps with continuous traffic
|
|
2109
|
-
// (polling, realtime sockets, a tap that fires 20-50 fetches) never reach
|
|
2110
|
-
// requestInFlight===0 / a stable requestTotal, so requiring full network
|
|
2111
|
-
// quiet burns the ENTIRE budget on every command \u2014 the leading idle that
|
|
2112
|
-
// failed PR-preview recordings for network-heavy apps (3pc fight-pulse).
|
|
2113
|
-
// layout-stability + the image-loader already prove visible content
|
|
2114
|
-
// loaded (a data load changes layout; an image load shows in the loader),
|
|
2115
|
-
// so the generic request counters are a courtesy, not a gate: honor them
|
|
2116
|
-
// only within this grace once the screen is visually still.
|
|
2117
|
-
const networkQuietGraceMs = 1200
|
|
2118
|
-
let lastNativeHierarchy = null
|
|
2119
|
-
let lastLayout = ''
|
|
2120
|
-
let lastNodeRows = []
|
|
2121
|
-
// what moved between the last two differing polls, bounded; names the
|
|
2122
|
-
// nodes behind "layout changed" without keeping any poll history.
|
|
2123
|
-
let lastLayoutChange = null
|
|
2124
|
-
const describeLayoutChange = (before, after) => {
|
|
2125
|
-
const previous = new Map(before.map(([key, label, geometry]) => [key, [label, geometry]]))
|
|
2126
|
-
const moved = []
|
|
2127
|
-
const added = []
|
|
2128
|
-
const short = (label, key) => String(label).slice(0, 48) + ' [' + String(key).slice(0, 24) + ']'
|
|
2129
|
-
for (const [key, label, geometry] of after) {
|
|
2130
|
-
const was = previous.get(key)
|
|
2131
|
-
previous.delete(key)
|
|
2132
|
-
if (!was) added.push(short(label, key) + ' ' + geometry)
|
|
2133
|
-
else if (was[1] !== geometry) moved.push(short(label, key) + ' ' + was[1] + '->' + geometry)
|
|
2134
|
-
}
|
|
2135
|
-
const removed = [...previous].map(([key, [label, geometry]]) => short(label, key) + ' ' + geometry)
|
|
2136
|
-
return {
|
|
2137
|
-
moved: moved.length, added: added.length, removed: removed.length,
|
|
2138
|
-
movedSample: moved.slice(0, 3), addedSample: added.slice(0, 3), removedSample: removed.slice(0, 3),
|
|
2139
|
-
}
|
|
2140
2093
|
}
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
//
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2094
|
+
return { layout: nodes.join(';'), nodeRows, nativeHierarchy, visibleMotion, visibleMotionBy, animating, animatingBy, shellAnimating, shellBlockers, layoutDirty, pendingFetches, workerBusy, webViewStarting, webViewBlocker, renderStatsAvailable, requestTotal, requestInFlight, appCommits, nodeCount }
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
// how long generic background network is allowed to keep us waiting AFTER
|
|
2098
|
+
// the screen is otherwise visually settled. apps with continuous traffic
|
|
2099
|
+
// (polling, realtime sockets, a tap that fires 20-50 fetches) never reach
|
|
2100
|
+
// requestInFlight===0 / a stable requestTotal, so requiring full network
|
|
2101
|
+
// quiet burns the ENTIRE budget on every command \u2014 the leading idle that
|
|
2102
|
+
// failed PR-preview recordings for network-heavy apps (3pc fight-pulse).
|
|
2103
|
+
// layout-stability + the image-loader already prove visible content
|
|
2104
|
+
// loaded (a data load changes layout; an image load shows in the loader),
|
|
2105
|
+
// so the generic request counters are a courtesy, not a gate: honor them
|
|
2106
|
+
// only within this grace once the screen is visually still.
|
|
2107
|
+
const networkQuietGraceMs = 1200
|
|
2108
|
+
let lastNativeHierarchy = null
|
|
2109
|
+
let lastLayout = ''
|
|
2110
|
+
let lastNodeRows = []
|
|
2111
|
+
// what moved between the last two differing polls, bounded; names the
|
|
2112
|
+
// nodes behind "layout changed" without keeping any poll history.
|
|
2113
|
+
let lastLayoutChange = null
|
|
2114
|
+
const describeLayoutChange = (before, after) => {
|
|
2115
|
+
const previous = new Map(before.map(([key, label, geometry]) => [key, [label, geometry]]))
|
|
2116
|
+
const moved = []
|
|
2117
|
+
const added = []
|
|
2118
|
+
const short = (label, key) => String(label).slice(0, 48) + ' [' + String(key).slice(0, 24) + ']'
|
|
2119
|
+
for (const [key, label, geometry] of after) {
|
|
2120
|
+
const was = previous.get(key)
|
|
2121
|
+
previous.delete(key)
|
|
2122
|
+
if (!was) added.push(short(label, key) + ' ' + geometry)
|
|
2123
|
+
else if (was[1] !== geometry) moved.push(short(label, key) + ' ' + was[1] + '->' + geometry)
|
|
2124
|
+
}
|
|
2125
|
+
const removed = [...previous].map(([key, [label, geometry]]) => short(label, key) + ' ' + geometry)
|
|
2126
|
+
return {
|
|
2127
|
+
moved: moved.length, added: added.length, removed: removed.length,
|
|
2128
|
+
movedSample: moved.slice(0, 3), addedSample: added.slice(0, 3), removedSample: removed.slice(0, 3),
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
let screenChangedPolls = 0
|
|
2132
|
+
let lastRequestTotal = -1
|
|
2133
|
+
let lastAppCommits = null
|
|
2134
|
+
let lastNodeCount = null
|
|
2135
|
+
// the last completed poll and the values it was compared against.
|
|
2136
|
+
let report = null
|
|
2137
|
+
// the still polls of the current run, when each began and answered
|
|
2138
|
+
let stillPolls = []
|
|
2139
|
+
let lastIdlePoll = null
|
|
2140
|
+
let visuallyStillSince = 0
|
|
2141
|
+
// counts across the whole budget: a flag that is true on every poll is a
|
|
2142
|
+
// different bug from one that is true intermittently, and the two need
|
|
2143
|
+
// opposite fixes (engine vs budget).
|
|
2144
|
+
let polls = 0
|
|
2145
|
+
let dirtyPolls = 0
|
|
2146
|
+
let animatingPolls = 0
|
|
2147
|
+
let layoutChangedPolls = 0
|
|
2148
|
+
let webViewStartingPolls = 0
|
|
2149
|
+
const hierarchyUnchanged = (current, previous) =>
|
|
2150
|
+
current !== null && previous !== null && current.length === previous.length &&
|
|
2151
|
+
current.every((node, index) => sameNativeAccessibilityShape(node, previous[index], accessibilityBounds))
|
|
2152
|
+
while (true) {
|
|
2153
|
+
if (clockNow() >= deadline) {
|
|
2154
|
+
if (!transitionWait) break
|
|
2155
|
+
await transitionWait
|
|
2156
|
+
transitionWait = null
|
|
2157
|
+
// nothing polled while parked on the transition, and a loaded
|
|
2158
|
+
// worker's late reply would spend the restarted budget unobserved.
|
|
2159
|
+
if (transitionEndedAt !== null) deadline = Math.max(deadline, clockNow() + budgetMs)
|
|
2160
|
+
if (clockNow() >= deadline) break
|
|
2161
|
+
}
|
|
2162
|
+
const pollStarted = clockNow()
|
|
2163
|
+
const snapshot = await readSnapshot()
|
|
2164
|
+
if (snapshot.runtimeUnsupported) return snapshot.runtimeUnsupported
|
|
2165
|
+
// a read the deadline cut short observed nothing: the last full poll
|
|
2166
|
+
// names what held the settle, not a worker that ran out of budget.
|
|
2167
|
+
// the loop head drains a transition still in flight before it ends.
|
|
2168
|
+
if (snapshot.workerBusy && clockNow() >= deadline && report) continue
|
|
2169
|
+
polls++
|
|
2170
|
+
report = { snapshot, nativeHierarchy: lastNativeHierarchy, layout: lastLayout, requestTotal: lastRequestTotal, appCommits: lastAppCommits, nodeCount: lastNodeCount }
|
|
2171
|
+
if (snapshot.layoutDirty) dirtyPolls++
|
|
2172
|
+
if (snapshot.animating || snapshot.shellAnimating) animatingPolls++
|
|
2173
|
+
if (snapshot.webViewStarting) webViewStartingPolls++
|
|
2174
|
+
if (polls > 1 && snapshot.layout !== lastLayout) {
|
|
2175
|
+
layoutChangedPolls++
|
|
2176
|
+
lastLayoutChange = describeLayoutChange(lastNodeRows, snapshot.nodeRows)
|
|
2177
|
+
}
|
|
2178
|
+
// the first poll has nothing to compare, so it cannot prove a still screen
|
|
2179
|
+
const screenChanged = screenStill && (
|
|
2180
|
+
polls === 1 ||
|
|
2181
|
+
snapshot.visibleMotion ||
|
|
2182
|
+
(snapshot.appCommits !== null && lastAppCommits !== null && snapshot.appCommits !== lastAppCommits) ||
|
|
2183
|
+
(snapshot.nodeCount !== null && lastNodeCount !== null && snapshot.nodeCount !== lastNodeCount) ||
|
|
2184
|
+
snapshot.layout !== lastLayout ||
|
|
2185
|
+
(maestro && !hierarchyUnchanged(snapshot.nativeHierarchy, lastNativeHierarchy))
|
|
2186
|
+
)
|
|
2187
|
+
if (polls > 1 && screenChanged) screenChangedPolls++
|
|
2188
|
+
const strictOk =
|
|
2189
|
+
!strict ||
|
|
2190
|
+
(snapshot.renderStatsAvailable &&
|
|
2224
2191
|
!snapshot.animating &&
|
|
2225
2192
|
!snapshot.shellAnimating &&
|
|
2226
|
-
!snapshot.layoutDirty
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2193
|
+
!snapshot.layoutDirty)
|
|
2194
|
+
// visually settled: no worker motion or layout work, no new layout
|
|
2195
|
+
// commits, a stable mounted node count, no image content loading
|
|
2196
|
+
// (unless motion alone is asked), no webview startup in progress,
|
|
2197
|
+
// layout unchanged since the last poll. both modes wait out finite
|
|
2198
|
+
// worker motion now; strict additionally implies the flags through
|
|
2199
|
+
// strictOk and adds shell motion plus the blocking-stats floor. a
|
|
2200
|
+
// null count or commit reading means the runtime does not report
|
|
2201
|
+
// it, which reads as stable the way a missing stats block does.
|
|
2202
|
+
// equal presented pixels can precede pending worker motion or layout.
|
|
2203
|
+
// after that work drains, iOS's 3 s pixel phase may accept two equal
|
|
2204
|
+
// native TreeNodes while paint-only playback continues. overlap
|
|
2205
|
+
// hierarchy reads so neither the gesture nor screenshot deadline grows.
|
|
2206
|
+
const maestroStill = !snapshot.workerBusy && snapshot.pendingFetches === 0 && snapshot.requestInFlight === 0 && !snapshot.webViewStarting &&
|
|
2207
|
+
!snapshot.animating && !snapshot.shellAnimating && !snapshot.layoutDirty && (
|
|
2208
|
+
!screenChanged || (clockNow() - start >= 3000 &&
|
|
2209
|
+
hierarchyUnchanged(snapshot.nativeHierarchy, lastNativeHierarchy))
|
|
2210
|
+
)
|
|
2211
|
+
const idleSnapshot =
|
|
2212
|
+
strictOk &&
|
|
2213
|
+
!snapshot.animating &&
|
|
2214
|
+
!snapshot.shellAnimating &&
|
|
2215
|
+
!snapshot.layoutDirty &&
|
|
2216
|
+
snapshot.pendingFetches === 0 &&
|
|
2217
|
+
!snapshot.workerBusy &&
|
|
2218
|
+
!snapshot.webViewStarting
|
|
2219
|
+
const visuallyStill = maestro ? maestroStill :
|
|
2220
|
+
idleSnapshot &&
|
|
2221
|
+
(snapshot.appCommits === null || lastAppCommits === null || snapshot.appCommits === lastAppCommits) &&
|
|
2222
|
+
(snapshot.nodeCount === null || lastNodeCount === null || snapshot.nodeCount === lastNodeCount) &&
|
|
2223
|
+
!screenChanged &&
|
|
2224
|
+
snapshot.layout === lastLayout
|
|
2225
|
+
// generic network quiet: nothing in flight and no new requests issued.
|
|
2226
|
+
const networkQuiet =
|
|
2227
|
+
snapshot.requestInFlight === 0 && snapshot.requestTotal === lastRequestTotal
|
|
2228
|
+
if (visuallyStill) {
|
|
2229
|
+
if (visuallyStillSince === 0) visuallyStillSince = clockNow()
|
|
2230
|
+
// two equal idle observations prove the interval between them.
|
|
2231
|
+
// discarding the first requires a third worker round trip, which
|
|
2232
|
+
// can exhaust the budget after a late image on a loaded host.
|
|
2233
|
+
if (!maestro && !screenStill && stillPolls.length === 0 && lastIdlePoll) {
|
|
2234
|
+
stillPolls.push(lastIdlePoll)
|
|
2235
|
+
}
|
|
2236
|
+
stillPolls.push({ started: pollStarted, answered: clockNow() })
|
|
2237
|
+
// still long enough, counting only polls that began after a started
|
|
2238
|
+
// transition drained.
|
|
2239
|
+
const stillProven = () => {
|
|
2240
|
+
const proving = stillPolls.filter((poll) => transitionEndedAt === null || poll.started >= transitionEndedAt)
|
|
2241
|
+
return proving.length >= minimumStablePolls && clockNow() - proving[0].answered >= requiredStillMs
|
|
2242
|
+
}
|
|
2243
|
+
// settle once the screen has held still long enough AND either the
|
|
2244
|
+
// network is genuinely quiet OR it has refused to quiet within the
|
|
2245
|
+
// grace (continuous background traffic must not block forever).
|
|
2246
|
+
if (
|
|
2247
|
+
stillProven() &&
|
|
2248
|
+
(maestro || networkQuiet || clockNow() - visuallyStillSince >= networkQuietGraceMs)
|
|
2249
|
+
) {
|
|
2250
|
+
if (transitionWait) {
|
|
2251
|
+
await transitionWait
|
|
2252
|
+
transitionWait = null
|
|
2266
2253
|
}
|
|
2267
|
-
|
|
2268
|
-
stillPolls = []
|
|
2269
|
-
visuallyStillSince = 0
|
|
2254
|
+
if (stillProven()) return { settled: true, elapsed: clockNow() - start, blockedBy: '' }
|
|
2270
2255
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
unsubscribe?.()
|
|
2256
|
+
} else {
|
|
2257
|
+
stillPolls = []
|
|
2258
|
+
visuallyStillSince = 0
|
|
2259
|
+
}
|
|
2260
|
+
lastIdlePoll = idleSnapshot ? { started: pollStarted, answered: clockNow() } : null
|
|
2261
|
+
lastNativeHierarchy = snapshot.nativeHierarchy
|
|
2262
|
+
lastLayout = snapshot.layout
|
|
2263
|
+
lastNodeRows = snapshot.nodeRows
|
|
2264
|
+
lastRequestTotal = snapshot.requestTotal
|
|
2265
|
+
lastAppCommits = snapshot.appCommits
|
|
2266
|
+
lastNodeCount = snapshot.nodeCount
|
|
2267
|
+
// reply latency belongs inside the poll interval; the stillness window
|
|
2268
|
+
// above remains measured from completed observations.
|
|
2269
|
+
const remainingPollMs = pollMs - (clockNow() - pollStarted)
|
|
2270
|
+
if (remainingPollMs > 0) await clockSleep(remainingPollMs)
|
|
2271
|
+
}
|
|
2272
|
+
if (!report) {
|
|
2273
|
+
return { settled: false, elapsed: clockNow() - start, blockedBy: 'no poll fit the budget' }
|
|
2274
|
+
}
|
|
2275
|
+
const last = report.snapshot
|
|
2276
|
+
const blockers = []
|
|
2277
|
+
if (!maestro && strict && !last.renderStatsAvailable) blockers.push('render stats unavailable')
|
|
2278
|
+
if (!maestro && last.animating) blockers.push('animations still running' + (last.animatingBy ? ' (' + last.animatingBy + ')' : ''))
|
|
2279
|
+
if (last.shellAnimating) blockers.push('animations still running (' + last.shellBlockers + ')')
|
|
2280
|
+
if (!maestro && last.layoutDirty) blockers.push('layout still dirty')
|
|
2281
|
+
if (!maestro && last.appCommits !== null && report.appCommits !== null && last.appCommits !== report.appCommits) blockers.push('layout commits still landing')
|
|
2282
|
+
if (!maestro && last.nodeCount !== null && report.nodeCount !== null && last.nodeCount !== report.nodeCount) blockers.push('node count still changing')
|
|
2283
|
+
if (last.pendingFetches > 0) blockers.push(last.pendingFetches + ' image fetches pending')
|
|
2284
|
+
if (last.workerBusy) blockers.push('a render worker too busy to report')
|
|
2285
|
+
if (last.webViewStarting) blockers.push(last.webViewBlocker || 'webView still starting')
|
|
2286
|
+
if (!maestro && last.layout !== report.layout) blockers.push('layout still changing')
|
|
2287
|
+
if (maestro && !hierarchyUnchanged(last.nativeHierarchy, report.nativeHierarchy)) blockers.push(last.nativeHierarchy === null ? 'native accessibility hierarchy unavailable' : 'native accessibility hierarchy still changing')
|
|
2288
|
+
if (screenStill && last.visibleMotion) blockers.push('visible motion continues (' + last.visibleMotionBy + ')')
|
|
2289
|
+
if (last.requestInFlight > 0) blockers.push(last.requestInFlight + ' requests in flight')
|
|
2290
|
+
else if (!maestro && last.requestTotal !== report.requestTotal) blockers.push('new requests issued')
|
|
2291
|
+
if (polls < 2) blockers.push('sim too busy to poll twice')
|
|
2292
|
+
// the last read is still: motion ended too near the deadline for the
|
|
2293
|
+
// stillness window to hold before it.
|
|
2294
|
+
if (!blockers.length) blockers.push('motion ended before stillness was proven')
|
|
2295
|
+
return {
|
|
2296
|
+
settled: false,
|
|
2297
|
+
elapsed: clockNow() - start,
|
|
2298
|
+
blockedBy:
|
|
2299
|
+
blockers.join(', ') + ' over ' + polls + ' polls (layout changed ' + layoutChangedPolls +
|
|
2300
|
+
'x, layoutDirty ' + dirtyPolls + 'x, animating ' + animatingPolls + 'x, webViewStarting ' + webViewStartingPolls + 'x, screen changed ' + screenChangedPolls + 'x)' +
|
|
2301
|
+
(lastLayoutChange ? '; last layout change ' + JSON.stringify(lastLayoutChange) : ''),
|
|
2318
2302
|
}
|
|
2319
2303
|
})()`
|
|
2320
2304
|
},
|
|
@@ -2515,7 +2499,7 @@ function isValidRuntimeVersion(value) {
|
|
|
2515
2499
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
2516
2500
|
|
|
2517
2501
|
// runtime-companion.json
|
|
2518
|
-
var runtime_companion_default = { abi: 1, sha256: "
|
|
2502
|
+
var runtime_companion_default = { abi: 1, sha256: "e31bca40962475bce9d44f3218ea76c4537e744dfed9849160b028389774d5ba", file: "node/cli-e31bca40962475bce9d44f3218ea76c4537e744dfed9849160b028389774d5ba.cjs" };
|
|
2519
2503
|
|
|
2520
2504
|
// src/answeredNativePackages.ts
|
|
2521
2505
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|