peachsim 0.1.1716 → 0.1.1738

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/README.md +21 -3
  2. package/cli/app-bundle-resources.ts +2 -1
  3. package/cli/app-fonts.ts +4 -4
  4. package/cli/app-splash.ts +4 -4
  5. package/cli/app-stubs.ts +17 -0
  6. package/cli/command-registry.ts +1 -0
  7. package/cli/commands/control.ts +83 -822
  8. package/cli/commands/coverage-swift.ts +112 -4
  9. package/cli/commands/daemon.ts +8 -0
  10. package/cli/commands/detox.ts +3 -0
  11. package/cli/commands/doctor.ts +19 -2
  12. package/cli/commands/inspect/actions.ts +74 -14
  13. package/cli/commands/inspect/core.ts +5 -1
  14. package/cli/commands/inspect/settling.ts +5 -2
  15. package/cli/commands/inspect/wait-ready.ts +6 -0
  16. package/cli/commands/inspect.ts +48 -45
  17. package/cli/commands/kotlin.ts +12 -2
  18. package/cli/commands/package.ts +760 -0
  19. package/cli/commands/serve.ts +6 -0
  20. package/cli/commands/shell-url.ts +838 -0
  21. package/cli/commands/swift.ts +42 -102
  22. package/cli/commands/test.ts +20 -0
  23. package/cli/commands/upload.ts +1 -1
  24. package/cli/device-option.ts +1 -1
  25. package/cli/main.ts +13 -1
  26. package/cli/native-input.ts +199 -0
  27. package/cli/outbound-endpoints.ts +26 -1
  28. package/cli/packaged-app-launcher.ts +95 -0
  29. package/cli/scene-video.ts +36 -12
  30. package/detox/index.ts +196 -24
  31. package/dist-lib/agent-daemon-client.cjs +1 -1
  32. package/dist-lib/agent-events.cjs +1 -1
  33. package/dist-lib/attached-projects.cjs +5 -2
  34. package/dist-lib/auth/shared-session.cjs +5 -2
  35. package/dist-lib/backend-origin.cjs +1 -1
  36. package/dist-lib/beta.cjs +1 -1
  37. package/dist-lib/beta.mjs +1 -1
  38. package/dist-lib/bridge-constants.cjs +1 -1
  39. package/dist-lib/bridge-contract-input.cjs +1 -1
  40. package/dist-lib/bridge-contract-input.mjs +1 -1
  41. package/dist-lib/bridge-contract.cjs +1 -1
  42. package/dist-lib/bridge-contract.mjs +1 -1
  43. package/dist-lib/bundle-channel.cjs +39889 -31873
  44. package/dist-lib/capture-contract.cjs +1 -1
  45. package/dist-lib/capture-contract.mjs +1 -1
  46. package/dist-lib/cloud-contract.cjs +1 -1
  47. package/dist-lib/cloud-contract.mjs +1 -1
  48. package/dist-lib/cloud-test-args.cjs +1 -1
  49. package/dist-lib/cloud-test-args.mjs +1 -1
  50. package/dist-lib/cloud.cjs +1 -1
  51. package/dist-lib/cloud.mjs +1 -1
  52. package/dist-lib/config.cjs +1 -1
  53. package/dist-lib/config.mjs +1 -1
  54. package/dist-lib/detox/index.cjs +195 -63
  55. package/dist-lib/dev-bundle-resolution.cjs +14 -13
  56. package/dist-lib/expo-swift-bundle.cjs +18507 -11835
  57. package/dist-lib/expo-swift-metadata.cjs +4 -1
  58. package/dist-lib/expo-swift-metadata.mjs +3 -1
  59. package/dist-lib/home-paths.cjs +27 -3
  60. package/dist-lib/host/bridge-host.cjs +28373 -24090
  61. package/dist-lib/host/fetch-proxy-handler.cjs +235 -225
  62. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  63. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  64. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  65. package/dist-lib/host/websocket-proxy.cjs +1 -1
  66. package/dist-lib/index.cjs +915 -399
  67. package/dist-lib/jump-to-source-babel.cjs +1 -1
  68. package/dist-lib/jump-to-source-native.cjs +1 -1
  69. package/dist-lib/kotlin-host.cjs +335 -47
  70. package/dist-lib/menu.cjs +13 -1
  71. package/dist-lib/menu.mjs +13 -1
  72. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  73. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  74. package/dist-lib/metro-production-bundle.cjs +1 -1
  75. package/dist-lib/metro-production-bundle.mjs +1 -1
  76. package/dist-lib/metro.cjs +918 -411
  77. package/dist-lib/native-app-identity-project.cjs +703 -283
  78. package/dist-lib/native-app-identity-project.mjs +500 -87
  79. package/dist-lib/native-app-identity.cjs +13 -2
  80. package/dist-lib/native-app-identity.mjs +13 -2
  81. package/dist-lib/native-firebase-metadata.cjs +1 -1
  82. package/dist-lib/native-firebase-metadata.mjs +1 -1
  83. package/dist-lib/plist.cjs +1 -1
  84. package/dist-lib/plist.mjs +1 -1
  85. package/dist-lib/profiles.cjs +5 -2
  86. package/dist-lib/public-brand.cjs +1 -1
  87. package/dist-lib/public-origins-lib-esm.json +28 -23
  88. package/dist-lib/public-origins-lib.json +418 -224
  89. package/dist-lib/react-native-host-modules.cjs +35 -2
  90. package/dist-lib/react-native-host-modules.mjs +35 -2
  91. package/dist-lib/reap-browser.cjs +12 -4
  92. package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
  93. package/dist-lib/sdk.cjs +17 -7
  94. package/dist-lib/sdk.mjs +16 -7
  95. package/dist-lib/skills.cjs +44825 -29141
  96. package/dist-lib/swift-compile.cjs +616 -400
  97. package/dist-lib/swift-compile.mjs +528 -315
  98. package/dist-lib/swift-package.cjs +1 -1
  99. package/dist-lib/swift-package.mjs +1 -1
  100. package/dist-lib/swift-submit.cjs +2 -2
  101. package/dist-lib/swift-submit.mjs +2 -2
  102. package/dist-lib/swift-toolchain.cjs +105 -17
  103. package/dist-lib/swift.cjs +1 -1
  104. package/dist-lib/vite-swift.cjs +4660 -2252
  105. package/dist-lib/vite.cjs +248 -234
  106. package/dist-lib/worklet-executable.cjs +1 -1
  107. package/dist-lib/worklet-executable.mjs +1 -1
  108. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
  109. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
  110. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +7 -4
  111. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +9 -6
  112. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
  113. package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +11 -1
  114. package/dist-types/packages/peach-engine/src/engine/node.d.ts +5 -12
  115. package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
  116. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +5 -0
  117. package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
  118. package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
  119. package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
  120. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
  121. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  122. package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
  123. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +7 -2
  124. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
  125. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
  126. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +36 -2
  127. package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
  128. package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
  129. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  130. package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
  131. package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
  132. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
  133. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  134. package/kotlin/README.md +3 -0
  135. package/kotlin/sdk.tar.gz +0 -0
  136. package/package.json +1 -1
  137. package/runtime-companion.json +1 -1
  138. package/scripts/dev-server-scanner.ts +12 -25
  139. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +55 -0
  140. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
  141. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
  142. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
  143. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
  144. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
  145. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
  146. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
  147. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
  148. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
  149. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
  150. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
  151. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
  152. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
  153. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
  154. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
  155. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
  156. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
  157. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +3 -1
  158. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
  159. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
  160. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -3
  161. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +711 -46
  162. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
  163. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
  164. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
  165. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
  166. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
  167. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
  168. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
  169. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
  170. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
  171. package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
  172. package/sdk/ios/usr/include/module.modulemap +1 -0
  173. package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
  174. package/sdk/ios/usr/include/os/signpost.h +414 -0
  175. package/sdk/ios/usr/include/os.modulemap +10 -0
  176. package/sdk/ios/usr/include/sys/cdefs.h +5 -0
  177. package/sdk/ios/usr/include/sys/ioccom.h +99 -0
  178. package/sdk/ios/usr/include/sys/syslog.h +236 -0
  179. package/sdk/ios/usr/include/syslog.h +24 -0
  180. package/sdk/ios/wasm/include/errno.h +4 -20
  181. package/sdk/ios/wasm/include/fcntl.h +4 -2
  182. package/sdk/ios/wasm/include/pthread.h +3 -0
  183. package/sdk/ios/wasm/include/setjmp.h +57 -0
  184. package/sdk/ios/wasm/include/stdio.h +24 -0
  185. package/sdk/ios/wasm/include/stdlib.h +32 -7
  186. package/sdk/ios/wasm/include/sys/file.h +7 -0
  187. package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
  188. package/sdk/ios/wasm/include/sys/resource.h +2 -2
  189. package/sdk/ios/wasm/include/sys/syscall.h +9 -0
  190. package/sdk/ios/wasm/include/sys/time.h +10 -0
  191. package/sdk/ios/wasm/include/unistd.h +12 -3
  192. package/sdk/native-hashes.json +4 -3
  193. package/skills/contrast/SKILL.md +2 -1
  194. package/skills/peach-debug/SKILL.md +0 -1
  195. package/skills/peach-perf/SKILL.md +0 -1
  196. package/skills/peach-setup/SKILL.md +0 -1
  197. package/skills/peach-test/SKILL.md +7 -4
  198. package/skills/peach-visual/SKILL.md +0 -1
  199. package/src/admitted-mac-build.ts +3 -0
  200. package/src/android-app-identity.ts +18 -0
  201. package/src/android-autolinking.ts +1 -0
  202. package/src/android-bridge-packages.ts +279 -0
  203. package/src/android-root-module.ts +9 -9
  204. package/src/appPackageContract.ts +83 -0
  205. package/src/bridge-contract.ts +50 -0
  206. package/src/bundle-channel.mjs +41 -6
  207. package/src/cli-runtime.ts +9 -5
  208. package/src/dev-bundle-resolution.ts +7 -27
  209. package/src/dom-source-reference.ts +15 -0
  210. package/src/expo-discovery-cache.ts +134 -26
  211. package/src/expo-kotlin-host.ts +97 -26
  212. package/src/expo-manifest-body.ts +33 -0
  213. package/src/expo-native-workspace.ts +158 -38
  214. package/src/expo-swift-host.ts +350 -75
  215. package/src/expo-swift-ready.ts +5 -1
  216. package/src/expoKotlinContract.ts +12 -2
  217. package/src/expoSwiftContract.ts +10 -0
  218. package/src/generated/swift-c-predefines.json +1 -1
  219. package/src/home-paths.ts +41 -2
  220. package/src/host/app-package-handler.ts +47 -0
  221. package/src/host/bridge-host.ts +8 -0
  222. package/src/host/fetch-proxy-handler.ts +10 -0
  223. package/src/host/staged-host-files.ts +18 -0
  224. package/src/index.ts +3 -0
  225. package/src/kotlin-host.ts +225 -48
  226. package/src/kotlin-instance-source.ts +126 -0
  227. package/src/kotlinSdkContract.ts +2 -1
  228. package/src/menu.ts +14 -0
  229. package/src/native-app-identity-project.ts +7 -2
  230. package/src/native-app-identity.ts +11 -0
  231. package/src/native-firebase-config.ts +24 -1
  232. package/src/native-prebuilt.ts +154 -0
  233. package/src/nitro-adapter.lock.json +270 -270
  234. package/src/nitro-adapter.ts +56 -50
  235. package/src/nitro-bundle.ts +92 -74
  236. package/src/nitro-compile.ts +45 -14
  237. package/src/nitro-dependencies.ts +63 -46
  238. package/src/nitro-source.ts +64 -26
  239. package/src/nitroAdapterContract.ts +146 -98
  240. package/src/nitroContract.ts +71 -21
  241. package/src/react-native-bridge-modules.ts +70 -42
  242. package/src/react-native-host-modules.ts +34 -1
  243. package/src/reactNativeConfigurationContract.ts +14 -0
  244. package/src/reap-browser.ts +15 -3
  245. package/src/sdk.ts +5 -0
  246. package/src/settingsContract.ts +38 -1
  247. package/src/sim-client.ts +4 -1
  248. package/src/storageSnapshotContract.ts +32 -81
  249. package/src/swift-compile.ts +268 -89
  250. package/src/swift-coverage/indexdump.ts +22 -6
  251. package/src/swift-coverage/indexing.ts +4 -4
  252. package/src/swift-coverage/provenance.ts +1 -0
  253. package/src/swift-coverage/sdk.ts +104 -20
  254. package/src/swift-coverage/types.ts +34 -0
  255. package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
  256. package/src/swift-coverage/xcode-assets.ts +89 -131
  257. package/src/swift-coverage/xcode.ts +10 -2
  258. package/src/swift-cxx-reachable.ts +2 -1
  259. package/src/swift-distribution.lock.json +20 -16
  260. package/src/swift-host.ts +98 -22
  261. package/src/swift-icu.ts +1 -1
  262. package/src/swift-link-roots.ts +118 -0
  263. package/src/swift-objc-compile.ts +144 -22
  264. package/src/swift-objc-import.ts +6 -0
  265. package/src/swift-objc-standin.ts +2 -14
  266. package/src/swift-package-manifest.ts +14 -6
  267. package/src/swift-packages.ts +75 -11
  268. package/src/swift-pdf-raster.ts +1 -0
  269. package/src/swift-root-lock.ts +17 -1
  270. package/src/swift-source-pods.ts +2 -10
  271. package/src/swift-standin-emit.ts +597 -57
  272. package/src/swift-standins.ts +599 -56
  273. package/src/swift-submit.ts +7 -1
  274. package/src/swift-toolchain.ts +140 -17
  275. package/src/turbo-bundle.ts +81 -0
  276. package/src/turbo-codegen-intake.ts +91 -0
  277. package/src/turbo-compile.ts +120 -0
  278. package/src/turbo-runtime.lock.json +69 -0
  279. package/src/turbo-source.ts +754 -0
  280. package/src/vite-plugin-one.ts +17 -12
  281. package/src/vite-plugin.ts +28 -15
  282. package/src/xcode-project.ts +223 -22
@@ -9,6 +9,9 @@ export function windowAdmission(): WindowAdmission | null {
9
9
  encoding: 'utf8',
10
10
  stdio: ['ignore', 'pipe', 'inherit'],
11
11
  })
12
+ // a host without tm (a disposable guest) has no window registry to admit it
13
+ if (result.error && 'code' in result.error && result.error.code === 'ENOENT')
14
+ return null
12
15
  if (result.error) throw result.error
13
16
  if (result.status === 1) return null
14
17
  if (result.status !== 0) throw new Error(`tm window ancestor exited ${result.status}`)
@@ -75,6 +75,23 @@ export function nativeAppIdentityFromAndroidManifest(
75
75
  ...(max === undefined ? {} : { maxSdkVersion: Number(max) }),
76
76
  })
77
77
  }
78
+ // one prebuild writes native.app.photoLibrary.addOnly as application meta-data
79
+ // once the merger has combined the app and linked libraries. resource
80
+ // references, placeholders and false stay uncertified like the Kotlin
81
+ // PackageManager read's default.
82
+ let androidPhotoLibraryAddOnly: true | undefined
83
+ for (const element of application.children) {
84
+ if (
85
+ element.name !== 'meta-data' ||
86
+ element.attributes[`${attribute}name`] !== 'one.photoLibrary.addOnly'
87
+ )
88
+ continue
89
+ // aapt2 parses true, True and TRUE as the boolean true
90
+ if (
91
+ /^(?:true|True|TRUE)$/.test(element.attributes[`${attribute}value`]?.trim() ?? '')
92
+ )
93
+ androidPhotoLibraryAddOnly = true
94
+ }
78
95
  let label = application.attributes[`${attribute}label`]
79
96
  let applicationName: string | null = null
80
97
  if (label && !/\$\{|^[@?]/.test(label)) applicationName = label
@@ -126,6 +143,7 @@ export function nativeAppIdentityFromAndroidManifest(
126
143
  bundleIdentifier,
127
144
  platform: 'android',
128
145
  androidManifestPermissions,
146
+ ...(androidPhotoLibraryAddOnly === undefined ? {} : { androidPhotoLibraryAddOnly }),
129
147
  }
130
148
  }
131
149
 
@@ -57,6 +57,7 @@ async function resolveAndroidModules(
57
57
  timeout: 30_000,
58
58
  maxBuffer: 8 * 1024 * 1024,
59
59
  env: { ...process.env, [RNX_FORKED_SCRIPT_ENV]: '1' },
60
+ cwd: appRoot,
60
61
  },
61
62
  )
62
63
  const resolved: unknown = JSON.parse(stdout)
@@ -0,0 +1,279 @@
1
+ // an Android app's own legacy React Native modules: the ReactPackage classes
2
+ // its application registers, the module classes they create, and the app
3
+ // sources each package needs, found the way gradle's main source set would
4
+ // compile them. the Kotlin parser reads each file (kotlin-host's bridge scan);
5
+ // this selects what it reports.
6
+ import fs from 'node:fs'
7
+ import path from 'node:path'
8
+ import { isRecord } from './is-record'
9
+
10
+ export interface BridgeMethod {
11
+ name: string
12
+ blocking: boolean
13
+ // null for a method that returns nothing
14
+ returns: string | null
15
+ params: { name: string; type: string }[]
16
+ }
17
+
18
+ export interface BridgeFile {
19
+ file: string
20
+ package: string
21
+ imports: string[]
22
+ declared: string[]
23
+ references: string[]
24
+ packages: { name: string; noArg: boolean }[]
25
+ modules: { name: string; methods: BridgeMethod[] }[]
26
+ }
27
+
28
+ export interface BridgeModule {
29
+ // fully qualified class
30
+ className: string
31
+ // the name getName() returns when it is a string literal
32
+ name: string
33
+ methods: BridgeMethod[]
34
+ }
35
+
36
+ export interface BridgePackage {
37
+ className: string
38
+ modules: BridgeModule[]
39
+ // the app sources the package's classes need, its own first
40
+ sources: string[]
41
+ // why the package cannot be hosted
42
+ unsupported: string | null
43
+ }
44
+
45
+ export interface BridgeSelection {
46
+ applicationId: string
47
+ packages: BridgePackage[]
48
+ }
49
+
50
+ const qualified = (file: { package: string }, name: string) =>
51
+ file.package ? `${file.package}.${name}` : name
52
+
53
+ function readMethod(value: unknown): BridgeMethod {
54
+ if (
55
+ !isRecord(value) ||
56
+ typeof value.name !== 'string' ||
57
+ typeof value.blocking !== 'boolean' ||
58
+ (value.returns !== null && typeof value.returns !== 'string') ||
59
+ !Array.isArray(value.params)
60
+ )
61
+ throw new Error('bridge-modules printed an invalid method')
62
+ return {
63
+ name: value.name,
64
+ blocking: value.blocking,
65
+ returns: value.returns,
66
+ params: value.params.map((param: unknown) => {
67
+ if (
68
+ !isRecord(param) ||
69
+ typeof param.name !== 'string' ||
70
+ typeof param.type !== 'string'
71
+ )
72
+ throw new Error('bridge-modules printed an invalid parameter')
73
+ return { name: param.name, type: param.type }
74
+ }),
75
+ }
76
+ }
77
+
78
+ function strings(value: unknown): string[] {
79
+ if (!Array.isArray(value) || !value.every((item) => typeof item === 'string'))
80
+ throw new Error('bridge-modules printed an invalid list')
81
+ return value.map(String)
82
+ }
83
+
84
+ export function readBridgeFiles(output: string): BridgeFile[] {
85
+ return output
86
+ .split('\n')
87
+ .filter((line) => line.startsWith('{'))
88
+ .map((line) => {
89
+ const row: unknown = JSON.parse(line)
90
+ if (
91
+ !isRecord(row) ||
92
+ typeof row.file !== 'string' ||
93
+ typeof row.package !== 'string' ||
94
+ !Array.isArray(row.packages) ||
95
+ !Array.isArray(row.modules)
96
+ )
97
+ throw new Error('bridge-modules printed an invalid file')
98
+ return {
99
+ file: row.file,
100
+ package: row.package,
101
+ imports: strings(row.imports),
102
+ declared: strings(row.declared),
103
+ references: strings(row.references),
104
+ packages: row.packages.map((entry: unknown) => {
105
+ if (
106
+ !isRecord(entry) ||
107
+ typeof entry.name !== 'string' ||
108
+ typeof entry.noArg !== 'boolean'
109
+ )
110
+ throw new Error('bridge-modules printed an invalid package')
111
+ return { name: entry.name, noArg: entry.noArg }
112
+ }),
113
+ modules: row.modules.map((entry: unknown) => {
114
+ if (
115
+ !isRecord(entry) ||
116
+ typeof entry.name !== 'string' ||
117
+ !Array.isArray(entry.methods)
118
+ )
119
+ throw new Error('bridge-modules printed an invalid module')
120
+ return { name: entry.name, methods: entry.methods.map(readMethod) }
121
+ }),
122
+ }
123
+ })
124
+ }
125
+
126
+ // the app module's main source set: the gradle android plugin's defaults
127
+ export function androidAppSources(appRoot: string): {
128
+ applicationId: string
129
+ kotlin: string[]
130
+ java: string[]
131
+ } | null {
132
+ const moduleDir = path.join(appRoot, 'android', 'app')
133
+ const gradle = ['build.gradle', 'build.gradle.kts']
134
+ .map((name) => path.join(moduleDir, name))
135
+ .find((file) => fs.existsSync(file))
136
+ if (!gradle) return null
137
+ const id = /\bapplicationId\s*=?\s*["']([^"']+)["']/.exec(
138
+ fs.readFileSync(gradle, 'utf8'),
139
+ )
140
+ if (!id) throw new Error(`${gradle}: no applicationId`)
141
+ const kotlin: string[] = []
142
+ const java: string[] = []
143
+ const walk = (dir: string) => {
144
+ if (!fs.existsSync(dir)) return
145
+ for (const child of fs
146
+ .readdirSync(dir, { withFileTypes: true })
147
+ .sort((a, b) => a.name.localeCompare(b.name))) {
148
+ const file = path.join(dir, child.name)
149
+ if (child.isSymbolicLink()) throw new Error(`Android source is a symlink: ${file}`)
150
+ if (child.isDirectory()) walk(file)
151
+ else if (child.name.endsWith('.kt')) kotlin.push(file)
152
+ else if (child.name.endsWith('.java')) java.push(file)
153
+ }
154
+ }
155
+ walk(path.join(moduleDir, 'src', 'main', 'java'))
156
+ walk(path.join(moduleDir, 'src', 'main', 'kotlin'))
157
+ return { applicationId: id[1], kotlin, java }
158
+ }
159
+
160
+ // a name a source refers to resolves to a file declaring it when the file's
161
+ // package is the source's own, one it imports, or one it writes in full
162
+ function declares(
163
+ source: { package: string; imports: string[]; text: string },
164
+ owner: { package: string },
165
+ name: string,
166
+ ): boolean {
167
+ const full = qualified(owner, name)
168
+ return (
169
+ source.package === owner.package ||
170
+ source.imports.includes(full) ||
171
+ source.imports.includes(`${owner.package}.*`) ||
172
+ source.text.includes(full)
173
+ )
174
+ }
175
+
176
+ export function selectBridgePackages(
177
+ applicationId: string,
178
+ files: BridgeFile[],
179
+ javaFiles: string[],
180
+ ): BridgeSelection {
181
+ const texts = new Map(
182
+ files.map((file) => [file.file, fs.readFileSync(file.file, 'utf8')]),
183
+ )
184
+ const owners = new Map<string, BridgeFile[]>()
185
+ for (const file of files)
186
+ for (const name of file.declared)
187
+ owners.set(name, [...(owners.get(name) ?? []), file])
188
+ const javaDeclarations = javaFiles.map((file) => ({
189
+ file,
190
+ package: /^\s*package\s+([\w.]+)\s*;/m.exec(fs.readFileSync(file, 'utf8'))?.[1] ?? '',
191
+ name: path.basename(file, '.java'),
192
+ }))
193
+
194
+ const closure = (root: BridgeFile) => {
195
+ const seen = new Set([root])
196
+ let unsupported: string | null = null
197
+ for (const file of seen) {
198
+ const source = {
199
+ package: file.package,
200
+ imports: file.imports,
201
+ text: texts.get(file.file)!,
202
+ }
203
+ for (const name of file.references) {
204
+ for (const owner of owners.get(name) ?? [])
205
+ if (!seen.has(owner) && declares(source, owner, name)) seen.add(owner)
206
+ for (const java of javaDeclarations)
207
+ if (java.name === name && declares(source, java, name))
208
+ unsupported ??= `${java.file}: Java sources in bridge modules are not supported yet`
209
+ }
210
+ }
211
+ return { files: [...seen], unsupported }
212
+ }
213
+
214
+ // an application registers a package by constructing it
215
+ const registered = (file: BridgeFile, name: string) => {
216
+ const registrars = files.filter(
217
+ (other) =>
218
+ other !== file &&
219
+ other.references.includes(name) &&
220
+ declares(
221
+ {
222
+ package: other.package,
223
+ imports: other.imports,
224
+ text: texts.get(other.file)!,
225
+ },
226
+ file,
227
+ name,
228
+ ),
229
+ )
230
+ return registrars.length === 0 ? null : registrars
231
+ }
232
+
233
+ const found: { order: string; position: number; result: BridgePackage }[] = []
234
+ for (const file of files) {
235
+ for (const entry of file.packages) {
236
+ const registrars = registered(file, entry.name)
237
+ if (!registrars) continue
238
+ const needed = closure(file)
239
+ const result: BridgePackage = {
240
+ className: qualified(file, entry.name),
241
+ modules: needed.files.flatMap((owner) =>
242
+ owner.modules.map((module) => ({
243
+ className: qualified(owner, module.name),
244
+ name:
245
+ moduleName(texts.get(owner.file)!, module.name) ??
246
+ module.name.split('.').pop()!,
247
+ methods: module.methods,
248
+ })),
249
+ ),
250
+ sources: needed.files.map((owner) => owner.file),
251
+ unsupported:
252
+ needed.unsupported ??
253
+ (entry.noArg
254
+ ? null
255
+ : `${file.file}: ${entry.name} has no constructor without arguments`),
256
+ }
257
+ const text = texts.get(registrars[0].file)!
258
+ found.push({
259
+ order: registrars[0].file,
260
+ position: text.search(new RegExp(`\\b${entry.name}\\s*\\(`)),
261
+ result,
262
+ })
263
+ }
264
+ }
265
+ found.sort((a, b) => a.order.localeCompare(b.order) || a.position - b.position)
266
+ return { applicationId, packages: found.map((entry) => entry.result) }
267
+ }
268
+
269
+ // the string literal a module's getName returns
270
+ function moduleName(text: string, className: string): string | null {
271
+ const klass = text.slice(
272
+ text.search(new RegExp(`\\bclass\\s+${className.split('.').pop()}\\b`)),
273
+ )
274
+ const match =
275
+ /\bfun\s+getName\s*\(\s*\)\s*(?::\s*String)?\s*(?:=\s*|\{\s*return\s+)"([^"$]*)"/.exec(
276
+ klass,
277
+ )
278
+ return match ? match[1] : null
279
+ }
@@ -75,16 +75,17 @@ function readModuleNamespace(
75
75
  return undefined
76
76
  }
77
77
 
78
- function readModuleRootModuleName(moduleRoot: string): string | undefined {
78
+ // null: the module declares no launcher. undefined: it declares one this reader cannot resolve.
79
+ function readModuleRootModuleName(moduleRoot: string): string | null | undefined {
79
80
  const sourceSets = path.join(moduleRoot, 'src')
80
81
  const manifestFile = path.join(sourceSets, 'main/AndroidManifest.xml')
81
- if (!fs.existsSync(manifestFile)) return undefined
82
+ if (!fs.existsSync(manifestFile)) return null
82
83
  const document = parseXml(fs.readFileSync(manifestFile, 'utf8'), manifestFile)
83
84
  const manifest = document.children[0]
84
85
  const application = manifest?.children.find((child) => child.name === 'application')
85
- if (manifest?.name !== 'manifest' || !application) return undefined
86
+ if (manifest?.name !== 'manifest' || !application) return null
86
87
  const launchers = launcherActivities(application)
87
- if (launchers.length === 0) return undefined
88
+ if (launchers.length === 0) return null
88
89
  // a variant or flavor manifest that declares activities can change the
89
90
  // launcher the merger selects; only a completed merger output can say how.
90
91
  for (const set of fs.readdirSync(sourceSets, { withFileTypes: true })) {
@@ -128,7 +129,8 @@ function readModuleRootModuleName(moduleRoot: string): string | undefined {
128
129
  )
129
130
  }
130
131
 
131
- // every application module is read; exactly one may carry a launcher.
132
+ // every application module is read; exactly one may carry a launcher, and an
133
+ // unresolvable launcher counts as one so it cannot make another module unique.
132
134
  export function readAndroidLauncherRootModuleName(
133
135
  projectRoot: string,
134
136
  ): string | undefined {
@@ -137,9 +139,7 @@ export function readAndroidLauncherRootModuleName(
137
139
  const names = fs
138
140
  .readdirSync(androidRoot, { withFileTypes: true })
139
141
  .filter((entry) => entry.isDirectory())
140
- .flatMap((entry) => {
141
- const name = readModuleRootModuleName(path.join(androidRoot, entry.name))
142
- return name === undefined ? [] : [name]
143
- })
142
+ .map((entry) => readModuleRootModuleName(path.join(androidRoot, entry.name)))
143
+ .filter((name) => name !== null)
144
144
  return names.length === 1 ? names[0] : undefined
145
145
  }
@@ -0,0 +1,83 @@
1
+ import {
2
+ isSettingKey,
3
+ isValidSettingValue,
4
+ settingsSchema,
5
+ type SettingsValues,
6
+ } from './settingsContract'
7
+
8
+ // replaced with the package's private daemon origin at launch, including in
9
+ // staged metadata. no port or absolute path from the build machine survives.
10
+ export const APP_PACKAGE_ORIGIN = 'http://127.0.0.1:65534'
11
+ // metadata can nest encoded URLs, but the numeric port survives every layer.
12
+ export const APP_PACKAGE_ADDRESS_PATTERN = String.raw`127\.0\.0\.1(?::|%(?:25)*3a)65534`
13
+ export const APP_PACKAGE_VERSION = 1
14
+
15
+ export interface AppPackageManifest {
16
+ schemaVersion: typeof APP_PACKAGE_VERSION
17
+ buildId: string
18
+ identifier: string
19
+ name: string
20
+ origin: string
21
+ hostExecutable: string
22
+ hostArguments: string[]
23
+ runtimeVersion: string
24
+ launchUrl: string
25
+ // seed a new app's config once; never override the user's later choices.
26
+ defaults: Partial<SettingsValues>
27
+ // staged file names whose text contains the build-time placeholder origin.
28
+ relocatableFiles: string[]
29
+ requiresServer: boolean
30
+ routes: Record<string, { file: string; contentType: string }>
31
+ }
32
+
33
+ export function packageSettingDefaults(
34
+ assignments: readonly string[],
35
+ ): Partial<SettingsValues> {
36
+ const defaults: Partial<SettingsValues> = {
37
+ ...Object.fromEntries(
38
+ Object.entries(settingsSchema).map(([key, definition]) => [
39
+ key,
40
+ definition.default,
41
+ ]),
42
+ ),
43
+ // a packaged app is a desktop app: it keeps the computer pointer and
44
+ // shows only the app, without the device frame or simulator rail.
45
+ // and types on the computer keyboard, so no software keyboard presents.
46
+ systemCursor: true,
47
+ hardwareKeyboard: true,
48
+ showFrame: false,
49
+ showRail: false,
50
+ }
51
+ for (const assignment of assignments) {
52
+ const equals = assignment.indexOf('=')
53
+ const key = assignment.slice(0, equals)
54
+ if (equals < 1 || !isSettingKey(key))
55
+ throw new Error(`unknown package setting: ${assignment}`)
56
+ const raw = assignment.slice(equals + 1)
57
+ const definition = settingsSchema[key]
58
+ const value: unknown =
59
+ definition.type === 'boolean'
60
+ ? raw === 'true'
61
+ ? true
62
+ : raw === 'false'
63
+ ? false
64
+ : raw
65
+ : definition.type === 'number'
66
+ ? raw.trim() === ''
67
+ ? NaN
68
+ : Number(raw)
69
+ : definition.type === 'string-array'
70
+ ? JSON.parse(raw)
71
+ : raw
72
+ if (
73
+ (typeof value === 'number' && !Number.isFinite(value)) ||
74
+ !isValidSettingValue(key, value)
75
+ )
76
+ throw new Error(
77
+ `invalid package setting ${assignment}${definition.options ? `; expected ${definition.options.join(', ')}` : ''}`,
78
+ )
79
+ Object.assign(defaults, { [key]: value })
80
+ }
81
+ // overrides cross the owning registry's validation; defaults come from it.
82
+ return defaults
83
+ }
@@ -13,7 +13,10 @@ import type {
13
13
  SootSimAgentActionDetail,
14
14
  SootSimCaptureFilter,
15
15
  SootSimExternalAppLifecycleOptions,
16
+ SootSimReplayTarget,
16
17
  SootSimStorageResetStrategy,
18
+ SootSimTapRefusal,
19
+ SootSimTapResult,
17
20
  TextInputEditCommand,
18
21
  } from '@peach/globals'
19
22
 
@@ -127,6 +130,53 @@ export interface WsCommand {
127
130
  storageSnapshotOptions?: { includeCredentials?: boolean }
128
131
  }
129
132
 
133
+ // ---------------------------------------------------------------------------
134
+ // tap — result
135
+ // ---------------------------------------------------------------------------
136
+
137
+ // every reason a tap reply states for not landing. the headless cloud runtime
138
+ // reports its own selector and hit-test misfires alongside the two targeted
139
+ // refusals the browser engine's interact bridge uses; the last two are the
140
+ // sdk's own retry observations, decided before a press is dispatched.
141
+ export type SimTapResultReason =
142
+ | SootSimTapRefusal['reason']
143
+ | 'selector_no_raw_node'
144
+ | 'selector_node_without_layout'
145
+ | 'selector_node_not_visible'
146
+ | 'selector_no_tap_target'
147
+ | 'hit_test_miss'
148
+ | 'no_responder'
149
+ | 'offscreen'
150
+ | 'screen-not-laid-out'
151
+ | 'target-moved'
152
+
153
+ // bounded evidence the headless runtime attaches to a tap it did not handle.
154
+ export interface SimTapDiagnostics {
155
+ nodeId: number | null
156
+ frame: { x: number; y: number; width: number; height: number } | null
157
+ inspectable: boolean | null
158
+ point: { x: number; y: number } | null
159
+ screen: { width: number; height: number }
160
+ commitRevision: number
161
+ layoutRevision: number
162
+ }
163
+
164
+ // one tap reply as the sdk observes it. the browser engine's interact bridge
165
+ // fills SootSimTapResult's hit verification; a headless cloud runtime answers
166
+ // `handled` and, when the press did not land, a reason with diagnostics; the
167
+ // sdk's retry loop adds refusals it decides before dispatch. every reply states
168
+ // its outcome in one of those two fields, so a reply carrying neither is not a
169
+ // tap the sdk can read as landed.
170
+ export type SimTapResult = Partial<Omit<SootSimTapResult, 'reason' | 'hit'>> & {
171
+ ok?: boolean
172
+ reason?: SimTapResultReason
173
+ diagnostics?: SimTapDiagnostics
174
+ // the sdk's pre-dispatch refusals carry the point and screen they checked.
175
+ x?: number
176
+ y?: number
177
+ screen?: { width: number; height: number }
178
+ } & ({ hit: boolean; handled?: boolean } | { handled: boolean; hit?: boolean })
179
+
130
180
  // ---------------------------------------------------------------------------
131
181
  // perform — batched input
132
182
  // ---------------------------------------------------------------------------
@@ -4,7 +4,9 @@ import { Script } from 'node:vm'
4
4
  import { isLoopbackHost } from './backend-origin'
5
5
  import { insertExpoKotlinFooter } from './expoKotlinContract'
6
6
  import { insertExpoSwiftFooter } from './expoSwiftContract'
7
- import { insertNitroFooter } from './nitroContract'
7
+ import { readInstalledNativePackageVersionsAsync } from './installed-package-versions'
8
+ import { insertNitroFooter, insertTurboFooter } from './nitroContract'
9
+ import { insertPackageVersionsFooter } from './packageVersionsContract'
8
10
  import { terminateProcessGroup } from './process-group'
9
11
 
10
12
  const digest = (bytes) => createHash('sha256').update(bytes).digest('hex')
@@ -92,12 +94,15 @@ function prepareChannel({
92
94
  expoSwift = null,
93
95
  expoKotlin = null,
94
96
  nitro = null,
97
+ turbo = null,
95
98
  }) {
96
99
  if (!(platform in nativeAssetPath)) throw new Error(`unknown platform: ${platform}`)
97
100
  const native = platform === 'ios' ? expoSwift : expoKotlin
98
101
  if (platform !== 'ios' && nitro !== null)
99
102
  throw new Error(`${platform} bundle carries an iOS Nitro module`)
100
- const nativeBundles = [native, nitro].filter(Boolean)
103
+ if (platform !== 'ios' && turbo !== null)
104
+ throw new Error(`${platform} bundle carries an iOS TurboModule`)
105
+ const nativeBundles = [native, nitro, turbo].filter(Boolean)
101
106
  const nativeAssets = new Map()
102
107
  if ((platform === 'ios' ? expoKotlin : expoSwift) !== null)
103
108
  throw new Error(`${platform} bundle carries another platform's native modules`)
@@ -141,6 +146,7 @@ function prepareChannel({
141
146
  }
142
147
  if (native) identity.update(JSON.stringify(native.metadata))
143
148
  if (nitro) identity.update(JSON.stringify(nitro.metadata))
149
+ if (turbo) identity.update(JSON.stringify(turbo.metadata))
144
150
  const releaseKey = `${prefix}/peach/releases/${identity.digest('hex')}`
145
151
  const assetBaseUrl = `${origin.origin}/${releaseKey}/`
146
152
  const directories = new Set(
@@ -202,6 +208,19 @@ function prepareChannel({
202
208
  }
203
209
  source = insertNitroFooter(source, nativeMetadata.nitro)
204
210
  }
211
+ if (turbo) {
212
+ nativeMetadata = {
213
+ ...nativeMetadata,
214
+ turbo: {
215
+ ...turbo.metadata,
216
+ url: release(turbo.metadata.url),
217
+ icuUrl: turbo.metadata.icuUrl.startsWith('/')
218
+ ? release(turbo.metadata.icuUrl)
219
+ : turbo.metadata.icuUrl,
220
+ },
221
+ }
222
+ source = insertTurboFooter(source, nativeMetadata.turbo)
223
+ }
205
224
  new Script(source, { filename: 'peach-release-bundle.js' })
206
225
  const bundleBytes = Buffer.from(source)
207
226
  const metadata = {
@@ -295,6 +314,10 @@ export async function snapshotDevServerBundles(
295
314
  ) {
296
315
  const { readFileSync } = await import('node:fs')
297
316
  const { basename } = await import('node:path')
317
+ const { resolveRNXAppConfig } = await import('../cli/app-config')
318
+ const { produceConfiguredBundle } = await import('./configured-bundle-producer')
319
+ const { config } = await resolveRNXAppConfig(projectRoot)
320
+ const versions = await readInstalledNativePackageVersionsAsync(projectRoot)
298
321
  const snapshots = []
299
322
  for (const platform of platforms) {
300
323
  const url = `${origin}/index.bundle?platform=${platform}&dev=true&minify=false`
@@ -337,7 +360,13 @@ export async function snapshotDevServerBundles(
337
360
  }
338
361
  snapshots.push({
339
362
  platform,
340
- bundle,
363
+ bundle: Buffer.from(
364
+ await produceConfiguredBundle(
365
+ insertPackageVersionsFooter(bundle.toString('utf8'), versions),
366
+ config,
367
+ new Set(Object.keys(versions)),
368
+ ),
369
+ ),
341
370
  assets: [...assets].map(([path, bytes]) => ({ path, bytes })),
342
371
  ...(platform === 'ios'
343
372
  ? {
@@ -345,6 +374,7 @@ export async function snapshotDevServerBundles(
345
374
  await import('./expo-swift-bundle')
346
375
  ).buildExpoSwiftBundle(projectRoot),
347
376
  nitro: await (await import('./nitro-bundle')).buildNitroBundle(projectRoot),
377
+ turbo: await (await import('./turbo-bundle')).buildTurboBundle(projectRoot),
348
378
  }
349
379
  : {
350
380
  expoKotlin: await (
@@ -357,7 +387,11 @@ export async function snapshotDevServerBundles(
357
387
  }
358
388
 
359
389
  // a One app's bundles, from a private dev server
360
- export async function snapshotOneDevBundle(projectRoot, env = {}) {
390
+ export async function snapshotOneDevBundle(
391
+ projectRoot,
392
+ env = {},
393
+ { runtimeExecutable = process.execPath, platforms = ['ios', 'android'] } = {},
394
+ ) {
361
395
  const { spawn } = await import('node:child_process')
362
396
  const { readFileSync } = await import('node:fs')
363
397
  const { createServer } = await import('node:net')
@@ -378,14 +412,15 @@ export async function snapshotOneDevBundle(projectRoot, env = {}) {
378
412
  })
379
413
  .on('error', reject)
380
414
  })
381
- const child = spawn(process.execPath, [oneBin, 'dev', '--port', String(port)], {
415
+ const child = spawn(runtimeExecutable, [oneBin, 'dev', '--port', String(port)], {
382
416
  cwd: projectRoot,
383
- env: { ...process.env, ...env },
417
+ env: { ...process.env, ...env, CI: '1', PEACH_NO_OPEN: '1' },
384
418
  stdio: ['ignore', 'inherit', 'inherit'],
385
419
  detached: true,
386
420
  })
387
421
  try {
388
422
  return await snapshotDevServerBundles(`http://127.0.0.1:${port}`, projectRoot, {
423
+ platforms,
389
424
  assertRunning: () => {
390
425
  if (child.exitCode !== null)
391
426
  throw new Error(`one dev exited with ${child.exitCode}`)
@@ -3,10 +3,7 @@ import { readFileSync } from 'node:fs'
3
3
  import { createRequire } from 'node:module'
4
4
  import { join } from 'node:path'
5
5
  import companionIdentity from '../runtime-companion.json' with { type: 'json' }
6
- import {
7
- resolveActiveRuntimeRoot,
8
- resolveDevCheckoutRuntimeAssetRoot,
9
- } from './runtime-assets'
6
+ import { findMonorepoRoot, resolveActiveRuntimeRoot } from './runtime-assets'
10
7
  import type * as CliRuntime from '#peach-cli-contract/cli-companion'
11
8
 
12
9
  export const CLI_COMPANION_ABI = 1
@@ -45,7 +42,14 @@ let loaded: { root: string; runtime: typeof CliRuntime } | undefined
45
42
  // so host serializers receive their implementation rather than a forwarding closure.
46
43
  export function getCliRuntime(): typeof CliRuntime {
47
44
  if (loaded) return loaded.runtime
48
- const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot()
45
+ // the companion is built from this source tree, so inside the dev checkout it
46
+ // is the one `build:peachsim:cli` copied beside the dev build; an isolated
47
+ // PEACH_HOME serves an installed runtime that predates this source and holds
48
+ // no companion for it
49
+ const monorepoRoot = findMonorepoRoot()
50
+ const root = monorepoRoot
51
+ ? join(monorepoRoot, 'public/sootsim')
52
+ : resolveActiveRuntimeRoot()
49
53
  if (!root) throw new Error('No Peach runtime installed; run `peach runtime install`')
50
54
  verifyCliCompanion(root)
51
55
  const require = createRequire(import.meta.url)