peachsim 0.1.1808 → 0.1.1812
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 +4 -2
- package/cli/app-bundle-resources.ts +15 -2
- package/cli/cloud-box-artifact.ts +115 -0
- package/cli/cloud-client.ts +148 -76
- package/cli/cloud-dispatch.ts +4 -4
- package/cli/cloud-session.ts +60 -22
- package/cli/commands/box.ts +8 -2
- package/cli/commands/compat.ts +7 -4
- package/cli/commands/control.ts +69 -3
- package/cli/commands/coverage.ts +14 -4
- package/cli/commands/daemon.ts +41 -0
- package/cli/commands/no-bridge-hint.ts +9 -0
- package/cli/commands/package.ts +31 -56
- package/cli/commands/platform.ts +71 -60
- package/cli/commands/preview.ts +73 -24
- package/cli/commands/record.ts +10 -2
- package/cli/commands/screenshot.ts +17 -60
- package/cli/commands/setup.ts +3 -1
- package/cli/commands/three-mode.ts +22 -12
- package/cli/commands/upload.ts +2 -1
- package/cli/desktop-companion.ts +6 -1
- package/cli/drivers/desktop.ts +4 -1
- package/cli/main.ts +12 -2
- package/cli/metro-bundle-assets.ts +14 -4
- package/cli/outbound-endpoints.ts +7 -3
- package/cli/output-redaction.ts +38 -0
- package/cli/privacy.ts +2 -2
- package/cli/recording-access.ts +5 -0
- package/cli/remote-project-bundle.ts +83 -0
- package/cli/shell-init.ts +7 -11
- package/cli/telemetry.ts +41 -4
- package/cli/usage-error.ts +3 -0
- package/cli/ws-bridge.ts +42 -6
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +42897 -40755
- package/dist-lib/capture-contract.cjs +7 -8
- package/dist-lib/capture-contract.mjs +7 -8
- 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 +13 -7
- package/dist-lib/dev-bundle-resolution.cjs +10 -4
- package/dist-lib/expo-swift-bundle.cjs +15889 -15553
- package/dist-lib/expo-swift-metadata.cjs +2 -1
- package/dist-lib/expo-swift-metadata.mjs +2 -1
- package/dist-lib/home-paths.cjs +2 -33
- package/dist-lib/host/bridge-host.cjs +20891 -18714
- package/dist-lib/host/fetch-proxy-handler.cjs +10 -11
- 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 +620 -553
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +57 -28
- package/dist-lib/native-app-identity-project.cjs +47 -14
- package/dist-lib/native-app-identity-project.mjs +55 -20
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +27 -26
- package/dist-lib/public-origins-lib.json +104 -81
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +30700 -24410
- package/dist-lib/swift-compile.cjs +336 -222
- package/dist-lib/swift-compile.mjs +378 -263
- package/dist-lib/swift-package.cjs +19 -7
- package/dist-lib/swift-package.mjs +16 -6
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +49 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +19213 -18937
- package/dist-lib/vite.cjs +11 -12
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/animated.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/engine/animation-graph.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/expo-manifest.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/preview/upload-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +8 -1
- package/dist-types/packages/peach-globals/src/electronBridgeContract.d.ts +2 -1
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCall.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCallCenter.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCarrier.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriber.h +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriberInfo.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDictionary.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSExtensionItem.h +1 -1
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVFoundation+MPNowPlayingInfoLanguageOptionAdditions.h +39 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/AVPlayerItem+MediaPlayerAdditions.h +26 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPContentItem.h +67 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPError.h +33 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaEntity.h +53 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItem.h +346 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItemCollection.h +42 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaLibrary.h +76 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPickerController.h +64 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlayback.h +47 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaPlaylist.h +82 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuery.h +120 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaQuerySection.h +26 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerController.h +444 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMoviePlayerViewController.h +43 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerApplicationController.h +47 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerController.h +147 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMusicPlayerQueueDescriptor.h +75 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoCenter.h +197 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingInfoLanguageOption.h +107 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPNowPlayingSession.h +89 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDataSource.h +59 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentDelegate.h +64 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManager.h +46 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPPlayableContentManagerContext.h +32 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommand.h +143 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandCenter.h +66 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteCommandEvent.h +128 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPRemoteControlTypes.h +27 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeSettings.h +20 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MPVolumeView.h +82 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.apinotes +74 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayer.h +40 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/MediaPlayerDefines.h +84 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Headers/NSUserActivity+MediaPlayerAdditions.h +20 -0
- package/sdk/ios/System/Library/Frameworks/MediaPlayer.framework/Modules/module.modulemap +5 -0
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityCustomRotor.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIAction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBackgroundConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIButtonConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuConfiguration.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIContextMenuInteraction.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDeferredMenuElement.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIMenu.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIPointerStyle.h +5 -5
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISlider.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISplitViewController.h +12 -50
- package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISplitViewControllerLayoutEnvironment.h +2 -8
- package/sdk/ios/System/Library/Frameworks/UIKitTypes.framework/Headers/UIKitTypes.h +62 -0
- package/sdk/ios/usr/include/dispatch.modulemap +22 -0
- package/sdk/ios/usr/include/module.modulemap +8 -3
- package/sdk/ios/usr/include/net/if.h +24 -0
- package/sdk/ios/usr/include/sys/time.h +1 -1
- package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +265 -0
- package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
- package/sdk/ios/wasm/include/fcntl.h +2 -0
- package/sdk/ios/wasm/include/pthread.h +3 -0
- package/sdk/ios/wasm/include/stdlib.h +2 -0
- package/sdk/ios/wasm/include/unistd.h +2 -2
- package/skills/contrast/SKILL.md +2 -2
- package/src/bundle-channel.mjs +9 -72
- package/src/capture-contract.ts +12 -9
- package/src/desktop-host-delivery.ts +16 -2
- package/src/dev-bundle-resolution.ts +12 -3
- package/src/expo-native-workspace.ts +113 -46
- package/src/expo-swift-host.ts +17 -12
- package/src/expo-swift-ready.ts +4 -1
- package/src/expoSwiftContract.ts +1 -0
- package/src/home-paths.ts +4 -48
- package/src/host/bridge-host.ts +1 -0
- package/src/installed-native-libraries.ts +2 -8
- package/src/metro-project-root.ts +2 -1
- package/src/native-bundles.ts +122 -0
- package/src/native-static-libraries.ts +65 -8
- package/src/nitro-adapter.lock.json +272 -272
- package/src/nitro-bundle.ts +2 -2
- package/src/nitro-compile.ts +68 -28
- package/src/nitro-source.ts +24 -6
- package/src/nitro-superset.lock.json +94 -34
- package/src/nitroContract.ts +3 -0
- package/src/podspec-sources.ts +1966 -0
- package/src/storageSnapshotContract.ts +40 -0
- package/src/swift-compile.ts +77 -26
- package/src/swift-design-time.ts +18 -1
- package/src/swift-distribution.lock.json +12 -12
- package/src/swift-distribution.ts +9 -6
- package/src/swift-host.ts +1 -2
- package/src/swift-link-roots.ts +13 -2
- package/src/swift-objc-compile.ts +12 -0
- package/src/swift-objc-standin.ts +321 -114
- package/src/swift-package-manifest.ts +4 -3
- package/src/swift-package.ts +31 -4
- package/src/swift-root-lock.ts +11 -0
- package/src/swift-shared-sdk.ts +10 -9
- package/src/swift-source-pods.ts +2 -2
- package/src/swift-standins.ts +40 -143
- package/src/swift-toolchain.ts +59 -0
- package/src/swift-wasm-prune.ts +53 -21
- package/src/turbo-bundle.ts +4 -5
- package/src/turbo-codegen-intake.ts +111 -108
- package/src/turbo-compile.ts +63 -33
- package/src/turbo-runtime.lock.json +22 -22
- package/src/turbo-source.ts +171 -76
- package/src/wasm-optimize.ts +31 -2
- package/src/xcode-project.ts +65 -15
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
THREE_MODE_SETTING_IDS,
|
|
13
13
|
} from '../../src/screenshots/screenshotContract.ts'
|
|
14
14
|
import { peachExit } from '../run-rnx'
|
|
15
|
+
import { CliUsageError } from '../usage-error'
|
|
15
16
|
import {
|
|
16
17
|
callInBridgeWrite,
|
|
17
18
|
createBridgeFromParsed,
|
|
@@ -250,7 +251,7 @@ export async function waitForThreeModeRuntimeReadyOnBridge(bridge: WsBridge) {
|
|
|
250
251
|
|
|
251
252
|
if (state?.ready === true) return state
|
|
252
253
|
if (state?.disabled) {
|
|
253
|
-
throw new
|
|
254
|
+
throw new CliUsageError('3d mode is off; run `peach mode three on` before configure')
|
|
254
255
|
}
|
|
255
256
|
throw new Error('3d mode runtime did not become ready')
|
|
256
257
|
}
|
|
@@ -330,7 +331,9 @@ function readNumberFlag(args: string[], flag: string, fallback: number, minimum
|
|
|
330
331
|
if (raw === undefined) return fallback
|
|
331
332
|
const value = Number.parseFloat(raw)
|
|
332
333
|
if (!Number.isFinite(value) || value < minimum) {
|
|
333
|
-
throw new
|
|
334
|
+
throw new CliUsageError(
|
|
335
|
+
`${flag} expects a number greater than or equal to ${minimum}`,
|
|
336
|
+
)
|
|
334
337
|
}
|
|
335
338
|
return value
|
|
336
339
|
}
|
|
@@ -518,7 +521,8 @@ async function runThreeModeTimelineAction(
|
|
|
518
521
|
if (action === 'seek') {
|
|
519
522
|
const rawTime = parsed.positional[1]
|
|
520
523
|
const timeMs = rawTime === undefined ? Number.NaN : Number.parseFloat(rawTime)
|
|
521
|
-
if (!Number.isFinite(timeMs))
|
|
524
|
+
if (!Number.isFinite(timeMs))
|
|
525
|
+
throw new CliUsageError('three-mode seek expects time in ms')
|
|
522
526
|
const sample = await callInBridgeWrite<TimelineSampleResult>(
|
|
523
527
|
bridge,
|
|
524
528
|
'SootSim.bridges.threeMode.seek',
|
|
@@ -543,7 +547,7 @@ async function runThreeModeTimelineAction(
|
|
|
543
547
|
|
|
544
548
|
const timelinePath = parsed.positional[1]
|
|
545
549
|
if (!timelinePath)
|
|
546
|
-
throw new
|
|
550
|
+
throw new CliUsageError(`three-mode ${action} expects a timeline JSON path`)
|
|
547
551
|
const loadedFile = readTimelineFile(timelinePath)
|
|
548
552
|
const timeline = await uploadTimelineAssets(
|
|
549
553
|
bridge,
|
|
@@ -572,7 +576,9 @@ async function runThreeModeTimelineAction(
|
|
|
572
576
|
const times = atValue.split(',').map((token) => {
|
|
573
577
|
const value = Number.parseFloat(token)
|
|
574
578
|
if (!Number.isFinite(value) || value < 0) {
|
|
575
|
-
throw new
|
|
579
|
+
throw new CliUsageError(
|
|
580
|
+
`--at expects comma-separated times in ms, got "${token}"`,
|
|
581
|
+
)
|
|
576
582
|
}
|
|
577
583
|
return Math.min(value, loaded.durationMs)
|
|
578
584
|
})
|
|
@@ -607,7 +613,7 @@ async function runThreeModeTimelineAction(
|
|
|
607
613
|
if (countValue === undefined) {
|
|
608
614
|
const to = readNumberFlag(args, '--to', loaded.durationMs, 0)
|
|
609
615
|
if (to <= from || to > loaded.durationMs) {
|
|
610
|
-
throw new
|
|
616
|
+
throw new CliUsageError(
|
|
611
617
|
`--to must be greater than --from and at most ${loaded.durationMs}`,
|
|
612
618
|
)
|
|
613
619
|
}
|
|
@@ -638,7 +644,7 @@ async function runThreeModeTimelineAction(
|
|
|
638
644
|
}
|
|
639
645
|
|
|
640
646
|
const outputValue = readFlagValue(args, '--output')
|
|
641
|
-
if (!outputValue) throw new
|
|
647
|
+
if (!outputValue) throw new CliUsageError('three-mode render requires --output <dir>')
|
|
642
648
|
const outputDirectory = resolve(outputValue)
|
|
643
649
|
const fps = readNumberFlag(args, '--fps', 30, 0.001)
|
|
644
650
|
const width = Math.round(readNumberFlag(args, '--width', 1_920, 1))
|
|
@@ -646,7 +652,9 @@ async function runThreeModeTimelineAction(
|
|
|
646
652
|
const from = readNumberFlag(args, '--from', 0, 0)
|
|
647
653
|
const to = readNumberFlag(args, '--to', loaded.durationMs, 0)
|
|
648
654
|
if (to <= from || to > loaded.durationMs) {
|
|
649
|
-
throw new
|
|
655
|
+
throw new CliUsageError(
|
|
656
|
+
`--to must be greater than --from and at most ${loaded.durationMs}`,
|
|
657
|
+
)
|
|
650
658
|
}
|
|
651
659
|
const frameDurationMs = 1_000 / fps
|
|
652
660
|
const frameCount = Math.ceil((to - from) / frameDurationMs)
|
|
@@ -655,7 +663,7 @@ async function runThreeModeTimelineAction(
|
|
|
655
663
|
(name) => /^frame-\d{5}\.png$/.test(name) || name === 'timeline-render.json',
|
|
656
664
|
)
|
|
657
665
|
if (ownedOutputs.length > 0 && !args.includes('--overwrite')) {
|
|
658
|
-
throw new
|
|
666
|
+
throw new CliUsageError(
|
|
659
667
|
`${outputDirectory} already has timeline frames; pass --overwrite to replace them`,
|
|
660
668
|
)
|
|
661
669
|
}
|
|
@@ -782,7 +790,7 @@ export function buildConfigureOptions(args: string[]): ThreeModeConfig {
|
|
|
782
790
|
const angleStr = value('--gradient-angle')
|
|
783
791
|
const angleDeg = angleStr === undefined ? undefined : Number.parseFloat(angleStr)
|
|
784
792
|
if (angleStr !== undefined && !Number.isFinite(angleDeg)) {
|
|
785
|
-
throw new
|
|
793
|
+
throw new CliUsageError(`--gradient-angle expects a number, got "${angleStr}"`)
|
|
786
794
|
}
|
|
787
795
|
options.customGradient = { stops, ...(angleDeg !== undefined ? { angleDeg } : {}) }
|
|
788
796
|
}
|
|
@@ -847,7 +855,9 @@ export function buildConfigureOptions(args: string[]): ThreeModeConfig {
|
|
|
847
855
|
const progressValue = value('--progress')
|
|
848
856
|
const progress = progressValue === undefined ? 1 : Number.parseFloat(progressValue)
|
|
849
857
|
if (!Number.isFinite(progress)) {
|
|
850
|
-
throw new
|
|
858
|
+
throw new CliUsageError(
|
|
859
|
+
`--progress expects a number from 0 to 1, got "${progressValue}"`,
|
|
860
|
+
)
|
|
851
861
|
}
|
|
852
862
|
options.script = {
|
|
853
863
|
id: scriptId,
|
|
@@ -865,7 +875,7 @@ function parseBooleanValue(value: string | undefined, flag: string): boolean | u
|
|
|
865
875
|
const normalized = value.toLowerCase()
|
|
866
876
|
if (['on', 'true', 'yes', '1'].includes(normalized)) return true
|
|
867
877
|
if (['off', 'false', 'no', '0'].includes(normalized)) return false
|
|
868
|
-
throw new
|
|
878
|
+
throw new CliUsageError(`${flag} expects on or off, got "${value}"`)
|
|
869
879
|
}
|
|
870
880
|
|
|
871
881
|
function summarizeState(state: Record<string, unknown>) {
|
package/cli/commands/upload.ts
CHANGED
|
@@ -1310,9 +1310,10 @@ export async function runUpload(
|
|
|
1310
1310
|
peachExit(1, message)
|
|
1311
1311
|
}
|
|
1312
1312
|
|
|
1313
|
-
const previewUrl = `${getCliRuntime().preview_presigned_upload.canonicalPublicPreviewOrigin(publicOrigin)}${finalize.
|
|
1313
|
+
const previewUrl = `${getCliRuntime().preview_presigned_upload.canonicalPublicPreviewOrigin(publicOrigin)}${finalize.shortUrl}`
|
|
1314
1314
|
console.log(`\n stored ${finalize.filesStored ?? 0} extra files`)
|
|
1315
1315
|
console.log(` preview: ${previewUrl}`)
|
|
1316
|
+
console.log(` preview id: ${finalize.id}`)
|
|
1316
1317
|
|
|
1317
1318
|
if (openResult) {
|
|
1318
1319
|
await openUrl(previewUrl)
|
package/cli/desktop-companion.ts
CHANGED
|
@@ -225,7 +225,9 @@ export function getNativeDesktopAppPath(): string | null {
|
|
|
225
225
|
? existsSync('/usr/bin/peach-desktop')
|
|
226
226
|
? '/usr/bin/peach-desktop'
|
|
227
227
|
: null
|
|
228
|
-
:
|
|
228
|
+
: desktopHostPlatform()
|
|
229
|
+
? activeDesktopHostApp()
|
|
230
|
+
: null
|
|
229
231
|
return resolve(explicitApp)
|
|
230
232
|
}
|
|
231
233
|
|
|
@@ -453,6 +455,9 @@ export async function launchDesktopCompanion(
|
|
|
453
455
|
install.path,
|
|
454
456
|
'--env',
|
|
455
457
|
`PEACH_HOME=${opts.bridgePort && launchUrl ? macDesktopLaunchHome(opts.bridgePort) : rnxHomeDir()}`,
|
|
458
|
+
// bridge-specific launch homes must still share the caller's account session.
|
|
459
|
+
'--env',
|
|
460
|
+
`PEACH_AUTH_HOME=${rnxHomeDir()}`,
|
|
456
461
|
]
|
|
457
462
|
if (opts.bridgePort) {
|
|
458
463
|
openArgs.push('--env', `PEACH_BRIDGE_PORT=${opts.bridgePort}`)
|
package/cli/drivers/desktop.ts
CHANGED
|
@@ -16,7 +16,10 @@ import type {
|
|
|
16
16
|
|
|
17
17
|
export function createDesktopDriver(id: 'desktop' | 'electron'): Driver {
|
|
18
18
|
const native = wantsNativeDesktop()
|
|
19
|
-
const missing =
|
|
19
|
+
const missing =
|
|
20
|
+
process.platform === 'darwin' && !desktopHostPlatform()
|
|
21
|
+
? 'the Peach desktop app needs Apple silicon on macOS 26 or later; open the simulator with --driver playwright --headed'
|
|
22
|
+
: `peach ${id} app not installed (run \`peach desktop install${native ? '' : ' --electron'}\`)`
|
|
20
23
|
function probe(): DriverAvailability {
|
|
21
24
|
const install = findDesktopCompanion({ native })
|
|
22
25
|
if (!install) {
|
package/cli/main.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { COMMANDS, parseArgs, TOP_LEVEL_RUNTIME_COMMANDS } from './parse-args'
|
|
|
12
12
|
import { PeachExit } from './run-rnx'
|
|
13
13
|
import { rnxSelfInvocation } from './self-invocation'
|
|
14
14
|
import { IS_STANDALONE } from './standalone'
|
|
15
|
+
import { CliUsageError } from './usage-error'
|
|
15
16
|
|
|
16
17
|
// bun's console has its own sink; use the streams our exit boundary drains.
|
|
17
18
|
Object.assign(console, new Console(process.stdout, process.stderr))
|
|
@@ -43,6 +44,7 @@ async function handleTopLevelError(err: unknown): Promise<never> {
|
|
|
43
44
|
// peach's known top-level errors are all single-line, narrow strings.
|
|
44
45
|
// everything else gets the full stack so unexpected crashes still surface.
|
|
45
46
|
const isKnownCliFailure =
|
|
47
|
+
err instanceof CliUsageError ||
|
|
46
48
|
/^command timed out after \d+(?:\.\d+)?s$/.test(msg) ||
|
|
47
49
|
/^cannot hand off bridge on port \d+: pid \d+ is not this Peach invocation$/.test(
|
|
48
50
|
msg,
|
|
@@ -52,6 +54,12 @@ async function handleTopLevelError(err: unknown): Promise<never> {
|
|
|
52
54
|
msg.startsWith('multiple sims are connected:') ||
|
|
53
55
|
msg.startsWith('saved sim ') ||
|
|
54
56
|
msg.startsWith('no sim connected with id ') ||
|
|
57
|
+
msg === 'no sim connected' ||
|
|
58
|
+
msg === 'sim disconnected before responding' ||
|
|
59
|
+
msg.startsWith('no live peach world holds sim ') ||
|
|
60
|
+
msg.startsWith('the last `peach open` did not pin a sim') ||
|
|
61
|
+
msg.startsWith('app not ready to capture after ') ||
|
|
62
|
+
(err instanceof Error && 'code' in err && err.code === 'EPIPE') ||
|
|
55
63
|
msg.startsWith('could not connect to ws://') ||
|
|
56
64
|
msg.startsWith('peach bridge daemon is not running') ||
|
|
57
65
|
msg.startsWith('peach bridge lockfile is fresh') ||
|
|
@@ -65,7 +73,9 @@ async function handleTopLevelError(err: unknown): Promise<never> {
|
|
|
65
73
|
`package.json already defines scripts.${rnxPublicBrand.commandName} as `,
|
|
66
74
|
) ||
|
|
67
75
|
msg.startsWith('could not resolve a native bundle for ') ||
|
|
68
|
-
msg.startsWith('could not load ')
|
|
76
|
+
msg.startsWith('could not load ') ||
|
|
77
|
+
msg.includes('the connected sim runs an older runtime than this CLI') ||
|
|
78
|
+
/^remote simulator request failed \(403\): \w+ requires the debug scope/.test(msg)
|
|
69
79
|
if (isKnownCliFailure && !process.env.SOOTSIM_VERBOSE) {
|
|
70
80
|
process.stderr.write(` ${msg}\n`)
|
|
71
81
|
await exitWithFlushedOutput(1)
|
|
@@ -650,7 +660,7 @@ try {
|
|
|
650
660
|
await exitWithFlush(await runRemoteStop(parsed.commandArgs.slice(1)))
|
|
651
661
|
} else {
|
|
652
662
|
console.error(
|
|
653
|
-
` usage: ${rnxPublicBrand.commandName} remote ios|android <bundle.js|https://bundle-url>`,
|
|
663
|
+
` usage: ${rnxPublicBrand.commandName} remote ios|android <app-dir|bundle.js|https://bundle-url>`,
|
|
654
664
|
)
|
|
655
665
|
await exitWithFlush(1)
|
|
656
666
|
}
|
|
@@ -28,19 +28,29 @@ export async function stageMetroBundleAssets(
|
|
|
28
28
|
const staged: { url: string; bytes: Uint8Array }[] = []
|
|
29
29
|
descriptors.forEach((descriptor, index) => {
|
|
30
30
|
const placement = search.dest?.placements[index]
|
|
31
|
-
|
|
31
|
+
const hashes = descriptor.fileHashes
|
|
32
|
+
// an iOS dest holds only @1x..@3x of a descriptor that declares more, which
|
|
33
|
+
// only a per-file md5 can verify; the app never requests the other scales.
|
|
34
|
+
const perFile =
|
|
35
|
+
!!hashes && !descriptor.fileUris && hashes.length === descriptor.scales.length
|
|
36
|
+
if (
|
|
37
|
+
!placement ||
|
|
38
|
+
placement.mismatched ||
|
|
39
|
+
!(placement.verified || (perFile && placement.files.size > 0))
|
|
40
|
+
)
|
|
32
41
|
throw new Error(
|
|
33
42
|
`could not verify Metro asset ${descriptor.name}.${descriptor.type}`,
|
|
34
43
|
)
|
|
35
|
-
const scales = [...new Set(descriptor.scales)]
|
|
44
|
+
const scales = [...new Set(descriptor.scales)].filter((scale) =>
|
|
45
|
+
placement.files.has(scale),
|
|
46
|
+
)
|
|
36
47
|
const bytes = scales.map((scale) => {
|
|
37
48
|
const relative = placement.files.get(scale)
|
|
38
49
|
if (!relative || !search.dest) throw new Error('Metro asset scale is missing')
|
|
39
50
|
return fs.readFileSync(path.join(search.dest.directory, relative))
|
|
40
51
|
})
|
|
41
|
-
const hashes = descriptor.fileHashes
|
|
42
52
|
const verified =
|
|
43
|
-
|
|
53
|
+
perFile && hashes
|
|
44
54
|
? bytes.every((content, i) => {
|
|
45
55
|
const hash = createHash('md5').update(content).digest('hex')
|
|
46
56
|
return descriptor.scales.some(
|
|
@@ -61,7 +61,7 @@ export const OUTBOUND_ENDPOINTS: Record<string, OutboundEndpointDeclaration> = {
|
|
|
61
61
|
destination: 'configured product API origin, /api/sootsim/report-issue',
|
|
62
62
|
preConsent: true,
|
|
63
63
|
payload:
|
|
64
|
-
'an unexpected CLI crash: error class, bounded
|
|
64
|
+
'an unexpected CLI crash: error class, bounded redacted first-line message and subprocess output tail or top stack frames, command name, CLI/runtime versions, OS/arch and a dedupe signature, at most once a day per signature; on until `peach config telemetry off` or DO_NOT_TRACK',
|
|
65
65
|
},
|
|
66
66
|
app_crash_report: {
|
|
67
67
|
category: 'bounded-diagnostics',
|
|
@@ -340,6 +340,10 @@ export const DECLARED_OUTBOUND_CALLS: Record<string, OutboundCallDeclaration> =
|
|
|
340
340
|
// empty, so the request carries no project or app data.
|
|
341
341
|
'packages/peachsim/cli/cloud-client.ts :: fetch :: `${options.apiOrigin}/v1/boxes/${encodeURIComponent()}/display-grant`':
|
|
342
342
|
{ category: 'peach_cloud_sim', count: 1 },
|
|
343
|
+
// the watch url the grant built is shortened into a peachsim.com link that
|
|
344
|
+
// expires with the grant; the body is that url and nothing else.
|
|
345
|
+
'packages/peachsim/cli/cloud-client.ts :: fetch :: `${options.apiOrigin}/api/v1/watch-links`':
|
|
346
|
+
{ category: 'peach_cloud_sim', count: 1 },
|
|
343
347
|
// a fresh box's boot receipts are read until its page loads or reports an
|
|
344
348
|
// error; the request carries no body.
|
|
345
349
|
'packages/peachsim/cli/cloud-client.ts :: fetch :: `${options.apiOrigin}/v1/boxes/${encodeURIComponent()}/lifecycle`':
|
|
@@ -766,7 +770,7 @@ export const DECLARED_OUTBOUND_CALLS: Record<string, OutboundCallDeclaration> =
|
|
|
766
770
|
'packages/peachsim/cli/commands/control.ts :: fetch :: `http://127.0.0.1:${port}/healthz`':
|
|
767
771
|
{
|
|
768
772
|
category: 'local_development',
|
|
769
|
-
count:
|
|
773
|
+
count: 2,
|
|
770
774
|
},
|
|
771
775
|
'packages/peachsim/cli/commands/control.ts :: net.connect :: port': {
|
|
772
776
|
category: 'local_development',
|
|
@@ -930,7 +934,7 @@ export const DECLARED_OUTBOUND_CALLS: Record<string, OutboundCallDeclaration> =
|
|
|
930
934
|
},
|
|
931
935
|
'packages/peach-engine/src/render-worker/native-resource-demand-host.ts :: fetch :: url':
|
|
932
936
|
{ category: 'same_origin_runtime', count: 1 },
|
|
933
|
-
"packages/peach-engine/src/render-worker/site-
|
|
937
|
+
"packages/peach-engine/src/render-worker/site-report.ts :: fetch :: `${posthogHost.replace(/\\/+$/, '')}/capture/`":
|
|
934
938
|
{ category: 'unlisted_site_report', count: 1 },
|
|
935
939
|
'packages/peach-engine/src/render-worker/video-thumbnail-host.ts :: fetch :: uri': {
|
|
936
940
|
category: 'guest_app_network',
|
package/cli/output-redaction.ts
CHANGED
|
@@ -130,6 +130,44 @@ export function redactForSharing(text: string): string {
|
|
|
130
130
|
return redactText(text, false)
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
// a private key block is removed whole: from its begin line to its end line, to
|
|
134
|
+
// the end of the text when the end line is missing, and from the start of the
|
|
135
|
+
// text when only the end line is present. run on the full text before any
|
|
136
|
+
// bounded cut, so a cut cannot leave key body lines without their markers.
|
|
137
|
+
export function redactPrivateKeys(text: string): string {
|
|
138
|
+
return text
|
|
139
|
+
.replace(
|
|
140
|
+
/-----BEGIN [A-Z0-9 ]*PRIVATE KEY[A-Z0-9 ]*-----[\s\S]*?(?:-----END [A-Z0-9 ]*PRIVATE KEY[A-Z0-9 ]*-----|$)/g,
|
|
141
|
+
'<private-key>',
|
|
142
|
+
)
|
|
143
|
+
.replace(/^[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY[A-Z0-9 ]*-----/, '<private-key>')
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// crash reports can include compiler output and stacks, so remove locations and
|
|
147
|
+
// environment values as well as the secrets masked in shared CLI output.
|
|
148
|
+
export function redactCrashDetail(text: string): string {
|
|
149
|
+
text = redactPrivateKeys(text)
|
|
150
|
+
.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, '')
|
|
151
|
+
.replace(/\b[a-z][a-z\d+.-]*:\/\/[^\s"'<>]+/gi, '<url>')
|
|
152
|
+
for (const value of Object.values(process.env)) {
|
|
153
|
+
if (value && value.length >= 4) text = text.split(value).join('<env>')
|
|
154
|
+
}
|
|
155
|
+
return redactForSharing(text)
|
|
156
|
+
.replace(/\b(?:export\s+)?[A-Z_][A-Z0-9_]*=(?:"[^"]*"|'[^']*'|[^\s]+)/g, '<env>')
|
|
157
|
+
.replace(
|
|
158
|
+
/\b[\w-]*(?:token|secret|password|api[-_]?key|credential)[\w-]*\s*=\s*(?:"[^"]*"|'[^']*'|[^\s]+)/gi,
|
|
159
|
+
'<secret>',
|
|
160
|
+
)
|
|
161
|
+
.replace(
|
|
162
|
+
/--[\w-]*(?:token|secret|password|api[-_]?key|credential)[\w-]*(?:=|\s+)(?:"[^"]*"|'[^']*'|[^\s]+)/gi,
|
|
163
|
+
'<secret>',
|
|
164
|
+
)
|
|
165
|
+
.replace(
|
|
166
|
+
/(?:[A-Za-z]:[\\/]|~[\w.-]*[\\/]|\\\\|\/)(?:[^\s"'<>:]|\s(?=[^"'<>\n]*[\\/]))+/g,
|
|
167
|
+
'<path>',
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
133
171
|
// an encoded value whose decoding is encoded again is unwrapped one level at
|
|
134
172
|
// a time, so each level's document is redacted at its own escaping.
|
|
135
173
|
function redactEncoded(value: string, configurationOnly: boolean): string {
|
package/cli/privacy.ts
CHANGED
|
@@ -37,8 +37,8 @@ export function crashReportsAllowedForCurrentProcess(
|
|
|
37
37
|
// what is sent, without claiming whether it is on: `peach config telemetry
|
|
38
38
|
// status` prints this under the stored state, which may be off.
|
|
39
39
|
export const PRIVACY_CONTENTS = [
|
|
40
|
-
'Anonymous diagnostics and crash reports send CLI/runtime versions, OS/arch, command name and exit code, a random install ID, package incompatibilities, and
|
|
41
|
-
'
|
|
40
|
+
'Anonymous diagnostics and crash reports send CLI/runtime versions, OS/arch, command name and exit code, a random install ID, package incompatibilities, and a redacted first-line error message.',
|
|
41
|
+
'Crash reports also include a short output tail or stack, with paths, URLs, known secrets and environment assignments redacted. Output can contain other app text.',
|
|
42
42
|
]
|
|
43
43
|
|
|
44
44
|
// shown before the choice is recorded, when both are on by default.
|
package/cli/recording-access.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { authHeaderValue, resolveCliAuth, type CliAuth } from './auth'
|
|
|
3
3
|
import { resolveDefaultUploadOrigin } from './commands/upload'
|
|
4
4
|
import { peachExit } from './run-rnx'
|
|
5
5
|
|
|
6
|
+
// printed after an upload the server stored private (api-key uploads start
|
|
7
|
+
// private), so a copied link is not mistaken for a shareable one.
|
|
8
|
+
export const PRIVATE_PREVIEW_NOTE =
|
|
9
|
+
" private: only signed-in members of your account can open it; turn on Public link in the page's share menu to share it"
|
|
10
|
+
|
|
6
11
|
type BillingSubscriptionSnapshot = {
|
|
7
12
|
entitlements?: {
|
|
8
13
|
desktopRecording?: boolean
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
4
|
+
import { dirname, join } from 'node:path'
|
|
5
|
+
import { readInstalledNativePackageVersionsAsync } from '../src/installed-package-versions'
|
|
6
|
+
import {
|
|
7
|
+
insertPackageVersionsFooter,
|
|
8
|
+
readPackageVersionsFooter,
|
|
9
|
+
} from '../src/packageVersionsContract'
|
|
10
|
+
import { detectProject } from './commands/detect'
|
|
11
|
+
import type { RemotePlatform } from './cloud-session'
|
|
12
|
+
|
|
13
|
+
// builds an app folder with its own bundler, the way the app's release build
|
|
14
|
+
// does, into `outDir/main.js` with Metro's assets beside it. the bundle is a
|
|
15
|
+
// development build: its module names are the module graph Peach maps native
|
|
16
|
+
// seams by, so the app needs no Metro plugin. returns the bundle path.
|
|
17
|
+
export async function buildRemoteProjectBundle(
|
|
18
|
+
projectRoot: string,
|
|
19
|
+
platform: RemotePlatform,
|
|
20
|
+
outDir: string,
|
|
21
|
+
): Promise<string> {
|
|
22
|
+
const project = detectProject(projectRoot)
|
|
23
|
+
if (!project || project.framework === 'one')
|
|
24
|
+
throw new Error(
|
|
25
|
+
`${projectRoot} is not an Expo or React Native app; build its bundle and pass the bundle file`,
|
|
26
|
+
)
|
|
27
|
+
const resolveIn = createRequire(join(projectRoot, 'package.json')).resolve
|
|
28
|
+
const bundleOutput = join(outDir, 'main.js')
|
|
29
|
+
const options = [
|
|
30
|
+
'--platform',
|
|
31
|
+
platform,
|
|
32
|
+
'--dev',
|
|
33
|
+
'true',
|
|
34
|
+
'--minify',
|
|
35
|
+
'false',
|
|
36
|
+
'--bundle-output',
|
|
37
|
+
bundleOutput,
|
|
38
|
+
'--assets-dest',
|
|
39
|
+
outDir,
|
|
40
|
+
]
|
|
41
|
+
const command =
|
|
42
|
+
project.framework === 'expo'
|
|
43
|
+
? [
|
|
44
|
+
join(dirname(resolveIn('expo/package.json')), 'bin/cli'),
|
|
45
|
+
'export:embed',
|
|
46
|
+
...options,
|
|
47
|
+
]
|
|
48
|
+
: [
|
|
49
|
+
join(dirname(resolveIn('react-native/package.json')), 'cli.js'),
|
|
50
|
+
'bundle',
|
|
51
|
+
'--entry-file',
|
|
52
|
+
'index.js',
|
|
53
|
+
...options,
|
|
54
|
+
]
|
|
55
|
+
console.log(` building ${projectRoot} for ${platform}`)
|
|
56
|
+
const output: Buffer[] = []
|
|
57
|
+
const code = await new Promise<number | null>((resolveExit, reject) => {
|
|
58
|
+
const child = spawn('node', command, {
|
|
59
|
+
cwd: projectRoot,
|
|
60
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
61
|
+
env: { ...process.env, CI: '1', EXPO_NO_TELEMETRY: '1', NODE_ENV: 'development' },
|
|
62
|
+
})
|
|
63
|
+
child.stdout.on('data', (chunk: Buffer) => output.push(chunk))
|
|
64
|
+
child.stderr.on('data', (chunk: Buffer) => output.push(chunk))
|
|
65
|
+
child.on('error', reject)
|
|
66
|
+
child.on('close', resolveExit)
|
|
67
|
+
})
|
|
68
|
+
if (code !== 0)
|
|
69
|
+
throw new Error(
|
|
70
|
+
`bundling ${projectRoot} exited ${code}:\n${Buffer.concat(output).toString('utf8').slice(-2000)}`,
|
|
71
|
+
)
|
|
72
|
+
// a withPeach Metro config already wrote the installed versions
|
|
73
|
+
const source = readFileSync(bundleOutput, 'utf8')
|
|
74
|
+
if (!readPackageVersionsFooter(source)?.['react-native'])
|
|
75
|
+
writeFileSync(
|
|
76
|
+
bundleOutput,
|
|
77
|
+
insertPackageVersionsFooter(
|
|
78
|
+
source,
|
|
79
|
+
await readInstalledNativePackageVersionsAsync(projectRoot),
|
|
80
|
+
),
|
|
81
|
+
)
|
|
82
|
+
return bundleOutput
|
|
83
|
+
}
|
package/cli/shell-init.ts
CHANGED
|
@@ -69,18 +69,14 @@ export function renderRnxShellInit(shell: string): string {
|
|
|
69
69
|
;;
|
|
70
70
|
esac
|
|
71
71
|
|
|
72
|
+
# a pipeline, a command substitution or a shell that cannot take the update
|
|
73
|
+
# still reaches the simulator through the project folder's saved session
|
|
72
74
|
if { [ -n "\${BASH_VERSION:-}" ] && [ "\${BASH_SUBSHELL:-0}" -ne 0 ]; } ||
|
|
73
|
-
{ [ -n "\${ZSH_VERSION:-}" ] && [ "\${ZSH_SUBSHELL:-0}" -ne 0 ]; }
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
printf '%s\\n' 'peach remote simulator shell integration requires file descriptor 9 to be unused' >&2
|
|
79
|
-
return 1
|
|
80
|
-
fi
|
|
81
|
-
if ! ( export ${PEACH_CLOUD_SESSION_ENV}=__peach_shell_probe && unset ${PEACH_CLOUD_SESSION_ENV} ) 2>/dev/null; then
|
|
82
|
-
printf '%s\\n' 'peach remote simulator shell integration cannot update PEACH_CLOUD_SESSION in this shell' >&2
|
|
83
|
-
return 1
|
|
75
|
+
{ [ -n "\${ZSH_VERSION:-}" ] && [ "\${ZSH_SUBSHELL:-0}" -ne 0 ]; } ||
|
|
76
|
+
( : >&9 ) 2>/dev/null ||
|
|
77
|
+
! ( export ${PEACH_CLOUD_SESSION_ENV}=__peach_shell_probe && unset ${PEACH_CLOUD_SESSION_ENV} ) 2>/dev/null; then
|
|
78
|
+
command peach "\${_peach_shell_args[@]}"
|
|
79
|
+
return $?
|
|
84
80
|
fi
|
|
85
81
|
|
|
86
82
|
case "$-" in
|
package/cli/telemetry.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
writeSharedConfig,
|
|
11
11
|
} from '../src/home-paths'
|
|
12
12
|
import { peachPublicBrand } from '../src/public-brand'
|
|
13
|
+
import { redactCrashDetail, redactPrivateKeys } from './output-redaction'
|
|
13
14
|
import { parseArgs } from './parse-args'
|
|
14
15
|
import {
|
|
15
16
|
crashReportsAllowedForCurrentProcess,
|
|
@@ -207,8 +208,8 @@ const CRASH_REPORT_EVERY_MS = 24 * 60 * 60_000
|
|
|
207
208
|
const CRASH_SENT_KEY = 'crashReportsSent'
|
|
208
209
|
|
|
209
210
|
// an unexpected CLI crash files itself in the issue queue: error class, the
|
|
210
|
-
// sanitized first line of its message,
|
|
211
|
-
//
|
|
211
|
+
// sanitized first line of its message, redacted failure detail, command and
|
|
212
|
+
// versions. one report per crash signature per
|
|
212
213
|
// day from this install. the signature is fuzzy (peach-engine crash-fingerprint),
|
|
213
214
|
// so the server counts every repeat of one crash on its first row.
|
|
214
215
|
export async function reportCliCrash(error: unknown): Promise<void> {
|
|
@@ -218,8 +219,44 @@ export async function reportCliCrash(error: unknown): Promise<void> {
|
|
|
218
219
|
160,
|
|
219
220
|
)
|
|
220
221
|
const message = sanitizeDiagnosticMessage(
|
|
221
|
-
|
|
222
|
+
redactCrashDetail(
|
|
223
|
+
error instanceof Error ? error.message : typeof error === 'string' ? error : '',
|
|
224
|
+
),
|
|
222
225
|
)
|
|
226
|
+
const stderr =
|
|
227
|
+
error && typeof error === 'object' && 'stderr' in error ? error.stderr : null
|
|
228
|
+
const output =
|
|
229
|
+
typeof stderr === 'string'
|
|
230
|
+
? stderr
|
|
231
|
+
: stderr instanceof Uint8Array
|
|
232
|
+
? new TextDecoder().decode(stderr)
|
|
233
|
+
: ''
|
|
234
|
+
const messageHasOutput =
|
|
235
|
+
error instanceof Error && (error.message.includes('\n') || error.message.length > 300)
|
|
236
|
+
const tail = Boolean(output) || messageHasOutput || typeof error === 'string'
|
|
237
|
+
const rawDetail =
|
|
238
|
+
output ||
|
|
239
|
+
(error instanceof Error
|
|
240
|
+
? messageHasOutput
|
|
241
|
+
? error.message
|
|
242
|
+
: (error.stack ?? error.message)
|
|
243
|
+
: typeof error === 'string'
|
|
244
|
+
? error
|
|
245
|
+
: '')
|
|
246
|
+
// keep whole lines before redaction so cutting through a secret cannot expose
|
|
247
|
+
// its suffix. a single oversized line is omitted instead of partially sent.
|
|
248
|
+
const lines = redactPrivateKeys(rawDetail).split(/\r?\n/)
|
|
249
|
+
const selected: string[] = []
|
|
250
|
+
let size = 0
|
|
251
|
+
for (const line of tail ? lines.reverse() : lines) {
|
|
252
|
+
if (size + line.length > 16_384) break
|
|
253
|
+
selected.push(line)
|
|
254
|
+
size += line.length + 1
|
|
255
|
+
}
|
|
256
|
+
if (tail) selected.reverse()
|
|
257
|
+
const redacted = redactCrashDetail(selected.join('\n'))
|
|
258
|
+
const bytes = Buffer.from(redacted)
|
|
259
|
+
const detail = (tail ? bytes.subarray(-4093) : bytes.subarray(0, 4093)).toString('utf8')
|
|
223
260
|
const {
|
|
224
261
|
command,
|
|
225
262
|
cli_version: cliVersion,
|
|
@@ -257,7 +294,7 @@ export async function reportCliCrash(error: unknown): Promise<void> {
|
|
|
257
294
|
runtimeVersion,
|
|
258
295
|
platform: process.platform,
|
|
259
296
|
arch: process.arch,
|
|
260
|
-
crash: { errorClass, message, command },
|
|
297
|
+
crash: { errorClass, message, command, detail },
|
|
261
298
|
},
|
|
262
299
|
}),
|
|
263
300
|
signal: AbortSignal.timeout(3_000),
|
package/cli/ws-bridge.ts
CHANGED
|
@@ -416,6 +416,16 @@ export class BridgeSimLockedError extends Error {
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
// the tcp listener accepted but the ws upgrade never completed: a hung or
|
|
420
|
+
// overloaded bridge, not an empty one. typed so probes can report it
|
|
421
|
+
// distinctly instead of collapsing it into "no bridge".
|
|
422
|
+
export class BridgeHandshakeTimeoutError extends Error {
|
|
423
|
+
constructor(message: string) {
|
|
424
|
+
super(message)
|
|
425
|
+
this.name = 'BridgeHandshakeTimeoutError'
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
419
429
|
interface WsBridgeOptions {
|
|
420
430
|
connectTimeoutMs?: number
|
|
421
431
|
commandTimeoutMs?: number
|
|
@@ -608,12 +618,23 @@ export function parseBridgeCliArgs(
|
|
|
608
618
|
|
|
609
619
|
/** whether the port answers the bridge protocol: an app or dev-server port does not. */
|
|
610
620
|
export async function isLiveBridge(port: number): Promise<boolean> {
|
|
621
|
+
return (await probeBridge(port)).live
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export type BridgeProbe = { live: true } | { live: false; error: Error }
|
|
625
|
+
|
|
626
|
+
// same probe as isLiveBridge, but keeps the failure so the caller can tell a
|
|
627
|
+
// hung bridge (tcp accepted, upgrade never completed) from no bridge at all.
|
|
628
|
+
export async function probeBridge(port: number): Promise<BridgeProbe> {
|
|
611
629
|
const bridge = createBridge(port, { commandTimeoutMs: 1000 })
|
|
612
630
|
try {
|
|
613
631
|
await bridge.listSims()
|
|
614
|
-
return true
|
|
615
|
-
} catch {
|
|
616
|
-
return
|
|
632
|
+
return { live: true }
|
|
633
|
+
} catch (error) {
|
|
634
|
+
return {
|
|
635
|
+
live: false,
|
|
636
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
637
|
+
}
|
|
617
638
|
} finally {
|
|
618
639
|
bridge.close()
|
|
619
640
|
}
|
|
@@ -651,7 +672,7 @@ export function createBridge(wsPort: number, opts: WsBridgeOptions = {}): WsBrid
|
|
|
651
672
|
// existing command budget bounds the handshake too.
|
|
652
673
|
const handshakeTimer = setTimeout(() => {
|
|
653
674
|
reject(
|
|
654
|
-
new
|
|
675
|
+
new BridgeHandshakeTimeoutError(
|
|
655
676
|
`${bridgeWsUrl(wsPort)} accepted the connection but did not complete the websocket handshake within ${commandTimeoutMs / 1000}s; is it a peach bridge?`,
|
|
656
677
|
),
|
|
657
678
|
)
|
|
@@ -1271,6 +1292,17 @@ export async function evalInBridge<T = unknown>(
|
|
|
1271
1292
|
return bridge.send(payload) as Promise<T>
|
|
1272
1293
|
}
|
|
1273
1294
|
|
|
1295
|
+
// a CLI newer than the connected runtime calls bridges the runtime does not
|
|
1296
|
+
// have yet; name that skew instead of leaving a bare lookup failure
|
|
1297
|
+
function explainMissingCallTarget(error: unknown): never {
|
|
1298
|
+
if (error instanceof Error && error.message.startsWith('call target not found: ')) {
|
|
1299
|
+
throw new Error(
|
|
1300
|
+
`${error.message}; the connected sim runs an older runtime than this CLI, so reload the sim or update peach`,
|
|
1301
|
+
)
|
|
1302
|
+
}
|
|
1303
|
+
throw error
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1274
1306
|
/**
|
|
1275
1307
|
* Invoke a function on `window.SootSim.bridges.*` over the bridge. Read-only
|
|
1276
1308
|
* by default for the same reason as evalInBridge.
|
|
@@ -1280,7 +1312,9 @@ export async function callInBridge<T = unknown>(
|
|
|
1280
1312
|
path: string,
|
|
1281
1313
|
...args: unknown[]
|
|
1282
1314
|
): Promise<T> {
|
|
1283
|
-
return bridge
|
|
1315
|
+
return bridge
|
|
1316
|
+
.send({ type: 'call', path, args })
|
|
1317
|
+
.catch(explainMissingCallTarget) as Promise<T>
|
|
1284
1318
|
}
|
|
1285
1319
|
|
|
1286
1320
|
/** Write variant — takes/refreshes the cli lease on the target sim. */
|
|
@@ -1289,5 +1323,7 @@ export async function callInBridgeWrite<T = unknown>(
|
|
|
1289
1323
|
path: string,
|
|
1290
1324
|
...args: unknown[]
|
|
1291
1325
|
): Promise<T> {
|
|
1292
|
-
return bridge
|
|
1326
|
+
return bridge
|
|
1327
|
+
.send({ type: 'call', path, args, acquireLock: true })
|
|
1328
|
+
.catch(explainMissingCallTarget) as Promise<T>
|
|
1293
1329
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1812 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1812 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|