peachsim 0.1.2242 → 0.1.2244
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/binary-sidecar.ts +89 -0
- package/cli/bridge-flow-runner.ts +2 -2
- package/cli/cloud-client.ts +2 -0
- package/cli/commands/control.ts +16 -0
- package/cli/commands/device.ts +1 -1
- package/cli/commands/flow.ts +6 -2
- package/cli/commands/inspect/core.ts +0 -20
- package/cli/commands/inspect/settling.ts +15 -2
- package/cli/commands/inspect.ts +5 -5
- package/cli/commands/preview.ts +12 -5
- package/cli/commands/shell-boolean-mode.ts +1 -1
- package/cli/commands/slides.ts +1 -1
- 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 +94 -15
- 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 +16 -5
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +93 -14
- 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 +121 -28
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- 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 +18 -7
- 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 +11 -2
- package/dist-lib/menu.mjs +11 -2
- 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 +3 -3
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- 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 +55 -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 +16 -24
- package/dist-lib/sdk.mjs +16 -22
- package/dist-lib/skills.cjs +973 -755
- package/dist-lib/swift-compile.cjs +4 -3
- package/dist-lib/swift-compile.mjs +4 -3
- 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 +485 -405
- package/dist-lib/vite.cjs +3 -3
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -1
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/src/binarySidecarContract.ts +45 -0
- package/src/host/bridge-host.ts +12 -13
- package/src/menu.ts +14 -0
- package/src/native-static-libraries.ts +82 -1
- package/src/swift-host.ts +6 -7
- package/src/swift-standins.ts +11 -4
- package/src/swift-submit.ts +3 -1
- package/src/swift-wasm-prune.ts +23 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { brotliDecompressSync } from 'node:zlib'
|
|
6
|
+
import { insertPackageVersionsFooter } from '@peach/globals/package-versions'
|
|
7
|
+
import {
|
|
8
|
+
PEACH_SIDECAR_ASSETS,
|
|
9
|
+
PEACH_SIDECAR_BUNDLE,
|
|
10
|
+
PEACH_SIDECAR_DIR,
|
|
11
|
+
PEACH_SIDECAR_MANIFEST,
|
|
12
|
+
readPeachSidecarManifest,
|
|
13
|
+
} from '../src/binarySidecarContract'
|
|
14
|
+
import { cacheDir } from '../src/home-paths'
|
|
15
|
+
|
|
16
|
+
export function isAppBinaryPath(target: string): boolean {
|
|
17
|
+
return (
|
|
18
|
+
/\.(ipa|apk)$/i.test(target) &&
|
|
19
|
+
fs.statSync(target, { throwIfNoEntry: false })?.isFile() === true
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// the plain bundle an ipa or apk we built carries, written as a bundle file
|
|
24
|
+
// with its assets beside it, the layout `peach open` and `peach preview`
|
|
25
|
+
// already read. hermes bytecode alone cannot run in peach.
|
|
26
|
+
export function extractAppBinaryBundle(binary: string): {
|
|
27
|
+
bundlePath: string
|
|
28
|
+
platform: 'ios' | 'android'
|
|
29
|
+
} {
|
|
30
|
+
const file = path.resolve(binary)
|
|
31
|
+
const entries = execFileSync('unzip', ['-Z1', file], {
|
|
32
|
+
encoding: 'utf8',
|
|
33
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
34
|
+
}).split('\n')
|
|
35
|
+
const manifestEntry = entries.find((entry) =>
|
|
36
|
+
new RegExp(
|
|
37
|
+
`^(Payload/[^/]+\\.app|assets)/${PEACH_SIDECAR_DIR}/${PEACH_SIDECAR_MANIFEST.replace('.', '\\.')}$`,
|
|
38
|
+
).test(entry),
|
|
39
|
+
)
|
|
40
|
+
if (!manifestEntry)
|
|
41
|
+
throw new Error(
|
|
42
|
+
`${binary} carries no peach sidecar; only apps built by Contrast include the plain javascript peach runs`,
|
|
43
|
+
)
|
|
44
|
+
const sidecar = path.posix.dirname(manifestEntry)
|
|
45
|
+
const appRoot = path.posix.dirname(sidecar)
|
|
46
|
+
const digest = createHash('sha256').update(fs.readFileSync(file)).digest('hex')
|
|
47
|
+
const out = path.join(cacheDir(), 'app-binaries', digest)
|
|
48
|
+
const bundlePath = path.join(out, 'main.js')
|
|
49
|
+
const extracted = path.join(out, 'extracted')
|
|
50
|
+
if (!fs.existsSync(bundlePath)) {
|
|
51
|
+
fs.rmSync(out, { recursive: true, force: true })
|
|
52
|
+
fs.mkdirSync(extracted, { recursive: true })
|
|
53
|
+
const patterns = [`${sidecar}/*`]
|
|
54
|
+
const iosAssets = `${appRoot}/assets/`
|
|
55
|
+
if (
|
|
56
|
+
appRoot.startsWith('Payload/') &&
|
|
57
|
+
entries.some((entry) => entry.startsWith(iosAssets))
|
|
58
|
+
)
|
|
59
|
+
patterns.push(`${iosAssets}*`)
|
|
60
|
+
execFileSync('unzip', ['-q', '-o', file, ...patterns, '-d', extracted])
|
|
61
|
+
const manifest = readPeachSidecarManifest(
|
|
62
|
+
JSON.parse(fs.readFileSync(path.join(extracted, manifestEntry), 'utf8')),
|
|
63
|
+
)
|
|
64
|
+
const bundle = brotliDecompressSync(
|
|
65
|
+
fs.readFileSync(path.join(extracted, sidecar, PEACH_SIDECAR_BUNDLE)),
|
|
66
|
+
)
|
|
67
|
+
if (createHash('sha256').update(bundle).digest('hex') !== manifest.bundleSha256)
|
|
68
|
+
throw new Error(`${binary}: the peach sidecar bundle does not match its manifest`)
|
|
69
|
+
const assets =
|
|
70
|
+
manifest.platform === 'ios'
|
|
71
|
+
? path.join(extracted, appRoot, 'assets')
|
|
72
|
+
: path.join(extracted, sidecar, PEACH_SIDECAR_ASSETS)
|
|
73
|
+
if (fs.existsSync(assets)) fs.renameSync(assets, path.join(out, 'assets'))
|
|
74
|
+
fs.copyFileSync(
|
|
75
|
+
path.join(extracted, manifestEntry),
|
|
76
|
+
path.join(out, PEACH_SIDECAR_MANIFEST),
|
|
77
|
+
)
|
|
78
|
+
fs.writeFileSync(
|
|
79
|
+
`${bundlePath}.partial`,
|
|
80
|
+
insertPackageVersionsFooter(bundle.toString('utf8'), manifest.nativePackages),
|
|
81
|
+
)
|
|
82
|
+
fs.renameSync(`${bundlePath}.partial`, bundlePath)
|
|
83
|
+
fs.rmSync(extracted, { recursive: true, force: true })
|
|
84
|
+
}
|
|
85
|
+
const { platform } = readPeachSidecarManifest(
|
|
86
|
+
JSON.parse(fs.readFileSync(path.join(out, PEACH_SIDECAR_MANIFEST), 'utf8')),
|
|
87
|
+
)
|
|
88
|
+
return { bundlePath, platform }
|
|
89
|
+
}
|
|
@@ -1852,7 +1852,7 @@ export class SootSimBridgeFlowRunner {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
const direct = await test.activatePressAt(point.x, point.y, ${nodeId})
|
|
1854
1854
|
if (direct?.ok) {
|
|
1855
|
-
|
|
1855
|
+
globalThis.dispatchEvent(
|
|
1856
1856
|
new CustomEvent('sootsim:agentAction', {
|
|
1857
1857
|
detail: { type: 'tap', x: point.x, y: point.y, target: ${JSON.stringify(
|
|
1858
1858
|
replayTarget,
|
|
@@ -1870,7 +1870,7 @@ export class SootSimBridgeFlowRunner {
|
|
|
1870
1870
|
if (!test?.activatePressAt) return null
|
|
1871
1871
|
const direct = await test.activatePressAt(${x}, ${y})
|
|
1872
1872
|
if (direct?.ok) {
|
|
1873
|
-
|
|
1873
|
+
globalThis.dispatchEvent(
|
|
1874
1874
|
new CustomEvent('sootsim:agentAction', {
|
|
1875
1875
|
detail: { type: 'tap', x: ${x}, y: ${y} },
|
|
1876
1876
|
}),
|
package/cli/cloud-client.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
metroAssetPlaceholderBytes,
|
|
17
17
|
metroAssetScaleFilename,
|
|
18
18
|
metroIosAssetDestRelatives,
|
|
19
|
+
resolveMetroAndroidAssetDestFiles,
|
|
19
20
|
resolveMetroIosAssetDestFiles,
|
|
20
21
|
separateMetroArtifactAssets,
|
|
21
22
|
type MetroAssetDescriptor,
|
|
@@ -477,6 +478,7 @@ function placeMetroDescriptor(
|
|
|
477
478
|
distinctByContent(listing.directory, [
|
|
478
479
|
...new Set([
|
|
479
480
|
...resolveMetroIosAssetDestFiles(listing.files, descriptor, scale),
|
|
481
|
+
...resolveMetroAndroidAssetDestFiles(listing.files, descriptor, scale),
|
|
480
482
|
...resolveExpoHashedAssetFiles(listing.files, descriptor, scale),
|
|
481
483
|
]),
|
|
482
484
|
]),
|
package/cli/commands/control.ts
CHANGED
|
@@ -62,6 +62,7 @@ import { sleep } from '../../src/sleep'
|
|
|
62
62
|
import { loadRNXAppConfig } from '../app-config'
|
|
63
63
|
import { findExpoAppConfig } from '../app-project'
|
|
64
64
|
import { discoverOneNativeAppSplash } from '../app-splash'
|
|
65
|
+
import { extractAppBinaryBundle, isAppBinaryPath } from '../binary-sidecar'
|
|
65
66
|
import { printBridgeFailureDiagnostics } from '../bridge-diagnostics'
|
|
66
67
|
import {
|
|
67
68
|
assertNoPendingOpen,
|
|
@@ -1427,6 +1428,21 @@ async function openSim(
|
|
|
1427
1428
|
args: string[],
|
|
1428
1429
|
opts: OpenCommandOptions,
|
|
1429
1430
|
): Promise<{ simId: string; launched: boolean } | undefined> {
|
|
1431
|
+
// an ipa or apk we built opens as the plain bundle it carries
|
|
1432
|
+
const binary = args.find((arg) => !arg.startsWith('-') && isAppBinaryPath(arg))
|
|
1433
|
+
if (binary) {
|
|
1434
|
+
try {
|
|
1435
|
+
const { bundlePath, platform } = extractAppBinaryBundle(binary)
|
|
1436
|
+
args = args.map((arg) => (arg === binary ? bundlePath : arg))
|
|
1437
|
+
if (platform === 'android' && !args.includes('--device') && !args.includes('-d'))
|
|
1438
|
+
args = [...args, '--device', 'pixel-8']
|
|
1439
|
+
} catch (error) {
|
|
1440
|
+
console.error(
|
|
1441
|
+
` peach open: ${error instanceof Error ? error.message : String(error)}`,
|
|
1442
|
+
)
|
|
1443
|
+
peachExit(1)
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1430
1446
|
const openArgOptions = {
|
|
1431
1447
|
stripBooleanFlags: [
|
|
1432
1448
|
'--new',
|
package/cli/commands/device.ts
CHANGED
|
@@ -246,7 +246,7 @@ export async function runDeviceCommand(args: string[], opts: DeviceCommandOption
|
|
|
246
246
|
else if (Date.now() > deadline) resolve(false)
|
|
247
247
|
else setTimeout(check, 50)
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
globalThis.dispatchEvent(new CustomEvent(${JSON.stringify(SOOTSIM_SHELL_COMMAND_NAME)}, { detail: { type: 'fold-to-rest', rest: ${JSON.stringify(target)} } }))
|
|
250
250
|
check()
|
|
251
251
|
})`,
|
|
252
252
|
{ acquireLock: true },
|
package/cli/commands/flow.ts
CHANGED
|
@@ -621,6 +621,8 @@ flow extension:
|
|
|
621
621
|
const openArgs = [openTarget]
|
|
622
622
|
if (pinnedShellBaseUrl) openArgs.push('--base-url', pinnedShellBaseUrl)
|
|
623
623
|
if (targetDevice) openArgs.push('--device', targetDevice)
|
|
624
|
+
// the app boots in the flow's posture, as native unfolds before its launch
|
|
625
|
+
if (targetPosture) openArgs.push('--posture', targetPosture)
|
|
624
626
|
if (
|
|
625
627
|
firstLaunchPermissions &&
|
|
626
628
|
(targetTheme === 'light' || targetTheme === 'dark' || targetTheme === 'auto')
|
|
@@ -737,7 +739,7 @@ flow extension:
|
|
|
737
739
|
await bridge.send({
|
|
738
740
|
type: 'evaluate',
|
|
739
741
|
simId: driver.simId,
|
|
740
|
-
code: `
|
|
742
|
+
code: `globalThis.dispatchEvent(new CustomEvent('sootsim:statusBarOverride', { detail: { time: ${JSON.stringify(statusBarTime)} } }))`,
|
|
741
743
|
})
|
|
742
744
|
}
|
|
743
745
|
if (targetTheme) {
|
|
@@ -797,7 +799,7 @@ flow extension:
|
|
|
797
799
|
else if (Date.now() > deadline) resolve(false)
|
|
798
800
|
else setTimeout(check, 50)
|
|
799
801
|
}
|
|
800
|
-
|
|
802
|
+
globalThis.dispatchEvent(new CustomEvent(${JSON.stringify(SOOTSIM_SHELL_COMMAND_NAME)}, { detail: { type: 'fold-to-rest', rest: ${JSON.stringify(targetPosture)} } }))
|
|
801
803
|
check()
|
|
802
804
|
})`,
|
|
803
805
|
})
|
|
@@ -896,6 +898,8 @@ flow extension:
|
|
|
896
898
|
}
|
|
897
899
|
const deviceChanged = await applySimSettings()
|
|
898
900
|
if (deviceChanged && !startsWithLaunchApp) await driver.waitForTree(120000)
|
|
901
|
+
// a reused sim, or the reload a device change makes, still holds another rest
|
|
902
|
+
if ((await applyPosture()) && !startsWithLaunchApp) await driver.waitForTree(120000)
|
|
899
903
|
// a device change reloads the page, which is a second boot without the seed
|
|
900
904
|
if (!deviceChanged) driver.seededLaunchPermissions = seededLaunchPermissions
|
|
901
905
|
// preview replay must reproduce the SAME initial conditions the agent
|
|
@@ -87,26 +87,6 @@ export function isInspectPickCommand(subcommand: string | null | undefined): boo
|
|
|
87
87
|
return typeof subcommand === 'string' && INSPECT_PICK_COMMANDS.has(subcommand)
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
export async function isInspectModeActive(bridge: InspectBridge): Promise<boolean> {
|
|
91
|
-
const active = await bridge.send({
|
|
92
|
-
type: 'evaluate',
|
|
93
|
-
code: 'globalThis.__sootsimEngineState?.inspectActive === true',
|
|
94
|
-
})
|
|
95
|
-
return active === true
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export async function shouldSkipAutoSettleForInspectPick(
|
|
99
|
-
bridge: InspectBridge,
|
|
100
|
-
subcommand: string | null | undefined,
|
|
101
|
-
): Promise<boolean> {
|
|
102
|
-
if (!isInspectPickCommand(subcommand)) return false
|
|
103
|
-
try {
|
|
104
|
-
return await isInspectModeActive(bridge)
|
|
105
|
-
} catch {
|
|
106
|
-
return false
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
90
|
// `get count` — total SootSimNode count in the live tree.
|
|
111
91
|
export async function inspectNodeCount(
|
|
112
92
|
bridge: InspectBridge,
|
|
@@ -32,6 +32,7 @@ export type WaitForSootsimIdleOptions = {
|
|
|
32
32
|
// activity and reads nothing per tick (renderActivityIdleScript); the
|
|
33
33
|
// still window is stablePolls * pollMs.
|
|
34
34
|
motionOnly?: boolean
|
|
35
|
+
skipIfInspectActive?: boolean
|
|
35
36
|
// after the app paints, a callback's own next frame is ongoing playback.
|
|
36
37
|
readyPlayback?: boolean
|
|
37
38
|
transitionStartWindowMs?: number
|
|
@@ -92,14 +93,19 @@ function renderActivityIdleScript({
|
|
|
92
93
|
requiredStillMs,
|
|
93
94
|
transitionStartWindowMs,
|
|
94
95
|
transitionTimeoutMs,
|
|
96
|
+
skipIfInspectActive,
|
|
95
97
|
}: {
|
|
96
98
|
maxMs: number
|
|
97
99
|
requiredStillMs: number
|
|
98
100
|
transitionStartWindowMs: number
|
|
99
101
|
transitionTimeoutMs: number
|
|
102
|
+
skipIfInspectActive: boolean
|
|
100
103
|
}): string {
|
|
101
104
|
return `(async () => {
|
|
102
105
|
const start = Date.now()
|
|
106
|
+
if (${skipIfInspectActive} && globalThis.__sootsimEngineState?.inspectActive === true) {
|
|
107
|
+
return { settled: true, elapsed: 0, blockedBy: '' }
|
|
108
|
+
}
|
|
103
109
|
const budgetMs = ${Math.max(0, Math.round(maxMs))}
|
|
104
110
|
const requiredStillMs = ${Math.max(1, Math.round(requiredStillMs))}
|
|
105
111
|
let deadline = start + budgetMs
|
|
@@ -204,6 +210,7 @@ export async function waitForSootsimIdle({
|
|
|
204
210
|
screenStill = false,
|
|
205
211
|
maestro = false,
|
|
206
212
|
motionOnly = false,
|
|
213
|
+
skipIfInspectActive = false,
|
|
207
214
|
readyPlayback = false,
|
|
208
215
|
transitionStartWindowMs = 80,
|
|
209
216
|
transitionTimeoutMs = 4000,
|
|
@@ -224,6 +231,7 @@ export async function waitForSootsimIdle({
|
|
|
224
231
|
Math.max(1, Math.round(stablePolls)) * Math.max(1, Math.round(pollMs)),
|
|
225
232
|
transitionStartWindowMs,
|
|
226
233
|
transitionTimeoutMs,
|
|
234
|
+
skipIfInspectActive,
|
|
227
235
|
})
|
|
228
236
|
: `(async () => {
|
|
229
237
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
@@ -318,6 +326,7 @@ export async function waitForSootsimIdle({
|
|
|
318
326
|
let webViewBlocker = ''
|
|
319
327
|
let visibleMotion = false
|
|
320
328
|
let visibleMotionBy = ''
|
|
329
|
+
let motionUnavailable = false
|
|
321
330
|
// the reads are independent, so they run concurrently: a loaded sim
|
|
322
331
|
// answers each one late, and a poll that waits for them in turn
|
|
323
332
|
// costs their sum, which fits too few polls in the budget to settle.
|
|
@@ -388,6 +397,9 @@ export async function waitForSootsimIdle({
|
|
|
388
397
|
.slice(0, 4)
|
|
389
398
|
.map((anim) => anim.source + '/' + anim.kind + '#' + anim.id + ' at ' + anim.current + (anim.loop ? ' loop' : ''))
|
|
390
399
|
.join(', ')
|
|
400
|
+
} else if (screenStill) {
|
|
401
|
+
motionUnavailable = true
|
|
402
|
+
workerBusy = true
|
|
391
403
|
}
|
|
392
404
|
}
|
|
393
405
|
const stats = await statsRead
|
|
@@ -565,7 +577,7 @@ export async function waitForSootsimIdle({
|
|
|
565
577
|
}
|
|
566
578
|
}
|
|
567
579
|
}
|
|
568
|
-
return { layout: nodes.join(';'), nodeRows, nativeHierarchy, visibleMotion, visibleMotionBy, animating, animatingBy, shellAnimating, shellBlockers, layoutDirty, pendingFetches, workerBusy, webViewStarting, webViewBlocker, renderStatsAvailable, requestTotal, requestInFlight, appCommits, nodeCount }
|
|
580
|
+
return { layout: nodes.join(';'), nodeRows, nativeHierarchy, visibleMotion, visibleMotionBy, animating, animatingBy, shellAnimating, shellBlockers, layoutDirty, pendingFetches, workerBusy, motionUnavailable, webViewStarting, webViewBlocker, renderStatsAvailable, requestTotal, requestInFlight, appCommits, nodeCount }
|
|
569
581
|
}
|
|
570
582
|
|
|
571
583
|
// how long generic background network is allowed to keep us waiting AFTER
|
|
@@ -755,7 +767,8 @@ export async function waitForSootsimIdle({
|
|
|
755
767
|
if (!maestro && last.appCommits !== null && report.appCommits !== null && last.appCommits !== report.appCommits) blockers.push('layout commits still landing')
|
|
756
768
|
if (!maestro && last.nodeCount !== null && report.nodeCount !== null && last.nodeCount !== report.nodeCount) blockers.push('node count still changing')
|
|
757
769
|
if (last.pendingFetches > 0) blockers.push(last.pendingFetches + ' image fetches pending')
|
|
758
|
-
if (last.
|
|
770
|
+
if (last.motionUnavailable) blockers.push('animation reporting unavailable')
|
|
771
|
+
if (last.workerBusy && !last.motionUnavailable) blockers.push('a render worker too busy to report')
|
|
759
772
|
if (last.webViewStarting) blockers.push(last.webViewBlocker || 'webView still starting')
|
|
760
773
|
if (!maestro && last.layout !== report.layout) blockers.push('layout still changing')
|
|
761
774
|
if (maestro && !hierarchyUnchanged(last.nativeHierarchy, report.nativeHierarchy)) blockers.push(last.nativeHierarchy === null ? 'native accessibility hierarchy unavailable' : 'native accessibility hierarchy still changing')
|
package/cli/commands/inspect.ts
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
inspectRequests,
|
|
60
60
|
inspectWarnings,
|
|
61
61
|
MERGED_CONSOLE_COUNT_EVAL,
|
|
62
|
-
|
|
62
|
+
isInspectPickCommand,
|
|
63
63
|
type LogEntry,
|
|
64
64
|
type LogLevel,
|
|
65
65
|
type OpenNativeUISurface,
|
|
@@ -845,7 +845,7 @@ async function runShellVisualCommand(
|
|
|
845
845
|
return bridge.send({
|
|
846
846
|
type: 'evaluate',
|
|
847
847
|
code: `(async () => {
|
|
848
|
-
|
|
848
|
+
globalThis.dispatchEvent(new CustomEvent('sootsim:shake'))
|
|
849
849
|
return { ok: true, action: 'shake' }
|
|
850
850
|
})()`,
|
|
851
851
|
})
|
|
@@ -1235,6 +1235,7 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
1235
1235
|
pollMs: 32,
|
|
1236
1236
|
stablePolls: 2,
|
|
1237
1237
|
motionOnly: true,
|
|
1238
|
+
skipIfInspectActive: isInspectPickCommand(subcommand),
|
|
1238
1239
|
})
|
|
1239
1240
|
if (!settled) {
|
|
1240
1241
|
process.stderr.write(
|
|
@@ -3767,7 +3768,7 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
3767
3768
|
await globalThis.__sootsimShellPerf.start()
|
|
3768
3769
|
// give a frame for profiling to engage before the event
|
|
3769
3770
|
await new Promise(r => requestAnimationFrame(() => r(undefined)))
|
|
3770
|
-
|
|
3771
|
+
globalThis.dispatchEvent(new Event('${eventName}'))
|
|
3771
3772
|
// shell animations are ~300-500ms; fixed timing avoids complex
|
|
3772
3773
|
// animation-end detection
|
|
3773
3774
|
await new Promise(r => setTimeout(r, 600))
|
|
@@ -4259,8 +4260,7 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
4259
4260
|
if (
|
|
4260
4261
|
writeCommands.has(subcommand) &&
|
|
4261
4262
|
!args.includes('--no-wait') &&
|
|
4262
|
-
process.env.PEACH_NO_AUTO_WAIT !== '1'
|
|
4263
|
-
!(await shouldSkipAutoSettleForInspectPick(bridge, subcommand))
|
|
4263
|
+
process.env.PEACH_NO_AUTO_WAIT !== '1'
|
|
4264
4264
|
) {
|
|
4265
4265
|
await autoSettleAfterWrite(bridge)
|
|
4266
4266
|
}
|
package/cli/commands/preview.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { getCliRuntime } from '../../src/cli-runtime.ts'
|
|
|
22
22
|
import { isRecord } from '../../src/is-record'
|
|
23
23
|
import { terminateProcessGroup } from '../../src/process-group'
|
|
24
24
|
import { authHeaderValue, cloudAccountIdOrExit, resolveCliAuth } from '../auth'
|
|
25
|
+
import { extractAppBinaryBundle, isAppBinaryPath } from '../binary-sidecar'
|
|
25
26
|
import { producePreviewArtifact } from '../cloud-client'
|
|
26
27
|
import { publishLiveDevStack, type PublishedLiveDevStack } from '../cloud-test-tunnel'
|
|
27
28
|
import { openUrl } from '../open-url'
|
|
@@ -90,18 +91,24 @@ export async function runPreview(args: string[]): Promise<number> {
|
|
|
90
91
|
origin,
|
|
91
92
|
takeValue(input, '--public-origin') ?? undefined,
|
|
92
93
|
)
|
|
93
|
-
const
|
|
94
|
+
const platformFlag = takeValue(input, '--platform')
|
|
94
95
|
const jsonIndex = input.indexOf('--json')
|
|
95
96
|
const json = jsonIndex >= 0
|
|
96
97
|
if (json) input.splice(jsonIndex, 1)
|
|
97
98
|
const openIndex = input.indexOf('--open')
|
|
98
99
|
const open = openIndex >= 0
|
|
99
100
|
if (open) input.splice(openIndex, 1)
|
|
101
|
+
if (input.length !== 1 || input[0]?.startsWith('-')) {
|
|
102
|
+
throw new Error('usage: peach preview <project|dist|bundle|ipa|apk>')
|
|
103
|
+
}
|
|
104
|
+
// an ipa or apk we built previews the plain bundle it carries
|
|
105
|
+
const binary = isAppBinaryPath(input[0]) ? extractAppBinaryBundle(input[0]) : null
|
|
106
|
+
const platform = platformFlag ?? binary?.platform ?? 'ios'
|
|
100
107
|
if (platform !== 'ios' && platform !== 'android') {
|
|
101
108
|
throw new Error('--platform must be ios or android')
|
|
102
109
|
}
|
|
103
|
-
if (
|
|
104
|
-
throw new Error(
|
|
110
|
+
if (binary && binary.platform !== platform) {
|
|
111
|
+
throw new Error(`${input[0]} is an ${binary.platform} build`)
|
|
105
112
|
}
|
|
106
113
|
const auth = resolveCliAuth()
|
|
107
114
|
if (!auth) throw new Error('peach preview needs `peach login` or PEACH_API_KEY')
|
|
@@ -109,8 +116,8 @@ export async function runPreview(args: string[]): Promise<number> {
|
|
|
109
116
|
|
|
110
117
|
const target = input[0]
|
|
111
118
|
const projectPath = resolve(target)
|
|
112
|
-
let bundleTarget: string | null = null
|
|
113
|
-
if (!/^https?:/.test(target) && statSync(projectPath).isDirectory()) {
|
|
119
|
+
let bundleTarget: string | null = binary?.bundlePath ?? null
|
|
120
|
+
if (!binary && !/^https?:/.test(target) && statSync(projectPath).isDirectory()) {
|
|
114
121
|
const expoBundle = resolveExpoExportBundle(projectPath, platform)
|
|
115
122
|
if (!expoBundle) {
|
|
116
123
|
const receipt = await publishProjectPreview(
|
|
@@ -58,7 +58,7 @@ export async function runShellBooleanMode(
|
|
|
58
58
|
code: `(async () => {
|
|
59
59
|
const modeKey = ${JSON.stringify(config.modeKey)}
|
|
60
60
|
const target = ${JSON.stringify(target)}
|
|
61
|
-
|
|
61
|
+
globalThis.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
62
62
|
detail: { type: 'fire-action', id: ${JSON.stringify(config.actionId)} },
|
|
63
63
|
}))
|
|
64
64
|
const deadline = Date.now() + 1200
|
package/cli/commands/slides.ts
CHANGED
|
@@ -131,7 +131,7 @@ async function ensureScreenshotMode(bridge: WsBridge): Promise<void> {
|
|
|
131
131
|
bridge,
|
|
132
132
|
`(async () => {
|
|
133
133
|
if (globalThis.SootSim?.bridges?.settings?.get?.()?.screenshotMode) return true
|
|
134
|
-
|
|
134
|
+
globalThis.dispatchEvent(new CustomEvent('sootsim:shell-command', {
|
|
135
135
|
detail: { type: 'fire-action', id: 'toggle-screenshot-mode' },
|
|
136
136
|
}))
|
|
137
137
|
const deadline = Date.now() + 2000
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/beta.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/beta.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|