peachsim 0.1.1716 → 0.1.1738
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/README.md +21 -3
- package/cli/app-bundle-resources.ts +2 -1
- package/cli/app-fonts.ts +4 -4
- package/cli/app-splash.ts +4 -4
- package/cli/app-stubs.ts +17 -0
- package/cli/command-registry.ts +1 -0
- package/cli/commands/control.ts +83 -822
- package/cli/commands/coverage-swift.ts +112 -4
- package/cli/commands/daemon.ts +8 -0
- package/cli/commands/detox.ts +3 -0
- package/cli/commands/doctor.ts +19 -2
- package/cli/commands/inspect/actions.ts +74 -14
- package/cli/commands/inspect/core.ts +5 -1
- package/cli/commands/inspect/settling.ts +5 -2
- package/cli/commands/inspect/wait-ready.ts +6 -0
- package/cli/commands/inspect.ts +48 -45
- package/cli/commands/kotlin.ts +12 -2
- package/cli/commands/package.ts +760 -0
- package/cli/commands/serve.ts +6 -0
- package/cli/commands/shell-url.ts +838 -0
- package/cli/commands/swift.ts +42 -102
- package/cli/commands/test.ts +20 -0
- package/cli/commands/upload.ts +1 -1
- package/cli/device-option.ts +1 -1
- package/cli/main.ts +13 -1
- package/cli/native-input.ts +199 -0
- package/cli/outbound-endpoints.ts +26 -1
- package/cli/packaged-app-launcher.ts +95 -0
- package/cli/scene-video.ts +36 -12
- package/detox/index.ts +196 -24
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +5 -2
- package/dist-lib/auth/shared-session.cjs +5 -2
- 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 +39889 -31873
- 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 +195 -63
- package/dist-lib/dev-bundle-resolution.cjs +14 -13
- package/dist-lib/expo-swift-bundle.cjs +18507 -11835
- package/dist-lib/expo-swift-metadata.cjs +4 -1
- package/dist-lib/expo-swift-metadata.mjs +3 -1
- package/dist-lib/home-paths.cjs +27 -3
- package/dist-lib/host/bridge-host.cjs +28373 -24090
- package/dist-lib/host/fetch-proxy-handler.cjs +235 -225
- 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 +915 -399
- 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 +335 -47
- package/dist-lib/menu.cjs +13 -1
- package/dist-lib/menu.mjs +13 -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 +918 -411
- package/dist-lib/native-app-identity-project.cjs +703 -283
- package/dist-lib/native-app-identity-project.mjs +500 -87
- package/dist-lib/native-app-identity.cjs +13 -2
- package/dist-lib/native-app-identity.mjs +13 -2
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +5 -2
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +28 -23
- package/dist-lib/public-origins-lib.json +418 -224
- package/dist-lib/react-native-host-modules.cjs +35 -2
- package/dist-lib/react-native-host-modules.mjs +35 -2
- package/dist-lib/reap-browser.cjs +12 -4
- package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
- package/dist-lib/sdk.cjs +17 -7
- package/dist-lib/sdk.mjs +16 -7
- package/dist-lib/skills.cjs +44825 -29141
- package/dist-lib/swift-compile.cjs +616 -400
- package/dist-lib/swift-compile.mjs +528 -315
- 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 +105 -17
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +4660 -2252
- package/dist-lib/vite.cjs +248 -234
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
- package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +7 -4
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +9 -6
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
- package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +11 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +5 -12
- package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +7 -2
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +36 -2
- package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/kotlin/README.md +3 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +12 -25
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
- package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
- package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +3 -1
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -3
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +711 -46
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
- package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
- package/sdk/ios/usr/include/module.modulemap +1 -0
- package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
- package/sdk/ios/usr/include/os/signpost.h +414 -0
- package/sdk/ios/usr/include/os.modulemap +10 -0
- package/sdk/ios/usr/include/sys/cdefs.h +5 -0
- package/sdk/ios/usr/include/sys/ioccom.h +99 -0
- package/sdk/ios/usr/include/sys/syslog.h +236 -0
- package/sdk/ios/usr/include/syslog.h +24 -0
- package/sdk/ios/wasm/include/errno.h +4 -20
- package/sdk/ios/wasm/include/fcntl.h +4 -2
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/setjmp.h +57 -0
- package/sdk/ios/wasm/include/stdio.h +24 -0
- package/sdk/ios/wasm/include/stdlib.h +32 -7
- package/sdk/ios/wasm/include/sys/file.h +7 -0
- package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
- package/sdk/ios/wasm/include/sys/resource.h +2 -2
- package/sdk/ios/wasm/include/sys/syscall.h +9 -0
- package/sdk/ios/wasm/include/sys/time.h +10 -0
- package/sdk/ios/wasm/include/unistd.h +12 -3
- package/sdk/native-hashes.json +4 -3
- package/skills/contrast/SKILL.md +2 -1
- package/skills/peach-debug/SKILL.md +0 -1
- package/skills/peach-perf/SKILL.md +0 -1
- package/skills/peach-setup/SKILL.md +0 -1
- package/skills/peach-test/SKILL.md +7 -4
- package/skills/peach-visual/SKILL.md +0 -1
- package/src/admitted-mac-build.ts +3 -0
- package/src/android-app-identity.ts +18 -0
- package/src/android-autolinking.ts +1 -0
- package/src/android-bridge-packages.ts +279 -0
- package/src/android-root-module.ts +9 -9
- package/src/appPackageContract.ts +83 -0
- package/src/bridge-contract.ts +50 -0
- package/src/bundle-channel.mjs +41 -6
- package/src/cli-runtime.ts +9 -5
- package/src/dev-bundle-resolution.ts +7 -27
- package/src/dom-source-reference.ts +15 -0
- package/src/expo-discovery-cache.ts +134 -26
- package/src/expo-kotlin-host.ts +97 -26
- package/src/expo-manifest-body.ts +33 -0
- package/src/expo-native-workspace.ts +158 -38
- package/src/expo-swift-host.ts +350 -75
- package/src/expo-swift-ready.ts +5 -1
- package/src/expoKotlinContract.ts +12 -2
- package/src/expoSwiftContract.ts +10 -0
- package/src/generated/swift-c-predefines.json +1 -1
- package/src/home-paths.ts +41 -2
- package/src/host/app-package-handler.ts +47 -0
- package/src/host/bridge-host.ts +8 -0
- package/src/host/fetch-proxy-handler.ts +10 -0
- package/src/host/staged-host-files.ts +18 -0
- package/src/index.ts +3 -0
- package/src/kotlin-host.ts +225 -48
- package/src/kotlin-instance-source.ts +126 -0
- package/src/kotlinSdkContract.ts +2 -1
- package/src/menu.ts +14 -0
- package/src/native-app-identity-project.ts +7 -2
- package/src/native-app-identity.ts +11 -0
- package/src/native-firebase-config.ts +24 -1
- package/src/native-prebuilt.ts +154 -0
- package/src/nitro-adapter.lock.json +270 -270
- package/src/nitro-adapter.ts +56 -50
- package/src/nitro-bundle.ts +92 -74
- package/src/nitro-compile.ts +45 -14
- package/src/nitro-dependencies.ts +63 -46
- package/src/nitro-source.ts +64 -26
- package/src/nitroAdapterContract.ts +146 -98
- package/src/nitroContract.ts +71 -21
- package/src/react-native-bridge-modules.ts +70 -42
- package/src/react-native-host-modules.ts +34 -1
- package/src/reactNativeConfigurationContract.ts +14 -0
- package/src/reap-browser.ts +15 -3
- package/src/sdk.ts +5 -0
- package/src/settingsContract.ts +38 -1
- package/src/sim-client.ts +4 -1
- package/src/storageSnapshotContract.ts +32 -81
- package/src/swift-compile.ts +268 -89
- package/src/swift-coverage/indexdump.ts +22 -6
- package/src/swift-coverage/indexing.ts +4 -4
- package/src/swift-coverage/provenance.ts +1 -0
- package/src/swift-coverage/sdk.ts +104 -20
- package/src/swift-coverage/types.ts +34 -0
- package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
- package/src/swift-coverage/xcode-assets.ts +89 -131
- package/src/swift-coverage/xcode.ts +10 -2
- package/src/swift-cxx-reachable.ts +2 -1
- package/src/swift-distribution.lock.json +20 -16
- package/src/swift-host.ts +98 -22
- package/src/swift-icu.ts +1 -1
- package/src/swift-link-roots.ts +118 -0
- package/src/swift-objc-compile.ts +144 -22
- package/src/swift-objc-import.ts +6 -0
- package/src/swift-objc-standin.ts +2 -14
- package/src/swift-package-manifest.ts +14 -6
- package/src/swift-packages.ts +75 -11
- package/src/swift-pdf-raster.ts +1 -0
- package/src/swift-root-lock.ts +17 -1
- package/src/swift-source-pods.ts +2 -10
- package/src/swift-standin-emit.ts +597 -57
- package/src/swift-standins.ts +599 -56
- package/src/swift-submit.ts +7 -1
- package/src/swift-toolchain.ts +140 -17
- package/src/turbo-bundle.ts +81 -0
- package/src/turbo-codegen-intake.ts +91 -0
- package/src/turbo-compile.ts +120 -0
- package/src/turbo-runtime.lock.json +69 -0
- package/src/turbo-source.ts +754 -0
- package/src/vite-plugin-one.ts +17 -12
- package/src/vite-plugin.ts +28 -15
- package/src/xcode-project.ts +223 -22
|
@@ -9,8 +9,15 @@ import { loadSwiftSdkInventoryFragment } from '../../../peach-compat/src/capabil
|
|
|
9
9
|
import { swiftSdkIdentity } from '../../src/swift-coverage/indexing'
|
|
10
10
|
import { indexSwiftPackage } from '../../src/swift-coverage/package'
|
|
11
11
|
import { buildSwiftIndexReader } from '../../src/swift-coverage/reader'
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
readSwiftSdkPeachStates,
|
|
14
|
+
readSwiftSdkSymbolCache,
|
|
15
|
+
} from '../../src/swift-coverage/sdk'
|
|
13
16
|
import { resolveSwiftFrontDoors } from '../../src/swift-coverage/source'
|
|
17
|
+
import {
|
|
18
|
+
SWIFT_SDK_LEDGER_STATES,
|
|
19
|
+
SWIFT_SDK_PEACH_STATES,
|
|
20
|
+
} from '../../src/swift-coverage/types'
|
|
14
21
|
import { indexSwiftXcodeApp, xcodeMetadataFiles } from '../../src/swift-coverage/xcode'
|
|
15
22
|
import { swiftTargetDependencyModules } from '../../src/swift-coverage/xcode-packages'
|
|
16
23
|
import { localPackageModules } from '../../src/swift-coverage/xcode-packages'
|
|
@@ -306,8 +313,77 @@ async function swiftSdkReach(
|
|
|
306
313
|
VERIFIED_SURFACES.flatMap<VerifiedFeature>((surface) => surface.features),
|
|
307
314
|
tools.sdkSymbols,
|
|
308
315
|
)
|
|
309
|
-
const
|
|
316
|
+
const data = await verifiedFeatureCellData()
|
|
317
|
+
const cells = reachedFeatureCells(data, reach.features)
|
|
310
318
|
const states = cells.flatMap((feature) => feature.cells.map((cell) => cell.state))
|
|
319
|
+
// each site's verified sdk state from the embedded ledger: the strongest
|
|
320
|
+
// state of the doors it reaches in a measured module, unverified when it
|
|
321
|
+
// has none, and null outside the measured modules
|
|
322
|
+
const ledgerMatched = data.sdk.sdk.fingerprint === tools.sdkFingerprint
|
|
323
|
+
const ledger = new Map(
|
|
324
|
+
data.sdk.symbols.map(([module, usr, state]) => [`swift:${module}:${usr}`, state]),
|
|
325
|
+
)
|
|
326
|
+
const measured = (door: string) =>
|
|
327
|
+
data.sdk.modules.includes(
|
|
328
|
+
door.slice('swift:'.length, door.indexOf(':', 'swift:'.length)),
|
|
329
|
+
)
|
|
330
|
+
// what Peach has for each door, from the sdk-states cache swift:yet writes
|
|
331
|
+
// on a host that runs it; elsewhere Peach states stay unknown
|
|
332
|
+
let peachStates: Map<string, string> | null = null
|
|
333
|
+
let peachUnknown: string | null = null
|
|
334
|
+
try {
|
|
335
|
+
peachStates = new Map(
|
|
336
|
+
readSwiftSdkPeachStates(tools.sdkFingerprint).symbols.map(
|
|
337
|
+
([module, usr, state]) => [`swift:${module}:${usr}`, state],
|
|
338
|
+
),
|
|
339
|
+
)
|
|
340
|
+
} catch (error) {
|
|
341
|
+
peachUnknown = `${error instanceof Error ? error.message : error}; Peach SDK states remain unknown.`
|
|
342
|
+
}
|
|
343
|
+
const strongest = <State extends string>(
|
|
344
|
+
states: readonly State[],
|
|
345
|
+
doors: string[],
|
|
346
|
+
of: Map<string, string>,
|
|
347
|
+
) => states.find((state) => doors.some((door) => of.get(door) === state)) ?? null
|
|
348
|
+
const sites = reach.sites.map((site) => {
|
|
349
|
+
const verifiedState =
|
|
350
|
+
ledgerMatched && site.frontDoorIds.some(measured)
|
|
351
|
+
? (strongest(SWIFT_SDK_LEDGER_STATES, site.frontDoorIds, ledger) ?? 'unverified')
|
|
352
|
+
: null
|
|
353
|
+
const peachState = peachStates
|
|
354
|
+
? strongest(SWIFT_SDK_PEACH_STATES, site.frontDoorIds, peachStates)
|
|
355
|
+
: null
|
|
356
|
+
return {
|
|
357
|
+
...site,
|
|
358
|
+
verifiedState,
|
|
359
|
+
peachState,
|
|
360
|
+
// the verified evidence when there is any, else what Peach has
|
|
361
|
+
sdkState:
|
|
362
|
+
verifiedState !== null && verifiedState !== 'unverified'
|
|
363
|
+
? verifiedState
|
|
364
|
+
: (peachState ?? verifiedState),
|
|
365
|
+
}
|
|
366
|
+
})
|
|
367
|
+
const countBy = (
|
|
368
|
+
states: readonly string[],
|
|
369
|
+
pick: (site: (typeof sites)[number]) => string | null,
|
|
370
|
+
) =>
|
|
371
|
+
Object.fromEntries(
|
|
372
|
+
states.map((state) => {
|
|
373
|
+
const reached = sites.filter((site) => pick(site) === state)
|
|
374
|
+
return [
|
|
375
|
+
state,
|
|
376
|
+
{
|
|
377
|
+
symbols: new Set(reached.map((site) => site.usr)).size,
|
|
378
|
+
sites: reached.length,
|
|
379
|
+
},
|
|
380
|
+
]
|
|
381
|
+
}),
|
|
382
|
+
)
|
|
383
|
+
const verifiedStates = countBy(
|
|
384
|
+
[...SWIFT_SDK_LEDGER_STATES, 'unverified'],
|
|
385
|
+
(site) => site.verifiedState,
|
|
386
|
+
)
|
|
311
387
|
return {
|
|
312
388
|
summary: {
|
|
313
389
|
symbolicReferences: index.sites.length,
|
|
@@ -324,6 +400,15 @@ async function swiftSdkReach(
|
|
|
324
400
|
},
|
|
325
401
|
mapped: null,
|
|
326
402
|
verified: null,
|
|
403
|
+
verifiedSdk: ledgerMatched
|
|
404
|
+
? { modules: data.sdk.modules, states: verifiedStates }
|
|
405
|
+
: null,
|
|
406
|
+
sdkStates: peachStates
|
|
407
|
+
? countBy(
|
|
408
|
+
[...SWIFT_SDK_LEDGER_STATES, ...SWIFT_SDK_PEACH_STATES, 'unverified'],
|
|
409
|
+
(site) => site.sdkState,
|
|
410
|
+
)
|
|
411
|
+
: null,
|
|
327
412
|
},
|
|
328
413
|
sdk: {
|
|
329
414
|
...tools.sdkIdentity,
|
|
@@ -332,13 +417,19 @@ async function swiftSdkReach(
|
|
|
332
417
|
},
|
|
333
418
|
possibleFeatures: reach.features,
|
|
334
419
|
features: cells,
|
|
335
|
-
index: { ...index, sites
|
|
420
|
+
index: { ...index, sites },
|
|
336
421
|
unknowns: [
|
|
337
422
|
...(reach.sdkMatched
|
|
338
423
|
? []
|
|
339
424
|
: [
|
|
340
425
|
'The installed SDK build and compiler do not match the retained Swift SDK inventory; all front doors remain unknown.',
|
|
341
426
|
]),
|
|
427
|
+
...(ledgerMatched
|
|
428
|
+
? []
|
|
429
|
+
: [
|
|
430
|
+
`The installed SDK build and compiler do not match the verified SDK ledger (${data.sdk.sdk.version}); verified SDK states remain unknown.`,
|
|
431
|
+
]),
|
|
432
|
+
...(peachUnknown ? [peachUnknown] : []),
|
|
342
433
|
],
|
|
343
434
|
}
|
|
344
435
|
}
|
|
@@ -401,7 +492,24 @@ export async function runSwiftCoverage(
|
|
|
401
492
|
console.log(
|
|
402
493
|
`SDK front doors: ${report.summary.frontDoors}; possible features: ${report.summary.possibleFeatures}. Mapped and verified shares: unknown.`,
|
|
403
494
|
)
|
|
404
|
-
const { cells } = report.summary
|
|
495
|
+
const { cells, verifiedSdk, sdkStates } = report.summary
|
|
496
|
+
if (verifiedSdk)
|
|
497
|
+
console.log(
|
|
498
|
+
`Verified SDK states (${verifiedSdk.modules.join(', ')}), symbols at sites: ${Object.entries(
|
|
499
|
+
verifiedSdk.states,
|
|
500
|
+
)
|
|
501
|
+
.map(([state, count]) => `${count.symbols} ${state} at ${count.sites}`)
|
|
502
|
+
.join(', ')}.`,
|
|
503
|
+
)
|
|
504
|
+
if (sdkStates)
|
|
505
|
+
console.log(
|
|
506
|
+
`SDK states, verified evidence first and then what Peach has, symbols at sites: ${Object.entries(
|
|
507
|
+
sdkStates,
|
|
508
|
+
)
|
|
509
|
+
.filter(([, count]) => count.sites > 0)
|
|
510
|
+
.map(([state, count]) => `${count.symbols} ${state} at ${count.sites}`)
|
|
511
|
+
.join(', ')}.`,
|
|
512
|
+
)
|
|
405
513
|
if (cells)
|
|
406
514
|
console.log(
|
|
407
515
|
`Cells of the possible features: ${cells.verified} verified, ${cells.failing} failing, ${cells.unknown} unknown.`,
|
package/cli/commands/daemon.ts
CHANGED
|
@@ -220,6 +220,14 @@ export async function daemonInstall({ port, force }: { port: number; force: bool
|
|
|
220
220
|
console.log(` port: ${port}`)
|
|
221
221
|
|
|
222
222
|
if (process.platform === 'darwin') {
|
|
223
|
+
// a launchd-spawned executable on an external volume stalls in dyld: the
|
|
224
|
+
// process spawns, never binds and never exits. only the executable is
|
|
225
|
+
// observed to stall, so scripts and peach home are not checked.
|
|
226
|
+
if (realPathOrSelf(invocation.executable).startsWith('/Volumes/')) {
|
|
227
|
+
throw new Error(
|
|
228
|
+
`${invocation.executable} is on an external volume, which the background service cannot load. install ${rnxPublicBrand.commandName} on the startup disk, then run \`${rnxPublicBrand.commandName} daemon install\` again`,
|
|
229
|
+
)
|
|
230
|
+
}
|
|
223
231
|
const legacy = teardownLegacyMacDaemonArtifacts()
|
|
224
232
|
if (!legacy.missing) {
|
|
225
233
|
console.log(` removed legacy ${LEGACY_SERVICE_LABEL_MAC} service`)
|
package/cli/commands/detox.ts
CHANGED
|
@@ -280,6 +280,9 @@ export async function runDetox(args: string[], opts: RunDetoxOpts = {}): Promise
|
|
|
280
280
|
stdio: 'inherit',
|
|
281
281
|
env: {
|
|
282
282
|
...process.env,
|
|
283
|
+
...(proofCapture && process.env.PEACH_JEST_NODE_OPTIONS
|
|
284
|
+
? { NODE_OPTIONS: process.env.PEACH_JEST_NODE_OPTIONS }
|
|
285
|
+
: {}),
|
|
283
286
|
PEACH_TEST_DIR: testDir,
|
|
284
287
|
SOOTSIM_PORT: String(port),
|
|
285
288
|
SOOTSIM_HEADED: headed ? '1' : '',
|
package/cli/commands/doctor.ts
CHANGED
|
@@ -224,7 +224,7 @@ function findAppTarget(
|
|
|
224
224
|
): AppTarget {
|
|
225
225
|
const at = (dir: string, manifest: ProjectManifest) => {
|
|
226
226
|
const installed = installedManifest(dir, manifest)
|
|
227
|
-
return { dir, manifest, installed, scan:
|
|
227
|
+
return { dir, manifest, installed, scan: scanInstalledPackages(dir, installed, data) }
|
|
228
228
|
}
|
|
229
229
|
const here = at(appDir, pkg)
|
|
230
230
|
if (explicit || here.scan.packages.length > 0) return here
|
|
@@ -241,6 +241,23 @@ function findAppTarget(
|
|
|
241
241
|
return here
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
function scanInstalledPackages(
|
|
245
|
+
dir: string,
|
|
246
|
+
manifest: ProjectManifest,
|
|
247
|
+
data: CompatScanData,
|
|
248
|
+
): ScanResult {
|
|
249
|
+
const nativePackages = new Set<string>()
|
|
250
|
+
for (const name of Object.keys({
|
|
251
|
+
...manifest.dependencies,
|
|
252
|
+
...manifest.devDependencies,
|
|
253
|
+
})) {
|
|
254
|
+
if (PURE_JS_PACKAGES.has(name)) continue
|
|
255
|
+
const packageDir = installedPackageDir(dir, name)
|
|
256
|
+
if (packageDir && hasNativeCode(packageDir, 'ios')) nativePackages.add(name)
|
|
257
|
+
}
|
|
258
|
+
return scanDepsWithData(manifest, data, nativePackages)
|
|
259
|
+
}
|
|
260
|
+
|
|
244
261
|
function checkVersions(
|
|
245
262
|
installed: ProjectManifest,
|
|
246
263
|
support: RuntimeAppSupport | null,
|
|
@@ -1025,5 +1042,5 @@ function scanOnePackage(
|
|
|
1025
1042
|
installed.dependencies?.[packageName] ??
|
|
1026
1043
|
installed.devDependencies?.[packageName] ??
|
|
1027
1044
|
'*'
|
|
1028
|
-
return
|
|
1045
|
+
return scanInstalledPackages(appDir, { dependencies: { [packageName]: version } }, data)
|
|
1029
1046
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type ResolvedTargetCoords,
|
|
8
8
|
} from './resolve-target'
|
|
9
9
|
import { waitForSootsimIdle } from './settling'
|
|
10
|
-
import type { SimSemanticNode } from '../../../src/bridge-contract'
|
|
10
|
+
import type { SimSemanticNode, SimTapResult } from '../../../src/bridge-contract'
|
|
11
11
|
import type {
|
|
12
12
|
SootSimAccessibilityState,
|
|
13
13
|
SootSimNodeInfo,
|
|
@@ -19,13 +19,69 @@ export type TapFailure = 'not-found' | 'missed' | 'special'
|
|
|
19
19
|
|
|
20
20
|
export type TapTargetSummary = SootSimReplayTarget
|
|
21
21
|
|
|
22
|
+
// a node named by a resolution. a semantic node may report its text as an
|
|
23
|
+
// accessibilityLabel instead of `text`, so a payload built from one can carry
|
|
24
|
+
// either.
|
|
25
|
+
export type TapNodeSummary = SootSimReplayTarget & {
|
|
26
|
+
accessibilityLabel?: string | null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// one text match offered to a caller that must pick among several.
|
|
30
|
+
export interface TapCandidate {
|
|
31
|
+
idx: number
|
|
32
|
+
nodeId: number | null
|
|
33
|
+
type: string | null
|
|
34
|
+
testID: string | null
|
|
35
|
+
text: string
|
|
36
|
+
abs: { x: number; y: number } | null
|
|
37
|
+
layout: { width: number; height: number } | null
|
|
38
|
+
ancestorTestIDs: string[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// what a tap resolver found, or why it found nothing. a resolver fills only the
|
|
42
|
+
// fields its case owns: a resolved target carries the point and the nodes it
|
|
43
|
+
// matched; a text read that matched several carries the candidates it offers; a
|
|
44
|
+
// special refusal carries `error` or `nthOutOfRange`.
|
|
45
|
+
export interface TapPayload {
|
|
46
|
+
cx?: number | null
|
|
47
|
+
cy?: number
|
|
48
|
+
// how many candidates a text read considered before picking or refusing
|
|
49
|
+
matched?: number
|
|
50
|
+
// the device screen the point was checked against
|
|
51
|
+
screen?: { width: number; height: number }
|
|
52
|
+
match?: TapNodeSummary
|
|
53
|
+
target?: TapNodeSummary
|
|
54
|
+
// tap-best's chosen node, whichever strategy found it
|
|
55
|
+
node?: TapNodeSummary
|
|
56
|
+
strategy?: 'matched-node' | 'testid' | 'text' | 'none'
|
|
57
|
+
total?: number
|
|
58
|
+
idx?: number
|
|
59
|
+
candidates?: TapCandidate[]
|
|
60
|
+
ambiguous?: true
|
|
61
|
+
nthOutOfRange?: true
|
|
62
|
+
nth?: number
|
|
63
|
+
offscreen?: true
|
|
64
|
+
// an offscreen point and screen, so a caller can report where it was going
|
|
65
|
+
x?: number
|
|
66
|
+
y?: number
|
|
67
|
+
error?: string
|
|
68
|
+
}
|
|
69
|
+
|
|
22
70
|
export interface TapOutcome {
|
|
23
|
-
payload:
|
|
24
|
-
result:
|
|
71
|
+
payload: TapPayload | null
|
|
72
|
+
result: SimTapResult | null
|
|
25
73
|
attempts: number
|
|
26
74
|
failure?: TapFailure
|
|
27
75
|
}
|
|
28
76
|
|
|
77
|
+
// a payload that resolved to a point a finger can press. every later read of
|
|
78
|
+
// its point may use the narrowed coordinates without re-checking them.
|
|
79
|
+
export function isResolvedTapPayload(
|
|
80
|
+
payload: TapPayload | null | undefined,
|
|
81
|
+
): payload is TapPayload & { cx: number; cy: number } {
|
|
82
|
+
return !!payload && typeof payload.cx === 'number' && typeof payload.cy === 'number'
|
|
83
|
+
}
|
|
84
|
+
|
|
29
85
|
export interface TapTextOptions {
|
|
30
86
|
exact?: boolean
|
|
31
87
|
role?: string | null
|
|
@@ -64,9 +120,13 @@ function tapTiming(agent: boolean, opts: TapTimingOptions = {}) {
|
|
|
64
120
|
}
|
|
65
121
|
}
|
|
66
122
|
|
|
67
|
-
|
|
123
|
+
// a tap landed only when the reply says so: the browser engine reports `hit`
|
|
124
|
+
// and the headless runtime reports `handled`. a reply with neither, such as an
|
|
125
|
+
// empty transport result or a bare refusal reason, proves nothing was pressed.
|
|
126
|
+
export function isTapSuccess(result: SimTapResult | null | undefined): boolean {
|
|
68
127
|
if (!result || result.hit === false || result.ok === false) return false
|
|
69
128
|
if (result.handled === false) return false
|
|
129
|
+
if (result.hit !== true && result.handled !== true) return false
|
|
70
130
|
if (result.requestedTargetMatched === false) return false
|
|
71
131
|
if (
|
|
72
132
|
result.pointerTapHandled === false &&
|
|
@@ -80,7 +140,7 @@ export function isTapSuccess(result: any): boolean {
|
|
|
80
140
|
}
|
|
81
141
|
|
|
82
142
|
export function tapTargetFromPayload(
|
|
83
|
-
payload:
|
|
143
|
+
payload: TapPayload,
|
|
84
144
|
textFallback?: string,
|
|
85
145
|
): TapTargetSummary {
|
|
86
146
|
const id = payload.target?.id ?? payload.match?.id ?? payload.node?.id
|
|
@@ -106,15 +166,15 @@ export async function tapResolvedTarget(
|
|
|
106
166
|
bridge: InspectBridge,
|
|
107
167
|
args: {
|
|
108
168
|
textFallback?: string
|
|
109
|
-
resolve: () => Promise<
|
|
169
|
+
resolve: () => Promise<TapPayload | null>
|
|
110
170
|
agent?: boolean
|
|
111
171
|
timing?: TapTimingOptions
|
|
112
172
|
},
|
|
113
173
|
): Promise<TapOutcome> {
|
|
114
174
|
const timing = tapTiming(!!args.agent, args.timing)
|
|
115
175
|
let attempts = 0
|
|
116
|
-
let lastPayload:
|
|
117
|
-
let lastResult:
|
|
176
|
+
let lastPayload: TapPayload | null = null
|
|
177
|
+
let lastResult: SimTapResult | null = null
|
|
118
178
|
|
|
119
179
|
// a CPU simulator only advances its animations while a command holds its
|
|
120
180
|
// clock, so a sheet that was still sliding in when the last command returned
|
|
@@ -158,7 +218,7 @@ export async function tapResolvedTarget(
|
|
|
158
218
|
throw new Error(UNREPORTED_SCREEN_ERROR)
|
|
159
219
|
}
|
|
160
220
|
const unsized = checksScreen && !isScreenSize(screen)
|
|
161
|
-
const payload =
|
|
221
|
+
const payload: TapPayload =
|
|
162
222
|
checksScreen &&
|
|
163
223
|
typeof resolved.cx === 'number' &&
|
|
164
224
|
typeof resolved.cy === 'number' &&
|
|
@@ -262,7 +322,7 @@ export async function tapCoordinates(
|
|
|
262
322
|
x: number,
|
|
263
323
|
y: number,
|
|
264
324
|
target?: TapTargetSummary,
|
|
265
|
-
): Promise<
|
|
325
|
+
): Promise<SimTapResult> {
|
|
266
326
|
return bridge.send({
|
|
267
327
|
type: 'tap',
|
|
268
328
|
x,
|
|
@@ -274,8 +334,8 @@ export async function tapCoordinates(
|
|
|
274
334
|
function payloadFromResolved(
|
|
275
335
|
resolved: ResolvedTargetCoords,
|
|
276
336
|
match: SootSimReplayTarget,
|
|
277
|
-
extra:
|
|
278
|
-
) {
|
|
337
|
+
extra: { total: number; idx: number } | null = null,
|
|
338
|
+
): TapPayload {
|
|
279
339
|
return {
|
|
280
340
|
cx: resolved.x,
|
|
281
341
|
cy: resolved.y,
|
|
@@ -295,7 +355,7 @@ function payloadFromResolved(
|
|
|
295
355
|
type: resolved.type ?? match.type ?? null,
|
|
296
356
|
},
|
|
297
357
|
strategy: 'matched-node',
|
|
298
|
-
...extra,
|
|
358
|
+
...(extra ?? {}),
|
|
299
359
|
}
|
|
300
360
|
}
|
|
301
361
|
|
|
@@ -380,7 +440,7 @@ async function resolveTextTapTarget(
|
|
|
380
440
|
bridge: InspectBridge,
|
|
381
441
|
query: string,
|
|
382
442
|
options: TapTextOptions = {},
|
|
383
|
-
) {
|
|
443
|
+
): Promise<TapPayload> {
|
|
384
444
|
const needle = options.exact ? query : query.trim().toLowerCase()
|
|
385
445
|
if (!needle) return { matched: 0, total: 0 }
|
|
386
446
|
const { tree } = await inspectTree(bridge, 50)
|
|
@@ -1294,7 +1294,7 @@ export function waitReadyReason(
|
|
|
1294
1294
|
if (status.bridgeError.includes(HEADLESS_TENANT_FETCH_HUNG_MARKER)) {
|
|
1295
1295
|
return status.bridgeError
|
|
1296
1296
|
}
|
|
1297
|
-
return `
|
|
1297
|
+
return `readiness probe failed: ${status.bridgeError}; no readiness snapshot received (check \`peach list\` for connection state)`
|
|
1298
1298
|
}
|
|
1299
1299
|
const waitingOnGuestFetch =
|
|
1300
1300
|
status.externalReady === false && /https?:\/\//.test(status.externalStatus)
|
|
@@ -1388,6 +1388,10 @@ export async function inspectWaitReady(
|
|
|
1388
1388
|
const status = waitReadyFromResult(result)
|
|
1389
1389
|
status.elapsedMs = now() - start
|
|
1390
1390
|
lastStatus = status
|
|
1391
|
+
// a guest evaluating its bundle holds the page, so a connected sim can
|
|
1392
|
+
// answer a slice after the transport deadline. that is no progress, and
|
|
1393
|
+
// the stall bound decides when an unanswering sim fails the wait.
|
|
1394
|
+
if (status.bridgeError.startsWith('command timed out after ')) continue
|
|
1391
1395
|
if (status.ready || status.externalError || status.bridgeError) return status
|
|
1392
1396
|
const key = waitReadyProgressKey(status)
|
|
1393
1397
|
if (key !== lastKey) {
|
|
@@ -354,8 +354,11 @@ export async function waitForSootsimIdle({
|
|
|
354
354
|
}
|
|
355
355
|
const counts = await countsRead
|
|
356
356
|
if (counts === BUSY) workerBusy = true
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
// <Image> loads are left to the image loader, which counts only those
|
|
358
|
+
// that can reach the window. a runtime older than the CLI reports none.
|
|
359
|
+
const imageLoads = counts?.imageLoads ?? { total: 0, inFlight: 0 }
|
|
360
|
+
requestTotal = typeof counts?.total === 'number' ? counts.total - imageLoads.total : 0
|
|
361
|
+
requestInFlight = typeof counts?.inFlight === 'number' ? counts.inFlight - imageLoads.inFlight : 0
|
|
359
362
|
const total = await nodeCountRead
|
|
360
363
|
if (total === BUSY) workerBusy = true
|
|
361
364
|
nodeCount = typeof total === 'number' ? total : null
|
|
@@ -87,6 +87,12 @@ function printReady(status: WaitReadyStatus, elapsedMs: number): void {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
function timedOut(status: WaitReadyStatus, elapsedMs: number): never {
|
|
90
|
+
if (status.bridgeError) {
|
|
91
|
+
console.error(
|
|
92
|
+
` ⚠ wait ready failed after ${elapsedMs}ms: ${waitReadyReason(status)}`,
|
|
93
|
+
)
|
|
94
|
+
rnxExit(1)
|
|
95
|
+
}
|
|
90
96
|
printStartupStatus(status)
|
|
91
97
|
console.error(
|
|
92
98
|
` ⚠ wait ready timed out after ${elapsedMs}ms — ${waitReadyReason(status)} (nodes: ${status.nodes}, targets: ${status.targets}, live surfaces: ${status.liveFrameActive ? status.liveFrameChannels : 0}, browser surfaces: ${status.browserSurfaceCount}, errors: ${status.errors})`,
|
package/cli/commands/inspect.ts
CHANGED
|
@@ -39,12 +39,14 @@ import {
|
|
|
39
39
|
type BridgeSimInfo,
|
|
40
40
|
} from '../ws-bridge'
|
|
41
41
|
import {
|
|
42
|
+
isResolvedTapPayload,
|
|
42
43
|
isTapSuccess,
|
|
43
44
|
tapBest,
|
|
44
45
|
tapById,
|
|
45
46
|
tapByText,
|
|
46
47
|
tapCoordinates,
|
|
47
48
|
tapResolvedTarget,
|
|
49
|
+
type TapOutcome,
|
|
48
50
|
type TapTextOptions,
|
|
49
51
|
} from './inspect/actions'
|
|
50
52
|
import {
|
|
@@ -113,7 +115,7 @@ import { runWaitIdleSubcommand } from './inspect/wait-idle'
|
|
|
113
115
|
import { runWaitReadySubcommand } from './inspect/wait-ready'
|
|
114
116
|
import { runWaitSelectorSubcommand } from './inspect/wait-selector'
|
|
115
117
|
import { printMissingSimHint, printUnknownSimHint } from './no-bridge-hint'
|
|
116
|
-
import type { PerformResult, PerformStep } from '../../src/bridge-contract'
|
|
118
|
+
import type { PerformResult, PerformStep, SimTapResult } from '../../src/bridge-contract'
|
|
117
119
|
import type {
|
|
118
120
|
SootSimReplayTarget,
|
|
119
121
|
SootSimRequestEntry,
|
|
@@ -1011,7 +1013,7 @@ async function recordInspectAction(
|
|
|
1011
1013
|
function buildTapCandidateFromResult(
|
|
1012
1014
|
x: number,
|
|
1013
1015
|
y: number,
|
|
1014
|
-
result:
|
|
1016
|
+
result: SimTapResult | null | undefined,
|
|
1015
1017
|
): { step: Record<string, unknown>; summary: string } | null {
|
|
1016
1018
|
if (!result || result.hit === false) return null
|
|
1017
1019
|
|
|
@@ -1416,9 +1418,16 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
1416
1418
|
}
|
|
1417
1419
|
}
|
|
1418
1420
|
|
|
1419
|
-
function printTapFailure(
|
|
1420
|
-
|
|
1421
|
-
|
|
1421
|
+
function printTapFailure(
|
|
1422
|
+
label: string,
|
|
1423
|
+
outcome: Pick<TapOutcome, 'attempts' | 'result'>,
|
|
1424
|
+
) {
|
|
1425
|
+
const { x, y, screen } = outcome.result ?? {}
|
|
1426
|
+
if (
|
|
1427
|
+
outcome.result?.reason === 'offscreen' &&
|
|
1428
|
+
typeof x === 'number' &&
|
|
1429
|
+
typeof y === 'number'
|
|
1430
|
+
) {
|
|
1422
1431
|
console.error(
|
|
1423
1432
|
` tap failed: ${label} resolved to (${Math.round(x)},${Math.round(y)}), outside the ${screen?.width}x${screen?.height} screen`,
|
|
1424
1433
|
)
|
|
@@ -2030,7 +2039,7 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
2030
2039
|
},
|
|
2031
2040
|
})
|
|
2032
2041
|
const payload = outcome.payload
|
|
2033
|
-
if (!payload
|
|
2042
|
+
if (!isResolvedTapPayload(payload)) {
|
|
2034
2043
|
await reportMissingTarget(bridge, 'tap', target)
|
|
2035
2044
|
peachExit(1)
|
|
2036
2045
|
}
|
|
@@ -2254,17 +2263,9 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
2254
2263
|
}
|
|
2255
2264
|
|
|
2256
2265
|
if (payload?.ambiguous) {
|
|
2257
|
-
const candidatesOut = payload.candidates
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
type: string | null
|
|
2261
|
-
testID: string | null
|
|
2262
|
-
text: string
|
|
2263
|
-
abs: { x: number; y: number } | null
|
|
2264
|
-
layout: { width: number; height: number } | null
|
|
2265
|
-
ancestorTestIDs: string[]
|
|
2266
|
-
}>
|
|
2267
|
-
console.error(` ambiguous: ${payload.total} matches for "${query}"`)
|
|
2266
|
+
const candidatesOut = payload.candidates ?? []
|
|
2267
|
+
const total = payload.total ?? candidatesOut.length
|
|
2268
|
+
console.error(` ambiguous: ${total} matches for "${query}"`)
|
|
2268
2269
|
for (const c of candidatesOut) {
|
|
2269
2270
|
const loc = c.abs ? `@(${Math.round(c.abs.x)},${Math.round(c.abs.y)})` : ''
|
|
2270
2271
|
const size = c.layout ? ` ${c.layout.width}x${c.layout.height}` : ''
|
|
@@ -2281,8 +2282,8 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
2281
2282
|
` [${c.idx}] <${c.type}>${text}${tid} ${loc}${size}${ancestors}`,
|
|
2282
2283
|
)
|
|
2283
2284
|
}
|
|
2284
|
-
if (
|
|
2285
|
-
console.error(` ... and ${
|
|
2285
|
+
if (total > candidatesOut.length) {
|
|
2286
|
+
console.error(` ... and ${total - candidatesOut.length} more`)
|
|
2286
2287
|
}
|
|
2287
2288
|
console.error(' pick one:')
|
|
2288
2289
|
console.error(
|
|
@@ -2309,7 +2310,7 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
2309
2310
|
peachExit(1)
|
|
2310
2311
|
}
|
|
2311
2312
|
|
|
2312
|
-
if (!payload
|
|
2313
|
+
if (!isResolvedTapPayload(payload)) {
|
|
2313
2314
|
console.error(` not found: ${query}`)
|
|
2314
2315
|
peachExit(1)
|
|
2315
2316
|
}
|
|
@@ -2344,7 +2345,7 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
2344
2345
|
: {}),
|
|
2345
2346
|
// expose the disambiguation outcome so agents can confirm which
|
|
2346
2347
|
// of the N matches was tapped, or notice that only one exists.
|
|
2347
|
-
...(payload.total > 1 || nthIndex !== null
|
|
2348
|
+
...((payload.total ?? 0) > 1 || nthIndex !== null
|
|
2348
2349
|
? { nth: { index: payload.idx, total: payload.total } }
|
|
2349
2350
|
: {}),
|
|
2350
2351
|
...(outcome.attempts > 1 ? { attempts: outcome.attempts } : {}),
|
|
@@ -2372,29 +2373,14 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
2372
2373
|
peachExit(1)
|
|
2373
2374
|
}
|
|
2374
2375
|
const outcome = await tapBest(bridge, query, { agent: isAgentEnv() })
|
|
2375
|
-
const payload = outcome.payload
|
|
2376
|
-
| {
|
|
2377
|
-
strategy: 'testid' | 'text'
|
|
2378
|
-
node: {
|
|
2379
|
-
nodeId: number | null
|
|
2380
|
-
id: string | null
|
|
2381
|
-
testID: string | null
|
|
2382
|
-
type: string | null
|
|
2383
|
-
text: string | null
|
|
2384
|
-
}
|
|
2385
|
-
cx: number
|
|
2386
|
-
cy: number
|
|
2387
|
-
}
|
|
2388
|
-
| { strategy: 'none' }
|
|
2389
|
-
| { error: string }
|
|
2390
|
-
| null
|
|
2376
|
+
const payload = outcome.payload
|
|
2391
2377
|
if (!payload) {
|
|
2392
2378
|
console.error(
|
|
2393
2379
|
` tap-best: no testID or visible text matched "${query}". try \`peach find --interactive-targets\` to list candidates.`,
|
|
2394
2380
|
)
|
|
2395
2381
|
peachExit(1)
|
|
2396
2382
|
}
|
|
2397
|
-
if (
|
|
2383
|
+
if (payload.error !== undefined) {
|
|
2398
2384
|
console.error(` ${payload.error}`)
|
|
2399
2385
|
peachExit(1)
|
|
2400
2386
|
}
|
|
@@ -2405,6 +2391,12 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
2405
2391
|
peachExit(1)
|
|
2406
2392
|
}
|
|
2407
2393
|
const node = payload.node
|
|
2394
|
+
if (!isResolvedTapPayload(payload) || !node) {
|
|
2395
|
+
console.error(
|
|
2396
|
+
` tap-best: no testID or visible text matched "${query}". try \`peach find --interactive-targets\` to list candidates.`,
|
|
2397
|
+
)
|
|
2398
|
+
peachExit(1)
|
|
2399
|
+
}
|
|
2408
2400
|
if (!isTapSuccess(outcome.result)) {
|
|
2409
2401
|
printTapFailure(`best "${query}"`, outcome)
|
|
2410
2402
|
peachExit(1)
|
|
@@ -2446,7 +2438,7 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
2446
2438
|
}
|
|
2447
2439
|
if (bridge.plane === 'cloud') {
|
|
2448
2440
|
const outcome = await tapById(bridge, targetId, { agent: isAgentEnv() })
|
|
2449
|
-
if (!outcome.payload
|
|
2441
|
+
if (!isResolvedTapPayload(outcome.payload)) {
|
|
2450
2442
|
console.error(` not found: ${targetId}`)
|
|
2451
2443
|
await printSimilarTestIds(bridge, targetId)
|
|
2452
2444
|
peachExit(1)
|
|
@@ -3477,10 +3469,11 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
3477
3469
|
acquireLock: true,
|
|
3478
3470
|
})
|
|
3479
3471
|
try {
|
|
3480
|
-
const reloadResult = await bridge.send(
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3472
|
+
const reloadResult = await bridge.send(
|
|
3473
|
+
{
|
|
3474
|
+
type: 'evaluate',
|
|
3475
|
+
acquireLock: true,
|
|
3476
|
+
code: `;(async () => {
|
|
3484
3477
|
// in-place guest reload is only valid while the page still runs
|
|
3485
3478
|
// the engine build the server would serve NOW. the shell dev
|
|
3486
3479
|
// server has no HMR client, so a long-lived sim tab otherwise
|
|
@@ -3498,14 +3491,19 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
3498
3491
|
}
|
|
3499
3492
|
} catch {}
|
|
3500
3493
|
const reloadExternalApp = window.SootSim?.bridges?.hotRemount?.reloadExternalApp
|
|
3494
|
+
// the restart can first finish work the running app owns, such
|
|
3495
|
+
// as suspending a recording, while the old app still answers
|
|
3496
|
+
// ready. resolve with it so the ready poll reads the new app.
|
|
3501
3497
|
if (!engineStale && typeof reloadExternalApp === 'function') {
|
|
3502
|
-
reloadExternalApp()
|
|
3498
|
+
await reloadExternalApp()
|
|
3503
3499
|
return { kind: 'external-app' }
|
|
3504
3500
|
}
|
|
3505
3501
|
window.location.reload()
|
|
3506
3502
|
return { kind: 'page', engineStale }
|
|
3507
3503
|
})()`,
|
|
3508
|
-
|
|
3504
|
+
},
|
|
3505
|
+
{ timeoutMs: RELOAD_READY_TIMEOUT_MS },
|
|
3506
|
+
)
|
|
3509
3507
|
inPlaceReload = !!reloadResult && reloadResult.kind === 'external-app'
|
|
3510
3508
|
issuedReload = true
|
|
3511
3509
|
if (reloadResult && reloadResult.engineStale) {
|
|
@@ -3521,6 +3519,11 @@ export async function runInspect(args: string[], opts: InspectOptions) {
|
|
|
3521
3519
|
) {
|
|
3522
3520
|
throw error
|
|
3523
3521
|
}
|
|
3522
|
+
// an in-place restart that outlives the budget is still replacing the
|
|
3523
|
+
// app, so a ready poll now would read the app it replaces.
|
|
3524
|
+
if (message.startsWith('command timed out')) {
|
|
3525
|
+
throw new Error(`reload did not finish within ${RELOAD_READY_TIMEOUT_MS}ms`)
|
|
3526
|
+
}
|
|
3524
3527
|
// the sim may already be in the middle of reloading; fall through to reconnect wait
|
|
3525
3528
|
}
|
|
3526
3529
|
console.log(' reloading...')
|