peachsim 0.1.1660 → 0.1.1673
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 +8 -1
- package/cli/bridge-flow-runner.ts +6 -3
- package/cli/commands/box.ts +2 -0
- package/cli/commands/control.ts +56 -17
- package/cli/commands/coverage-swift.ts +291 -0
- package/cli/commands/coverage.ts +168 -24
- package/cli/commands/debug.ts +100 -9
- package/cli/commands/diagnose.ts +1 -19
- package/cli/commands/flow.ts +2 -2
- package/cli/commands/inspect/settle.ts +4 -2
- package/cli/commands/inspect/settling.ts +17 -14
- package/cli/commands/platform.ts +3 -0
- package/cli/commands/react.ts +3 -18
- package/cli/commands/screenshot.ts +1 -1
- package/cli/commands/screenshots-capture.ts +1 -1
- package/cli/current-sim.ts +21 -1
- package/cli/dev-build-freshness.ts +36 -2
- package/cli/drivers/playwright-provisioning.ts +1 -4
- package/cli/drivers/playwright.ts +15 -1
- package/cli/maestro-compare.ts +44 -14
- package/cli/main.ts +3 -0
- package/cli/material-symbol-fonts.ts +3 -100
- package/cli/output-redaction.ts +21 -6
- package/cli/parent-pid.ts +2 -2
- package/cli/scene-video.ts +1 -1
- package/cli/ui.ts +20 -0
- package/cli/ws-bridge.ts +26 -37
- package/detox/frame-identity.cjs +21 -0
- package/detox/frame-identity.d.cts +6 -0
- package/detox/index.ts +39 -33
- package/detox/jest-environment.cjs +4 -1
- package/detox/jest-setup-after-env.cjs +0 -4
- package/detox/navigation-lifecycle.ts +2 -2
- package/detox/proof-observer.ts +126 -0
- package/dist-lib/agent-daemon-client.cjs +29 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +10 -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 +2581 -27346
- 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 +2752 -4982
- package/dist-lib/detox/jest-environment.cjs +4 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +2272 -27004
- 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 +2801 -27484
- package/dist-lib/host/fetch-proxy-handler.cjs +7 -7
- 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 +394 -49
- 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 +10 -1
- package/dist-lib/metro-production-bundle.mjs +12 -1
- package/dist-lib/metro.cjs +235 -13
- package/dist-lib/native-app-identity-project.cjs +123 -13
- package/dist-lib/native-app-identity-project.mjs +123 -13
- 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/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +21 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +76 -28
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +590 -184
- 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 +964 -0
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +18 -15
- package/dist-lib/sdk.mjs +18 -15
- package/dist-lib/skills.cjs +3900 -28409
- package/dist-lib/swift-compile.cjs +1227 -26292
- package/dist-lib/swift-compile.mjs +1156 -26221
- package/dist-lib/swift-package.cjs +34 -4
- package/dist-lib/swift-package.mjs +33 -4
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +52 -44
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +2317 -26955
- package/dist-lib/vite.cjs +132 -21
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/demo/demo-bundle-platform.d.ts +29 -0
- package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +13 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/engine/fontDataContract.d.ts +73 -0
- package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +2 -3
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +21 -3
- package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -4
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +0 -1
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/ios/aux-shell-animated-sources.d.ts +6 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +68 -0
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +11 -0
- package/dist-types/packages/peach-engine/src/render-worker/nativeSyncReplyContract.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +8 -1
- package/dist-types/packages/peach-engine/src/render-worker/shell-scene-schema.d.ts +10 -2
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +7 -2
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/accessibilityBridgeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/androidDateTimePickerBridgeContract.d.ts +41 -0
- package/dist-types/packages/peach-globals/src/appLifecycleBridgeContract.d.ts +22 -0
- package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +33 -0
- package/dist-types/packages/peach-globals/src/bridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +94 -0
- package/dist-types/packages/peach-globals/src/captureBridgeContract.d.ts +36 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +45 -0
- package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +31 -0
- package/dist-types/packages/peach-globals/src/debugBridgeContract.d.ts +27 -0
- package/dist-types/packages/peach-globals/src/electronBridgeContract.d.ts +29 -0
- package/dist-types/packages/peach-globals/src/eventBridgeContract.d.ts +200 -0
- package/dist-types/packages/peach-globals/src/globalsContract.d.ts +462 -0
- package/dist-types/packages/peach-globals/src/hostStorageBridgeContract.d.ts +3 -0
- package/dist-types/packages/peach-globals/src/imagePickerBridgeContract.d.ts +47 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +47 -3343
- package/dist-types/packages/peach-globals/src/interactionBridgeContract.d.ts +21 -0
- package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +44 -0
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +77 -0
- package/dist-types/packages/peach-globals/src/nativeViewContract.d.ts +28 -0
- package/dist-types/packages/peach-globals/src/navigationBridgeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +665 -0
- package/dist-types/packages/peach-globals/src/performanceBridgeContract.d.ts +100 -0
- package/dist-types/packages/peach-globals/src/permissionsBridgeContract.d.ts +152 -0
- package/dist-types/packages/peach-globals/src/photoLibraryBridgeContract.d.ts +36 -0
- package/dist-types/packages/peach-globals/src/portalBridgeContract.d.ts +9 -0
- package/dist-types/packages/peach-globals/src/recordingBridgeContract.d.ts +131 -0
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +125 -0
- package/dist-types/packages/peach-globals/src/sceneStreamBridgeContract.d.ts +37 -0
- package/dist-types/packages/peach-globals/src/settingsBridgeContract.d.ts +7 -0
- package/dist-types/packages/peach-globals/src/shareSheetBridgeContract.d.ts +14 -0
- package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +82 -0
- package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +28 -0
- package/dist-types/packages/peach-globals/src/speechSynthesisBridgeContract.d.ts +25 -0
- package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +278 -0
- package/dist-types/packages/peach-globals/src/timelineBridgeContract.d.ts +58 -0
- package/dist-types/packages/peach-globals/src/videoBridgeContract.d.ts +80 -0
- package/dist-types/packages/peach-globals/src/webViewBridgeContract.d.ts +331 -0
- package/dist-types/packages/peach-globals/src/windowBridgeContract.d.ts +5 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/ui/popover-placement.d.ts +3 -5
- package/package.json +2 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVAsset.h +20 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVAsynchronousKeyValueLoading.h +15 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.h +5 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVMetadataFormat.h +13 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVMetadataItem.h +16 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Headers/AVTimedMetadataGroup.h +13 -0
- package/sdk/ios/System/Library/Frameworks/AVFoundation.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +11 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +307 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +174 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +7 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/CoreData.h +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchRequest.h +21 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSFetchedResultsController.h +39 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObject.h +10 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h +9 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectID.h +7 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectModel.h +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreCoordinator.h +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Headers/NSPersistentStoreRequest.h +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreData.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +221 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +316 -0
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.h +46 -0
- package/sdk/ios/System/Library/Frameworks/CoreImage.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMTime.h +31 -0
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CMTimeRange.h +8 -0
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.h +3 -0
- package/sdk/ios/System/Library/Frameworks/CoreMedia.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h +12 -0
- package/sdk/ios/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h +1276 -0
- package/sdk/ios/System/Library/Frameworks/CoreServices.framework/Headers/UTType.h +644 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontManager.h +20 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreText.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +1441 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageAnimation.h +106 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageDestination.h +429 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageMetadata.h +665 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageProperties.h +2504 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/CGImageSource.h +634 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/ImageIO.h +22 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h +18 -0
- package/sdk/ios/System/Library/Frameworks/ImageIO.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/System/Library/Frameworks/MobileCoreServices.framework/Headers/MobileCoreServices.h +9 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +40 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h +14 -0
- package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewControllerConfiguration.h +9 -0
- package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SafariServices.h +2 -0
- package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +3 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +30 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +3 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStore.h +439 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h +216 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreKey.h +267 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetwork.h +204 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h +1393 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConnection.h +568 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkReachability.h +369 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h +473 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesPath.h +179 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesSetSpecific.h +95 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h +2395 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h +184 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAppearance.h +5 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIColor.h +2 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +817 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Modules/module.modulemap +4 -0
- package/sdk/ios/usr/include/Availability.h +630 -0
- package/sdk/ios/usr/include/AvailabilityInternal.h +556 -0
- package/sdk/ios/usr/include/AvailabilityInternalLegacy.h +4346 -0
- package/sdk/ios/usr/include/AvailabilityVersions.h +547 -0
- package/sdk/ios/usr/include/CommonCrypto/CommonDigest.h +130 -0
- package/sdk/ios/usr/include/MacTypes.h +3 -0
- package/sdk/ios/usr/include/TargetConditionals.h +14 -0
- package/sdk/ios/usr/include/__xlocale.h +41 -0
- package/sdk/ios/usr/include/_bounds.h +67 -0
- package/sdk/ios/usr/include/_ctermid.h +42 -0
- package/sdk/ios/usr/include/_mb_cur_max.h +39 -0
- package/sdk/ios/usr/include/_printf.h +38 -0
- package/sdk/ios/usr/include/_stdio.h +510 -0
- package/sdk/ios/usr/include/_types/_intmax_t.h +40 -0
- package/sdk/ios/usr/include/_types/_locale_t.h +38 -0
- package/sdk/ios/usr/include/_types/_uint16_t.h +32 -0
- package/sdk/ios/usr/include/_types/_uint32_t.h +32 -0
- package/sdk/ios/usr/include/_types/_uint64_t.h +32 -0
- package/sdk/ios/usr/include/_types/_uint8_t.h +32 -0
- package/sdk/ios/usr/include/_types/_uintmax_t.h +40 -0
- package/sdk/ios/usr/include/_types.h +72 -0
- package/sdk/ios/usr/include/arm/_endian.h +105 -0
- package/sdk/ios/usr/include/arm/_mcontext.h +95 -0
- package/sdk/ios/usr/include/arm/_param.h +25 -0
- package/sdk/ios/usr/include/arm/_types.h +125 -0
- package/sdk/ios/usr/include/arm/endian.h +65 -0
- package/sdk/ios/usr/include/arm/signal.h +22 -0
- package/sdk/ios/usr/include/arm/types.h +110 -0
- package/sdk/ios/usr/include/asl.h +160 -0
- package/sdk/ios/usr/include/assert.h +14 -0
- package/sdk/ios/usr/include/dirent.h +224 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +114 -0
- package/sdk/ios/usr/include/dlfcn.h +16 -0
- package/sdk/ios/usr/include/errno.h +24 -0
- package/sdk/ios/usr/include/execinfo.h +11 -0
- package/sdk/ios/usr/include/fcntl.h +23 -0
- package/sdk/ios/usr/include/i386/_endian.h +105 -0
- package/sdk/ios/usr/include/i386/_mcontext.h +216 -0
- package/sdk/ios/usr/include/i386/_param.h +49 -0
- package/sdk/ios/usr/include/i386/_types.h +149 -0
- package/sdk/ios/usr/include/i386/endian.h +89 -0
- package/sdk/ios/usr/include/i386/signal.h +47 -0
- package/sdk/ios/usr/include/libkern/OSAtomic.h +51 -0
- package/sdk/ios/usr/include/libkern/OSAtomicDeprecated.h +1267 -0
- package/sdk/ios/usr/include/libkern/OSAtomicQueue.h +115 -0
- package/sdk/ios/usr/include/libkern/OSByteOrder.h +315 -0
- package/sdk/ios/usr/include/libkern/OSSpinLockDeprecated.h +212 -0
- package/sdk/ios/usr/include/libkern/_OSByteOrder.h +125 -0
- package/sdk/ios/usr/include/libkern/arm/_OSByteOrder.h +99 -0
- package/sdk/ios/usr/include/libkern/i386/_OSByteOrder.h +110 -0
- package/sdk/ios/usr/include/libkern/machine/OSByteOrder.h +147 -0
- package/sdk/ios/usr/include/limits.h +4 -0
- package/sdk/ios/usr/include/mach/arm/_structs.h +741 -0
- package/sdk/ios/usr/include/mach/boolean.h +4 -0
- package/sdk/ios/usr/include/mach/exception_types.h +40 -0
- package/sdk/ios/usr/include/mach/host_info.h +200 -0
- package/sdk/ios/usr/include/mach/i386/_structs.h +1316 -0
- package/sdk/ios/usr/include/mach/kern_return.h +61 -0
- package/sdk/ios/usr/include/mach/mach.h +16 -0
- package/sdk/ios/usr/include/mach/mach_error.h +10 -0
- package/sdk/ios/usr/include/mach/mach_host.h +18 -0
- package/sdk/ios/usr/include/mach/mach_init.h +15 -0
- package/sdk/ios/usr/include/mach/mach_port.h +11 -0
- package/sdk/ios/usr/include/mach/mach_time.h +14 -0
- package/sdk/ios/usr/include/mach/mach_types.h +20 -0
- package/sdk/ios/usr/include/mach/machine/_structs.h +40 -0
- package/sdk/ios/usr/include/mach/machine.h +144 -0
- package/sdk/ios/usr/include/mach/task.h +14 -0
- package/sdk/ios/usr/include/mach/task_info.h +23 -0
- package/sdk/ios/usr/include/mach/task_policy.h +29 -0
- package/sdk/ios/usr/include/mach/thread_act.h +12 -0
- package/sdk/ios/usr/include/mach/thread_info.h +32 -0
- package/sdk/ios/usr/include/mach/time_value.h +4 -0
- package/sdk/ios/usr/include/mach/vm_prot.h +8 -0
- package/sdk/ios/usr/include/mach/vm_region.h +43 -0
- package/sdk/ios/usr/include/mach/vm_statistics.h +491 -0
- package/sdk/ios/usr/include/mach/vm_types.h +8 -0
- package/sdk/ios/usr/include/mach-o/arch.h +21 -0
- package/sdk/ios/usr/include/mach-o/dyld.h +16 -0
- package/sdk/ios/usr/include/mach-o/dyld_images.h +71 -0
- package/sdk/ios/usr/include/mach-o/getsect.h +17 -0
- package/sdk/ios/usr/include/mach-o/loader.h +158 -0
- package/sdk/ios/usr/include/mach-o/nlist.h +38 -0
- package/sdk/ios/usr/include/mach-o/stab.h +33 -0
- package/sdk/ios/usr/include/mach-o/utils.h +10 -0
- package/sdk/ios/usr/include/machine/_endian.h +42 -0
- package/sdk/ios/usr/include/machine/_mcontext.h +39 -0
- package/sdk/ios/usr/include/machine/_param.h +39 -0
- package/sdk/ios/usr/include/machine/_types.h +39 -0
- package/sdk/ios/usr/include/machine/endian.h +42 -0
- package/sdk/ios/usr/include/machine/signal.h +39 -0
- package/sdk/ios/usr/include/machine/types.h +42 -0
- package/sdk/ios/usr/include/math.h +5 -0
- package/sdk/ios/usr/include/module.modulemap +4 -0
- package/sdk/ios/usr/include/net/if.h +20 -0
- package/sdk/ios/usr/include/net/if_dl.h +10 -0
- package/sdk/ios/usr/include/net/if_var.h +15 -0
- package/sdk/ios/usr/include/net/net_kev.h +100 -0
- package/sdk/ios/usr/include/netdb.h +5 -0
- package/sdk/ios/usr/include/netinet/in.h +670 -0
- package/sdk/ios/usr/include/netinet6/in6.h +676 -0
- package/sdk/ios/usr/include/notify.h +45 -0
- package/sdk/ios/usr/include/notify_keys.h +17 -0
- package/sdk/ios/usr/include/objc/NSObject.h +79 -0
- package/sdk/ios/usr/include/os/availability.h +140 -0
- package/sdk/ios/usr/include/os/lock.h +24 -0
- package/sdk/ios/usr/include/os/log.h +77 -0
- package/sdk/ios/usr/include/os/object.h +13 -0
- package/sdk/ios/usr/include/peach/darwin.h +6 -0
- package/sdk/ios/usr/include/peach/netdb.h +316 -0
- package/sdk/ios/usr/include/peach/pthread.h +19 -0
- package/sdk/ios/usr/include/pthread.h +4 -0
- package/sdk/ios/usr/include/secure/_common.h +45 -0
- package/sdk/ios/usr/include/secure/_stdio.h +130 -0
- package/sdk/ios/usr/include/signal.h +132 -0
- package/sdk/ios/usr/include/stdint.h +205 -0
- package/sdk/ios/usr/include/stdio.h +65 -0
- package/sdk/ios/usr/include/stdlib.h +17 -0
- package/sdk/ios/usr/include/string.h +8 -0
- package/sdk/ios/usr/include/sys/__endian.h +108 -0
- package/sdk/ios/usr/include/sys/_endian.h +152 -0
- package/sdk/ios/usr/include/sys/_posix_availability.h +73 -0
- package/sdk/ios/usr/include/sys/_pthread/_pthread_attr_t.h +32 -0
- package/sdk/ios/usr/include/sys/_pthread/_pthread_t.h +32 -0
- package/sdk/ios/usr/include/sys/_pthread/_pthread_types.h +120 -0
- package/sdk/ios/usr/include/sys/_symbol_aliasing.h +1093 -0
- package/sdk/ios/usr/include/sys/_types/_errno_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_filesec_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_gid_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_in_addr_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_in_port_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_ino_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_int16_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_int32_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_int64_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_int8_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_intptr_t.h +33 -0
- package/sdk/ios/usr/include/sys/_types/_iovec_t.h +35 -0
- package/sdk/ios/usr/include/sys/_types/_mode_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_null.h +54 -0
- package/sdk/ios/usr/include/sys/_types/_o_dsync.h +30 -0
- package/sdk/ios/usr/include/sys/_types/_o_sync.h +30 -0
- package/sdk/ios/usr/include/sys/_types/_off_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_pid_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_ptrdiff_t.h +56 -0
- package/sdk/ios/usr/include/sys/_types/_s_ifmt.h +74 -0
- package/sdk/ios/usr/include/sys/_types/_sa_family_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_seek_set.h +51 -0
- package/sdk/ios/usr/include/sys/_types/_sigaltstack.h +50 -0
- package/sdk/ios/usr/include/sys/_types/_sigset_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_size_t.h +56 -0
- package/sdk/ios/usr/include/sys/_types/_socklen_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_ssize_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_timespec.h +38 -0
- package/sdk/ios/usr/include/sys/_types/_timeval32.h +3 -0
- package/sdk/ios/usr/include/sys/_types/_u_int16_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_u_int32_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_u_int64_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_u_int8_t.h +31 -0
- package/sdk/ios/usr/include/sys/_types/_ucontext.h +59 -0
- package/sdk/ios/usr/include/sys/_types/_uid_t.h +32 -0
- package/sdk/ios/usr/include/sys/_types/_uintptr_t.h +37 -0
- package/sdk/ios/usr/include/sys/_types/_va_list.h +49 -0
- package/sdk/ios/usr/include/sys/_types/_wchar_t.h +59 -0
- package/sdk/ios/usr/include/sys/_types.h +103 -0
- package/sdk/ios/usr/include/sys/appleapiopts.h +61 -0
- package/sdk/ios/usr/include/sys/cdefs.h +341 -0
- package/sdk/ios/usr/include/sys/constrained_ctypes.h +622 -0
- package/sdk/ios/usr/include/sys/dirent.h +141 -0
- package/sdk/ios/usr/include/sys/errno.h +271 -0
- package/sdk/ios/usr/include/sys/fcntl.h +649 -0
- package/sdk/ios/usr/include/sys/mman.h +273 -0
- package/sdk/ios/usr/include/sys/proc.h +65 -0
- package/sdk/ios/usr/include/sys/qos.h +61 -0
- package/sdk/ios/usr/include/sys/signal.h +394 -0
- package/sdk/ios/usr/include/sys/socket.h +752 -0
- package/sdk/ios/usr/include/sys/stdio.h +61 -0
- package/sdk/ios/usr/include/sys/sysctl.h +74 -0
- package/sdk/ios/usr/include/sys/syslimits.h +11 -0
- package/sdk/ios/usr/include/sys/time.h +5 -0
- package/sdk/ios/usr/include/sys/types.h +21 -0
- package/sdk/ios/usr/include/sys/ucontext.h +41 -0
- package/sdk/ios/usr/include/sys/xattr.h +50 -0
- package/sdk/ios/usr/include/time.h +2 -0
- package/sdk/ios/usr/include/unistd.h +3 -0
- package/sdk/ios/usr/include/uuid/uuid.h +19 -0
- package/sdk/ios/usr/include/xlocale/_stdio.h +85 -0
- package/sdk/ios/usr/lib/swift/CoreGraphics.swiftmodule/arm64-apple-ios-simulator.swiftinterface +8 -0
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +51 -0
- package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +20 -0
- package/sdk/ios/wasm/include/dlfcn.h +3 -0
- package/sdk/ios/wasm/include/netdb.h +4 -0
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/stdlib.h +3 -0
- package/sdk/ios/wasm/include/string.h +3 -0
- package/sdk/ios/wasm/include/sys/socket.h +7 -0
- package/sdk/ios/wasm/include/sys/types.h +4 -0
- package/sdk/ios/wasm/include/sys/ucontext.h +38 -0
- package/src/bridge-contract.ts +42 -0
- package/src/chromium-admission.ts +196 -0
- package/src/cli-runtime.ts +5 -5
- package/src/conformance-comparison-contract.ts +146 -0
- package/src/conformance-pixel-comparison.ts +327 -0
- package/src/device-catalog.ts +12 -3
- package/src/host/bridge-host.ts +6 -43
- package/src/launch-deadline.ts +74 -0
- package/src/material-symbol-fonts.ts +107 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/profiles.ts +21 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +402 -0
- package/src/react-native-coverage/capability-source-references.ts +1296 -0
- package/src/react-native-coverage/native-typescript-parser.ts +74 -0
- package/src/react-native-coverage/project-aliases.ts +207 -0
- package/src/react-native-coverage/verified-reach.ts +47 -0
- package/src/reap-browser.ts +1019 -0
- package/src/skills/builtin/a11y-review.ts +1 -1
- package/src/skills/builtin/perf-profile.ts +1 -1
- package/src/skills/builtin/screenshot-all.ts +1 -1
- package/src/skills/builtin/visual-diff.ts +1 -1
- package/src/swift-compile.ts +584 -226
- package/src/swift-compiler-digest.ts +6 -2
- package/src/swift-coverage/indexdump.ts +80 -0
- package/src/swift-coverage/indexing.ts +147 -0
- package/src/swift-coverage/package.ts +230 -0
- package/src/swift-coverage/provenance.ts +47 -0
- package/src/swift-coverage/reader.ts +81 -0
- package/src/swift-coverage/source.ts +252 -0
- package/src/swift-coverage/types.ts +58 -0
- package/src/swift-coverage/xcode-assets.ts +175 -0
- package/src/swift-coverage/xcode-bridging.ts +160 -0
- package/src/swift-coverage/xcode-packages.ts +251 -0
- package/src/swift-coverage/xcode-strings.ts +78 -0
- package/src/swift-coverage/xcode.ts +656 -0
- package/src/swift-distribution.lock.json +8 -8
- package/src/swift-distribution.ts +2 -1
- package/src/swift-host.ts +47 -4
- package/src/swift-objc-compile.ts +72 -97
- package/src/swift-objc-import.ts +238 -38
- package/src/swift-objc-metadata.ts +54 -7
- package/src/swift-objc-sdk-tree.ts +17 -0
- package/src/swift-objc-sdk.ts +27 -25677
- package/src/swift-objc-standin.ts +4 -2
- package/src/swift-package-manifest.ts +134 -13
- package/src/swift-package.ts +46 -4
- package/src/swift-standins.ts +2 -2
- package/src/swift-submit.ts +2 -1
- package/src/swift-toolchain.ts +72 -61
- package/src/swift-vite-lifetime.ts +42 -0
- package/src/swiftContract.ts +54 -0
- package/src/vite-plugin-one.ts +36 -15
- package/src/vite-plugin-swift.ts +21 -2
- package/src/worker-system-chunks.ts +3 -10
- package/src/xcode-header-search.ts +114 -0
- package/src/xcode-project.ts +108 -14
- package/detox/attempt-events.cjs +0 -884
- package/detox/attempt-events.d.cts +0 -113
- package/detox/motion-change.cjs +0 -524
- package/detox/motion-change.d.cts +0 -140
- package/detox/motion-leg-starts.cjs +0 -20
- package/detox/motion-leg-starts.d.cts +0 -8
- package/detox/proof-frame.cjs +0 -190
- package/detox/record-block-execution.cjs +0 -78
|
@@ -0,0 +1,964 @@
|
|
|
1
|
+
/*! peach v0.1.1673 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
|
+
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
|
+
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// src/reap-browser.ts
|
|
33
|
+
var reap_browser_exports = {};
|
|
34
|
+
__export(reap_browser_exports, {
|
|
35
|
+
LINUX_CHROME_SCOPE_ENV: () => LINUX_CHROME_SCOPE_ENV,
|
|
36
|
+
assertGpuBrowserCommand: () => assertGpuBrowserCommand,
|
|
37
|
+
assertGpuRendererInfo: () => assertGpuRendererInfo,
|
|
38
|
+
chromeDisabledFeaturesSwitch: () => chromeDisabledFeaturesSwitch,
|
|
39
|
+
chromeLaunchOptions: () => chromeLaunchOptions,
|
|
40
|
+
claimSignalShutdown: () => claimSignalShutdown,
|
|
41
|
+
gpuChromeArgs: () => gpuChromeArgs,
|
|
42
|
+
gpuChromeLaunchOptions: () => gpuChromeLaunchOptions,
|
|
43
|
+
killTree: () => killTree,
|
|
44
|
+
launchReaped: () => launchReaped,
|
|
45
|
+
launchReapedChrome: () => launchReapedChrome,
|
|
46
|
+
launchReapedChromeScoped: () => launchReapedChromeScoped,
|
|
47
|
+
launchReapedScoped: () => launchReapedScoped,
|
|
48
|
+
launchWithPauseAwareDeadline: () => launchWithPauseAwareDeadline,
|
|
49
|
+
reapSpawnedNow: () => reapSpawnedNow,
|
|
50
|
+
reserveChromiumAdmission: () => reserveChromiumAdmission,
|
|
51
|
+
softwareChromeAllowed: () => softwareChromeAllowed,
|
|
52
|
+
softwareChromeLaunchOptions: () => softwareChromeLaunchOptions
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(reap_browser_exports);
|
|
55
|
+
var childProcess = __toESM(require("node:child_process"), 1);
|
|
56
|
+
var import_node_child_process3 = require("node:child_process");
|
|
57
|
+
var import_node_crypto = require("node:crypto");
|
|
58
|
+
var fs = __toESM(require("node:fs"), 1);
|
|
59
|
+
var os2 = __toESM(require("node:os"), 1);
|
|
60
|
+
var path2 = __toESM(require("node:path"), 1);
|
|
61
|
+
|
|
62
|
+
// src/chromium-admission.ts
|
|
63
|
+
function readChromiumQueue(deps, verified, own) {
|
|
64
|
+
const { fs: fs2, os: os3, path: path3, childProcess: childProcess2 } = deps;
|
|
65
|
+
const dir = path3.join(
|
|
66
|
+
process.platform === "win32" ? os3.tmpdir() : "/tmp",
|
|
67
|
+
"chromium-admission"
|
|
68
|
+
);
|
|
69
|
+
fs2.mkdirSync(dir, { recursive: true });
|
|
70
|
+
const limit = Math.max(2, Math.floor(os3.cpus().length / 3));
|
|
71
|
+
const live = (entry) => {
|
|
72
|
+
const match = /^(\d+)-(\d+)-/.exec(entry);
|
|
73
|
+
if (!match) return false;
|
|
74
|
+
const pid = Number(match[1]);
|
|
75
|
+
try {
|
|
76
|
+
process.kill(pid, 0);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
if (!(err instanceof Error && "code" in err && err.code === "EPERM")) return false;
|
|
79
|
+
}
|
|
80
|
+
const known = verified.get(entry);
|
|
81
|
+
if (known !== void 0) return known;
|
|
82
|
+
let same = pid === process.pid;
|
|
83
|
+
if (!same) {
|
|
84
|
+
let started = "";
|
|
85
|
+
try {
|
|
86
|
+
started = childProcess2.execFileSync("ps", ["-p", String(pid), "-o", "lstart="], { encoding: "utf8" }).trim();
|
|
87
|
+
} catch (err) {
|
|
88
|
+
const gone = err instanceof Error && "status" in err && err.status === 1;
|
|
89
|
+
if (!gone) return true;
|
|
90
|
+
}
|
|
91
|
+
const startedAt = Date.parse(started);
|
|
92
|
+
if (started && Number.isNaN(startedAt)) return true;
|
|
93
|
+
same = Math.abs(startedAt / 1e3 - Number(match[2])) <= 2;
|
|
94
|
+
}
|
|
95
|
+
verified.set(entry, same);
|
|
96
|
+
return same;
|
|
97
|
+
};
|
|
98
|
+
const tickets = [];
|
|
99
|
+
for (const entry of fs2.readdirSync(dir)) {
|
|
100
|
+
if (entry !== own && !live(entry)) {
|
|
101
|
+
try {
|
|
102
|
+
fs2.unlinkSync(path3.join(dir, entry));
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
tickets.push({
|
|
109
|
+
entry,
|
|
110
|
+
created: fs2.statSync(path3.join(dir, entry), { bigint: true }).ctimeNs
|
|
111
|
+
});
|
|
112
|
+
} catch {
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
tickets.sort(
|
|
116
|
+
(a, b) => a.created === b.created ? a.entry < b.entry ? -1 : 1 : a.created < b.created ? -1 : 1
|
|
117
|
+
);
|
|
118
|
+
return { dir, limit, tickets: tickets.map((t) => t.entry) };
|
|
119
|
+
}
|
|
120
|
+
async function acquireChromiumAdmission(deps) {
|
|
121
|
+
const { fs: fs2, path: path3, label, readQueue, signal } = deps;
|
|
122
|
+
signal?.throwIfAborted();
|
|
123
|
+
const queuedAt = Date.now();
|
|
124
|
+
const verified = /* @__PURE__ */ new Map();
|
|
125
|
+
const startedAt = Math.round(Date.now() / 1e3 - process.uptime());
|
|
126
|
+
const name = `${process.pid}-${startedAt}-${Math.random().toString(36).slice(2, 10)}`;
|
|
127
|
+
const ticket = path3.join(readQueue(deps, verified, name).dir, name);
|
|
128
|
+
fs2.closeSync(fs2.openSync(ticket, "wx"));
|
|
129
|
+
let released = false;
|
|
130
|
+
const release = () => {
|
|
131
|
+
if (released) return;
|
|
132
|
+
released = true;
|
|
133
|
+
process.removeListener("exit", release);
|
|
134
|
+
try {
|
|
135
|
+
fs2.unlinkSync(ticket);
|
|
136
|
+
} catch {
|
|
137
|
+
}
|
|
138
|
+
process.stderr.write(`[chromium-admission] ${label}: released ${name}
|
|
139
|
+
`);
|
|
140
|
+
};
|
|
141
|
+
process.on("exit", release);
|
|
142
|
+
signal?.addEventListener("abort", release, { once: true });
|
|
143
|
+
let waited = false;
|
|
144
|
+
try {
|
|
145
|
+
while (true) {
|
|
146
|
+
signal?.throwIfAborted();
|
|
147
|
+
const { limit, tickets } = readQueue(deps, verified, name);
|
|
148
|
+
const rank = tickets.indexOf(name);
|
|
149
|
+
if (rank < 0) {
|
|
150
|
+
throw new Error(`[chromium-admission] ${label}: reservation disappeared`);
|
|
151
|
+
}
|
|
152
|
+
if (rank < limit) {
|
|
153
|
+
process.stderr.write(
|
|
154
|
+
`[chromium-admission] ${label}: admitted ${name} after ${Date.now() - queuedAt}ms
|
|
155
|
+
`
|
|
156
|
+
);
|
|
157
|
+
return release;
|
|
158
|
+
}
|
|
159
|
+
if (!waited) {
|
|
160
|
+
const holders = tickets.slice(0, limit).map((t) => t.split("-")[0]);
|
|
161
|
+
process.stderr.write(
|
|
162
|
+
`[chromium-admission] ${label}: ${limit} chromium launches already run on this machine (pids ${holders.join(" ")}), queued ${rank - limit + 1}
|
|
163
|
+
`
|
|
164
|
+
);
|
|
165
|
+
waited = true;
|
|
166
|
+
}
|
|
167
|
+
await new Promise((resolve, reject) => {
|
|
168
|
+
const abort = () => {
|
|
169
|
+
clearTimeout(timer);
|
|
170
|
+
signal?.removeEventListener("abort", abort);
|
|
171
|
+
reject(
|
|
172
|
+
new Error(`[chromium-admission] ${label}: cancelled`, {
|
|
173
|
+
cause: signal?.reason
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
const timer = setTimeout(() => {
|
|
178
|
+
signal?.removeEventListener("abort", abort);
|
|
179
|
+
resolve();
|
|
180
|
+
}, 500);
|
|
181
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
182
|
+
if (signal?.aborted) abort();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
} catch (error) {
|
|
186
|
+
release();
|
|
187
|
+
throw error;
|
|
188
|
+
} finally {
|
|
189
|
+
signal?.removeEventListener("abort", release);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/launch-deadline.ts
|
|
194
|
+
var import_node_child_process = require("node:child_process");
|
|
195
|
+
var import_node_fs = require("node:fs");
|
|
196
|
+
var os = __toESM(require("node:os"), 1);
|
|
197
|
+
var path = __toESM(require("node:path"), 1);
|
|
198
|
+
var LEDGER_PATH = path.join(
|
|
199
|
+
process.env.TM_HOME || path.join(os.homedir(), ".team-machine"),
|
|
200
|
+
"governor-pauses.json"
|
|
201
|
+
);
|
|
202
|
+
var TICK_MS = 500;
|
|
203
|
+
var MAX_COUNTED_GAP_MS = TICK_MS * 3;
|
|
204
|
+
function heldPids() {
|
|
205
|
+
try {
|
|
206
|
+
const ledger = JSON.parse(
|
|
207
|
+
(0, import_node_fs.readFileSync)(LEDGER_PATH, "utf8")
|
|
208
|
+
);
|
|
209
|
+
return Object.values(ledger).flatMap((procs) => procs.map((proc) => proc.pid));
|
|
210
|
+
} catch {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function holdsThisProcessTree(held) {
|
|
215
|
+
const parents = /* @__PURE__ */ new Map();
|
|
216
|
+
for (const line of (0, import_node_child_process.execFileSync)("ps", ["-A", "-o", "pid=,ppid="], {
|
|
217
|
+
encoding: "utf8"
|
|
218
|
+
}).split("\n")) {
|
|
219
|
+
const [pid, ppid] = line.trim().split(/\s+/).map(Number);
|
|
220
|
+
if (pid && ppid !== void 0) parents.set(pid, ppid);
|
|
221
|
+
}
|
|
222
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
223
|
+
for (let pid = process.pid, hops = 0; pid && hops < 64; hops++) {
|
|
224
|
+
ancestors.add(pid);
|
|
225
|
+
pid = parents.get(pid);
|
|
226
|
+
}
|
|
227
|
+
return held.some((start) => {
|
|
228
|
+
if (ancestors.has(start)) return true;
|
|
229
|
+
for (let pid = parents.get(start), hops = 0; pid && hops < 64; hops++) {
|
|
230
|
+
if (pid === process.pid) return true;
|
|
231
|
+
pid = parents.get(pid);
|
|
232
|
+
}
|
|
233
|
+
return false;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function startLaunchDeadline(budgetMs, onExpire) {
|
|
237
|
+
let remaining = budgetMs;
|
|
238
|
+
let last = Date.now();
|
|
239
|
+
const poll = setInterval(() => {
|
|
240
|
+
const now = Date.now();
|
|
241
|
+
const elapsed = Math.min(now - last, MAX_COUNTED_GAP_MS);
|
|
242
|
+
last = now;
|
|
243
|
+
const held = heldPids();
|
|
244
|
+
if (held.length > 0 && holdsThisProcessTree(held)) return;
|
|
245
|
+
remaining -= elapsed;
|
|
246
|
+
if (remaining <= 0) {
|
|
247
|
+
clearInterval(poll);
|
|
248
|
+
onExpire();
|
|
249
|
+
}
|
|
250
|
+
}, TICK_MS);
|
|
251
|
+
return () => clearInterval(poll);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/process-group.ts
|
|
255
|
+
var import_node_child_process2 = require("node:child_process");
|
|
256
|
+
var import_node_fs2 = require("node:fs");
|
|
257
|
+
function listProcessChildren(parents, timeoutMs = 3e3) {
|
|
258
|
+
if (parents.some((pid) => !Number.isInteger(pid) || pid <= 1))
|
|
259
|
+
throw new Error("process inspection requires valid parent pids");
|
|
260
|
+
if (parents.length === 0) return [];
|
|
261
|
+
const deadline = Date.now() + timeoutMs;
|
|
262
|
+
let children;
|
|
263
|
+
if (process.platform === "linux") {
|
|
264
|
+
const lists = [];
|
|
265
|
+
for (const parent of parents) {
|
|
266
|
+
try {
|
|
267
|
+
const tasks = `/proc/${parent}/task`;
|
|
268
|
+
for (const thread of (0, import_node_fs2.readdirSync)(tasks)) {
|
|
269
|
+
if (Date.now() >= deadline)
|
|
270
|
+
throw new Error("process descendant inspection exceeded its deadline");
|
|
271
|
+
try {
|
|
272
|
+
lists.push((0, import_node_fs2.readFileSync)(`${tasks}/${thread}/children`, "utf8"));
|
|
273
|
+
} catch (error) {
|
|
274
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
} catch (error) {
|
|
279
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
280
|
+
throw error;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
children = lists.join(" ");
|
|
284
|
+
} else {
|
|
285
|
+
const result = (0, import_node_child_process2.spawnSync)("pgrep", ["-P", parents.join(",")], {
|
|
286
|
+
encoding: "utf8",
|
|
287
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
288
|
+
timeout: Math.max(1, timeoutMs),
|
|
289
|
+
killSignal: "SIGKILL"
|
|
290
|
+
});
|
|
291
|
+
if (result.error || result.status !== 0 && result.status !== 1) {
|
|
292
|
+
throw new Error(
|
|
293
|
+
`could not inspect descendants of processes ${parents.join(",")}: ${result.error?.message || result.stderr.trim() || `pgrep exited ${result.status}`}`
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
children = result.stdout;
|
|
297
|
+
}
|
|
298
|
+
return [...new Set(children.trim().split(/\s+/).map(Number))].filter(
|
|
299
|
+
(pid) => Number.isInteger(pid) && pid > 1 && !parents.includes(pid)
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// src/reap-browser.ts
|
|
304
|
+
var LINUX_CHROME_SCOPE_ENV = {
|
|
305
|
+
DBUS_SESSION_BUS_ADDRESS: "unix:path=/nonexistent/chrome-session-bus"
|
|
306
|
+
};
|
|
307
|
+
function reserveChromiumAdmission(signal) {
|
|
308
|
+
return acquireChromiumAdmission({
|
|
309
|
+
fs,
|
|
310
|
+
os: os2,
|
|
311
|
+
path: path2,
|
|
312
|
+
childProcess,
|
|
313
|
+
label: process.argv.slice(1, 3).join(" "),
|
|
314
|
+
readQueue: readChromiumQueue,
|
|
315
|
+
signal
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
var discoveredChromePids = /* @__PURE__ */ new WeakMap();
|
|
319
|
+
var discoveredChromeProcesses = /* @__PURE__ */ new WeakMap();
|
|
320
|
+
var reapPids = /* @__PURE__ */ new Map();
|
|
321
|
+
var installed = false;
|
|
322
|
+
function currentRuntime() {
|
|
323
|
+
return { platform: process.platform, env: process.env };
|
|
324
|
+
}
|
|
325
|
+
function processCommand(pid) {
|
|
326
|
+
return (0, import_node_child_process3.execFileSync)("/bin/ps", ["-p", String(pid), "-o", "command="], {
|
|
327
|
+
encoding: "utf8"
|
|
328
|
+
}).trim();
|
|
329
|
+
}
|
|
330
|
+
function processIdentity(pid) {
|
|
331
|
+
try {
|
|
332
|
+
const identity = (0, import_node_child_process3.execFileSync)(
|
|
333
|
+
"/bin/ps",
|
|
334
|
+
["-p", String(pid), "-o", "lstart=", "-o", "command="],
|
|
335
|
+
{ encoding: "utf8" }
|
|
336
|
+
).trim();
|
|
337
|
+
return identity || null;
|
|
338
|
+
} catch {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function softwareChromeAllowed(runtime = currentRuntime()) {
|
|
343
|
+
if (runtime.platform !== "linux") return false;
|
|
344
|
+
return runtime.env.CONTRAST_REMOTE_BUILD === "linux" || runtime.env.GITHUB_ACTIONS === "true" && runtime.env.RUNNER_OS === "Linux" || runtime.env.CONTRAST_CF_FACTORY_CONTAINER === "1" || runtime.env.PEACH_NATIVE_COMPOSITOR === "1";
|
|
345
|
+
}
|
|
346
|
+
function isSoftwareRendererArgument(value) {
|
|
347
|
+
const arg = String(value);
|
|
348
|
+
return /^--disable-gpu(?:=.*)?$/i.test(arg) || /^--enable-unsafe-swiftshader(?:=.*)?$/i.test(arg) || /^--use-angle=(?:swiftshader|swiftshader-webgl)$/i.test(arg) || /^--use-gl=swiftshader$/i.test(arg);
|
|
349
|
+
}
|
|
350
|
+
function softwareRendererArgumentInText(command) {
|
|
351
|
+
const unsafe = command.match(
|
|
352
|
+
/(?:^|\s)(--disable-gpu(?:=[^\s]+)?|--enable-unsafe-swiftshader(?:=[^\s]+)?|--use-angle=(?:swiftshader|swiftshader-webgl)|--use-gl=swiftshader)(?=\s|$)/i
|
|
353
|
+
);
|
|
354
|
+
return unsafe?.[1] ?? null;
|
|
355
|
+
}
|
|
356
|
+
function expectedAngle(platform) {
|
|
357
|
+
if (platform === "darwin") return "metal";
|
|
358
|
+
if (platform === "linux") return "vulkan";
|
|
359
|
+
return "default";
|
|
360
|
+
}
|
|
361
|
+
function assertGpuBrowserCommand(command, runtime = currentRuntime()) {
|
|
362
|
+
if (softwareChromeAllowed(runtime)) return;
|
|
363
|
+
const unsafe = softwareRendererArgumentInText(command);
|
|
364
|
+
if (unsafe) {
|
|
365
|
+
throw new Error(
|
|
366
|
+
`[reap-browser] refused software-rendering Chrome process argument ${unsafe}`
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
const angle = expectedAngle(runtime.platform);
|
|
370
|
+
const args = command.split(/\s+/);
|
|
371
|
+
if (!args.includes(`--use-angle=${angle}`) || !args.includes("--enable-gpu")) {
|
|
372
|
+
throw new Error(
|
|
373
|
+
`[reap-browser] Chrome process did not retain the required ${angle} GPU arguments`
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
for (const name of ["--enable-features=", "--disable-features="]) {
|
|
377
|
+
const lists = args.filter((arg) => arg.startsWith(name)).map((arg) => arg.slice(name.length).split(",").filter(Boolean));
|
|
378
|
+
const kept = new Set(lists.at(-1) ?? []);
|
|
379
|
+
const dropped = lists.slice(0, -1).flat().filter((feature) => !kept.has(feature));
|
|
380
|
+
if (dropped.length > 0) {
|
|
381
|
+
throw new Error(
|
|
382
|
+
`[reap-browser] Chrome keeps only its last ${name.slice(0, -1)} switch, which dropped ${dropped.join(",")}; add them to the merged list in packages/peachsim/src/reap-browser.ts`
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (runtime.platform === "darwin" && command.includes("/Applications/Google Chrome.app/")) {
|
|
387
|
+
throw new Error(
|
|
388
|
+
"[reap-browser] refused the user's installed Google Chrome; use Playwright channel chromium"
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
function collectGpuRendererStrings(info) {
|
|
393
|
+
if (!info || typeof info !== "object") return [];
|
|
394
|
+
const record = info;
|
|
395
|
+
const gpu = record.gpu;
|
|
396
|
+
if (!gpu || typeof gpu !== "object") return [];
|
|
397
|
+
const gpuRecord = gpu;
|
|
398
|
+
const values = [];
|
|
399
|
+
const aux = gpuRecord.auxAttributes;
|
|
400
|
+
if (aux && typeof aux === "object") {
|
|
401
|
+
for (const value of Object.values(aux)) {
|
|
402
|
+
if (typeof value === "string") values.push(value);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const devices = gpuRecord.devices;
|
|
406
|
+
if (Array.isArray(devices)) {
|
|
407
|
+
for (const device of devices) {
|
|
408
|
+
if (!device || typeof device !== "object") continue;
|
|
409
|
+
for (const value of Object.values(device)) {
|
|
410
|
+
if (typeof value === "string") values.push(value);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return values;
|
|
415
|
+
}
|
|
416
|
+
function browserProcessPid(info) {
|
|
417
|
+
if (!info || typeof info !== "object") return null;
|
|
418
|
+
const record = info;
|
|
419
|
+
if (!Array.isArray(record.processInfo)) return null;
|
|
420
|
+
for (const entry of record.processInfo) {
|
|
421
|
+
if (!entry || typeof entry !== "object") continue;
|
|
422
|
+
const processInfo = entry;
|
|
423
|
+
if (processInfo.type === "browser" && typeof processInfo.id === "number" && Number.isInteger(processInfo.id) && processInfo.id > 0) {
|
|
424
|
+
return processInfo.id;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
function assertGpuRendererInfo(info, runtime = currentRuntime()) {
|
|
430
|
+
if (softwareChromeAllowed(runtime)) return;
|
|
431
|
+
const renderers = collectGpuRendererStrings(info);
|
|
432
|
+
const summary = renderers.join(" | ");
|
|
433
|
+
if (!summary || /swiftshader|llvmpipe|software rasterizer/i.test(summary)) {
|
|
434
|
+
throw new Error(
|
|
435
|
+
`[reap-browser] Chrome reported a software renderer${summary ? `: ${summary}` : ""}`
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
if (runtime.platform === "darwin" && !/metal/i.test(summary)) {
|
|
439
|
+
throw new Error(
|
|
440
|
+
`[reap-browser] Chrome did not report an ANGLE Metal renderer: ${summary}`
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function rootChromePid(b) {
|
|
445
|
+
if (b && typeof b === "object") {
|
|
446
|
+
const discovered = discoveredChromePids.get(b);
|
|
447
|
+
if (discovered !== void 0) return discovered;
|
|
448
|
+
}
|
|
449
|
+
const w = b;
|
|
450
|
+
if (w && typeof w.process === "function") {
|
|
451
|
+
try {
|
|
452
|
+
const p = w.process();
|
|
453
|
+
if (p && typeof p.pid === "number" && p.pid > 0) return p.pid;
|
|
454
|
+
} catch {
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (w && typeof w.browser === "function") {
|
|
458
|
+
try {
|
|
459
|
+
const child = w.browser();
|
|
460
|
+
if (child) return rootChromePid(child);
|
|
461
|
+
} catch {
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
function killTree(pid) {
|
|
467
|
+
let kids = [];
|
|
468
|
+
try {
|
|
469
|
+
kids = listProcessChildren([pid]);
|
|
470
|
+
} catch {
|
|
471
|
+
}
|
|
472
|
+
for (const k of kids) killTree(k);
|
|
473
|
+
try {
|
|
474
|
+
process.kill(pid, "SIGKILL");
|
|
475
|
+
} catch {
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
function killOwnedTree(tracked) {
|
|
479
|
+
if (tracked.readIdentity(tracked.pid) !== tracked.identity) return;
|
|
480
|
+
killTree(tracked.pid);
|
|
481
|
+
}
|
|
482
|
+
function trackReapPid(pid, readIdentity = processIdentity) {
|
|
483
|
+
const identity = readIdentity(pid);
|
|
484
|
+
if (identity === null) return null;
|
|
485
|
+
const current = reapPids.get(pid);
|
|
486
|
+
if (current?.identity === identity && current.readIdentity === readIdentity) {
|
|
487
|
+
return current;
|
|
488
|
+
}
|
|
489
|
+
const tracked = { pid, identity, readIdentity };
|
|
490
|
+
reapPids.set(pid, tracked);
|
|
491
|
+
installReaper();
|
|
492
|
+
return tracked;
|
|
493
|
+
}
|
|
494
|
+
function untrackReapPid(tracked) {
|
|
495
|
+
if (reapPids.get(tracked.pid) === tracked) reapPids.delete(tracked.pid);
|
|
496
|
+
}
|
|
497
|
+
function browserControl(b) {
|
|
498
|
+
const candidate = b;
|
|
499
|
+
if (!candidate || typeof candidate !== "object") return null;
|
|
500
|
+
if (typeof candidate.newBrowserCDPSession === "function" || typeof candidate.process === "function") {
|
|
501
|
+
return candidate;
|
|
502
|
+
}
|
|
503
|
+
if (typeof candidate.browser !== "function") return null;
|
|
504
|
+
try {
|
|
505
|
+
const browser = candidate.browser();
|
|
506
|
+
return browser ? browserControl(browser) : null;
|
|
507
|
+
} catch {
|
|
508
|
+
return null;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function registerChromePid(browser, control, pid, readIdentity = processIdentity) {
|
|
512
|
+
if (browser && typeof browser === "object") discoveredChromePids.set(browser, pid);
|
|
513
|
+
discoveredChromePids.set(control, pid);
|
|
514
|
+
const tracked = trackReapPid(pid, readIdentity);
|
|
515
|
+
if (tracked === null) return;
|
|
516
|
+
if (browser && typeof browser === "object") {
|
|
517
|
+
discoveredChromeProcesses.set(browser, tracked);
|
|
518
|
+
}
|
|
519
|
+
discoveredChromeProcesses.set(control, tracked);
|
|
520
|
+
}
|
|
521
|
+
async function discoverChromePid(browser) {
|
|
522
|
+
const known = rootChromePid(browser);
|
|
523
|
+
if (known !== null) return known;
|
|
524
|
+
const control = browserControl(browser);
|
|
525
|
+
if (!control || typeof control.newBrowserCDPSession !== "function") return null;
|
|
526
|
+
const session = await control.newBrowserCDPSession();
|
|
527
|
+
try {
|
|
528
|
+
const pid = browserProcessPid(await session.send("SystemInfo.getProcessInfo"));
|
|
529
|
+
if (pid === null) return null;
|
|
530
|
+
registerChromePid(browser, control, pid);
|
|
531
|
+
return pid;
|
|
532
|
+
} finally {
|
|
533
|
+
await session.detach?.();
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
async function rejectLaunchedBrowser(browser) {
|
|
537
|
+
const tracked = browser && typeof browser === "object" ? discoveredChromeProcesses.get(browser) : void 0;
|
|
538
|
+
if (tracked) {
|
|
539
|
+
killOwnedTree(tracked);
|
|
540
|
+
untrackReapPid(tracked);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
const candidate = browser;
|
|
544
|
+
if (candidate && typeof candidate.close === "function") {
|
|
545
|
+
try {
|
|
546
|
+
await candidate.close();
|
|
547
|
+
} catch {
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
async function validateLaunchedGpuBrowser(browser, runtime, rendererTarget, commandForPid = processCommand, readIdentity = processIdentity) {
|
|
552
|
+
if (softwareChromeAllowed(runtime)) return;
|
|
553
|
+
const root = rootChromePid(browser);
|
|
554
|
+
const launchedControl = browserControl(browser);
|
|
555
|
+
if (root !== null && launchedControl) {
|
|
556
|
+
registerChromePid(browser, launchedControl, root, readIdentity);
|
|
557
|
+
}
|
|
558
|
+
if (root !== null && (runtime.platform === "darwin" || runtime.platform === "linux")) {
|
|
559
|
+
assertGpuBrowserCommand(commandForPid(root), runtime);
|
|
560
|
+
}
|
|
561
|
+
const rendererBrowser = rendererTarget ? await rendererTarget(browser) : browser;
|
|
562
|
+
const control = browserControl(rendererBrowser);
|
|
563
|
+
if (control && typeof control.newBrowserCDPSession === "function") {
|
|
564
|
+
const session = await control.newBrowserCDPSession();
|
|
565
|
+
try {
|
|
566
|
+
const pid = browserProcessPid(await session.send("SystemInfo.getProcessInfo"));
|
|
567
|
+
if (pid === null) {
|
|
568
|
+
throw new Error("[reap-browser] Chrome did not report its browser process id");
|
|
569
|
+
}
|
|
570
|
+
registerChromePid(browser, control, pid, readIdentity);
|
|
571
|
+
if (rendererBrowser && typeof rendererBrowser === "object") {
|
|
572
|
+
discoveredChromePids.set(rendererBrowser, pid);
|
|
573
|
+
}
|
|
574
|
+
if (runtime.platform === "darwin" || runtime.platform === "linux") {
|
|
575
|
+
assertGpuBrowserCommand(commandForPid(pid), runtime);
|
|
576
|
+
}
|
|
577
|
+
assertGpuRendererInfo(await session.send("SystemInfo.getInfo"), runtime);
|
|
578
|
+
return;
|
|
579
|
+
} finally {
|
|
580
|
+
await session.detach?.();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
throw new Error("[reap-browser] could not validate the launched Chrome GPU renderer");
|
|
584
|
+
}
|
|
585
|
+
var signalShutdownClaimed = false;
|
|
586
|
+
function claimSignalShutdown() {
|
|
587
|
+
signalShutdownClaimed = true;
|
|
588
|
+
}
|
|
589
|
+
function installReaper() {
|
|
590
|
+
if (installed) return;
|
|
591
|
+
installed = true;
|
|
592
|
+
const reap = () => {
|
|
593
|
+
for (const tracked of reapPids.values()) killOwnedTree(tracked);
|
|
594
|
+
};
|
|
595
|
+
if (!signalShutdownClaimed) {
|
|
596
|
+
process.on("SIGTERM", () => {
|
|
597
|
+
reap();
|
|
598
|
+
process.exit(0);
|
|
599
|
+
});
|
|
600
|
+
process.on("SIGINT", () => {
|
|
601
|
+
reap();
|
|
602
|
+
process.exit(0);
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
process.on("exit", reap);
|
|
606
|
+
}
|
|
607
|
+
async function launchReapedScoped(launch, readIdentity = processIdentity, admission) {
|
|
608
|
+
const releaseAdmission = await (admission ? admission.acquire() : reserveChromiumAdmission());
|
|
609
|
+
let browser;
|
|
610
|
+
try {
|
|
611
|
+
admission?.signal.throwIfAborted();
|
|
612
|
+
browser = await launch();
|
|
613
|
+
if (admission?.signal.aborted) {
|
|
614
|
+
await rejectLaunchedBrowser(browser);
|
|
615
|
+
admission.signal.throwIfAborted();
|
|
616
|
+
}
|
|
617
|
+
} catch (err) {
|
|
618
|
+
releaseAdmission();
|
|
619
|
+
throw err;
|
|
620
|
+
}
|
|
621
|
+
const mine = /* @__PURE__ */ new Set();
|
|
622
|
+
let closed = false;
|
|
623
|
+
const reapNow = () => {
|
|
624
|
+
closed = true;
|
|
625
|
+
for (const tracked of mine) {
|
|
626
|
+
killOwnedTree(tracked);
|
|
627
|
+
untrackReapPid(tracked);
|
|
628
|
+
}
|
|
629
|
+
mine.clear();
|
|
630
|
+
admission?.signal.removeEventListener("abort", reapNow);
|
|
631
|
+
releaseAdmission();
|
|
632
|
+
};
|
|
633
|
+
const evented = browserControl(browser) ?? browser;
|
|
634
|
+
if (typeof evented.on === "function") {
|
|
635
|
+
const disconnectEvent = typeof evented.newBrowserCDPSession === "function" ? "disconnected" : "close";
|
|
636
|
+
evented.on(disconnectEvent, reapNow);
|
|
637
|
+
}
|
|
638
|
+
admission?.signal.addEventListener("abort", reapNow, { once: true });
|
|
639
|
+
if (admission?.signal.aborted) reapNow();
|
|
640
|
+
let root = rootChromePid(browser);
|
|
641
|
+
if (root === null && !closed) {
|
|
642
|
+
try {
|
|
643
|
+
root = await discoverChromePid(browser);
|
|
644
|
+
} catch {
|
|
645
|
+
root = null;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
if (root != null) {
|
|
649
|
+
const tracked = trackReapPid(root, readIdentity);
|
|
650
|
+
if (tracked !== null) mine.add(tracked);
|
|
651
|
+
}
|
|
652
|
+
if (closed) {
|
|
653
|
+
reapNow();
|
|
654
|
+
admission?.signal.throwIfAborted();
|
|
655
|
+
throw new Error("[reap-browser] browser disconnected during launch");
|
|
656
|
+
}
|
|
657
|
+
return { browser, reapNow };
|
|
658
|
+
}
|
|
659
|
+
async function launchReaped(launch, readIdentity = processIdentity, admission) {
|
|
660
|
+
const { browser } = await launchReapedScoped(launch, readIdentity, admission);
|
|
661
|
+
return browser;
|
|
662
|
+
}
|
|
663
|
+
function gpuChromeArgs(platform = process.platform) {
|
|
664
|
+
const angle = expectedAngle(platform);
|
|
665
|
+
return [
|
|
666
|
+
// sootsim's compositor renders through skia graphite on webgpu, so a launch
|
|
667
|
+
// without navigator.gpu cannot present a frame at all. chrome enables webgpu
|
|
668
|
+
// by default on gpu-backed macOS but not on every headless configuration,
|
|
669
|
+
// and every caller that renders a sim was passing this by hand. own it here
|
|
670
|
+
// so a launcher cannot silently come up without the only backend there is.
|
|
671
|
+
"--enable-unsafe-webgpu",
|
|
672
|
+
`--use-angle=${angle}`,
|
|
673
|
+
"--enable-gpu",
|
|
674
|
+
"--enable-gpu-rasterization",
|
|
675
|
+
"--enable-zero-copy",
|
|
676
|
+
"--ignore-gpu-blocklist"
|
|
677
|
+
];
|
|
678
|
+
}
|
|
679
|
+
var PLAYWRIGHT_DISABLED_FEATURES = [
|
|
680
|
+
"AimEnabled",
|
|
681
|
+
"AvoidUnnecessaryBeforeUnloadCheckSync",
|
|
682
|
+
"BlockOriginHeaderModificationOnRedirect",
|
|
683
|
+
"BoundaryEventDispatchTracksNodeRemoval",
|
|
684
|
+
"DestroyProfileOnBrowserClose",
|
|
685
|
+
"DialMediaRouteProvider",
|
|
686
|
+
"GlobalMediaControls",
|
|
687
|
+
"HttpsUpgrades",
|
|
688
|
+
"LensOverlay",
|
|
689
|
+
"MediaRouter",
|
|
690
|
+
"PaintHolding",
|
|
691
|
+
"ThirdPartyStoragePartitioning",
|
|
692
|
+
"Translate",
|
|
693
|
+
"AutoDeElevate",
|
|
694
|
+
"RenderDocument",
|
|
695
|
+
"OptimizationHints",
|
|
696
|
+
"msForceBrowserSignIn",
|
|
697
|
+
"msEdgeUpdateLaunchServicesPreferredVersion"
|
|
698
|
+
];
|
|
699
|
+
var PLAYWRIGHT_ENABLED_FEATURES = ["CDPScreenshotNewSurface"];
|
|
700
|
+
var DISABLED_FEATURES = ["NetworkTimeServiceQuerying", "LocalNetworkAccessChecks"];
|
|
701
|
+
function chromeDisabledFeaturesSwitch() {
|
|
702
|
+
return `--disable-features=${[.../* @__PURE__ */ new Set([...PLAYWRIGHT_DISABLED_FEATURES, ...DISABLED_FEATURES])].join(",")}`;
|
|
703
|
+
}
|
|
704
|
+
function mergeFeatureSwitches(args, enabled = []) {
|
|
705
|
+
const enable = /* @__PURE__ */ new Set([...PLAYWRIGHT_ENABLED_FEATURES, ...enabled]);
|
|
706
|
+
const disable = /* @__PURE__ */ new Set([...PLAYWRIGHT_DISABLED_FEATURES, ...DISABLED_FEATURES]);
|
|
707
|
+
const rest = [];
|
|
708
|
+
for (const arg of args) {
|
|
709
|
+
const match = /^--(enable|disable)-features=(.*)$/.exec(arg);
|
|
710
|
+
if (!match) {
|
|
711
|
+
rest.push(arg);
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
for (const feature of match[2].split(",")) {
|
|
715
|
+
if (feature) (match[1] === "enable" ? enable : disable).add(feature);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return [
|
|
719
|
+
...rest,
|
|
720
|
+
`--enable-features=${[...enable].join(",")}`,
|
|
721
|
+
`--disable-features=${[...disable].join(",")}`
|
|
722
|
+
];
|
|
723
|
+
}
|
|
724
|
+
function gpuChromeLaunchOptions(opts = {}, runtime = currentRuntime()) {
|
|
725
|
+
const callerArgs = Array.isArray(opts.args) ? opts.args : [];
|
|
726
|
+
const unsafe = callerArgs.find(isSoftwareRendererArgument);
|
|
727
|
+
if (unsafe !== void 0) {
|
|
728
|
+
throw new Error(
|
|
729
|
+
`[reap-browser] refused software-rendering Chrome launch argument ${String(unsafe)}`
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
if (opts.executablePath !== void 0) {
|
|
733
|
+
throw new Error(
|
|
734
|
+
"[reap-browser] executablePath bypasses Playwright Chrome for Testing and is not allowed"
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
if (opts.ignoreDefaultArgs === true) {
|
|
738
|
+
throw new Error(
|
|
739
|
+
"[reap-browser] ignoreDefaultArgs=true bypasses required Chrome launch defaults"
|
|
740
|
+
);
|
|
741
|
+
}
|
|
742
|
+
const managedGpuArgs = /* @__PURE__ */ new Set([
|
|
743
|
+
"--enable-unsafe-webgpu",
|
|
744
|
+
"--enable-gpu",
|
|
745
|
+
"--enable-gpu-rasterization",
|
|
746
|
+
"--enable-zero-copy",
|
|
747
|
+
"--ignore-gpu-blocklist"
|
|
748
|
+
]);
|
|
749
|
+
const unmanagedCallerArgs = callerArgs.filter((arg) => {
|
|
750
|
+
const value = String(arg);
|
|
751
|
+
return !managedGpuArgs.has(value) && !value.startsWith("--use-angle=");
|
|
752
|
+
});
|
|
753
|
+
const callerIgnored = Array.isArray(opts.ignoreDefaultArgs) ? opts.ignoreDefaultArgs : [];
|
|
754
|
+
const ignoredDefaults = [
|
|
755
|
+
.../* @__PURE__ */ new Set([...callerIgnored, "--disable-gpu", "--enable-unsafe-swiftshader"])
|
|
756
|
+
];
|
|
757
|
+
const env = runtime.platform === "linux" ? {
|
|
758
|
+
...opts.env ?? runtime.env,
|
|
759
|
+
...LINUX_CHROME_SCOPE_ENV
|
|
760
|
+
} : opts.env;
|
|
761
|
+
return {
|
|
762
|
+
...opts,
|
|
763
|
+
...env ? { env } : {},
|
|
764
|
+
// playwright's `chromium` channel is the full Google Chrome for Testing
|
|
765
|
+
// app, not chromium_headless_shell. on macOS it has bundle id
|
|
766
|
+
// com.google.chrome.for.testing, so automation cannot become the target of
|
|
767
|
+
// Dock open/quit events intended for the user's com.google.Chrome browser.
|
|
768
|
+
channel: "chromium",
|
|
769
|
+
args: mergeFeatureSwitches([
|
|
770
|
+
...unmanagedCallerArgs,
|
|
771
|
+
...gpuChromeArgs(runtime.platform)
|
|
772
|
+
]),
|
|
773
|
+
ignoreDefaultArgs: ignoredDefaults
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
var DEFAULT_LAUNCH_TIMEOUT_MS = 18e4;
|
|
777
|
+
async function launchWithPauseAwareDeadline(launch, opts) {
|
|
778
|
+
const budget = typeof opts.timeout === "number" ? opts.timeout : DEFAULT_LAUNCH_TIMEOUT_MS;
|
|
779
|
+
if (budget === 0) return launch(opts);
|
|
780
|
+
const marker = `--peach-launch-id=${(0, import_node_crypto.randomUUID)()}`;
|
|
781
|
+
let expired = false;
|
|
782
|
+
const cleanupAttempted = [];
|
|
783
|
+
const lookupFailed = [];
|
|
784
|
+
let sweepFailure;
|
|
785
|
+
const cancel = startLaunchDeadline(budget, () => {
|
|
786
|
+
expired = true;
|
|
787
|
+
let children = [];
|
|
788
|
+
try {
|
|
789
|
+
children = listProcessChildren([process.pid]);
|
|
790
|
+
} catch (err) {
|
|
791
|
+
sweepFailure = err instanceof Error ? err.message : String(err);
|
|
792
|
+
}
|
|
793
|
+
for (const pid of children) {
|
|
794
|
+
let marked;
|
|
795
|
+
try {
|
|
796
|
+
marked = processCommand(pid).includes(marker);
|
|
797
|
+
} catch {
|
|
798
|
+
lookupFailed.push(pid);
|
|
799
|
+
continue;
|
|
800
|
+
}
|
|
801
|
+
if (!marked) continue;
|
|
802
|
+
cleanupAttempted.push(pid);
|
|
803
|
+
killTree(pid);
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
try {
|
|
807
|
+
const args = Array.isArray(opts.args) ? opts.args : [];
|
|
808
|
+
return await launch({ ...opts, args: [...args, marker], timeout: 0 });
|
|
809
|
+
} catch (err) {
|
|
810
|
+
if (!expired) throw err;
|
|
811
|
+
const observed = [
|
|
812
|
+
sweepFailure ? `child listing failed: ${sweepFailure}` : cleanupAttempted.length > 0 ? `marked child pid(s) ${cleanupAttempted.join(", ")} observed, kill attempted (outcome not checked)` : lookupFailed.length > 0 ? "no marked child confirmed" : "no marked child observed",
|
|
813
|
+
lookupFailed.length > 0 ? `command lookup failed for pid(s) ${lookupFailed.join(", ")}, ownership unknown` : void 0
|
|
814
|
+
].filter(Boolean).join("; ");
|
|
815
|
+
throw new Error(
|
|
816
|
+
`[reap-browser] browser launch timed out after ${budget}ms; ${observed}`,
|
|
817
|
+
{ cause: err }
|
|
818
|
+
);
|
|
819
|
+
} finally {
|
|
820
|
+
cancel();
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
function platformChromeLaunch(launch, opts, rendererTarget, policy = {}) {
|
|
824
|
+
return async () => {
|
|
825
|
+
const runtime = policy.runtime ?? currentRuntime();
|
|
826
|
+
if (softwareChromeAllowed(runtime)) {
|
|
827
|
+
return launchWithPauseAwareDeadline(launch, chromeLaunchOptions(opts, runtime));
|
|
828
|
+
}
|
|
829
|
+
const gpuOptions = chromeLaunchOptions(opts, runtime);
|
|
830
|
+
let browser;
|
|
831
|
+
try {
|
|
832
|
+
browser = await launchWithPauseAwareDeadline(launch, gpuOptions);
|
|
833
|
+
} catch (err) {
|
|
834
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
835
|
+
const missing = /not found at|not installed|Chromium distribution|Executable doesn't exist|No such file/i.test(
|
|
836
|
+
msg
|
|
837
|
+
);
|
|
838
|
+
if (!missing) throw err;
|
|
839
|
+
throw new Error(
|
|
840
|
+
"[reap-browser] Playwright Chrome for Testing is required for local GPU browser work. Run `bun scripts/ops/install-playwright-browsers.ts chromium`.",
|
|
841
|
+
{ cause: err }
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
try {
|
|
845
|
+
await validateLaunchedGpuBrowser(
|
|
846
|
+
browser,
|
|
847
|
+
runtime,
|
|
848
|
+
rendererTarget,
|
|
849
|
+
policy.processCommand,
|
|
850
|
+
policy.processIdentity
|
|
851
|
+
);
|
|
852
|
+
} catch (err) {
|
|
853
|
+
await rejectLaunchedBrowser(browser);
|
|
854
|
+
throw err;
|
|
855
|
+
}
|
|
856
|
+
return browser;
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
function softwareChromeLaunchOptions(opts, runtime = currentRuntime()) {
|
|
860
|
+
if (opts.ignoreDefaultArgs === true) {
|
|
861
|
+
throw new Error(
|
|
862
|
+
"[reap-browser] ignoreDefaultArgs=true bypasses required Chrome launch defaults"
|
|
863
|
+
);
|
|
864
|
+
}
|
|
865
|
+
if (runtime.platform === "linux") {
|
|
866
|
+
const env = Object.assign(
|
|
867
|
+
{},
|
|
868
|
+
opts.env ?? runtime.env,
|
|
869
|
+
LINUX_CHROME_SCOPE_ENV
|
|
870
|
+
);
|
|
871
|
+
delete env.VK_DRIVER_FILES;
|
|
872
|
+
delete env.VK_ICD_FILENAMES;
|
|
873
|
+
opts = { ...opts, env };
|
|
874
|
+
}
|
|
875
|
+
const callerArgs = Array.isArray(opts.args) ? opts.args.map(String) : [];
|
|
876
|
+
if (runtime.platform === "linux" && runtime.env.PEACH_NATIVE_COMPOSITOR === "1") {
|
|
877
|
+
const native = {
|
|
878
|
+
...opts,
|
|
879
|
+
args: [...callerArgs, "--disable-gpu"]
|
|
880
|
+
};
|
|
881
|
+
delete native.channel;
|
|
882
|
+
delete native.executablePath;
|
|
883
|
+
return native;
|
|
884
|
+
}
|
|
885
|
+
const unmanagedCallerArgs = callerArgs.filter((arg) => {
|
|
886
|
+
return !arg.startsWith("--use-angle=") && arg !== "--enable-gpu" && arg !== "--enable-gpu-rasterization" && arg !== "--enable-zero-copy" && arg !== "--ignore-gpu-blocklist" && arg !== "--disable-gpu-watchdog" && arg !== "--enable-skia-graphite" && !/^--enable-unsafe-webgpu(?:=.*)?$/i.test(arg) && !/^--enable-unsafe-swiftshader(?:=.*)?$/i.test(arg);
|
|
887
|
+
});
|
|
888
|
+
const software = {
|
|
889
|
+
...opts,
|
|
890
|
+
// playwright's bundled software chromium exposes no navigator.gpu without
|
|
891
|
+
// --enable-unsafe-webgpu plus the Vulkan feature, and the compositor's only
|
|
892
|
+
// backend is webgpu. emitted here rather than per caller so a hosted-linux
|
|
893
|
+
// launch and a local gpu launch agree on what a sim needs.
|
|
894
|
+
args: mergeFeatureSwitches(
|
|
895
|
+
[
|
|
896
|
+
...unmanagedCallerArgs,
|
|
897
|
+
"--use-angle=swiftshader",
|
|
898
|
+
"--enable-unsafe-swiftshader",
|
|
899
|
+
"--enable-unsafe-webgpu",
|
|
900
|
+
// without Skia Graphite as chromium's own compositor, SwiftShader has no
|
|
901
|
+
// shared-image backing for a WebGPU canvas swap chain at any size: the
|
|
902
|
+
// first configured canvas fails "Could not find SharedImageBackingFactory"
|
|
903
|
+
// and chromium destroys the device mid-capture. compute-only WebGPU
|
|
904
|
+
// still works, so an adapter probe cannot see this.
|
|
905
|
+
"--enable-skia-graphite",
|
|
906
|
+
// the GPU watchdog kills the GPU process when a task outlives its
|
|
907
|
+
// timeout, and SwiftShader precompiling Graphite pipelines on two CPU
|
|
908
|
+
// cores can legitimately outlive it. the cost: a genuinely wedged GPU
|
|
909
|
+
// process now holds its job until the job's own timeout instead of
|
|
910
|
+
// dying fast.
|
|
911
|
+
"--disable-gpu-watchdog"
|
|
912
|
+
],
|
|
913
|
+
["Vulkan"]
|
|
914
|
+
)
|
|
915
|
+
};
|
|
916
|
+
delete software.channel;
|
|
917
|
+
delete software.executablePath;
|
|
918
|
+
return software;
|
|
919
|
+
}
|
|
920
|
+
function chromeLaunchOptions(opts = {}, runtime = currentRuntime()) {
|
|
921
|
+
if (signalShutdownClaimed) {
|
|
922
|
+
opts = { ...opts, handleSIGINT: false, handleSIGTERM: false, handleSIGHUP: false };
|
|
923
|
+
}
|
|
924
|
+
return softwareChromeAllowed(runtime) ? softwareChromeLaunchOptions(opts, runtime) : gpuChromeLaunchOptions(opts, runtime);
|
|
925
|
+
}
|
|
926
|
+
async function launchReapedChrome(launch, opts = {}, rendererTarget, policy = {}) {
|
|
927
|
+
return launchReaped(
|
|
928
|
+
platformChromeLaunch(launch, opts, rendererTarget, policy),
|
|
929
|
+
policy.processIdentity,
|
|
930
|
+
policy.admission
|
|
931
|
+
);
|
|
932
|
+
}
|
|
933
|
+
async function launchReapedChromeScoped(launch, opts = {}, rendererTarget, policy = {}) {
|
|
934
|
+
return launchReapedScoped(
|
|
935
|
+
platformChromeLaunch(launch, opts, rendererTarget, policy),
|
|
936
|
+
policy.processIdentity,
|
|
937
|
+
policy.admission
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
function reapSpawnedNow() {
|
|
941
|
+
for (const tracked of reapPids.values()) killOwnedTree(tracked);
|
|
942
|
+
reapPids.clear();
|
|
943
|
+
}
|
|
944
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
945
|
+
0 && (module.exports = {
|
|
946
|
+
LINUX_CHROME_SCOPE_ENV,
|
|
947
|
+
assertGpuBrowserCommand,
|
|
948
|
+
assertGpuRendererInfo,
|
|
949
|
+
chromeDisabledFeaturesSwitch,
|
|
950
|
+
chromeLaunchOptions,
|
|
951
|
+
claimSignalShutdown,
|
|
952
|
+
gpuChromeArgs,
|
|
953
|
+
gpuChromeLaunchOptions,
|
|
954
|
+
killTree,
|
|
955
|
+
launchReaped,
|
|
956
|
+
launchReapedChrome,
|
|
957
|
+
launchReapedChromeScoped,
|
|
958
|
+
launchReapedScoped,
|
|
959
|
+
launchWithPauseAwareDeadline,
|
|
960
|
+
reapSpawnedNow,
|
|
961
|
+
reserveChromiumAdmission,
|
|
962
|
+
softwareChromeAllowed,
|
|
963
|
+
softwareChromeLaunchOptions
|
|
964
|
+
});
|